#include <hidef.h> /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ #include <mc9s12xs128.h> //定义PID参数 #define VV_KPVALUE 3 //比例 #define VV_KIVALUE 40 //积分 #define VV_KDVALUE 3 //微分 #define VV_MAX 10000 //返回的最大值,是pwm的周期值 #define VV_MIN 0 #define VV_DEADLINE 0X08 //速度PID,设置死区范围 typedef struct PID //定义数法核心数据 { signed int vi_Ref; //速度PID,速度设定值 signed int vi_FeedBack; //速度PID,速度反馈值
上传时间: 2016-04-27
上传用户:547453159
pid控制 #ifndef _PID_H #ifndef _PID_H #ifdef _PID_C #define PID_EXT #else #define PID_EXT extern #endif typedef struct PID { int SetPoint; unsigned char BitMove; float Proportion; float Integral; float derivative; int iError; int iIncpid; int LastError; int PrevError; int Uk; }PID,*pPID; PID_EXT PID sPID; PID_EXT pPID sptr; void IncPIDInit(void); int IncPIDCalc(int NextPoint); #endif
上传时间: 2019-08-02
上传用户:stcwzy
#nclude<reg51.h>#include<intrins.h>#销nclude<math.h>#include<string.h>struct PID{unsigned int SetPoint;//设定目标 Desired Value unsigned int Proportion;//比例常数Proportional Const unsigned int integral;//积分常数Integral Const unsigned int derivative://微分常数derivative Const unsigned int LastError;//Emorl-1]unsigned int PrevError;//Errorl-2]unsigned int SumError;//Sums of Errors struct PID spid;//PID Control Structure unsigned int rout;//PID Response(Output)unsigned int rin://PID Feedback(Input)sbit data1=P100;sbit clk=P141;sbit plus=P240;sbit subs=P241:sbit stop=P22;sbit output=P34;sbit DQ=P33;unsigned char flag,flag_1=0;unsigned char high_time,low_time,.count=0,/占空比调节参数unsigned char set_temper=35;unsigned char temper;unsigned chari:unsigned charj=0;unsigned ints;
上传时间: 2022-07-02
上传用户:xsr1983
简介本文档介绍了如何使用dsPIC30F数字信号控制器(Digital Signal Controller,DSC)控制正弦电流来驱动具有位置传感器的永磁同步电机(Permanent Mag-net Synchronous Motor,PMSM).电机控制固件使用dsPIC30F外设,而数学运算则由DSP引擎完成。为充分利用dsPIC30F的特殊DSP运算性能,固件采用C语言编写,只有某些子程序采用汇编语言编写。应用特性·使用空间矢量调制(Space Vector Modulation,SVM)方法产生用于驱动PMSM电机各相的正弦电流·正弦电压与PMSM电机转子位置同步·四象限运行,可实现正向、反向和制动运行·基于数字比例一积分一微分(Proportional Integral derivative,PID)控制的闭环转速控制·相位超前技术可实现更宽的调速范围·由dsPICODSC的DSP引擎实现小数数学运算
上传时间: 2022-07-05
上传用户: