Datasheet
www.ti.com
Example of Source Code for MSP430 present in the launchpad
P1OUT |= BIT0; // RED LED ON
__delay_cycles(25000); // delay 25ms
P1OUT &= ~BIT0; // Clear P1.0 RED LED Off
//BUTTON S2 configuration
P1REN |= BIT3; // Pull-up resistor enabled
P1IE |= BIT3; // P1.3 interrupt enabled
P1IES |= BIT3; // P1.3 Hi/Lo edge
P1IFG &= ~BIT3; // P1.3 IFG cleared
// WAKE signal
P2IE |= BIT0; // P2.0 interrupt enabled
P2IES &= ~BIT0; // P2.0 Lo/Hi edge
P2IFG &= ~BIT0; // P2.0 IFG cleared
// DONE signal
P2OUT |= BIT4; // Done High
__delay_cycles(100); // delay 100u
P2OUT &= ~BIT4; // Done Low
IE1 |= NMIIE; // Enable NMI
_BIS_SR(LPM4_bits + GIE); // Enter LPM4 with Interrupt enabled
}
#pragma vector=NMI_VECTOR
__interrupt void nmi_ (void)
{
P1OUT |= BIT0; // P1.0 Red Led On
__delay_cycles(200000); // delay 200ms
P1OUT &= ~BIT0; // P1.0 Red Led Off
if (DONE==1)
{
P2OUT |= BIT4; // Done On
__delay_cycles(100); // delay 100us
P2OUT &= ~BIT4; // Done Off
}
IFG1 &= ~NMIIFG; // Re-clear NMI flag in case bounce
IE1 |= NMIIE; // Enable NMI
}
// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
P1OUT |= BIT6; // P1.6 Red Green On
__delay_cycles(200000); // delay 200ms
P1OUT &= ~BIT6; // P1.6 Red Green Off
if (DONE==1)
{
P2OUT |= BIT4; // Done On
__delay_cycles(100); // delay 100us
P2OUT &= ~BIT4; // Done Off
}
P2IES &= ~BIT0; // P1.4 Lo/Hi edge
P2IFG &= ~BIT0; // P1.4 IFG cleared
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
5
SNAU148A–JUNE 2013–Revised JULY 2013 TPL5100EVM User's Guide
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated