English
Language : 

PIC17C7XX Datasheet, PDF (87/328 Pages) Microchip Technology – High-Performance 8-Bit CMOS EPROM Microcontrollers with 10-bit A/D
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 is automatically configured as
analog inputs, and must be configured in software to
be a digital I/O.
Figure 10-17: Block Diagram of RH7:RH4
Data bus
D
Q
WR PORTH
CK Q
Data Latch
WR DDRH
D
Q
CK Q
DDRH Latch
EXAMPLE 10-8: INITIALIZING PORTH
MOVLB
MOVLW
MOVPF
CLRF
MOVLW
MOVWF
8
0x0E
ADCON1
PORTH, F
0x03
DDRH
; Select Bank 8
; Configure PORTH as
; digital
; Initialize PORTH data
; latches before
; the data direction
; register
; Value used to init
; data direction
; Set RH<1:0> as inputs
; RH<7:2> as outputs
VDD
P
I/O pin
N
VSS
RD DDRH
Q
D
EENN
ST
input
buffer
RD PORT
PCFG3:PCFG0
VAIN
To other pads
CHS3:CHS0
To other pads
Note: I/O pins have protection diodes to VDD and VSS.
© 1998 Microchip Technology Inc.
DS30289A-page 87