Info: The PLL has two input sources: The OSCHF and XOSCHF. The default source is
OSCHF, but the XOSCHF can be configured by setting the Select Source for PLL
(SOURCE) bit in the PLL Control A (PLLCTRLA) register.
Edit TIMER_TCD0_init() to include the following to set the
PLL as the clock source with no prescaler:
Enable the TCD by first ensuring
that the Enable Ready (ENRDY) bit in the Status (TCDn.STATUS) register is set to
‘1’ and then setting the ENABLE bit in Control A
(TCDn.CTRLA) register:
Info: In addition to the configurations that have been set, the TCD is set to
increment the duty cycle of WOA by one bit after every period. See
ISR(TCD0_OVF_vect) how this is
implemented.
Verify that the solution/project builds by selecting
the Build → Build
Solution from the top menu
bare in Atmel Studio or by pressing the
F7 key.
Flash the device by selecting the Debug → Start without
debugging
from the top menu bar in Atmel Studio or by pressing the
Ctrl+Alt+F5 keys.
Plot the PWM signal using a Logic
Analyzer the output for WOA is available on PA4, while the output for WOB is
available on PA5.
Result: The
PLL and TCD are combined to create a very high-resolution PWM signal. In Figure 1, you can
seen that the duty cycle is increased by about 20 ns from 1.4 µs to 1.42 µs after
each period showing the high-resolution of the PWM signal.Figure 4-1. Assignment 2:
Result
The online versions of the documents are provided as a courtesy. Verify all content and data in the device’s PDF documentation found on the device product page.