21.3.6.2 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 21.8 LETIMER Simple Waveforms Output on page 723
, but to generate
changing waveforms, using the repeat counter and buffer registers can prove advantageous.
For the example in
Figure 21.12 LETIMER Continuous Operation on page 726
, 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
CNT
COMP0
COMP1
REP0
REP1
1
2
0
3
1
2
2
3
1
2
1
3
1
2
0
3
1
2
2
2
1
2
1
2
1
2
0
2
1
2
2
1
1
2
1
1
1
2
0
1
1
1
1
4
1
1
0
4
1
1
1
3
2
1
0
3
2
1
1
2
2
1
0
2
2
1
1
1
2
1
0
1
2
2
2
2
2
2
1
2
2
2
0
2
2
2
2
1
Initial configuration,
REPB just written
UFIF
REP0IF
UFIF
UFIF
UFIF
UFIF
Int. flags set
Stop,
final values
Write
COMP1 = 2
REP1 = 2
UFIF
UFIF
UFIF
REP0IF
4
4
4
4
4
u
4
u
4
u
2
2 2
u
2
u
2
u
2
u
2
2
1
1
2
2
0
1
2
u
2
u
REP0IF
LFACLK
LETIMERn
LETn_O0
UFOA0 = 01
LETn_O1
UFOA0 = 10
Pulse Seq. 1
Pulse Seq. 2
Pulse Seq. 3
4
4
4
4
4
4
2
2
2
2
2
0
0
2
u
Figure 21.12. LETIMER Continuous Operation
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 21.12 LETIMER Continuous Operation on page 726
. 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.
Reference Manual
LETIMER - Low Energy Timer
silabs.com
| Building a more connected world.
Rev. 1.1 | 726