525
32099I–01/2012
AT32UC3L016/32/64
Note that the duty cycle registers will not be updated with the new values until the timebase
counter reaches its top value, in order to avoid glitches. The BUSY bit in SR will always be set
during this updating and synchronization period.
23.6.8
Interrupts
When the timebase counter overflows, the Timebase Overflow bit in the Status Register
(SR.TOFL) is set. If the corresponding bit in the Interrupt Mask Register (IMR) is set, an interrupt
request will be generated.
Since the user needs to wait until the user interface is available between each write due to syn-
chronization, a READY bit is provided in SR, which can be used to generate an interrupt
request.
The interrupt request will be generated if the corresponding bit in IMR is set. Bits in IMR are set
by writing a one to the corresponding bit in the Interrupt Enable Register (IER), and cleared by
writing a one to the corresponding bit in the Interrupt Disable Register (IDR). The interrupt
request remains active until the corresponding bit in SR is cleared by writing a one to the corre-
sponding bit in the Status Clear Register (SCR).
23.6.9
Peripheral Events
23.6.9.1
Input Peripheral Events
The pre-defined channels support input peripheral events from the Peripheral Event System. An
increase event (event_incr) will increase the duty cycle value by one, and a decrease event
(event_decr) will decrease the duty cycle value by one. If an increase event and a decrease
event occur at the same time, the duty cycle value will not be changed.
The number of channels supporting input peripheral events is device specific. Please refer to the
Module Configuration section at the end of this chapter for details.
Input peripheral events must be enabled by writing a one to the corresponding bit in the Chanel
Event Enable Register (CHEERm) before peripheral events can be used to control the duty
cycle value. Each bit in the register corresponds to one channel, where bit 0 corresponds to
channel 0 and so on. Both the increase and decrease events are enabled for the corresponding
channel when a bit in the CHEERm register is written to one.
23.6.9.2
Output Peripheral Event
The PWMA also supports one output peripheral event (event_ch0) to the Peripheral Event Sys-
tem. This output peripheral event is connected to channel 0 and will be asserted when the
timebase counter reaches the duty cycle value for channel 0. This output event is always
enabled.