TI论坛
直播中

魏双艳

7年用户 222经验值
私信 关注
[问答]

请问LM4F120H5QR例程,中GEN0,1,2,3怎么和通用定时器对应起来?

STELLARISWARE里面有产生PWM的例程,但又一处不是很明白.
以下是文档原画:
The generator blocks are called Gen0, Gen1, Gen2 and Gen3.
The two PWM output signals associated with each generator block are called OutA and OutB.
The output signals are called PWM0, PWM1, PWM2, PWM3, PWM4, PWM5, PWM6 and
PWM7.
PWM0 and PWM1 are associated with Gen0, PWM2 and PWM3 are associated with Gen1,
PWM4 and PWM5 are associated with Gen2 and PWM6 and PWM7 are associated with
Gen3.
我的疑问是GEN0,1,2,3怎么和通用定时器对应起来??找了好多文档也没找到其中的关系,查看了PWM.H,PWM.C这两个文件也看出来这PWM和通用定时器有关...
难道有单独的PWM模块????????????????????
PF1口对应的是通用定时器0的tiMERB的比较输出.那我要启用它应该是启用哪个??GEN0?GEN1???我试了GEN0不管...

回帖(3)

魏双艳

2020-4-9 11:34:12
  ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |           //80mhz
                       SYSCTL_OSC_MAIN);
  SysCtlPWMClockSet(SYSCTL_PWMDIV_8);   //10MHZ
 
  SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM);
  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
 
  GPIOPinConfigure(GPIO_PF1_T0CCP1);
 
  GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1);   //PF1
 
  PWMGenConfigure(PWM_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
 
  PWMGenPeriodSet(PWM_BASE, PWM_GEN_0, 10000);  //1khz
 
  PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, 3000);
 
  PWMOutputState(PWM_BASE, PWM_OUT_0_BIT, true);
 
  PWMGenEnable(PWM_BASE, PWM_GEN_0);
让PF1输出,这个应该做何修改呢??
举报

魏双艳

2020-4-9 11:47:11
明白了...LM4F120上没有PWM模块...好吧..
举报

王兵

2020-4-9 11:57:10
如果需要输出PWM而且要求不是很高的话,可以考虑使用TIMER输出
                                                                         Wellin
举报

更多回帖

×
20
完善资料,
赚取积分