使用HVDMC KIt套件,调试controlsuite中HVBLDC_sensorless.c程序。对母线电流进行采样,ADC通过软件触发,程序如下:
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; // Use internal bandgap
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
for(i=0; i<5000; i++){} // wait 60000 cycles = 1ms (each iteration is 12 cycles)
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; // create int pulses 1 cycle prior to output latch
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6;
AdcRegs.ADCSOC0CTL.bit.CHSEL= 2;
AdcRegs.ADCSOC1CTL.bit.CHSEL= 2;
AdcRegs.ADCSOC0CTL.bit.TRIGSEL= 0;
AdcRegs.ADCSOC1CTL.bit.TRIGSEL= 0;
EDIS;
进入主中断后,(buildlevel=2)
#if (BUILDLEVEL==LEVEL2)
// ——————————————————————————
// ADC conversion and offset adjustment// ——————————————————————————
AdcRegs.ADCSOCFRC1.all = 0x0003; // 软件触发ADC
for(i=0;i<10;i++){} //等待转换完成
DCbus_current = _IQ12toIQ(AdcResult.ADCRESULT1);
在电路板上测的A2通道的输入电压为1.64V,但是AdcResult.ADCRESULT1 的值很不稳定,且只有200左右。这是为什么?实验相部分原理图如下·
采样A7通道,即母线电压时,采样不到结果,实测电压0.88V。只有A0通道的Vref采样的数字结果很稳定,在2000左右。求大牛们解答!已经纠结了好多天了