THIS MY CODE:
unsigned int buffer[20];
unsigned char i=0;
void main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
{
while(1); // If calibration constants erased
// do not load, trap CPU!!
}
BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz
DCOCTL = CALDCO_1MHZ;
InitializeLcm();
P1SEL |= BIT1; // P1.1 CCI0A
TACTL = TASSEL_2 + MC_2 + ID_3; // SMCLK, contmode
TACCTL0 = CM_1+CCIS_0+SCS+CAP+CCIE;
CCTL1 = CCIE; // Habilita interrupção do Timer A...
CCR1 = 31250; // ... a cada 31.250 ciclos ...
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
}
#pragma vector=TIMERA1_VECTOR
__interrupt void TimerA1(void)
{
LcmSetCursorPosition(1,0);
printDecimal(i);
i = 0;
CCR1 += 31250;
}
#pragma vector=TIMERA0_VECTOR
__interrupt void TimerA0(void)
{
buffer[i++] = TACCR0;
if (i>10)
__no_operation(); // PLACE BREAKPOINT HERE
// VIEW 'BUFFER' VARIABLE
}
----------------------
I am trying to one frequency counter, in this code, the counter read the value of i, set = 0 and restart the count of pulses
but don´t work... :(
-------------------------------