[求助]2812源代码,为什么不能生成PWM波?请教达人
- UID
- 777141
- 性别
- 男
|
[求助]2812源代码,为什么不能生成PWM波?请教达人
2812源代码,为什么不能生成PWM波?请教达人 |
#include "DSP28_Device.h"
void init_eva(void);
void main(void) {
InitSysCtrl();
EALLOW;
GpioMuxRegs.GPAMUX.all = 0x00FF; // EVA PWM 1-6 pins GpioMuxRegs.GPBMUX.all = 0x00FF; // EVB PWM 7-12 pins EDIS;
DINT;
InitPieCtrl();
IER = 0x0000; IFR = 0x0000;
InitPieVectTable();
init_eva();
for(;;);
}
void init_eva() {
EvaRegs.T1PR = 0xFFFF; // Timer1 period EvaRegs.T1CMPR = 0x3C00; // Timer1 compare EvaRegs.T1CNT = 0x0000; // Timer1 counter
EvaRegs.T1CON.all = 0x1042;
EvaRegs.T2PR = 0x0FFF; // Timer2 period EvaRegs.T2CMPR = 0x03C0; // Timer2 compare EvaRegs.T2CNT = 0x0000; // Timer2 counter
EvaRegs.T2CON.all = 0x1042;
EvaRegs.GPTCONA.bit.TCOMPOE = 1;
EvaRegs.GPTCONA.bit.T1PIN = 1;
EvaRegs.GPTCONA.bit.T2PIN = 2;
EvaRegs.CMPR1 = 0x0C00; EvaRegs.CMPR2 = 0x3C00; EvaRegs.CMPR3 = 0xFC00;
EvaRegs.ACTR.all = 0x0666; EvaRegs.DBTCONA.all = 0x0000; // Disable deadband EvaRegs.COMCONA.all = 0xA600;
} 其实,代码是移植的别人的程序,基本上没做什么改变。不知为什么在引脚用示波器看,没看到矩形波,只是高电平
困扰了好几天了,郁闷~
|
|
|
睡觉睡到自然醒,数钱数到手抽筋!
▲╭╩═╮╔════╗╔════╗╔════╗╔════╗╔════╗
╭╯G O ╠╣支持楼主╠╣正真牛人 ╠╣雁过留声╠╣人过留帖╠╣拿分走人╣
╰⊙═⊙╯╚◎══◎╝╚◎══◎╝╚◎══◎╝╚◎══◎╝╚◎══◎╝ |
|
|
|
|
|