Pic16c7x Micro Controller Data Sheet
Pic16c7x Micro Controller Data Sheet
PIC16C72 PIC16C72
MCLR/VPP •1 28 RB7
MCLR/VPP 1 40 RB7
RA0/AN0 2 27 RB6 RA0/AN0 2 39 RB6
RA1/AN1 3 26 RB5 RA1/AN1 3 38 RB5
RA2/AN2 4 25 RB4 RA2/AN2 4 37 RB4
RA3/AN3/VREF 5 24 RB3 RA3/AN3/VREF 5 36 RB3
RA4/T0CKI 6 35 RB2
RA4/T0CKI 6 23 RB2
RA5/SS/AN4 7 34 RB1
RA5/SS/AN4 7 22 RB1 RE0/RD/AN5 8 33 RB0/INT
VSS 8 21 RB0/INT RE1/WR/AN6 9 32 VDD
OSC1/CLKIN 9 20 VDD RE2/CS/AN7 10 31 VSS
VDD 11 30 RD7/PSP7
OSC2/CLKOUT 10 19 VSS
VSS 12 29 RD6/PSP6
RC0/T1OSO/T1CKI 11 18 RC7/RX/DT OSC1/CLKIN 28 RD5/PSP5
13
RC1/T1OSI/CCP2 12 17 RC6/TX/CK OSC2/CLKOUT 14 27 RD4/PSP4
RC2/CCP1 13 16 RC5/SDO RC0/T1OSO/T1CKI 15 26 RC7/RX/DT
RC3/SCK/SCL 14 15 RC4/SDI/SDA RC1/T1OSI/CCP2 16 25 RC6/TX/CK
RC2/CCP1 17 24 RC5/SDO
RC3/SCK/SCL 18 23 RC4/SDI/SDA
PIC16C73 RD0/PSP0 19 22 RD3/PSP3
PIC16C76 PIC16C74
PIC16C74A
PIC16C77
RC1/T1OSI/CCP2
MQFP
RC3/SCK/SCL
RC4/SDI/SDA
RC6/TX/CK
RC2/CCP1
RD3/PSP3
RD2/PSP2
RD1/PSP1
RD0/PSP0
RC5/SDO
NC
44
43
42
41
40
39
38
37
36
35
34
RC7/RX/DT 1 33 NC
RD4/PSP4 2 32 RC0/T1OSO/T1CKI
RD5/PSP5 3 31 OSC2/CLKOUT
RD6/PSP6 4 30 OSC1/CLKIN
RD7/PSP7 5 29 VSS
VSS 6 28 VDD
VDD 7 PIC16C74 27 RE2/CS/AN7
RB0/INT 8 26 RE1/WR/AN6
RB1 9 25 RE0/RD/AN5
RB2 10 24 RA5/SS/AN4
RB3 11 23 RA4/T0CKI
12
13
14
15
16
17
18
19
20
21
22
RA3/AN3/VREF
MCLR/VPP
RA0/AN0
RA1/AN1
RA2/AN2
NC
NC
RB4
RB5
RB6
RB7
RC1/T1OSI/CCP2
RA3/AN3/VREF
RC3/SCK/SCL
RC4/SDI/SDA
MCLR/VPP
PLCC
RA2/AN2
RA1/AN1
RA0/AN0
RC6/TX/CK
RC2/CCP1
RD3/PSP3
RD2/PSP2
RD1/PSP1
RD0/PSP0
RC5/SDO
MQFP
RB7
RB6
RB5
RB4
NC
NC
TQFP
NC
44
43
42
41
40
6
5
4
3
2
1
44
43
42
41
40
39
38
37
36
35
34
RA4/T0CKI 7 39 RB3
RC7/RX/DT 1 33 NC
RA5/SS/AN4 8 38 RB2
RE0/RD/AN5 9 37 RB1 RD4/PSP4 2 32 RC0/T1OSO/T1CKI
RE1/WR/AN6 10 36 RB0/INT RD5/PSP5 3 31 OSC2/CLKOUT
RE2/CS/AN7 11 PIC16C74 35 VDD RD6/PSP6 4 30 OSC1/CLKIN
VDD 12 34 VSS RD7/PSP7 5 PIC16C74A 29 VSS
VSS 13 PIC16C74A 33 RD7/PSP7 VSS 6 28 VDD
OSC1/CLKIN 14 32 RD6/PSP6 VDD 7
PIC16C77 27 RE2/CS/AN7
OSC2/CLKOUT 15 PIC16C77 31 RD5/PSP5 RB0/INT
RB1
8
9
26
25
RE1/WR/AN6
RE0/RD/AN5
RC0/T1OSO/T1CKI 16 30 RD4/PSP4
RB2 10 24 RA5/SS/AN4
NC 17 29 RC7/RX/DT
RB3 11 23 RA4/T0CKI
12
13
14
15
16
17
18
19
20
21
22
18
19
20
21
22
23
24
25
26
27
28
RC1/T1OSI/CCP2
RC4/SDI/SDA
RC3/SCK/SCL
RC2/CCP1
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RC6/TX/CK
RC5/SDO
NC
RA3/AN3/VREF
MCLR/VPP
RA0/AN0
RA1/AN1
RA2/AN2
NC
NC
RB4
RB5
RB6
RB7
The PIC16C72 has 128 bytes of RAM and 22 I/O pins. The PIC16C7X family fits perfectly in applications rang-
In addition several peripheral features are available ing from security and remote sensors to appliance con-
including: three timer/counters, one Capture/Compare/ trol and automotive. The EPROM technology makes
PWM module and one serial port. The Synchronous customization of application programs (transmitter
Serial Port can be configured as either a 3-wire Serial codes, motor speeds, receiver frequencies, etc.)
Peripheral Interface (SPI) or the two-wire Inter-Inte- extremely fast and convenient. The small footprint
grated Circuit (I 2C) bus. Also a 5-channel high-speed packages make this microcontroller series perfect for
8-bit A/D is provided. The 8-bit resolution is ideally all applications with space limitations. Low cost, low
suited for applications requiring low-cost analog inter- power, high performance, ease of use and I/O flexibility
face, e.g. thermostat control, pressure sensing, etc. make the PIC16C7X very versatile even in areas where
no microcontroller use has been considered before
The PIC16C73/73A devices have 192 bytes of RAM, (e.g. timer functions, serial communication, capture
while the PIC16C76 has 368 byes of RAM. Each device and compare, PWM functions and coprocessor appli-
has 22 I/O pins. In addition, several peripheral features cations).
are available including: three timer/counters, two Cap-
ture/Compare/PWM modules and two serial ports. The 1.1 Family and Upward Compatibility
Synchronous Serial Port can be configured as either a
3-wire Serial Peripheral Interface (SPI) or the two-wire Users familiar with the PIC16C5X microcontroller fam-
Inter-Integrated Circuit (I 2C) bus. The Universal Syn- ily will realize that this is an enhanced version of the
chronous Asynchronous Receiver Transmitter PIC16C5X architecture. Please refer to Appendix A for
(USART) is also known as the Serial Communications a detailed list of enhancements. Code written for the
Interface or SCI. Also a 5-channel high-speed 8-bit A/ PIC16C5X can be easily ported to the PIC16CXX fam-
D is provided.The 8-bit resolution is ideally suited for ily of devices (Appendix B).
applications requiring low-cost analog interface, e.g.
1.2 Development Support
thermostat control, pressure sensing, etc.
PIC16C7X devices are supported by the complete line
The PIC16C74/74A devices have 192 bytes of RAM,
of Microchip Development tools.
while the PIC16C77 has 368 bytes of RAM. Each
device has 33 I/O pins. In addition several peripheral Please refer to Section 16.0 for more details about
features are available including: three timer/counters, Microchip’s development tools.
two Capture/Compare/PWM modules and two serial
ports. The Synchronous Serial Port can be configured
as either a 3-wire Serial Peripheral Interface (SPI) or
the two-wire Inter-Integrated Circuit (I2C) bus. The Uni-
versal Synchronous Asynchronous Receiver Transmit-
ter (USART) is also known as the Serial
Communications Interface or SCI. An 8-bit Parallel
Slave Port is provided. Also an 8-channel high-speed
Features In-Circuit Serial Programming Yes Yes Yes Yes Yes Yes
Brown-out Reset Yes — Yes Yes Yes Yes
Packages 18-pin DIP, 18-pin DIP, 18-pin DIP, 18-pin DIP, 28-pin SDIP, 28-pin SDIP,
SOIC; SOIC SOIC; SOIC; SOIC, SSOP SOIC, SSOP
20-pin SSOP 20-pin SSOP 20-pin SSOP
Serial Port(s) (SPI/I2C, US- SPI/I2C, USART SPI/I2C, USART SPI/I2C, USART SPI/I2C, USART
ART)
Parallel Slave Port — Yes — Yes
A/D Converter (8-bit) Channels 5 8 5 8
Interrupt Sources 11 12 11 12
I/O Pins 22 33 22 33
Voltage Range (Volts) 2.5-6.0 2.5-6.0 2.5-6.0 2.5-6.0
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high I/O current capabil-
ity. All PIC16C7XX Family devices use serial programming with clock pin RB6 and data pin RB7.
Note 1: Please contact your local Microchip sales office for availability of these devices.
Program
Device Data Memory
Memory
PIC16C72 2K x 14 128 x 8
PIC16C73 4K x 14 192 x 8
PIC16C73A 4K x 14 192 x 8
PIC16C74 4K x 14 192 x 8
PIC16C74A 4K x 14 192 x 8
PIC16C76 8K x 14 368 x 8
PIC16C77 8K x 14 386 x 8
The PIC16CXX can directly or indirectly address its
register files or data memory. All special function regis-
ters, including the program counter, are mapped in the
data memory. The PIC16CXX has an orthogonal (sym-
metrical) instruction set that makes it possible to carry
out any operation on any register using any addressing
mode. This symmetrical nature and lack of ‘special
optimal situations’ make programming with the
PIC16CXX simple yet efficient. In addition, the learning
curve is reduced significantly.
Synchronous
A/D Serial Port CCP1
PIC16C73 4K x 14 192 x 8
PIC16C73A 4K x 14 192 x 8
PIC16C76 8K x 14 368 x 8
STATUS reg
8 PORTC
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
3 RC2/CCP1
Power-up MUX
RC3/SCK/SCL
Timer RC4/SDI/SDA
Instruction Oscillator RC5/SDO
Decode & Start-up Timer ALU RC6/TX/CK
Control RC7/RX/DT
Power-on
Reset 8
Timing Watchdog
Generation Timer W reg
OSC1/CLKIN Brown-out
OSC2/CLKOUT Reset(2)
Synchronous
CCP1 CCP2 USART
Serial Port
PIC16C74 4K x 14 192 x 8
PIC16C74A 4K x 14 192 x 8
PIC16C77 8K x 14 368 x 8
STATUS reg
8 PORTC
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
3 RC2/CCP1
Power-up MUX
RC3/SCK/SCL
Timer
RC4/SDI/SDA
Instruction Oscillator RC5/SDO
Decode & Start-up Timer RC6/TX/CK
ALU
Control RC7/RX/DT
Power-on
Reset 8 PORTD
Timing Watchdog
Generation Timer W reg
OSC1/CLKIN Brown-out
OSC2/CLKOUT RD7/PSP7:RD0/PSP0
Reset(2)
RE1/WR/AN6
Timer0 Timer1 Timer2 A/D
RE2/CS/AN7
Synchronous
CCP1 CCP2 USART
Serial Port
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Q1
Q2 Internal
phase
Q3 clock
Q4
PC PC PC+1 PC+2
OSC2/CLKOUT
(RC mode)
Fetch INST (PC)
Execute INST (PC-1) Fetch INST (PC+1)
Execute INST (PC) Fetch INST (PC+2)
Execute INST (PC+1)
All instructions are single cycle, except for any program branches. These take two cycles since the fetch
instruction is “flushed” from the pipeline while the new instruction is being fetched and then executed.
Program
Device Address Range
Memory
Stack Level 8
PIC16C72 2K x 14 0000h-07FFh
PIC16C73 4K x 14 0000h-0FFFh
Reset Vector 0000h
PIC16C73A 4K x 14 0000h-0FFFh
PIC16C74 4K x 14 0000h-0FFFh
PIC16C74A 4K x 14 0000h-0FFFh
Interrupt Vector
User Memory
0004h
PIC16C76 8K x 14 0000h-1FFFh
0005h
Space
On-chip Program
PIC16C77 8K x 14 0000h-1FFFh Memory (Page 0)
For those devices with less than 8K program memory, 07FFh
accessing a location above the physically implemented 0800h
On-chip Program
address will cause a wraparound. Memory (Page 1)
The reset vector is at 0000h and the interrupt vector is
at 0004h. 0FFFh
1000h
FIGURE 4-1: PIC16C72 PROGRAM
MEMORY MAP AND STACK
1FFFh
PC<12:0>
CALL, RETURN
RETFIE, RETLW 13
Stack Level 1
Stack Level 8
Interrupt Vector
User Memory
0004h
0005h
Space
On-chip Program
Memory
07FFh
0800h
1FFFh
0800h
On-Chip Page 1 The register file can be accessed either directly, or indi-
0FFFh rectly through the File Select Register FSR
(Section 4.5).
1000h
On-Chip Page 2
17FFh
1800h
On-Chip Page 3
1FFFh
7Fh FFh
Bank 0 Bank 1
7Fh FFh
Bank 0 Bank 1
Unimplemented data memory locations, read as
'0'.
Unimplemented data memory locations, read as
Note 1: Not a physical register.
'0'. 2: These registers are not physically imple-
Note 1: Not a physical register. mented on the PIC16C73/73A, read as '0'.
Indirect addr.(*) 00h Indirect addr.(*) 80h Indirect addr.(*) 100h Indirect addr.(*) 180h
TMR0 01h OPTION 81h TMR0 101h OPTION 181h
PCL 02h PCL 82h PCL 102h PCL 182h
STATUS 03h STATUS 83h STATUS 103h STATUS 183h
FSR 04h FSR 84h FSR 104h FSR 184h
PORTA 05h TRISA 85h 105h 185h
PORTB 06h TRISB 86h PORTB 106h TRISB 186h
PORTC 07h TRISC 87h 107h 187h
PORTD (1) 08h TRISD (1) 88h 108h 188h
PORTE (1) 09h TRISE (1) 89h 109h 189h
PCLATH 0Ah PCLATH 8Ah PCLATH 10Ah PCLATH 18Ah
INTCON 0Bh INTCON 8Bh INTCON 10Bh INTCON 18Bh
PIR1 0Ch PIE1 8Ch 10Ch 18Ch
PIR2 0Dh PIE2 8Dh 10Dh 18Dh
TMR1L 0Eh PCON 8Eh 10Eh 18Eh
TMR1H 0Fh 8Fh 10Fh 18Fh
T1CON 10h 90h 110h 190h
TMR2 11h 91h 111h 191h
T2CON 12h PR2 92h 112h 192h
SSPBUF 13h SSPADD 93h 113h 193h
SSPCON 14h SSPSTAT 94h 114h 194h
CCPR1L 15h 95h 115h 195h
CCPR1H 16h 96h 116h 196h
CCP1CON 17h 97h General 117h General 197h
Purpose Purpose
RCSTA 18h TXSTA 98h Register 118h Register 198h
TXREG 19h SPBRG 99h 16 Bytes 119h 16 Bytes 199h
RCREG 1Ah 9Ah 11Ah 19Ah
CCPR2L 1Bh 9Bh 11Bh 19Bh
CCPR2H 1Ch 9Ch 11Ch 19Ch
CCP2CON 1Dh 9Dh 11Dh 19Dh
ADRES 1Eh 9Eh 11Eh 19Eh
ADCON0 1Fh ADCON1 9Fh 11Fh 19Fh
20h A0h 120h 1A0h
Note: The upper 16 bytes of data memory in banks 1, 2, and 3 are mapped in Bank 0. This may require
relocation of data memory usage in the user application code if upgrading to the PIC16C76/77.
Bank 0
00h(1) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
02h(1) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(1) (4) (4)
03h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
04h(1) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
05h PORTA — — PORTA Data Latch when written: PORTA pins when read --0x 0000 --0u 0000
06h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu
07h PORTC PORTC Data Latch when written: PORTC pins when read xxxx xxxx uuuu uuuu
08h — Unimplemented — —
09h — Unimplemented — —
0Ah(1,2) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
0Bh(1) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
0Ch PIR1 — ADIF — — SSPIF CCP1IF TMR2IF TMR1IF -0-- 0000 -0-- 0000
0Dh — Unimplemented — —
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
17h CCP1CON — — CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
18h — Unimplemented — —
19h — Unimplemented — —
1Ah — Unimplemented — —
1Bh — Unimplemented — —
1Ch — Unimplemented — —
1Dh — Unimplemented — —
1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE — ADON 0000 00-0 0000 00-0
Bank 1
80h(1) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
81h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
82h(1) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
84h(1) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
86h TRISB PORTB Data Direction Register 1111 1111 1111 1111
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
88h — Unimplemented — —
89h — Unimplemented — —
8Ah(1,2) PCLATH — — — Write Buffer for the upper 5 bits of the PC ---0 0000 ---0 0000
8Bh(1) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
8Ch PIE1 — ADIE — — SSPIE CCP1IE TMR2IE TMR1IE -0-- 0000 -0-- 0000
8Dh — Unimplemented — —
8Fh — Unimplemented — —
90h — Unimplemented — —
91h — Unimplemented — —
93h SSPADD Synchronous Serial Port (I2C mode) Address Register 0000 0000 0000 0000
95h — Unimplemented — —
96h — Unimplemented — —
97h — Unimplemented — —
98h — Unimplemented — —
99h — Unimplemented — —
9Ah — Unimplemented — —
9Bh — Unimplemented — —
9Ch — Unimplemented — —
9Dh — Unimplemented — —
9Eh — Unimplemented — —
Bank 0
00h(4) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
02h(4) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(4) (7) (7)
03h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
04h(4) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
05h PORTA — — PORTA Data Latch when written: PORTA pins when read --0x 0000 --0u 0000
06h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu
07h PORTC PORTC Data Latch when written: PORTC pins when read xxxx xxxx uuuu uuuu
08h(5) PORTD PORTD Data Latch when written: PORTD pins when read xxxx xxxx uuuu uuuu
(5)
09h PORTE — — — — — RE2 RE1 RE0 ---- -xxx ---- -uuu
0Ah(1,4) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
0Bh(4) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
0Ch PIR1 PSPIF(3) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
17h CCP1CON — — CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
19h TXREG USART Transmit Data Register 0000 0000 0000 0000
1Ah RCREG USART Receive Data Register 0000 0000 0000 0000
1Bh CCPR2L Capture/Compare/PWM Register2 (LSB) xxxx xxxx uuuu uuuu
1Dh CCP2CON — — CCP2X CCP2Y CCP2M3 CCP2M2 CCP2M1 CCP2M0 --00 0000 --00 0000
1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE — ADON 0000 00-0 0000 00-0
Bank 1
80h(4) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
81h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
82h(4) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(4) (7) (7)
83h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
84h(4) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
86h TRISB PORTB Data Direction Register 1111 1111 1111 1111
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
88h(5) TRISD PORTD Data Direction Register 1111 1111 1111 1111
(5)
89h TRISE IBF OBF IBOV PSPMODE — PORTE Data Direction Bits 0000 -111 0000 -111
8Ah(1,4) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
8Bh(4) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
8Ch PIE1 PSPIE(3) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
8Fh — Unimplemented — —
90h — Unimplemented — —
91h — Unimplemented — —
93h SSPADD Synchronous Serial Port (I2C mode) Address Register 0000 0000 0000 0000
95h — Unimplemented — —
96h — Unimplemented — —
97h — Unimplemented — —
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
9Ah — Unimplemented — —
9Bh — Unimplemented — —
9Ch — Unimplemented — —
9Dh — Unimplemented — —
9Eh — Unimplemented — —
Bank 0
00h(4) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
02h(4) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(4)
03h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
04h(4) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
05h PORTA — — PORTA Data Latch when written: PORTA pins when read --0x 0000 --0u 0000
06h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu
07h PORTC PORTC Data Latch when written: PORTC pins when read xxxx xxxx uuuu uuuu
08h(5) PORTD PORTD Data Latch when written: PORTD pins when read xxxx xxxx uuuu uuuu
(5)
09h PORTE — — — — — RE2 RE1 RE0 ---- -xxx ---- -uuu
0Ah(1,4) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
0Bh(4) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
0Ch PIR1 PSPIF(3) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
17h CCP1CON — — CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
19h TXREG USART Transmit Data Register 0000 0000 0000 0000
1Ah RCREG USART Receive Data Register 0000 0000 0000 0000
1Dh CCP2CON — — CCP2X CCP2Y CCP2M3 CCP2M2 CCP2M1 CCP2M0 --00 0000 --00 0000
1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE — ADON 0000 00-0 0000 00-0
Bank 1
80h(4) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
81h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
82h(4) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(4)
83h STATUS IRP RP1 RP0 TO PD Z DC C 0001 1xxx 000q quuu
84h(4) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
86h TRISB PORTB Data Direction Register 1111 1111 1111 1111
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
88h(5) TRISD PORTD Data Direction Register 1111 1111 1111 1111
(5)
89h TRISE IBF OBF IBOV PSPMODE — PORTE Data Direction Bits 0000 -111 0000 -111
8Ah(1,4) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
8Bh(4) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
8Ch PIE1 PSPIE(3) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
8Fh — Unimplemented — —
90h — Unimplemented — —
91h — Unimplemented — —
93h SSPADD Synchronous Serial Port (I2C mode) Address Register 0000 0000 0000 0000
94h SSPSTAT SMP CKE D/A P S R/W UA BF 0000 0000 0000 0000
95h — Unimplemented — —
96h — Unimplemented — —
97h — Unimplemented — —
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
9Ah — Unimplemented — —
9Bh — Unimplemented — —
9Ch — Unimplemented — —
9Dh — Unimplemented — —
9Eh — Unimplemented — —
Bank 2
100h(4) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
102h(4) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
104h(4) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
105h — Unimplemented — —
106h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu
107h — Unimplemented — —
108h — Unimplemented — —
109h — Unimplemented — —
(1,4) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
10Ah
(4) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh
10Ch-
— Unimplemented — —
10Fh
Bank 3
180h(4) INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
182h(4) PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
184h(4) FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
185h — Unimplemented — —
186h TRISB PORTB Data Direction Register 1111 1111 1111 1111
187h — Unimplemented — —
188h — Unimplemented — —
189h — Unimplemented — —
18Ah (1,4) PCLATH — — — Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
(4) INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
18Bh
18Ch-
— Unimplemented — —
18Fh
The STATUS register, shown in Figure 4-7, contains the It is recommended, therefore, that only BCF, BSF,
arithmetic status of the ALU, the RESET status and the SWAPF and MOVWF instructions are used to alter the
bank select bits for data memory. STATUS register because these instructions do not
affect the Z, C or DC bits from the STATUS register. For
The STATUS register can be the destination for any other instructions, not affecting any status bits, see the
instruction, as with any other register. If the STATUS "Instruction Set Summary."
register is the destination for an instruction that affects
the Z, DC or C bits, then the write to these three bits is Note 1: For those devices that do not use bits IRP
disabled. These bits are set or cleared according to the and RP1 (STATUS<7:6>), maintain these
device logic. Furthermore, the TO and PD bits are not bits clear to ensure upward compatibility
writable. Therefore, the result of an instruction with the with future products.
STATUS register as destination may be different than Note 2: The C and DC bits operate as a borrow
intended. and digit borrow bit, respectively, in sub-
traction. See the SUBLW and SUBWF
instructions for examples.
Interrupt flag bits get set when an interrupt condition occurs regardless of the state of its corresponding enable bit or the
global enable bit, GIE (INTCON<7>). User software should ensure the appropriate interrupt flag bits are clear prior to
enabling an interrupt.
Note 1: PIC16C73/73A/76 devices do not have a Parallel Slave Port implemented, this bit location is reserved
on these devices, always maintain this bit clear.
Interrupt flag bits get set when an interrupt condition occurs regardless of the state of its corresponding enable bit or the
global enable bit, GIE (INTCON<7>). User software should ensure the appropriate interrupt flag bits are clear prior to
enabling an interrupt.
Note 1: PIC16C73/73A/76 devices do not have a Parallel Slave Port implemented, this bit location is reserved
on these devices, always maintain this bit clear.
Interrupt flag bits get set when an interrupt condition occurs regardless of the state of its corresponding enable bit or the
global enable bit, GIE (INTCON<7>). User software should ensure the appropriate interrupt flag bits are clear prior to
enabling an interrupt.
Applicable Devices Note: Interrupt flag bits get set when an interrupt
72 73 73A 74 74A 76 77 condition occurs regardless of the state of
its corresponding enable bit or the global
This register contains the CCP2 interrupt flag bit. enable bit, GIE (INTCON<7>). User soft-
ware should ensure the appropriate inter-
rupt flag bits are clear prior to enabling an
interrupt.
Capture Mode
1 = A TMR1 register capture occurred (must be cleared in software)
0 = No TMR1 register capture occurred
Compare Mode
1 = A TMR1 register compare match occurred (must be cleared in software)
0 = No TMR1 register compare match occurred
PWM Mode
Unused
Interrupt flag bits get set when an interrupt condition occurs regardless of the state of its corresponding enable bit or the
global enable bit, GIE (INTCON<7>). User software should ensure the appropriate interrupt flag bits are clear prior to
enabling an interrupt.
4.3.2 STACK
not used
Data
Memory
Pin RA4 is multiplexed with the Timer0 module clock Note 1: I/O pins have protection diodes to VDD and
input to become the RA4/T0CKI pin. VSS.
Other PORTA pins are multiplexed with analog inputs
and analog VREF input. The operation of each pin is
selected by clearing/setting the control bits in the FIGURE 5-2: BLOCK DIAGRAM OF RA4/
ADCON1 register (A/D Control Register1).
T0CKI PIN
Note: On a Power-on Reset, these pins are con- Data
figured as analog inputs and read as '0'. bus D Q
The TRISA register controls the direction of the RA WR
PORT
pins, even when they are being used as analog inputs. CK Q
N I/O pin(1)
The user must ensure the bits in the TRISA register are
Data Latch
maintained set when using them as analog inputs.
D Q VSS
EXAMPLE 5-1: INITIALIZING PORTA WR
TRIS CK Q Schmitt
BCF STATUS, RP0 ; Trigger
input
BCF STATUS, RP1 ; PIC16C76/77 only TRIS Latch buffer
CLRF PORTA ; Initialize PORTA by
; clearing output
; data latches RD TRIS
BSF STATUS, RP0 ; Select Bank 1
MOVLW 0xCF ; Value used to Q D
; initialize data
; direction
EN
EN
MOVWF TRISA ; Set RA<3:0> as inputs
; RA<5:4> as outputs RD PORT
; TRISA<7:6> are always
; read as '0'.
TMR0 clock input
05h PORTA — — RA5 RA4 RA3 RA2 RA1 RA0 --0x 0000 --0u 0000
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
9Fh ADCON1 — — — — — PCFG2 PCFG1 PCFG0 ---- -000 ---- -000
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'. Shaded cells are not used by PORTA.
RD TRIS
Q D
RD Port EN
RB0/INT
06h, 106h PORTB RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 xxxx xxxx uuuu uuuu
86h, 186h TRISB PORTB Data Direction Register 1111 1111 1111 1111
81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
Legend: x = unknown, u = unchanged. Shaded cells are not used by PORTB.
07h PORTC RC7 RC6 RC5 RC4 RC3 RC2 RC1 RC0 xxxx xxxx uuuu uuuu
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
Legend: x = unknown, u = unchanged.
RD TRIS
Q D
EN
EN
RD PORT
08h PORTD RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 xxxx xxxx uuuu uuuu
88h TRISD PORTD Data Direction Register 1111 1111 1111 1111
89h TRISE IBF OBF IBOV PSPMODE — PORTE Data Direction Bits 0000 -111 0000 -111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by PORTD.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Note:
PC PC PC + 1 PC + 2 PC + 3 This example shows a write to PORTB
Instruction followed by a read from PORTB.
fetched MOVWF PORTB MOVF PORTB,W
write to NOP NOP
PORTB Note that:
RB7:RB0 data setup time = (0.25TCY - TPD)
where TCY = instruction cycle
Port pin
sampled here TPD = propagation delay
TPD Therefore, at higher clock frequencies,
Instruction
executed NOP
a write followed by a read may be prob-
MOVWF PORTB MOVF PORTB,W
write to lematic.
PORTB
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
08h PORTD Port data latch when written: Port pins when read xxxx xxxx uuuu uuuu
09h PORTE — — — — — RE2 RE1 RE0 ---- -xxx ---- -uuu
89h TRISE IBF OBF IBOV PSPMODE — PORTE Data Direction Bits 0000 -111 0000 -111
0Ch PIR1 PSPIF ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
8Ch PIE1 PSPIE ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
9Fh ADCON1 — — — — — PCFG2 PCFG1 PCFG0 ---- -000 ---- -000
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the Parallel Slave Port.
Data bus
FOSC/4 0
PSout 8
1
Sync with
1 Internal TMR0
clocks
RA4/T0CKI Programmable 0 PSout
pin Prescaler
T0SE (2 cycle delay)
3
Set interrupt
PS2, PS1, PS0 PSA flag bit T0IF
T0CS on overflow
PC Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
(Program
Counter) PC-1 PC PC+1 PC+2 PC+3 PC+4 PC+5 PC+6
Instruction MOVWF TMR0 MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W
Fetch
Instruction
Executed
Write TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0
executed reads NT0 reads NT0 reads NT0 reads NT0 + 1 reads NT0 + 2
PC Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
(Program
Counter) PC-1 PC PC+1 PC+2 PC+3 PC+4 PC+5 PC+6
Instruction MOVWF TMR0 MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W
Fetch
Instruction
Execute Write TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0 Read TMR0
executed reads NT0 reads NT0 reads NT0 reads NT0 reads NT0 + 1
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
CLKOUT(3)
GIE bit
(INTCON<7>)
INSTRUCTION
FLOW
PC PC PC +1 PC +1 0004h 0005h
Instruction
fetched Inst (PC) Inst (PC+1) Inst (0004h) Inst (0005h)
Instruction Inst (PC-1) Inst (PC) Dummy cycle Dummy cycle Inst (0004h)
executed
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Small pulse
External Clock Input or misses sampling
Prescaler output (2)
(1)
(3)
External Clock/Prescaler
Output after sampling
Increment Timer0 (Q4)
Timer0 T0 T0 + 1 T0 + 2
Note 1: Delay from clock input change to Timer0 increment is 3Tosc to 7Tosc. (Duration of Q = Tosc).
Therefore, the error in measuring the interval between two edges on Timer0 input = ±4Tosc max.
2: External clock if no prescaler selected, Prescaler output otherwise.
3: The arrows indicate the points in time where sampling occurs.
8
M 1
0
RA4/T0CKI U M
X SYNC
pin U 2 TMR0 reg
1 0
X Cycles
T0SE
T0CS
PSA Set flag bit T0IF
on Overflow
0
M 8-bit Prescaler
U
Watchdog 1 X 8
Timer
8 - to - 1MUX PS2:PS0
PSA
0 1
WDT Enable bit
MUX PSA
WDT
Time-out
TMR1CS = 1
1 = Do not synchronize external clock input
0 = Synchronize external clock input
TMR1CS = 0
This bit is ignored. Timer1 uses the internal clock when TMR1CS = 0.
bit 1: TMR1CS: Timer1 Clock Source Select bit
1 = External clock from pin RC0/T1OSO/T1CKI (on the rising edge)
0 = Internal clock (FOSC/4)
bit 0: TMR1ON: Timer1 On bit
1 = Enables Timer1
0 = Stops Timer1
Note 1: When the T1OSCEN bit is cleared, the inverter and feedback resistor are turned off. This eliminates power drain.
2: The CCP2 module is not implemented in the PIC16C72.
3: For the PIC16C73 and PIC16C74, the Schmitt Trigger is not implemented in external clock mode.
0Bh,8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh,18Bh
0Ch PIR1 PSPIF(1,2) ADIF RCIF(2) TXIF(2) SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
8Ch PIE1 PSPIE(1,2) ADIE RCIE(2) TXIE(2) SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
0Eh TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
0Fh TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1 register xxxx xxxx uuuu uuuu
10h T1CON — — T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the Timer1 module.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
2: The PIC16C72 does not have a Parallel Slave Port or a USART, these bits are unimplemented, read as '0'.
4 PR2 reg
0Bh,8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh,18Bh
0Ch PIR1 PSPIF(1,2) ADIF RCIF(2) TXIF(2) SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
(1,2) (2) (2) 0000 0000 0000 0000
8Ch PIE1 PSPIE ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE
11h TMR2 Timer2 module’s register 0000 0000 0000 0000
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
92h PR2 Timer2 Period Register 1111 1111 1111 1111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the Timer2 module.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
2: The PIC16C72 does not have a Parallel Slave Port or a USART, these bits are unimplemented, read as '0'.
Capture Timer1
Compare Timer1
PWM Timer2
Note: If the RC2/CCP1 is configured as an out- When the Capture mode is changed, a false capture
put, a write to the port can cause a capture interrupt may be generated. The user should keep bit
condition. CCP1IE (PIE1<2>) clear to avoid false interrupts and
should clear the flag bit CCP1IF following any such
change in operating mode.
There are four prescaler settings, specified by bits The user must configure the RC2/CCP1 pin as an out-
CCP1M3:CCP1M0. Whenever the CCP module is put by clearing the TRISC<2> bit.
turned off, or the CCP module is not in capture mode,
Note: Clearing the CCP1CON register will force
the prescaler counter is cleared. This means that any
the RC2/CCP1 compare output latch to the
reset will clear the prescaler counter.
default low level. This is not the data latch.
Switching from one capture prescaler to another may
generate an interrupt. Also, the prescaler counter will 10.2.2 TIMER1 MODE SELECTION
not be cleared, therefore the first capture may be from
a non-zero prescaler. Example 10-1 shows the recom- Timer1 must be running in Timer mode or Synchro-
mended method for switching between capture pres- nized Counter mode if the CCP module is using the
calers. This example also clears the prescaler counter compare feature. In Asynchronous Counter mode, the
and will not generate the “false” interrupt. compare operation may not work.
Q S Output
Logic Comparator
RC2/CCP1 R match
Pin
TRISC<2> TMR1H TMR1L
Output Enable CCP1CON<3:0>
Mode Select
TMR2 = PR2 Note: If the PWM duty cycle value is longer than
TMR2 = Duty Cycle the PWM period the CCP1 pin will not be
cleared.
TMR2 = PR2
PWM Frequency 1.22 kHz 4.88 kHz 19.53 kHz 78.12 kHz 156.3 kHz 208.3 kHz
Timer Prescaler (1, 4, 16) 16 4 1 1 1 1
PR2 Value 0xFF 0xFF 0xFF 0x3F 0x1F 0x17
Maximum Resolution (bits) 10 10 10 8 7 5.5
TABLE 10-4: REGISTERS ASSOCIATED WITH CAPTURE, COMPARE, AND TIMER1
0Bh,8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh,18Bh
0Ch PIR1 PSPIF(1,2) ADIF RCIF(2) TXIF(2) SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
0Dh(2) PIR2 — — — — — — — CCP2IF ---- ---0 ---- ---0
8Ch PIE1 PSPIE(1,2) ADIE RCIE(2) TXIE(2) SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
8Dh(2) PIE2 — — — — — — — CCP2IE ---- ---0 ---- ---0
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
11h TMR2 Timer2 module’s register 0000 0000 0000 0000
92h PR2 Timer2 module’s period register 1111 1111 1111 1111
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
15h CCPR1L Capture/Compare/PWM register1 (LSB) xxxx xxxx uuuu uuuu
16h CCPR1H Capture/Compare/PWM register1 (MSB) xxxx xxxx uuuu uuuu
17h CCP1CON — — CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
1Bh(2) CCPR2L Capture/Compare/PWM register2 (LSB) xxxx xxxx uuuu uuuu
1Ch(2) CCPR2H Capture/Compare/PWM register2 (MSB) xxxx xxxx uuuu uuuu
1Dh(2) CCP2CON — — CCP2X CCP2Y CCP2M3 CCP2M2 CCP2M1 CCP2M0 --00 0000 --00 0000
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by PWM and Timer2.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
2: The PIC16C72 does not have a Parallel Slave Port, USART or CCP2 module, these bits are unimplemented, read as '0'.
FIGURE 11-1: SSPSTAT: SYNC SERIAL PORT STATUS REGISTER (ADDRESS 94h)
11.2.1 OPERATION OF SSP MODULE IN SPI EXAMPLE 11-1: LOADING THE SSPBUF
MODE (SSPSR) REGISTER
Applicable Devices BSF STATUS, RP0 ;Specify Bank 1
72 73 73A 74 74A 76 77 LOOP BTFSS SSPSTAT, BF ;Has data been
;received
The SPI mode allows 8-bits of data to be synchro-
;(transmit
nously transmitted and received simultaneously. To
;complete)?
accomplish communication, typically three pins are
GOTO LOOP ;No
used:
BCF STATUS, RP0 ;Specify Bank 0
• Serial Data Out (SDO) MOVF SSPBUF, W ;W reg = contents
• Serial Data In (SDI) ;of SSPBUF
• Serial Clock (SCK) MOVWF RXDATA ;Save in user RAM
MOVF TXDATA, W ;W reg = contents
Additionally a fourth pin may be used when in a slave ; of TXDATA
mode of operation: MOVWF SSPBUF ;New data to xmit
• Slave Select (SS)
The block diagram of the SSP module, when in SPI
When initializing the SPI, several options need to be mode (Figure 11-3), shows that the SSPSR register is
specified. This is done by programming the appropriate not directly readable or writable, and can only be
control bits in the SSPCON register (SSPCON<5:0>). accessed from addressing the SSPBUF register. Addi-
These control bits allow the following to be specified: tionally, the SSP status register (SSPSTAT) indicates
• Master Mode (SCK is the clock output) the various status conditions.
• Slave Mode (SCK is the clock input) FIGURE 11-3: SSP BLOCK DIAGRAM
• Clock Polarity (Output/Input data on the Rising/ (SPI MODE)
Falling edge of SCK)
• Clock Rate (Master mode only)
• Slave Select Mode (Slave mode only) Internal
data bus
The SSP consists of a transmit/receive Shift Register
(SSPSR) and a Buffer register (SSPBUF). The SSPSR Read Write
shifts the data in and out of the device, MSb first. The
SSPBUF holds the data that was written to the SSPSR, SSPBUF reg
until the received data is ready. Once the 8-bits of data
have been received, that byte is moved to the SSPBUF
register. Then the Buffer Full bit, BF (SSPSTAT<0>)
and flag bit SSPIF are set. This double buffering of the SSPSR reg
received data (SSPBUF) allows the next byte to start RC4/SDI/SDA bit0 shift
reception before reading the data that was just clock
received. Any write to the SSPBUF register during
transmission/reception of data will be ignored, and the RC5/SDO
write collision detect bit, WCOL (SSPCON<7>) will be
set. User software must clear bit WCOL so that it can
be determined if the following write(s) to the SSPBUF SS Control
Enable
completed successfully. When the application software
is expecting to receive valid data, the SSPBUF register RA5/SS/AN4 Edge
should be read before the next byte of data to transfer Select
is written to the SSPBUF register. The Buffer Full bit BF
(SSPSTAT<0>) indicates when the SSPBUF register 2
has been loaded with the received data (transmission Clock Select
is complete). When the SSPBUF is read, bit BF is
SSPM3:SSPM0
cleared. This data may be irrelevant if the SPI is only a TMR2 output
transmitter. Generally the SSP Interrupt is used to 4 2
determine when the transmission/reception has com- Edge
pleted. The SSPBUF register must be read and/or writ- Select Prescaler TCY
ten. If the interrupt method is not going to be used, then RC3/SCK/ 4, 16, 64
software polling can be done to ensure that a write col- SCL
lision does not occur. Example 11-1 shows the loading TRISC<3>
of the SSPBUF (SSPSR) register for data transmission.
The shaded instruction is only required if the received
data is meaningful.
SDO SDI
SDI SDO
Shift Register Shift Register
(SSPSR) (SSPSR)
PROCESSOR 1 PROCESSOR 2
The SS pin allows a synchronous slave mode. The point at which it was taken high. External pull-up/
SPI must be in slave mode (SSPCON<3:0> = 04h) pull-down resistors may be desirable, depending on the
and the TRISA<5> bit must be set the for synchro- application.
nous slave mode to be enabled. When the SS pin is To emulate two-wire communication, the SDO pin can
low, transmission and reception are enabled and be connected to the SDI pin. When the SPI needs to
the SDO pin is driven. When the SS pin goes high, operate as a receiver the SDO pin can be configured as
the SDO pin is no longer driven, even if in the mid- an input. This disables transmissions from the SDO.
dle of a transmitted byte, and becomes a floating The SDI can always be left as an input (SDI function)
output. If the SS pin is taken low without resetting since it cannot create a bus conflict.
SPI mode, the transmission will continue from the
FIGURE 11-5: SPI MODE TIMING, MASTER MODE OR SLAVE MODE W/O SS CONTROL
SCK
(CKP = 0)
SCK
(CKP = 1)
SDI
bit7 bit0
SSPIF
SCK
(CKP = 0)
SCK
(CKP = 1)
SDI
bit7 bit0
SSPIF
0Bh,8Bh INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
0Ch PIR1 PSPIF(1,2) ADIF RCIF(2) TXIF(2) SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
8Ch PIE1 PSPIE(1,2) ADIE RCIE(2) TXIE(2) SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
94h SSPSTAT — — D/A P S R/W UA BF --00 0000 --00 0000
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the SSP in SPI mode.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A, always maintain these bits clear.
2: The PIC16C72 does not have a Parallel Slave Port or USART, these bits are unimplemented, read as '0'.
FIGURE 11-7: SSPSTAT: SYNC SERIAL PORT STATUS REGISTER (ADDRESS 94h)(PIC16C76/77)
FIGURE 11-8: SSPCON: SYNC SERIAL PORT CONTROL REGISTER (ADDRESS 14h)(PIC16C76/77)
To enable the serial port, SSP Enable bit, SSPEN The master can initiate the data transfer at any time
(SSPCON<5>) must be set. To reset or reconfigure SPI because it controls the SCK. The master determines
mode, clear bit SSPEN, re-initialize the SSPCON reg- when the slave (Processor 2) is to broadcast data by
ister, and then set bit SSPEN. This configures the SDI, the firmware protocol.
SDO, SCK, and SS pins as serial port pins. For the pins In master mode the data is transmitted/received as
to behave as the serial port function, they must have soon as the SSPBUF register is written to. If the SPI is
their data direction bits (in the TRISC register) appro- only going to receive, the SCK output could be disabled
priately programmed. That is: (programmed as an input). The SSPSR register will
• SDI must have TRISC<4> set continue to shift in the signal present on the SDI pin at
• SDO must have TRISC<5> cleared the programmed clock rate. As each byte is received, it
• SCK (Master mode) must have TRISC<3> will be loaded into the SSPBUF register as if a normal
cleared received byte (interrupts and status bits appropriately
set). This could be useful in receiver applications as a
• SCK (Slave mode) must have TRISC<3> set
“line activity monitor” mode.
• SS must have TRISA<5> set
In slave mode, the data is transmitted and received as
Any serial port function that is not desired may be over- the external clock pulses appear on SCK. When the
ridden by programming the corresponding data direc- last bit is latched the interrupt flag bit SSPIF (PIR1<3>)
tion (TRIS) register to the opposite value. An example is set.
would be in master mode where you are only sending
data (to a display driver), then both SDI and SS could The clock polarity is selected by appropriately program-
be used as general purpose outputs by clearing their ming bit CKP (SSPCON<4>). This then would give
corresponding TRIS register bits. waveforms for SPI communication as shown in
Figure 11-11, Figure 11-12, and Figure 11-13 where
Figure 11-10 shows a typical connection between two the MSB is transmitted first. In master mode, the SPI
microcontrollers. The master controller (Processor 1) clock rate (bit rate) is user programmable to be one of
initiates the data transfer by sending the SCK signal. the following:
Data is shifted out of both shift registers on their pro-
grammed clock edge, and latched on the opposite edge • FOSC/4 (or TCY)
of the clock. Both processors should be programmed to • FOSC/16 (or 4 • TCY)
same Clock Polarity (CKP), then both controllers would • FOSC/64 (or 16 • TCY)
send and receive data at the same time. Whether the • Timer2 output/2
data is meaningful (or dummy data) depends on the
This allows a maximum bit clock frequency (at 20 MHz)
application firmware. This leads to three scenarios for
of 5 MHz. When in slave mode the external clock must
data transmission:
meet the minimum high and low times.
• Master sends data — Slave sends dummy data
In sleep mode, the slave can transmit and receive data
• Master sends data — Slave sends data and wake the device from sleep.
• Master sends dummy data — Slave sends data
FIGURE 11-10: SPI MASTER/SLAVE CONNECTION (PIC16C76/77)
SDO SDI
SDI SDO
Shift Register Shift Register
(SSPSR) (SSPSR)
PROCESSOR 1 PROCESSOR 2
SCK (CKP = 0,
CKE = 0)
SCK (CKP = 0,
CKE = 1)
SCK (CKP = 1,
CKE = 0)
SCK (CKP = 1,
CKE = 1)
SDI (SMP = 0)
bit7 bit0
SDI (SMP = 1)
bit7 bit0
SSPIF
FIGURE 11-12: SPI MODE TIMING (SLAVE MODE WITH CKE = 0) (PIC16C76/77)
SS (optional)
SCK (CKP = 0)
SCK (CKP = 1)
SDI (SMP = 0)
bit7 bit0
SSPIF
FIGURE 11-13: SPI MODE TIMING (SLAVE MODE WITH CKE = 1) (PIC16C76/77)
SS
(not optional)
SCK (CKP = 0)
SCK (CKP = 1)
SDI (SMP = 0)
bit7 bit0
SSPIF
0Bh,8Bh. INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh,18Bh
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
87h TRISC PORTC Data Direction Register 1111 1111 1111 1111
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
94h SSPSTAT SMP CKE D/A P S R/W UA BF 0000 0000 0000 0000
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by the SSP in SPI mode.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C76, always maintain these bits clear.
Term Description
Receiver The device that receives the data from the bus.
Master The device which initiates the transfer, generates the clock and terminates the transfer.
Multi-master More than one master device in a system. These masters can attempt to control the bus at the
same time without corrupting the message.
Arbitration Procedure that ensures that only one of the master devices will control the bus. This ensure that
the transfer data does not get corrupted.
Synchronization Procedure where the clock signals of two or more devices are synchronized.
S
MSb LSb Start Clock Pulse for
Condition Acknowledgment
S R/W ACK
SDA
MSB acknowledgment acknowledgment
signal from receiver byte complete signal from receiver
interrupt with receiver
clock line held low while
interrupts are serviced
SCL S 1 2 7 8 9 1 2 3•8 9 P
Start Stop
Condition Address R/W ACK Wait Data ACK
State Condition
S Slave Address R/W A Data A/A Sr Slave Address R/W A Data A/A P
Combined format:
Sr Slave Address R/W A Slave Address A Data A Data A/A Sr Slave Address R/W A Data A Data A P
First 7 bits Second byte First 7 bits
(write) (read)
Combined format - A master addresses a slave with a 10-bit address, then transmits
data to this slave and reads data from this slave.
A = acknowledge (SDA low)
From master to slave A = not acknowledge (SDA high)
S = Start Condition
From slave to master P = Stop Condition
The I2C protocol allows a system to have more than Clock synchronization occurs after the devices have
one master. This is called multi-master. When two or started arbitration. This is performed using a
more masters try to transfer data at the same time, arbi- wired-AND connection to the SCL line. A high to low
tration and synchronization occur. transition on the SCL line causes the concerned
devices to start counting off their low period. Once a
11.4.4.1 ARBITRATION device clock has gone low, it will hold the SCL line low
until its SCL high state is reached. The low to high tran-
Arbitration takes place on the SDA line, while the SCL sition of this clock may not change the state of the SCL
line is high. The master which transmits a high when line, if another device clock is still within its low period.
the other master transmits a low loses arbitration The SCL line is held low by the device with the longest
(Figure 11-22), and turns off its data output stage. A low period. Devices with shorter low periods enter a
master which lost arbitration can generate clock pulses high wait-state, until the SCL line comes high. When
until the end of the data byte where it lost arbitration. the SCL line comes high, all devices start counting off
When the master devices are addressing the same their high periods. The first device to complete its high
device, arbitration continues into the data. period will pull the SCL line low. The SCL line high time
is determined by the device with the shortest high
FIGURE 11-22: MULTI-MASTER period, Figure 11-23.
ARBITRATION
(TWO MASTERS) FIGURE 11-23: CLOCK SYNCHRONIZATION
DATA 2 CLK
1
SDA counter
CLK reset
2
SCL
SCL
11.5.1 SLAVE MODE address is compared on the falling edge of the eighth
clock (SCL) pulse. If the addresses match, and the BF
In slave mode, the SCL and SDA pins must be config- and SSPOV bits are clear, the following events occur:
ured as inputs (TRISC<4:3> set). The SSP module will
override the input state with the output data when a) The SSPSR register value is loaded into the
required (slave-transmitter). SSPBUF register.
b) The buffer full bit, BF is set.
When an address is matched or the data transfer after
an address match is received, the hardware automati- c) An ACK pulse is generated.
cally will generate the acknowledge (ACK) pulse, and d) SSP interrupt flag bit, SSPIF (PIR1<3>) is set
then load the SSPBUF register with the received value (interrupt is generated if enabled) - on the falling
currently in the SSPSR register. edge of the ninth SCL pulse.
There are certain conditions that will cause the SSP In 10-bit address mode, two address bytes need to be
module not to give this ACK pulse. These are if either received by the slave (Figure 11-16). The five Most Sig-
(or both): nificant bits (MSbs) of the first address byte specify if
this is a 10-bit address. Bit R/W (SSPSTAT<2>) must
a) The buffer full bit BF (SSPSTAT<0>) was set
specify a write so the slave device will receive the sec-
before the transfer was received.
ond address byte. For a 10-bit address the first byte
b) The overflow bit SSPOV (SSPCON<6>) was set would equal ‘1111 0 A9 A8 0’, where A9 and A8 are
before the transfer was received. the two MSbs of the address. The sequence of events
In this case, the SSPSR register value is not loaded for 10-bit address is as follows, with steps 7- 9 for
into the SSPBUF, but bit SSPIF (PIR1<3>) is set. slave-transmitter:
Table 11-4 shows what happens when a data transfer 1. Receive first (high) byte of Address (bits SSPIF,
byte is received, given the status of bits BF and SSPOV. BF, and bit UA (SSPSTAT<1>) are set).
The shaded cells show the condition where user soft-
2. Update the SSPADD register with second (low)
ware did not properly clear the overflow condition. Flag
byte of Address (clears bit UA and releases the
bit BF is cleared by reading the SSPBUF register while
SCL line).
bit SSPOV is cleared through software.
3. Read the SSPBUF register (clears bit BF) and
The SCL clock input must have a minimum high and clear flag bit SSPIF.
low for proper operation. The high and low times of the
4. Receive second (low) byte of Address (bits
I2C specification as well as the requirement of the SSP
SSPIF, BF, and UA are set).
module is shown in timing parameter #100 and param-
eter #101. 5. Update the SSPADD register with the first (high)
byte of Address, if match releases SCL line, this
11.5.1.1 ADDRESSING will clear bit UA.
6. Read the SSPBUF register (clears bit BF) and
Once the SSP module has been enabled, it waits for a clear flag bit SSPIF.
START condition to occur. Following the START condi-
7. Receive repeated START condition.
tion, the 8-bits are shifted into the SSPSR register. All
incoming bits are sampled with the rising edge of the 8. Receive first (high) byte of Address (bits SSPIF
clock (SCL) line. The value of register SSPSR<7:1> is and BF are set).
compared to the value of the SSPADD register. The 9. Read the SSPBUF register (clears bit BF) and
clear flag bit SSPIF.
SCL S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SSPOV (SSPCON<6>)
Bit SSPOV is set because the SSPBUF register is still full.
ACK is not sent.
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Data in SCL held low
sampled while CPU
responds to SSPIF
SSPIF (PIR1<3>) cleared in software
BF (SSPSTAT<0>)
From SSP interrupt
SSPBUF is written in software service routine
CKP (SSPCON<4>)
Master mode of operation is supported in firmware In multi-master mode, the interrupt generation on the
using interrupt generation on the detection of the detection of the START and STOP conditions allows
START and STOP conditions. The STOP (P) and the determination of when the bus is free. The STOP
START (S) bits are cleared from a reset or when the (P) and START (S) bits are cleared from a reset or
SSP module is disabled. The STOP (P) and START (S) when the SSP module is disabled. The STOP (P) and
bits will toggle based on the START and STOP condi- START (S) bits will toggle based on the START and
tions. Control of the I 2C bus may be taken when the P STOP conditions. Control of the I2C bus may be taken
bit is set, or the bus is idle and both the S and P bits are when bit P (SSPSTAT<4>) is set, or the bus is idle and
clear. both the S and P bits clear. When the bus is busy,
In master mode the SCL and SDA lines are manipu- enabling the SSP Interrupt will generate the interrupt
lated by clearing the corresponding TRISC<4:3> bit(s). when the STOP condition occurs.
The output level is always low, irrespective of the In multi-master operation, the SDA line must be moni-
value(s) in PORTC<4:3>. So when transmitting data, a tored to see if the signal level is the expected output
'1' data bit must have the TRISC<4> bit set (input) and level. This check only needs to be done when a high
a '0' data bit must have the TRISC<4> bit cleared (out- level is output. If a high level is expected and a low level
put). The same scenario is true for the SCL line with the is present, the device needs to release the SDA and
TRISC<3> bit. SCL lines (set TRISC<4:3>). There are two stages
The following events will cause SSP Interrupt Flag bit, where this arbitration can be lost, these are:
SSPIF, to be set (SSP Interrupt if enabled): • Address Transfer
• START condition • Data Transfer
• STOP condition When the slave logic is enabled, the slave continues to
• Data transfer byte transmitted/received receive. If arbitration was lost during the address trans-
fer stage, communication to the device may be in
Master mode of operation can be done with either the
progress. If addressed an ACK pulse will be generated.
slave mode idle (SSPM3:SSPM0 = 1011) or with the
If arbitration was lost during the data transfer stage, the
slave active. When both master and slave modes are
device will need to re-transfer the data at a later time.
enabled, the software needs to differentiate the
source(s) of the interrupt.
Value on
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other resets
BOR
0Bh, 8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh,18Bh
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
13h SSPBUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
93h SSPADD Synchronous Serial Port (I2C mode) Address Register 0000 0000 0000 0000
14h SSPCON WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000 0000 0000
94h SSPSTAT SMP(2) CKE(2) D/A P S R/W UA BF 0000 0000 0000 0000
87h TRISC PORTC Data Direction register 1111 1111 1111 1111
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'.
Shaded cells are not used by SSP module in SPI mode.
Note 1: PSPIF and PSPIE are reserved on the PIC16C73/73A/76, always maintain these bits clear.
2: The SMP and CKE bits are implemented on the PIC16C76/77 only. All other PIC16C7X devices have these two bits unim-
plemented, read as '0'.
IDLE_MODE (7-bit):
if (Addr_match) { Set interrupt;
if (R/W = 1) { Send ACK = 0;
set XMIT_MODE;
}
else if (R/W = 0) set RCV_MODE;
}
RCV_MODE:
if ((SSPBUF=Full) OR (SSPOV = 1))
{ Set SSPOV;
Do not acknowledge;
}
else { transfer SSPSR → SSPBUF;
send ACK = 0;
}
Receive 8-bits in SSPSR;
Set interrupt;
XMIT_MODE:
While ((SSPBUF = Empty) AND (CKP=0)) Hold SCL Low;
Send byte;
Set interrupt;
if ( ACK Received = 1) { End of transmission;
Go back to IDLE_MODE;
}
else if ( ACK Received = 0) Go back to XMIT_MODE;
IDLE_MODE (10-Bit):
If (High_byte_addr_match AND (R/W = 0))
{ PRIOR_ADDR_MATCH = FALSE;
Set interrupt;
if ((SSPBUF = Full) OR ((SSPOV = 1))
{ Set SSPOV;
Do not acknowledge;
}
else { Set UA = 1;
Send ACK = 0;
While (SSPADD not updated) Hold SCL low;
Clear UA = 0;
Receive Low_addr_byte;
Set interrupt;
Set UA = 1;
If (Low_byte_addr_match)
{ PRIOR_ADDR_MATCH = TRUE;
Send ACK = 0;
while (SSPADD not updated) Hold SCL low;
Clear UA = 0;
Set RCV_MODE;
}
}
}
else if (High_byte_addr_match AND (R/W = 1)
{ if (PRIOR_ADDR_MATCH)
{ send ACK = 0;
set XMIT_MODE;
}
else PRIOR_ADDR_MATCH = FALSE;
}
FIGURE 12-1: TXSTA: TRANSMIT STATUS AND CONTROL REGISTER (ADDRESS 98h)
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other resets
BOR
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
Legend: x = unknown, - = unimplemented read as '0'. Shaded cells are not used by the BRG.
Note: For the PIC16C73/73A/74/74A, the asynchronous high speed mode (BRGH = 1) may experience a high
rate of receive errors. It is recommended that BRGH = 0. If you desire a higher baud rate than BRGH = 0
can support, refer to the device errata for additional information, or use the PIC16C76/77.
x16 CLK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3
Samples
baud clk
First falling edge after RX pin goes low
Second rising edge
x4 clk
1 2 3 4 1 2 3 4 1 2
Q2, Q4 clk
Q2, Q4 clk
Samples
x16 CLK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3
Samples
TX9
Baud Rate Generator
TX9D
Write to TXREG
Word 1
BRG output
(shift clock)
RC6/TX/CK (pin)
Start Bit Bit 0 Bit 1 Bit 7/8 Stop Bit
WORD 1
TXIF bit
(Transmit buffer
reg. empty flag)
WORD 1
TRMT bit Transmit Shift Reg
(Transmit shift
reg. empty flag)
Write to TXREG
Word 1 Word 2
BRG output
(shift clock)
RC6/TX/CK (pin)
Start Bit Bit 0 Bit 1 Bit 7/8 Stop Bit Start Bit Bit 0
TXIF bit
(interrupt reg. flag) WORD 1 WORD 2
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
Legend: x = unknown, - = unimplemented locations read as '0'. Shaded cells are not used for Asynchronous Transmission.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
SPBRG
÷ 64 MSb RSR register LSb
or
÷ 16
Baud Rate Generator Stop (8) 7 • • • 1 0 Start
RC7/RX/DT
Pin Buffer Data
and Control Recovery RX9
Interrupt RCIF
Data Bus
RCIE
RCIF
(interrupt flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RX input. The RCREG (receive buffer) is read after the third word,
causing the OERR (overrun) bit to be set.
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
1Ah RCREG USART Receive Register 0000 0000 0000 0000
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
Legend: x = unknown, - = unimplemented locations read as '0'. Shaded cells are not used for Asynchronous Reception.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other Resets
BOR
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
Legend: x = unknown, - = unimplemented, read as '0'. Shaded cells are not used for Synchronous Master Transmission.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
Q1Q2 Q3Q4 Q1 Q2Q3 Q4Q1 Q2Q3 Q4Q1 Q2Q3 Q4Q1 Q2 Q3Q4 Q3Q4 Q1Q2 Q3Q4 Q1Q2 Q3Q4 Q1Q2 Q3 Q4Q1 Q2Q3 Q4Q1 Q2Q3 Q4Q1 Q2Q3 Q4
Write to
TXREG reg
Write word1 Write word2
TXIF bit
(Interrupt flag)
TRMT
TRMT bit
'1' '1'
TXEN bit
Note: Sync master mode; SPBRG = '0'. Continuous transmission of two 8-bit words
RC6/TX/CK pin
Write to
TXREG reg
TXIF bit
TRMT bit
TXEN bit
Once Synchronous mode is selected, reception is 1. Initialize the SPBRG register for the appropriate
enabled by setting either enable bit SREN baud rate. (Section 12.1)
(RCSTA<5>) or enable bit CREN (RCSTA<4>). Data is 2. Enable the synchronous master serial port by
sampled on the RC7/RX/DT pin on the falling edge of setting bits SYNC, SPEN, and CSRC.
the clock. If enable bit SREN is set, then only a single 3. Ensure bits CREN and SREN are clear.
word is received. If enable bit CREN is set, the recep- 4. If interrupts are desired, then set enable bit
tion is continuous until CREN is cleared. If both bits are RCIE.
set then CREN takes precedence. After clocking the 5. If 9-bit reception is desired, then set bit RX9.
last bit, the received data in the Receive Shift Register
6. If a single reception is required, set bit SREN.
(RSR) is transferred to the RCREG register (if it is
For continuous reception set bit CREN.
empty). When the transfer is complete, interrupt flag bit
RCIF (PIR1<5>) is set. The actual interrupt can be 7. Interrupt flag bit RCIF will be set when reception
enabled/disabled by setting/clearing enable bit RCIE is complete and an interrupt will be generated if
(PIE1<5>). Flag bit RCIF is a read only bit which is enable bit RCIE was set.
reset by the hardware. In this case it is reset when the 8. Read the RCSTA register to get the ninth bit (if
RCREG register has been read and is empty. The enabled) and determine if any error occurred
RCREG is a double buffered register, i.e. it is a two during reception.
deep FIFO. It is possible for two bytes of data to be 9. Read the 8-bit received data by reading the
received and transferred to the RCREG FIFO and a RCREG register.
third byte to begin shifting into the RSR register. On the 10. If any error occurred, clear the error by clearing
clocking of the last bit of the third byte, if the RCREG bit CREN.
register is still full then overrun error bit OERR
(RCSTA<1>) is set. The word in the RSR will be lost.
The RCREG register can be read twice to retrieve the
two bytes in the FIFO. Bit OERR has to be cleared in
software (by clearing bit CREN). If bit OERR is set,
transfers from the RSR to the RCREG are inhibited, so
it is essential to clear bit OERR if it is set. The 9th
receive bit is buffered the same way as the receive
data. Reading the RCREG register, will load bit RX9D
with a new value, therefore it is essential for the user to
read the RCSTA register before reading RCREG in
order not to lose the old RX9D information.
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other Resets
BOR
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
RC7/RX/DT pin bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7
RC6/TX/CK pin
Write to
bit SREN
SREN bit
CREN bit '0' '0'
RCIF bit
(interrupt)
Read
RXREG
Note: Timing diagram demonstrates SYNC master mode with bit SREN = '1' and bit BRG = '0'.
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other Resets
BOR
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
Legend: x = unknown, - = unimplemented read as '0'. Shaded cells are not used for Synchronous Slave Transmission.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other Resets
BOR
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
18h RCSTA SPEN RX9 SREN CREN — FERR OERR RX9D 0000 -00x 0000 -00x
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
98h TXSTA CSRC TX9 TXEN SYNC — BRGH TRMT TX9D 0000 -010 0000 -010
99h SPBRG Baud Rate Generator Register 0000 0000 0000 0000
Legend: x = unknown, - = unimplemented read as '0'. Shaded cells are not used for Synchronous Slave Reception.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
PCFG2:PCFG0 RA0 RA1 RA2 RA5 RA3 RE0(1) RE1(1) RE2(1) VREF
000 A A A A A A A A VDD
001 A A A A VREF A A A RA3
010 A A A A A D D D VDD
011 A A A A VREF D D D RA3
100 A A D D A D D D VDD
101 A A D D VREF D D D RA3
11x D D D D D D D D —
A = Analog input
D = Digital I/O
Note 1: RE0, RE1, and RE2 are implemented on the PIC16C74/74A/77 only.
111
RE2/AN7(1)
110
RE1/AN6(1)
101
RE0/AN5(1)
100
RA5/AN4
VIN
(Input voltage) 011
RA3/AN3/VREF
010
A/D RA2/AN2
Converter
001
RA1/AN1
VDD 000
RA0/AN0
000 or
VREF 010 or
100
(Reference
voltage) 001 or
011 or
101
PCFG2:PCFG0
Note 1: Not available on PIC16C72/73/73A/76.
CHOLD
VA CPIN I leakage = DAC capacitance
5 pF VT = 0.6V ± 500 nA = 51.2 pF
VSS
(full scale)
(moving the ADRES to the desired location). The
255 LSb
256 LSb
0.5 LSb
1 LSb
2 LSb
3 LSb
4 LSb
appropriate analog input channel must be selected and
the minimum acquisition done before the “special event
trigger” sets the GO/DONE bit (starts a conversion).
Analog input voltage
If the A/D module is not enabled (ADON is cleared),
then the “special event trigger” will be ignored by the
A/D module, but will still reset the Timer1 counter.
13.11 References
13.9 Connection Considerations
Applicable Devices A very good reference for understanding A/D convert-
ers is the "Analog-Digital Conversion Handbook" third
72 73 73A 74 74A 76 77
edition, published by Prentice Hall (ISBN
If the input voltage exceeds the rail values (VSS or VDD) 0-13-03-2848-0).
by greater than 0.2V, then the accuracy of the conver-
sion is out of specification.
An external RC filter is sometimes added for anti-alias-
ing of the input signal. The R component should be
selected to ensure that the total source impedance is
kept under the 10 kΩ recommended specification. Any
external components connected (via hi-impedance) to
an analog input pin (capacitor, zener diode, etc.) should
have very little leakage current at the pin.
Yes
ADON = 0?
No
Acquire
Selected Channel
Yes
GO = 0?
No
A/D Clock
Yes Start of A/D SLEEP Yes Finish Conversion
Conversion Delayed Instruction? GO = 0
= RC? 1 Instruction Cycle ADIF = 1
No No
No No
Wait 2 TAD
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other Resets
BOR
0Bh,8Bh INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
0Ch PIR1 — ADIF — — SSPIF CCP1IF TMR2IF TMR1IF -0-- 0000 -0-- 0000
8Ch PIE1 — ADIE — — SSPIE CCP1IE TMR2IE TMR1IE -0-- 0000 -0-- 0000
1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE — ADON 0000 00-0 0000 00-0
05h PORTA — — RA5 RA4 RA3 RA2 RA1 RA0 --0x 0000 --0u 0000
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
Value on:
Value on all
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 POR,
other Resets
BOR
0Bh,8Bh, INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
10Bh,18Bh
0Ch PIR1 PSPIF(1) ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
8Ch PIE1 PSPIE(1) ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE — ADON 0000 00-0 0000 00-0
05h PORTA — — RA5 RA4 RA3 RA2 RA1 RA0 --0x 0000 --0u 0000
85h TRISA — — PORTA Data Direction Register --11 1111 --11 1111
89h TRISE IBF OBF IBOV PSPMODE — PORTE Data Direction Bits 0000 -111 0000 -111
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC6C73/73A/76, always maintain these bits clear.
CP1 CP0 CP1 CP0 CP1 CP0 — BODEN CP1 CP0 PWRTE WDTE FOSC1 FOSC0 Register: CONFIG
bit13 bit0 Address 2007h
Note 1: Enabling Brown-out Reset automatically enables Power-up Timer (PWRT) regardless of the value of bit PWRTE.
Ensure the Power-up Timer is enabled anytime Brown-out Reset is enabled.
2: All of the CP1:CP0 pairs have to be given the same value to enable the code protection scheme listed.
MCLR
SLEEP
WDT WDT
Module Time-out
Reset
VDD rise
detect
Power-on Reset
VDD (2)
Brown-out
Reset S
BODEN
OST/PWRT
OST
Chip_Reset
10-bit Ripple counter R Q
OSC1
(1) PWRT
On-chip
RC OSC 10-bit Ripple counter
Enable PWRT
(3)
Enable OST
Note 1: This is a separate oscillator from the RC oscillator of the CLKIN pin.
2: Brown-out Reset is implemented on the PIC16C72/73A/74A/76/77.
3: See Table 14-3 and Table 14-4 for time-out situations.
VDD
BVDD Max.
BVDD Min.
Internal
72 ms
Reset
VDD
BVDD Max.
BVDD Min.
Internal <72 ms
Reset 72 ms
VDD
BVDD Max.
BVDD Min.
Internal
72 ms
Reset
POR TO PD
0 1 1 Power-on Reset
0 0 x Illegal, TO is set on POR
0 x 0 Illegal, PD is set on POR
1 0 1 WDT Reset
1 0 0 WDT Wake-up
1 u u MCLR Reset during normal operation
1 1 0 MCLR Reset during SLEEP or interrupt wake-up from SLEEP
Legend: u = unchanged, x = unknown
POR BOR TO PD
0 x 1 1 Power-on Reset
0 x 0 x Illegal, TO is set on POR
0 x x 0 Illegal, PD is set on POR
1 0 x x Brown-out Reset
1 1 0 1 WDT Reset
1 1 0 0 WDT Wake-up
1 1 u u MCLR Reset during normal operation
1 1 1 0 MCLR Reset during SLEEP or interrupt wake-up from SLEEP
TABLE 14-7: RESET CONDITION FOR SPECIAL REGISTERS
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
FIGURE 14-11: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
VDD
MCLR
INTERNAL POR
TPWRT
OST TIME-OUT
INTERNAL RESET
D 10k MCLR
R
R1 40k
MCLR PIC16CXX
C PIC16CXX
VDD VDD
R1
Q1
MCLR
R2 40k
PIC16CXX
PSPIF
PSPIE
ADIF Wake-up (If in SLEEP mode)
T0IF
ADIE T0IE
RCIF INTF
RCIE INTE
Interrupt to CPU
TXIF RBIF
TXIE RBIE
SSPIF
SSPIE
PEIE
CCP1IF
CCP1IE GIE
TMR2IF
TMR2IE
TMR1IF
TMR1IE
CCP2IF
CCP2IE
CLKOUT 3
4
INT pin
1
1
INTF flag 5 Interrupt Latency 2
(INTCON<1>)
GIE bit
(INTCON<7>)
INSTRUCTION FLOW
PC PC PC+1 PC+1 0004h 0005h
Instruction
fetched Inst (PC) Inst (PC+1) — Inst (0004h) Inst (0005h)
0
M Postscaler
1 U
WDT Timer
X 8
8 - to - 1 MUX PS2:PS0
PSA
WDT
Enable Bit
To TMR0 (Figure 7-6)
0 1
MUX PSA
WDT
Note: PSA and PS2:PS0 are bits in the OPTION register. Time-out
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
2007h Config. bits (1) BODEN(1) CP1 CP0 PWRTE(1) WDTE FOSC1 FOSC0
81h,181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
Legend: Shaded cells are not used by the Watchdog Timer.
Note 1: See Figure 14-1, and Figure 14-2 for operation of these bits.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
CLKOUT(4) TOST(2)
INT pin
INTF flag
(INTCON<1>) Interrupt Latency
(Note 2)
GIE bit Processor in
(INTCON<7>)
SLEEP
INSTRUCTION FLOW
PC PC PC+1 PC+2 PC+2 PC + 2 0004h 0005h
Instruction
fetched Inst(PC) = SLEEP Inst(PC + 1) Inst(PC + 2) Inst(0004h) Inst(0005h)
14.9 Program Verification/Code Protection The device is placed into a program/verify mode by
Applicable Devices holding the RB6 and RB7 pins low while raising the
MCLR (VPP) pin from VIL to VIHH (see programming
72 73 73A 74 74A 76 77
specification). RB6 becomes the programming clock
If the code protection bit(s) have not been pro- and RB7 becomes the programming data. Both RB6
grammed, the on-chip program memory can be read and RB7 are Schmitt Trigger inputs in this mode.
out for verification purposes.
After reset, to place the device into programming/verify
Note: Microchip does not recommend code pro- mode, the program counter (PC) is at location 00h. A 6-
tecting windowed devices. bit command is then supplied to the device. Depending
on the command, 14-bits of program data are then sup-
14.10 ID Locations plied to or from the device, depending if the command
Applicable Devices was a load or a read. For complete details of serial pro-
72 73 73A 74 74A 76 77 gramming, please refer to the PIC16C6X/7X Program-
ming Specifications (Literature #DS30228).
Four memory locations (2000h - 2003h) are designated
as ID locations where the user can store checksum or FIGURE 14-21: TYPICAL IN-CIRCUIT SERIAL
other code-identification numbers. These locations are PROGRAMMING
not accessible during normal execution but are read- CONNECTION
able and writable during program/verify. It is recom-
mended that only the 4 least significant bits of the ID
location are used. To Normal
Connections
External
14.11 In-Circuit Serial Programming Connector PIC16CXX
Signals
Applicable Devices
+5V VDD
72 73 73A 74 74A 76 77
0V VSS
PIC16CXX microcontrollers can be serially pro-
VPP MCLR/VPP
grammed while in the end application circuit. This is
simply done with two lines for clock and data, and three CLK RB6
other lines for power, ground, and the programming
voltage. This allows customers to manufacture boards Data I/O RB7
with unprogrammed devices, and then program the
microcontroller just before shipping the product. This
also allows the most recent firmware or a custom firm- VDD
ware to be programmed. To Normal
Connections
Description: The contents of the W register are Description: The contents of W register are
added to the eight bit literal 'k' and the AND’ed with the eight bit literal 'k'. The
result is placed in the W register. result is placed in the W register.
Words: 1 Words: 1
Cycles: 1 Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write to Decode Read Process Write to
literal 'k' data W literal "k" data W
Example CLRWDT
Before Instruction
WDT counter = ?
After Instruction
WDT counter = 0x00
WDT prescaler= 0
TO = 1
PD = 1
DECF Decrement f
Example HERE DECFSZ CNT, 1
Syntax: [label] DECF f,d
GOTO LOOP
Operands: 0 ≤ f ≤ 127 CONTINUE •
d ∈ [0,1] •
•
Operation: (f) - 1 → (destination) Before Instruction
Status Affected: Z PC = address HERE
After Instruction
Encoding: 00 0011 dfff ffff
CNT = CNT - 1
Description: Decrement register 'f'. If 'd' is 0 the if CNT = 0,
result is stored in the W register. If 'd' is PC = address CONTINUE
1 the result is stored back in register 'f'.
if CNT ≠ 0,
Words: 1 PC = address HERE+1
Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write to
register data destination
'f'
Words: 1 Words: 1
Cycles: 2 Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4 Q Cycle Activity: Q1 Q2 Q3 Q4
1st Cycle Decode Read Process Write to Decode Read Process Write to
literal 'k' data PC register data destination
'f'
2nd Cycle No- No- No- No-
Operation Operation Operation Operation
Example INCF CNT, 1
Example GOTO THERE Before Instruction
CNT = 0xFF
After Instruction
Z = 0
PC = Address THERE
After Instruction
CNT = 0x00
Z = 1
Cycles: 1(2)
Example IORLW 0x35
Q Cycle Activity: Q1 Q2 Q3 Q4
Before Instruction
Decode Read Process Write to
W = 0x9A
register 'f' data destination
After Instruction
If Skip: (2nd Cycle) W = 0xBF
Z = 1
Q1 Q2 Q3 Q4
No- No- No- No-
Operation Operation Operation Operation
Example RETFIE
After Interrupt
PC = TOS
GIE = 1
1st Cycle Decode Read No- Write to W, 2nd Cycle No- No- No- No-
literal 'k' Operation Pop from Operation Operation Operation Operation
the Stack
Before Instruction
W = 0x07
After Instruction
W = value of k8
RLF Rotate Left f through Carry RRF Rotate Right f through Carry
Syntax: [ label ] RLF f,d Syntax: [ label ] RRF f,d
Operands: 0 ≤ f ≤ 127 Operands: 0 ≤ f ≤ 127
d ∈ [0,1] d ∈ [0,1]
Operation: See description below Operation: See description below
Status Affected: C Status Affected: C
Encoding: 00 1101 dfff ffff Encoding: 00 1100 dfff ffff
Description: The contents of register 'f' are rotated Description: The contents of register 'f' are rotated
one bit to the left through the Carry one bit to the right through the Carry
Flag. If 'd' is 0 the result is placed in the Flag. If 'd' is 0 the result is placed in the
W register. If 'd' is 1 the result is stored W register. If 'd' is 1 the result is placed
back in register 'f'. back in register 'f'.
C Register f C Register f
Words: 1 Words: 1
Cycles: 1 Cycles: 1
Q Cycle Activity: Q1 Q2 Q3 Q4 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read Process Write to Decode Read Process Write to
register data destination register data destination
'f' 'f'
DS30390E-page 166
ICEPIC Low-Cost
In-Circuit Emulator
✔ ✔ ✔ ✔ ✔ ✔
PIC16C7X
Emulator Products
MPLAB
Integrated
Development
Environment ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
MPLAB C
Compiler ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
fuzzyTECH-MP
Explorer/Edition
Fuzzy Logic
Dev. Tool ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
Software Tools
MP-DriveWay
Applications
Code Generator ✔ ✔ ✔ ✔ ✔ ✔
Total Endurance
Software Model ✔
PICSTART
DEVELOPMENT TOOLS FROM MICROCHIP
Programmers
Programmer ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
KEELOQ
Programmer ✔
SEEVAL
Designers Kit ✔
PICDEM-1 ✔ ✔ ✔ ✔
PICDEM-2 ✔ ✔
PICDEM-3 ✔
Demo Boards
KEELOQ
✔
D041 with Schmitt Trigger buffer 0.8VDD - VDD V For entire VDD range
D042 MCLR 0.8VDD - VDD V
D042A OSC1 (XT, HS and LP) 0.7VDD - VDD V Note1
D043 OSC1 (in RC mode) 0.9VDD - VDD V
D070 PORTB weak pull-up current IPURB 50 250 †400 µA VDD = 5V, VPIN = VSS
Input Leakage Current (Notes 2, 3)
D060 I/O ports IIL - - ±1 µA Vss ≤ VPIN ≤ VDD, Pin at hi-
impedance
D061 MCLR, RA4/T0CKI - - ±5 µA Vss ≤ VPIN ≤ VDD
D063 OSC1 - - ±5 µA Vss ≤ VPIN ≤ VDD, XT, HS and
LP osc configuration
Output Low Voltage
D080 I/O ports VOL - - 0.6 V IOL = 8.5 mA, VDD = 4.5V,
-40°C to +85°C
D080A - - 0.6 V IOL = 7.0 mA, VDD = 4.5V,
-40°C to +125°C
D083 OSC2/CLKOUT (RC osc config) - - 0.6 V IOL = 1.6 mA, VDD = 4.5V,
-40°C to +85°C
D083A - - 0.6 V IOL = 1.2 mA, VDD = 4.5V,
-40°C to +125°C
*These parameters are characterized but not tested.
†Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt trigger input. It is not recommended that the
PIC16C7X be driven with external clock in RC mode.
2: The leakage current on the MCLR/VPP pin is strongly dependent on the applied voltage level. The specified
levels represent normal operating conditions. Higher leakage current may be measured at different input volt-
ages.
3: Negative current is defined as current sourced by the pin.
VDD/2
RL
CL CL
Pin Pin
VSS VSS
RL = 464Ω
CL = 50 pF for all pins except OSC2
15 pF for OSC2 output
OSC1
1 3 3 4 4
2
CLKOUT
Q4 Q1 Q2 Q3
OSC1
10 11
CLKOUT
13 12
19 18
14 16
I/O Pin
(input)
17 15
20, 21
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
OSC
Time-out
Internal
RESET
Watchdog
Timer
RESET
31
34
34
I/O Pins
VDD BVDD
35
TABLE 17-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER,
AND BROWN-OUT RESET REQUIREMENTS
Parameter Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 2 — — µs VDD = 5V, -40˚C to +125˚C
31* Twdt Watchdog Timer Time-out Period 7 18 33 ms VDD = 5V, -40˚C to +125˚C
(No Prescaler)
32 Tost Oscillation Start-up Timer Period — 1024TOSC — — TOSC = OSC1 period
33* Tpwrt Power-up Timer Period 28 72 132 ms VDD = 5V, -40˚C to +125˚C
34 TIOZ I/O Hi-impedance from MCLR Low — — 2.1 µs
or Watchdog Timer Reset
35 TBOR Brown-out Reset pulse width 100 — — µs VDD ≤ BVDD (D005)
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
RA4/T0CKI
40 41
42
RC0/T1OSO/T1CKI
45 46
47 48
TMR0 or
TMR1
RC2/CCP1
(Capture Mode)
50 51
52
RC2/CCP1
(Compare or PWM Mode)
53 54
SS
70
SCK
(CKP = 0)
71 72
78 79
SCK
(CKP = 1)
79 78
80
SDO
75, 76 77
SDI
74
73
SCL
91 93
90 92
SDA
START STOP
Condition Condition
SDA
Out
Note: Refer to Figure 17-1 for load conditions
A/D DATA 7 6 5 4 3 2 1 0
ADIF
GO DONE
SAMPLING STOPPED
SAMPLE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
D041 with Schmitt Trigger buffer 0.8VDD - VDD V For entire VDD range
D042 MCLR 0.8VDD - VDD V
D042A OSC1 (XT, HS and LP) 0.7VDD - VDD V Note1
D043 OSC1 (in RC mode) 0.9VDD - VDD V
D070 PORTB weak pull-up current IPURB 50 250 400 µA VDD = 5V, VPIN = VSS
Input Leakage Current
(Notes 2, 3)
D060 I/O ports IIL - - ±1 µA Vss ≤ VPIN ≤ VDD, Pin at hi-imped-
ance
D061 MCLR, RA4/T0CKI - - ±5 µA Vss ≤ VPIN ≤ VDD
D063 OSC1 - - ±5 µA Vss ≤ VPIN ≤ VDD, XT, HS and LP osc
configuration
Output Low Voltage
D080 I/O ports VOL - - 0.6 V IOL = 8.5 mA, VDD = 4.5V,
-40°C to +85°C
D083 OSC2/CLKOUT (RC osc config) - - 0.6 V IOL = 1.6 mA, VDD = 4.5V,
-40°C to +85°C
Output High Voltage
D090 I/O ports (Note 3) VOH VDD - 0.7 - - V IOH = -3.0 mA, VDD = 4.5V,
-40°C to +85°C
D092 OSC2/CLKOUT (RC osc config) VDD - 0.7 - - V IOH = -1.3 mA, VDD = 4.5V,
-40°C to +85°C
D150* Open-Drain High Voltage VOD - - 14 V RA4 pin
* These parameters are characterized but not tested.
† Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended that the
PIC16C7X be driven with external clock in RC mode.
2: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels
represent normal operating conditions. Higher leakage current may be measured at different input voltages.
3: Negative current is defined as current sourced by the pin.
VDD/2
RL
CL CL
Pin Pin
VSS VSS
RL = 464Ω
CL = 50 pF for all pins except OSC2, but including PORTD and PORTE outputs as
ports
15 pF for OSC2 output
Note: PORTD and PORTE are not implemented on the PIC16C73.
OSC1
1 3 3 4 4
2
CLKOUT
Q4 Q1 Q2 Q3
OSC1
10 11
CLKOUT
13 12
19 18
14 16
I/O Pin
(input)
17 15
20, 21
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
OSC
Time-out
Internal
RESET
Watchdog
Timer
RESET
31
34
34
I/O Pins
TABLE 18-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP
TIMER REQUIREMENTS
Parameter Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 100 — — ns VDD = 5V, -40˚C to +85˚C
31* Twdt Watchdog Timer Time-out Period 7 18 33 ms VDD = 5V, -40˚C to +85˚C
(No Prescaler)
32 Tost Oscillation Start-up Timer Period — 1024TOSC — — TOSC = OSC1 period
33* Tpwrt Power up Timer Period 28 72 132 ms VDD = 5V, -40˚C to +85˚C
34 TIOZ I/O Hi-impedance from MCLR Low — — 100 ns
or Watchdog Timer Reset
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
RA4/T0CKI
40 41
42
RC0/T1OSO/T1CKI
45 46
47 48
TMR0 or
TMR1
RC1/T1OSI/CCP2
and RC2/CCP1
(Capture Mode)
50 51
52
RC1/T1OSI/CCP2
and RC2/CCP1
(Compare or PWM Mode)
53 54
RE2/CS
RE0/RD
RE1/WR
65
RD7:RD0
62
64
63
Note: Refer to Figure 18-1 for load conditions
SS
70
SCK
(CKP = 0)
71 72
78 79
SCK
(CKP = 1)
79 78
80
SDO
75, 76 77
SDI
74
73
SCL
91 93
90 92
SDA
START STOP
Condition Condition
SDA
Out
Note: Refer to Figure 18-1 for load conditions
RC6/TX/CK
pin 121
121
RC7/RX/DT
pin
120
122
Note: Refer to Figure 18-1 for load conditions
RC6/TX/CK
pin 125
RC7/RX/DT
pin
126
A/D DATA 7 6 5 4 3 2 1 0
ADIF
GO DONE
SAMPLING STOPPED
SAMPLE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
D041 with Schmitt Trigger buffer 0.8VDD - VDD V For entire VDD range
D042 MCLR 0.8VDD - VDD V
D042A OSC1 (XT, HS and LP) 0.7VDD - VDD V Note1
D043 OSC1 (in RC mode) 0.9VDD - VDD V
D070 PORTB weak pull-up current IPURB 50 250 400 µA VDD = 5V, VPIN = VSS
Input Leakage Current
(Notes 2, 3)
D060 I/O ports IIL - - ±1 µA Vss ≤ VPIN ≤ VDD, Pin at hi-imped-
ance
D061 MCLR, RA4/T0CKI - - ±5 µA Vss ≤ VPIN ≤ VDD
D063 OSC1 - - ±5 µA Vss ≤ VPIN ≤ VDD, XT, HS and LP osc
configuration
Output Low Voltage
D080 I/O ports VOL - - 0.6 V IOL = 8.5 mA, VDD = 4.5V,
-40°C to +85°C
D080A - - 0.6 V IOL = 7.0 mA, VDD = 4.5V,
-40°C to +125°C
D083 OSC2/CLKOUT (RC osc config) - - 0.6 V IOL = 1.6 mA, VDD = 4.5V,
-40°C to +85°C
D083A - - 0.6 V IOL = 1.2 mA, VDD = 4.5V,
-40°C to +125°C
*These parameters are characterized but not tested.
†Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended that the
PIC16C7X be driven with external clock in RC mode.
2: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels
represent normal operating conditions. Higher leakage current may be measured at different input voltages.
3: Negative current is defined as current sourced by the pin.
VDD/2
RL
CL CL
Pin Pin
VSS VSS
RL = 464Ω
CL = 50 pF for all pins except OSC2, but including PORTD and PORTE outputs as
ports
15 pF for OSC2 output
Note: PORTD and PORTE are not implemented on the PIC16C73A.
OSC1
1 3 3 4 4
2
CLKOUT
Q4 Q1 Q2 Q3
OSC1
10 11
CLKOUT
13 12
19 18
14 16
I/O Pin
(input)
17 15
20, 21
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
OSC
Time-out
Internal
RESET
Watchdog
Timer
RESET
31
34
34
I/O Pins
VDD BVDD
35
TABLE 19-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER,
AND BROWN-OUT RESET REQUIREMENTS
Parameter Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 2 — — µs VDD = 5V, -40˚C to +125˚C
31* Twdt Watchdog Timer Time-out Period 7 18 33 ms VDD = 5V, -40˚C to +125˚C
(No Prescaler)
32 Tost Oscillation Start-up Timer Period — 1024TOSC — — TOSC = OSC1 period
33* Tpwrt Power up Timer Period 28 72 132 ms VDD = 5V, -40˚C to +125˚C
34 TIOZ I/O Hi-impedance from MCLR Low — — 2.1 µs
or Watchdog Timer Reset
35 TBOR Brown-out Reset pulse width 100 — — µs VDD ≤ BVDD (D005)
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
RA4/T0CKI
40 41
42
RC0/T1OSO/T1CKI
45 46
47 48
TMR0 or
TMR1
RC1/T1OSI/CCP2
and RC2/CCP1
(Capture Mode)
50 51
52
RC1/T1OSI/CCP2
and RC2/CCP1
(Compare or PWM Mode)
53 54
PIC16LC73A/74A — 25 45 ns
54* TccF CCP1 and CCP2 output fall time PIC16C73A/74A — 10 25 ns
PIC16LC73A/74A — 25 45 ns
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated.
These parameters are for design guidance only and are not tested.
RE2/CS
RE0/RD
RE1/WR
65
RD7:RD0
62
64
63
Note: Refer to Figure 19-1 for load conditions
SS
70
SCK
(CKP = 0)
71 72
78 79
SCK
(CKP = 1)
79 78
80
SDO
75, 76 77
SDI
74
73
SCL
91 93
90 92
SDA
START STOP
Condition Condition
SDA
Out
Note: Refer to Figure 19-1 for load conditions
RC6/TX/CK
pin 121
121
RC7/RX/DT
pin
120
122
Note: Refer to Figure 19-1 for load conditions
RC6/TX/CK
pin 125
RC7/RX/DT
pin
126
A/D DATA 7 6 5 4 3 2 1 0
ADIF
GO DONE
SAMPLING STOPPED
SAMPLE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
D041 with Schmitt Trigger buffer 0.8VDD - VDD V For entire VDD range
D042 MCLR 0.8VDD - VDD V
D042A OSC1 (XT, HS and LP) 0.7VDD - VDD V Note1
D043 OSC1 (in RC mode) 0.9VDD - VDD V
D070 PORTB weak pull-up current IPURB 50 250 400 µA VDD = 5V, VPIN = VSS
Input Leakage Current
(Notes 2, 3)
D060 I/O ports IIL - - ±1 µA Vss ≤ VPIN ≤ VDD, Pin at hi-imped-
ance
D061 MCLR, RA4/T0CKI - - ±5 µA Vss ≤ VPIN ≤ VDD
D063 OSC1 - - ±5 µA Vss ≤ VPIN ≤ VDD, XT, HS and LP osc
configuration
Output Low Voltage
D080 I/O ports VOL - - 0.6 V IOL = 8.5 mA, VDD = 4.5V,
-40°C to +85°C
D080A - - 0.6 V IOL = 7.0 mA, VDD = 4.5V,
-40°C to +125°C
D083 OSC2/CLKOUT (RC osc config) - - 0.6 V IOL = 1.6 mA, VDD = 4.5V,
-40°C to +85°C
D083A - - 0.6 V IOL = 1.2 mA, VDD = 4.5V,
-40°C to +125°C
*These parameters are characterized but not tested.
†Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended that the
PIC16C7X be driven with external clock in RC mode.
2: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels
represent normal operating conditions. Higher leakage current may be measured at different input voltages.
3: Negative current is defined as current sourced by the pin.
VDD/2
RL
CL CL
Pin Pin
VSS VSS
RL = 464Ω
CL = 50 pF for all pins except OSC2, but including PORTD and PORTE outputs as
ports
15 pF for OSC2 output
Note: PORTD and PORTE are not implemented on the PIC16C76.
OSC1
1 3 3 4 4
2
CLKOUT
Q4 Q1 Q2 Q3
OSC1
10 11
CLKOUT
13 12
19 18
14 16
I/O Pin
(input)
17 15
20, 21
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
OSC
Time-out
Internal
RESET
Watchdog
Timer
RESET
31
34
34
I/O Pins
VDD BVDD
35
TABLE 20-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER,
AND BROWN-OUT RESET REQUIREMENTS
Parameter Sym Characteristic Min Typ† Max Units Conditions
No.
30 TmcL MCLR Pulse Width (low) 2 — — µs VDD = 5V, -40˚C to +125˚C
31* Twdt Watchdog Timer Time-out Period 7 18 33 ms VDD = 5V, -40˚C to +125˚C
(No Prescaler)
32 Tost Oscillation Start-up Timer Period — 1024TOSC — — TOSC = OSC1 period
33* Tpwrt Power up Timer Period 28 72 132 ms VDD = 5V, -40˚C to +125˚C
34 TIOZ I/O Hi-impedance from MCLR Low — — 2.1 µs
or Watchdog Timer Reset
35 TBOR Brown-out Reset pulse width 100 — — µs VDD ≤ BVDD (D005)
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
RA4/T0CKI
40 41
42
RC0/T1OSO/T1CKI
45 46
47 48
TMR0 or
TMR1
RC1/T1OSI/CCP2
and RC2/CCP1
(Capture Mode)
50 51
52
RC1/T1OSI/CCP2
and RC2/CCP1
(Compare or PWM Mode)
53 54
PIC16LC76/77 — 25 45 ns
54* TccF CCP1 and CCP2 output fall time PIC16C76/77 — 10 25 ns
PIC16LC76/77 — 25 45 ns
* These parameters are characterized but not tested.
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated.
These parameters are for design guidance only and are not tested.
RE2/CS
RE0/RD
RE1/WR
65
RD7:RD0
62
64
63
Note: Refer to Figure 20-1 for load conditions
SS
70
SCK
(CKP = 0)
71 72
78 79
SCK
(CKP = 1)
79 78
80
75, 76
SS
81
SCK
(CKP = 0)
71 72
79
73
SCK
(CKP = 1)
80
78
75, 76
74
SS
70
SCK
(CKP = 0) 83
71 72
78 79
SCK
(CKP = 1)
79 78
80
75, 76 77
74
73
Refer to Figure 20-1 for load conditions.
82
SS
70
SCK 83
(CKP = 0)
71 72
SCK
(CKP = 1)
80
75, 76 77
SDI
MSB IN BIT6 - - - -1 LSB IN
74
SCL
91 93
90 92
SDA
START STOP
Condition Condition
SDA
Out
Note: Refer to Figure 20-1 for load conditions
RC6/TX/CK
pin 121
121
RC7/RX/DT
pin
120
122
Note: Refer to Figure 20-1 for load conditions
RC6/TX/CK
pin 125
RC7/RX/DT
pin
126
A/D DATA 7 6 5 4 3 2 1 0
ADIF
GO DONE
SAMPLING STOPPED
SAMPLE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
30
25
20
IPD(nA)
15
10
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD(Volts)
85°C
70°C
1.000
IPD(µA)
0.100 25°C
0°C
-40°C
0.010
0.001
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD(Volts)
Fosc(MHz)
IPD(µA)
15
3.5
3.0
10 R = 10k
2.5
2.0
5
1.5
1.0
0 R = 100k
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 0.5
VDD(Volts) 0.0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD(Volts)
25 2.2
R = 3.3k
2.0
IPD(µA)
20 1.8
70°C 1.6
Fosc(MHz)
15 R = 5k
1.4
85°C 1.2
10
1.0
R = 10k
5 0.8
0.6
Data based on matrix samples. See first page of this section for details.
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 0.4
R = 100k
VDD(Volts) 0.2
0.0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD(Volts)
600
R = 5k
500
400
R = 10k
300
200
100 R = 100k
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD(Volts)
1200 30
1000
25
IPD(µA)
IPD(µA)
400 Device in 15
Brown-out
200 Reset 10
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 5
VDD(Volts)
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
The shaded region represents the built-in hysteresis of the VDD(Volts)
brown-out reset circuitry.
1400
1200 45
1000 40
Device NOT in
IPD(µA)
35
800 Brown-out Reset
30
600 Device in
25
IPD(µA)
Brown-out
400 Reset 20
15
Data based on matrix samples. See first page of this section for details.
200
4.3 10
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 5
VDD(Volts)
0
The shaded region represents the built-in hysteresis of the 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
brown-out reset circuitry. VDD(Volts)
2000
6.0V
1800 5.5V
5.0V
1600
4.5V
1400
4.0V
1200
IDD(µA)
3.5V
1000 3.0V
800
2.5V
600
400
200
0
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5
Frequency(MHz)
Shaded area is
beyond recommended range
FIGURE 21-13: MAXIMUM IDD vs. FREQUENCY (RC MODE @ 22 pF, -40°C TO 85°C)
2000 6.0V
1800 5.5V
5.0V
1600
4.5V
1400
4.0V
Data based on matrix samples. See first page of this section for details.
1200
IDD(µA)
3.5V
1000 3.0V
800
2.5V
600
400
200
0
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5
Frequency(MHz)
Shaded area is
beyond recommended range
1600
6.0V
1400 5.5V
5.0V
1200 4.5V
4.0V
1000
3.5V
IDD(µA)
3.0V
800
2.5V
600
400
200
0
0 200 400 600 800 1000 1200 1400 1600 1800
Shaded area is Frequency(kHz)
beyond recommended range
FIGURE 21-15: MAXIMUM IDD vs. FREQUENCY (RC MODE @ 100 pF, -40°C TO 85°C)
1600
6.0V
1400 5.5V
Data based on matrix samples. See first page of this section for details.
5.0V
1200 4.5V
4.0V
1000
3.5V
IDD(µA)
3.0V
800
2.5V
600
400
200
0
0 200 400 600 800 1000 1200 1400 1600 1800
Shaded area is Frequency(kHz)
beyond recommended range
1200
6.0V
5.5V
1000 5.0V
4.5V
4.0V
800
3.5V
3.0V
IDD(µA)
600
2.5V
400
200
0
0 100 200 300 400 500 600 700
Frequency(kHz)
FIGURE 21-17: MAXIMUM IDD vs. FREQUENCY (RC MODE @ 300 pF, -40°C TO 85°C)
1200
6.0V
5.5V
1000 5.0V
Data based on matrix samples. See first page of this section for details.
4.5V
4.0V
800
3.5V
3.0V
IDD(µA)
600
2.5V
400
200
0
0 100 200 300 400 500 600 700
Frequency(kHz)
gm(mA/V)
IDD(µA)
3.0V
300 2.0
0 0.0
20 pF 100 pF 300 pF 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0
Capacitance(pF) Shaded area is VDD(Volts)
beyond recommended range
TABLE 21-1: RC OSCILLATOR
FREQUENCIES FIGURE 21-20: TRANSCONDUCTANCE(gm)
OF LP OSCILLATOR vs. VDD
Average 110
Cext Rext
Fosc @ 5V, 25°C 100 Max -40°C
90
22 pF 5k 4.12 MHz ± 1.4% 80
10k 2.35 MHz ± 1.4% 70
gm(µA/V)
Data based on matrix samples. See first page of this section for details.
Shaded areas are VDD(Volts)
5k 501 kHz ± 1.2%
beyond recommended range
10k 269 kHz ± 1.6%
100k 28.3 kHz ± 1.1% FIGURE 21-21: TRANSCONDUCTANCE(gm)
OF XT OSCILLATOR vs. VDD
The percentage variation indicated here is part to
part variation due to normal process distribution. The
1000
variation indicated is ±3 standard deviation from
900 Max -40°C
average value for VDD = 5V.
800
700
gm(µA/V)
70
3.0
60
2.5
Startup Time(Seconds)
50
Startup Time(ms)
2.0
40
32 kHz, 33 pF/33 pF 200 kHz, 68 pF/68 pF
1.5 30
200 kHz, 47 pF/47 pF
20
1.0 1 MHz, 15 pF/15 pF
10 4 MHz, 15 pF/15 pF
0.5 200 kHz, 15 pF/15 pF
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
0.0 VDD(Volts)
2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD(Volts)
1600 6.0V
120
1400 5.5V
100
5.0V
1200
80 4.5V
1000
IDD(µA)
4.0V
60
6.0V 3.5V
800
5.5V
IDD(µA)
40 5.0V 3.0V
4.5V 600
4.0V 2.5V
20 3.5V
3.0V 400
2.5V
0
0 50 100 150 200 200
Frequency(kHz)
0
0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6 4.0
Frequency(MHz)
FIGURE 21-26: MAXIMUM IDD vs. FIGURE 21-28: MAXIMUM IDD vs.
FREQUENCY FREQUENCY
(LP MODE, 85°C TO -40°C) (XT MODE, -40°C TO 85°C)
1800
6.0V
140 1600
5.5V
120 1400
5.0V
80 1000 4.0V
IDD(µA)
5.5V 3.0V
Data based on matrix samples. See first page of this section for details.
5.0V
40 4.5V 600 2.5V
4.0V
3.5V
20 3.0V
400
2.5V
0 200
0 50 100 150 200
Frequency(kHz) 0
0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6 4.0
Frequency(MHz)
4.0
IDD(mA)
3.0
3.0
2.0 6.0V
5.5V
5.0V 2.0 6.0V
1.0 4.5V 5.5V
4.0V 5.0V
1.0 4.5V
0.0 4.0V
1 2 4 6 8 10 12 14 16 18 20
0.0
Frequency(MHz) 1 2 4 6 8 10 12 14 16 18 20
Frequency(MHz)
Data based on matrix samples. See first page of this section for details.
C
E1 E
eA
Pin #1 α eB
Indicator Area
D
S1
S
Base
Plane
Seating A3 A2
Plane L
A1 A
B1 e1
B
D1
E1 E
α C
Pin No. 1
Indicator eA
Area eB
D
S S1
Base
Plane
Seating
Plane L
B1 e1 A1 A3 A A2
B
D1
E1 E α
C
Pin No. 1 eA
Indicator eB
Area
B2 B1
D
S
Base
Plane
Seating
Plane L
Detail A B3 B
e1 A1 A2 A
D1 Detail A
α
E1 E C
Pin No. 1 eA
Indicator eB
Area
D
S S1
Base
Plane
Seating
Plane L
B1 e1 A1 A2 A
B
D1
e
B
h x 45°
Index
Area
E H α C
Chamfer L
h x 45°
1 2 3
CP Base
Seating Plane
Plane
A1 A
N
Index
area
E H
α
C
L
1 2 3
e B
A Base plane
CP
Seating plane
D A1
D 0.812/0.661 N Pics
0.177 1.27 .032/.026
.007 S B D-E S .050
2 Sides -H- 0.177
-A- .007 S B A S
D1 A
A1 2 Sides
-D- 3 9
D3/E3
0.101 Seating
D2 D
.004 Plane
0.38 -C-
3 .015 F-G S 4
3 -G-
8 E2
-F-
E1 E
0.38
.015 F-G S 4
-B-
3 -E- 0.177
.007 S A F-G S
10
0.812/0.661
0.254 0.254 3
.032/.026
.010 Max 11 .010 Max 11
1.524
0.508 0.508
2 -H- .060 Min
.020 .020 -H- 2
6
6
-C-
5
1.651 1.651 0.64 Min 0.533/0.331
.065 .065 .025 .021/.013
R 1.14/0.64 R 1.14/0.64
.045/.025 .045/.025 0.177
, D-E S
.007 M A F-G S
0.20 M C A-B S D S
4 D
0.20 M H A-B S D S
D1 5 7
0.05 mm/mm A-B 0.20 min.
D3
0.13 R min.
Index
area 6 PARTING
LINE
0.13/0.30 R
9
b α
L
C
E3 E1 E
1.60 Ref.
0.20 M C A-B S D S
4
TYP 4x
10
0.20 M H A-B S D S
e B 5 7
0.05 mm/mm D
A2 A
Base
Plane Seating
Plane
A1
11°/13°(4x)
Pin#1 Pin#1
2 2 0° Min
E E1
Θ
11°/13°(4x)
Detail B
e
3.0ø (0.118ø) Ref. R1 0.08 Min
Option 1 (TOP side) R 0.08/0.20
Option 2 (TOP side)
Gage Plane
A1 0.250
Base Metal Lead Finish
A2 A b S
L 0.20
L Min
Detail A c c1 L1
Detail B
1.00 Ref. 1.00 Ref
b1
Detail A Detail B
AABBCAE 9517SBP
MMMMMMMMMMMMMMMM PIC16C73-10/SO
XXXXXXXXXXXXXXXXXXXX
AABBCDE 945/CAA
Note: In the event the full Microchip part number cannot be marked on one
line, it will be carried over to the next line thus limiting the number of
available characters for customer specific information.
* Standard OTP marking consists of Microchip part number, year code, week code,
facility code, mask revision number, and assembly code. For OTP marking beyond
this, certain price adders apply. Please check with your Microchip Sales Office.
For QTP devices, any special marking adders are included in QTP price.
MMMMMMMMM PIC16C74/JW
XXXXXXXXXXX
XXXXXXXXXXX
AABBCDE AABBCDE
MMMMMMMM PIC16C74
XXXXXXXXXX -10/L
XXXXXXXXXX
AABBCDE AABBCDE
MMMMMMMM PIC16C74
XXXXXXXXXX -10/PQ
XXXXXXXXXX
AABBCDE AABBCDE
MMMMMMMM PIC16C74A
XXXXXXXXXX -10/TQ
XXXXXXXXXX
AABBCDE AABBCDE
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high
I/O current capability. All PIC16C5XX Family devices use serial programming with clock pin RB6 and data pin RB7.
Note 1: Please contact your local Microchip sales office for availability of these devices.
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high
I/O current capability. All PIC16C62X and PIC16C64X Family devices use serial programming with clock pin RB6 and data pin RB7.
Serial Port(s) (SPI/I2C, USART) SPI/I2C SPI/I2C SPI/I2C, SPI/I2C, SPI/I2C, SPI/I2C,
USART USART USART USART
Parallel Slave Port Yes Yes Yes Yes — Yes
Interrupt Sources 8 8 11 11 10 11
I/O Pins 33 33 33 33 22 33
Voltage Range (Volts) 2.5-6.0 2.5-6.0 2.5-6.0 2.5-6.0 2.5-6.0 2.5-6.0
In-Circuit Serial Programming Yes Yes Yes Yes Yes Yes
Features Brown-out Reset Yes Yes Yes Yes Yes Yes
Packages 40-pin DIP; 40-pin DIP; 40-pin DIP; 40-pin DIP; 28-pin SDIP, 40-pin DIP;
44-pin PLCC, 44-pin PLCC, 44-pin PLCC, 44-pin SOIC 44-pin
MQFP, TQFP MQFP, TQFP MQFP, TQFP PLCC, PLCC,
MQFP, MQFP,
TQFP TQFP
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high I/O current
capability. All PIC16C6X Family devices use serial programming with clock pin RB6 and data pin RB7.
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high I/O current capabil-
ity. All PIC16C8X Family devices use serial programming with clock pin RB6 and data pin RB7.
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high I/O current capa-
bility. All PIC16C9XX Family devices use serial programming with clock pin RB6 and data pin RB7.
PIC17C752 PIC17C756
Maximum Frequency 33 33
Clock
of Operation (MHz)
EPROM Program Memory 8K 16K
(words)
Memory ROM Program Memory — —
(words)
RAM Data Memory (bytes) 454 902
Timer Module(s) TMR0, TMR0,
TMR1, TMR1,
TMR2, TMR2,
Peripherals TMR3 TMR3
Captures/PWM Module(s) 4/3 4/3
Serial Port(s) (USART) 2 2
Hardware Multiply Yes Yes
External Interrupts Yes Yes
Interrupt Sources 18 18
I/O Pins 50 50
Features Voltage Range (Volts) 3.0-6.0 3.0-6.0
Number of Instructions 58 58
Packages 64-pin DIP; 64-pin DIP;
68-pin LCC, 68-pin LCC,
68-pin TQFP 68-pin TQFP
All PIC16/17 Family devices have Power-on Reset, selectable Watchdog Timer, selectable code protect and high
I/O current capability.
X
XMIT_MODE ...................................................................... 98
Z
Z bit .................................................................................... 30
Zero bit ................................................................................. 9
Connecting to the Microchip BBS Trademarks: The Microchip name, logo, PIC, PICSTART,
PICMASTER and PRO MATE are registered trademarks
Connect worldwide to the Microchip BBS using either of Microchip Technology Incorporated in the U.S.A. and
the Internet or the CompuServe communications net- other countries. FlexROM, MPLAB and fuzzyLAB, are
work. trademarks and SQTP is a service mark of Microchip in
Internet: the U.S.A.
You can telnet or ftp to the Microchip BBS at the fuzzyTECH is a registered trademark of Inform Software
Corporation. IBM, IBM PC-AT are registered trademarks
address: mchipbbs.microchip.com of International Business Machines Corp. Pentium is a
trademark of Intel Corporation. Windows is a trademark
CompuServe Communications Network: and MS-DOS, Microsoft Windows are registered trade-
When using the BBS via the Compuserve Network, marks of Microsoft Corporation. CompuServe is a regis-
in most cases, a local call is your only expense. The tered trademark of CompuServe Incorporated.
Microchip BBS connection does not use CompuServe All other trademarks mentioned herein are the property of
membership services, therefore you do not need their respective companies.
CompuServe membership to join Microchip's BBS.
There is no charge for connecting to the Microchip BBS.
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________ FAX: (______) _________ - _________
Application (optional):
Would you like a reply? Y N
Questions:
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this data sheet easy to follow? If not, why?
4. What additions to the data sheet do you think would enhance the structure and subject?
5. What deletions from the data sheet could be made without affecting the overall usefulness?
8. How would you improve our software, systems, and silicon products?
* JW Devices are UV erasable and can be programmed to any device configuration. JW Devices meet the electrical requirement of
each oscillator type (including LC devices).
• The PICmicro family meets the specifications contained in the Microchip Data Sheet.
• Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today,
when used in the intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowl-
edge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet.
The person doing so may be engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable”.
• Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of
our product.
If you have any further questions about this matter, please contact the local sales office nearest to you.
01/18/02