Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

URGENT PLEASE PF4 Question 3 (30 Points): You will be writing a code, which will light the LEDs (connected to PF1-3) with a specific color,

URGENT PLEASE image text in transcribed
PF4 Question 3 (30 Points): You will be writing a code, which will light the LEDs (connected to PF1-3) with a specific color, when a switch 1 (SW1) is pressed. Below is the register list you need: PF1 EQU Ox40025008 ; RED LED PIN PF2 EQU 0x40025010 ; BLUE LED PIN PF3 EQU 0x40025020 ; GREEN LED PIN EQU Ox40025040 ;SWI PIN GPIO_PORTF_DATA_R EQU 0x400253FC ; PORTE Data Register a) (12 Points) Assuming that Port F is properly initialized, write 4 separate subroutines: Redon, which would turn the Red LED on, when called. BlueOn, which would turn the Blue LED on, when called. Greenon, which would turn the Green LED on, when called. LEDsOff, turn all LEDs off. b) (8 Points) Write a subroutine BusyWaitswi, which would busy-wait for SW1 to be pressed. In other words, when this subroutine is called, it will not return until SW1 is pressed. c) (10 Points) Write a subroutine Yellowish which is simple an infinite loop that creates the color yellow on LEDs. However, the brightness of this yellow color is designated by the value inside RO. If RO is 1 (one), then it is at minimum brightness; and if it is 100, it is at maximum brightness. This subroutine is a no-return subroutine. In other words, when you call it, the infinite loop will not allow it to return. Hint: Yellow is Red + Green, no Blues. And you may have to use the subroutines you have written in a). PF4 Question 3 (30 Points): You will be writing a code, which will light the LEDs (connected to PF1-3) with a specific color, when a switch 1 (SW1) is pressed. Below is the register list you need: PF1 EQU Ox40025008 ; RED LED PIN PF2 EQU 0x40025010 ; BLUE LED PIN PF3 EQU 0x40025020 ; GREEN LED PIN EQU Ox40025040 ;SWI PIN GPIO_PORTF_DATA_R EQU 0x400253FC ; PORTE Data Register a) (12 Points) Assuming that Port F is properly initialized, write 4 separate subroutines: Redon, which would turn the Red LED on, when called. BlueOn, which would turn the Blue LED on, when called. Greenon, which would turn the Green LED on, when called. LEDsOff, turn all LEDs off. b) (8 Points) Write a subroutine BusyWaitswi, which would busy-wait for SW1 to be pressed. In other words, when this subroutine is called, it will not return until SW1 is pressed. c) (10 Points) Write a subroutine Yellowish which is simple an infinite loop that creates the color yellow on LEDs. However, the brightness of this yellow color is designated by the value inside RO. If RO is 1 (one), then it is at minimum brightness; and if it is 100, it is at maximum brightness. This subroutine is a no-return subroutine. In other words, when you call it, the infinite loop will not allow it to return. Hint: Yellow is Red + Green, no Blues. And you may have to use the subroutines you have written in a)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Alpine Cupcakes Audit Case With Data Analytics

Authors: Carol Callaway Dee, Mary P.Mindak

2nd Edition

1618533231, 978-1618533234

More Books

Students also viewed these Accounting questions