
Rev. 1.40
82
March 29, 2019
Rev. 1.40
83
March 29, 2019
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
Bit 1
PCR1
: Define PB4 is A/D input or not
0: Not A/D input
1: A/D input, AN1
Bit 0
PCR0
: Define PB3 is A/D input or not
0: Not A/D input
1: A/D input, AN0
A/D Operation
The START bit in the ADCR register is used to start and reset the A/D converter. When the
microcontroller sets this bit from low to high and then low again, an analog to digital conversion
cycle will be initiated. When the START bit is brought from low to high but not low again, the
EOCB bit in the ADCR register will be set high and the analog to digital converter will be reset. It
is the START bit that is used to control the overall start operation of the internal analog to digital
converter.
The EOCB bit in the ADCR register is used to indicate when the analog to digital conversion process
is complete. This bit will be automatically set to “0” by the microcontroller after a conversion cycle
has ended. In addition, the corresponding A/D interrupt request flag will be set in the interrupt
control register, and if the interrupts are enabled, an appropriate internal interrupt signal will be
generated. This A/D internal interrupt signal will direct the program flow to the associated A/D
internal interrupt address for processing. If the A/D internal interrupt is disabled, the microcontroller
can be used to poll the EOCB bit in the ADCR register to check whether it has been cleared as an
alternative method of detecting the end of an A/D conversion cycle.
The clock source for the A/D converter, which originates from the system clock f
SYS
, can be chosen
to be either f
SYS
or a subdivided version of f
SYS
. The division ratio value is determined by the
ADCS2~ADCS0 bits in the ACSR register.
Although the A/D clock source is determined by the system clock f
SYS
, and by bits ADCS2~ADCS0,
there are some limitations on the maximum A/D clock source speed that can be selected. As the
minimum value of permissible A/D clock period, t
AD
, is 0.5µs, care must be taken for system clock
frequencies equal to or greater than 4MHz. For example, if the system clock operates at a frequency
of 4MHz, the ADCS2~ADCS0 bits should not be set to “100”. Doing so will give A/D clock periods
that are less than the minimum A/D clock period which may result in inaccurate A/D conversion
values. Refer to the following table for examples, where values marked with an asterisk * show
where, depending upon the devices, special care must be taken, as the values may be less than the
specified minimum A/D Clock Period.
f
SYS
A/D Clock Period (t
AD
)
ADCS2,
ADCS1,
ADCS0
= 100
(f
SYS
)
ADCS2,
ADCS1,
ADCS0
= 000
(f
SYS
/2)
ADCS2,
ADCS1,
ADCS0
= 101
(f
SYS
/4)
ADCS2,
ADCS1,
ADCS0
= 001
(f
SYS
/8)
ADCS2,
ADCS1,
ADCS0
= 110
(f
SYS
/16)
ADCS2,
ADCS1,
ADCS0
= 010
(f
SYS
/32)
ADCS2,
ADCS1,
ADCS0
= 111
= 011
1MHz
1µs
2µs
4µs
8µs
16µs
32µs
Undefined
2MHz
500ns
1µs
2µs
4µs
8µs
16µs
Undefined
4MHz
250ns*
500ns
1µs
2µs
4µs
8µs
Undefined
8MHz
125ns*
250ns*
500ns
1µs
2µs
4µs
Undefined
12MHz
83ns*
167ns*
333ns*
667ns
1.33µs
2.67µs
Undefined
A/D Clock Period Examples