Rev.3.02
Apr 10, 2008
REJ03B0177-0302
38D2 Group
Fig. 37 Structure of AD control register
ADKEY function
The ADKEY function is used to judge the analog input voltage
input from the ADKEY pin. When the A/D converter starts
operating after VIL (0.7
× Vcc-0.5) or less is input, the event of
analog voltage input can be judged with the A/D conversion
interrupt.
This function can be used with the STP and WIT state.
As for the ADKEY function in 38D2 Group, the A/D conversion
of analog input voltage immediately after starting ADKEY
function is not performed.
Therefore, the A/D conversion result immediately after an
ADKEY function is undefined. Accordingly, when the A/D
conversion result of the analog input voltage input from the
ADKEY pin is required, start the A/D conversion by program
after the analog input pin corresponding to ADKEY is selected.
ADKEY Selection
When the ADKEY pin is used, set the ADKEY selection bit to
“1”. The ADKEY selection bit is “0”, just after the A/D
conversion is started.
ADKEY Enable
The ADKEY function is enabled by writing “1” to the ADKEY
enable bit. Surely, in order to enable ADKEY function, set “1” to
the ADKEY enable bit, after setting the ADKEY selection bit to
“1”.
When the ADKEY enable bit of the AD control register is “1”,
the analog input pin selection bits become invalid. Please do not
write “0” in the AD conversion completion bit by the program
during ADKEY enabled state.
[ADKEY Control Circuit]
In order to obtain a more exact conversion result, by the A/D
conversion with ADKEY, execute the following;
set the input to the ADKEY pin into a steep falling waveform,
stabilize the input voltage within 8 clock cycles (1
μs at f(XIN)
= 8 MHz) after the input voltage is under VIL
The threshold voltage with an actual ADKEY pin is the voltage
between VIH-VIL.
In order not to make ADKEY operation perform superfluously in
a noise etc., in the state of the waiting for an input, set the voltage
of an ADKEY pin to VIH (0.9VCC) or more.
When the following operations are performed, the A/D
conversion operation cannot be guaranteed.
When the CPU mode register is operated during A/D
conversion operation,
When the AD conversion control register is operated during
A/D conversion operation,
When the STP or WIT instruction is executed during A/D
conversion operation.
AD control register
(ADCON: address 001516)
Analog input pin selection bits
b2 b1 b0
0 0 0 : P40/AN0
0 0 1 : P41/AN1
0 1 0 : P42/AN2
0 1 1 : P43/AN3
1 0 0 : P44/AN4
1 0 1 : P45/AN5
1 1 0 : P46/AN6
1 1 1 : P47/AN7
AD conversion completion bit
0 : Conversion in progress
1 : Conversion completed
AD conversion clock selection bit
0 :
φSOURCE/2
1 :
φSOURCE/8
ADKEY enable bit
0 : Disabled
1 : Enabled
10-bit or 8-bit conversion switch bit
0 : 10-bit AD
1 : 8-bit AD
ADKEY selection bit
0 : Invalid
1 : Valid
b7
b0
*VREF input switch bit
0: ON only during A/D conversion
1: ON
Note : The bit 5 to bit 1 of address 001616 become “0” at reading.
Also, bit 0 is undefined at reading.
(low-order)
*
b1 b0
b7
b0
AD conversion register
high-order
(Address 001716)
b7
b2
b3
b6 b5 b4
b9 b8
(high-order)
b7
b0
At 10bitAD
(Read address 001716 before 001616)
b5
b0
b1
b4 b3 b2
b7 b6
b7
b0
Notes 1:
φSOURCE indicates the followings:
XIN input in the frequency/2, 4, or 8 mode
On-chip oscillator divided by 4 in the low-speed and the on-chip
oscillator mode
2: When the ADKEY enable bit is “1”, the analog input pin selection
bits are invalid.
Do not execute the A/D conversion by program while the ADKEY is
enabled.
Bit 0 to bit 2 of ADCON are not changed even when ADKEY is
enabled.
AD conversion register
low-order
(Address 001616)
At 8bitAD
(Read only address 001716)
(Address 001716)
(2)
(1)