基于tms320f2812的永磁同步电动机svpwm空间矢量控制算法实现的源代码终稿.docx
- 文档编号:763678
- 上传时间:2022-10-12
- 格式:DOCX
- 页数:24
- 大小:19.93KB
基于tms320f2812的永磁同步电动机svpwm空间矢量控制算法实现的源代码终稿.docx
《基于tms320f2812的永磁同步电动机svpwm空间矢量控制算法实现的源代码终稿.docx》由会员分享,可在线阅读,更多相关《基于tms320f2812的永磁同步电动机svpwm空间矢量控制算法实现的源代码终稿.docx(24页珍藏版)》请在冰豆网上搜索。
基于tms320f2812的永磁同步电动机svpwm空间矢量控制算法实现的源代码终稿
/*==============================================================================
SystemName:
PMSM34
FileName:
PMSM3_4.C
Description:
PrimarysystemfilefortheRealImplementationofPositionControl
BasedSensoredFieldOrientationControlforaThreePhasePermanent-
MagnetSynchronousMotor(PMSM)usingQEPsensor
Originator:
DigitalcontrolsystemsGroup-TexasInstruments
Note:
Inthissoftware,thedefaultinverterissupposedtobeDMC550board.
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005Version3.20:
SupportbothF280xandF281xtargets
04-25-2005Version3.21:
MoveEINTandERTMdowntoensurethatallinitialization
iscompletedbeforeinterruptsareallowed.
=================================================================================*/
//Includeheaderfilesusedinthemainfunction
#include"target.h"
#include"DSP281x_Device.h"
#include"IQmathLib.h"
#include"pmsm3_4.h"
#include"parameter.h"
#include"build.h"
#include
//Prototypestatementsforfunctionsfoundwithinthisfile.
interruptvoidMainISR(void);
interruptvoidQepISR(void);
interruptvoidPDPINTAISR(void);
//Globalvariablesusedinthissystem
float32VdTesting=0;//Vdtesting(pu)
float32VqTesting=0.25;//Vqtesting(pu)
float32IdRef=0;//Idreference(pu)
float32IqRef=0.2;//Iqreference(pu)
float32SpeedRef=0.1;//Speedreference(pu)
float32PositionRef=0.5;//Positionreference(MechanicalrotorAnglele(pu)
float32T=0.001/ISR_FREQUENCY;//Sampingperiod(sec),seeparameter.h
Uint16IsrTicker=0;
Uint16BackTicker=0;
volatileUint16EnableFlag=FALSE;
Uint16LockRotorFlag=FALSE;
Uint16SpeedLoopPrescaler=10;//Speedloopprescaler
Uint16SpeedLoopCount=1;//Speedloopcounter
//Instanceafewtransformobjects
CLARKEclarke1=CLARKE_DEFAULTS;
PARKpark1=PARK_DEFAULTS;
IPARKipark1=IPARK_DEFAULTS;
//InstancePIDregulatorstoregulatethedandqsynchronousaxiscurrents,
//speedandposition
PIDREG3pid1_id=PIDREG3_DEFAULTS;
PIDREG3pid1_iq=PIDREG3_DEFAULTS;
PIDREG3pid1_pos=PIDREG3_DEFAULTS;
PIDREG3pid1_spd=PIDREG3_DEFAULTS;
//InstanceaPWMdriverinstance
PWMGENpwm1=PWMGEN_DEFAULTS;
//InstanceaSpaceVectorPWMmodulator.Thismodulatorgeneratesa,bandc
//phasesbasedonthedandqstationeryreferenceframeinputs
SVGENDQsvgen_dq1=SVGENDQ_DEFAULTS;
//InstanceaQEPinterfacedriver
QEPqep1=QEP_DEFAULTS;
//InstanceaspeedcalculatorbasedonQEP
SPEED_MEAS_QEPspeed1=SPEED_MEAS_QEP_DEFAULTS;
//Instancearampcontrollertosmoothlyrampthefrequency
RMPCNTLrc1=RMPCNTL_DEFAULTS;
//InstancearampgeneratortosimulateanAnglele
RAMPGENrg1=RAMPGEN_DEFAULTS;
//Createaninstanceofthecurrent/dc-busvoltagemeasurementdriver
ILEG2DCBUSMEASilg2_vdc1=ILEG2DCBUSMEAS_DEFAULTS;
voidmain(void)
{
//******************************************
//InitializationcodeforDSP_TARGET=F2812
//******************************************
//InitializeSystemControlregisters,PLL,WatchDog,Clockstodefaultstate:
//ThisfunctionisfoundintheDSP281x_SysCtrl.cfile.
InitSysCtrl();
//HISPCPprescaleregistersettings,normallyitwillbesettodefaultvalues
EALLOW;//ThisisneededtowritetoEALLOWprotectedregisters
SysCtrlRegs.HISPCP.all=0x0000;//SYSCLKOUT/1
EDIS;//ThisisneededtodisablewritetoEALLOWprotectedregisters
//DisableandclearallCPUinterrupts:
DINT;
IER=0x0000;
IFR=0x0000;
//InitializePieControlRegistersToDefaultState:
//ThisfunctionisfoundintheDSP281x_PieCtrl.cfile.
InitPieCtrl();
//InitializethePIEVectorTableToaKnownState:
//ThisfunctionisfoundinDSP281x_PieVect.c.
//ThisfunctionpopulatesthePIEvectortablewithpointers
//totheshellISRfunctionsfoundinDSP281x_DefaultIsr.c.
InitPieVectTable();
//InitializeGPIO;MUX为0,表示IO;MUX为1表示外围;
//DIR为0,表示输入;DIR为1表示输出
EALLOW;
GpioMuxRegs.GPAMUX.all=0X073F;
GpioMuxRegs.GPADIR.all=0XC0C0;
GpioMuxRegs.GPBMUX.all=0X0000;
GpioMuxRegs.GPBDIR.all=0X0000;
GpioMuxRegs.GPDMUX.bit.T1CTRIP_PDPA_GPIOD0=1;//功能PDPINTA
GpioMuxRegs.GPDMUX.bit.T2CTRIP_SOCA_GPIOD1=0;//INPUT
GpioMuxRegs.GPDDIR.bit.GPIOD1=0;
GpioMuxRegs.GPDMUX.bit.T3CTRIP_PDPB_GPIOD5=0;
GpioMuxRegs.GPDDIR.bit.GPIOD5=0;
GpioMuxRegs.GPDMUX.bit.T4CTRIP_SOCB_GPIOD6=0;
GpioMuxRegs.GPDDIR.bit.GPIOD6=0;
GpioMuxRegs.GPEMUX.bit.XINT1_XBIO_GPIOE0=0;
GpioMuxRegs.GPEMUX.bit.XINT2_ADCSOC_GPIOE1=0;
GpioMuxRegs.GPEMUX.bit.XNMI_XINT13_GPIOE2=0;
GpioMuxRegs.GPEDIR.bit.GPIOE0=0;
GpioMuxRegs.GPEDIR.bit.GPIOE1=0;
GpioMuxRegs.GPEDIR.bit.GPIOE2=0;
GpioMuxRegs.GPFMUX.all=0X4037;
GpioMuxR
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 tms320f2812 永磁 同步电动机 svpwm 空间 矢量 控制 算法 实现 源代码
![提示](https://static.bdocx.com/images/bang_tan.gif)