hello sir,
i had to try to form a 2 sec timer counter interrupt , but it wont work . it only happen 2 sec delay . but i need to when i hold the button at the time timer will count 2 sec and then led will blink . that code i will attached here. please give need full solution.
#include <msp430g2553.h>
void main(void)
{
WDTCTL = WDTPW|WDTHOLD;
P1OUT &= 0x00;
P1DIR &= 0x00;
P1DIR |= BIT6;
P1REN |= BIT3;
P1OUT |= BIT3;
P1IE |= BIT3;
P1IFG &= ~BIT3;
P1IES |= BIT3;
TACTL |= TASSEL_1;
TACTL |= MC_0;
_BIS_SR( GIE );
while(1)
{}
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
unsigned char in_prt;
P1IFG &= ~BIT3;
P1IES ^= BIT3;
in_prt = P1IN & BIT3;
if(in_prt > 0)
{
TACCR0 = 24000;
TACTL |= TASSEL_1;
TACTL ^= MC_3;
TACCTL0 |= CM_1;
TACCTL0 |= CCIE;
}
else
{
TACTL &= ~MC_1;
//TACCTL0 &= ~CCIE;
}
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void timer_A0(void)
{
P1OUT ^= BIT6;
TACTL &= ~MC_1;
TACCTL0 &= ~CCIE;
}