SN8P2711A
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 78
Version 0.1
P4.0 is shared with general purpose I/O, ADC input (AIN0) and ADC external high reference voltage input. EVHENB
flag of VREFH register is external ADC high reference voltage input control bit. If EVHENB is enabled, P4.0 general
purpose I/O and ADC analog input (AIN0) functions are disabled. P4.0 pin is connected to ADC high reference voltage
directly.
Note:
For P4.0 general purpose I/O and AIN0 functions, EVHENB must be set as “0”.
0AFH
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
VREFH
EVHENB
- - - - -
VHS1
VHS0
Read/Write
R/W
- - - - -
R/W
R/W
After
reset
0 - - - - - 0 0
Bit 7
EVHENB:
External ADC high reference voltage input control bit.
0 = Disable ADC external high reference voltage input.
1 = Enable ADC external high reference voltage input.
¾
Example: Set P4.0 to be general purpose input mode. EVHENB and P4CON.0 bits must be set as “0”.
; Check EVHENB status.
B0BTS0
FEVHENB
; Check EVHENB = 0.
B0BCLR
FEVHENB
; EVHENB = 1, clear it to disable external ADC high
reference input.
; EVHENB = 0, execute next routine.
; Check GCHS and CHS[2:0] status.
B0BCLR
FGCHS
;If CHS[2:0] point to P4.0 (CHS[2:0] = 000B), set GCHS=0
;If CHS[2:0] don’t point to P4.0 (CHS[2:0]
≠
000B), don’t
care GCHS status.
; Clear P4CON.
B0BCLR
P4CON.0
; Enable P4.0 digital function.
; Enable P4.0 input mode.
B0BCLR
P4M.0
; Set P4.0 as input mode.