文件名称:dsp pid算法测序
文件大小:110KB
文件格式:DOC
更新时间:2017-03-07 11:07:20
dsp pid
#include "DSP281x_Device.h" #include "IQmathLib.h" #include "pmsm3_1.h" #include "parameter.h" #include "build.h" //=========本文件中用到的函数原型声明============ interrupt void MainISR(void); interrupt void QepISR(void); interrupt void SCIB_IX_ISR(void); void Delay_Us(Uint16,Uint16); #define CPU_CLOCK_SPEED 6.6667L // for a 150MHz CPU clock speed #define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_CLOCK_SPEED) - 9.0L) / 5.0L) extern void DSP28x_usDelay(unsigned long Count); //============全局变量声明======================= float32 T = 0.001/ISR_FREQUENCY; //PWM频率20KHZ,周期50us float32 SpeedRef = 0.15; //速度参考值(标幺值),(0.2) float32 IqRef = 0.1; // Iq参考值(标幺值) float32 IdRef = 0; // Id参考值(标幺值) float32 VqTesting = 0.18; // Vq测试值(标幺值),(0.25) float32 VdTesting = 0; // Vd测试值(标幺值) float32 angle; Uint16 BackTicker = 0; Uint16 IsrTicker = 0; int16 PwmDacCh1=0; int16 PwmDacCh2=0; int16 PwmDacCh3=0; int16 DlogCh1 = 0; int16 DlogCh2 = 0; int16 DlogCh3 = 0; int16 DlogCh4 = 0; Uint16 LockRotorFlag = FALSE;