// file name: svpwm.c
//generate svpwm waveforms
#include "math.h"
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h"
#include
// DSP281x Examples Include File
//global variables
float Tz=2e-4;
int Vdc=600;
//float PI=3.1415;
//int f=50;
// Prototype statements for functions found in this file.
void svpwm(float *ptr,float uapha,float ubeta,float Tswitch,int vdc_link);
void init_eva(void);
void main(void)
{
float cmpr[3]={0,0,0};//cmpr[3]={CMPR1,CMPR2,CMPR3)
float *ptrc=&cmpr[0];//point to the addrs of cmpr
float v_aphar=100;//reference value of vaphar
float v_betar=-20;//reference value of vbetar
//float tstep=0.0000001;
//float tend=5
//float w=2*PI*f;
//float y=sin(w*t);
// Step 1. Initialize System Control:
// PLL--30MHz*10/2, disable WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
InitGpio();
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT; //asm(" setc INTM")
// 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 DSP281x_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 DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
// InitPieVectTable();