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 09:50
What is a rush associated with alcohol?
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select “state” under field name, then type in the state name under “equal to”
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
Pressing the backspace key deletes the text to the of the insertion point. the left or the right?
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
Acontact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. write a program that first takes in word pairs that consist of a name and a phone number (both strings). that list is followed by a name, and your program should output that name's phone number.
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, 04.11.2020 19:00
Questions on the website: 13722363