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
A/D Converter Input Pins
All of the external A/D analog input pins are pin-shared with the I/O pins as well as other functions.
The corresponding pin-shared function selection bits in the PxS0 and PxS1 registers, determine
whether the external input pins are setup as A/D converter analog channel inputs or whether they
have other functions. If the corresponding pin is setup to be an A/D converter analog channel input,
the original pin functions will be disabled. In this way, pins can be changed under program control
to change their function between A/D inputs and other functions. All pull-high resistors, which are
setup through register programming, will be automatically disconnected if the pins are setup as A/D
inputs. Note that it is not necessary to first setup the A/D pin as an input in the port control register
to enable the A/D input as when the relevant A/D input function selection bits enable an A/D input,
the status of the port control register will be overridden.
The A/D converter has its own reference voltage pin, VREF. However, the reference voltage can
also be supplied from the power supply pin or an internal temperature sensor circuit, a choice which
is made through the VREFP_EXT and VREFS bits in the TSC2 and ADCR1 register respectively.
Note that the analog input signal values must not be allowed to exceed the value of the selected A/D
reference voltage.
Conversion Rate and Timing Diagram
A complete A/D conversion contains two parts, data sampling and data conversion. The data
sampling which is defined as t
ADS
takes 4 A/D clock cycles and the data conversion takes 12 A/D
clock cycles. Therefore a total of 16 A/D clock cycles for an external input A/D conversion which is
defined as t
ADC
are necessary. However, an A/D conversion for an internal temperature sensor signal
will take a total of 56 A/D clock cycles.
Maximum single A/D conversion rate = A/D clock period / 16 (External channel input signal)
Maximum single A/D conversion rate = A/D clock period / 56 (Internal Temperature sensor signal)
The accompanying diagram shows graphically the various stages involved in an analog to digital
conversion process and its associated timing. After an A/D conversion process has been initiated
by the application program, the microcontroller internal hardware will begin to carry out the
conversion, during which time the program can continue with other functions. The time taken for the
A/D conversion is 16 t
ADCK
clock cycles where t
ADCK
is equal to the A/D clock period.
ADCEN
START
ADBZ
ACS[3:0]
(TSE=0)
off
on
off
on
t
ON2ST
t
ADS
A/D sampling time
t
ADS
A/D sampling time
Start of A/D conversion
Start of A/D conversion
Start of A/D conversion
End of A/D
conversion
End of A/D
conversion
t
ADC
A/D conversion time
t
ADC
A/D conversion time
t
ADC
A/D conversion time
x011B
x010B
x000B
x001B
A/D channel
switch
A/D Conversion Timing – External Channel Input