HT46R064B/065B/066B
Programming Considerations
between the analog input value and the digitised output
value for the A/D converter.
When programming, special attention must be given to
the PCR[2: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.
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 VDD level.
A/D Programming Example
The following two programming examples illustrate how
to setup and implement an A/D conversion. In the first
example, the method of polling the EOCB bit in the
ADCR register is used to detect when the conversion
cycle is complete, whereas in the second example, the
A/D interrupt is used to determine when the conversion
is complete.
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
DD/4096. The diagram show the ideal transfer function
P
C
R
2
~
0
0
0
B
x
x
x
B
-
P
C
R
[
2
:
0
]
i
s
n
o
t
e
q
u
a
l
t
o
"
0
"
P
C
R
0
A
D
O
N
B
t
O
N
2
S
T
A
D
C
m
o
d
u
l
e
o
f
f
o
n
o
n
O
N
A
/
D
s
a
m
p
l
i
n
g
A
/
t
D
i
m
s
e
a
m
p
l
i
n
g
t
i
m
e
A
D
t
C
S
A
D
t
C
S
S
T
A
R
T
E
O
C
B
A
C
S
2
~
x
x
x
B
0
0
0
B
0
0
1
B
0
1
0
B
A
C
S
0
P
o
w
e
r
-
o
n
S
t
a
r
t
o
f
A
/
D
S
t
a
r
t
o
f
A
/
D
S
t
a
r
t
o
f
A
/
D
R
e
s
e
t
c
o
n
v
e
r
s
i
o
n
c
o
n
v
e
r
s
i
o
n
c
o
n
v
e
r
s
i
o
n
R
e
s
e
t
A
/
D
R
c
e
s
e
t
A
/
D
R
e
s
e
t
A
/
D
c
o
n
v
e
r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