Datasheet

1998-2013 Microchip Technology Inc. DS30289C-page 89
PIC17C7XX
10.8 PORTH and DDRH Registers
(PIC17C76X only)
PORTH is an 8-bit wide, bi-directional port. The corre-
sponding data direction register is DDRH. A '1' in
DDRH configures the corresponding port pin as an
input. A '0' in the DDRH register configures the corre-
sponding port pin as an output. Reading PORTH reads
the status of the pins, whereas writing to PORTH will
write to the respective port latch.
The upper four bits of PORTH are multiplexed with
4 channels of the 10-bit A/D converter.
The remaining bits of PORTH are general purpose I/O.
Upon RESET, RH7:RH4 are automatically configured
as analog inputs and must be configured in software to
be a digital I/O.
EXAMPLE 10-8: INITIALIZING PORTH
FIGURE 10-17: BLOCK DIAGRAM OF RH7:RH4
MOVLB 8 ; Select Bank 8
MOVLW 0x0E ; Configure PORTH as
MOVPF ADCON1 ; digital
CLRF PORTH, F ; Initialize PORTH data
; latches before
; the data direction
; register
MOVLW 0x03 ; Value used to init
; data direction
MOVWF DDRH ; Set RH<1:0> as inputs
; RH<7:2> as outputs
Data Bus
WR PORTH
WR DDRH
RD PORT
Data Latch
DDRH Latch
P
V
SS
I/O pin
PCFG3:PCFG0
To other pads
Q
D
Q
CK
EN
QD
EN
N
ST
Input
Buffer
VDD
RD DDRH
To other pads
VAIN
CHS3:CHS0
Q
D
QCK
Note: I/O pins have protection diodes to VDD and VSS.