TI中文支持网
TI专业的中文技术问题搜集分享网站

28377D的16bitAD,SOC0的值会串到SOC1

        如下的配置,16bit差分模式,ADC的中断是24KHZ,每24KHZ读一次AD的全部15个数据,现发现ADCA的SOC0加一个电压,ADCA的SOC1是没有加电压的,结果SOC0结果寄存器上读的值却会受到SOC1上的值影响,这是为什么呢?个人理解是SOC0切换到SOC1的过程太快,带有部分的电压值切了过去(大概这样表达),如果是这样,哪里可以配置的呢?十分紧急,谢谢!

void InitAdc(void)
{
 Uint16 acqps;

 EALLOW;

    //
    //write configurations
    //ADCCLK: PRESCALE*0.5+1
    //
    AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcbRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdccRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcdRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4

    AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCB, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCC, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCD, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);

    //
    //Set pulse positions to late
    //1 Interrupt pulse generation occurs at the end of the conversion
    //
    AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;

    //
    //power up the ADC
    //
    AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;

    //
    //delay for 1ms to allow ADC time to power up
    //
    DELAY_US(1000);

    EDIS;

    //
    //determine minimum acquisition window (in SYSCLKS) based on resolution
    //acquisition window duration is based on the System Clock,not the ADC clock(ADCCLK)
    //duration=(acqps+1)*(1/SYSCLK)
    //
 if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
    {
        acqps = 14; //75ns
    }
    else //resolution is 16-bit
    {
        acqps = 63; //320ns
    }

    //
    //Select the channels to convert and end of conversion flag
    //acquisition window duration is based on the System Clock,not the ADC clock(ADCCLK)
 //duration=(acqps+1)*(1/SYSCLK)
    //
    EALLOW;

    //ADCIN1P&ADCIN1N VIN-4
    AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin A0&A1
    AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN2P&ADCIN2N VIN-3
    AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin A2&A3
    AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN3P&ADCIN3N VIN-2
    AdcaRegs.ADCSOC2CTL.bit.CHSEL = 4;  //SOC2 will convert pin A4&A5
    AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN4P&ADCIN4N VOUT-2
    AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin B0&B1
    AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN5P&ADCIN5N VOUT-3
    AdcbRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin B2&B3
    AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN6P&ADCIN6N VIN-1
    AdccRegs.ADCSOC0CTL.bit.CHSEL = 2;  //SOC0 will convert pin C2&C3
    AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdccRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN7P&ADCIN7N VOUT-1
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 14;  //SOC1 will convert pin C14&C15
    AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdccRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN8P&ADCIN8N VOUT-4
    AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin D0&D1
    AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN9P&ADCIN9N VOUT-M
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin D2&D3
    AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    //epwm→AD INT 4分频,SOC2
    AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 2; //end of SOC2 will set INT1 flag,看前面使用到几个SOC
    AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable ADCINT1
    AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared

    EDIS;
}

//24K进入一次

interrupt void  ADCINT_ISR(void)     // ADC
{
 DINT;

     ArrayOfReceiveAdValue[SN_OF_V_IN_CH1]=(int32)AdccResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH2]=(int32)AdcaResultRegs.ADCRESULT2;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH3]=(int32)AdcaResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH4]=(int32)AdcaResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH1]=(int32)AdccResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH2]=(int32)AdcbResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH3]=(int32)AdcbResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH4]=(int32)AdcdResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_M]=(int32)AdcdResultRegs.ADCRESULT1;

 AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //clear INT1 flag
    PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1;

    EINT;
}

mangui zhang:

高速AD中各通道之间都讲隔离度这个参数,是不是硬件上串扰过去的,采集过程中不应该有相关联系

