Other Parts Discussed in Thread: CC430F5137
Hello,
I was using timer0 with SMCLK and was working well with the ADC sampling when checked with a breapoint placed at result=ADC12MEM0; but when I tried to use Timer1 inplace of Timer0 it is not working and the code is shown below with timer1
void main( void )
{
WDTCTL = WDTPW | WDTHOLD;
REFCTL0 = REFON;//RefMaster;Internal REF_ON
REFCTL0&=~REFMSTR;
ADC12CTL0 = ADC12SHT0_4 + ADC12REFON + ADC12REF2_5V+ADC12ON;
ADC12CTL1 = ADC12SSEL_3+ ADC12SHS_1 + ADC12SHP ;
ADC12CTL2 = ADC12PDIV + ADC12RES_2;
ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_3;
P2SEL = BIT3;
ADC12IE = ADC12IE0;
ADC12CTL0 |= ADC12ENC;
TA1CCR0 = Smclk/(100) - 1;
TA1CCR1 = TA0CCR0 - 20;
TA1CCTL1 = OUTMOD_3;
TA1CTL = TASSEL_2 + MC_1;
{
ADC12CTL0 |= ADC12SC;
__bis_SR_register(CPUOFF + GIE);
}
}
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR(void)
{
result=ADC12MEM0;//placed a breakpoint here
__bic_SR_register_on_exit(CPUOFF);
}
Original working code is having Timer0 in place of Timer1 in these lines in the above shown code
TA0CCR0 = Smclk/(100) - 1; TA0CCR1 = TA0CCR0 - 20; TA0CCTL1 = OUTMOD_3; TA0CTL = TASSEL_2 + MC_1;
can someone help out in finding tthe problem of why the timer1 is not working if it was working timer0.
Thnkas.