Rev. 1.60
152
August 20, 2019
Rev. 1.60
153
August 20, 2019
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
Summary of A/D Conversion Steps
The following summarises the individual steps that should be executed in order to implement an A/D
conversion process.
• Step 1
Select the required A/D conversion clock by properly programming the ADCK2~ADCK0 bits in
the ADCR1 register.
• Step 2
Enable the A/D converter by setting the ADCEN bit in the ADCR0 register to one.
• Step 3
Select which signal is to be connected to the internal A/D converter by correctly configuring the
ACS3~ACS0 bits
If the TSE bit is 0 and ACS3~ACS0 bits are equal to x000~x111, then an external channel input
is selected.
If the TSE bit is 1 and ACS3~ACS0 bits are equal to 1xxx, then the relevant internal temperature
sensor signal is selected.
•
Step 4
Select the reference voltgage source by configuring the K_VPTAT, K_REFO and VREFS bits.
• Step 5
Select the A/D converter output data format by configuring the ADRFS bit.
• Step 6
If A/D conversion interrupt is used, the interrupt control registers must be correctly configured
to ensure the A/D interrupt function is active. The master interrupt bontrol bit, EMI, and the A/D
conversion interrupt control bit, ADE, must both be set high in advance.
• Step 7
The A/D conversion procedure can now be initialized by setting the START bit from low to high
and then low again.
• Step 8
If A/D conversion is in progress, the ADBZ flag will be set high. After the A/D conversion
process is complete, the ADBZ flag will go low and then the output data can be read from ADRH
and ADRL registers.
Note: When checking for the end of the conversion process, if the method of polling the ADBZ bit
in the ADCR0 register is used, the interrupt enable step above can be omitted. However, the
interrupt method must be used to check for the end of the conversion process and obtain the
corresponding digital output data if the auto-conversion mode is enabled.
Programming Considerations
During microcontroller operations where the A/D converter is not being used, the A/D internal
circuitry can be switched off to reduce power consumption, by setting bit ADCEN low in the ADCR
register. When this happens, the internal A/D converter circuits will not consume power irrespective
of what analog voltage is applied to their input lines. If the A/D converter input lines are used as
normal I/Os, then care must be taken as if the input voltage is not at a valid logic level, then this may
lead to some increase in power consumption.
A/D Converter Transfer Function
As the devices contain a 12-bit A/D converter, its full-scale converted digitised value is equal to
FFFH. Since the full-scale analog input value is equal to the reference voltage, this gives a single bit
analog input value of reference voltage value divided by 4096.
1 LSB = V
REF
÷ 4096