English
Language : 

PIC16F946 Datasheet, PDF (58/274 Pages) Microchip Technology – 64-Pin Flash-Based, 8-Bit CMOS Microcontrollers with LCD Driver and nanoWatt Technology
PIC16F946
3.5 PORTD and TRISD Registers
PORTD is an 8-bit port with Schmitt Trigger input buffers.
Each pin is individually configured as an input or output.
PORTD is only available on the PIC16F946 and
PIC16F946.
Note:
Analog lines that carry LCD signals
(i.e., SEGx, COMy, where x and y are seg-
ment and common identifiers) are shown
as direct connections to the device pins.
The signals are outputs from the LCD
module and may be tri-stated, depending
on the configuration of the LCD module.
EXAMPLE 3-4: INITIALIZING PORTD
BCF
BCF
CLRF
BSF
BCF
MOVLW
MOVWF
BCF
BCF
STATUS,RP0 ;Bank 0
STATUS,RP1 ;
PORTD
;Init PORTD
STATUS,RP0 ;Bank 1
STATUS,RP1 ;
FFh
;Set RD<7:0> as inputs
TRISD
;
STATUS,RP0 ;Bank 0
STATUS,RP1 ;
REGISTER 3-9:
PORTD – PORTD REGISTER (ADDRESS: 08h)
R/W-x R/W-x R/W-x R/W-x R/W-x
RD7
RD6
RD5
RD4
RD3
bit 7
R/W-x
RD2
R/W-x
RD1
R/W-x
RD0
bit 0
bit 7-0
RD<7:0>: PORTD I/O Pin bits
1 = Port pin is >VIH
0 = Port pin is <VIL
Legend:
R = Readable bit
- n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared x = Bit is unknown
REGISTER 3-10:
TRISD – PORTD TRI-STATE REGISTER (ADDRESS: 88h)
R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1
TRISD7 TRISD6 TRISD5 TRISD4 TRISD3 TRISD2
bit 7
R/W-1
TRISD1
R/W-1
TRISD0
bit 0
bit 7-0
TRISD<7:0>: PORTD Tri-State Control bits
1 = PORTD pin configured as an input (tri-stated)
0 = PORTD pin configured as an output
Note: TRISD<7:6> always reads ‘1’ in XT, HS and LP OSC modes.
Legend:
R = Readable bit
- n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared x = Bit is unknown
DS41265A-page 56
Preliminary
© 2005 Microchip Technology Inc.