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.

TIMER1 控制 ADC 无效果



你好, 我在用timer1 控制 ADC。 Timer1 设置为 output compare mode on channel 0,  ADC 每次开始是由timer1 channel 0 compare event来控制的。具体代码如下:

  PERCFG &= ~0x40; // peripheral configure 0 
  P0DIR |= 0x04; // P0_2 = output
  P0SEL |= 0x04; // Peripheral function on P0_2
  
  T1CTL = 0x0E;        // modulo
  T1CCTL0 = 0x54;
  T1CC0L = 0xFA; //250 times 0.004ms = 1ms
  T1CC0H = 0x00; 
  
  T1CCTL0 |= 0x40; //enable interrupt
  T1CTL |= 0x10;

ADC的配置如下

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

这样做了之后,ADC一直不工作,不用timer1的话是可以的。但是一用就固定在一个特别的值上面。 请问应该怎么配置呢? 谢谢!