Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 19:00, nayo2006
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
Answers: 2
image
Computers and Technology, 23.06.2019 20:40, bobby3350
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
image
Computers and Technology, 24.06.2019 08:30, 5theth
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
image
Computers and Technology, 24.06.2019 11:30, nate1808
What does the https: // mean when you type in a website
Answers: 1
Do you know the correct answer?
He following program is the simple i/o sample program (ch8) we discussed in class. basically when yo...

Questions in other subjects:

Konu
Chemistry, 10.01.2021 02:40