×

开环spwm程序

消耗积分:0 | 格式:doc | 大小:42KB | 2017-10-07

EthanCoen

分享资料个

SPWM程序

  #include “DSP28x_Project.h” // Device Headerfile and Examples Include File

  #include “math.h”

  // Prototype statements for functions found within this file.

  void InitEPwm1Example(void);

  void InitEPwm2Example(void);

  interrupt void epwm1_isr(void);

  interrupt void epwm2_isr(void);

  // Configure the period for each timer

  #define EPWM1_TIMER_TBPRD 7500

  #define EPWM2_TIMER_TBPRD 7500

  #define PI 3.1415926

  Uint16 k1=0;

  Uint16 k2=0;

  Uint16 N=200;

  float Comp1=0;

  float Comp2=0;

  float Comp3=0;

  float Comp4=0;

  float M=1;

  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();

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(0)
发评论

下载排行榜

全部0条评论

快来发表一下你的评论吧 !