Name——自行编辑 这里编辑为PWM_0
Timer Clock Source 选择时钟源
Timer Clock Divider 选择时钟源分频
Timer Clock Prescale 选择定时器的分频
最终32000000分频为125000
PWM Period Count 选择PWM的计数周期为2000
PWM Mode 选择为向上计数模式
Initial Value 选择起始值为 高电平
Desired Duty Cycle 选择占空比为75%
另一个通道的配置相似不做重复
如下图
此处可以选择定时器和定时器通道
最后的代码就只是开启定时器的代码,因为所以的频率 周期 占空比都在配置里面选择好了
#include "ti_msp_dl_config.h"
int main(void)
{
SYSCFG_DL_init();
DL_TimerG_startCounter(PWM_0_INST);
while (1)
{
// __WFI();//进入睡眠模式 这里可以不使用
}
}