28035,开发板示例代码采用同步采样方式,我改成顺序采样,结果不进入中断服务子程序,这个问题已经折磨我好几天了,请大神们看一下。代码如下:
void Motor_ADC_Config(void)
{
InitAdc(); // For this example, init the ADC
EALLOW; // This is needed to write to EALLOW protected register
PieVectTable.ADCINT1 = &adc_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // Enable INT 1.1 in the PIE
IER |= M_INT1; // Enable CPU Interrupt 1
// Configure ADC
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; //REF Int
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; //ADCINT1 trips after AdcResults latch
AdcRegs.INTSEL1N2.bit.INT1E = 1; //Enabled ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; //Disable ADCINT1 Continuous mode,single conversion mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 1; //setup EOC1 to trigger ADCINT1 to fire , EOC1 is trigger for ADCINTx
//Sequential sampling enable for SOC0/SOC1
AdcRegs.ADCSAMPLEMODE.bit.SIMULEN0 = 0; //SOC0/1 Sequential Sampling Enable ,SOC0与SOC1独立工作
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; //SOC0 ,配置模拟通道连接
AdcRegs.ADCSOC1CTL.bit.CHSEL = 8; //SOC1 ,配置模拟通道连接
//AdcRegs.ADCSAMPLEMODE.bit.SIMULEN0=1; //SOC0与SOC1
//AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; //SOC0 ,配置模拟通道连接
//AdcRegs.ADCSOC1CTL.bit.CHSEL = 1; //SOC1 ,配置模拟通道连接
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 0x00; //ADCTRIG0- Software only
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 0x00;
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; //set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
EDIS;
}
//-------------------------------------------------------------------------
//AD 中断处理函数
//
//##########################################################################
interrupt void adc_isr(void)
{
EALLOW;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
EDIS;
AdcRegs.ADCINT**CLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize for next SOC
} |