建议你测一下送到AD端口的两路信号是否有影响

        如下的配置,16bit差分模式,ADC的中断是24KHZ,每24KHZ读一次AD的全部15个数据,现发现ADCA的SOC0加一个电压,ADCA的SOC1是没有加电压的,结果SOC0结果寄存器上读的值却会受到SOC1上的值影响,这是为什么呢?个人理解是SOC0切换到SOC1的过程太快,带有部分的电压值切了过去(大概这样表达),如果是这样,哪里可以配置的呢?十分紧急,谢谢!

void InitAdc(void)
{
 Uint16 acqps;

 EALLOW;

    //
    //write configurations
    //ADCCLK: PRESCALE*0.5+1
    //
    AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcbRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdccRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcdRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4

    AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCB, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCC, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCD, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);

    //
    //Set pulse positions to late
    //1 Interrupt pulse generation occurs at the end of the conversion
    //
    AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;

    //
    //power up the ADC
    //
    AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;

    //
    //delay for 1ms to allow ADC time to power up
    //
    DELAY_US(1000);

    EDIS;

    //
    //determine minimum acquisition window (in SYSCLKS) based on resolution
    //acquisition window duration is based on the System Clock,not the ADC clock(ADCCLK)
    //duration=(acqps+1)*(1/SYSCLK)
    //
 if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
    {
        acqps = 14; //75ns
    }
    else //resolution is 16-bit
    {
        acqps = 63; //320ns
    }

    //
    //Select the channels to convert and end of conversion flag
    //acquisition window duration is based on the System Clock,not the ADC clock(ADCCLK)
 //duration=(acqps+1)*(1/SYSCLK)
    //
    EALLOW;

    //ADCIN1P&ADCIN1N VIN-4
    AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin A0&A1
    AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN2P&ADCIN2N VIN-3
    AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin A2&A3
    AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN3P&ADCIN3N VIN-2
    AdcaRegs.ADCSOC2CTL.bit.CHSEL = 4;  //SOC2 will convert pin A4&A5
    AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN4P&ADCIN4N VOUT-2
    AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin B0&B1
    AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN5P&ADCIN5N VOUT-3
    AdcbRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin B2&B3
    AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN6P&ADCIN6N VIN-1
    AdccRegs.ADCSOC0CTL.bit.CHSEL = 2;  //SOC0 will convert pin C2&C3
    AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdccRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN7P&ADCIN7N VOUT-1
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 14;  //SOC1 will convert pin C14&C15
    AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdccRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN8P&ADCIN8N VOUT-4
    AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin D0&D1
    AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN9P&ADCIN9N VOUT-M
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin D2&D3
    AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    //epwm→AD INT 4分频,SOC2
    AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 2; //end of SOC2 will set INT1 flag,看前面使用到几个SOC
    AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable ADCINT1
    AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared

    EDIS;
}

//24K进入一次

interrupt void  ADCINT_ISR(void)     // ADC
{
 DINT;

     ArrayOfReceiveAdValue[SN_OF_V_IN_CH1]=(int32)AdccResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH2]=(int32)AdcaResultRegs.ADCRESULT2;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH3]=(int32)AdcaResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH4]=(int32)AdcaResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH1]=(int32)AdccResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH2]=(int32)AdcbResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH3]=(int32)AdcbResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH4]=(int32)AdcdResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_M]=(int32)AdcdResultRegs.ADCRESULT1;

 AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //clear INT1 flag
    PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1;

    EINT;
}

user4661451:

回复 mangui zhang:

我关闭了其他路所有的转换,SOC1的结果就是0,不会受到SOC0给定值的影响。

        如下的配置,16bit差分模式,ADC的中断是24KHZ,每24KHZ读一次AD的全部15个数据,现发现ADCA的SOC0加一个电压,ADCA的SOC1是没有加电压的,结果SOC0结果寄存器上读的值却会受到SOC1上的值影响,这是为什么呢?个人理解是SOC0切换到SOC1的过程太快,带有部分的电压值切了过去(大概这样表达),如果是这样,哪里可以配置的呢?十分紧急,谢谢!

