21.3.3.1.7 Single-Shot Mode
The Single-Shot mode can be used to generate a pulse with a duration defined by the Compare (TCBn.CCMP) register, every time a rising or falling edge is observed on a connected event channel.
When the counter is stopped, the output pin is driven to low. If an event is detected on the connected event channel, the timer will reset and start counting from BOTTOM to TOP while driving its output high. The RUN bit in the Status (TCBn.STATUS) register can be read to see if the counter is counting or not. When the Counter register reaches the CCMP register value, the counter will stop, and the output pin will go low for at least one prescaler cycle. A new event arriving during this time will be ignored. There is a two clock-cycle delay from when the event is received until the output is set high.
The counter will start counting as soon as the module is enabled,
even without triggering an event. This is prevented by writing TOP to the
Counter register. Similar behavior is seen if the Event Edge (EDGE) bit in
the Event Control (TCBn.EVCTRL) register is ‘1
’ while the
module is enabled. Writing TOP to the Counter register prevents this as
well.
If the Event Asynchronous (ASYNC) bit in the Control B (TCBn.CTRLB)
register is written to ‘1
’ the timer will react
asynchronously to an incoming event. An edge on the event will immediately
cause the output signal to be set. The counter will still start counting two
clock cycles after the event is received.