subject

He following program is the simple i/o sample program (ch8) we discussed in class. basically when you push the button, led1 toggles, and when you release it, led2 toggles. modify the program, so that at the push of the button, the micro cycles through 4 different as follows: 1- led1 flashes while led2 off2- led2 flashes while led1 off3- led1 and led2 flash simultaneously4- led1 and led2 flash alternativelyhint: use a counting semaphore to cycle through 4 different values, each of which corresponds to the four different modes, see the other sample code for flasher with multiple speeds.#include #include "msp430g2553.h"int sw2=0; int main(void){wdtctl = wdtpw | wdthold; //stop watchdog timerp1dir = 0x00; //port 1 all inputsp1dir |= (bit0 | bit6); //set p1.0 and p1.6 as outputs (led1, led2)p1ren |= bit3; //activate resister on p1.3p1out |= bit3; //make it pull up because sw2 is active lowfor (; ; ){sw2 = p1in; //read values from p1sw2 & = bit3; //mask out only bit3 wheresw2 is connectedif (sw2 == bit3){ //if sw2 is highp1out & = ~bit6; //turn led2 offp1out ^= bit0; //toggleled1 __delay_cycles(5); //delay 50,000 micro seconds}else{ //else (sw2 is low)p1out & = ~bit0; //turn led1 offp1out ^= bit6; //toggle led2__delay_cycles(2); //delay 200,000 micro seconds}}// end of infinite loop}//end of main

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
Using the list, you can select the number of photos that will appear on each slide. a. theme b. frame shape c. pictures in album d. picture layout
Answers: 1
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
You know the right answer?
He following program is the simple i/o sample program (ch8) we discussed in class. basically when yo...
Questions
question
Mathematics, 08.03.2021 19:40
question
English, 08.03.2021 19:40
question
Mathematics, 08.03.2021 19:40
question
World Languages, 08.03.2021 19:40
Questions on the website: 13722367