This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC triggered by timer1 not working.

Dear All, i am writing code to use timer1 trigger ADC. But the ADC never starts.

I set the timer1 channel 0 output compare mode and ADC trigger by timer1 channel 0 compare event. All i have done is this: 

P0DIR |= 0x04; // P0_2 = output
P0SEL |= 0x04; // Peripheral function on P0_2

T1CTL = 0x0E;

T1CCTL0 = 0x14;
T1CC0L = 0xFA; //250 times 0.004ms = 1ms
T1CC0H = 0x00;

T1CCTL0 |= 0x40; //enable interrupt


T1CNTL = 0x01; // write T1CC0 and start the timer from 0x0000

APCFG |= 0xF3;
AdcInit();

void AdcInit(void)// interal temp sensor
{
ADCCON1 = 0x23;// triggered by timer1 channel 0
ADCCON3 = 0x3e;// temp sensor
TR0 = 0x01;
ATEST = 0x01;
}

What can be the problem? Or do i need to do something on the hardware. But i only see ADC will start when timer1 channel 0 compare event happens. Thanks in advance!