Datasheet
1996 Microchip Technology Inc.
Preliminary
DS40122B-page 25
PIC14000
5.0 I/O PORTS
The PIC14000 has three ports, PORTA, PORTC and
PORTD, described in the following paragraphs.
Generally, PORTA is used as the analog input port.
PORTC is used for general purpose I/O and for host
communication. PORTD provides additional I/O lines.
Four lines of PORTD may function as analog inputs.
5.1 POR
TA and TRISA
PORTA is a 4-bit wide port with data register located at
location 05h and corresponding data direction register
(TRISA) at 85h. PORTA can operate as either
analog inputs for the internal A/D converter or as
general purpose digital I/O ports. These inputs are
Schmitt Triggers when used as digital inputs, and have
CMOS drivers as outputs.
PORTA pins are multiplexed with analog inputs.
ADCON1<1:0> bits control whether these pins are
analog or digital as shown in Section 8.7. When config-
ured to the digital mode, reading the PORTA register
reads the status of the pins whereas writing to it will
write to the port latch. When selected as an analog
input, these pins will read as ‘0’s.
The TRISA register controls the direction of the PORTA
pins, even when they are being used as analog inputs.
The user must make sure to keep the pins configured
as inputs when using them as analog inputs. A ‘1’ in
each location configures the corresponding port pin as
an input. This register resets to all ‘1’s, meaning all
PORTA pins are initially inputs. The data register
should be initialized prior to configuring the port as out-
puts. See Figure 5-2 and Figure 5-3.
PORTA inputs go through a Schmitt Trigger AND gate
that is disabled when the input is in analog mode. Refer
to Figure 5-1.
Note that bits RA<7:4> are unimplemented and always
read as ‘0’. Unused inputs should not be left floating to
avoid leakage currents. All pins have input protection
diodes to V
DD
and V
SS
.
EXAMPLE 5-1: INITIALIZING PORTA
Note:
On Reset, PORTA is configured as analog
inputs
CLRF PORTA ;Initialize PORTA by setting
;output data latches
BSF STATUS, RP0 ;Select Bank1
MOVLW 0x0F ;Value used to initialize
;data direction
MOVWF TRISA ;Set RA<3:0> as inputs
FIGURE 5-1: PORTA BLOCK DIAGRAM
D
Q
CK
Q
D
Q
CK
Q
D
Q
EN
Data
Bus
Write
PORTA
Write
TRISA
Read
TRISA
Read
PORTA
To A/D Converter
Note: I/O pins have protection diodes to V
DD and VSS.
P
N
I/O
Pin
VSS
VDD
Schmitt Trigger
Analog Input Mode
Input Buffer
This document was created with FrameMaker404