没有合适的资源?快使用搜索试试~ 我知道了~
svpwm源程序[定义].pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 118 浏览量
2021-10-12
00:50:52
上传
评论
收藏 92KB PDF 举报
温馨提示
试读
11页
svpwm源程序[定义].pdf
资源推荐
资源详情
资源评论
/ TI File $Revision: /main/8 $
// Checkin $Date: April 21, 2008 15:41:53 $
//###########################################################################
//
// FILE: Example_2833xEPwmUpDownAQ.c
//
// TITLE: 空间电压矢量产生程序 SVPWM
//
// ASSUMPTIONS:
//
// This program requires the DSP2833x header files.
//
// Monitor ePWM1-ePWM3 pins on an oscilloscope as described
// below.
//
// EPWM1A is on GPIO0-------5 脚
// EPWM1B is on GPIO1-------6 脚
//
// EPWM2A is on GPIO2-------7 脚
// EPWM2B is on GPIO3-------10 脚
//
// EPWM3A is on GPIO4-------11 脚
// EPWM3B is on GPIO5-------12 脚
//
//
//###########################################################################
// $TI Release: DSP2833x/DSP2823x Header Files V1.20 $
// $Release Date: August 1, 2008 $
//###########################################################################
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
// Prototype statements for functions found within this file.
void InitEPwm1Example ( void );
void InitEPwm2Example ( void );
void InitEPwm3Example ( void );
void svpwmGen( void );
interrupt void svpwm_isr ( void );
volatile float Ualpha,Ubeta;
volatile float A,B,C;
volatile float T0,T1,T2,T3,T4,T5,T6;
volatile float Taon,Tbon,Tcon;
float Ua,Ub,Uc;
float Ts;
int a,b,c;
int N= 0,sector= 0;
#define TPRD 800
#define Udc 800
void main ( void )
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); // Skipped for this example
// For this case just init GPIO pins for ePWM1, ePWM2, ePWM3
// These functions are in the DSP2833x_EPwm.c file
InitEPwm1Gpio();
InitEPwm2Gpio();
InitEPwm3Gpio();
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
InitPieVectTable();
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.EPWM1_INT = &svpwm_isr;
//PieVectTable.EPWM2_INT = &epwm2_isr;
//PieVectTable.EPWM3_INT = &epwm3_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP2833x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
// For this example, only initialize the ePWM
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPwm1Example();
InitEPwm2Example();
InitEPwm3Example();
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
// Step 5. User specific code, enable interrupts:
// Enable CPU INT3 which is connected to EPWM1-3 INT:
IER |= M_INT3;
// Enable EPWM INTn in the PIE: Group 3 interrupt 1-3
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
剩余10页未读,继续阅读
资源评论
- lich64332022-06-04用户下载后在一定时间内未进行评价,系统默认好评。
czq131452007
- 粉丝: 2
- 资源: 12万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功