Question: Hello, I need help with the MSP430. The following program is the simple LO sample program (Ch8) we discussed in class. Basically when you push

Hello, I need help with the MSP430.

Hello, I need help with the MSP430. The following program is the

The following program is the simple LO sample program (Ch8) we discussed in class. Basically when you push the button, LEDI 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 off 2-LED2 flashes while LED1 off 3-LED1 and LED2 flash simultaneously 4-LED1 and LED2 flash alternatively Hint: use a counting semaphore to cycle through 4 different values, each of which corresponds to the four different modes #include #include ''Insp430g2553.h" int sw2-0; int main(void) WDTCTL = WDTPW | WDTHOLD; //stop watchdog time. P I DIR = 0x00; PIDIR(BITO BIT6); PIREN BIT3; PIOUT FBIT3; //port 1 all inputs /set P1.0 and P1.6 as outputs (LED1, LED2) //activate resister on P1.3 //make it pull up because SW2 is active low For () { sw2 = PIN /read values from Pl //mask out only BIT3 where SW2 is connected sw2 &BIT3; if (sw2BIT3) //if SW2 is high //turn LED2 off /toggle LEDI /delay 50,000 micro seconds PIOUTBITO; _delay_cycles(50000); else PIOUT &=-BIT); PI OUT-BIT6; -delay-cycles( 200000); //else (SW2 is low) //turn LEDI off //toggle LED2 /delay 200,000 micro seconds // end of infinite loop //end of main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!