PIC18C242 MICROCHIP [Microchip Technology], PIC18C242 Datasheet - Page 83

no-image

PIC18C242

Manufacturer Part Number
PIC18C242
Description
High-Performance Microcontrollers with 10-Bit A/D
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18C242-I/SO
Manufacturer:
MICROCHIP
Quantity:
2 000
Part Number:
PIC18C242/JW
Manufacturer:
NS
Quantity:
10
8.3
PORTC is an 8 bit wide bi-directional port. The corre-
sponding Data Direction Register is TRISC. Setting a
TRISC bit (=1) will make the corresponding PORTC pin
an input, (i.e., put the corresponding output driver in a
hi-impedance mode). Clearing a TRISC bit (=0) will
make the corresponding PORTC pin an output, (i.e.,
put the contents of the output latch on the selected pin).
The Data Latch register (LATC) is also memory
mapped. Read-modify-write operations on the LATC
register reads and writes the latched output value for
PORTC.
PORTC is multiplexed with several peripheral functions
(Table 8-5). PORTC pins have Schmitt Trigger input
buffers.
When enabling peripheral functions, care should be
taken in defining TRIS bits for each PORTC pin. Some
peripherals override the TRIS bit to make a pin an out-
put, while other peripherals override the TRIS bit to
FIGURE 8-7:
7/99 Microchip Technology Inc.
PORTC, TRISC and LATC Registers
PORTC BLOCK DIAGRAM (PERIPHERAL OUTPUT OVERRIDE)
WR LATC or
WR PORTC
WR TRISC
Data Bus
Peripheral Data In
RD PORTC
CK
CK
D
RD TRISC
D
RD LATC
Q
Q
Q
Q
Peripheral Data Out
Peripheral Out
Select
Preliminary
1
0
Q
Q
CK
D
make a pin an input. The user should refer to the corre-
sponding peripheral section for the correct TRIS bit set-
tings.
The pin override value is not loaded into the TRIS reg-
ister. This allows read-modify-write of the TRIS register,
without concern due to peripheral overrides.
EXAMPLE 8-3:
CLRF
CLRF
MOVLW 0xCF
MOVWF TRISC
Peripheral Output Enable
ST Buffer
PORTC
LATC
; Initialize PORTC by
; clearing output
; data latches
; Alternate method
; to clear output
; data latches
; Value used to
; initialize data
; direction
; Set RC<3:0> as inputs
; RC<5:4> as outputs
; RC<7:6> as inputs
INITIALIZING PORTC
RC7: RC0
PIC18CXX2
DS39026B-page 83

Related parts for PIC18C242