HT46801N-1 Holtek Semiconductor, HT46801N-1 Datasheet - Page 46

no-image

HT46801N-1

Manufacturer Part Number
HT46801N-1
Description
(HT4xR01x-1) Small Package 8-Bit OTP MCU
Manufacturer
Holtek Semiconductor
Datasheet
www.DataSheet.co.kr
A/D Input Pins
All of the A/D analog input pins are pin-shared with the
I/O pins on Port A. Bits PCR3~PCR0 in the register, de-
termine whether the input pins are setup as normal Port
A 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 opera-
tion to analog inputs and vice versa. Pull-high resistors,
which are setup through register programming, 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 neces-
sary to first setup the A/D pin as an input in the PAC 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.
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 ADCS2, ADCS1 and ADCS0 in the
register.
Step 2
Enable the A/D by clearing the ADONB bit in the
ACSR register to zero.
Step 3
Select which channel is to be connected to the internal
A/D converter by correctly programming the
ACS1~ACS0 bits which are also contained in the reg-
ister.
Step 4
Select which pins are to be used as A/D inputs and
configure them as A/D input pins by correctly pro-
gramming the PCR3~PCR0 bits in the ADCR register.
Note that this step can be combined with Step 3. into a
single ADCR register programming operation.
Step 5
If the interrupts are to be used, the interrupt control reg-
isters must be correctly configured to ensure the A/D
converter interrupt function is active. The master inter-
rupt control bit, EMI, in the INTC0 interrupt control reg-
ister must be set to 1 , and the A/D converter interrupt
bit, ADE, in the INTC1 register must also be set to 1 .
Step 6
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 .
46
Note:
The accompanying 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 continue with other
functions. The time taken for the A/D conversion is 16t
where t
Programming Considerations
When programming, special attention must be given to
the PCR[3:0] bits in the register. If these bits are all
cleared to zero no external pins will be selected for use
as A/D input pins allowing the pins to be used as normal
I/O pins. When this happens the internal A/D circuitry
will be power down. Setting the ADONB bit high has the
ability to power down the internal A/D circuitry, which
may be an important consideration in power sensitive
applications.
A/D Transfer Function
As the device 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
VDD voltage, this gives a single bit analog input value of
V
between the analog input value and the digitised output
value for the A/D converter.
Note that to reduce the quantisation error, a 0.5 LSB off-
set is added to the A/D Converter input. Except for the
digitised zero value, the subsequent digitised values will
change at a point 0.5 LSB below where they would
change without the offset, and the last full scale digitised
value will change at a point 1.5 LSB below the V
DD
Step 7
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.
/4096. The diagram show the ideal transfer function
AD
When checking for the end of the conversion
process, if the method of polling the EOCB bit in
the ADCR register is used, the interrupt enable
step above can be omitted.
is equal to the A/D clock period.
HT46R01B-1/HT46R01N-1
HT48R01B-1/HT48R01N-1
June 9, 2011
DD
level.
AD
Datasheet pdf - http://www.DataSheet4U.net/

Related parts for HT46801N-1