#include "DSP280x_Device.h" // DSP280x Headerfile Include File #include "DSP280x_Examples.h" // DSP280x Examples Include File
void InitEPwm1Example(void);
void main(void) {
InitSysCtrl();
InitEPwm1Gpio(); InitEPwm2Gpio(); InitEPwm3Gpio(); EALLOW; GpioCtrlRegs.GPBPUD.bit.GPIO33 = 0; GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 2;
EDIS;
EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; EDIS;
InitEPwm1Example();
EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; EDIS;
for(;;) {
EPwm1Regs.TBCTL.bit.SWFSYNC = 1; asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); }
}
void InitEPwm1Example() { EPwm1Regs.TBCTL.bit.CTRMODE = 0; EPwm1Regs.TBPRD = 0x1000; EPwm1Regs.TBCTL.bit.PHSEN = 1; EPwm1Regs.TBCTL.bit.PHSDIR =1; EPwm1Regs.TBCTL.bit.SYNCOSEL =0; EPwm1Regs.TBPHS.half.TBPHS = 0x0300; EPwm1Regs.TBCTR = 0x0000; EPwm1Regs.CMPA.half.CMPA = 0x200; EPwm1Regs.AQCTLA.bit.ZRO = 2; EPwm1Regs.AQCTLA.bit.CAU = 1;
EPwm2Regs.TBCTL.bit.CTRMODE = 0; EPwm2Regs.TBPRD = 0x1000; EPwm2Regs.TBCTL.bit.PHSEN = 1; EPwm2Regs.TBCTL.bit.SYNCOSEL =0; EPwm2Regs.TBPHS.half.TBPHS = 0x0300; EPwm2Regs.TBCTR = 0x0000; EPwm2Regs.CMPA.half.CMPA = 0x200; EPwm2Regs.AQCTLA.bit.ZRO = 2; EPwm2Regs.AQCTLA.bit.CAU = 1; EPwm2Regs.TBCTL.bit.PHSDIR =1;
EPwm3Regs.TBCTL.bit.CTRMODE = 0; EPwm3Regs.TBPRD = 0x1000; EPwm3Regs.TBCTL.bit.PHSEN = 1; EPwm3Regs.TBCTL.bit.SYNCOSEL =0; EPwm3Regs.TBPHS.half.TBPHS = 0x0300; EPwm3Regs.TBCTR = 0x0000; EPwm3Regs.CMPA.half.CMPA = 0x200; EPwm3Regs.AQCTLA.bit.ZRO = 2; EPwm3Regs.AQCTLA.bit.CAU = 1; EPwm3Regs.TBCTL.bit.PHSDIR =1; } |