ht82a836r Holtek Semiconductor Inc., ht82a836r Datasheet - Page 56

no-image

ht82a836r

Manufacturer Part Number
ht82a836r
Description
Usb Audio Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
HT82A836R
Manufacturer:
HOLTEK/合泰
Quantity:
20 000
Initialising the A/D Converter
The internal A/D converter must be initialised in a spe-
cial way. Each time the A/D channel selection bits are
modified by the program, the A/D converter 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 con-
verter after the channel selection bits have changed,
then, within a time frame of one to ten instruction cycles,
the START bit in the ADCR register must 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.
Rev. 1.00
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
ACS2~ACS0 bits which are also contained in the
ADCR register.
Step 3
Select A/D converter power on or power down by pro-
gramming the PCR2~PCR0 bits in the ADCR register.
Note that this step can be combined with Step 2 into a
single ADCR register programming operation.
Step 4
If the interrupts are to be used, the interrupt control
registers must be correctly configured to ensure the
A/D Conversion Timing
56
The following timing diagram shows graphically the vari-
ous stages involved in an analog to digital conversion
process and its associated timing.
The setting up and operation of the A/D converter func-
tion is fully under the control of the application program
as there are no configuration options associated with
the A/D converter. 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 con-
tinue with other functions.
Note: When checking for the end of the conversion
A/D converter interrupt function is active. The master
interrupt control bit, EMI, in the INTC0 interrupt control
register must be set to 1 , the multi-function 1 inter-
rupt control bit, EMF1I, in the INTC1 register and the
A/D converter interrupt bit, EADI, in the MFI1C regis-
ter must also be set to 1 .
Step 5
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 6
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 ADRL and ADRH can be read to obtain the
conversion value. As an alternative method if the in-
terrupts are enabled and the stack is not full, the pro-
gram can wait for an A/D interrupt to occur.
process, if the method of polling the EOCB bit in
the ADCR register is used, the interrupt enable
step above can be omitted.
HT82A836R
March 20, 2008

Related parts for ht82a836r