English
Language : 

EFM32WG Datasheet, PDF (589/834 Pages) List of Unclassifed Manufacturers – The EFM32WG Wonder Gecko is the ideal choice for demanding 8-, 16-, and 32-bit energy sensitive applications.
...the world's most energy friendly microcontrollers
23.3.5.2 Continuous Output Generation
Example 23.2. LETIMER Continuous Output Generation
In some scenarios, it might be desired to make LETIMER generate a continuous waveform. Very simple
constant waveforms can be generated without the repeat counter as shown in Figure 23.6 (p. 587) , but
to generate changing waveforms, using the repeat counter and buffer registers can prove advantageous.
For the example in Figure 23.10 (p. 589) , the goal is to produce a pulse train consisting of 3 sequences
with the following properties:
• 3 pulses with periods of 3 cycles
• 4 pulses with periods of 2 cycles
• 2 pulses with periods of 3 cycles
Figure 23.10. LETIMER Continuous Operation
Initial configuration,
REPB just writ t en
Write
COMP1 = 2
REP1 = 2
St op,
final values
COMP1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2
COMP0 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2
CNT 0 2 1 0 2 1 0 2 1 0 1 0 1 0 1 0 1 0 2 1 0 2 1 0 0
REP0 3 3 3 3 2 2 2 1 1 1 4 4 3 3 2 2 1 1 2 2 2 1 1 1 0
REP1 4 4 4 4 4 4 4 4 4 4 4u 4u 4u 2 2 2 2 2 2u 2u 2u 2u 2u 2u 2u
Int. flags set
LFACLKLETIMERn
LETn _O0
UFOA0 = 01
LETn _O1
UFOA0 = 10
UFIF
UFIF
UFIF
REP0 IF
UFIF UFIF UFIF
REP0 IF
UFIF UFIF
REP0 IF
Pulse Seq. 1
Pulse Seq. 2
Pulse Seq. 3
The first two sequences are loaded into the LETIMER before the timer is started.
LETIMERn_COMP0 is set to 2 (cycles – 1), and LETIMERn_REP0 is set to 3 for the first sequence, and
the second sequence is loaded into the buffer registers, i.e. COMP1 is set to 1 and LETIMERn_REP1
is set to 4.
The LETIMER is set to trigger an interrupt when LETIMERn_REP0 is done by setting REP0 in
LETIMERn_IEN. This interrupt is a good place to update the values of the buffers. Last but not least
REPMODE in LETIMERn_CTRL is set to buffered mode, and the timer is started.
In the interrupt routine the buffers are updated with the values for the third sequence. If this had not been
done, the timer would have stopped after the second sequence.
The final result is shown in Figure 23.10 (p. 589) . The pulse output is grouped to show which sequence
generated which output. Toggle output is also shown in the figure. Note that the toggle output is not
aligned with the pulse outputs.
Note
2013-05-08 - Wonder Gecko Family - d0233_Rev0.50
589
www.energymicro.com