Write a program for the msp430FR6989 to make led1 and led 2 alternate blinking 2. repeat the program to make each led blink 5 times in a sequence, then 5 times simultaneously
Hello,
Please find the answer to the
first question (Program 1) attached below. If the answer has helped
you please give a thumbs up rating. Thank you and
have a nice day!
************ C Code for Led 1 and 2 alternate blinking *******
//Demo app to blink LED1 and LED2 on the TI Launchpad
//which is attached to P1.0 and P2.0 respectively
//The green LED(LED2) is connected to P1.6
#include <msp430g2553.h>
int main(void) {
volatile int i;
// stop watchdog timer
WDTCTL = WDTPW | WDTHOLD;
// set up bit 0 and bit 1 of P1 as output
P1DIR = 0x02;
// intialize bit 0 of P1 to 0 and bit 1 to 1
P1OUT = 0x02;
// loop forever
for (;;) {
// toggle bit 0 and bit 1 of P1
P1OUT ^= 0x03;
// delay for a while
for (i = 0; i < 0x6000; i++);
}
}
Get Answers For Free
Most questions answered within 1 hours.