This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
为什么我按照timer A配置成pwm的方法配置timer b,但是timer b却输出不了pwm,而且timer b 的定时器值一直都没变
下面是代码:
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER5);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
TimerClockSourceSet(TIMER5_BASE,TIMER_CLOCK_SYSTEM);
TimerConfigure(TIMER5_BASE,TIMER_CFG_SPLIT_PAIR |TIMER_CFG_B_PWM|TIMER_CFG_B_ACT_CLRSETTO);//pwm模式
TimerControlLevel(TIMER5_BASE,TIMER_B,true);
TimerLoadSet(TIMER5_BASE,TIMER_B,ui32Load); //pwm周期
TimerMatchSet(TIMER5_BASE,TIMER_B,ui32Load/2); //占空比
TimerEnable(TIMER5_BASE,TIMER_B);
GPIOPinConfigure(GPIO_PM7_T5CCP1);
GPIOPinTypeTimer(GPIO_PORTM_BASE,GPIO_PIN_0|GPIO_PIN_7);
库函数没有问题,将顺序调整一下。
你可以跑一下附件中例程。
King YAO 说:为什么我按照timer A配置成pwm的方法配置timer b,但是timer b却输出不了pwm,而且timer b 的定时器值一直都没变
下面是代码:
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER5);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);TimerClockSourceSet(TIMER5_BASE,TIMER_CLOCK_SYSTEM);
TimerConfigure(TIMER5_BASE,TIMER_CFG_SPLIT_PAIR |TIMER_CFG_B_PWM|TIMER_CFG_B_ACT_CLRSETTO);//pwm模式
TimerControlLevel(TIMER5_BASE,TIMER_B,true);
GPIOPinConfigure(GPIO_PM7_T5CCP1);
GPIOPinTypeTimer(GPIO_PORTM_BASE,GPIO_PIN_0|GPIO_PIN_7);
TimerLoadSet(TIMER5_BASE,TIMER_B,ui32Load); //pwm周期
TimerMatchSet(TIMER5_BASE,TIMER_B,ui32Load/2); //占空比
TimerEnable(TIMER5_BASE,TIMER_B);
Tivaware中有的。
外设例程 C:\ti\TivaWare_C_Series-2.1.1.71\examples\peripherals
评估板例程 C:\ti\TivaWare_C_Series-2.1.1.71\examples\boards