AD采样通道顺序不同采样结果不同 这两段程序配置完全相同,只是顺序不同
用第一个程序采样正常,屏蔽第一段用第二个 采样 有偏差。偏差达到40左右
请问这是什么原因??先谢谢了
程序如下:
/*AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //set SOC0 电感电流 ADCINA6
AdcRegs.ADCSOC1CTL.bit.CHSEL = 9; //set SOC1 超容侧电压 ADCINB1
AdcRegs.ADCSOC2CTL.bit.CHSEL = 1; //set SOC2 输出侧电压 ADCINA1
AdcRegs.ADCSOC3CTL.bit.CHSEL = 15; //set SOC3 温度 ADCINB7
AdcRegs.ADCSOC4CTL.bit.CHSEL = 11; //set SOC4 二极管前端电压 ADCINB3
AdcRegs.ADCSOC5CTL.bit.CHSEL = 4; //set SOC5 电感电流I1 ADCINA4
AdcRegs.ADCSOC6CTL.bit.CHSEL = 7; //set SOC6 电感电流I2 ADCINA7
AdcRegs.ADCSOC7CTL.bit.CHSEL = 3; //set SOC7 电感电流I3 ADCINA3
AdcRegs.ADCSOC8CTL.bit.CHSEL = 0; //1.65V采样
*/
AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //set 电感电流 ADCINA6
AdcRegs.ADCSOC1CTL.bit.CHSEL = 4; //set 电感电流 ADCINA4
AdcRegs.ADCSOC2CTL.bit.CHSEL = 7; //set 电感电流 ADCINA7
AdcRegs.ADCSOC3CTL.bit.CHSEL = 3; //set 电感电流 ADCINA3
AdcRegs.ADCSOC4CTL.bit.CHSEL = 1; //set 输出侧电压 ADCINA1
AdcRegs.ADCSOC5CTL.bit.CHSEL = 0; //set 1.65V ADCINA0
AdcRegs.ADCSOC6CTL.bit.CHSEL = 9; //set 超容侧电压 ADCINB1
AdcRegs.ADCSOC7CTL.bit.CHSEL = 11; //set 二极管前端电压 ADCINB3
AdcRegs.ADCSOC8CTL.bit.CHSEL = 15; //set 温度 ADCINB7
采样结果:
user6102121:
AD 采样不同的采样端口,相同的配置,均无输入,第一个采样与第二个采样结果本应相差无几,但实际采样结果相差40左右,请问这是什么原因??
这是程序::SOC配置
AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; AdcRegs.ADCSOC1CTL.bit.CHSEL = 4; AdcRegs.ADCSOC2CTL.bit.CHSEL = 7; AdcRegs.ADCSOC3CTL.bit.CHSEL = 3; AdcRegs.ADCSOC4CTL.bit.CHSEL = 1; AdcRegs.ADCSOC5CTL.bit.CHSEL = 0; AdcRegs.ADCSOC6CTL.bit.CHSEL = 9; AdcRegs.ADCSOC7CTL.bit.CHSEL = 11; AdcRegs.ADCSOC8CTL.bit.CHSEL = 15;
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 7; AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 7; //set SOC1 start trigger on EPWM2A, due to round-robin SOC0 converts first then SOC1 AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 7; //set SOC2 start trigger on EPWM2A, due to round-robin SOC0 converts first then SOC1, then SOC2 AdcRegs.ADCSOC3CTL.bit.TRIGSEL = 7; AdcRegs.ADCSOC4CTL.bit.TRIGSEL = 7; AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 7; AdcRegs.ADCSOC6CTL.bit.TRIGSEL = 7; AdcRegs.ADCSOC7CTL.bit.TRIGSEL = 7; AdcRegs.ADCSOC8CTL.bit.TRIGSEL = 7;
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; //set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1) AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; //set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1) AdcRegs.ADCSOC2CTL.bit.ACQPS = 6; //set SOC2 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1) AdcRegs.ADCSOC3CTL.bit.ACQPS = 6; AdcRegs.ADCSOC4CTL.bit.ACQPS = 6; AdcRegs.ADCSOC5CTL.bit.ACQPS = 6; AdcRegs.ADCSOC6CTL.bit.ACQPS = 6; AdcRegs.ADCSOC7CTL.bit.ACQPS = 6; AdcRegs.ADCSOC8CTL.bit.ACQPS = 6;
这是采样结果:
AD采样通道顺序不同采样结果不同 这两段程序配置完全相同,只是顺序不同
用第一个程序采样正常,屏蔽第一段用第二个 采样 有偏差。偏差达到40左右
请问这是什么原因??先谢谢了
程序如下:
/*AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //set SOC0 电感电流 ADCINA6
AdcRegs.ADCSOC1CTL.bit.CHSEL = 9; //set SOC1 超容侧电压 ADCINB1
AdcRegs.ADCSOC2CTL.bit.CHSEL = 1; //set SOC2 输出侧电压 ADCINA1
AdcRegs.ADCSOC3CTL.bit.CHSEL = 15; //set SOC3 温度 ADCINB7
AdcRegs.ADCSOC4CTL.bit.CHSEL = 11; //set SOC4 二极管前端电压 ADCINB3
AdcRegs.ADCSOC5CTL.bit.CHSEL = 4; //set SOC5 电感电流I1 ADCINA4
AdcRegs.ADCSOC6CTL.bit.CHSEL = 7; //set SOC6 电感电流I2 ADCINA7
AdcRegs.ADCSOC7CTL.bit.CHSEL = 3; //set SOC7 电感电流I3 ADCINA3
AdcRegs.ADCSOC8CTL.bit.CHSEL = 0; //1.65V采样
*/
AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //set 电感电流 ADCINA6
AdcRegs.ADCSOC1CTL.bit.CHSEL = 4; //set 电感电流 ADCINA4
AdcRegs.ADCSOC2CTL.bit.CHSEL = 7; //set 电感电流 ADCINA7
AdcRegs.ADCSOC3CTL.bit.CHSEL = 3; //set 电感电流 ADCINA3
AdcRegs.ADCSOC4CTL.bit.CHSEL = 1; //set 输出侧电压 ADCINA1
AdcRegs.ADCSOC5CTL.bit.CHSEL = 0; //set 1.65V ADCINA0
AdcRegs.ADCSOC6CTL.bit.CHSEL = 9; //set 超容侧电压 ADCINB1
AdcRegs.ADCSOC7CTL.bit.CHSEL = 11; //set 二极管前端电压 ADCINB3
AdcRegs.ADCSOC8CTL.bit.CHSEL = 15; //set 温度 ADCINB7
采样结果:
Green Deng:这些数值是每次测试都一样的情况吗?单独配置一个口的话采样结果如何?
AD采样通道顺序不同采样结果不同 这两段程序配置完全相同,只是顺序不同
用第一个程序采样正常,屏蔽第一段用第二个 采样 有偏差。偏差达到40左右
请问这是什么原因??先谢谢了
程序如下:
/*AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //set SOC0 电感电流 ADCINA6
AdcRegs.ADCSOC1CTL.bit.CHSEL = 9; //set SOC1 超容侧电压 ADCINB1
AdcRegs.ADCSOC2CTL.bit.CHSEL = 1; //set SOC2 输出侧电压 ADCINA1
AdcRegs.ADCSOC3CTL.bit.CHSEL = 15; //set SOC3 温度 ADCINB7
AdcRegs.ADCSOC4CTL.bit.CHSEL = 11; //set SOC4 二极管前端电压 ADCINB3
AdcRegs.ADCSOC5CTL.bit.CHSEL = 4; //set SOC5 电感电流I1 ADCINA4
AdcRegs.ADCSOC6CTL.bit.CHSEL = 7; //set SOC6 电感电流I2 ADCINA7
AdcRegs.ADCSOC7CTL.bit.CHSEL = 3; //set SOC7 电感电流I3 ADCINA3
AdcRegs.ADCSOC8CTL.bit.CHSEL = 0; //1.65V采样
*/
AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; //set 电感电流 ADCINA6
AdcRegs.ADCSOC1CTL.bit.CHSEL = 4; //set 电感电流 ADCINA4
AdcRegs.ADCSOC2CTL.bit.CHSEL = 7; //set 电感电流 ADCINA7
AdcRegs.ADCSOC3CTL.bit.CHSEL = 3; //set 电感电流 ADCINA3
AdcRegs.ADCSOC4CTL.bit.CHSEL = 1; //set 输出侧电压 ADCINA1
AdcRegs.ADCSOC5CTL.bit.CHSEL = 0; //set 1.65V ADCINA0
AdcRegs.ADCSOC6CTL.bit.CHSEL = 9; //set 超容侧电压 ADCINB1
AdcRegs.ADCSOC7CTL.bit.CHSEL = 11; //set 二极管前端电压 ADCINB3
AdcRegs.ADCSOC8CTL.bit.CHSEL = 15; //set 温度 ADCINB7
采样结果:
user6102121:
回复 Green Deng:
您好,单独配置一个AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; 采样是正常的,我尝试将AdcRegs.ADCSOC0CTL.bit.CHSEL = 6; 改成AdcRegs.ADCSOC9CTL.bit.CHSEL = 6;
此时采样数据也是正常的,我将SOC0配置在别的通道发现采样也是正常的,请问为啥放在第一个就会出现采样偏差??