我们正在尝试沿着dio23模拟引脚输出PWM信号。我们将CC1310_LAUNCHXL_PWMPIN0设置为IOID_23并运行以下代码;但是,直接从该引脚在示波器上查看时,未检测到输出信号。有什么我们想念的吗?
PWM_Handle handle;
PWM_Params params;
/* Call driver init functions. */
PWM_init();
PWM_Params_init(¶ms);
params.idleLevel = PWM_IDLE_LOW;
params.periodUnits = PWM_PERIOD_HZ;
params.periodValue = 1e6;
params.dutyUnits = PWM_DUTY_FRACTION;
params.dutyValue = 100;
handle = PWM_open(Board_PWM0, ¶ms);
if(handle==NULL){
while(1);
}
PWM_start(handle);
while(1);
答案 0 :(得分:0)
实际上,您设定的职责太小。 100不是100%,而是100 / PWM_DUTY_FRACTION_MAX,其中PWM_DUTY_FRACTION_MAX为2 ^ 32-1-请参见文档:http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_20_00_06/exports/tirtos_full_2_20_00_06/products/tidrivers_msp43x_2_20_00_08/docs/doxygen/html/_p_w_m_8h.html
尝试将dutyValue设置为PWM_DUTY_FRACTION_MAX / 2(或其他大值),您应该会看到结果。