抱歉! 想請教各位先進,如果想使用timer trigger soc 後 觸發EOC 發生 ADC interrupt,timer有需要做什麼特別設定嗎?
目前我是使用timer1 觸發SOC
ADC.c 是這樣設定的
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; // ADCINT trips after AdcResults latch
AdcRegs.INTSEL1N2.bit.INT1CONT = 0;
AdcRegs.INTSEL1N2.bit.INT1E = 1;
AdcRegs.INTSEL1N2.bit.INT1SEL = 2; // EOC2 is Trigger for ADCINT1
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0x02; // ADCINA2
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 2; //Timer1 trigger soc AdcRegs.ADCSOC0CTL.bit.ACQPS = 8;
Timer1 的設定如下:
void Init_Timer1(void)
{
EALLOW;
// Initialize timer period to maximum
CpuTimer1Regs.PRD.all = 0xFFFFFFFF;
// Initialize pre-scale counter to divide by 500 (SYSCLKOUT)
// Cpu timer dived-down every(TDDRH:TDDR+1) (1:F3+1 -> 1F4(500))
CpuTimer1Regs.TPR.all = 0x00F4;
CpuTimer1Regs.TPRH.all = 0x0001;
// Initialize timer period
CpuTimer1Regs.PRD.all = dTimer_PRD – 1;
CpuTimer1Regs.PRD.all = D2D_PWR.Trigger_Point;
// Initialize timer control register
CpuTimer1Regs.TCR.bit.TSS = 1; // 1 = stop timer, 0 = Start / Restart Timer
CpuTimer1Regs.TCR.bit.TRB = 1; // Reload timer counter to PRD
CpuTimer1Regs.TCR.bit.SOFT = 1;
CpuTimer1Regs.TCR.bit.FREE = 1; // Timer Free Run
CpuTimer1Regs.TCR.bit.TIE = 1; // Enable Timer Interrupt
EDIS;
}
但結果還是沒有去trigger soc 發生ADC中斷,謝謝各位的協助和回答!