Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 1. (20 points) Write a code that makes the MSP430 blink the red LED and

ID: 1858029 • Letter: Q

Question

QUESTION 1. (20 points)

Write a code that makes the MSP430 blink the red LED and the green LED at the same time. The two LEDs

should be on at the same time and then off at the same time. You can use the same delay as in the code that

we

Explanation / Answer

#include unsigned int i = 0; // Initialize variables. This will keep count of how many cycles between LED toggles void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer. This line of code is needed at the beginning of most MSP430 projects. // This line of code turns off the watchdog timer, which can reset the device after a certain period of time. P1DIR |= 0x01; // P1DIR is a register that configures the direction (DIR) of a port pin as an output or an input. // To set a specific pin as output or input, we write a '1' or '0' on the appropriate bit of the register. // P1DIR = // Since we want to blink the on-board red LED, we want to set the direction of Port 1, Pin 0 (P1.0) as an output // We do that by writing a 1 on the PIN0 bit of the P1DIR register // P1DIR = // P1DIR = 0000 0001 // P1DIR = 0x01 firstnames, mydata->lastname, mydata->city, mydata->empid, mydata->salary ); i++; } /* EOF */ } /* File exists */ /* Print the file */ printf("%s, %s, %s, %s, %s, %s ", headings[40][0], headings[40][1], headings[40][2], headings[40][3], headings[40][4], headings[40][5] ); int j; for (j=0; j
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote