Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please read the question and its hints very well. Use the skeleton program as instructed and modify the lines in red color. Any submitted program

Please read the question and its hints very well. Use the skeleton program as instructed and modify the lines in red color. Any submitted program that is not based on the provided skeleton will not be accepted.
The following program is the simple I/O sample program we discussed in class. The code is posted under Modules. Basically when the switch is open, LED1 toggles, and when switch is closed, LED2 toggles.
Modify the program, so that at the push of the button, the micro cycles through 4 different modes of operation. The areas to be modified are marked below in red.
Hint: use a counting semaphore (1-3), which is incremented whenever the switch is closed, and it resets to 1 when it reaches value >=4. When the switch is open, the software uses a case statement to execute the 4 different modes of operations based on the semaphore value as follows:
value 1; LED1 flashes while LED2 off
value 2; LED2 flashes while LED1 off
value 3; LED1 and LED2 flash simultaneously
value 4: LED1 and LED alternate
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions