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 05:10
Read the code below. what will the computer print if the input for year_variable is 1700? if year_variable == 1776: print("your answer is correct. the declaration of independence was signed in “year_variable”.") elif year_variable < 1776: compute_variable = 1776 - year_variable. print("add “compute_variable“ years to your answer for the correct answer.") elif year_variable > 1776: compute_variable = year_variable - 1776 print("subtract “compute_variable” years from your answer for the correct answer.")
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
What can you prevent issues related to downloading content form the internet
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
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, 10.12.2020 23:10
question
Social Studies, 10.12.2020 23:10
question
English, 10.12.2020 23:10
question
Mathematics, 10.12.2020 23:10
Questions on the website: 13722361