程序如下:
PWM_Handle m_hPwm;
PWM_init();
m_hPwm = PWM_open(0, &PWM_defaultParams);
PWM_setPeriod(m_hPwm, 1000);
PWM_setDuty(m_hPwm, 50);
PWM_start(m_hPwm);
配置参数如下
const PWM_Params PWM_defaultParams = {
.periodUnits = PWM_PERIOD_US,//PWM_PERIOD_HZ, /* Period is defined in Hz */
.periodValue = 1e6, /* 1MHz */
.dutyUnits = PWM_PERIOD_US,//PWM_DUTY_FRACTION, /* Duty is fraction of period */
.dutyValue = 0, /* 0% duty cycle */
.idleLevel = PWM_IDLE_LOW, /* Low idle level */
.custom = NULL /* No custom params */
};
Kevin Qiu1:
PWM参考例程C:\ti\simplelink_cc13x2_26x2_sdk_4_20_00_35\examples\rtos\CC26X2R1_LAUNCHXL\drivers\pwmled2
user1388075:
回复 Kevin Qiu1:
就是按照这个来的。
YiKai Chen:
回复 user1388075:
使用 pwmled2 原例程也沒辦法正常?
user1388075:
回复 YiKai Chen:
奇怪了, m_hPwm = PWM_open(0, &PWM_defaultParams); 这句话返回的句柄为NULL。
const PWM_Params PWM_defaultParams = { .periodUnits = PWM_PERIOD_US,//PWM_PERIOD_HZ, /* Period is defined in Hz */ .periodValue = 1e6, /* 1MHz */ .dutyUnits = PWM_PERIOD_US,//PWM_DUTY_FRACTION, /* Duty is fraction of period */ .dutyValue = 50,//0, /* 0% duty cycle */ .idleLevel = PWM_IDLE_LOW, /* Low idle level */ .custom = NULL /* No custom params */};
TI中文支持网
