...the world's most energy friendly microcontrollers
2016-04-28 - Giant Gecko Family - d0053_Rev1.20
635
www.silabs.com
Figure 25.10. Capacitive sense setup
EFM32
ACMP0_CH0
ACMP0_CH1
ACMP0_CH2
ACMP0_CH3
The following steps show how to configure LESENSE to scan through the four buttons 100 times per
second, issuing an interrupt if one of them is pressed.
1. Assuming LFACLK
LESENSE
is 32kHz, set PCPRESC to 3 and PCTOP to 39 in CTRL. This will make
the LESENSE scan frequency 100Hz.
2. Enable channels 0 through 3 in CHEN and set IDLECONF for these channels to DISABLED. In
capacitive sense mode, the GPIO should always be disabled (analog input).
3. Configure the ACMP to operate in CAPSENSE mode, refer to Section 26.3.5 (p. 672) for details.
4. Configure the following bit fields in CHx_CONF, for channels 0 through 3:
a. Set EXTIME to 0. No excitation is needed in this mode.
b. Set SAMPLE to COUNTER and COMP to LESS. This makes LESENSE interpret a sensor as
active if the frequency on a channel drops below the threshold, i.e. the button is pressed.
c. Set SAMPLEDLY to an appropriate value, each sensor will be measured for SAMPLEDLY/
LFACLK
LESENSE
seconds. MEASUREDLY should be set to 0
5. Set CTRTHRESHOLD to an appropriate value. An interrupt will be issued if the counter value for a
sensor is below this threshold after the measurement phase.
6. Enable interrupts on channels 0 through 3.
7. Start scan sequence by writing a 1 to START in CMD.
In a capacitive sense application, it might be required to calibrate the threshold values on a periodic
basis, this is done in order to compensate for humidity and other physical variations. LESENSE is able
to store up to 16 counter values from a configurable number of channels, making it possible to collect
sample data while in EM2. When calibration is to be performed, the CPU only has to be woken up for a
short period of time as the data to be processed already lies in the result registers. To enable storing of
the count value for a channel, set STRSAMPLE in the CHx_INTERACT register.
25.3.14.2 LC sensor
Figure 25.11 (p. 635) below illustrates how the EFM32GG can be set up to monitor four LC sensors.
Figure 25.11. LC sensor setup
EFM32
ACMP0_CH0
ACMP0_CH1
ACMP0_CH2
DAC0_OUT0
X
X
X
X
ACMP0_CH3
LESENSE can be used to excite and measure the damping factor in LC sensor oscillations. To measure
the damping factor, the ACMP can be used to generate a high output each time the sensor voltage
Summary of Contents for Giant Gecko EFM32GG
Page 842: ......