This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PMSM_3_4例程问题

我现在搭建最小系统电机第一级测试,中断函数每次都正常进入,但是我单步跟踪电压 TA, TB , TC 的值的都没领,用示波器测量CM1到CM6波形基本是一样的,调试代码的时候CM1 = 1249, CMP2 = 1249, CMP3 = 1249, CMP3 = 1249 , CMP4 = 1250, CMP5 = 1250, CMP5 = 1250,像这种情况一般是那个模块不正常出现的问题,中断函数代码  SpeedRef = 0.1

interrupt void MainISR(void)
{

// Verifying the ISR
IsrTicker++;

// ***************** LEVEL1 *****************
#if (BUILDLEVEL==LEVEL1)

// ------------------------------------------------------------------------------
// Connect inputs of the RMP module and call the Ramp control
// calculation function.
// ------------------------------------------------------------------------------
rc1.TargetValue = _IQ(SpeedRef);
rc1.calc(&rc1);

// ------------------------------------------------------------------------------
// Connect inputs of the RAMP GEN module and call the Ramp generator
// calculation function.
// ------------------------------------------------------------------------------
rg1.Freq = rc1.SetpointValue;
rg1.calc(&rg1);

// ------------------------------------------------------------------------------
// Connect inputs of the INV_PARK module and call the inverse park transformation
// calculation function.
// ------------------------------------------------------------------------------
ipark1.Ds = _IQ(VdTesting);
ipark1.Qs = _IQ(VqTesting);
ipark1.Angle = rg1.Out;
ipark1.calc(&ipark1);

// ------------------------------------------------------------------------------
// Connect inputs of the SVGEN_DQ module and call the space-vector gen.
// calculation function.
// ------------------------------------------------------------------------------
svgen_dq1.Ualpha = ipark1.Alpha;
svgen_dq1.Ubeta = ipark1.Beta;
svgen_dq1.calc(&svgen_dq1);

// ------------------------------------------------------------------------------
// Connect inputs of the PWM_DRV module and call the PWM signal generation
// update function.
// ------------------------------------------------------------------------------
pwm1.MfuncC1 = (int16)_IQtoIQ15(svgen_dq1.Ta); // MfuncC1 is in Q15
pwm1.MfuncC2 = (int16)_IQtoIQ15(svgen_dq1.Tb); // MfuncC2 is in Q15
pwm1.MfuncC3 = (int16)_IQtoIQ15(svgen_dq1.Tc); // MfuncC3 is in Q15
pwm1.update(&pwm1);

// ------------------------------------------------------------------------------
// Connect inputs of the PWMDAC module
// ------------------------------------------------------------------------------
PwmDacCh1 = (int16)_IQtoIQ15(svgen_dq1.Ta);
PwmDacCh2 = (int16)_IQtoIQ15(svgen_dq1.Tb);
PwmDacCh3 = (int16)_IQtoIQ15(svgen_dq1.Tc);

// ------------------------------------------------------------------------------
// Connect inputs of the DATALOG module
// ------------------------------------------------------------------------------
DlogCh1 = (int16)_IQtoIQ15(svgen_dq1.Ta);
DlogCh2 = (int16)_IQtoIQ15(svgen_dq1.Tb);
DlogCh3 = (int16)_IQtoIQ15(svgen_dq1.Tc);
DlogCh4 = (int16)_IQtoIQ15(svgen_dq1.Ta-svgen_dq1.Tb);

// ------------------------------------------------------------------------------
// Connect inputs of the EN_DRV module and call the enable/disable PWM signal
// update function. (FOR DMC1500 ONLY)
// ------------------------------------------------------------------------------
drv1.EnableFlag = EnableFlag;
drv1.update(&drv1);