User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 629
www.energymicro.com
1. Configure the channels to be used, be sure to set DECODE in CHx_EVAL.
2. Set PRSCNT to enable generation of count waveforms on PRS. Also configure a PCNT to listen to
the PRS channels and count accordingly.
3. Configure the following in STx_TCONFA and STx_TCONFB:
a. Set MASK = 0b1000 in STx_TCONFA and STx_TCONFB for all used states. This enables three
sensors to be evaluated by the decoder.
b. Configure the remaining bit fields in STx_TCONFA and STx_TCONFB as described in
Table 25.3 (p. 629) .
Table 25.3. LESENSE decoder configuration
Register TCONFA_NEXTSTATETCONFA_COMP TCONFA_PRSACT TCONFB_NEXTSTATETCONFB_COMP TCONFB_PRSACT
ST0 1 0b001 UP 7 0b100 DOWN
ST1 2 0b011 UP 0 0b000 DOWN
ST2 3 0b010 UP 1 0b001 DOWN
ST3 4 0b110 UP 2 0b011 DOWN
ST4 5 0b111 UP 3 0b010 DOWN
ST5 6 0b101 UP 4 0b110 DOWN
ST6 7 0b100 UP 5 0b111 DOWN
ST7 0 0b000 UP 6 0b101 DOWN
4. To initialize the decoder, run one scan, and read the present sensor status from SENSORSTATE.
Then write the index of this state to DECSTATE.
5. Write to START in CMD to start scanning of sensors and decoding.
25.3.14.4 LESENSE decoder 2
The example below illustrates how the LESENSE decoder can be used to implement the state machine
seen in Figure 25.14 (p. 629) .
Figure 25.14. FSM example 2
0
2
4
6
8
0010
0000
0001
0000
0001
0011
0011
0010
1XXX
1XXX
1XXX
1XXX
State Index
Sensor value
1. Configure STx_TCONFA and STx_TCONFB as described in Table 25.4 (p. 630) .