PIC16F785-I/P Microchip Technology Inc., PIC16F785-I/P Datasheet - Page 47

no-image

PIC16F785-I/P

Manufacturer Part Number
PIC16F785-I/P
Description
MCU, 8-Bit, 2KW Flash, 128 RAM, 18 I/O, DIP-20
Manufacturer
Microchip Technology Inc.
Datasheet

Specifications of PIC16F785-I/P

A/d Inputs
12-Channel, 10-Bit
Comparators
2
Cpu Speed
5 MIPS
Eeprom Memory
256 Bytes
Input Output
17
Memory Type
Flash
Number Of Bits
8
Package Type
20-pin PDIP
Programmable Memory
3.5K Bytes
Ram Size
128 Bytes
Speed
20 MHz
Timers
2-8-bit, 1-16-bit
Voltage, Range
2-5.5 V
Lead Free Status / Rohs Status
RoHS Compliant part Electrostatic Device
4.4
PORTC is an 8-bit wide, bidirectional port. The corre-
sponding data direction register is TRISC (Register 4-
8). Setting a TRISC bit (= 1) will make the correspond-
ing PORTC pin an input (i.e., put the corresponding
output driver in a High-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). Example 4-3 shows how to initial-
ize PORTC.
Reading the PORTC register (Register 4-7) 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 TRISC register controls the direction of the
PORTC pins, even when they are being used as
analog inputs. The user must ensure the bits in the
TRISC register are maintained set when using them as
analog inputs. I/O pins configured as analog input
always read ‘0’.
REGISTER 4-7:
REGISTER 4-8:
© 2006 Microchip Technology Inc.
PORTC and TRISC Registers
bit 7-0
bit 7-0
PORTC: PORTC REGISTER (ADDRESS: 07h, 107h)
TRISC: PORTC TRI-STATE REGISTER (ADDRESS: 87h, 187h)
bit 7
RC<7:0>: PORTC General Purpose I/O Pin bits
1 = Port pin is greater than V
0 = Port pin is less than V
Legend:
R = Readable bit
-n = Value at POR
bit 7
TRISC<7:0>: PORTC Tri-State Control bits
1 = PORTC pin configured as an input (tri-stated)
0 = PORTC pin configured as an output
Legend:
R = Readable bit
-n = Value at POR
R/W-x
TRISC7
R/W-1
Note 1: Data latches are unknown after a POR, but each port bit reads ‘0’ when the
RC7
(1)
corresponding analog select bit is ‘1’ (see Registers
R/W-x
TRISC6
R/W-1
RC6
(1)
TRISC5
IL
R/W-x
R/W-1
RC5
Preliminary
W = Writable bit
‘1’ = Bit is set
W = Writable bit
‘1’ = Bit is set
IH
TRISC4
R/W-x
R/W-1
RC4
When RC4 or RC5 is configured as an op amp output,
the corresponding RC4 or RC5 digital output driver will
automatically be disabled regardless of the TRISC<4>
or TRISC<5> value.
EXAMPLE 4-3:
BCF
BCF
CLRF
BSF
CLRF
CLRF
MOVLW
MOVWF
BCF
Note:
PIC16F785/HV785
R/W-x
TRISC3
STATUS,RP0
STATUS,RP1
PORTC
STATUS,RP0
ANSEL0
ANSEL1
0Ch
TRISC
STATUS,RP0
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared
R/W-1
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared
RC3
The ANSEL0 (91h) and ANSEL1 (93h)
registers must be initialized to configure
an analog channel as a digital input. Pins
configured as analog inputs will read ‘0’.
(1)
R/W-x
TRISC2
R/W-1
12-1
RC2
INITIALIZING PORTC
(1)
and
;Bank 0
;Init PORTC
;Bank 1
;digital I/O
;digital I/O
;Set RC<3:2> as inputs
; and set RC<5:4,1:0>
; as outputs
;Bank 0
12-2 on page 82
x = Bit is unknown
x = Bit is unknown
R/W-x
TRISC1
R/W-1
RC1
DS41249D-page 45
(1)
R/W-x
TRISC0
R/W-1
RC0
).
bit 0
bit 0
(1)

Related parts for PIC16F785-I/P