Hello,
I am using the cc430f5137 with CCS5 and I am plannign to sample the ADC at 20Hz and using Timer1 in up_mode.
So,the timer1 TA1R should count upto the value of 52428 value I guess.But when a breakpoint was placed at
ADC12CTL0 |= ADC12SC; the Register TA1R in timer1_A3 is showing only the values like 9,24,46,60 but it is not reaching the value of 52428(not even >100)
The main lines of code are
Smclk=1048576.
void main( void )
{
// Initialize ADC12_A to sample ADC_channel_3
REFCTL0 = REFON;
REFCTL0&=~REFMSTR;
ADC12CTL0 = ADC12SHT0_4 + ADC12REFON + ADC12REF2_5V+ADC12ON;
ADC12CTL1 = ADC12SSEL_3+ ADC12SHS_0 + ADC12SHP ;
ADC12CTL2 = ADC12RES_2;
ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_3;
P2SEL = BIT3;
ADC12IE = ADC12IE0;
ADC12CTL0 |= ADC12ENC;
TA1CCR0 = Smclk/(20) - 1;
TA1CCTL0 = CCIE;
TA1CTL = TASSEL_2 + MC_1 + TACLR;
while (1)
{
if(samples==19)
{
samples=0;
}
else
{
samples=samples+1;
}
__bis_SR_register(CPUOFF + GIE);//CPU OFF mode
}
}
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR(void)
{
result=ADC12MEM0;
__bic_SR_register_on_exit(CPUOFF);
}
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
ADC12CTL0 |= ADC12SC; // Toggle P1.0
}
can someone explain the problem associated with this and how to check the Timer coutner value.
Thanks.