51.2. Fix Duty Cycle
51.2.1. Overiew
PWM supports the function of fixing the duty cycle and modifying the frequency. This project demonstrates the function of modifying the frequency while ensuring that the duty cycle of the waveform remains unchanged through two methods: hardware association or software calculation.
51.2.2. Configurations
Oscilloscope
Install the serial terminal, view board information , and configure the serial terminal parameters
PWM_P0 pin Check the information according to the board model
51.2.3. Running the Demo
After power-on, it can be observed through an oscilloscope that the frequency of the waveform output from the P0 pin is constantly changing while the duty cycle remains unchanged
Serial port printing information:
pwmv2 fix duty cycle example
>> Generate fix duty cycle by calc
Two waveforms will be generated, PWM P0 is the target waveform
>> Generate fix duty cycle by shadow
Two waveforms will be generated, PWM P0 is the target waveform
test done
waveform diagrams:
Note
Output the PWM waveform once, and if you observe the waveform again, you need to run the program again.