AVR®: Using Hardware Fast PWM Mode and Testing with Data Visualizer
In this video:
- Understand the Fast PWM timing diagram.
- Modify our PWM initialization function to configure 11-bit PWM and clear Output Compare 1B (OC1B) on compare match.
- Find that OC1B is an alternate pin function of PB2 and setting this as an output.
- Use the Data Visualizer's GPIO view in pin mode to analyze the output waveforms.
- Utilize cursors to measure the frequency of the waveforms of both the LED pin (PB5) and OC1B (PB2).
- Check the measured frequency (7813 Hz), against that from the formula in the datasheet (7812 Hz), showing the frequency is measured as expected.