Question

In: Electrical Engineering

1. write a program for the msp430fr6989 that will light LED1, whenever S1 is pressed. It...

1. write a program for the msp430fr6989 that will light LED1, whenever S1 is pressed. It should turn off whenever S1 is released. 2. Write a program that will make LED1 blink 5 times when S1 is pressed, and then stop.

Solutions

Expert Solution

1.

#include <msp430fr6989.h> // For the M430FR6989 chip,

void main(void)

{

        WDTCTL = WDTPW + WDTHOLD;               // Stop watchdog timer

        P1REN |= 0x08;                          //Turn on PullUp on????? How do you turn it off?

        P1DIR &= ~BIT3;                         // Push Port 1 P1.3 (push button) as input

        //P1OUT &= 0x08;                         // Pull down resistor???

        P1DIR |= BIT6;                          // Set (LED) to output direction

        P1SEL &= ~(BIT3 | BIT6);                // Select (push button)

        

        P1OUT &= ~BIT6;                         // Set the LED off

        int value = P1IN & BIT3;

        while( 1 ) {

                if( value == 0)         // Push button down when bit 3 == 0

                        P1OUT |= BIT6;          // Set LED on when button down

                else

                        P1OUT &= ~BIT6;         // Set LED off when button off

        }

}

2.

#include <msp430fr6989.h>
int main(void) {
volatile int i;
// stop watchdog timer
WDTCTL = WDTPW | WDTHOLD;
// set up bit 0 of P1 as output
P1DIR = 0x01;
// intialize bit 0 of P1 to 0
P1OUT = 0x00;
// loop forever
for (;;) {
// toggle bit 0 of P1
P1OUT ^= 0x01;
// delay for a while
for (i = 0; i < 0x6000; i++);

}

}


Related Solutions

using code composer studio 1. write a program for the msp430fr6989 that will light LED1, whenever...
using code composer studio 1. write a program for the msp430fr6989 that will light LED1, whenever S1 is pressed. It should turn off whenever S1 is released. 2. Write a program that will make LED1 blink 5 times when S1 is pressed, and then stop.
For the mspfr6989 write program #2 1(b) Write a program that will make LED1 blink 5...
For the mspfr6989 write program #2 1(b) Write a program that will make LED1 blink 5 times when S1 is pressed, and then stop. Program #2 – Using both S1 and S2 1 Write a program like 1(b) above, but the LED1 will blink until S2 is pressed. 2 Write a program that simulates a motor coming up to speed. When S1 is pressed, LED1 blinks at 50% duty cycle for 10 cycles (indicating a motor coming up to speed)....
1.. Write a code that LED1 (Red LED- P1.0) turns ON when after you push S1(push...
1.. Write a code that LED1 (Red LED- P1.0) turns ON when after you push S1(push button - P1.1) five times and stays OFF forever after that. 2.. Write a code that LED1 (Red LED- P1.0) turns OFF and LED2 (Red LED- P9.7) Turns ON after you push S1(push button -P1.1) five times and they stay that way forever.
4. Write a code that S1(push button -P1.1) turns LED1 (Red LED- P1.0) ON and stays...
4. Write a code that S1(push button -P1.1) turns LED1 (Red LED- P1.0) ON and stays on when you push once and turns off and stays OFF when you push 3 times. This should repeat forever. 5. Write a code that S2(push button -P1.2) turns LED2 (Red LED- P9.7) ON and stays ON when you push once and turns OFF and stays OFF when you push 3 times. This should repeat five times. 6. Write a code that LED2 (Red...
1.write a program for the msp430FR6989 to make led 1 blink at 50 percent duty cycle....
1.write a program for the msp430FR6989 to make led 1 blink at 50 percent duty cycle. 2 modify the program to make led 1 blink 5 times, make a long pause, then blink 5 more times then stop. The time delays should be carried out in subroutines
write a program for the msp430fr6989 Using the general purpose timer, specifically the ACLK, create a...
write a program for the msp430fr6989 Using the general purpose timer, specifically the ACLK, create a program which makes LED1 stay on for 4 seconds and off for 2 seconds and repeat indefinitely. Modify the above program to extend the timing to 20 and 10 seconds, respectively.
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code that transmits a single character and lights the red LED upon receiving that character. The board will "talk" to itself. The green LED should turn on whenever a message is sent and the LCD will display the message being received.
a) Create a program for the msp430FR6989 .You will use need to program it to be...
a) Create a program for the msp430FR6989 .You will use need to program it to be able to use a external pulse switch to start/stop the blinking of LED1, and a second pulse switch to control the blinking of LED2. b) Modify Program #1 (b) to blink the number of times on the data switches once the pulse switch is engaged
Write a program for the msp430 to make led1 and led 2 alternate blinking 2. repeat...
Write a program for the msp430 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
A block of mass m is pressed against a light spring by a distance d and...
A block of mass m is pressed against a light spring by a distance d and is kept at rest (Fig. 1). The spring, of elastic constant k, is released and the block is thrown on a horizontal surface without friction. The smooth surface curves upward and the block rises. Calculate your speed when you have climbed a height h. (Express v as a function of k, m, d, h and g).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT