0% found this document useful (0 votes)
8 views1 page

Blink Led

This document describes a demo program for the MSP430 microcontroller that toggles an LED connected to pin P1.0 using a software loop. The program initializes the watchdog timer, configures the GPIO settings, and continuously toggles the LED state with a delay. The code is intended for use with Texas Instruments' MSP430x5xx series microcontrollers.

Uploaded by

cookpad student
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Blink Led

This document describes a demo program for the MSP430 microcontroller that toggles an LED connected to pin P1.0 using a software loop. The program initializes the watchdog timer, configures the GPIO settings, and continuously toggles the LED state with a delay. The code is intended for use with Texas Instruments' MSP430x5xx series microcontrollers.

Uploaded by

cookpad student
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

//

***********************************************************************************
****
// MSP430 Blink the LED Demo - Software Toggle P1.0
//
// Description; Toggle P1.0 by xor'ing P1.0 inside of a software loop.
// ACLK = n/a, MCLK = SMCLK = default DCO
//
// MSP430x5xx
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// | P1.0|-->LED
//
// Texas Instruments, Inc
// July 2013
//
***********************************************************************************
****

#include <msp430.h>

void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default
high-impedance mode
// to activate previously configured
port settings
P1DIR |= 0x01; // Set P1.0 to output direction

for(;;) {
volatile unsigned int i; // volatile to prevent optimization

P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR

i = 100000; // SW Delay
do i--;
while(i != 0);
}
}

You might also like