English
Language : 

PIC16F946 Datasheet, PDF (70/274 Pages) Microchip Technology – 64-Pin Flash-Based, 8-Bit CMOS Microcontrollers with LCD Driver and nanoWatt Technology
PIC16F946
3.8 PORTG and TRISG Registers
PORTG is an 8-bit port with Schmitt Trigger input
buffers. RG<5:0> are individually configured as inputs
or outputs, depending on the state of the port direction.
The port bits are also multiplexed with LCD segment
functions.
Note:
Analog lines that carry LCD signals
(i.e., SEGx, where x are segment 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-7: INITIALIZING PORTG
BCF
BCF
CLRF
BSF
BCF
MOVLW
MOVWF
CLRF
BCF
BCF
STATUS,RP0
STATUS,RP1
PORTG
STATUS,RP0
STATUS,RP1
0Fh
TRISF
;
ANSEL
STATUS,RP0
STATUS,RP1
;Bank 3
;
;Init PORTG
;Bank 1
;
;Set RG<3:0> as inputs
;Make RG<2:0> as I/O’s
;Bank 0
;
REGISTER 3-15:
PORTG – PORTG REGISTER (ADDRESS: 189h)
U-0
U-0
R/W-x R/W-x R/W-x
—
—
RG5
RG4
RG3
bit 7
R/W-x
RG2
R/W-x
RG1
R/W-x
RG0
bit 0
bit 7-6
bit 5-0
Unimplemented: Read as ‘0’
RG<5:0>: PORTG 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-16:
TRISG – PORTG TRI-STATE REGISTER (ADDRESS: 187h)
U-0
U-0
R/W-1 R/W-1 R/W-1 R/W-1
—
—
TRISG5 TRISG4 TRISG3 TRISG2
bit 7
R/W-1
TRISG1
R/W-1
TRISG0
bit 0
bit 7-6
bit 5-0
Unimplemented: Read as ‘0’
TRISG<5:0>: Data Direction bits
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 68
Preliminary
© 2005 Microchip Technology Inc.