尝试了用scs里面的ledpwm例程实现自定义占空比的4通道pwm
请问怎么实现不同占空比的设置呢?更改了duty cycle和timer2的计数并没有发生改变?
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.
尝试了用scs里面的ledpwm例程实现自定义占空比的4通道pwm
请问怎么实现不同占空比的设置呢?更改了duty cycle和timer2的计数并没有发生改变?
你有LP 板子吗?可以参考下面的程序
while (1) { UInt events = Event_pend(h_evnButtonPressed, Event_Id_NONE, EV_BTNS_MASK, BIOS_WAIT_FOREVER); // Increment the duty-cycle if BTN1 was pressed if (events & EV_BTN1_PRESSED) { // Interrupt has to be enabled, as it was disabled by the Hwi callback PIN_setConfig(h_buttonPins, PIN_BM_IRQ, Board_BTN1 | PIN_IRQ_NEGEDGE); dutyCycleExp = MIN(dutyCycleExp + 1, SCIF_LED_PWM_DUTY_CYCLE_EXP_MAX); } // Decrement the duty-cycle if BTN2 was pressed if (events & EV_BTN2_PRESSED) { // Interrupt has to be enabled, as it was disabled by the Hwi callback PIN_setConfig(h_buttonPins, PIN_BM_IRQ, Board_BTN2 | PIN_IRQ_NEGEDGE); dutyCycleExp = MAX(dutyCycleExp - 1, SCIF_LED_PWM_DUTY_CYCLE_EXP_MIN); } // Set new duty-cycle which is read by the Sensor Controller task scifTaskData.ledPwm.cfg.dutyCycleExp = dutyCycleExp; }
是的,我上面贴出来的程序即Sensor controller studio 产生的