Question
The code should be change so that the msp430 will blink the green led and keep the red led steadily lit.I have debugged thus far
The code should be change so that the msp430 will blink the green led and keep the red led steadily lit.I have debugged thus far to light the red and green led.But cant figure out how to blink the green led. I tried changing the for loop but nothing.
#include /* * Fix this code! You may NOT delete or add code, you may only change values being stored in a variable or register.
*/ void DELAY(); unsigned int CLS(unsigned int x);
unsigned int CRS(unsigned int x);
int main(void) { WDTCTL = WDTPW | WDTHOLD;
volatile unsigned int m = 1;
volatile unsigned int s = 0;
volatile unsigned int p = 65535
; P1DIR |= m; while(s
) { p = CRS(p); P1OUT = p;
DELAY();
}
} void DELAY()
{ volatile unsigned int i = 25;
volatile unsigned int j = 0;
volatile unsigned int k = 1;
volatile unsigned int l = 0;
for(; i > 0; i--)
{ j += 2; k += 2; }
l = CLS(j + k);
}
unsigned int CLS(unsigned int x)
{
return (x << 1) | (x >> 15);
}
unsigned int CRS(unsigned int x)
{ return (x >> 1)| (x << 15); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started