Observing PWM Waveforms
The duty cycle is the ratio of high to low in the PWM signal. Use a logic analyzer to observe how the duty cycle affects the waveform.
- Start the logic analyzer and begin measuring GPIO2, GPIO3, GPIO4, and GPIO5:
L:/>pwm 2-5 func:pwm disable freq:100 counter:0
L:/>pwm2 duty:.2; pwm3 duty:.4; pwm4 duty:.6; pwm5 duty:.8
L:/>pwm 2-5 enable
The bottom waveform is duty 0.2, then 0.4, 0.6, and 0.8 above. As the duty increases, the high time increases and the pulse width widens. The period is about 10,000μs, so the frequency is 100Hz.