PIC16C9XX
5.4 PORTD and TRISD Registers
PORTD is an 8-bit port with Schmitt Trigger input buff-
ers. The first five pins are configurable as general pur-
pose I/O pins or LCD segment drivers. Pins RD5, RD6
and RD7 can be digital inputs or LCD segment or com-
mon drivers.
TRISD controls the direction of pins RD0 through RD4
when PORTD is configured as a digital port.
Note: On a Power-on Reset these pins are con-
figured as LCD segment drivers.
Note:
To configure the pins as a digital port, the
corresponding bits in the LCDSE register
must be cleared. Any bit set in the LCDSE
register overrides any bit settings in the
corresponding TRIS register.
EXAMPLE 5-4: INITIALIZING PORTD
BCF STATUS,RP0
BSF STATUS,RP1
BCF LCDSE,SE29
BCF LCDSE,SE0
BSF STATUS,RP0
BCF STATUS,RP1
MOVLW 0x07
MOVWF TRISD
;Select Bank2
;
;Make RD<7:5> digital
;Make RD<4:0> digital
;Select Bank1
;
;Make RD<4:0> outputs
;Make RD<7:5> inputs
FIGURE 5-6: PORTD<4:0> BLOCK
DIAGRAM
LCD
Segment Data
LCD Segment
Output Enable
Data Bus
WR
PORT
D
Q
CK
Data Latch
WR
TRIS
D
Q
CK
TRIS Latch
RD TRIS
LCDSE<n>
I/O pin
Schmitt
Trigger
input
buffer
RD
PORT
Q
D
ENEN
DS30444E - page 36
© 1997 Microchip Technology Inc.