void InitAdc(void)
{
 Uint16 acqps;

 EALLOW;

    //
    //write configurations
    //ADCCLK: PRESCALE*0.5+1
    //
    AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcbRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdccRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    AdcdRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4

    AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCB, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCC, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);
    AdcSetMode(ADC_ADCD, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL);

    //
    //Set pulse positions to late
    //1 Interrupt pulse generation occurs at the end of the conversion
    //
    AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1;

    //
    //power up the ADC
    //
    AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1;

    //
    //delay for 1ms to allow ADC time to power up
    //
    DELAY_US(1000);

    EDIS;

    //
    //determine minimum acquisition window (in SYSCLKS) based on resolution
    //acquisition window duration is based on the System Clock,not the ADC clock(ADCCLK)
    //duration=(acqps+1)*(1/SYSCLK)
    //
 if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
    {
        acqps = 14; //75ns
    }
    else //resolution is 16-bit
    {
        acqps = 63; //320ns
    }

    //
    //Select the channels to convert and end of conversion flag
    //acquisition window duration is based on the System Clock,not the ADC clock(ADCCLK)
 //duration=(acqps+1)*(1/SYSCLK)
    //
    EALLOW;

    //ADCIN1P&ADCIN1N VIN-4
    AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin A0&A1
    AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN2P&ADCIN2N VIN-3
    AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin A2&A3
    AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN3P&ADCIN3N VIN-2
    AdcaRegs.ADCSOC2CTL.bit.CHSEL = 4;  //SOC2 will convert pin A4&A5
    AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN4P&ADCIN4N VOUT-2
    AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin B0&B1
    AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN5P&ADCIN5N VOUT-3
    AdcbRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin B2&B3
    AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN6P&ADCIN6N VIN-1
    AdccRegs.ADCSOC0CTL.bit.CHSEL = 2;  //SOC0 will convert pin C2&C3
    AdccRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdccRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN7P&ADCIN7N VOUT-1
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 14;  //SOC1 will convert pin C14&C15
    AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdccRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN8P&ADCIN8N VOUT-4
    AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0;  //SOC0 will convert pin D0&D1
    AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C
    //ADCIN9P&ADCIN9N VOUT-M
    AdcdRegs.ADCSOC1CTL.bit.CHSEL = 2;  //SOC1 will convert pin D2&D3
    AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps+1 SYSCLK cycles
    AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    //epwm→AD INT 4分频,SOC2
    AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 2; //end of SOC2 will set INT1 flag,看前面使用到几个SOC
    AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable ADCINT1
    AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared

    EDIS;
}

//24K进入一次

interrupt void  ADCINT_ISR(void)     // ADC
{
 DINT;

     ArrayOfReceiveAdValue[SN_OF_V_IN_CH1]=(int32)AdccResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH2]=(int32)AdcaResultRegs.ADCRESULT2;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH3]=(int32)AdcaResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_IN_CH4]=(int32)AdcaResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH1]=(int32)AdccResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH2]=(int32)AdcbResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH3]=(int32)AdcbResultRegs.ADCRESULT1;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_CH4]=(int32)AdcdResultRegs.ADCRESULT0;
     ArrayOfReceiveAdValue[SN_OF_V_OUT_M]=(int32)AdcdResultRegs.ADCRESULT1;

 AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //clear INT1 flag
    PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1;

    EINT;
}

user4661451:

回复 mangui zhang:

我还试着将当前ADCA SOC1转换的目标换成ADCD SOC2,结果也是不受ADCA SOC0影响,然后我在ADCD SOC1加电压值,结果就会受到影响,在ADCD SOC0加电压值,结果不会受到影响,结果也就是同一个转换器前一级转换的目标值会影响下一级转换的结果。

赞(0)
未经允许不得转载:TI中文支持网 » 28377D的16bitAD,SOC0的值会串到SOC1
分享到: 更多 (0)