I have been trying to figure this one out.
I want to run an interrupt upon a trigger from an input, in the interrupt it will cause a pin to go high. I want to make this function as the interrupt will be reset by another input or by a set time. This is the code that I have found and attempted to change to work with the MSP430G2553, but I can not get it to work. What do I need to do to get this to work ?
Thanks!!!!
#include "msp430g2553.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
TA0CCTL0=CCIE; // CCR0 interrupt enabled
TA0CTL = TASSEL_2+MC_1+ID_3; // SMCLK/8, upmode
TA0CCR0=10000; // 12.5 Hz
P1OUT &= 0x00; // Shut down everything
P1DIR &= 0x00;
P1DIR |= BIT0 + BIT6; // P1.0 and P1.6 pins output the rest are input
P1REN |= BIT3; // Enable internal pull-up/down resistors
P1OUT |= BIT3; //Select pull-up mode for P1.3
P1IE |= BIT3; // P1.3 interrupt enabled
P1IES &= ~BIT3; // P1.3 Hi/lo edge
P1IFG &= ~BIT3; // P1.3 IFG cleared
_BIS_SR(CPUOFF + GIE); // Enter LPM0 w/ interrupt
while(1) //Loop forever, we work with interrupts!
{}
}
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
P1OUT ^= BIT0; // Toggle P1.0
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1OUT ^= BIT6; // Toggle P1.6
P1IFG &= ~BIT3; // P1.3 IFG cleared
}