HT82A520R HOLTEK [Holtek Semiconductor Inc], HT82A520R Datasheet - Page 36

no-image

HT82A520R

Manufacturer Part Number
HT82A520R
Description
Full Speed USB 8-Bit OTP MCU with SPI
Manufacturer
HOLTEK [Holtek Semiconductor Inc]
Datasheet
ods 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 de-
vice, special care must be taken, as the values may be
less than the specified minimum A/D Clock Period
A/D Input Pins
All of the A/D analog input pins are pin-shared with the
I/O pins on Port B and Port C. Bits PCR3~PCR0 in the
ACSR register, determine whether the input pins are
setup as normal Port B and Port C input/output pins or
whether they are setup as analog inputs. In this way, pins
can be changed under program control to change their
function from normal I/O operation to analog inputs and
vice versa. Pull-high resistors, which are setup through
configuration options, apply to the input pins only when
they are used as normal I/O pins, if setup as A/D inputs
the pull-high resistors will be automatically disconnected.
Note that it is not necessary to first setup the A/D pin as
an input in the PBC or PCC port control register to enable
the A/D input as when the PCR3~PCR0 bits enable an
A/D input, the status of the port control register will be
overridden.
Initialising the A/D Converter
The internal A/D converter must be initialised in a spe-
cial way. Each time the Port B and Port C A/D channel
selection bits are modified by the program, the A/D con-
verter must be re-initialised. If the A/D converter is not
initialised after the channel selection bits are changed,
the EOCB flag may have an undefined value, which may
produce a false end of conversion signal. To initialise the
A/D converter after the channel selection bits have
changed, then, within a time frame of one to ten instruc-
tion cycles, the START bit in the ADCR register must
Rev.1.00
A/D Conversion Timing
36
first be set high and then immediately cleared to zero.
This will ensure that the EOCB flag is correctly set to a
high condition.
Summary of A/D Conversion Steps
The following summarises the individual steps that
should be executed in order to implement an A/D con-
version process.
Step 1
Select the required A/D conversion clock by correctly
programming bits ADCS1 and ADCS0 in the ACSR
register.
Step 2
Select which channel is to be connected to the internal
A/D converter by correctly programming the ACS3~
ACS0 bits which are also contained in the ADCR register.
Step 3
Select which pins on Port B and Port C are to be used
as A/D inputs and configure them as A/D input pins by
correctly programming the PCR3~PCR0 bits in the
ACSR register.
Step 4
The analog to digital conversion process can now be
initialised by setting the START bit in the ADCR regis-
ter from 0 to 1 and then to 0 again. Note that this
bit should have been originally set to 0 .
Step 5
To check when the analog to digital conversion pro-
cess is complete, the EOCB bit in the ADCR register
can be polled. The conversion process is complete
when this bit goes low. When this occurs the A/D data
registers ADR can be read to obtain the conversion
value. As an alternative method if the interrupts are
enabled and the stack is not full, the program can wait
for an A/D interrupt to occur.
HT82A520R/HT82A620R
October 23, 2009

Related parts for HT82A520R