PIC16C662-20/PQ Microchip Technology, PIC16C662-20/PQ Datasheet - Page 29
![IC MCU OTP 4KX14 COMP 44-MQFP](/photos/6/59/65984/150-44-pqfp_sml.jpg)
PIC16C662-20/PQ
Manufacturer Part Number
PIC16C662-20/PQ
Description
IC MCU OTP 4KX14 COMP 44-MQFP
Manufacturer
Microchip Technology
Series
PIC® 16Cr
Specifications of PIC16C662-20/PQ
Core Processor
PIC
Core Size
8-Bit
Speed
20MHz
Peripherals
Brown-out Detect/Reset, LED, POR, WDT
Number Of I /o
33
Program Memory Size
7KB (4K x 14)
Program Memory Type
OTP
Ram Size
176 x 8
Voltage - Supply (vcc/vdd)
4 V ~ 6 V
Oscillator Type
External
Operating Temperature
0°C ~ 70°C
Package / Case
44-MQFP, 44-PQFP
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Eeprom Size
-
Data Converters
-
Connectivity
-
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
PIC16C662-20/PQ
Manufacturer:
Microchip Technology
Quantity:
10 000
5.0
The PIC16C641 and PIC16C642 have three ports,
PORTA, PORTB, and PORTC. PIC16C661 and
PIC16C662 devices have five ports, PORTA through
PORTE. Some pins for these I/O ports are multiplexed
with alternate functions for the peripheral features on
the device. In general, when a peripheral is enabled,
that pin may not be used as a general purpose I/O pin.
5.1
PORTA is a 6-bit wide latch. RA4 is a Schmitt Trigger
input and an open drain output. Pin RA4 is multiplexed
with the T0CKI clock input. All other RA port pins have
Schmitt Trigger input levels and full CMOS output driv-
ers. All pins have data direction bits (TRIS registers)
which can configure these pins as input or output.
Setting a bit in the TRISA register puts the correspond-
ing output driver in a hi-impedance mode. Clearing a bit
in the TRISA register puts the contents of the output
latch on the selected pin.
Reading the PORTA register reads the status of the
pins, whereas writing to it will write to the port latch. All
write operations are read-modify-write operations.
Therefore, a write to a port implies that the port pins are
read, this value is modified, and then written to the port
data latch.
The PORTA pins are multiplexed with comparator and
voltage reference functions. The operation of these
pins are selected by control bits in the CMCON
(comparator control register) register and the VRCON
(voltage reference control) register. When selected as
comparator inputs, these pins will read as '0's.
1996 Microchip Technology Inc.
I/O PORTS
PORTA and TRISA Registers
This document was created with FrameMaker 4 0 4
Preliminary
PIC16C64X & PIC16C66X
FIGURE 5-1:
TRISA controls the direction of the RA pins, even when
they are being used as comparator inputs. The user
must make sure to keep the pins configured as inputs
when using them as comparator inputs.
The RA2 pin will also function as the output for the
voltage reference. When in this mode, the V
a very hi-impedance output. The user must set the
TRISA<2> bit and use hi-impedance loads.
In one of the comparator modes defined by the
CMCON register, pins RA3 and RA4 become outputs
of the comparators. The TRISA<4:3> bits must be
cleared to enable outputs to use this function.
EXAMPLE 5-1:
CLRF
MOVLW
MOVWF
BSF
MOVLW
MOVWF
Data
bus
WR
Port
WR
TRIS
Note:
Note: I/O pins have protection diodes to V
RD PORT
PORTA
0x07
CMCON
STATUS, RP0
0x1F
TRISA
To Comparator
TRIS Latch
D
D
Data Latch
On reset, the TRISA register is set to all
inputs. The digital inputs are disabled and
the comparator inputs are forced to ground
to reduce excess current consumption.
CK
CK
RD TRIS
BLOCK DIAGRAM OF
RA1:RA0 PINS
Q
Q
Q
Q
INITIALIZING PORTA
Input Mode
;Initialize PORTA by
;clearing output latches
;Turn comparators off,
;enable pins for I/O
;Select bank1
;Value to initialize
;data direction
;Set RA<4:0> as inputs
;TRISA<7:5> are clear
Schmitt Trigger
Analog
Q
Input Buffer
EN
V
V
N
P
DS30559A-page 29
D
DD
SS
DD
and V
I/O Pin
REF
SS
pin is
.