Professional Documents
Culture Documents
Data Sheet
28/40/44-Pin, 8-Bit CMOS Flash
Microcontrollers with 10-Bit A/D
and nanoWatt Technology
DS30498C
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families 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
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchips Data
Sheets. Most likely, the person doing so is 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
products. Attempts to break Microchips code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart, rfPIC, and SmartShunt are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
AmpLab, FilterLab, MXDEV, MXLAB, PICMASTER, SEEVAL,
SmartSensor and The Embedded Control Solutions Company
are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM,
dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial
Programming, ICSP, ICEPIC, Migratable Memory, MPASM,
MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net,
PICLAB, PICtail, PowerCal, PowerInfo, PowerMate,
PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial,
SmartTel and Total Endurance are trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
2004, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
DS30498C-page ii
PIC16F7X7
28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with
10-Bit A/D and nanoWatt Technology
Low-Power Features:
Peripheral Features:
Power-Managed modes:
- Primary Run (XT, RC oscillator, 76 A,
1 MHz, 2V)
- RC_RUN (7 A, 31.25 kHz, 2V)
- SEC_RUN (9 A, 32 kHz, 2V)
- Sleep (0.1 A, 2V)
Timer1 Oscillator (1.8 A, 32 kHz, 2V)
Watchdog Timer (0.7 A, 2V)
Two-Speed Oscillator Start-up
Oscillators:
Three Crystal modes:
- LP, XT, HS (up to 20 MHz)
Two External RC modes
One External Clock mode:
- ECIO (up to 20 MHz)
Internal Oscillator Block:
- 8 user-selectable frequencies (31 kHz,
125 kHz, 250 kHz, 500 kHz, 1 MHz, 2 MHz,
4 MHz, 8 MHz)
Analog Features:
I/O
10-bit
A/D (ch)
Comparators
Device
Program
Data
Memory
SRAM
(# Single-Word
(Bytes)
Instructions)
Interrupts
MSSP
CCP
(PWM) SPI
Timers
I2C AUSART 8/16-bit
(Master)
PIC16F737
4096
368
25
16
11
Yes
Yes
Yes
2/1
PIC16F747
4096
368
36
17
14
Yes
Yes
Yes
2/1
PIC16F767
8192
368
25
16
11
Yes
Yes
Yes
2/1
PIC16F777
8192
368
36
17
14
Yes
Yes
Yes
2/1
DS30498C-page 1
PIC16F7X7
Pin Diagrams
PDIP, SOIC, SSOP (28-pin)
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RB7/PGD
RB6/PGC
RB5/AN13/CCP3
RB4/AN11
RB3/CCP2(1)/AN9
RB2/AN8
RB1/AN10
RB0/INT/AN12
VDD
VSS
RC7/RX/DT
RC6/TX/CK
RC5/SDO
RC4/SDI/SDA
RA1/AN1
RA0/AN0
MCLR/VPP/RE3
RB7/PGD
RB6/PGC
RB5/AN13/CCP3
RB4/AN11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
PIC16F737/767
MCLR/VPP/RE3
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/SS/C2OUT
VSS
OSC1/CLKI/RA7
OSC2/CLKO/RA6
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2(1)
RC2/CCP1
RC3/SCK/SCL
QFN (28-pin)
28 27 26 25 24 23 22
21
20
PIC16F737 19
18
PIC16F767 17
16
15
8 9 10 11 12 13 14
RB3/CCP2(1)/AN9
RB2/AN8
RB1/AN10
RB0/INT/AN12
VDD
VSS
RC7/RX/DT
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2(1)
RC2/CCP1
RC3/SCK/SCL
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
1
2
3
4
5
6
7
44
43
42
41
40
39
38
37
36
35
34
QFN (44-pin)
RC6/TX/CK
RC5/SDO
RC4/SDI/SDA
RD3/PSP3
RD2/PSP2
RD1/PSP1
RD0/PSP0
RC3/SCK/SCL
RC2/CCP1
RC1/T1OSI/CCP2(1)
RC0/T1OSO/T1CKI
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/SS/C2OUT
VSS
OSC1/CLKI/RA7
OSC2/CLKO/RA6
PIC16F747
PIC16F777
33
32
31
30
29
28
27
26
25
24
23
12
13
14
15
16
17
18
19
20
21
22
1
2
3
4
5
6
7
8
9
10
11
OSC2/CLKO/RA6
OSC1/CLKI/RA7
VSS
VSS
NC
VDD
RE2/CS/AN7
RE1/WR/AN6
RE0/RD/AN5
RA5/AN4/LVDIN/SS/C2OUT
RA4/T0CKI/C1OUT
RB3/CCP2(1)/AN9
NC
RB4/AN11
RB5/AN13/CCP3
RB6/PGC
RB7/PGD
MCLR/VPP/RE3
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RC7/RX/DT
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7
VSS
VDD
VDD
RB0/INT/AN12
RB1/AN10
RB2/AN8
Note 1:
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 2
PIC16F7X7
Pin Diagrams (Continued)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
RB7/PGD
RB6/PGC
RB5/AN13/CCP3
RB4/AN11
RB3/CCP2(1)/AN9
RB2/AN8
RB1/AN10
RB0/INT/AN12
VDD
VSS
RD7/PSP7
RD6/PSP6
RD5/PSP5
RD4/PSP4
RC7/RX/DT
RC6/TX/CK
RC5/SDO
RC4/SDI/SDA
RD3/PSP3
RD2/PSP2
RC6/TX/CK
RC5/SDO
RC4/SDI/SDA
RD3/PSP3
RD2/PSP2
RD1/PSP1
RD0/PSP0
RC3/SCK/SCL
RC2/CCP1
RC1/T1OSI/CCP2(1)
NC
MCLR/VPP/RE3
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/SS/C2OUT
RE0/RD/AN5
RE1/WR/AN6
RE2/CS/AN7
VDD
VSS
OSC1/CLKI/RA7
OSC2/CLKO/RA6
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2(1)
RC2/CCP1
RC3/SCK/SCL
RD0/PSP0
RD1/PSP1
PIC16F747/777
PDIP (40-pin)
44
43
42
41
40
39
38
37
36
35
34
TQFP (44-pin)
PIC16F747
PIC16F777
33
32
31
30
29
28
27
26
25
24
23
12
13
14
15
16
17
18
19
20
21
22
1
2
3
4
5
6
7
8
9
10
11
NC
RC0/T1OSO/T1CKI
OSC2/CLKO/RA6
OSC1/CLKI/RA7
VSS
VDD
RE2/CS/AN7
RE1/WR/AN6
RE0/RD/AN5
RA5/AN4/LVDIN/SS/C2OUT
RA4/T0CKI/C1OUT
NC
NC
RB4/AN11
RB5/AN13/CCP3
RB6/PGC
RB7/PGD
MCLR/VPP/RE3
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RC7/RX/DT
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7
VSS
VDD
RB0/INT/AN12
RB1/AN10
RB2/AN8
RB3/CCP2(1)/AN9
Note 1:
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 3
PIC16F7X7
Table of Contents
1.0 Device Overview .......................................................................................................................................................................... 5
2.0 Memory Organization ................................................................................................................................................................. 15
3.0 Reading Program Memory ......................................................................................................................................................... 31
4.0 Oscillator Configurations ............................................................................................................................................................ 33
5.0 I/O Ports ..................................................................................................................................................................................... 49
6.0 Timer0 Module ........................................................................................................................................................................... 73
7.0 Timer1 Module ........................................................................................................................................................................... 77
8.0 Timer2 Module ........................................................................................................................................................................... 85
9.0 Capture/Compare/PWM Modules .............................................................................................................................................. 87
10.0 Master Synchronous Serial Port (MSSP) Module ...................................................................................................................... 93
11.0 Addressable Universal Synchronous Asynchronous Receiver Transmitter (AUSART) ........................................................... 133
12.0 Analog-to-Digital Converter (A/D) Module ................................................................................................................................ 151
13.0 Comparator Module.................................................................................................................................................................. 161
14.0 Comparator Voltage Reference Module ................................................................................................................................... 167
15.0 Special Features of the CPU .................................................................................................................................................... 169
16.0 Instruction Set Summary .......................................................................................................................................................... 193
17.0 Development Support............................................................................................................................................................... 201
18.0 Electrical Characteristics .......................................................................................................................................................... 207
19.0 DC and AC Characteristics Graphs and Tables ....................................................................................................................... 237
20.0 Packaging Information.............................................................................................................................................................. 251
Appendix A: Revision History............................................................................................................................................................. 261
Appendix B: Device Differences......................................................................................................................................................... 261
Appendix C: Conversion Considerations ........................................................................................................................................... 262
Index .................................................................................................................................................................................................. 263
On-Line Support................................................................................................................................................................................. 271
Systems Information and Upgrade Hot Line ...................................................................................................................................... 271
Reader Response .............................................................................................................................................................................. 272
PIC16F7X7 Product Identification System ......................................................................................................................................... 273
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
Microchips Worldwide Web site; http://www.microchip.com
Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
DS30498C-page 4
PIC16F7X7
1.0
DEVICE OVERVIEW
PIC16F767
PIC16F777
TABLE 1-1:
Key Features
PIC16F737
PIC16F747
PIC16F767
PIC16F777
Operating Frequency
DC 20 MHz
DC 20 MHz
DC 20 MHz
DC 20 MHz
POR, BOR
(PWRT, OST)
POR, BOR
(PWRT, OST)
POR, BOR
(PWRT, OST)
POR, BOR
(PWRT, OST)
4K
4K
8K
8K
368
368
368
368
Interrupts
16
17
16
17
I/O Ports
Ports A, B, C
Ports A, B, C, D, E
Ports A, B, C
Ports A, B, C, D, E
Timers
Capture/Compare/PWM Modules
MSSP, AUSART
MSSP, AUSART
MSSP, AUSART
MSSP, AUSART
PSP
PSP
11 Input Channels
14 Input Channels
11 Input Channels
14 Input Channels
35 Instructions
35 Instructions
35 Instructions
35 Instructions
28-pin PDIP
28-pin SOIC
28-pin SSOP
28-pin QFN
40-pin PDIP
44-pin QFN
44-pin TQFP
28-pin PDIP
28-pin SOIC
28-pin SSOP
28-pin QFN
40-pin PDIP
44-pin QFN
44-pin TQFP
DS30498C-page 5
PIC16F7X7
FIGURE 1-1:
Program
Bus
Data Bus
Program Counter
RAM
File
Registers
368 x 8
8-Level Stack
(13-bit)
14
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/
SS/C2OUT
OSC2/CLKO/RA6
OSC1/CLKI/RA7
RAM Addr(1)
PORTB
RB0/INT/AN12
RB1/AN10
RB2/AN8
RB3/CCP2(1)/AN9
RB4/AN11
RB5/AN13/CCP3
RB7/PGD:RB6/PGC
Addr MUX
Instruction Register
Direct Addr
Indirect
Addr
FSR reg
Status reg
8
PORTC
3
Power-up
Timer
Instruction
Decode &
Control
Timing
Generation
OSC1/CLKI
OSC2/CLKO
Oscillator
Start-up Timer
Power-on
Reset
Watchdog
Timer
Brown-out
Reset
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2(1)
RC2/CCP1
RC3/SCK/SCL
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
RC7/RX/DT
MUX
ALU
8
WREG
PORTE
VDD, VSS
MCLR/VPP/RE3
Timer0
Timer1
Timer2
10-bit A/D
Comparators
CCP1, 2, 3
MSSP
Addressable
USART
BOR/LVD
Note 1: Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 6
PIC16F7X7
FIGURE 1-2:
Program
Bus
RAM
File
Registers
368 x 8
8-Level Stack
(13-bit)
14
RA0/AN0
RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/
SS/C2OUT
OSC2/CLKO/RA6
OSC1/CLKI/RA7
Data Bus
Program Counter
RAM Addr(1)
PORTB
RB0/INT/AN12
RB1/AN10
RB2/AN8
RB3/CCP2(1)/AN9
RB4/AN11
RB5/AN13/CCP3
RB7/PGD:RB6/PGC
Addr MUX
Instruction Register
Direct Addr
Indirect
Addr
FSR reg
Status reg
8
3
Power-up
Timer
Instruction
Decode &
Control
Timing
Generation
OSC1/CLKI
OSC2/CLKO
Oscillator
Start-up Timer
Power-on
Reset
Watchdog
Timer
Brown-out
Reset
PORTC
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2(1)
RC2/CCP1
RC3/SCK/SCL
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
RC7/RX/DT
MUX
ALU
8
PORTD
WREG
RD7/PSP7:RD0/PSP0
Parallel Slave Port
VDD, VSS
PORTE
RE0/RD/AN5
RE1/WR/AN6
Timer0
Timer1
Timer2
10-bit A/D
RE2/CS/AN7
MCLR/VPP/RE3
Comparators
CCP1, 2, 3
MSSP
Addressable
USART
BOR/LVD
Note 1: Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 7
PIC16F7X7
TABLE 1-2:
Pin Name
OSC1/CLKI/RA7
OSC1
PDIP
SOIC
SSOP
Pin #
QFN
Pin #
I/O/P
Type
CLKI
RA7
I/O
OSC2/CLKO/RA6
OSC2
10
RA6
I/O
1
26
ST
ST
I
P
I
VPP
RE3
Description
CLKO
MCLR/VPP/RE3
MCLR
Buffer
Type
ST
RA0/AN0
RA0
AN0
RA1/AN1
RA1
AN1
RA2/AN2/VREF-/CVREF
RA2
AN2
VREFCVREF
RA3/AN3/VREF+
RA3
AN3
VREF+
RA4/T0CKI/C1OUT
RA4
T0CKI
C1OUT
RA5/AN4/LVDIN/SS/C2OUT
RA5
AN4
LVDIN
SS
C2OUT
Legend:
Note 1:
2:
3:
4:
27
TTL
I/O
I
28
Digital I/O.
Analog input 0.
TTL
I/O
I
1
Digital I/O.
Analog input 1.
TTL
I/O
I
I
0
2
Digital I/O.
Analog input 2.
A/D reference voltage input (low).
Comparator voltage reference output.
TTL
I/O
I
I
3
Digital I/O.
Analog input 3.
A/D reference voltage input (high).
ST
I/O
I
O
4
I/O
I
I/O
I
O
Digital I/O.
Analog input 4.
Low-Voltage Detect input.
SPI slave select input.
Comparator 2 output bit.
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as the external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 8
PIC16F7X7
TABLE 1-2:
Pin Name
QFN
Pin #
I/O/P
Type
Buffer
Type
Description
21
RB1/AN10
RB1
AN10
22
RB2/AN8
RB2
AN8
23
RB3/CCP2/AN9
RB3
CCP2(4)
AN9
24
RB4/AN11
RB4
AN11
25
RB5/AN13/CCP3
RB5
AN13
CCP3
26
RB6/PGC
RB6
PGC
27
RB7/PGD
RB7
PGD
28
Legend:
Note 1:
2:
3:
4:
TTL/ST(1)
18
Digital I/O.
External interrupt.
Analog input channel 12.
I/O
I
I
19
TTL
I/O
I
20
Digital I/O.
Analog input channel 10.
TTL
I/O
I
21
Digital I/O.
Analog input channel 8.
TTL
I/O
I/O
I
22
Digital I/O.
CCP2 capture input, compare output, PWM output.
Analog input channel 9.
TTL
I/O
I
23
Digital I/O.
Analog input channel 11.
TTL
I/O
I
I/O
Digital I/O.
Analog input channel 13.
CCP3 capture input, compare output, PWM output.
TTL/ST(2)
24
Digital I/O.
In-Circuit Debugger and ICSP programming clock.
I/O
I/O
TTL/ST(2)
25
I/O
I/O
Digital I/O.
In-Circuit Debugger and ICSP programming data.
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as the external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 9
PIC16F7X7
TABLE 1-2:
Pin Name
PDIP
SOIC
SSOP
Pin #
QFN
Pin #
I/O/P
Type
Buffer
Type
Description
11
RC1/T1OSI/CCP2
RC1
T1OSI
CCP2(4)
12
RC2/CCP1
RC2
CCP1
13
RC3/SCK/SCL
RC3
SCK
SCL
14
RC4/SDI/SDA
RC4
SDI
SDA
15
RC5/SDO
RC5
SDO
16
RC6/TX/CK
RC6
TX
CK
17
RC7/RX/DT
RC7
RX
DT
18
ST
I/O
O
I
Digital I/O.
Timer1 oscillator output.
Timer1 external clock input.
ST
I/O
I
I/O
10
Digital I/O.
Timer1 oscillator input.
Capture2 input, Compare2 output, PWM2 output.
ST
I/O
I/O
11
Digital I/O.
Capture1 input, Compare1 output, PWM1 output.
ST
I/O
I/O
I/O
12
Digital I/O.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I2C mode.
ST
I/O
I
I/O
13
Digital I/O.
SPI data in.
I2C data I/O.
ST
I/O
O
14
Digital I/O.
SPI data out.
ST
I/O
O
I/O
15
Digital I/O.
AUSART asynchronous transmit.
AUSART synchronous clock.
ST
I/O
I
I/O
Digital I/O.
AUSART asynchronous receive.
AUSART synchronous data.
VSS
8, 19
5, 16
VDD
20
17
Legend:
Note 1:
2:
3:
4:
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as the external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 10
PIC16F7X7
TABLE 1-3:
Pin Name
OSC1/CLKI/RA7
OSC1
PDIP
Pin #
QFN
Pin #
TQFP
Pin #
13
32
30
I/O/P
Type
I
CLKI
RA7
I/O
OSC2/CLKO/RA6
OSC2
14
33
31
RA6
I/O
1
18
18
ST
ST
I
P
I
VPP
RE3
Description
CLKO
MCLR/VPP/RE3
MCLR
Buffer
Type
ST
RA0/AN0
RA0
AN0
RA1/AN1
RA1
AN1
RA2/AN2/VREF-/CVREF
RA2
AN2
VREFCVREF
RA3/AN3/VREF+
RA3
AN3
VREF+
RA4/T0CKI/C1OUT
RA4
T0CKI
C1OUT
RA5/AN4/LVDIN/SS/C2OUT
RA5
AN4
LVDIN
SS
C2OUT
Legend:
Note 1:
2:
3:
4:
5:
19
19
TTL
I/O
I
20
20
Digital I/O.
Analog input 0.
TTL
I/O
I
21
21
Digital I/O.
Analog input 1.
TTL
I/O
I
I
I
22
Digital I/O.
Analog input 2.
A/D reference voltage input (low).
Comparator voltage reference output.
TTL
22
I/O
I
I
23
23
Digital I/O.
Analog input 3.
A/D reference voltage input (high).
ST
I/O
I
O
24
24
I/O
I
I
I
I
Digital I/O.
Analog input 4.
Low-Voltage Detect input.
SPI slave select input.
Comparator 2 output.
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as an external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured as a general purpose I/O and a TTL input when used in the Parallel
Slave Port mode (for interfacing to a microprocessor bus).
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 11
PIC16F7X7
TABLE 1-3:
Pin Name
QFN
Pin #
TQFP
Pin #
I/O/P
Type
Buffer
Type
Description
PORTB is a bidirectional I/O port. PORTB can be
software programmed for internal weak pull-up on all
inputs.
RB0/INT/AN12
RB0
INT
AN12
33
RB1/AN10
RB1
AN10
34
RB2/AN8
RB2
AN8
35
RB3/CCP2/AN9
RB3
CCP2(5)
AN9
36
RB4/AN11
RB4
AN11
37
RB5/AN13/CCP3
RB5
AN13
CCP3
38
RB6/PGC
RB6
PGC
39
RB7/PGD
RB7
PGD
40
Legend:
Note 1:
2:
3:
4:
5:
TTL/ST(1)
8
I/O
I
I
10
Digital I/O.
External interrupt.
Analog input channel 12.
TTL
I/O
I
11
10
Digital I/O.
Analog input channel 10.
TTL
I/O
I
12
11
Digital I/O.
Analog input channel 8.
TTL
I/O
I/O
I
14
14
Digital I/O.
CCP2 capture input, compare output, PWM output.
Analog input channel 9.
TTL
I/O
I
15
15
Digital I/O.
Analog input channel 11
TTL
I/O
I
I
16
Digital I/O.
Analog input channel 13.
CCP3 capture input, compare output, PWM output.
TTL/ST(2)
16
Digital I/O.
In-Circuit Debugger and ICSP programming
clock.
I/O
I/O
17
TTL/ST(2)
17
I/O
I/O
Digital I/O.
In-Circuit Debugger and ICSP programming
data.
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as an external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured as a general purpose I/O and a TTL input when used in the Parallel
Slave Port mode (for interfacing to a microprocessor bus).
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 12
PIC16F7X7
TABLE 1-3:
Pin Name
PDIP
Pin #
QFN
Pin #
TQFP
Pin #
I/O/P
Type
Buffer
Type
Description
PORTC is a bidirectional I/O port.
RC0/T1OSO/T1CKI
RC0
T1OSO
T1CKI
15
RC1/T1OSI/CCP2
RC1
T1OSI
CCP2(5)
16
RC2/CCP1
RC2
CCP1
17
RC3/SCK/SCL
RC3
SCK
18
34
32
35
35
36
36
Digital I/O.
Timer1 oscillator input.
Capture 2 input, Compare 2 output, PWM 2 output.
ST
37
37
Digital I/O.
Capture 1 input, Compare 1 output, PWM 1 output.
ST
I/O
I/O
Digital I/O.
Synchronous serial clock input/output
for SPI mode.
Synchronous serial clock input/output
for I2C mode.
I/O
23
RC5/SDO
RC5
SDO
24
RC6/TX/CK
RC6
TX
CK
25
RC7/RX/DT
RC7
RX
DT
26
4:
5:
ST
I/O
I/O
RC4/SDI/SDA
RC4
SDI
SDA
Note 1:
2:
3:
Digital I/O.
Timer1 oscillator output.
Timer1 external clock input.
I/O
I
I/O
SCL
Legend:
ST
I/O
O
I
42
42
ST
I/O
I
I/O
43
43
Digital I/O.
SPI data in.
I2C data I/O.
ST
I/O
O
44
44
Digital I/O.
SPI data out.
ST
I/O
O
I/O
1
Digital I/O.
AUSART asynchronous transmit.
AUSART synchronous clock.
ST
I/O
I
I/O
Digital I/O.
AUSART asynchronous receive.
AUSART synchronous data.
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as an external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured as a general purpose I/O and a TTL input when used in the Parallel
Slave Port mode (for interfacing to a microprocessor bus).
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 13
PIC16F7X7
TABLE 1-3:
Pin Name
QFN
Pin #
TQFP
Pin #
I/O/P
Type
Buffer
Type
Description
PORTD is a bidirectional I/O port or Parallel Slave Port
when interfacing to a microprocessor bus.
RD0/PSP0
RD0
PSP0
19
RD1/PSP1
RD1
PSP1
20
RD2/PSP2
RD2
PSP2
21
RD3/PSP3
RD3
PSP3
22
RD4/PSP4
RD4
PSP4
27
RD5/PSP5
RD5
PSP5
28
RD6/PSP6
RD6
PSP6
29
RD7/PSP7
RD7
PSP7
30
RE0/RD/AN5
RE0
RD
AN5
RE1/WR/AN6
RE1
WR
AN6
RE2/CS/AN7
RE2
CS
AN7
10
38
ST/TTL(3)
38
Digital I/O.
Parallel Slave Port data.
I/O
I/O
39
ST/TTL(3)
39
Digital I/O.
Parallel Slave Port data.
I/O
I/O
40
ST/TTL(3)
40
Digital I/O.
Parallel Slave Port data.
I/O
I/O
41
ST/TTL(3)
41
Digital I/O.
Parallel Slave Port data.
I/O
I/O
2
ST/TTL(3)
Digital I/O.
Parallel Slave Port data.
I/O
I/O
3
ST/TTL(3)
Digital I/O.
Parallel Slave Port data.
I/O
I/O
4
ST/TTL(3)
Digital I/O.
Parallel Slave Port data.
I/O
I/O
5
ST/TTL(3)
Digital I/O.
Parallel Slave Port data.
I/O
I/O
ST/TTL(3)
25
I/O
I
I
26
Digital I/O.
Read control for Parallel Slave Port.
Analog input 5.
ST/TTL(3)
26
Digital I/O.
Write control for Parallel Slave Port.
Analog input 6.
I/O
I
I
27
ST/TTL(3)
27
Digital I/O.
Chip select control for Parallel Slave Port.
Analog input 7.
I/O
I
I
VSS
31
VSS
12, 31
6, 30
6, 29
VDD
VDD
11, 32
7, 28
7, 28
NC
Legend:
Note 1:
2:
3:
4:
5:
I = input
O = output
I/O = input/output
P = power
= Not used
TTL = TTL input
ST = Schmitt Trigger input
This buffer is a Schmitt Trigger input when configured as an external interrupt.
This buffer is a Schmitt Trigger input when used in Serial Programming mode.
This buffer is a Schmitt Trigger input when configured as a general purpose I/O and a TTL input when used in the Parallel
Slave Port mode (for interfacing to a microprocessor bus).
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
DS30498C-page 14
PIC16F7X7
2.0
MEMORY ORGANIZATION
2.2
RP1:RP0
Bank
00
01
10
2.1
11
2.2.1
GENERAL PURPOSE
REGISTER FILE
FIGURE 2-1:
13
Stack Level 1
Stack Level 2
Stack Level 8
Reset Vector
0000h
Interrupt Vector
0004h
0005h
Page 0
Page 1
On-Chip
Program
Memory
Page2
07FFh
0800h
0FFFh
1000h
17FFh
1800h
Page 3
1FFFh
DS30498C-page 15
PIC16F7X7
FIGURE 2-2:
Indirect addr.(*)
TMR0
PCL
STATUS
FSR
PORTA
PORTB
PORTC
PORTE
PCLATH
INTCON
PIR1
PIR2
TMR1L
TMR1H
T1CON
TMR2
T2CON
SSPBUF
SSPCON
CCPR1L
CCPR1H
CCP1CON
RCSTA
TXREG
RCREG
CCPR2L
CCPR2H
CCP2CON
ADRESH
ADCON0
00h
01h
02h
03h
04h
05h
06h
07h
08h
09h
0Ah
0Bh
0Ch
0Dh
0Eh
0Fh
10h
11h
12h
13h
14h
15h
16h
17h
18h
19h
1Ah
1Bh
1Ch
1Dh
1Eh
1Fh
20h
File
Address
Indirect addr.(*)
OPTION_REG
PCL
STATUS
FSR
TRISA
TRISB
TRISC
TRISE
PCLATH
INTCON
PIE1
PIE2
PCON
OSCCON
OSCTUNE
SSPCON2
PR2
SSPADD
SSPSTAT
CCPR3L
CCPR3H
CCP3CON
TXSTA
SPBRG
ADCON2
CMCON
CVRCON
ADRESL
ADCON1
General
Purpose
Register
80 Bytes
General
Purpose
Register
80h
81h
82h
83h
84h
85h
86h
87h
88h
89h
8Ah
8Bh
8Ch
8Dh
8Eh
8Fh
90h
91h
92h
93h
94h
95h
96h
97h
98h
99h
9Ah
9Bh
9Ch
9Dh
9Eh
9Fh
File
Address
Indirect addr.(*)
A0h
PMDATH
PMADRH
7Fh
FFh
Bank 1
Indirect addr.(*)
OPTION_REG
PCL
STATUS
FSR
TRISB
PCLATH
INTCON
PMCON1
19Fh
1A0h
11Fh
120h
General
Purpose
Register
80 Bytes
General
Purpose
Register
80 Bytes
16Fh
170h
1EFh
1F0h
Accesses
70h-7Fh
17Fh
Bank 2
180h
181h
182h
183h
184h
185h
186h
187h
188h
189h
18Ah
18Bh
18Ch
18Dh
18Eh
18Fh
190h
General
Purpose
Register
16 Bytes
General
Purpose
Register
16 Bytes
Accesses
70h-7Fh
Accesses
70h-7Fh
LVDCON
PCLATH
INTCON
PMDATA
PMADR
EFh
F0h
96 Bytes
Bank 0
TMR0
PCL
STATUS
FSR
WDTCON
PORTB
100h
101h
102h
103h
104h
105h
106h
107h
108h
109h
10Ah
10Bh
10Ch
10Dh
10Eh
10Fh
110h
File
Address
1FFh
Bank 3
DS30498C-page 16
PIC16F7X7
FIGURE 2-3:
Indirect addr.(*)
TMR0
PCL
STATUS
FSR
PORTA
PORTB
PORTC
PORTD
PORTE
PCLATH
INTCON
PIR1
PIR2
TMR1L
TMR1H
T1CON
TMR2
T2CON
SSPBUF
SSPCON
CCPR1L
CCPR1H
CCP1CON
RCSTA
TXREG
RCREG
CCPR2L
CCPR2H
CCP2CON
ADRESH
ADCON0
00h
01h
02h
03h
04h
05h
06h
07h
08h
09h
0Ah
0Bh
0Ch
0Dh
0Eh
0Fh
10h
11h
12h
13h
14h
15h
16h
17h
18h
19h
1Ah
1Bh
1Ch
1Dh
1Eh
1Fh
20h
File
Address
Indirect addr.(*)
OPTION_REG
PCL
STATUS
FSR
TRISA
TRISB
TRISC
TRISD
TRISE
PCLATH
INTCON
PIE1
PIE2
PCON
OSCCON
OSCTUNE
SSPCON2
PR2
SSPADD
SSPSTAT
CCPR3L
CCPR3H
CCP3CON
TXSTA
SPBRG
ADCON2
CMCON
CVRCON
ADRESL
ADCON1
General
Purpose
Register
80 Bytes
General
Purpose
Register
80h
81h
82h
83h
84h
85h
86h
87h
88h
89h
8Ah
8Bh
8Ch
8Dh
8Eh
8Fh
90h
91h
92h
93h
94h
95h
96h
97h
98h
99h
9Ah
9Bh
9Ch
9Dh
9Eh
9Fh
Indirect addr.(*)
A0h
LVDCON
PCLATH
INTCON
PMDATA
PMADR
PMDATH
PMADRH
7Fh
Bank 0
100h
101h
102h
103h
104h
105h
106h
107h
108h
109h
10Ah
10Bh
10Ch
10Dh
10Eh
10Fh
110h
FFh
Bank 1
Indirect addr.(*)
OPTION_REG
PCL
STATUS
FSR
TRISB
PCLATH
INTCON
PMCON1
19Fh
1A0h
11Fh
120h
General
Purpose
Register
80 Bytes
General
Purpose
Register
80 Bytes
16Fh
170h
1EFh
1F0h
Accesses
70h-7Fh
17Fh
Bank 2
180h
181h
182h
183h
184h
185h
186h
187h
188h
189h
18Ah
18Bh
18Ch
18Dh
18Eh
18Fh
190h
General
Purpose
Register
16 Bytes
General
Purpose
Register
16 Bytes
Accesses
70h-7Fh
Accesses
70h-7Fh
TMR0
PCL
STATUS
FSR
WDTCON
PORTB
EFh
F0h
96 Bytes
File
Address
File
Address
1FFh
Bank 3
DS30498C-page 17
PIC16F7X7
2.2.2
TABLE 2-1:
Address
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Details
on page
Bank 0
00h(4)
INDF
Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000
30, 180
01h
TMR0
76, 180
02h(4)
PCL
03h(4)
STATUS
04h(4)
FSR
xxxx xxxx
30, 180
05h
PORTA
xx0x 0000
55, 180
IRP
RP1
xxxx xxxx
RP0
TO
PD
DC
0000 0000
29, 180
0001 1xxx
21, 180
06h
PORTB
xx00 0000
64, 180
07h
PORTC
xxxx xxxx
66, 180
08h(5)
PORTD
xxxx xxxx
67, 180
09h(5)
PORTE
---- x000
68, 180
---0 0000
29, 180
0Ah(1,4) PCLATH
0Bh(4)
INTCON
0Ch
PIR1
RE3
RE2
RE1
RE0
GIE
PEIE
TMR0IE
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
23, 180
PSPIF(3)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
TMR1IF
0000 0000
25, 180
OSFIF
CMIF
LVDIF
BCLIF
CCP3IF
CCP2IF
0Dh
PIR2
000- 0-00
27, 180
0Eh
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
xxxx xxxx
83, 180
0Fh
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
xxxx xxxx
83, 180
10h
T1CON
11h
TMR2
12h
T2CON
13h
SSPBUF
14h
SSPCON
15h
CCPR1L
xxxx xxxx
90, 180
16h
CCPR1H
xxxx xxxx
90, 180
17h
CCP1CON
88, 180
18h
RCSTA
19h
TXREG
1Ah
RCREG
1Bh
CCPR2L
xxxx xxxx
92, 180
1Ch
CCPR2H
xxxx xxxx
92, 180
1Dh
CCP2CON
88, 180
1Eh
ADRESH
1Fh
ADCON0
T1RUN
T1CKPS1
T1CKPS0
T1OSCEN T1SYNC
83, 180
0000 0000
86, 180
86, 180
TOUTPS3 TOUTPS2
TOUTPS1
SSPOV
SSPEN
CKP
SSPM3
SSPM1
CCP1X
CCP1Y
CCP1M3
CCP1M2
CCP1M1
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
CCP2X
CCP2Y
CCP2M3
CCP2M2
CCP2M1
SSPM0
RX9D
ADCS0
CHS2
CHS0
GO/DONE
CHS3
ADON
DS30498C-page 18
PIC16F7X7
TABLE 2-1:
Address
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Details
on page
Bank 1
80h(4)
INDF
81h
OPTION_REG
82h(4)
PCL
83h(4)
STATUS
84h(4)
FSR
xxxx xxxx
30, 180
85h
TRISA
1111 1111
55, 181
Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000
RBPU
INTEDG
T0CS
T0SE
PS2
PS1
PS0
1111 1111
0000 0000
29, 180
PD
DC
0001 1xxx
21, 180
RP1
RP0
TO
30, 180
PSA
22, 180
86h
TRISB
1111 1111
64, 181
87h
TRISC
1111 1111
66, 181
88h(5)
TRISD
89h(5)
TRISE
8Ah(1,4) PCLATH
IBF(5)
OBF(5)
IBOV(5)
PSPMODE(5)
(8)
67, 181
69, 181
---0 0000
23, 180
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
25, 180
PIE1
PSPIE(3)
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
TMR1IE
0000 0000
24, 181
26, 181
8Bh(4)
INTCON
8Ch
1111 1111
0000 1111
8Dh
PIE2
OSFIE
CMIE
LVDIE
BCLIE
CCP3IE
CCP2IE
000- 0-00
8Eh
PCON
SBOREN
POR
BOR
---- -1qq
28, 181
8Fh
OSCCON
IRCF2
IRCF1
IRCF0
OSTS(7)
IOFS
SCS1
SCS0
-000 1000
38, 181
90h
OSCTUNE
TUN5
TUN4
TUN3
TUN2
TUN1
TUN0
--00 0000
36, 181
91h
SSPCON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
0000 0000
105
92h
PR2
1111 1111
86, 181
93h
SSPADD
94h
SSPSTAT
95h
CCPR3L
xxxx xxxx
92
96h
CCPR3H
xxxx xxxx
92
97h
CCP3CON
92
98h
TXSTA
99h
SPBRG
9Ah
9Bh
ADCON2
9Ch
CMCON
9Dh
CVRCON
9Eh
ADRESL
9Fh
ADCON1
SMP
CKE
D/A
UA
CCP3X
CCP3Y
CCP3M3
CCP3M2
CCP3M1
CSRC
TX9
TXEN
SYNC
BRGH
TRMT
BF
TX9D
Unimplemented
ACQT0
--00 0---
154
ACQT2
ACQT1
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
0000 0111
55, 161
CVREN
CVROE
CVRR
CVR3
CVR2
CVR1
CVR0
000- 0000
55, 167
xxxx xxxx
180
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
ADCS2
VCFG1
DS30498C-page 19
PIC16F7X7
TABLE 2-1:
Address
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Details
on page
Bank 2
100h(4)
INDF
Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000
30, 180
101h
TMR0
76, 180
102h(4)
PCL
103h(4)
STATUS
104h(4)
FSR
105h
WDTCON
106h
PORTB
107h
108h
109h
IRP
xxxx xxxx
RP1
RP0
TO
PD
DC
LVDCON
10Ah(1,4) PCLATH
10Bh(4)
INTCON
10Ch
PMDATA
WDTPS3
0000 0000
29, 180
0001 1xxx
21, 180
xxxx xxxx
30, 180
187
xxxx xxxx
64, 180
Unimplemented
Unimplemented
--00 0101
176
---0 0000
23, 180
IRVST
GIE
PEIE
TMR0IE
LVDEN
LVDL3
LVDL2
LVDL1
LVDL0
0000 000x
25, 180
xxxx xxxx
32, 181
xxxx xxxx
32, 181
10Dh
PMADR
10Eh
PMDATH
10Fh
PMADRH
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
--xx xxxx
32, 181
---- xxxx
32, 181
Bank 3
180h(4)
INDF
181h
OPTION_REG
182h(4)
PCL
183h(4)
STATUS
184h(4)
FSR
185h
186h
Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000
RBPU
INTEDG
T0CS
T0SE
PS2
PS1
PS0
1111 1111
0000 0000
29, 180
PD
DC
0001 1xxx
21, 180
xxxx xxxx
30, 180
RP1
RP0
TO
TRISB
30, 180
PSA
Unimplemented
PORTB Data Direction Register
22, 180
1111 1111
64, 181
187h
Unimplemented
188h
Unimplemented
189h
Unimplemented
---0 0000
23, 180
18Ah(1,4) PCLATH
18Bh(4)
INTCON
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
25, 180
18Ch
PMCON1
r(6)
RD
1--- ---0
32, 181
18Dh
18Eh
18Fh
DS30498C-page 20
PIC16F7X7
2.2.2.1
Status Register
REGISTER 2-1:
R/W-0
R/W-0
R-1
R-1
R/W-x
R/W-x
R/W-x
IRP
RP1
RP0
TO
PD
DC
bit 7
bit 0
bit 7
bit 6-5
bit 4
bit 3
bit 2
Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit 1
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 21
PIC16F7X7
2.2.2.2
OPTION_REG Register
Note:
REGISTER 2-2:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
RBPU
INTEDG
T0CS
T0SE
PSA
PS2
PS1
PS0
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
000
001
010
011
100
101
110
111
1:2
1:4
1:8
1 : 16
1 : 32
1 : 64
1 : 128
1 : 256
1:1
1:2
1:4
1:8
1 : 16
1 : 32
1 : 64
1 : 128
Legend:
DS30498C-page 22
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
2.2.2.3
INTCON Register
Note:
The INTCON register is a readable and writable register which contains various enable and flag bits for the
TMR0 register overflow, RB port change and external
RB0/INT pin interrupts.
REGISTER 2-3:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-x
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 23
PIC16F7X7
2.2.2.4
PIE1 Register
Note:
REGISTER 2-4:
PSPIE
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
TMR1IE
bit 7
bit 7
bit 0
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS30498C-page 24
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
2.2.2.5
PIR1 Register
REGISTER 2-5:
R/W-0
R-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
TMR1IF
bit 0
bit 7
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Legend:
R = Readable bit
-n = Value at POR
W = Writable bit
1 = Bit is set
DS30498C-page 25
PIC16F7X7
2.2.2.6
PIE2 Register
REGISTER 2-6:
R/W-0
CMIE
R/W-0
U-0
R/W-0
U-0
R/W-0
R/W-0
LVDIE
BCLIE
CCP3IE
CCP2IE
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
Unimplemented: Read as 0
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS30498C-page 26
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
2.2.2.7
PIR2 Register
Note:
The PIR2 register contains the flag bits for the CCP2
interrupt.
REGISTER 2-7:
R/W-0
R/W-0
U-0
R/W-0
U-0
R/W-0
R/W-0
OSFIF
CMIF
LVDIF
BCLIF
CCP3IF
CCP2IF
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
Unimplemented: Read as 0
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 27
PIC16F7X7
2.2.2.8
PCON Register
Note:
REGISTER 2-8:
U-0
U-0
U-0
U-0
R/W-1
R/W-0
R/W-1
SBOREN
POR
BOR
bit 7
bit 0
bit 7-3
Unimplemented: Read as 0
bit 2
bit 1
bit 0
DS30498C-page 28
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
2.3
FIGURE 2-4:
LOADING OF PC IN
DIFFERENT SITUATIONS
PCH
PCL
12
PC
8
PCLATH<4:0>
Instruction with
PCL as
Destination
ALU
PCLATH
PCH
12
11 10
PCL
8
PC
GOTO,CALL
2
PCLATH<4:3>
11
Opcode <10:0>
PCLATH
2.3.1
2.4
PIC16F7X7 devices are capable of addressing a continuous 8K word block of program memory. The CALL
and GOTO instructions provide only 11 bits of address to
allow branching within any 2K program memory page.
When doing a CALL or GOTO instruction, the upper
2 bits of the address are provided by PCLATH<4:3>.
When doing a CALL or GOTO instruction, the user must
ensure that the page select bits are programmed so
that the desired program memory page is addressed. If
a return from a CALL instruction (or interrupt) is
executed, the entire 13-bit PC is POPed off the stack.
Therefore, manipulation of the PCLATH<4:3> bits is
not required for the RETURN instructions (which POPs
the address from the stack).
Note:
COMPUTED GOTO
2.3.2
EXAMPLE 2-1:
STACK
ORG
BCF
BSF
0x500
PCLATH, 4
PCLATH, 3 ;Select page 1
;(800h-FFFh)
CALL SUB1_P1
;Call subroutine in
:
;page 1 (800h-FFFh)
:
ORG
0x900
;page 1 (800h-FFFh)
SUB1_P1
:
:
:
RETURN
CALL OF A SUBROUTINE
IN PAGE 1 FROM PAGE 0
;called subroutine
;page 1 (800h-FFFh)
;return to Call
;subroutine in page 0
;(000h-7FFh)
DS30498C-page 29
PIC16F7X7
2.5
EXAMPLE 2-2:
MOVLW
MOVWF
NEXT
CLRF
INCF
BTFSS
GOTO
CONTINUE
:
INDIRECT ADDRESSING
0x20
;initialize pointer
FSR
;to RAM
INDF
;clear INDF register
FSR, F ;inc pointer
FSR, 4 ;all done?
NEXT
;no clear next
;yes continue
FIGURE 2-5:
DIRECT/INDIRECT ADDRESSING
Direct Addressing
RP1:RP0
Bank Select
Indirect Addressing
From Opcode
IRP
FSR Register
Bank Select
Location Select
00
01
10
Location Select
11
00h
80h
100h
180h
7Fh
FFh
17Fh
1FFh
Data
Memory(1)
Bank 0
Note 1:
Bank 1
Bank 2
Bank 3
DS30498C-page 30
PIC16F7X7
3.0
3.1
PMCON1
PMDATA
PMDATH
PMADR
PMADRH
PMADR
3.2
PMCON1 Register
U-0
U-0
U-0
U-x
U-0
U-0
R/S-0
reserved
RD
bit 7
bit 0
bit 7
Reserved: Read as 1
bit 6-1
Unimplemented: Read as 0
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 31
PIC16F7X7
3.3
3.4
EXAMPLE 3-1:
Required
Sequence
BSF
BCF
MOVF
MOVWF
MOVF
MOVWF
BSF
STATUS, RP1
STATUS, RP0
ADDRH, W
PMADRH
ADDRL, W
PMADR
STATUS, RP0
;
;
;
;
;
;
;
BSF
NOP
NOP
PMCON1, RD
BCF
MOVF
MOVF
STATUS, RP0
PMDATA, W
PMDATH, W
; Bank 2
; W = LSByte of Program PMDATA
; W = MSByte of Program PMDATH
TABLE 3-1:
Address
Bank 2
MSByte of Program Address to read
LSByte of Program Address to read
Bank 3 Required
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
all other
Resets
10Dh
PMADR
10Fh
PMADRH
10Ch
10Eh
PMDATH
18Ch
PMCON1 reserved(1)
Legend:
Note 1:
Value on:
POR, BOR
RD
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used during Flash access.
This bit always reads as a 1.
DS30498C-page 32
PIC16F7X7
4.0
OSCILLATOR
CONFIGURATIONS
4.1
Oscillator Types
TABLE 4-1:
The PIC16F7X7 can be operated in eight different oscillator modes. The user can program three configuration
bits (FOSC2:FOSC0) to select one of these eight modes
(modes 5-8 are new PIC16 oscillator configurations):
1.
2.
3.
4.
LP
XT
HS
RC
Low-Power Crystal
Crystal/Resonator
High-Speed Crystal/Resonator
External Resistor/Capacitor with
FOSC/4 output on RA6
RCIO External Resistor/Capacitor with
I/O on RA6
INTIO1 Internal Oscillator with FOSC/4
output on RA6 and I/O on RA7
INTIO2 Internal Oscillator with I/O on RA6
and RA7
ECIO External Clock with I/O on RA6
5.
6.
7.
8.
4.2
Crystal Oscillator/Ceramic
Resonators
FIGURE 4-1:
CRYSTAL OPERATION
(HS, XT OR LP OSC
CONFIGURATION)
OSC1
PIC16F7X7
C1(1)
XTAL
RF(3)
Sleep
OSC2
C2(1)
Osc Type
LP
XT
HS
C2
32 kHz
33 pF
33 pF
200 kHz
15 pF
15 pF
200 kHz
56 pF
56 pF
1 MHz
15 pF
15 pF
4 MHz
15 pF
15 pF
4 MHz
15 pF
15 pF
8 MHz
15 pF
15 pF
20 MHz
15 pF
15 pF
RS(2)
To Internal
Logic
DS30498C-page 33
PIC16F7X7
FIGURE 4-2:
CERAMIC RESONATOR
OPERATION (HS OR XT
OSC CONFIGURATION)
OSC1
C1
PIC16F7X7
(1)
RES
RF(3)
Sleep
OSC2
C2(1)
RS(2)
To Internal
Logic
4.3
FIGURE 4-3:
OSC1/CLKI
Clock from
Ext. System
PIC16F7X7
RA6
TABLE 4-2:
I/O (OSC2)
Freq
OSC1
OSC2
XT
455 kHz
2.0 MHz
4.0 MHz
56 pF
47 pF
33 pF
56 pF
47 pF
33 pF
HS
8.0 MHz
16.0 MHz
27 pF
22 pF
27 pF
22 pF
Note:
DS30498C-page 34
PIC16F7X7
4.4
RC Oscillator
4.5
FIGURE 4-4:
RC OSCILLATOR MODE
VDD
REXT
OSC1
Internal
Clock
CEXT
PIC16F7X7
VSS
FOSC/4
FIGURE 4-5:
Power-up Timer
Watchdog Timer
Two-Speed Start-up
Fail-Safe Clock Monitor
OSC2/CLKO
VDD
REXT
Internal
Clock
OSC1
CEXT
PIC16F7X7
VSS
RA6
I/O (OSC2)
DS30498C-page 35
PIC16F7X7
4.5.1
INTRC MODES
4.5.2
REGISTER 4-1:
bit 7
bit 7-6
bit 5-0
OSCTUNE REGISTER
U-0
R/W-0
TUN5
R/W-0
TUN4
R/W-0
TUN3
R/W-0
TUN2
R/W-0
TUN1
R/W-0
TUN0
bit 0
Unimplemented: Read as 0
TUN<5:0>: Frequency Tuning bits
011111 = Maximum frequency
011110 =
000001 =
000000 = Center frequency. Oscillator module is running at the calibrated frequency.
111111 =
DS30498C-page 36
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
4.6
4.6.2
4.6.1
OSCCON REGISTER
CLOCK SWITCHING
DS30498C-page 37
PIC16F7X7
4.6.3
Once the clock transition is complete (i.e., new oscillator selection switch has occurred), the Watchdog
Counter is re-enabled with the Counter Reset. This
allows the user to synchronize the Watchdog Timer to
the start of execution at the new clock frequency.
REGISTER 4-2:
R/W-0
R/W-0
R/W-0
R-0
R-0
R/W-0
R/W-0
IRCF2
IRCF1
IRCF0
OSTS(1)
IOFS
SCS1
SCS0
bit 7
bit 0
bit 7
Unimplemented: Read as 0
bit 6-4
bit 3
bit 2
bit 1-0
DS30498C-page 38
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
FIGURE 4-6:
Primary Oscillator
OSC2
Sleep
Secondary Oscillator
T1OSC
T1OSO
To Timer1
T1OSCEN
Enable
Oscillator
OSCCON<6:4>
8 MHz
4 MHz
Internal
Oscillator
Block
8 MHz
(INTOSC)
31.25 kHz
(INTRC)
4.6.4
CPU
111
110
101
1 MHz
100
500 kHz
250 kHz
125 kHz
31.25 kHz
Internal Oscillator
2 MHz
Postscaler
31.25 kHz
Source
Peripherals
011
MUX
T1OSI
MUX
OSC1
010
001
000
WDT, FSCM
DS30498C-page 39
PIC16F7X7
4.6.5
TABLE 4-3:
4.6.6
Clock Switch
Frequency
Oscillator Delay
INTRC
T1OSC
31.25 kHz
32.768 kHz
CPU Start-up(1)
INTOSC/INTOSC
Postscaler
4 ms (approx.) and
CPU Start-up(1)
INTRC/
Sleep
EC, RC
DC 20 MHz
INTRC
(31.25 kHz)
EC, RC
DC 20 MHz
Sleep
LP, XT, HS
4 ms (approx.)
From
Sleep/POR
INTRC
INTOSC/INTOSC
(31.25 kHz)
Postscaler
Note 1:
Comments
To
DS30498C-page 40
PIC16F7X7
4.7
Power-Managed Modes
4.7.1
RC_RUN MODE
FIGURE 4-7:
TIMING DIAGRAM FOR XT, HS, LP, EC, EXTRC TO RC_RUN MODE
Q1 Q2 Q3 Q4 Q1
Q1
TINP(1)
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
INTOSC
TSCS(3)
OSC1
System
Clock
TOSC(2)
TDLY(4)
SCS<1:0>
Program
Counter
Note 1:
2:
3:
4:
PC
PC + 1
PC + 2
PC + 3
TINP = 32 s typical.
TOSC = 50 ns minimum.
TSCS = 8 TINP.
TDLY = 1 TINP.
DS30498C-page 41
PIC16F7X7
4.7.2
SEC_RUN MODE
FIGURE 4-8:
Final
SCS<1:0>
00
01
00 no change
00
11
10 INTRC
10
11
10 no change
10
01
00 Oscillator
defined by
FOSC<2:0>
Q1 Q2 Q3 Q4 Q1
T1OSI
Q1
TT1P(1)
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
TSCS(3)
OSC1
System
Clock
TOSC(2)
TDLY(4)
SCS<1:0>
Program
Counter
Note 1:
2:
3:
4:
PC
PC + 1
PC + 2
PC + 3
TT1P = 30.52 s.
TOSC = 50 ns minimum.
TSCS = 8 TT1P
TDLY = 1 TT1P.
DS30498C-page 42
PIC16F7X7
4.7.3
SEC_RUN/RC_RUN TO PRIMARY
CLOCK SOURCE
4.7.3.1
2.
3.
4.
5.
6.
7.
DS30498C-page 43
PIC16F7X7
FIGURE 4-9:
Q1
Q2
Q3
Q4
TT1P(1) or TINP(2)
Q1
Q2 Q3 Q4 Q1 Q2 Q3 Q4
Secondary
Oscillator
OSC1
TOST(6)
OSC2
TOSC(3)
Primary Clock
TSCS(4)
System Clock
TDLY(5)
SCS<1:0>
OSTS
Program
Counter
Note 1:
2:
3:
4:
5:
6:
PC
PC + 1
PC + 2
PC + 3
TT1P = 30.52 s.
TINP = 32 s typical.
TOSC = 50 ns minimum.
TSCS = 8 TINP OR 8 TT1P.
TDLY = 1 TINP OR 1 TT1P.
Refer to parameter D032 in Section 18.0 Electrical Characteristics.
DS30498C-page 44
PIC16F7X7
4.7.3.2
3.
4.
FIGURE 4-10:
TIMING LP CLOCK TO PRIMARY SYSTEM CLOCK AFTER RESET (HS, XT, LP)
Q4
TT1P(1)
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Q1
Q1 Q2 Q3 Q4
T1OSI
OSC1
TOST(4)
OSC2
TEPU(3)
TOSC(2)
CPU Start-up
System Clock
Peripheral
Clock
Reset
Sleep
OSTS
Program
Counter
Note 1:
2:
3:
4:
PC
0000h
0001h
0003h
0004h
0005h
TT1P = 30.52 s.
TOSC = 50 ns minimum.
TEPU = 5-10 s.
Refer to parameter D032 in Section 18.0 Electrical Characteristics.
DS30498C-page 45
PIC16F7X7
FIGURE 4-11:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Q1
Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4
T1OSI
OSC1
OSC2
TCPU(2)
CPU Start-up
System Clock
MCLR
OSTS
Program
Counter
Note 1:
2:
PC
0000h
0001h
0002h
0003h
0004h
TT1P = 30.52 s.
TCPU = 5-10 s.
DS30498C-page 46
PIC16F7X7
TABLE 4-4:
Current
System
Clock
Delay
OSTS
bit
IOFS T1RUN
bit
bit
New
System
Clock
8 Clocks of
INTRC
1(1)
8 Clocks of
T1OSC
N/A
T1OSC
EC
or
RC
Comments
INTRC
The internal RC oscillator
or
frequency is dependant upon
INTOSC the IRCF bits.
or
INTOSC
Postscaler
T1OSCEN bit must be enabled.
INTRC
T1OSC
00
FOSC<2:0> = EC
or
FOSC<2:0> = RC
8 Clocks of
EC
or
RC
N/A
INTRC
T1OSC
00
FOSC<2:0> = LP,
XT, HS
1024 Clocks
+
8 Clocks of
LP, XT, HS
N/A
LP, XT, HS
00
(Due to Reset)
LP, XT, HS
1024 Clocks
N/A
Note 1:
If the new clock source is the INTOSC or INTOSC postscaler, then the IOFS bit will be set 4 ms (approx.)
after the clock change.
DS30498C-page 47
PIC16F7X7
4.7.4
4.7.4.1
Sequence of Events
If SCS<1:0> = 00:
1.
2.
3.
DS30498C-page 48
If SCS<1:0> = 01 or 10:
1.
2.
OSCCON,SCS0
PIC16F7X7
5.0
I/O PORTS
5.1
PORTA is a 8-bit wide, bidirectional port. The corresponding data direction register is TRISA. Setting a
TRISA bit (= 1) will make the corresponding PORTA pin
an input (i.e., put the corresponding output driver in a
high-impedance mode). Clearing a TRISA bit (= 0) will
make the corresponding PORTA pin an output (i.e., put
the contents of the output latch on the selected pin).
Reading the PORTA register reads the status of the
pins, whereas writing to it, will write to the port latch.
The RA4 pin is multiplexed with the Timer0 module
clock input and one of the comparator outputs to
become the RA4/T0CKI/C1OUT pin. Pins RA6 and
RA7 are multiplexed with the main oscillator pins; they
are enabled as oscillator or I/O pins by the selection of
the main oscillator in Configuration Register 1H (see
Section 15.1 Configuration Bits for details). When
they are not used as port pins, RA6 and RA7 and their
associated TRIS and LAT bits are read as 0.
EXAMPLE 5-1:
INITIALIZING PORTA
BCF
BCF
CLRF
STATUS, RP0
STATUS, RP1
PORTA
BSF
MOVLW
MOVWF
MOVLW
STATUS, RP0
0x0F
ADCON1
0xCF
MOVWF
TRISA
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Bank0
Initialize PORTA by
clearing output
data latches
Select Bank 1
Configure all pins
as digital inputs
Value used to
initialize data
direction
Set RA<3:0> as inputs
RA<5:4> as outputs
TRISA<7:6>are always
read as '0'.
DS30498C-page 49
PIC16F7X7
FIGURE 5-1:
BLOCK DIAGRAM OF
RA0/AN0:RA1/AN1 PINS
FIGURE 5-2:
Data
Bus
Data
Bus
Q
CK
WR
TRISA
Q
N
CK
CK
Q
VSS
TRIS Latch
Data Latch
Data Latch
D
Q
VDD
WR
PORTA
VDD
WR
PORTA
BLOCK DIAGRAM OF
RA3/AN3/VREF+ PIN
I/O pin
WR
TRISA
Q
N
CK
Q
VSS
TRIS Latch
Analog
Input Mode
Analog
Input Mode
TTL
Input Buffer
RD TRISA
Q
D
EN
EN
To Comparator
TTL
Input Buffer
RD TRISA
RD PORTA
I/O pin
RD PORTA
To Comparator
To A/D Module Channel Input
To A/D Module VREF+ Input
DS30498C-page 50
PIC16F7X7
FIGURE 5-3:
Data
Bus
VDD
WR
PORTA
CK
Data Latch
D
Q
RA2/AN2/VREF-/
CVREF pin
WR
TRISA
CK
Q
VSS
TRIS Latch
Analog
Input Mode
TTL
Input Buffer
RD TRISA
Q
D
EN
RD PORTA
To Comparator
To A/D Module VREFTo A/D Module Channel Input
CVROE
CVREF
FIGURE 5-4:
Data
Bus
WR
PORTA
Q
Comparator 1 Output
1
CK
Q
Data Latch
D
WR
TRISA
Q
N
CK
RA4/T0CKI/
C1OUT pin
TRIS Latch
VSS
Analog
Input Mode
Schmitt Trigger
Input Buffer
RD TRISA
Q
D
EN
RD PORTA
TMR0 Clock Input
DS30498C-page 51
PIC16F7X7
FIGURE 5-5:
Data
Bus
Q
Comparator 2 Output
WR
PORTA
CK
Data Latch
D
VDD
Q
N
WR
TRISA
CK
RA5/AN4/LVDIN/
SS/C2OUT pin
TRIS Latch
Analog
Input Mode
VSS
TTL
Buffer
RD TRISA
Q
D
EN
RD PORTA
SS Input
LVDIN
To A/D Module Channel Input
DS30498C-page 52
PIC16F7X7
FIGURE 5-6:
(FOSC = 1x1)
From OSC1
CLKO (FOSC/4)
1
Oscillator
Circuit
0
VDD
Data
Bus
OSC2/CLKO
D
WR
PORTA
CK
VDD
Data Latch
D
WR
TRISA
Q
N
CK
Q
(FOSC = 1x1)
TRIS Latch
EMUL
VSS
RD TRISA
Q
EMUL
TTL
Buffer
EN
RD PORTA
RA6 pin
(FOSC = 1x0,011)
VDD
P
(FOSC = 1x1)
EMUL + FOSC = 00x, 010
VSS
DS30498C-page 53
PIC16F7X7
FIGURE 5-7:
Oscillator
Circuit
VDD
(FOSC = 011)
Data
Bus
WR
PORTA
Q
CK
OSC1/CLKI
VDD
Data Latch
Q
D
WR
TRISA
N
CK
TRIS Latch
RD TRISA
Q
NEMUL
1
EN
TTL
Buffer
RD PORTA
RA7 pin
(FOSC = 10x)
VDD
P
DS30498C-page 54
PIC16F7X7
TABLE 5-1:
PORTA FUNCTIONS
Name
Bit#
Buffer
Function
RA0/AN0
bit 0
TTL
RA1/AN1
bit 1
TTL
RA2/AN2/VREF-/CVREF
bit 2
TTL
RA3/AN3/VREF+
bit 3
TTL
RA4/T0CKI/C1OUT
bit 4
ST
RA5/AN4/LVDIN/SS/C2OUT
bit 5
TTL
OSC2/CLKO/RA6
bit 6
ST
OSC1/CLKI/RA7
bit 7
TABLE 5-2:
Address
Name
05h
PORTA
85h
TRISA
9Fh
ADCON1
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RA7
RA6
RA5
RA4
RA3
RA2
RA1
RA0
xx0x 0000
uu0u 0000
1111 1111
1111 1111
0000 0000
0000 0000
ADCS2
PCFG1
PCFG0
9Ch
CMCON
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
0000 0111
0000 0111
9Dh
CVRCON
CVREN CVROE
CVRR
CVR3
CVR2
CVR1
CVR0
000- 0000
000- 0000
Legend:
Note:
x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by PORTA.
When using the SSP module in SPI Slave mode and SS enabled, the A/D converter must be set to one of
the following modes, where PCFG2:PCFG0 = 100, 101, 11x.
DS30498C-page 55
PIC16F7X7
5.2
PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISB. Setting a
TRISB bit (= 1) will make the corresponding PORTB
pin an input (i.e., put the corresponding output driver in
a high-impedance mode). Clearing a TRISB bit (= 0)
will make the corresponding PORTB pin an output (i.e.,
put the contents of the output latch on the selected pin).
Each of the PORTB pins has a weak internal pull-up. A
single control bit can turn on all the pull-ups. This is
performed by clearing bit RBPU (OPTION_REG<7>).
The weak pull-up is automatically turned off when the
port pin is configured as an output. The pull-ups are
disabled on a Power-on Reset.
PORTB pins are multiplexed with analog inputs. The
operation of each pin is selected by clearing/setting the
appropriate control bits in the ADCON1 register.
Note:
Four of the PORTB pins (RB7:RB4) have an interrupton-change feature. Only pins configured as inputs can
cause this interrupt to occur (i.e., any RB7:RB4 pin
configured as an output is excluded from the interrupton-change comparison). The input pins (of RB7:RB4)
are compared with the old value latched on the last
read of PORTB. The mismatch outputs of RB7:RB4
are ORed together to generate the RB port change
interrupt with flag bit, RBIF (INTCON<0>).
DS30498C-page 56
PIC16F7X7
FIGURE 5-8:
Analog
Input Mode
RBPU (1)
Data Bus
WR PORTB
Weak
P Pull-up
Data Latch
D
Q
I/O pin
CK
TRIS Latch
D
Q
WR TRISB
Analog
Input Mode
CK
TTL
Input Buffer
RD TRISB
Q
RD PORTB
EN
Analog
Input Mode
RD PORTB
To INT
To A/D Channel Input
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
FIGURE 5-9:
RBPU (1)
Data Bus
WR PORTB
Weak
P Pull-up
Data Latch
D
Q
I/O pin
CK
TRIS Latch
D
Q
WR TRISB
CK
RD TRISB
Analog
Input Mode
TTL
Input Buffer
Q
RD PORTB
D
EN
RD PORTB
To A/D Channel Input
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
DS30498C-page 57
PIC16F7X7
FIGURE 5-10:
RBPU(1)
Data Bus
WR PORTB
Weak
P Pull-up
Data Latch
D
Q
I/O pin
CK
TRIS Latch
D
Q
WR TRISB
CK
Analog
Input Mode
TTL
Input Buffer
RD TRISB
Q
RD PORTB
D
EN
RD PORTB
To A/D Channel Input
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
DS30498C-page 58
PIC16F7X7
FIGURE 5-11:
RBPU(2)
Data Bus
WR PORTB
Weak
P Pull-up
VDD
Data Latch
D
Q
CK
N
I/O pin
VSS
TRIS Latch
D
Q
WR TRISB
CK
Analog
Input Mode
TTL
Input Buffer
RD TRISB
Q
RD PORTB
D
EN
RD PORTB
Analog
Input Mode
Note 1: Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
2: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
3: The SDA Schmitt Trigger conforms to the I2C specification.
DS30498C-page 59
PIC16F7X7
FIGURE 5-12:
VDD
Weak
P Pull-up
VDD
P
Data Latch
Data Bus
WR PORTB
TRIS Latch
D
Q
WR TRISB
I/O pin
CK
VSS
CK
RD TRISB
Analog
Input Mode
TTL
Input Buffer
Latch
Q
D
RD PORTB
Set RBIF
From other
RB7:RB4 pins
EN
Q1
Analog
Input Mode
Q
D
EN
RD PORTB
Q3
DS30498C-page 60
PIC16F7X7
FIGURE 5-13:
1
0
VDD
RBPU(1)
Weak
P Pull-up
Data Latch
D
Q
Data Bus
I/O pin
WR PORTB
CK
TRIS Latch
D
Q
WR TRISB
CK
Analog
Input Mode
TTL
Input Buffer
RD TRISB
Latch
Q
D
RD PORTB
Set RBIF
From other
RB7:RB4 pins
To CCP Module Input
EN
Q1
Analog
Input Mode
Schmitt Trigger
Buffer
Analog
Input Mode
D
EN
RD PORTB
Q3
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
DS30498C-page 61
PIC16F7X7
FIGURE 5-14:
Program Mode/ICD
VDD
RBPU(1)
Weak
P Pull-up
Data Latch
D
Q
Data Bus
I/O pin
WR PORTB
CK
TRIS Latch
D
Q
WR TRISB
CK
TTL
Input Buffer
RD TRISB
Latch
Q
D
Set RBIF
RD PORTB
EN
Program Mode/ICD
From other
RB7:RB4 pins
D
RD PORTB
EN
PGC
Q1
Schmitt Trigger
Buffer
Q3
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
DS30498C-page 62
PIC16F7X7
FIGURE 5-15:
Port/Program Mode/ICD
PGD
1
0
VDD
RBPU(1)
Weak
P Pull-up
Data Latch
D
Q
Data Bus
I/O pin
WR PORTB
CK
TRIS Latch
D
Q
WR TRISB
CK
TTL
Input Buffer
RD TRISB
PGD DRVEN
Latch
Q
D
RD PORTB
Set RBIF
From other
RB7:RB4 pins
EN
Program Mode/ICD
D
EN
Q1
RD PORTB
Q3
PGD
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit.
DS30498C-page 63
PIC16F7X7
TABLE 5-3:
PORTB FUNCTIONS
Name
Bit#
Buffer
Function
RB0/INT/AN12
bit 0
RB1/AN10
bit 1
TTL
RB2/AN8
bit 2
TTL
RB3/CCP2/AN9
bit 3
TTL
RB4/AN11
bit 4
TTL
RB5/AN13/CCP3
bit 5
TTL
RB6/PGC
bit 6
RB7/PGD
bit 7
TABLE 5-4:
Address
Value on
all other
Resets
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
PSA
PS2
PS1
PS0
06h, 106h
PORTB
86h, 186h
TRISB
81h, 181h
OPTION_REG RBPU
INTEDG
T0CS
T0SE
9Fh
ADCON1
ADCS2
VCFG1
VCFG0
Legend:
DS30498C-page 64
Value on:
POR, BOR
Bit 7
PIC16F7X7
5.3
PORTC is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISC. Setting a
TRISC bit (= 1) will make the corresponding PORTC
pin an input (i.e., put the corresponding output driver in
a high-impedance mode). Clearing a TRISC bit (= 0)
will make the corresponding PORTC pin an output (i.e.,
put the contents of the output latch on the selected pin).
PORTC is multiplexed with several peripheral functions
(Table 5-5). PORTC pins have Schmitt Trigger input
buffers.
When enabling peripheral functions, care should be
taken in defining TRIS bits for each PORTC pin. Some
peripherals override the TRIS bit to make a pin an
output, while other peripherals override the TRIS bit to
make a pin an input. Since the TRIS bit override is in
effect while the peripheral is enabled, read-modifywrite instructions (BSF, BCF, XORWF) with TRISC as
destination should be avoided. The user should refer to
the corresponding peripheral section for the correct
TRIS bit settings and to Section 16.1 Read-ModifyWrite Operations for additional information on
read-modify-write operations.
FIGURE 5-17:
Port/Peripheral Select(2)
Peripheral Data Out
Data Bus
WR
Port
D
CK
VDD
Q
Q
P
1
I/O
pin(1)
Data Latch
WR
TRIS
D
CK
Q
Q
TRIS Latch
Vss
RD
TRIS
Peripheral
OE(3)
RD
Port
Schmitt
Trigger
Q
D
EN
0
Schmitt
Trigger
with
SMBus
Levels
SSPl Input
1
FIGURE 5-16:
Port/Peripheral Select(2)
Peripheral Data Out
Data Bus
WR
Port
D
CK
VDD
0
Q
Q
CKE
SSPSTAT<6>
P
1
I/O
pin(1)
Data Latch
D
WR
TRIS
CK
Q
Q
TRIS Latch
VSS
RD
TRIS
Schmitt
Trigger
Peripheral
OE(3)
D
EN
RD
Port
Peripheral Input
DS30498C-page 65
PIC16F7X7
TABLE 5-5:
PORTC FUNCTIONS
Name
Bit#
Buffer Type
Function
RC0/T1OSO/T1CKI
bit 0
ST
RC1/T1OSI/CCP2
bit 1
ST
RC2/CCP1
bit 2
ST
RC3/SCK/SCL
bit 3
ST
RC3 can also be the synchronous serial clock for both SPI and
I2C modes.
RC4/SDI/SDA
bit 4
ST
RC4 can also be the SPI data in (SPI mode) or data I/O (I2C mode).
RC5/SDO
bit 5
ST
RC6/TX/CK
bit 6
ST
RC7/RX/DT
bit 7
ST
TABLE 5-6:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
07h
PORTC
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
87h
TRISC
Address
DS30498C-page 66
PIC16F7X7
5.4
FIGURE 5-18:
Data Bus
Q
I/O pin(1)
WR Port
CK
Data Latch
PORTD can be configured as an 8-bit wide microprocessor port (Parallel Slave Port) by setting control
bit, PSPMODE (TRISE<4>). In this mode, the input
buffers are TTL.
D
WR TRIS
Q
Schmitt
Trigger
Input
Buffer
CK
TRIS Latch
RD TRIS
Q
D
ENEN
RD Port
TABLE 5-7:
Name
PORTD FUNCTIONS
Bit#
Buffer Type
bit 0
ST/TTL(1)
RD1/PSP1
bit 1
ST/TTL
(1)
RD2/PSP2
bit 2
ST/TTL(1)
RD3/PSP3
bit 3
ST/TTL(1)
RD4/PSP4
bit 4
ST/TTL(1)
RD5/PSP5
bit 5
ST/TTL
(1)
RD6/PSP6
bit 6
ST/TTL(1)
bit 7
(1)
RD0/PSP0
RD7/PSP7
ST/TTL
Function
TABLE 5-8:
Address
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RD7
RD6
RD5
RD4
RD3
RD2
RD1
RD0
xxxx xxxx
uuuu uuuu
1111 1111
1111 1111
0000 1111
0000 1111
08h
PORTD
88h
TRISD
89h
TRISE
Legend:
Note 1:
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by PORTD.
RE3 is an input only. The state of the TRISE3 bit has no effect and will always read 1.
OBF
IBOV
PSPMODE
(1)
DS30498C-page 67
PIC16F7X7
5.5
FIGURE 5-19:
Data Bus
WR Port
CK
Q
I/O pin(1)
Data Latch
D
I/O PORTE becomes control inputs for the microprocessor port when bit, PSPMODE (TRISE<4>), is
set. In this mode, the user must make sure that the
TRISE<2:0> bits are set (pins are configured as digital
inputs). Ensure ADCON1 is configured for digital I/O. In
this mode, the input buffers are TTL.
WR TRIS
TRIS Latch
RD TRIS
D
ENEN
RD Port
Schmitt
Trigger
Input
Buffer
CK
TABLE 5-9:
Name
PORTE FUNCTIONS
Bit#
Buffer Type
Function
(1)
Input/output port pin or read control input in Parallel Slave Port mode or analog input.
For RD (PSP mode):
1 = Idle
0 = Read operation. Contents of PORTD register output to PORTD I/O pins (if chip selected).
RE0/RD/AN5
bit 0
ST/TTL
RE1/WR/AN6
bit 1
ST/TTL(1)
Input/output port pin or write control input in Parallel Slave Port mode or analog input.
For WR (PSP mode):
1 = Idle
0 = Write operation. Value of PORTD I/O pins latched into PORTD register (if chip selected).
RE2/CS/AN7
bit 2
ST/TTL(1)
Input/output port pin or chip select control input in Parallel Slave Port mode or analog input.
For CS (PSP mode):
1 = Device is not selected
0 = Device is selected
MCLR/VPP/RE3
bit 3
ST
Legend:
Note 1:
TABLE 5-10:
Addr
09h
Name
PORTE
89h
TRISE
9Fh
ADCON1
Legend:
Note 1:
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RE3
RE2
RE1
RE0
---- x000
---- x000
PSPMODE
(1)
0000 1111
0000 1111
0000 0000
0000 0000
IBF
ADFM
OBF
IBOV
ADCS2 VCFG1
VCFG0
PCFG3 PCFG2
PCFG1
PCFG0
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by PORTE.
RE3 is an input only. The state of the TRISE3 bit has no effect and will always read 1.
DS30498C-page 68
PIC16F7X7
REGISTER 5-1:
R-0
R/W-0
R/W-0
U-0
R/W-1
R/W-1
R/W-1
IBF
OBF
IBOV
PSPMODE
(1)
TRISE2
TRISE1
TRISE0
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 69
PIC16F7X7
5.6
FIGURE 5-20:
Data Bus
D
WR
Port
Q
RDx pin
CK
TTL
Q
RD
Port
D
ENEN
Read
TTL
RD
Chip Select
TTL
CS
Write
TTL
WR
DS30498C-page 70
PIC16F7X7
FIGURE 5-21:
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q4
Q1
Q2
Q3
Q4
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
FIGURE 5-22:
Q2
Q3
Q4
Q1
Q2
Q3
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
TABLE 5-11:
Address
08h
Name
PORTD
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 1
Bit 0
09h
PORTE
RE3
89h
TRISE
IBF
OBF
IBOV
PSPMODE
(2)
0Ch
PIR1
PSPIF(1)
ADIF
RCIF
TXIF
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
9Fh
ADCON1
Legend:
Note 1:
2:
Bit 2
ADFM
ADCS2 VCFG1
VCFG0
RE2
Value on
all other
Resets
xxxx xxxx
uuuu uuuu
RE0
---- x000
---- x000
0000 1111
0000 1111
SSPIF
0000 0000
0000 0000
SSPIE
0000 0000
0000 0000
0000 0000
0000 0000
PCFG3 PCFG2
RE1
Value on:
POR, BOR
PCFG1
PCFG0
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by the Parallel Slave Port.
Bits PSPIE and PSPIF are reserved on the PIC16F737/767; always maintain these bits clear.
RE3 is an input only. The state of the TRISE3 bit has no effect and will always read 1.
DS30498C-page 71
PIC16F7X7
NOTES:
DS30498C-page 72
PIC16F7X7
6.0
TIMER0 MODULE
8-bit timer/counter
Readable and writable
8-bit software programmable prescaler
Internal or external clock select
Interrupt on overflow from FFh to 00h
Edge select for external clock
6.2
6.1
The TMR0 interrupt is generated when the TMR0 register overflows from FFh to 00h. This overflow sets bit
TMR0IF (INTCON<2>). The interrupt can be masked
by clearing bit TMR0IE (INTCON<5>). Bit TMR0IF
must be cleared in software by the Timer0 module
Interrupt Service Routine before re-enabling this
interrupt. The TMR0 interrupt cannot awaken the
processor from Sleep since the timer is shut-off during
Sleep.
Timer0 Operation
FIGURE 6-1:
Timer0 Interrupt
CLKO (= FOSC/4)
Data Bus
0
1
RA4/T0CKI/C1OUT
pin
M
U
X
1
M
U
X
Sync
2
Cycles
TMR0 Reg
T0SE
T0CS
PSA
Prescaler
0
WDT Timer
31.25 kHz
16-bit
Prescaler
M
U
X
8-bit Prescaler
8
8-to-1 MUX
PS2:PS0
PSA
1
0
MUX
PSA
WDT Time-out
Note: T0CS, T0SE, PSA and PS2:PS0 are (OPTION_REG<5:0>).
DS30498C-page 73
PIC16F7X7
6.3
6.4
Prescaler
DS30498C-page 74
Note:
PIC16F7X7
REGISTER 6-1:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
RBPU
INTEDG
T0CS
T0SE
PSA(1)
PS2
PS1
PS0
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 75
PIC16F7X7
EXAMPLE 6-1:
CLRWDT
BANKSEL
MOVLW
MOVWF
TABLE 6-1:
Name
01h,101h
TMR0
0Bh,8Bh,
10Bh,18Bh
INTCON
Legend:
Address
81h,181h
;
;
;
;
OPTION_REG
b'xxxx0xxx'
OPTION_REG
OPTION_REG
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PEIE
RBPU
INTEDG
Value on
all other
Resets
Value on
POR, BOR
xxxx xxxx
uuuu uuuu
0000 000u
T0CS
T0SE
PSA
PS2
PS1
PS0
1111 1111
1111 1111
x = unknown, u = unchanged, - = unimplemented locations read as 0. Shaded cells are not used by Timer0.
DS30498C-page 76
PIC16F7X7
7.0
TIMER1 MODULE
7.1
Timer1 Operation
DS30498C-page 77
PIC16F7X7
REGISTER 7-1:
R-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
T1RUN
T1CKPS1
T1CKPS0
T1OSCEN
T1SYNC
TMR1CS
TMR1ON
bit 7
bit 0
bit 7
Unimplemented: Read as 0
bit 6
bit 5-4
bit 3
bit 2
bit 1
bit 0
DS30498C-page 78
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
7.2
7.4
7.3
FIGURE 7-1:
T1CKI
(Default High)
T1CKI
(Default Low)
FIGURE 7-2:
TMR1
TMR1H
Synchronized
Clock Input
TMR1L
1
TMR1ON
On/Off
T1SYNC
T1OSC
1
T1OSO/T1CKI
T1OSI
Note 1:
T1OSCEN FOSC/4
Enable
Internal
Oscillator(1) Clock
Prescaler
1, 2, 4, 8
Synchronize
det
0
2
T1CKPS1:T1CKPS0
TMR1CS
Q Clock
When the T1OSCEN bit is cleared, the inverter is turned off. This eliminates power drain.
DS30498C-page 79
PIC16F7X7
7.5
Timer1 Operation in
Asynchronous Counter Mode
7.5.1
EXAMPLE 7-1:
EXAMPLE 7-2:
DS30498C-page 80
PIC16F7X7
7.6
Timer1 Oscillator
7.7
FIGURE 7-3:
EXTERNAL
COMPONENTS FOR THE
TIMER1 LP OSCILLATOR
C1
33 pF
FIGURE 7-4:
PIC16F7X7
OSCILLATOR CIRCUIT
WITH GROUNDED
GUARD RING
T1OSI
VSS
XTAL
32.768 kHz
OSC1
OSC2
T1OSO
C2
33 pF
Note:
RC0
RC1
TABLE 7-1:
Osc Type
Freq
C1
C2
LP
32 kHz
33 pF
33 pF
RC2
7.8
Timer1 must be configured for either Timer or Synchronized Counter mode to take advantage of this feature.
If Timer1 is running in Asynchronous Counter mode,
this Reset operation may not work.
In the event that a write to Timer1 coincides with a
special event trigger from CCP1, the write will take
precedence.
In this mode of operation, the CCPR1H:CCPR1L
register pair effectively becomes the period register for
Timer1.
DS30498C-page 81
PIC16F7X7
7.9
7.10
Timer1 Prescaler
7.11
EXAMPLE 7-3:
RTCinit
RTCisr
BANKSEL
MOVLW
MOVWF
CLRF
MOVLW
MOVWF
CLRF
CLRF
MOVLW
MOVWF
BANKSEL
BSF
RETURN
BANKSEL
BSF
BCF
INCF
MOVF
SUBLW
BTFSS
RETURN
CLRF
INCF
MOVF
SUBLW
BTFSS
RETURN
CLRF
INCF
MOVF
SUBLW
BTFSS
RETURN
CLRF
RETURN
DS30498C-page 82
TMR1H
0x80
TMR1H
TMR1L
b00001111
T1CON
secs
mins
.12
hours
PIE1
PIE1, TMR1IE
TMR1H
TMR1H, 7
PIR1, TMR1IF
secs, F
secs, w
.60
STATUS, Z
seconds
mins, f
mins, w
.60
STATUS, Z
mins
hours, f
hours, w
.24
STATUS, Z
hours
;
;
;
;
60 seconds elapsed?
No, done
Clear seconds
Increment minutes
;
;
;
;
60 seconds elapsed?
No, done
Clear minutes
Increment hours
;
;
;
;
24 hours elapsed?
No, done
Clear hours
Done
PIC16F7X7
TABLE 7-2:
Address
Value on
all other
Resets
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
0Ch
PIR1
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
0Eh
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
0Fh
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
10h
T1CON
Legend:
Note 1:
T1RUN T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON -000 0000 -uuu uuuu
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by the Timer1 module.
Bits PSPIE and PSPIF are reserved on the PIC16F737/767 devices; always maintain these bits clear.
DS30498C-page 83
PIC16F7X7
NOTES:
DS30498C-page 84
PIC16F7X7
8.0
TIMER2 MODULE
8.1
8.2
Output of TMR2
FIGURE 8-1:
Sets Flag
bit TMR2IF
TMR2
Output(1)
Reset
Postscaler
1:1 to 1:16
4
EQ
TMR2 Reg
Comparator
PR2 Reg
Prescaler
1:1, 1:4, 1:16
FOSC/4
2
T2CKPS1:
T2CKPS0
TOUTPS3:
TOUTPS0
Note 1: TMR2 register output can be software selected by the
SSP module as a baud clock.
DS30498C-page 85
PIC16F7X7
REGISTER 8-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
bit 7
bit 0
bit 7
Unimplemented: Read as 0
bit 6-3
bit 2
bit 1-0
TABLE 8-1:
Address
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
PIR1
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
Name
0Bh,8Bh,
INTCON
10Bh, 18Bh
0Ch
R = Readable bit
8Ch
PIE1
PSPIE(1)
11h
TMR2
12h
T2CON
92h
PR2
Legend:
Note 1:
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by the Timer2 module.
Bits PSPIE and PSPIF are reserved on the PIC16F737/767 devices; always maintain these bits clear.
DS30498C-page 86
TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
PIC16F7X7
9.0
CAPTURE/COMPARE/PWM
MODULES
9.1
CCP1 Module
TABLE 9-2:
CCP2 Module
Capture/Compare/PWM Register 2 (CCPR2) is comprised of two 8-bit registers: CCPR2L (low byte) and
CCPR2H (high byte). The CCP2CON register controls
the operation of CCP2. The special event trigger is generated by a compare match; it will clear both TMR1H and
TMR1L registers and start an A/D conversion (if the A/D
module is enabled).
Additional information on CCP modules is available in
the PICmicro Mid-Range MCU Family Reference
Manual (DS33023) and in Application Note AN594
Using the CCP Module(s) (DS00594).
9.3
CCP3 Module
Capture/Compare/PWM Register 3 (CCPR3) is comprised of two 8-bit registers: CCPR3L (low byte) and
CCPR3H (high byte). The CCP3CON register controls
the operation of CCP3.
TABLE 9-1:
CCP Mode
Timer Resource
Capture
Compare
PWM
Timer1
Timer1
Timer2
9.2
Interaction
Capture
Capture
Compare
Compare
Compare
PWM
PWM
The PWMs will have the same frequency and update rate (TMR2 interrupt).
The rising edges are aligned.
PWM
Capture
None.
PWM
Compare
None.
DS30498C-page 87
PIC16F7X7
REGISTER 9-1:
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
CCPxX
CCPxY
CCPxM3
CCPxM2
CCPxM1
CCPxM0
bit 7
bit 0
bit 7-6
Unimplemented: Read as 0
bit 5-4
bit 3-0
DS30498C-page 88
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
9.4
Capture Mode
9.4.4
9.4.1
EXAMPLE 9-1:
CHANGING BETWEEN
CAPTURE PRESCALERS
CLRF
MOVLW
CCP1CON
NEW_CAPT_PS
MOVWF
CCP1CON
FIGURE 9-1:
CAPTURE MODE
OPERATION BLOCK
DIAGRAM
Prescaler
1, 4, 16
RC2/CCP1
pin
CCPR1H
and
Edge Detect
CCPR1L
Capture
Enable
TMR1H
TMR1L
9.5
Compare Mode
FIGURE 9-2:
COMPARE MODE
OPERATION BLOCK
DIAGRAM
CCP1CON<3:0>
Qs
9.4.2
CCP1CON<3:0>
Mode Select
Timer1 must be running in Timer mode or Synchronized Counter mode for the CCP module to use the
capture feature. In Asynchronous Counter mode, the
capture operation may not work.
9.4.3
CCP PRESCALER
SOFTWARE INTERRUPT
RC2/CCP1
pin
Output
Logic
Match
TRISC<2>
Output Enable
Comparator
TMR1H
TMR1L
DS30498C-page 89
PIC16F7X7
9.5.1
9.5.4
9.5.2
Timer1 must be running in Timer mode or Synchronized Counter mode if the CCP module is using the
compare feature. In Asynchronous Counter mode, the
compare operation may not work.
9.5.3
Note:
TABLE 9-3:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
0Bh,8Bh, INTCON
10Bh,18Bh
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
CCP3IF
CCP1IE TMR2IE
Address
0Ch
PIR1
0Dh
PIR2
OSFIF
CMIF
LVDIF
BCLIF
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
OSFIE
CMIE
LVDIE
BCLIE
8Dh
PIE2
87h
TRISC
CCP3IE
0Eh
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
0Fh
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
10h
T1CON
15h
CCPR1L
16h
CCPR1H
17h
CCP1CON
1Bh
CCPR2L
1Ch
CCPR2H
1Dh
CCP2CON
95h
CCPR3L
96h
CCPR3H
97h
CCP3CON
Legend:
Note 1:
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by Capture and Timer1.
The PSP is not implemented on the PIC16F737/767 devices; always maintain these bits clear.
DS30498C-page 90
T1RUN T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON -000 0000 -uuu uuuu
CCP1X
CCP2X
CCP3X
CCP1Y
CCP2Y
CCP3Y
PIC16F7X7
9.6
9.6.1
PWM PERIOD
EQUATION 9-1:
PWM Period = [(PR2) + 1] 4 TOSC
(TMR2 Prescale Value)
PWM frequency is defined as 1/[PWM period].
TMR2 is cleared
The CCP1 pin is set (exception: if PWM duty
cycle = 0%, the CCP1 pin will not be set)
The PWM duty cycle is latched from CCPR1L into
CCPR1H
FIGURE 9-3:
CCP1CON<5:4>
Note:
CCPR1L
CCPR1H (Slave)
R
Comparator
9.6.2
Q
RC2/CCP1
(1)
TMR2
(Note 1)
TRISC<2>
Comparator
Clear Timer,
CCP1 pin and
latch D.C.
PR2
FIGURE 9-4:
PWM OUTPUT
TMR2
Reset
EQUATION 9-2:
PWM Duty Cycle = (CCPR1L:CCP1CON<5:4>)
TOSC (TMR2 Prescale Value)
CCPR1L and CCP1CON<5:4> can be written to at any
time, but the duty cycle value is not latched into
CCPR1H until after a match between PR2 and TMR2
occurs (i.e., the period is complete). In PWM mode,
CCPR1H is a read-only register.
TMR2
Reset
Period
Duty Cycle
TMR2 = PR2
TMR2 = Duty Cycle
TMR2 = PR2
DS30498C-page 91
PIC16F7X7
The CCPR1H register and a 2-bit internal latch are
used to double-buffer the PWM duty cycle. This
double-buffering is essential for glitchless PWM
operation.
When the CCPR1H and 2-bit latch match TMR2,
concatenated with an internal 2-bit Q clock or 2 bits of
the TMR2 prescaler, the CCP1 pin is cleared.
The maximum PWM resolution (bits) for a given PWM
frequency is given by the formula:
9.6.3
3.
4.
EQUATION 9-3:
FOSC
log FPWM
Resolution =
Note:
5.
bits
log(2)
TABLE 9-4:
PWM Frequency
1.22 kHz
4.88 kHz
19.53 kHz
78.12 kHz
156.3 kHz
208.3 kHz
16
0xFF
0xFF
0xFF
0x3F
0x1F
0x17
10
10
10
6.6
TABLE 9-5:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
0Bh,8Bh, INTCON
10Bh,18Bh
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
Address
0Ch
PIR1
0Dh
PIR2
OSFIF
CMIF
LVDIF
BCLIF
CCP3IF
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
8Dh
PIE2
OSFIE
CMIE
LVDIE
BCLIE
CCP3IE
87h
TRISC
11h
TMR2
92h
PR2
12h
T2CON
15h
CCPR1L
16h
CCPR1H
17h
CCP1CON
1Bh
CCPR2L
1Ch
CCPR2H
1Dh
CCP2CON
95h
CCPR3L
96h
CCPR3H
97h
CCP3CON
Legend:
Note 1:
TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
CCP1X
CCP2X
CCP3X
CCP1Y
CCP2Y
CCP3Y
CCP2M3
CCP3M3
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by PWM and Timer2.
Bits PSPIE and PSPIF are reserved on the PIC16F737/767 devices; always maintain these bits clear.
DS30498C-page 92
PIC16F7X7
10.0
10.1
MASTER SYNCHRONOUS
SERIAL PORT (MSSP)
MODULE
FIGURE 10-1:
Internal
Data Bus
Read
RC4/SDI/
SDA
SSPSR Reg
RC5/SDO
Shift
Clock
bit 0
Peripheral OE
RA5/AN4/
LVDIN/SS/
C2OUT
SS Control
Enable
Edge
Select
2
Clock Select
Control Registers
10.3
Write
SSPBUF Reg
Master mode
Multi-Master mode
Slave mode
10.2
RC3/
SCK/
SCL
SSPM3:SSPM0
SMP:CKE 4
TMR2 Output
2
2
Edge
Select
Prescaler TOSC
4, 16, 64
SPI Mode
DS30498C-page 93
PIC16F7X7
10.3.1
REGISTERS
REGISTER 10-1:
During transmission, the SSPBUF is not doublebuffered. A write to SSPBUF will write to both SSPBUF
and SSPSR.
R/W-0
R-0
R-0
R-0
R-0
R-0
R-0
SMP
CKE
D/A
R/W
UA
BF
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
P: Stop bit
Used in I2C mode only. This bit is cleared when the MSSP module is disabled, SSPEN is cleared.
bit 3
S: Start bit
Used in I2C mode only.
bit 2
bit 1
bit 0
DS30498C-page 94
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
REGISTER 10-2:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
bit 7
bit 0
bit 7
bit 6
bit 5
In Master mode, the overflow bit is not set since each new reception (and
transmission) is initiated by writing to the SSPBUF register.
bit 4
bit 3-0
Bit combinations not specifically listed here are either reserved or implemented in
I2C mode only.
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 95
PIC16F7X7
10.3.2
OPERATION
EXAMPLE 10-1:
LOOP
BTFSS
BRA
MOVF
SSPSTAT, BF
LOOP
SSPBUF, W
MOVWF
RXDATA
MOVF
MOVWF
TXDATA, W
SSPBUF
DS30498C-page 96
PIC16F7X7
10.3.3
10.3.4
TYPICAL CONNECTION
FIGURE 10-2:
SDI
SDI
Shift Register
(SSPSR)
MSb
LSb
Shift Register
(SSPSR)
MSb
SCK
PROCESSOR 1
SDO
Serial Clock
LSb
SCK
PROCESSOR 2
DS30498C-page 97
PIC16F7X7
10.3.5
MASTER MODE
FIGURE 10-3:
Write to
SSPBUF
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
4 Clock
Modes
SCK
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
SDO
(CKE = 0)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDO
(CKE = 1)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDI
(SMP = 0)
bit 0
bit 7
Input
Sample
(SMP = 0)
SDI
(SMP = 1)
bit 7
bit 0
Input
Sample
(SMP = 1)
SSPIF
SSPSR to
SSPBUF
DS30498C-page 98
Next Q4 Cycle
after Q2
PIC16F7X7
10.3.6
SLAVE MODE
10.3.7
SLAVE SELECT
SYNCHRONIZATION
FIGURE 10-4:
SS
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSPBUF
SDO
SDI
(SMP = 0)
bit 7
bit 6
bit 7
bit 0
bit 0
bit 7
bit 7
Input
Sample
(SMP = 0)
SSPIF
Interrupt
Flag
SSPSR to
SSPBUF
Next Q4 Cycle
after Q2
DS30498C-page 99
PIC16F7X7
FIGURE 10-5:
SS
Optional
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSPBUF
SDO
bit 7
SDI
(SMP = 0)
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
bit 0
bit 7
Input
Sample
(SMP = 0)
SSPIF
Interrupt
Flag
Next Q4 Cycle
after Q2
SSPSR to
SSPBUF
FIGURE 10-6:
SS
Not Optional
SCK
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
Write to
SSPBUF
SDO
SDI
(SMP = 0)
bit 6
bit 7
bit 7
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
bit 0
Input
Sample
(SMP = 0)
SSPIF
Interrupt
Flag
SSPSR to
SSPBUF
DS30498C-page 100
Next Q4 Cycle
after Q2
PIC16F7X7
10.3.8
SLEEP OPERATION
10.3.10
TABLE 10-1:
10.3.9
CKE
0, 0
0, 1
1, 0
1, 1
Name
Standard SPI
Mode Terminology
EFFECTS OF A RESET
TABLE 10-2:
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Value on
all other
Resets
INTCON
GIE/GIEH PEIE/GIEL
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
PIR1
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
TMR1IF
(1)
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
TMR1IE
PIE1
PSPIE
TRISC
SSPBUF
SSPCON
TRISA
SSPSTAT
Legend:
Note 1:
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
R/W
UA
BF
CKE
D/A
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by the MSSP in SPI mode.
The PSPIF and PSPIE bits are reserved on 28-pin devices; always maintain these bits clear.
DS30498C-page 101
PIC16F7X7
10.4
I2C Mode
10.4.1
FIGURE 10-7:
Read
Write
RC3/SCK/
SCL
SSPBUF Reg
Shift
Clock
MSb
LSb
Match Detect
Addr Match
SSPADD Reg
Start and
Stop bit Detect
DS30498C-page 102
SSPSR Reg
RC4/
SDI/
SDA
REGISTERS
During transmission, the SSPBUF is not doublebuffered. A write to SSPBUF will write to both SSPBUF
and SSPSR.
Set, Reset
S, P bits
(SSPSTAT Reg)
PIC16F7X7
REGISTER 10-3:
R/W-0
R-0
R-0
R-0
R-0
R-0
R-0
SMP
CKE
D/A
R/W
UA
BF
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
P: Stop bit
1 = Indicates that a Stop bit has been detected last
0 = Stop bit was not detected last
Note:
bit 3
S: Start bit
1 = Indicates that a Start bit has been detected last
0 = Start bit was not detected last
Note:
bit 2
bit 1
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 103
PIC16F7X7
REGISTER 10-4:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
bit 7
bit 0
bit 7
bit 6
bit 5
When enabled, the SDA and SCL pins must be properly configured as input or output.
bit 4
bit 3-0
Bit combinations not specifically listed here are either reserved or implemented in
SPI mode only.
Legend:
DS30498C-page 104
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
REGISTER 10-5:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
bit 7
bit 0
bit 7
bit 6
bit 5
Value that will be transmitted when the user initiates an Acknowledge sequence at
the end of a receive.
bit 4
bit 3
bit 2
bit 1
bit 0
For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode,
this bit may not be set (no spooling) and the SSPBUF may not be written (or writes
to the SSPBUF are disabled).
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 105
PIC16F7X7
10.4.2
OPERATION
10.4.3
MOVF
IORLW
ANDLW
TRISC, W
0x18
B11111001
MOVWF
TRISC
;
;
;
;
SLAVE MODE
In Slave mode, the SCL and SDA pins must be configured as inputs (TRISC<4:3> set). The MSSP module
will override the input state with the output data when
required (slave-transmitter).
To ensure proper communication of the I2C Slave
mode, the TRIS bits (TRISx [SDA, SCL]) corresponding to the I2C pins must be set to 1. If any TRIS bits
(TRISx<7:0>) of the port containing the I2C pins
(PORTx [SDA, SCL]) are changed in software, during
I2C communication using a Read-Modify-Write
instruction (BSF, BCF), then the I2C mode may stop
functioning properly and I2C communication may
suspend. Do not change any of the TRISx bits (TRIS
bits of the port containing the I2C pins) using the
instruction BSF or BCF during I2C communication. If it
is absolutely necessary to change the TRISx bits
during communication, the following method can be
used:
10.4.3.1
Addressing
DS30498C-page 106
PIC16F7X7
In 10-bit Address mode, two address bytes need to be
received by the slave. The five Most Significant bits
(MSbs) of the first address byte specify if this is a 10-bit
address. Bit R/W (SSPSTAT<2>) must specify a write
so the slave device will receive the second address
byte. For a 10-bit address, the first byte would equal
11110 A9 A8 0, where A9 and A8 are the two
MSbs of the address. The sequence of events for
10-bit address is as follows, with steps 7 through 9 for
the slave-transmitter:
1.
10.4.3.3
2.
3.
4.
5.
6.
7.
8.
9.
10.4.3.2
Reception
Transmission
DS30498C-page 107
DS30498C-page 108
CKP
A6
A4
A3
Receiving Address
A5
A2
SSPOV (SSPCON<6>)
BF (SSPSTAT<0>)
SSPIF (PIR1<3>)
SCL
A7
A1
ACK
R/W = 0
D7
D4
D3
Receiving Data
D5
Cleared in software
SSPBUF is read
D6
D2
D1
D0
ACK
D7
D6
D4
D3
Receiving Data
D5
D2
D1
D0
Bus master
terminates
transfer
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
ACK
FIGURE 10-8:
SDA
PIC16F7X7
I2C SLAVE MODE TIMING WITH SEN = 0 (RECEPTION, 7-BIT ADDRESS)
CKP
A6
Data in
sampled
BF (SSPSTAT<0>)
SSPIF (PIR1<3>)
A7
A5
A4
A3
A2
Receiving Address
A1
R/W = 1
ACK
D7
D4
D3
Cleared in software
D5
D2
D6
Transmitting Data
D0
ACK
D1
D7
D4
D3
D2
D0
ACK
D1
Transmitting Data
Cleared in software
D5
D6
FIGURE 10-9:
SCL
SDA
PIC16F7X7
DS30498C-page 109
DS30498C-page 110
A9 A8
UA (SSPSTAT<1>)
SSPOV (SSPCON<6>)
CKP
Cleared in software
BF (SSPSTAT<0>)
SSPIF (PIR1<3>)
SCL
ACK
R/W = 0
A7
A4
A3
A2
A0 ACK
Cleared by hardware
when SSPADD is updated
with low byte of address
A1
Cleared in software
A5
A6
D7
Cleared in software
9
1
Cleared in software
D3 D2
D3 D2
D1 D0
P
Bus master
terminates
transfer
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
ACK
FIGURE 10-10:
SDA
PIC16F7X7
I2C SLAVE MODE TIMING WITH SEN = 0 (RECEPTION, 10-BIT ADDRESS)
CKP (SSPCON<4>)
UA (SSPSTAT<1>)
BF (SSPSTAT<0>)
SSPIF (PIR1<3>)
SCL
A9 A8
ACK
Cleared in software
2
7
A1 A0
A6 A5 A4 A3 A2
A7
ACK
Cleared in software
ACK
R/W = 1
Cleared in software
Completion of
data transmission
clears BF flag
ACK
Bus master
terminates
transfer
D7 D6 D5 D4 D3 D2 D1 D0
Write of SSPBUF
BF flag is clear
initiates transmit
at the end of the
third address sequence
A9 A8
Sr
FIGURE 10-11:
SDA
R/W = 0
PIC16F7X7
DS30498C-page 111
PIC16F7X7
10.4.4
CLOCK STRETCHING
10.4.4.1
10.4.4.2
10.4.4.3
10.4.4.4
DS30498C-page 112
PIC16F7X7
10.4.4.5
Clock Synchronization
and the CKP Bit
FIGURE 10-12:
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
SDA
DX
DX 1
SCL
CKP
Master device
asserts clock
Master device
deasserts clock
Write
SSPCON
DS30498C-page 113
DS30498C-page 114
CKP
SSPOV (SSPCON<6>)
BF (SSPSTAT<0>)
SSPIF (PIR1<3>)
SCL
A7
A6
A4
A3
Receiving Address
A5
A2
A1
ACK
R/W = 0
D4
D3
Receiving Data
D5
Cleared in software
D6
If BF is cleared
prior to the falling
edge of the 9th clock,
CKP will not be reset
to 0 and no clock
stretching will occur
SSPBUF is read
D7
D2
D1
ACK
D7
D0
D4
D3
Receiving Data
D5
CKP
written
to 1 in
software
D6
D2
D1
D0
Bus master
terminates
transfer
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
ACK
FIGURE 10-13:
SDA
PIC16F7X7
I2C SLAVE MODE TIMING WITH SEN = 1 (RECEPTION, 7-BIT ADDRESS)
UA (SSPSTAT<1>)
SSPOV (SSPCON<6>)
CKP
A9
A8
Cleared in software
BF (SSPSTAT<0>)
SSPIF (PIR1<3>)
SCL
ACK
R/W = 0
A7
A4
A3
A2
Cleared in software
A5
A1
Note:
A0 ACK
A6
Cleared in software
D5 D4 D3 D2
D1
Note:
Cleared in software
CKP written to 1
in software
D3 D2
ACK
D0
D7 D6
ACK
Bus master
terminates
transfer
SSPOV is set
because SSPBUF is
still full. ACK is not sent.
D1 D0
FIGURE 10-14:
SDA
PIC16F7X7
DS30498C-page 115
PIC16F7X7
10.4.5
When the interrupt is serviced, the source for the interrupt can be checked by reading the contents of the
SSPBUF. The value can be used to determine if the
address was device specific or a general call address.
In 10-bit mode, the SSPADD is required to be updated
for the second half of the address to match and the UA
bit is set (SSPSTAT<1>). If the general call address is
sampled when the GCEN bit is set and while the slave
is configured in 10-bit Address mode, then the second
half of the address is not necessary, the UA bit will not
be set and the slave will begin receiving data after the
Acknowledge (Figure 10-15).
FIGURE 10-15:
SDA
Receiving Data
ACK
D6
D5
D4
D3
D2
D1
D0
SCL
S
SSPIF
BF (SSPSTAT<0>)
Cleared in software
SSPBUF is read
SSPOV (SSPCON<6>)
GCEN (SSPCON2<7>)
DS30498C-page 116
PIC16F7X7
MASTER MODE
Note:
FIGURE 10-16:
Start condition
Stop condition
Data transfer byte transmitted/received
Acknowledge Transmit
Repeated Start
Internal
Data Bus
Read
Write
SSPBUF
Baud
Rate
Generator
Shift
Clock
SDA
SDA In
SCL In
Bus Collision
LSb
Clock Cntl
SCL
Receive Enable
SSPSR
MSb
10.4.6
DS30498C-page 117
PIC16F7X7
10.4.6.1
DS30498C-page 118
PIC16F7X7
10.4.7
Once the given operation is complete (i.e., transmission of the last data bit is followed by ACK), the internal
clock will automatically stop counting and the SCL pin
will remain in its last state.
FIGURE 10-17:
SSPM3:SSPM0
Reload
SCL
Control
SSPADD<6:0>
Reload
CLKO
TABLE 10-3:
FOSC/4
FOSC
FCY
FCY*2
BRG Value
FSCL
(2 Rollovers of BRG)
40 MHz
10 MHz
20 MHz
18h
400 kHz(1)
40 MHz
10 MHz
20 MHz
1Fh
312.5 kHz
40 MHz
10 MHz
20 MHz
63h
100 kHz
16 MHz
4 MHz
8 MHz
09h
400 kHz(1)
16 MHz
4 MHz
8 MHz
0Ch
308 kHz
16 MHz
4 MHz
8 MHz
27h
100 kHz
4 MHz
1 MHz
2 MHz
02h
333 kHz(1)
4 MHz
1 MHz
2 MHz
09h
100 kHz
4 MHz
1 MHz
2 MHz
00h
1 MHz(1)
Note 1:
The I2C interface does not conform to the 400 kHz I2C specification (which applies to rates greater than
100 kHz) in all details, but may be used with care where higher rates are required by the application.
DS30498C-page 119
PIC16F7X7
10.4.7.1
Clock Arbitration
FIGURE 10-18:
SDA
DX 1
SCL deasserted but slave holds
SCL low (clock arbitration)
SCL
BRG decrements on
Q2 and Q4 cycles
BRG
Value
03h
02h
01h
03h
02h
DS30498C-page 120
PIC16F7X7
10.4.8
10.4.8.1
Note:
FIGURE 10-19:
TBRG
SDA
2nd bit
TBRG
SCL
TBRG
S
DS30498C-page 121
PIC16F7X7
10.4.9
10.4.9.1
FIGURE 10-20:
Set S (SSPSTAT<3>)
Write to SSPCON2
occurs here.
SDA = 1,
SCL (no change).
SDA = 1,
SCL = 1
TBRG
TBRG
SDA
Falling edge of ninth clock.
End of Xmit.
SCL
DS30498C-page 122
PIC16F7X7
10.4.10
10.4.10.1
BF Status Flag
10.4.10.3
10.4.11
10.4.11.1
BF Status Flag
10.4.11.2
10.4.11.3
10.4.10.2
DS30498C-page 123
DS30498C-page 124
S
R/W
PEN
SEN
BF (SSPSTAT<0>)
SSPIF
SCL
SDA
A6
A5
A4
A3
A2
A1
Cleared in software
SSPBUF written
D7
D5
D4
D3
D2
D1
D0
D6
Cleared in software
1
SCL held low
while CPU
responds to SSPIF
ACK = 0
R/W = 0
A7
ACKSTAT in
SSPCON2 = 1
FIGURE 10-21:
SEN = 0
PIC16F7X7
I 2C MASTER MODE WAVEFORM (TRANSMISSION, 7 OR 10-BIT ADDRESS)
ACKEN
SSPOV
BF
(SSPSTAT<0>)
SDA = 0, SCL = 1
while CPU
responds to SSPIF
SSPIF
Cleared in software
SCL
A6 A5 A4 A3 A2
A7
SDA
A1
R/W = 1
ACK
D0
ACK
Cleared in software
D7 D6 D5 D4 D3 D2 D1
Cleared in
software
ACK
P
Set SSPIF interrupt
at end of Acknowledge sequence
Bus master
terminates
transfer
Set P bit
(SSPSTAT<4>)
and SSPIF
PEN bit = 1
written here
D0
RCEN cleared
automatically
RCEN = 1, start
next receive
Cleared in software
Cleared in software
D7 D6 D5 D4 D3 D2 D1
RCEN cleared
automatically
FIGURE 10-22:
SEN = 0
Write to SSPBUF occurs here.
Start XMIT.
Write to SSPCON2<4>
to start Acknowledge sequence,
SDA = ACKDT (SSPCON2<5>) = 0
PIC16F7X7
DS30498C-page 125
PIC16F7X7
10.4.12
ACKNOWLEDGE SEQUENCE
TIMING
10.4.13
10.4.12.1
10.4.13.1
FIGURE 10-23:
TBRG
TBRG
SDA
ACK
D0
SCL
SSPIF
Cleared in
software
Cleared in
software
FIGURE 10-24:
Write to SSPCON2,
set PEN
Falling edge of
9th clock
SCL
SDA
ACK
TBRG
P
TBRG
TBRG
SCL brought high after TBRG
SDA asserted low before rising edge of clock to setup Stop condition
DS30498C-page 126
PIC16F7X7
10.4.14
SLEEP OPERATION
10.4.17
10.4.15
EFFECT OF A RESET
10.4.16
MULTI-MASTER MODE
Address Transfer
Data Transfer
A Start Condition
A Repeated Start Condition
An Acknowledge Condition
MULTI-MASTER COMMUNICATION,
BUS COLLISION AND BUS
ARBITRATION
Multi-Master mode support is achieved by bus arbitration. When the master outputs address/data bits onto
the SDA pin, arbitration takes place when the master
outputs a 1 on SDA by letting SDA float high and
another master asserts a 0. When the SCL pin floats
high, data should be stable. If the expected data on
SDA is a 1 and the data sampled on the SDA pin = 0,
then a bus collision has taken place. The master will set
the Bus Collision Interrupt Flag, BCLIF and reset the
I2C port to its Idle state (Figure 10-25).
If a transmit was in progress when the bus collision
occurred, the transmission is halted, the BF flag is
cleared, the SDA and SCL lines are deasserted and the
SSPBUF can be written to. When the user services the
bus collision Interrupt Service Routine and if the I2C
bus is free, the user can resume communication by
asserting a Start condition.
If a Start, Repeated Start, Stop or Acknowledge condition was in progress when the bus collision occurred,
the condition is aborted, the SDA and SCL lines are
deasserted and the respective control bits in the
SSPCON2 register are cleared. When the user
services the bus collision Interrupt Service Routine and
if the I2C bus is free, the user can resume
communication by asserting a Start condition.
The master will continue to monitor the SDA and SCL
pins. If a Stop condition occurs, the SSPIF bit will be set.
A write to the SSPBUF will start the transmission of
data at the first data bit, regardless of where the
transmitter left off when the bus collision occurred.
In Multi-Master mode, the interrupt generation on the
detection of Start and Stop conditions allows the determination of when the bus is free. Control of the I2C bus can
be taken when the P bit is set in the SSPSTAT register or
the bus is Idle and the S and P bits are cleared.
FIGURE 10-25:
SDA released
by master
SDA
SCL
BCLIF
DS30498C-page 127
PIC16F7X7
10.4.17.1
FIGURE 10-26:
SDA
SCL
Set SEN, enable Start
condition if SDA = 1, SCL = 1
SEN
BCLIF
SSPIF
DS30498C-page 128
PIC16F7X7
FIGURE 10-27:
TBRG
SDA
SCL
SEN
SCL = 0 before BRG time-out,
bus collision occurs. Set BCLIF.
BCLIF
Interrupt cleared
in software
S
SSPIF
FIGURE 10-28:
SDA
Set SSPIF
TBRG
SCL
S
SCL pulled low after BRG
time-out
SEN
BCLIF
SSPIF
SDA = 0, SCL = 1,
set SSPIF
Interrupts cleared
in software
DS30498C-page 129
PIC16F7X7
10.4.17.2
FIGURE 10-29:
If at the end of the BRG time-out, both SCL and SDA are
still high, the SDA pin is driven low and the BRG is
reloaded and begins counting. At the end of the count,
regardless of the status of the SCL pin, the SCL pin is
driven low and the Repeated Start condition is complete.
SDA
SCL
BCLIF
Cleared in software
0
SSPIF
FIGURE 10-30:
TBRG
SDA
SCL
BCLIF
RSEN
S
SSPIF
DS30498C-page 130
PIC16F7X7
10.4.17.3
b)
FIGURE 10-31:
TBRG
TBRG
SDA sampled
low after TBRG,
set BCLIF
SDA
SDA asserted low
SCL
PEN
BCLIF
P
SSPIF
FIGURE 10-32:
TBRG
TBRG
SDA
Assert SDA
SCL
PEN
BCLIF
P
SSPIF
DS30498C-page 131
PIC16F7X7
NOTES:
DS30498C-page 132
PIC16F7X7
11.0
ADDRESSABLE UNIVERSAL
SYNCHRONOUS
ASYNCHRONOUS RECEIVER
TRANSMITTER (AUSART)
REGISTER 11-1:
R/W-0
R/W-0
R/W-0
U-0
R/W-0
R-1
R/W-0
CSRC
TX9
TXEN
SYNC
BRGH
TRMT
TX9D
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
Unimplemented: Read as 0
bit 2
bit 1
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 133
PIC16F7X7
REGISTER 11-2:
R/W-0
R/W-0
R/W-0
R/W-0
R-0
R-0
R-x
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS30498C-page 134
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
11.1
11.1.1
TABLE 11-1:
SAMPLING
SYNC
0
1
TABLE 11-2:
Address
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
98h
TXSTA
CSRC
TX9
TXEN
SYNC
BRGH
TRMT
TX9D
0000 -010
0000 -010
18h
RCSTA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
0000 000x
0000 000x
99h
SPBRG
0000 0000
0000 0000
Legend:
x = unknown, = unimplemented, read as 0. Shaded cells are not used by the BRG.
DS30498C-page 135
PIC16F7X7
TABLE 11-3:
Baud
Rate
(K)
Kbaud
%
Error
FOSC = 16 MHz
SPBRG
Value
(decimal)
Kbaud
%
Error
FOSC = 10 MHz
SPBRG
Value
(decimal)
Kbaud
%
Error
SPBRG
Value
(decimal)
0.3
1.2
1.221
1.75
255
1.202
0.17
207
1.202
0.17
129
2.4
2.404
0.17
129
2.404
0.17
103
2.404
0.17
64
9.6
9.766
1.73
31
9.615
0.16
25
9.766
1.73
15
19.2
19.531
1.72
15
19.231
0.16
12
19.531
1.72
28.8
31.250
8.51
27.778
3.55
31.250
8.51
33.6
34.722
3.34
35.714
6.29
31.250
6.99
57.6
62.500
8.51
62.500
8.51
52.083
9.58
HIGH
1.221
255
0.977
255
0.610
255
LOW
312.500
250.000
156.250
FOSC = 4 MHz
Baud
Rate
(K)
Kbaud
0.3
1.2
%
Error
SPBRG
Value
(decimal)
%
Error
SPBRG
Value
(decimal)
0.300
207
1.202
0.17
51
0.3
191
1.2
2.4
2.404
0.17
25
47
2.4
9.6
8.929
6.99
23
9.6
19.2
20.833
8.51
19.2
28.8
31.250
33.6
8.51
28.8
Kbaud
57.6
62.500
8.51
57.6
HIGH
0.244
255
0.225
255
LOW
62.500
57.6
TABLE 11-4:
FOSC = 16 MHz
FOSC = 10 MHz
Baud
Rate
(K)
Kbaud
%
Error
SPBRG
Value
(decimal)
Kbaud
%
Error
SPBRG
Value
(decimal)
Kbaud
%
Error
SPBRG
Value
(decimal)
0.3
1.2
2.4
2.441
1.71
255
9.6
9.615
0.16
129
9.615
0.16
103
9.615
0.16
64
19.2
19.231
0.16
64
19.231
0.16
51
19.531
1.72
31
28.8
29.070
0.94
42
29.412
2.13
33
28.409
1.36
21
33.6
33.784
0.55
36
33.333
0.79
29
32.895
2.10
18
57.6
59.524
3.34
20
58.824
2.13
16
56.818
1.36
10
HIGH
4.883
255
3.906
255
2.441
255
LOW
1250.000
1000.000
625.000
FOSC = 4 MHz
Baud
Rate
(K)
Kbaud
%
Error
Kbaud
%
Error
SPBRG
Value
(decimal)
0.3
1.2
1.202
0.17
207
1.2
191
2.4
2.404
0.17
103
2.4
95
9.6
9.615
0.16
25
9.6
23
19.2
19.231
0.16
12
19.2
11
28.8
27.798
3.55
28.8
33.6
35.714
6.29
32.9
2.04
57.6
62.500
8.51
57.6
HIGH
0.977
255
0.9
255
LOW
250.000
230.4
DS30498C-page 136
PIC16F7X7
TABLE 11-5:
Baud
Rate
(K)
Kbaud
%
Error
FOSC = 4 MHz
SPBRG
Value
(decimal)
Kbaud
FOSC = 2 MHz
%
Error
SPBRG
Value
(decimal)
Kbaud
FOSC = 1 MHz
%
Error
SPBRG
Value
(decimal)
Kbaud
%
Error
SPBRG
Value
(decimal)
0.3
NA
0.300
207
0.300
103
0.300
51
1.2
1.202
+0.16
103
1.202
+0.16
51
1.202
+0.16
25
1.202
+0.16
12
2.4
2.404
+0.16
51
2.404
+0.16
25
2.404
+0.16
12
2.232
-6.99
9.6
9.615
+0.16
12
8.929
-6.99
10.417
+8.51
NA
19.2
17.857
-6.99
20.833
+8.51
NA
NA
28.8
31.250
+8.51
31.250
+8.51
31.250
+8.51
NA
38.4
41.667
+8.51
NA
NA
NA
57.6
62.500
+8.51
62.500
8.51
NA
NA
TABLE 11-6:
FOSC = 4 MHz
FOSC = 2 MHz
FOSC = 1 MHz
Baud
Rate
(K)
Kbaud
%
Error
SPBRG
Value
(decimal)
0.3
NA
NA
NA
1.2
NA
1.202
+0.16
207
1.202
+0.16
103
2.4
2.404
+0.16
207
2.404
+0.16
103
2.404
+0.16
51
9.6
9.615
+0.16
51
9.615
+0.16
25
9.615
+0.16
19.2
19.231
+0.16
25
19.231
+0.16
12
17.857
28.8
29.412
+2.12
16
27.778
-3.55
31.250
38.4
38.462
+0.16
12
35.714
-6.99
41.667
+8.51
57.6
55.556
-3.55
62.500
+8.51
62.500
+8.51
Kbaud
%
Error
SPBRG
Value
(decimal)
Kbaud
SPBRG
Value
(decimal)
%
Error
SPBRG
Value
(decimal)
0.300
207
1.202
+0.16
51
2.404
+0.16
25
12
8.929
-6.99
-6.99
20.833
+8.51
+8.51
31.250
+8.51
NA
62.500
+8.51
%
Error
Kbaud
DS30498C-page 137
PIC16F7X7
11.2
In this mode, the AUSART uses standard Non-Returnto-Zero (NRZ) format (one Start bit, eight or nine data
bits and one Stop bit). The most common data format
is 8 bits. An on-chip, dedicated, 8-bit Baud Rate
Generator can be used to derive standard baud rate
frequencies from the oscillator. The AUSART transmits
and receives the LSb first. The transmitter and receiver
are functionally independent but use the same data format and baud rate. The Baud Rate Generator produces
a clock, either x16 or x64 of the bit shift rate, depending
on bit BRGH (TXSTA<2>). Parity is not supported by
the hardware but can be implemented in software (and
stored as the ninth data bit). Asynchronous mode is
stopped during Sleep.
11.2.1
AUSART ASYNCHRONOUS
TRANSMITTER
FIGURE 11-1:
TXREG Register
TXIE
8
MSb
(8)
LSb
0
Pin Buffer
and Control
TSR Register
RC6/TX/CK pin
Interrupt
TXEN
SPEN
SPBRG
Baud Rate Generator
TX9
TX9D
DS30498C-page 138
PIC16F7X7
When setting up an Asynchronous Transmission,
follow these steps:
5.
1.
6.
2.
3.
4.
FIGURE 11-2:
7.
8.
Write to TXREG
Word 1
BRG Output
(Shift Clock)
RC6/TX/CK (pin)
Start bit
bit 0
bit 1
Word 1
TXIF bit
(Transmit Buffer
Reg. Empty Flag)
bit 7/8
Stop bit
Word 1
Transmit Shift Reg
TRMT bit
(Transmit Shift
Reg. Empty Flag)
FIGURE 11-3:
Write to TXREG
Word 1
BRG Output
(Shift Clock)
RC6/TX/CK (pin)
Word 2
Start bit
bit 0
TXIF bit
(Interrupt Reg. Flag)
Start bit
Word 2
bit 0
Word 2
Transmit Shift Reg.
Name
Stop bit
TABLE 11-7:
Address
bit 7/8
Word 1
Transmit Shift Reg.
TRMT bit
(Transmit Shift
Reg. Empty Flag)
Note:
bit 1
Word 1
PIR1
Bit 7
Bit 6
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
0000 000u
TXIF
SSPIF
CCP1IF
TMR2IF
TMR1IF
0000 0000
0000 0000
CREN
ADDEN
FERR
OERR
RX9D
0000 000x
0000 000x
Bit 5
Bit 4
TMR0IE INT0IE
18h
RCSTA
19h
TXREG
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
98h
TXSTA
CSRC
TX9
TXEN
SYNC
BRGH
TRMT
0000 0000
0000 0000
TMR1IE
0000 0000
0000 0000
TX9D
0000 -010
0000 -010
0000 0000
0000 0000
99h
Legend:
Note 1:
x = unknown, = unimplemented locations read as 0. Shaded cells are not used for asynchronous transmission.
Bits PSPIE and PSPIF are reserved on 28-pin devices; always maintain these bits clear.
DS30498C-page 139
PIC16F7X7
11.2.2
AUSART ASYNCHRONOUS
RECEIVER
FIGURE 11-4:
OERR
CREN
FOSC
FERR
SPBRG
Baud Rate Generator
Pin Buffer
and Control
64
or
16
RSR Register
MSb
Stop
Data
Recovery
(8)
LSb
0
Start
RX9
RC7/RX/DT
RX9D
SPEN
Interrupt
RCREG Register
RCIF
Data Bus
RCIE
FIGURE 11-5:
RX (pin)
Rcv Shift
Reg
Rcv Buffer Reg
Read Rcv
Buffer Reg
RCREG
FIFO
ASYNCHRONOUS RECEPTION
Start
bit
bit 0
bit 1
Start
bit
Word 1
RCREG
bit 0
bit 7/8
Stop
bit
Start
bit
bit 7/8
Stop
bit
Word 2
RCREG
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 Error) bit to be set.
DS30498C-page 140
PIC16F7X7
When setting up an Asynchronous Reception, follow
these steps:
1.
2.
3.
4.
5.
6.
TABLE 11-8:
Address
Name
PIR1
Bit 7
Bit 6
Bit 5
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
0000 000u
TXIF
SSPIF
0000 0000
0000 0000
CREN
ADDEN
0000 000x
0000 000x
0000 0000
0000 0000
0000 0000
0000 0000
0000 -010
0000 -010
0000 0000
0000 0000
Bit 4
TMR0IE INT0IE
18h
RCSTA
1Ah
8Ch
PIE1
98h
TXSTA
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
CSRC
TX9
TXEN
SYNC
FERR
OERR
RX9D
TRMT
TX9D
99h
SPBRG
Legend:
Note 1:
x = unknown, = unimplemented locations read as 0. Shaded cells are not used for asynchronous reception.
Bits PSPIE and PSPIF are reserved on 28-pin devices; always maintain these bits clear.
DS30498C-page 141
PIC16F7X7
11.2.3
FIGURE 11-6:
FERR
OERR
CREN
FOSC
SPBRG
64
MSb
16
Stop
or
Pin Buffer
and Control
Data
Recovery
RSR Register
(8)
LSb
0
Start
RX9
RC7/RX/DT
8
SPEN
Enable
Load of
Receive
Buffer
RX9
ADDEN
RX9
ADDEN
RSR<8>
RX9D
RCREG Register
FIFO
8
Interrupt
RCIF
Data Bus
RCIE
DS30498C-page 142
PIC16F7X7
FIGURE 11-7:
RC7/RX/DT (pin)
bit 0
bit 1
bit 8
Stop
bit
Start
bit
bit 0
bit 8
Stop
bit
Load RSR
bit 8 = 0, Data Byte
Word 1
RCREG
Read
RCIF
Note:
This timing diagram shows a data byte followed by an address byte. The data byte is not read into the RCREG (Receive Buffer)
because ADDEN = 1.
FIGURE 11-8:
RC7/RX/DT (pin)
bit 0
bit 1
bit 8
Stop
bit
Start
bit
bit 0
bit 8
Stop
bit
Load RSR
bit 8 = 1, Address Byte
Word 1
RCREG
Read
RCIF
Note:
This timing diagram shows a data byte followed by an address byte. The data byte is not read into the RCREG (Receive Buffer)
because ADDEN was not updated and still = 0.
TABLE 11-9:
Address
Name
PIR1
18h
RCSTA
1Ah
RCREG
8Ch
PIE1
98h
TXSTA
99h
SPBRG
Legend:
Note 1:
Bit 7
Bit 6
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
0000 000u
TXIF
SSPIF
CREN
ADDEN
Bit 5
Bit 4
TMR0IE INT0IE
FERR
OERR
RX9D
(1)
CSRC
ADIE
RCIE
TXIE
SSPIE
TX9
TXEN
SYNC
TRMT
TX9D
0000 0000
0000 0000
0000 000x
0000 000x
0000 0000
0000 0000
0000 0000
0000 0000
0000 -010
0000 -010
0000 0000
0000 0000
x = unknown, = unimplemented locations read as 0. Shaded cells are not used for asynchronous reception.
Bits PSPIE and PSPIF are reserved on 28-pin devices; always maintain these bits clear.
DS30498C-page 143
PIC16F7X7
11.3
AUSART Synchronous
Master Mode
11.3.1
DS30498C-page 144
2.
3.
4.
5.
6.
7.
8.
PIC16F7X7
TABLE 11-10: REGISTERS ASSOCIATED WITH SYNCHRONOUS MASTER TRANSMISSION
Address
Name
Bit 7
Bit 6
0Bh, 8Bh,
INTCO
10Bh,18Bh N
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
0Ch
PIR1
18h
RCSTA
19h
TXREG
PSPIE
PIE1
98h
TXSTA
99h
SPBRG
Legend:
Note 1:
Bit 4
TMR0IE INT0IE
TXIF
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
0000 000u
SSPIF
CCP1IF
TMR2IF
FERR
OERR
CREN ADDEN
ADIE
RCIE
TXIE
SSPIE
TX9
TXEN
SYNC
CSRC
0000 0000
0000 000x
0000 000x
0000 0000
0000 0000
0000 0000
8Ch
Bit 5
BRGH
TRMT
TX9D
0000 -010
0000 -010
0000 0000
0000 0000
x = unknown, = unimplemented, read as 0. Shaded cells are not used for synchronous master transmission.
Bits PSPIE and PSPIF are reserved on 28-pin devices; always maintain these bits clear.
FIGURE 11-9:
SYNCHRONOUS TRANSMISSION
RC7/RX/DT
pin
bit 0
bit 1
bit 2
bit 7
RC6/TX/CK
pin
Write to
TXREG Reg
Write Word 1
bit 0
bit 1
bit 7
Word 2
Word 1
Write Word 2
TXIF bit
(Interrupt Flag)
TRMT bit
TXEN bit
Note: Sync Master mode, SPBRG = 0. Continuous transmission of two 8-bit words.
FIGURE 11-10:
RC7/RX/DT pin
bit 0
bit 1
bit 2
bit 6
bit 7
RC6/TX/CK pin
Write to
TXREG Reg
TXIF bit
TRMT bit
TXEN bit
DS30498C-page 145
PIC16F7X7
11.3.2
Name
PIR1
18h
RCSTA
Bit 7
Bit 6
Bit 5
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
Bit 4
TMR0IE INT0IE
TXIF
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
0000 000u
SSPIF
CCP1IF
TMR2IF
TMR1IF
0000 0000
0000 0000
FERR
OERR
RX9D
0000 000x
0000 000x
0000 0000
0000 0000
0000 0000
CREN ADDEN
1Ah
RCREG
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
98h
TXSTA
CSRC
TX9
TXEN
SYNC
99h
SPBRG
Legend:
Note 1:
BRGH
TRMT
TX9D
0000 -010
0000 -010
0000 0000
0000 0000
x = unknown, = unimplemented, read as 0. Shaded cells are not used for synchronous master reception.
Bits PSPIE and PSPIF are reserved on 28-pin devices; always maintain these bits clear.
DS30498C-page 146
PIC16F7X7
FIGURE 11-11:
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 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
RC7/RX/DT pin
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
RC6/TX/CK pin
Write to
bit SREN
SREN bit
CREN bit
RCIF bit
(Interrupt)
Read
RXREG
Note: Timing diagram demonstrates Sync Master mode with bit SREN = 1 and bit BRG = 0.
DS30498C-page 147
PIC16F7X7
11.4
11.4.1
2.
3.
4.
5.
6.
7.
a)
8.
b)
c)
d)
e)
Name
PIR1
18h
RCSTA
19h
TXREG
8Ch
PIE1
98h
TXSTA
99h
SPBRG
Legend:
Note 1:
Bit 7
Bit 6
Bit 5
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
RBIE
TMR0IF
INT0IF
RBIF
0000 000x
0000 000u
TXIF
SSPIF
CREN
ADDEN
Bit 4
TMR0IE INT0IE
FERR
OERR
RX9D
0000 000x
0000 0000
0000 0000
0000 0000
PSPIE
CSRC
ADIE
RCIE
TXIE
SSPIE
TX9
TXEN
SYNC
0000 0000
0000 000x
BRGH
TRMT
TX9D
0000 -010
0000 -010
0000 0000
0000 0000
x = unknown, = unimplemented, read as 0. Shaded cells are not used for synchronous slave transmission.
Bits PSPIE and PSPIF are reserved on 28-pin devices; always maintain these bits clear.
DS30498C-page 148
PIC16F7X7
11.4.2
1.
2.
3.
4.
5.
6.
7.
8.
9.
Name
Bit 7
Bit 6
GIE
PEIE
PSPIF(1)
ADIF
RCIF
SPEN
RX9
SREN
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
RBIE
TMR0IF
INT0IF
RBIF
TXIF
SSPIF
CCP1IF
TMR2IF
CREN
ADDEN
FERR
OERR
Bit 4
TMR0IE INT0IE
0Ch
PIR1
18h
RCSTA
1Ah
RCREG
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
98h
TXSTA
CSRC
TX9
TXEN
SYNC
99h
SPBRG
Legend:
Note 1:
Value on
all other
Resets
Bit 3
Bit 5
TRMT
TX9D
x = unknown, = unimplemented, read as 0. Shaded cells are not used for synchronous slave reception.
Bits PSPIE and PSPIF are reserved on 28-pin devices, always maintain these bits clear.
DS30498C-page 149
PIC16F7X7
NOTES:
DS30498C-page 150
PIC16F7X7
12.0
ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
DS30498C-page 151
PIC16F7X7
REGISTER 12-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADCS1
ADCS0
CHS2
CHS1
CHS0
GO/DONE
CHS3
ADON
bit 7
bit 0
bit 7-6
bit 5-3
bit 2
bit 1
CHS<3>: Analog Channel Select bit (see bit 5-3 for bit settings)
bit 0
DS30498C-page 152
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
REGISTER 12-2:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADFM
ADCS2
VCFG1
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3-0
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Legend:
Note:
AN5 through AN7 are only available on the 40-pin product variant (PIC16F747 and
PIC16F777).
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 153
PIC16F7X7
REGISTER 12-3:
U-0
R/W-0
R/W-0
R/W-0
U-0
U-0
U-0
ACQT2
ACQT1
ACQT0
bit 7
bit 0
bit 7-6
Unimplemented: Read as 0
bit 5-3
bit 2-0
Unimplemented: Read as 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
DS30498C-page 154
x = Bit is unknown
PIC16F7X7
The value in the ADRESH/ADRESL registers is not
modified for a Power-on Reset. The ADRESH/
ADRESL registers will contain unknown data after a
Power-on Reset.
2.
3.
4.
5.
6.
7.
FIGURE 12-1:
1101
1100
AN13
AN12
1011
AN11
0011
AN3/VREF+
0010
VIN
AN2/VREF-
(Input Voltage)
0001
AN1
VDD
A/D
Converter
0000
AN0
VREF+
(Reference
Voltage)
VCFG<1:0>
VREF(Reference
Voltage)
VSS
VCFG<1:0>
DS30498C-page 155
PIC16F7X7
12.1
EQUATION 12-1:
TACQ
TC
TACQ
ACQUISITION TIME
TAMP + TC + TCOFF
2 s + TC + [(Temperature 25C)(0.05 s/C)]
CHOLD (RIC + RSS + RS) In(1/2047)
-120 pF (1 k + 7 k + 10 k) In(0.0004885)
16.47 s
2 s + 16.47 s + [(50C 25C)(0.05 s/C)
19.72 s
Note 1: The reference voltage (VREF) has no effect on the equation since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is 10 k. This is required to meet the pin
leakage specification.
4: After a conversion has completed, a 2.0 TAD delay must complete before acquisition can begin again.
During this time, the holding capacitor is not connected to the selected A/D input channel.
FIGURE 12-2:
ANx
CPIN
5 pF
VT = 0.6V
VT = 0.6V
Sampling
Switch
RIC 1K SS RSS
CHOLD
= DAC Capacitance
= 120 pF
ILEAKAGE
500 nA
VSS
Legend: CPIN
= Input Capacitance
VT
= Threshold Voltage
ILEAKAGE = Leakage Current at the pin due to
various junctions
RIC
= Interconnect Resistance
SS
= Sampling Switch
CHOLD
= Sample/Hold Capacitance (from DAC)
DS30498C-page 156
6V
5V
VDD 4V
3V
2V
5 6 7 8 9 10 11
Sampling Switch
(k)
PIC16F7X7
12.2
12.3
2 TOSC
4 TOSC
8 TOSC
16 TOSC
32 TOSC
64 TOSC
Internal A/D module, RC oscillator (2-6 s)
TABLE 12-1:
Note 1:
2:
3:
Operation
ADCS2:ADCS1:ADCS0
2 TOSC
000
1.25 MHz
4 TOSC
100
2.5 MHz
8 TOSC
001
5 MHz
16 TOSC
101
10 MHz
32 TOSC
010
20 MHz
64 TOSC
110
20 MHz
RC(1,2,3)
x11
(Note 1)
The RC source has a typical TAD time of 4 s but can vary between 2-6 s.
When the device frequencies are greater than 1 MHz, the RC A/D conversion clock source is only
recommended for Sleep operation.
For extended voltage devices (LF), please refer to Section 18.0 Electrical Characteristics.
DS30498C-page 157
PIC16F7X7
12.4
Operation in Power-Managed
Modes
DS30498C-page 158
12.5
PIC16F7X7
12.6
A/D Conversions
FIGURE 12-3:
TCY - TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b4
b1
b0
b6
b7
b2
b9
b8
b3
b5
Conversion starts
Holding capacitor is disconnected from analog input (typically 100 ns)
Set GO/DONE bit
Next Q4: ADRESH/ADRESL is loaded, GO/DONE bit is cleared,
ADIF bit is set, holding capacitor is connected to analog input.
FIGURE 12-4:
TAD Cycles
TACQT Cycles
1
Automatic
Acquisition
Time
10
11
b9
b8
b7
b6
b5
b4
b3
b2
b1
b0
Conversion starts
(Holding capacitor is disconnected)
DS30498C-page 159
PIC16F7X7
12.7
12.8
TABLE 12-2:
Effects of a Reset
12.9
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
0Bh,8Bh,
INTCON
10Bh, 18Bh
GIE
PEIE
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
PSPIF(1)
ADIF
RCIF
TXIF
SSPIF
CCP1IF
Address
0Ch
PIR1
0Dh
PIR2
OSFIF
CMIF
LVDIF
BCLIF
8Ch
PIE1
PSPIE(1)
ADIE
RCIE
TXIE
SSPIE
CCP1IE
OSFIE
CMIE
LVDIE
BCLIE
8Dh
PIE2
1Eh
1Fh
ADCON0
ADCS1
ADCS0
9Fh
ADCON1
ADFM
ADCS2 VCFG1
05h
PORTA
85h
TRISA
09h
PORTE(2)
89h
TRISE(2)
IBF
OBF
Legend:
Note 1:
2:
3:
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used for A/D conversion.
Bits PSPIE and PSPIF are reserved on the PIC16F737/767 devices; always maintain these bits clear.
These registers are reserved on the PIC16F737/767 devices.
RE3 is an input only. The state of the TRISE3 bit has no effect and will always read 1.
DS30498C-page 160
RA7
RA6
ADON
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
RA4
RA3
RA2
RA1
RA0
RE3(3)
RE2
RE1
RE0
IBOV
PSPMODE
(3)
CHS2
CHS1
RA5
CHS0 GO/DONE
0000 0000
PIC16F7X7
13.0
COMPARATOR MODULE
The comparator module contains two analog comparators. The inputs to the comparators are
multiplexed with I/O port pins, RA0 through RA3, while
the outputs are multiplexed to pins RA4 and RA5. The
on-chip voltage reference (Section 14.0 Comparator
Voltage Reference Module) can also be an input to
the comparators.
REGISTER 13-1:
R-0
R/W-0
R/W-0
R/W-0
R/W-1
R/W-1
R/W-1
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 161
PIC16F7X7
13.1
Comparator Configuration
There are eight modes of operation for the comparators. The CMCON register is used to select these
modes. Figure 13-1 shows the eight possible modes.
The TRISA register controls the data direction of the
comparator pins for each mode. If the Comparator
mode is changed, the comparator output level may not
FIGURE 13-1:
VINVIN+
VIN-
RA2/AN2/ A
VREF-/CVREF
VIN+
RA3/AN3/ A
VREF+
VIN-
RA3/AN3/ D
VREF+
VIN+
VIN-
RA2/AN2/ D
VREF-/CVREF
VIN+
RA0/AN0
C1
Off (Read as 0)
C2
Off (Read as 0)
RA1/AN1
VIN-
RA0/AN0
VIN-
VIN+
RA3/AN3/ A
VREF+
VIN+
C1
C1
Off (Read as 0)
C2
Off (Read as 0)
RA3/AN3/ A
VREF+
RA1/AN1
Note:
Comparators Reset
CM2:CM0 = 000
RA0/AN0
C1OUT
C1
C1OUT
C2
C2OUT
RA4/T0CKI/C1OUT
A
VIN-
RA2/AN2/ A
VIN+
RA1/AN1
C2
C2OUT
VREF-/CVREF
VIN-
RA2/AN2/ A
VREF-/CVREF
VIN+
RA1/AN1
RA5/AN4/LVDIN/SS/C2OUT
Two Common Reference Comparators
CM2:CM0 = 100
RA0/AN0
RA3/AN3/ A
VREF+
VINVIN+
C1
C1OUT
RA0/AN0
VIN-
RA3/AN3/
VREF+
VIN+
C1
C1OUT
C2
C2OUT
RA4/T0CKI/C1OUT
A
VIN-
RA2/AN2/ D
VREF-/CVREF
VIN+
RA1/AN1
C2
C2OUT
VIN-
D
RA2/AN2/
VREF-/CVREF
VIN+
RA1/AN1
RA5/AN4/LVDIN/SS/C2OUT
Four Inputs Multiplexed to Two Comparators
CM2:CM0 = 110
VIN-
RA3/AN3/ A
VREF+
VIN+
RA0/AN0
RA0/AN0
C1
C1OUT
RA4/T0CKI/C1OUT
D
VIN-
RA2/AN2/ D
VREF-/CVREF
VIN+
RA1/AN1
RA3/AN3/ A
VREF+
RA1/AN1
C2
CIS = 0
CIS = 1
VINVIN+
C1
C1OUT
C2
C2OUT
RA2/AN2/ A
VREF-/CVREF
CIS = 0
CIS = 1
VINVIN+
Off (Read as 0)
DS30498C-page 162
PIC16F7X7
13.2
13.3.2
Comparator Operation
13.3
13.4
Comparator Reference
FIGURE 13-2:
SINGLE COMPARATOR
13.5
VIN+
VIN-
Output
VIN
VIN
VIN
+
VIN+
Comparator Outputs
Output
Output
13.3.1
DS30498C-page 163
PIC16F7X7
FIGURE 13-3:
MULTIPLEX
+
CxINV
To RA4 or
RA5 pin
Bus
Data
Q
Read CMCON
Set
CMIF
bit
D
EN
Q
From
other
Comparator
D
EN
CL
Read CMCON
Reset
13.6
Comparator Interrupts
DS30498C-page 164
Note:
PIC16F7X7
13.7
Comparator Operation
During Sleep
13.9
13.8
Effects of a Reset
FIGURE 13-4:
RS < 10K
RIC
AIN
CPIN
5 pF
VA
Legend:
TABLE 13-1:
Address
CPIN
VT
ILEAKAGE
RIC
RS
VA
=
=
=
=
=
=
ILEAKAGE
500 nA
VT = 0.6V
VSS
Input Capacitance
Threshold Voltage
Leakage Current at the pin due to various junctions
Interconnect Resistance
Source Impedance
Analog Voltage
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR
Value on
all other
Resets
9Ch
CMCON
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
9Dh
CVRCON CVREN
CVROE
CVRR
CVR3
CVR2
CVR1
CVR0
RBIE
TMR0IF
INT0IF
RBIF
BCLIF
CCP3IF
CCP2IF
CCP3IE CCP2IE
PEIE
PIR2
OSFIF
CMIF
LVDIF
OSFIE
CMIE
LVDIE
BCLIE
RA7
RA6
RA5
RA4
RA3
RA2
8Dh
PIE2
05h
PORTA
85h
TRISA
Legend:
TMR0IE INT0IE
GIE
RA1
RA0
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are unused by the comparator module.
DS30498C-page 165
PIC16F7X7
NOTES:
DS30498C-page 166
PIC16F7X7
14.0
COMPARATOR VOLTAGE
REFERENCE MODULE
REGISTER 14-1:
R/W-0
R/W-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
CVREN
CVROE
CVRR
CVR3
CVR2
CVR1
CVR0
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4
Unimplemented: Read as 0
bit 3-0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 167
PIC16F7X7
FIGURE 14-1:
16 Stages
CVREN
8R
8R
CVRR
RA2/AN2/VREF-/CVREF
CVROE
CVREF
Input to
Comparator
TABLE 14-1:
Address
CVR3
CVR2
CVR1
CVR0
Value on
all other
Resets
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
9Dh
CVRCON
CVREN
CVROE
CVRR
CVR3
CVR2
CVR1
CVR0
9Ch
CMCON
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
Legend:
DS30498C-page 168
PIC16F7X7
15.0
SPECIAL FEATURES OF
THE CPU
15.1
Configuration Bits
DS30498C-page 169
PIC16F7X7
REGISTER 15-1:
R/P-1 R/P-1
CP
R/P-1
CCPMX DEBUG
U-1
U-1
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
bit 13
bit 0
bit 13
bit 12
bit 11
bit 6
bit 5
bit 3
bit 2
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
DS30498C-page 170
x = Bit is unknown
PIC16F7X7
REGISTER 15-2:
U-1
U-1
U-1
U-1
U-1
U-1
U-1
R/P-1
U-1
U-1
U-1
U-1
BORSEN
R/P-1
R/P-1
IESO FCMEN
bit 13
bit 0
bit 5-2
Unimplemented: Read as 1
bit 1
bit 0
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
DS30498C-page 171
PIC16F7X7
15.2
Reset
FIGURE 15-1:
MCLR/VPP/RE3 pin
Sleep
WDT
Time-out
Reset
WDT
Module
VDD Rise
Detect
Power-on Reset
VDD
Brown-out
Detect
BOREN
BORSEN
OST/PWRT
OST
Chip_Reset
OSC1/
CLKI pin
PWRT
INTRC(1)
Enable PWRT
Enable OST
Note 1:
This is the 32 kHz INTRC oscillator. See Section 4.0 Oscillator Configurations for more information.
DS30498C-page 172
PIC16F7X7
15.3
MCLR
15.5
FIGURE 15-2:
RECOMMENDED MCLR
CIRCUIT
VDD
PIC16F7X7
R1
1 k (or greater)
MCLR
C1
0.1 F
(optional, not critical)
15.4
15.6
15.7
DS30498C-page 173
PIC16F7X7
15.8
Low-Voltage Detect
Voltage
FIGURE 15-3:
VA
VB
Legend:
VA = LVD trip point
VB = Minimum valid device
operating voltage
Time
DS30498C-page 174
TA
TB
PIC16F7X7
FIGURE 15-4:
LVD Control
Register
16-to-1 MUX
VDD
Internally Generated
Reference Voltage
1.2V
LVDEN
FIGURE 15-5:
LVDIF
LVDIN
Externally Generated
Trip Point
LVDEN
LVD
LVDEN
BODEN
EN
BGAP
DS30498C-page 175
PIC16F7X7
15.9
Control Register
REGISTER 15-3:
U-0
R-0
R/W-0
R/W-0
R/W-1
R/W-0
R/W-1
IRVST
LVDEN
LVDL3
LVDL2
LVDL1
LVDL0
bit 7
bit 0
bit 7-6
Unimplemented: Read as 0
bit 5
bit 4
bit 3-0
See Table 18-3 in Section 18.0 Electrical Characteristics for the specifications.
Legend:
DS30498C-page 176
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
PIC16F7X7
15.10 Operation
1.
2.
3.
4.
5.
6.
FIGURE 15-6:
CASE 1:
Enable LVD
Internally Generated
Reference Stable
TIRVST
LVDIF cleared in software
CASE 2:
VDD
VLVD
LVDIF
Enable LVD
Internally Generated
Reference Stable
TIRVST
DS30498C-page 177
PIC16F7X7
15.10.1
15.10.2
CURRENT CONSUMPTION
DS30498C-page 178
PIC16F7X7
TABLE 15-1:
Oscillator
Configuration
PWRTE = 0
TPWRT
XT, HS, LP
EXTRC, INTRC
+ 1024 TOSC
Note 1:
PWRTE = 1
PWRTE = 0
PWRTE = 1
Wake-up from
Sleep
1024 TOSC
1024 TOSC
1024 TOSC
5-10 s
TPWRT
T1OSC
Brown-out Reset
(1)
5-10 s
TPWRT
(1)
5-10 s(1)
5-10 s(1)
CPU start-up is always invoked on POR, BOR and wake-up from Sleep. The 5 s-10 s delay is based on
a 1 MHz system clock.
TABLE 15-2:
POR
BOR
TO
PD
Power-on Reset
Brown-out Reset
WDT Reset
WDT Wake-up
TABLE 15-3:
Status
Register
PCON
Register
Power-on Reset
000h
0001 1xxx
---- -10x
000h
000u uuuu
---- -uuu
000h
0001 0uuu
---- -uuu
000h
0000 1uuu
---- -uuu
PC + 1
uuu0 0uuu
---- -uuu
Condition
WDT Reset
WDT Wake-up
Brown-out Reset
Interrupt Wake-up from Sleep
000h
0001 1xxx
---- -1u0
PC + 1(1)
uuu1 0uuu
---- -uuu
DS30498C-page 179
PIC16F7X7
TABLE 15-4:
Register
W
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset
xxxx xxxx
uuuu uuuu
uuuu uuuu
INDF
N/A
N/A
N/A
TMR0
xxxx xxxx
uuuu uuuu
uuuu uuuu
0000h
0000h
PC + 1(2)
PCL
STATUS
0001 1xxx
000q quuu(3)
uuuq quuu(3)
FSR
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTA
xx0x 0000
uu0u 0000
uuuu uuuu
PORTB
xx00 0000
uu00 0000
uuuu uuuu
PORTC
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTD
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTE (PIC16F737/767)
PORTE (PIC16F747/777)
PCLATH
---0 0000
---0 0000
---u uuuu
INTCON
0000 000x
0000 000u
uuuu uuuu(1)
PIR1
0000 0000
0000 0000
uuuu uuuu(1)
PIR2
000- 0-00
000- 0-00
uuu- u-uu
TMR1L
xxxx xxxx
uuuu uuuu
uuuu uuuu
TMR1H
xxxx xxxx
uuuu uuuu
uuuu uuuu
T1CON
-000 0000
-uuu uuuu
-uuu uuuu
TMR2
0000 0000
0000 0000
uuuu uuuu
T2CON
-000 0000
-000 0000
-uuu uuuu
SSPBUF
xxxx xxxx
uuuu uuuu
uuuu uuuu
SSPCON
0000 0000
0000 0000
uuuu uuuu
SSPCON2
0000 0000
0000 0000
uuuu uuuu
CCPR1L
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR1H
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCP1CON
--00 0000
--00 0000
--uu uuuu
CCP2CON
--00 0000
--00 0000
--uu uuuu
CCP3CON
--00 0000
--00 0000
uuuu uuuu
CCPR2L
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR2H
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR3L
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR3H
xxxx xxxx
uuuu uuuu
uuuu uuuu
RCSTA
0000 000x
0000 000x
uuuu uuuu
TXREG
0000 0000
0000 0000
uuuu uuuu
RCREG
0000 0000
0000 0000
uuuu uuuu
ADRESH
xxxx xxxx
uuuu uuuu
uuuu uuuu
ADCON0
0000 0000
0000 0000
uuuu uuuu
OPTION_REG
1111 1111
1111 1111
uuuu uuuu
DS30498C-page 180
PIC16F7X7
TABLE 15-4:
MCLR Reset,
WDT Reset
TRISA
1111 1111
1111 1111
uuuu uuuu
TRISB
1111 1111
1111 1111
uuuu uuuu
TRISC
1111 1111
1111 1111
uuuu uuuu
TRISD
1111 1111
1111 1111
uuuu uuuu
TRISE (PIC16F737/767)
TRISE (PIC16F747/777)
PIE1
0000 0000
0000 0000
-uuu uuuu
PIE2
000- 0-00
000- 0-00
uuu- u-uu
PCON
---- -1qq
---- -uuu
---- -uuu
OSCCON
-000 1000
-000 1000
-uuu uuuu
OSCTUNE
--00 0000
--00 0000
--uu uuuu
PR2
1111 1111
1111 1111
1111 1111
SSPADD
0000 0000
0000 0000
uuuu uuuu
SSPSTAT
0000 0000
0000 0000
uuuu uuuu
TXSTA
0000 -010
0000 -010
uuuu -u1u
SPBRG
0000 0000
0000 0000
uuuu uuuu
CMCON
0000 0111
0000 0111
uuuu uuuu
CVRCON
000- 0000
000- 0000
uuu- uuuu
WDTCON
---0 1000
---0 1000
---u uuuu
ADRESL
xxxx xxxx
uuuu uuuu
uuuu uuuu
ADCON1
0000 0000
0000 0000
uuuu uuuu
ADCON2
--00 0---
--00 0---
uuuu uuuu
PMDATA
xxxx xxxx
uuuu uuuu
uuuu uuuu
PMADR
xxxx xxxx
uuuu uuuu
uuuu uuuu
PMDATH
--xx xxxx
--uu uuuu
--uu uuuu
PMADRH
---- xxxx
---- uuuu
---- uuuu
PMCON1
1--- ---0
1--- ---u
1--- ---u
LVDCON
--00 0101
--00 0101
--uu uuuu
Register
DS30498C-page 181
PIC16F7X7
FIGURE 15-7:
VDD
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
FIGURE 15-8:
VDD
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
FIGURE 15-9:
VDD
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
DS30498C-page 182
PIC16F7X7
FIGURE 15-10:
1V
0V
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
DS30498C-page 183
PIC16F7X7
15.15 Interrupts
The PIC16F7X7 has up to 17 sources of interrupt. The
Interrupt Control register (INTCON) records individual
interrupt requests in flag bits. It also has individual and
global interrupt enable bits.
Note:
Individual interrupt flag bits are set regardless of the status of their corresponding
mask bit or the GIE bit.
FIGURE 15-11:
INTERRUPT LOGIC
PSPIF(1)
PSPIE(1)
OSFIF
OSFIE
BCLIF
BCLIE
ADIF
ADIE
RCIF
RCIE
INT0IF
INT0IE
Interrupt to CPU
RBIF
RBIE
PEIE
GIE
CCP2IF
CCP2IE
CCP3IF
CCP3IE
TMR2IF
TMR2IE
TMR1IF
TMR1IE
CMIF
CMIE
Note 1:
DS30498C-page 184
PIC16F7X7
15.15.1
INT INTERRUPT
15.15.3
15.15.2
TMR0 INTERRUPT
EXAMPLE 15-1:
MOVWF
SWAPF
CLRF
MOVWF
:
:(ISR)
:
SWAPF
W_TEMP
STATUS, W
STATUS
STATUS_TEMP
MOVWF
SWAPF
SWAPF
STATUS
W_TEMP, F
W_TEMP, W
;Copy
;Swap
;bank
;Save
W to TEMP register
status to be saved into W
0, regardless of current bank, Clears IRP,RP1,RP0
status to bank zero STATUS_TEMP register
DS30498C-page 185
PIC16F7X7
15.17 Watchdog Timer (WDT)
15.17.1
15.17.2
WDT OSCILLATOR
The WDT derives its time base from the 31.25 kHz
INTRC; therefore, the accuracy of the 31.25 kHz will be
the same accuracy for the WDT time-out period.
The value of WDTCON is ---0 1000 on all Resets.
This gives a nominal time base of 16.38 ms which is
compatible with the time base generated with previous
PIC16 microcontroller versions.
Note:
FIGURE 15-12:
WDT CONTROL
0
Postscaler
16-bit Programmable Prescaler WDT
1
8
PSA
31.25 kHz
INTRC Clock
PS<2:0>
WDTPS<3:0>
To TMR0
0
1
PSA
TABLE 15-5:
Prescaler
Postscaler (PSA = 1)
Cleared
Cleared
WDTEN = 0
CLRWDT Command
Oscillator Fail Detected
Exit Sleep + System Clock = T1OSC, EXTRC, INTRC, EXTCLK
Exit Sleep + System Clock = XT, HS, LP
DS30498C-page 186
PIC16F7X7
REGISTER 15-4:
U-0
U-0
R/W-0
WDTPS3
R/W-1
R/W-0
R/W-0
R/W-0
bit 7
bit 0
bit 7-5
Unimplemented: Read as 0
bit 4-1
bit 0
TABLE 15-6:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
T0SE
PSA
PS2
PS1
PS0
Address
Name
2007h
Configuration
bits(1)
105h
WDTCON
Legend:
Note 1:
Bit 7
Bit 6
FOSC1
DS30498C-page 187
PIC16F7X7
15.17.3
TWO-SPEED CLOCK
START-UP MODE
FIGURE 15-13:
15.17.3.1
1.
2.
3.
4.
5.
6.
7.
8.
TWO-SPEED START-UP
CPU Start-up
Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Q1
Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4
0003h
0004h
INTRC
OSC1
TOST
OSC2
System Clock
Sleep
OSTS
Program
Counter
PC
DS30498C-page 188
0000h
0001h
0005h
PIC16F7X7
15.17.4
FAIL-SAFE OPTION
FIGURE 15-14:
Peripheral
Clock
INTRC
Oscillator
64
31.25 kHz
(32 s)
488 Hz
(2.048 ms)
Clock
Failure
Detected
FIGURE 15-15:
15.17.4.1
Sample Clock
(488 Hz)
System
Clock
Output
Oscillator
Failure
CM Output
(Q)
Failure
Detected
OSCFIF
CM Test
Note:
CM Test
CM Test
The system clock is normally at a much higher frequency than the sample clock. The relative frequencies in
this example have been chosen for clarity.
DS30498C-page 189
PIC16F7X7
15.17.4.2
15.18.1
15.17.4.3
1.
2.
3.
DS30498C-page 190
PIC16F7X7
15.18.2
FIGURE 15-16:
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
TOST(2)
CLKO(4)
INT pin
INTF Flag
(INTCON<1>)
Interrupt Latency
(Note 2)
GIE bit
(INTCON<7>)
Processor in
Sleep
INSTRUCTION FLOW
PC
Instruction
Fetched
Instruction
Executed
Note 1:
2:
3:
4:
PC
PC + 1
Inst(PC) = Sleep
Inst(PC + 1)
PC + 2
Inst(PC + 2)
PC + 2
Inst(PC 1)
Sleep
Inst(PC + 1)
PC + 2
Dummy Cycle
0004h
0005h
Inst(0004h)
Inst(0005h)
Dummy Cycle
Inst(0004h)
DS30498C-page 191
PIC16F7X7
15.19 In-Circuit Debugger
When the DEBUG bit in the Configuration Word is programmed to a 0, the In-Circuit Debugger functionality
is enabled. This function allows simple debugging
functions when used with MPLAB ICD. When the
microcontroller has this feature enabled, some of the
resources are not available for general use. Table 15-7
shows which features are consumed by the background
debugger.
TABLE 15-7:
DEBUGGER RESOURCES
I/O pins
RB6, RB7
Stack
1 level
Program Memory
Data Memory
FIGURE 15-17:
TYPICAL IN-CIRCUIT
SERIAL PROGRAMMING
CONNECTION
To use the In-Circuit Debugger function of the microcontroller, the design must implement In-Circuit Serial
Programming connections to MCLR/VPP, VDD, GND,
RB7 and RB6. This will interface to the In-Circuit
Debugger module available from Microchip or one of
the third party development tool companies.
Note:
To Normal
Connections
External
Connector
Signals
PIC16F7X7
+5V
VDD
0V
VSS
VPP
MCLR/VPP/RE3
CLK
RB6
Data I/O
RB7
15.21 ID Locations
Four memory locations (2000h-2003h) are designated
as ID locations where the user can store checksum or
other code identification numbers. These locations are
not accessible during normal execution but are
readable and writable during program/verify. It is
recommended that only the four Least Significant bits
of the ID location are used.
DS30498C-page 192
*
VDD
To Normal
Connections
* Isolation devices (as required).
PIC16F7X7
16.0
TABLE 16-1:
Description
PC
Program Counter
TO
Time-out bit
PD
Power-Down bit
FIGURE 16-1:
f (FILE #)
d = 0 for destination W
d = 1 for destination f
f = 7-bit file register address
Bit-oriented file register operations
13
10 9
7 6
OPCODE
b (BIT #)
f (FILE #)
OPCODE
Read-Modify-Write Operations
OPCODE FIELD
DESCRIPTIONS
Field
16.1
0
k (literal)
11
OPCODE
10
0
k (literal)
DS30498C-page 193
PIC16F7X7
TABLE 16-2:
Mnemonic,
Operands
14-Bit Opcode
Description
Cycles
MSb
LSb
Status
Affected
Notes
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
Add W and f
AND W with f
Clear f
Clear W
Complement f
Decrement f
Decrement f, Skip if 0
Increment f
Increment f, Skip if 0
Inclusive OR W with f
Move f
Move W to f
No Operation
Rotate Left f through Carry
Rotate Right f through Carry
Subtract W from f
Swap nibbles in f
Exclusive OR W with f
1
1
1
1
1
1
1(2)
1
1(2)
1
1
1
1
1
1
1
1
1
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
0111
0101
0001
0001
1001
0011
1011
1010
1111
0100
1000
0000
0000
1101
1100
0010
1110
0110
dfff
dfff
lfff
0xxx
dfff
dfff
dfff
dfff
dfff
dfff
dfff
lfff
0xx0
dfff
dfff
dfff
dfff
dfff
ffff
ffff
ffff
xxxx
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
0000
ffff
ffff
ffff
ffff
ffff
00bb
01bb
10bb
11bb
bfff
bfff
bfff
bfff
ffff
ffff
ffff
ffff
111x
1001
0kkk
0000
1kkk
1000
00xx
0000
01xx
0000
0000
110x
1010
kkkk
kkkk
kkkk
0110
kkkk
kkkk
kkkk
0000
kkkk
0000
0110
kkkk
kkkk
kkkk
kkkk
kkkk
0100
kkkk
kkkk
kkkk
1001
kkkk
1000
0011
kkkk
kkkk
C, DC, Z
Z
Z
Z
Z
Z
Z
Z
Z
C
C
C, DC, Z
Z
1, 2
1, 2
2
1, 2
1, 2
1, 2, 3
1, 2
1, 2, 3
1, 2
1, 2
1,2
1, 2
1, 2
1, 2
1, 2
f, b
f, b
f, b
f, b
Bit Clear f
Bit Set f
Bit Test f, Skip if Clear
Bit Test f, Skip if Set
1
1
1 (2)
1 (2)
01
01
01
01
1, 2
1, 2
3
3
2:
3:
Note:
k
k
k
k
k
k
k
k
k
1
1
2
1
2
1
1
2
2
2
1
1
1
11
11
10
00
10
11
11
00
11
00
00
11
11
C, DC, Z
Z
TO, PD
Z
TO, PD
C, DC, Z
Z
When an I/O register is modified as a function of itself ( e.g., MOVF PORTB, 1), the value used will be that value
present on the pins themselves. For example, if the data latch is 1 for a pin configured as input and is driven low by an
external device, the data will be written back with a 0.
If this instruction is executed on the TMR0 register (and where applicable, d = 1), the prescaler will be cleared if
assigned to the Timer0 module.
If Program Counter (PC) is modified, or a conditional test is true, the instruction requires two cycles. The second cycle
is executed as a NOP.
Additional information on the mid-range instruction set is available in the PICmicro Mid-Range MCU
Family Reference Manual (DS33023).
DS30498C-page 194
PIC16F7X7
16.2
Instruction Descriptions
ADDLW
BCF
Bit Clear f
Syntax:
[ label ] ADDLW
Syntax:
[ label ] BCF
Operands:
0 k 255
Operands:
0 f 127
0b7
Operation:
(W) + k (W)
Status Affected:
C, DC, Z
Operation:
0 (f<b>)
Description:
Status Affected:
None
Description:
ADDWF
Add W and f
BSF
Bit Set f
Syntax:
[ label ] ADDWF
Syntax:
[ label ] BSF
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
0b7
Operation:
Operation:
1 (f<b>)
Status Affected:
C, DC, Z
Status Affected:
None
Description:
Description:
ANDLW
BTFSS
Syntax:
[ label ] ANDLW
Syntax:
Operands:
0 k 255
Operands:
Operation:
0 f 127
0b<7
Status Affected:
Operation:
skip if (f<b>) = 1
Description:
Status Affected:
None
Description:
BTFSC
Syntax:
f,d
f,b
f,b
ANDWF
AND W with f
Syntax:
[ label ] ANDWF
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
0b7
Operation:
Operation:
skip if (f<b>) = 0
Status Affected:
Status Affected:
None
Description:
Description:
f,d
DS30498C-page 195
PIC16F7X7
CALL
Call Subroutine
CLRWDT
Syntax:
[ label ] CALL k
Syntax:
[ label ] CLRWDT
Operands:
0 k 2047
Operands:
None
Operation:
(PC) + 1 TOS,
k PC<10:0>,
(PCLATH<4:3>) PC<12:11>
Operation:
Status Affected:
None
00h WDT
0 WDT prescaler,
1 TO
1 PD
Description:
Status Affected:
TO, PD
Description:
Clear f
COMF
Complement f
CLRF
Syntax:
[ label ] CLRF
Syntax:
[ label ] COMF
Operands:
0 f 127
Operands:
Operation:
00h (f)
1Z
0 f 127
d [0,1]
Operation:
(f) (destination)
Status Affected:
Status Affected:
Description:
Description:
CLRW
Clear W
DECF
Decrement f
Syntax:
[ label ] CLRW
Syntax:
Operands:
None
Operands:
Operation:
00h (W)
1Z
0 f 127
d [0,1]
Operation:
(f) 1 (destination)
Status Affected:
Status Affected:
Description:
Description:
Decrement register f. If d is 0,
the result is stored in the W
register. If d is 1, the result is
stored back in register f.
DS30498C-page 196
f,d
PIC16F7X7
DECFSZ
Decrement f, Skip if 0
INCFSZ
Increment f, Skip if 0
Syntax:
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f) 1 (destination);
skip if result = 0
Operation:
(f) + 1 (destination),
skip if result = 0
Status Affected:
None
Status Affected:
None
Description:
Description:
GOTO
Unconditional Branch
IORLW
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 k 2047
Operands:
0 k 255
Operation:
k PC<10:0>
PCLATH<4:3> PC<12:11>
Operation:
Status Affected:
Status Affected:
None
Description:
Description:
INCF
Increment f
IORWF
Inclusive OR W with f
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f) + 1 (destination)
Operation:
Status Affected:
Status Affected:
Description:
Description:
GOTO k
INCF f,d
INCFSZ f,d
IORWF
f,d
DS30498C-page 197
PIC16F7X7
MOVF
Move f
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operation:
No operation
Operation:
(f) (destination)
Status Affected:
None
Status Affected:
Description:
No operation.
Description:
MOVLW
Move Literal to W
RETFIE
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 k 255
Operands:
None
Operation:
k (W)
Operation:
Status Affected:
None
TOS PC,
1 GIE
Description:
Status Affected:
None
MOVWF
Move W to f
RETLW
Syntax:
[ label ]
Syntax:
[ label ]
MOVF f,d
MOVLW k
MOVWF
NOP
No Operation
Syntax:
[ label ]
Operands:
None
NOP
RETFIE
RETLW k
Operands:
0 f 127
Operands:
0 k 255
Operation:
(W) (f)
Operation:
Status Affected:
None
k (W);
TOS PC
Description:
Status Affected:
None
Description:
DS30498C-page 198
PIC16F7X7
RLF
SLEEP
Syntax:
[ label ] RLF
Syntax:
[ label ] SLEEP
Operands:
0 f 127
d [0,1]
Operands:
None
Operation:
Operation:
Status Affected:
Description:
00h WDT,
0 WDT prescaler,
1 TO,
0 PD
f,d
Status Affected:
TO, PD
Description:
Register f
RETURN
SUBLW
Syntax:
[ label ]
Syntax:
[ label ] SUBLW k
Operands:
None
Operands:
0 k 255
Operation:
TOS PC
Operation:
k (W) (W)
Status Affected:
None
Description:
Description:
RRF
SUBWF
Subtract W from f
Syntax:
[ label ]
Syntax:
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
Operation:
Status Affected:
Description:
Description:
RETURN
RRF f,d
Register f
DS30498C-page 199
PIC16F7X7
SWAPF
Swap Nibbles in f
XORWF
Exclusive OR W with f
Syntax:
Syntax:
[ label ] XORWF
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f<3:0>) (destination<7:4>),
(f<7:4>) (destination<3:0>)
Operation:
Status Affected:
Status Affected:
None
Description:
Description:
XORLW
Syntax:
[ label ] XORLW k
Operands:
0 k 255
Operation:
Status Affected:
Description:
DS30498C-page 200
f,d
PIC16F7X7
17.0
DEVELOPMENT SUPPORT
17.1
17.2
MPASM Assembler
DS30498C-page 201
PIC16F7X7
17.3
17.4
17.5
DS30498C-page 202
17.6
17.7
The MPLAB SIM software simulator allows code development in a PC hosted environment by simulating the
PICmicro series microcontrollers on an instruction
level. On any given instruction, the data areas can be
examined or modified and stimuli can be applied from
a file, or user defined key press, to any pin. The execution can be performed in Single-Step, Execute Until
Break or Trace mode.
The MPLAB SIM simulator fully supports symbolic
debugging using the MPLAB C17 and MPLAB C18
C Compilers, as well as the MPASM assembler. The
software simulator offers the flexibility to develop and
debug code outside of the laboratory environment,
making it an excellent, economical software
development tool.
17.8
PIC16F7X7
17.9
DS30498C-page 203
PIC16F7X7
17.14 PICSTART Plus Development
Programmer
DS30498C-page 204
PIC16F7X7
17.20 PICDEM 17 Demonstration Board
The PICDEM 17 demonstration board is an evaluation
board that demonstrates the capabilities of several
Microchip microcontrollers, including PIC17C752,
PIC17C756A, PIC17C762 and PIC17C766. A programmed sample is included. The PRO MATE II device
programmer, or the PICSTART Plus development programmer, can be used to reprogram the device for user
tailored application development. The PICDEM 17
demonstration board supports program download and
execution from external on-board Flash memory. A
generous prototype area is available for user hardware
expansion.
DS30498C-page 205
PIC16F7X7
NOTES:
DS30498C-page 206
PIC16F7X7
18.0
ELECTRICAL CHARACTERISTICS
DS30498C-page 207
PIC16F7X7
FIGURE 18-1:
Voltage
5.0V
4.5V
4.0V
3.5V
3.0V
2.5V
2.0V
16 MHz
20 MHz
Frequency
FIGURE 18-2:
Voltage
5.0V
4.5V
4.0V
3.5V
3.0V
2.5V
2.0V
4 MHz
10 MHz
Frequency
FMAX = (12 MHz/V) (VDDAPPMIN 2.5V) + 4 MHz
Note 1: VDDAPPMIN is the minimum voltage of the PICmicro device in the application.
Note 2: FMAX has a maximum frequency of 10 MHz.
DS30498C-page 208
PIC16F7X7
18.1
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Sym
VDD
Characteristic
Min
Typ
Max
Units
Conditions
PIC16LF7X7
2.5
2.2
2.0
5.5
5.5
5.5
V
V
V
PIC16F7X7
4.0
VBOR*
5.5
5.5
V
V
All configurations
BOR enabled (Note 6)
Supply Voltage
D001
D001
D001A
D002*
VDR
1.5
D003
VPOR
VSS
D004*
SVDD
0.05
VBOR
1.96
2.06
2.16
BORV1:BORV0 = 10
2.64
2.78
2.92
BORV1:BORV0 = 01
4.11
4.33
4.55
4.41
4.64
4.87
PIC16LF7X7
D005
BORV1:BORV0 = 00
D005
85C T 25C
PIC16F7X7 Industrial
BORV1:BORV0 = 1x
N.A.
N.A.
BORV1:BORV0 = 01
4.16
4.5
4.45
4.83
BORV1:BORV0 = 00
D005
PIC16F7X7 Extended
Legend:
*
Note 1:
2:
3:
4:
5:
6:
BORV1:BORV0 = 1x
N.A.
N.A.
BORV1:BORV0 = 01
4.07
4.59
BORV1:BORV0 = 00
4.36
4.92
DS30498C-page 209
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
PIC16LF7X7
All devices
Extended devices
Legend:
Note 1:
2:
3:
0.1
0.4
-40C
0.1
0.4
+25C
0.4
1.5
+85C
0.3
0.5
-40C
0.3
0.5
+25C
0.7
1.7
+85C
0.6
1.0
-40C
0.6
1.0
+25C
1.2
5.0
+85C
28
+125C
VDD = 2.0V
VDD = 3.0V
VDD = 5.0V
DS30498C-page 210
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
PIC16LF7X7
All devices
-40C
+25C
15
+85C
16
30
-40C
14
25
+25C
14
25
+85C
32
40
-40C
26
35
+25C
26
35
+85C
35
53
+125C
72
95
-40C
76
90
+25C
76
90
+85C
Extended devices
3:
A
A
PIC16LF7X7
All devices
2:
20
15
Extended devices
PIC16LF7X7
Legend:
Note 1:
9
7
138
175
-40C
136
170
+25C
136
170
+85C
310
380
-40C
290
360
+25C
280
360
+85C
330
500
+125C
VDD = 2.0V
VDD = 3.0V
FOSC = 32 kHZ
(LP Oscillator)
VDD = 5.0V
VDD = 2.0V
VDD = 3.0V
FOSC = 1 MHZ
(RC Oscillator)(3)
VDD = 5.0V
DS30498C-page 211
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
PIC16LF7X7
All devices
3:
-40C
310
+25C
285
310
+85C
460
610
-40C
450
600
+25C
450
600
+85C
900
1060
-40C
890
1050
+25C
890
1050
+85C
.920
1.5
mA
+125C
All devices
1.8
2.3
mA
-40C
Extended devices
2:
315
Extended devices
All devices
Legend:
Note 1:
270
280
1.6
2.2
mA
+25C
1.3
2.2
mA
+85C
3.0
4.2
mA
-40C
2.5
4.0
mA
+25C
2.5
4.0
mA
+85C
3.0
5.0
mA
+125C
VDD = 2.0V
VDD = 3.0V
FOSC = 4 MHz
(RC Oscillator)(3)
VDD = 5.0V
VDD = 4.0V
FOSC = 20 MHZ
(HS Oscillator)
VDD = 5.0V
DS30498C-page 212
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
PIC16LF7X7
All devices
-40C
+25C
15
+85C
16
30
-40C
14
25
+25C
14
25
+85C
32
40
-40C
29
35
+25C
29
35
+85C
35
45
+125C
132
160
-40C
126
155
+25C
126
155
+85C
260
310
-40C
230
300
+25C
230
300
+85C
560
690
-40C
500
650
+25C
500
650
+85C
+125C
Extended devices
570
710
PIC16LF7X7
310
420
-40C
300
410
+25C
300
410
+85C
PIC16LF7X7
All devices
Extended devices
3:
A
A
PIC16LF7X7
All devices
2:
20
15
Extended devices
PIC16LF7X7
Legend:
Note 1:
8
7
550
650
-40C
530
620
+25C
530
620
+85C
1.2
1.5
mA
-40C
1.1
1.4
mA
+25C
1.1
1.4
mA
+85C
1.3
1.6
mA
+125C
VDD = 2.0V
VDD = 3.0V
VDD = 5.0V
VDD = 2.0V
VDD = 3.0V
FOSC = 1 MHz
(RC_RUN mode,
Internal RC Oscillator)
VDD = 5.0V
VDD = 2.0V
VDD = 3.0V
FOSC = 4 MHz
(RC_RUN mode,
Internal RC Oscillator)
VDD = 5.0V
DS30498C-page 213
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
.950
1.3
mA
-40C
.930
1.2
mA
+25C
.930
1.2
mA
+85C
1.8
3.0
mA
-40C
1.7
2.8
mA
+25C
1.7
2.8
mA
+85C
2.0
4.0
mA
+125C
13
-10C
14
+25C
+70C
All devices
Extended devices
PIC16LF7X7
PIC16LF7X7
All devices
Legend:
Note 1:
2:
3:
11
16
12
34
-10C
12
31
+25C
14
28
+70C
20
72
-10C
20
65
+25C
25
59
+70C
VDD = 3.0V
FOSC = 8 MHz
(RC_RUN mode,
Internal RC Oscillator)
VDD = 5.0V
VDD = 2.0V
VDD = 3.0V
FOSC = 32 kHz
(SEC_RUN mode,
Timer1 as Clock)
VDD = 5.0V
DS30498C-page 214
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
D022A
(IBOR)
D022B
(ILVD)
Watchdog Timer
2:
3:
3.8
-40C
3.8
+25C
2.7
4.0
+85C
VDD = 2.0V
2.3
4.6
-40C
2.7
4.6
+25C
3.1
4.8
+85C
3.0
10.0
-40C
3.3
10.0
+25C
3.9
13.0
+85C
Extended devices
5.0
21.0
+125C
Brown-out Reset
17
35
-40C to +85C
VDD = 3.0V
47
45
-40C to +85C
VDD = 5.0V
-40C to +85C
VDD = 2.0V
VDD = 3.0V
VDD = 5.0V
VDD = 3.0V
VDD = 5.0V
Extended devices
48
50
-40C to +125C
VDD = 5.0V
Low-Voltage Detect
14
25
-40C to +85C
VDD = 2.0V
18
35
-40C to +85C
VDD = 3.0V
21
45
-40C to +85C
VDD = 5.0V
24
50
-40C to +125C
VDD = 5.0V
Extended devices
Legend:
Note 1:
1.5
2.2
BOREN:BORSEN = 10
in Sleep mode
DS30498C-page 215
PIC16F7X7
18.2
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Typ
Max
Units
Conditions
Timer1 Oscillator
D026
(IAD)
2:
3:
2.3
-40C
2.3
+25C
2.0
2.3
+85C
2.2
3.8
-40C
2.6
3.8
+25C
2.9
3.8
+85C
3.0
6.0
-40C
3.2
6.0
+25C
3.4
7.0
+85C
VDD = 2.0V
VDD = 3.0V
32 kHz on Timer1
VDD = 5.0V
2.0
-40C to +85C
VDD = 2.0V
0.001
2.0
-40C to +85C
VDD = 3.0V
0.003
2.0
-40C to +85C
VDD = 5.0V
mA
-40C to +125C
VDD = 5.0V
Extended devices
Legend:
Note 1:
1.7
1.8
DS30498C-page 216
PIC16F7X7
18.3
DC Characteristics:
Internal RC Accuracy
PIC16F737/747/767/777 (Industrial, Extended)
PIC16LF737/747/767/777 (Industrial)
PIC16LF737/747/767/777
(Industrial)
PIC16F737/747/767/777
(Industrial, Extended)
Param
No.
Device
Min
Typ
Max
Units
Conditions
INTOSC Accuracy @ Freq = 8 MHz, 4 MHz, 2 MHz, 1 MHz, 500 kHz, 250 kHz, 125 kHz(1)
PIC16LF7X7
-2
+25C
-5
-10C to +85C
-10
10
-40C to +85C
-2
+25C
-5
-10C to +85C
-10
10
-40C to +85C
-15
15
-40C to +125C
PIC16F7X7
Extended devices
Legend:
Note 1:
2:
VDD = 2.7V-3.3V
VDD = 4.5V-5.5V
kHz(2)
PIC16LF7X7 26.562
35.938
kHz
-40C to +85C
VDD = 2.7V-3.3V
PIC16F7X7 26.562
35.938
kHz
-40C to +85C
VDD = 4.5V-5.5V
DS30498C-page 217
PIC16F7X7
18.4
DC Characteristics:
DC CHARACTERISTICS
Param
Sym
No.
Min
Typ
Max
Units
VSS
0.15
VDD
VSS
0.8V
D031
VSS
0.2 VDD
D032
VSS
0.2 VDD
D033
VSS
0.3V
VSS
0.3 VDD
VIL
Characteristic
D030
D030A
(Note 1)
D034
VSS
0.3 VDD
D034A
with SMBus
-0.5
0.6
VIH
D040
D040A
D041
D042
MCLR
D042A
D043
2.0
VDD
VDD
0.8 VDD
VDD
0.8 VDD
VDD
1.6V
VDD
0.7 VDD
VDD
0.9 VDD
VDD
(Note 1)
0.7 VDD
VDD
D044A
with SMBus
1.4
5.5
50
250
400
D070
DS30498C-page 218
PIC16F7X7
18.4
DC Characteristics:
DC CHARACTERISTICS
Param
Sym
No.
IIL
Characteristic
Typ
Max
Units
Conditions
D060
I/O ports
D061
MCLR, RA4/T0CKI
D063
OSC1
VOL
D080
I/O ports
0.6
D083
OSC2/CLKO
(RC oscillator configuration)
0.6
0.6
VOH
D090
VDD 0.7
D092
OSC2/CLKO
(RC oscillator configuration)
VDD 0.7
VDD 0.7
12
RA4 pin
D150* VOD
D100
15
pF
D101
CIO
50
pF
D102
CB
400
pF
EP
Endurance
100
1000
D131
VPR
2.0
5.5
E/W 25C at 5V
V
DS30498C-page 219
PIC16F7X7
TABLE 18-1:
COMPARATOR SPECIFICATIONS
Operating Conditions: 3.0V < VDD < 5.5V, -40C < TA < +85C (unless otherwise stated).
Param
No.
Sym
Characteristics
Min
Typ
Max
Units
D300
VIOFF
5.0
10
mV
D301
VICM
VDD 1.5
D302
CMRR
55
dB
300
300A
TRESP
Response Time(1)*
150
400
600
ns
ns
301
TMC2OV
10
*
Note 1:
Comments
PIC16F7X7
PIC16LF7X7
TABLE 18-2:
Operating Conditions: 3.0V < VDD < 5.5V, -40C < TA < +85C (unless otherwise stated).
Param
No.
Sym
Characteristics
Min
Typ
Max
Units
VDD/24
VDD/32
LSb
1/4
1/2
LSb
LSb
D310
VRES
Resolution
D311
VRAA
Absolute Accuracy
D312
VRUR
2k
310
TSET
Settling Time(1)*
10
*
Note 1:
Comments
DS30498C-page 220
PIC16F7X7
FIGURE 18-3:
VLVD
(LVDIF set by hardware)
LVDIF
TABLE 18-3:
Symbol
VLVD
Legend:
Characteristic
LVD Voltage on VDD
Transition High-to-Low
LVDL<3:0> = 0000
Min
Typ
Max
Units
Conditions
N/A
N/A
N/A
Reserved
LVDL<3:0> = 0001
1.96
2.06
2.16
T 25C
LVDL<3:0> = 0010
2.16
2.27
2.38
T 25C
LVDL<3:0> = 0011
2.35
2.47
2.59
T 25C
LVDL<3:0> = 0100
2.43
2.56
2.69
LVDL<3:0> = 0101
2.64
2.78
2.92
LVDL<3:0> = 0110
2.75
2.89
3.03
LVDL<3:0> = 0111
2.95
3.1
3.26
LVDL<3:0> = 1000
3.24
3.41
3.58
LVDL<3:0> = 1001
3.43
3.61
3.79
LVDL<3:0> = 1010
3.53
3.72
3.91
LVDL<3:0> = 1011
3.72
3.92
4.12
LVDL<3:0> = 1100
3.92
4.13
4.34
LVDL<3:0> = 1101
4.11
4.33
4.55
LVDL<3:0> = 1110
4.41
4.64
4.87
DS30498C-page 221
PIC16F7X7
18.5
3. TCC:ST
2. TppS
4. Ts
T
F
Frequency
Lowercase letters (pp) and their meanings:
pp
cc
CCP1
ck
CLKO
cs
CS
di
SDI
do
SDO
dt
Data in
io
I/O port
mc
MCLR
Uppercase letters and their meanings:
S
F
Fall
H
High
I
Invalid (High-impedance)
L
Low
I2C only
AA
BUF
output access
Bus free
FIGURE 18-4:
Time
osc
rd
rw
sc
ss
t0
t1
wr
OSC1
RD
RD or WR
SCK
SS
T0CKI
T1CKI
WR
P
R
V
Z
Period
Rise
Valid
High-impedance
High
Low
High
Low
SU
Setup
STO
Stop condition
LOAD CONDITIONS
Load Condition 1
Load Condition 2
VDD/2
RL
CL
pin
VSS
RL = 464
CL = 50 pF
15 pF
CL
pin
VSS
for all pins except OSC2, but including PORTD and PORTE outputs as ports
for OSC2 output
Note: PORTD and PORTE are not implemented on the PIC16F737/767 devices.
DS30498C-page 222
PIC16F7X7
FIGURE 18-5:
Q1
Q2
Q3
Q4
Q1
OSC1
1
2
CLKO
TABLE 18-4:
Param
No.
Symbol
FOSC
Characteristic
External CLKI Frequency
(Note 1)
Oscillator Frequency
(Note 1)
TOSC
Oscillator Period
(Note 1)
Min
Typ
Max
Units
Conditions
DC
MHz
XT Oscillator mode
DC
20
MHz
HS Oscillator mode
DC
32
kHz
LP Oscillator mode
DC
MHz
RC Oscillator mode
0.1
MHz
XT Oscillator mode
4
5
20
200
MHz
kHz
HS Oscillator mode
LP Oscillator mode
1000
ns
XT Oscillator mode
50
ns
HS Oscillator mode
ms
LP Oscillator mode
250
ns
RC Oscillator mode
250
10,000
ns
XT Oscillator mode
50
250
ns
HS Oscillator mode
ms
LP Oscillator mode
TCY
200
TCY
DC
ns
TCY = 4/FOSC
TOSL,
TOSH
500
ns
XT oscillator
TOSR,
TOSF
2.5
ms
LP oscillator
15
ns
HS oscillator
25
ns
XT oscillator
50
ns
LP oscillator
15
ns
HS oscillator
Data in Typ column is at 5V, 25C unless otherwise stated. These parameters are for design guidance
only and are not tested.
Note 1: Instruction cycle period (TCY) equals four times the input oscillator time base period. All specified values are
based on characterization data for that particular oscillator type, under standard operating conditions, with
the device executing code. Exceeding these specified limits may result in an unstable oscillator operation
and/or higher than expected current consumption. All devices are tested to operate at min. values with an
external clock applied to the OSC1/CLKI pin. When an external clock input is used, the max. cycle time
limit is DC (no clock) for all devices.
DS30498C-page 223
PIC16F7X7
FIGURE 18-6:
Q4
Q2
Q3
OSC1
11
10
CLKO
13
14
19
12
18
16
I/O pin
(Input)
15
17
I/O pin
(Output)
New Value
Old Value
20, 21
Note: Refer to Figure 18-4 for load conditions.
TABLE 18-5:
Param
No.
Symbol
Characteristic
Min
Typ
Max
Units Conditions
10*
75
200
ns
(Note 1)
11*
75
200
ns
(Note 1)
12*
TCKR
35
100
ns
(Note 1)
13*
TCKF
35
100
ns
(Note 1)
14*
TCKL2IOV
0.5 TCY + 20
ns
(Note 1)
15*
TIOV2CKH
TOSC + 200
ns
(Note 1)
16*
TCKH2IOI
ns
(Note 1)
17*
TOSH2IOV
100
255
ns
18*
TOSH2IOI
PIC16F7X7
100
ns
PIC16LF7X7
200
ns
ns
PIC16F7X7
10
40
ns
PIC16LF7X7
145
ns
PIC16F7X7
10
40
ns
PIC16LF7X7
145
ns
19*
20*
TIOR
21*
TIOF
22*
TINP
TCY
ns
23*
TRBP
TCY
ns
Note 1:
DS30498C-page 224
PIC16F7X7
FIGURE 18-7:
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out
32
Oscillator
Time-out
Internal
Reset
Watchdog
Timer
Reset
31
34
34
I/O pins
FIGURE 18-8:
VBOR
VDD
35
TABLE 18-6:
Param
No.
Sym
30
TMCL
31*
TWDT
32
TOST
33*
TPWRT
34
TIOZ
35
TBOR
Min
Typ
Max
Units
Conditions
13.6
16
18.4
ms
1024 TOSC
61.2
72
82.8
ms
2.1
100
DS30498C-page 225
PIC16F7X7
FIGURE 18-9:
RA4/T0CKI/C1OUT
41
40
42
RC0/T1OSO/T1CKI
46
45
47
48
TMR0 or TMR1
Note: Refer to Figure 18-4 for load conditions.
TABLE 18-7:
Param
No.
40*
Symbol
TT0H
Characteristic
T0CKI High Pulse Width
No prescaler
With prescaler
41*
TT0L
42*
TT0P
T0CKI Period
No prescaler
With prescaler
No prescaler
With prescaler
45*
TT1H
46*
47*
TT1L
TT1P
T1CKI Input
Period
48
Max
Units
Conditions
0.5 TCY + 20
ns
10
ns
0.5 TCY + 20
ns
10
ns
TCY + 40
ns
Greater of:
20 or TCY + 40
N
ns
N = prescale
value (2, 4, ...,
256)
0.5 TCY + 20
ns
15
ns
25
ns
PIC16F7X7
30
ns
50
ns
0.5 TCY + 20
ns
Synchronous,
PIC16F7X7
Prescaler = 2, 4, 8 PIC16LF7X7
15
ns
25
ns
Asynchronous
30
ns
PIC16LF7X7
50
ns
PIC16F7X7
Greater of:
30 or TCY + 40
N
ns
N = prescale
value (1, 2, 4, 8)
PIC16LF7X7
Greater of:
50 or TCY + 40
N
ns
N = prescale
value (1, 2, 4, 8)
PIC16F7X7
60
ns
PIC16LF7X7
100
ns
DC
200
kHz
2 TOSC
7 TOSC
Synchronous
PIC16F7X7
Typ
PIC16LF7X7
Synchronous, Prescaler = 1
Asynchronous
FT1
Min
DS30498C-page 226
PIC16F7X7
FIGURE 18-10:
RC1/T1OSI/CCP2
and RC2/CCP1
(Capture Mode)
51
50
52
RC1/T1OSI/CCP2
and RC2/CCP1
(Compare or PWM Mode)
54
53
Note: Refer to Figure 18-4 for load conditions.
TABLE 18-8:
Param
Symbol
No.
50*
51*
TCCL
TCCH
Characteristic
Min
0.5 TCY + 20
ns
10
ns
20
ns
0.5 TCY + 20
ns
10
ns
20
ns
3 TCY + 40
N
ns
52*
TCCP
53*
TCCR
PIC16F7X7
10
25
ns
PIC16LF7X7
25
50
ns
PIC16F7X7
10
25
ns
PIC16LF7X7
25
45
ns
54*
TCCF
Conditions
N = prescale
value (1, 4 or 16)
DS30498C-page 227
PIC16F7X7
FIGURE 18-11:
RE2/CS/AN7
RE0/RD/AN5
RE1/WR/AN6
65
RD7/PSP7:RD0/PSP0
62
64
63
Note: Refer to Figure 18-4 for load conditions.
TABLE 18-9:
Param
No.
62
63*
Symbol
Characteristic
Min
WR or CS to Data In Invalid
(hold time)
20
25
Typ Max
Units
Conditions
ns
ns
PIC16F7X7
20
ns
PIC16LF7X7
35
ns
64
TRDL2DTV
80
90
ns
ns
65
TRDH2DTI
10
30
ns
DS30498C-page 228
PIC16F7X7
FIGURE 18-12:
SS
70
SCK
(CKP = 0)
71
72
78
79
79
78
SCK
(CKP = 1)
80
MSb
SDO
LSb
bit 6 - - - - - -1
75, 76
SDI
MSb In
bit 6 - - - -1
LSb In
74
73
Note: Refer to Figure 18-4 for load conditions.
FIGURE 18-13:
SS
81
SCK
(CKP = 0)
71
72
79
73
SCK
(CKP = 1)
80
78
SDO
MSb
LSb
bit 6 - - - - - -1
75, 76
SDI
MSb In
bit 6 - - - -1
LSb In
74
Note: Refer to Figure 18-4 for load conditions.
DS30498C-page 229
PIC16F7X7
FIGURE 18-14:
SS
70
SCK
(CKP = 0)
83
71
72
78
79
79
78
SCK
(CKP = 1)
80
MSb
SDO
LSb
bit 6 - - - - - -1
77
75, 76
SDI
bit 6 - - - -1
MSb In
LSb In
74
73
Note: Refer to Figure 18-4 for load conditions.
FIGURE 18-15:
SS
SCK
(CKP = 0)
70
83
71
72
SCK
(CKP = 1)
80
SDO
MSb
bit 6 - - - - - -1
LSb
77
75, 76
SDI
MSb In
bit 6 - - - -1
LSb In
74
Note: Refer to Figure 18-4 for load conditions.
DS30498C-page 230
PIC16F7X7
TABLE 18-10: SPI MODE REQUIREMENTS
Param
No.
Symbol
70*
Characteristic
TSSL2SCH,
TSSL2SCL
Min
Typ
TCY
ns
71*
TSCH
TCY + 20
ns
72*
TSCL
TCY + 20
ns
73*
TDIV2SCH,
TDIV2SCL
100
ns
74*
TSCH2DIL,
TSCL2DIL
100
ns
75*
TDOR
10
25
25
50
ns
ns
76*
TDOF
10
25
ns
77*
TSSH2DOZ
10
50
ns
78*
TSCR
10
25
25
50
ns
ns
79*
TSCF
10
25
ns
80*
TSCH2DOV,
TSCL2DOV
50
145
ns
ns
81*
TCY
ns
82*
TSSL2DOV
50
ns
83*
TSCH2SSH,
TSCL2SSH
1.5 TCY + 40
ns
PIC16F7X7
PIC16LF7X7
PIC16F7X7
PIC16LF7X7
FIGURE 18-16:
SCL
91
90
93
92
SDA
Start
Condition
Stop
Condition
DS30498C-page 231
PIC16F7X7
TABLE 18-11: I2C BUS START/STOP BITS REQUIREMENTS
Param
Symbol
No.
Characteristic
90*
TSU:STA
Start Condition
91*
THD:STA
92*
TSU:STO
93
Typ
4700
Max Units
Setup Time
600
Start Condition
4000
Hold Time
600
Stop Condition
4700
Setup Time
Hold Time
*
Min
600
4000
600
Conditions
ns
ns
ns
ns
FIGURE 18-17:
102
100
101
SCL
90
106
107
91
92
SDA
In
110
109
109
SDA
Out
Note: Refer to Figure 18-4 for load conditions.
DS30498C-page 232
PIC16F7X7
TABLE 18-12: I2C BUS DATA REQUIREMENTS
Param.
No.
100*
Symbol
THIGH
Characteristic
Clock High Time
Min
Max
Units
4.0
0.6
1.5 TCY
4.7
1.3
SSP module
101*
TLOW
SSP module
102*
TR
103*
TF
TSU:STA
90*
91*
THD:STA
THD:DAT
106*
107*
TSU:DAT
TSU:STO
92*
109*
TAA
110*
TBUF
CB
*
Note 1:
2:
1.5 TCY
1000
ns
20 + 0.1 CB
300
ns
300
ns
300
ns
CB is specified to be from
10-400 pF
Only relevant for Repeated
Start condition
Start Condition
Setup Time
4.7
0.6
4.0
0.6
20 + 0.1
CB
ns
0.9
250
ns
100
ns
Stop Condition
Setup Time
4.7
0.6
3500
ns
ns
Conditions
4.7
1.3
400
pF
CB is specified to be from
10-400 pF
(Note 2)
(Note 1)
Time the bus must be free
before a new transmission
can start
DS30498C-page 233
PIC16F7X7
FIGURE 18-18:
RC6/TX/CK
pin
121
121
RC7/RX/DT
pin
120
122
Note: Refer to Figure 18-4 for load conditions.
Symbol
Characteristic
PIC16F7X7
Min
Typ
Max
Units Conditions
80
ns
PIC16LF7X7
100
ns
121
TCKRF
PIC16F7X7
45
ns
PIC16LF7X7
50
ns
122
TDTRF
PIC16F7X7
45
ns
PIC16LF7X7
50
ns
Data in Typ column is at 5V, 25C unless otherwise stated. These parameters are for design guidance
only and are not tested.
FIGURE 18-19:
RC6/TX/CK
pin
125
RC7/RX/DT
pin
126
Note: Refer to Figure 18-4 for load conditions.
Symbol
Characteristic
Min
Typ
Max
Units
125
TDTV2CKL
15
ns
126
TCKL2DTL
15
ns
Conditions
Data in Typ column is at 5V, 25C unless otherwise stated. These parameters are for design guidance
only and are not tested.
DS30498C-page 234
PIC16F7X7
TABLE 18-15: A/D CONVERTER CHARACTERISTICS: PIC16F7X7 (INDUSTRIAL, EXTENDED)
PIC16LF7X7 (INDUSTRIAL)
Param
Sym
No.
Characteristic
Min
Typ
Max
Units
Conditions
A01
NR
Resolution
10 bits
bit
A03
EIL
<1
LSb
A04
EDL
<1
LSb
A06
EOFF
Offset Error
<2
LSb
A07
EGN
Gain Error
<1
LSb
A10
Monotonicity
guaranteed(3)
A20
VREF
Reference Voltage
(VREF+ VREF-)
2.0
VDD + 0.3
A21
AVDD 2.5V
AVDD + 0.3V
A22
AVSS 0.3V
VREF+ 2.0V
A25
VAIN
VSS 0.3V
VREF + 0.3V
A30
ZAIN
Recommended Impedance of
Analog Voltage Source
2.5
(Note 4)
A40
IAD
A/D Conversion
Current (VDD)
PIC16F7X7
220
PIC16LF7X7
90
Average current
consumption when A/D is on
(Note 1)
150
A50
IREF
Note 1:
2:
3:
4:
DS30498C-page 235
PIC16F7X7
FIGURE 18-20:
BSF ADCON0, GO
(TOSC/2)(1)
131
Q4
130
A/D CLK
132
9
A/D DATA
...
...
OLD_DATA
ADRES
NEW_DATA
ADIF
GO
DONE
Sampling Stopped
SAMPLE
Note: 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.
TAD
Characteristic
A/D Clock Period
PIC16F7X7
2.0
4.0
6.0
A/D RC mode
PIC16LF7X7
3.0
6.0
9.0
A/D RC mode
12
TAD
(Note 2)
40
10*
TOSC/2
TACQ
Acquisition Time
Note 1:
2:
Conditions
1.6
132
Units
3.0
Max
PIC16LF7X7
TCNV
TGO
Typ
PIC16F7X7
131
134
Min
DS30498C-page 236
PIC16F7X7
19.0
Note:
The graphs and tables provided following this note are a statistical summary based on a limited number of
samples and are provided for informational purposes only. The performance characteristics listed herein
are not tested or guaranteed. In some graphs or tables, the data presented may be outside the specified
operating range (e.g., outside specified power supply range) and therefore, outside the warranted range.
Typical represents the mean of the distribution at 25C. Maximum or minimum represents (mean + 3) or (mean 3)
respectively, where is a standard deviation, over the whole temperature range.
FIGURE 19-1:
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
5.5V
5.0V
IDD (mA)
4.5V
4
4.0V
3.5V
3.0V
2
2.5V
2.0V
0
4
10
12
14
16
18
20
18
20
FOSC (MHz)
FIGURE 19-2:
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
5.5V
6
5.0V
4.5V
IDD (mA)
4.0V
4
3.5V
3.0V
3
2.5V
2
2.0V
0
4
10
12
14
16
FOSC (MHz)
DS30498C-page 237
PIC16F7X7
FIGURE 19-3:
1.8
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
1.6
5.5V
1.4
5.0V
1.2
4.5V
IDD (mA)
4.0V
1.0
3.5V
0.8
3.0V
2.5V
0.6
2.0V
0.4
0.2
0.0
0
500
1000
1500
2000
2500
3000
3500
4000
3500
4000
FOSC (MHz)
FIGURE 19-4:
2.5
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
2.0
5.5V
5.0V
1.5
IDD (mA)
4.5V
4.0V
3.5V
1.0
3.0V
2.5V
2.0V
0.5
0.0
0
500
1000
1500
2000
2500
3000
FOSC (MHz)
DS30498C-page 238
PIC16F7X7
FIGURE 19-5:
70
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
60
5.5V
5.0V
50
4.5V
IDD (A)
40
4.0V
3.5V
30
3.0V
2.5V
20
2.0V
10
0
20
30
40
50
60
70
80
90
100
FOSC (kHz)
FIGURE 19-6:
120
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
5.5V
100
5.0V
4.5V
80
IDD (A)
4.0V
3.5V
60
3.0V
2.5V
40
2.0V
20
0
20
30
40
50
60
70
80
90
100
FOSC (kHz)
DS30498C-page 239
PIC16F7X7
FIGURE 19-7:
1.6
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
1.4
5.5V
5.0V
1.2
4.5V
1.0
IDD (mA)
4.0V
3.5V
0.8
3.0V
0.6
2.5V
0.4
2.0V
0.2
0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
FOSC (MHz)
FIGURE 19-8:
4.5
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
4.0
5.5V
3.5
5.0V
4.5V
IDD (mA)
3.0
4.0V
2.5
3.5V
2.0
3.0V
1.5
2.5V
2.0V
1.0
0.5
0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
FOSC (MHz)
DS30498C-page 240
PIC16F7X7
FIGURE 19-9:
45.0
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
40.0
35.0
Max (+70C)
IDD (A)
30.0
25.0
Typ (+25C)
20.0
15.0
10.0
5.0
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-10:
IPD vs. VDD, -40C TO +125C (SLEEP MODE, ALL PERIPHERALS DISABLED)
100
Max (125C)
10
Max (85C)
IPD (A)
0.1
0.01
Typ (25C)
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
0.001
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS30498C-page 241
PIC16F7X7
FIGURE 19-11:
AVERAGE FOSC vs. VDD FOR VARIOUS VALUES OF R (RC MODE, C = 20 pF, +25C)
4.5
Operation above 4 MHz is not recommended
4.0
5.1 kOhm
3.5
Freq (MHz)
3.0
2.5
10 kOhm
2.0
1.5
1.0
0.5
100 kOhm
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-12:
2.5
2.0
3.3 kOhm
Freq (MHz)
1.5
5.1 kOhm
1.0
10 kOhm
0.5
100 kOhm
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS30498C-page 242
PIC16F7X7
FIGURE 19-13:
0.9
0.8
3.3 kOhm
0.7
0.6
Freq (MHz)
5.1 kOhm
0.5
0.4
10 kOhm
0.3
0.2
0.1
100 kOhm
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-14:
5.0
4.5
Max (-10C to +70C)
4.0
3.5
3.0
IPD (A)
Typ (+25C)
2.5
2.0
1.5
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
1.0
0.5
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS30498C-page 243
PIC16F7X7
FIGURE 19-15:
18
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
16
14
IWDT (A)
12
10
Max (-40C to +125C)
8
6
Max (-40C to +85C)
4
2
Typ (25C)
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-16:
50
45
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
40
Max (+125C)
35
Max (+85C)
IPD (A)
30
Typ (+25C)
25
20
15
10
Low-Voltage Detection Range
5
Normal Operating Range
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS30498C-page 244
PIC16F7X7
FIGURE 19-17:
40
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
35
Max (+125C)
30
25
IPD (A)
Typ (+25C)
20
15
10
Device may be in Reset
5
Device is Operating
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-18:
IPD A/D, -40C TO +125C (SLEEP MODE, A/D ENABLED NOT CONVERTING)
12
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
10
Max
(-40C to +125C)
IPD (A)
4
Max
(-40C to +85C)
2
Typ (+25C)
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS30498C-page 245
PIC16F7X7
FIGURE 19-19:
TYPICAL, MINIMUM AND MAXIMUM VOH vs. IOH (VDD = 5V, -40C TO +125C)
5.5
5.0
4.5
4.0
Max
3.5
VOH (V)
Typ (25C)
3.0
2.5
Min
2.0
1.5
1.0
0.5
0.0
0
10
15
20
25
IOH (-mA)
FIGURE 19-20:
TYPICAL, MINIMUM AND MAXIMUM VOH vs. IOH (VDD = 3V, -40C TO +125C)
3.5
3.0
2.5
Max
VOH (V)
2.0
Typ (25C)
1.5
Min
1.0
0.5
0.0
0
10
15
20
25
IOH (-mA)
DS30498C-page 246
PIC16F7X7
FIGURE 19-21:
TYPICAL, MINIMUM AND MAXIMUM VOL vs. IOL (VDD = 5V, -40C TO +125C)
1.0
0.9
Max (125C)
0.8
0.7
Max (85C)
VOL (V)
0.6
0.5
Typ (25C)
0.4
0.3
Min (-40C)
0.2
0.1
0.0
0
10
15
20
25
IOL (-mA)
FIGURE 19-22:
TYPICAL, MINIMUM AND MAXIMUM VOL vs. IOL (VDD = 3V, -40C TO +125C)
3.0
Max (125C)
2.5
VOL (V)
2.0
1.5
Max (85C)
1.0
Typ (25C)
0.5
Min (-40C)
0.0
0
10
15
20
25
IOL (-mA)
DS30498C-page 247
PIC16F7X7
FIGURE 19-23:
MINIMUM AND MAXIMUM VIN vs. VDD (TTL INPUT, -40C TO +125C)
1.5
1.4
1.3
1.1
VIN (V)
0.9
0.8
0.7
0.6
0.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-24:
MINIMUM AND MAXIMUM VIN vs. VDD (ST INPUT, -40C TO +125C)
4.0
3.5
3.0
VIN (V)
2.5
1.0
0.5
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS30498C-page 248
PIC16F7X7
MINIMUM AND MAXIMUM VIN vs. VDD (I2C INPUT, -40C TO +125C)
FIGURE 19-25:
3.5
VIH Max
Typical:
statistical mean @ 25C
Maximum: mean + 3 (-40C to +125C)
Minimum: mean 3 (-40C to +125C)
3.0
2.5
2.0
VIN (V)
V
Max
VIL
ILMax
VIH Min
1.5
1.0
VIL Min
0.5
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 19-26:
3.5
-40C
-40C
3
+25C
25C
2.5
+85C
85C
2
1.5
0.5
+125C
125C
0
2
2.5
3.5
4.5
5.5
DS30498C-page 249
PIC16F7X7
FIGURE 19-27:
2.5
1.5
Max
+125C)
Max (-40C
(-40C toto125C)
1
Typ
Typ (+25C)
(25C)
0.5
0
2
2.5
3.5
4.5
5.5
VREFH (V)
DS30498C-page 250
PIC16F7X7
20.0
PACKAGING INFORMATION
20.1
Example
PIC16F737-I/SP
0410017
XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX
YYWWNNN
28-Lead SOIC
Example
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
YYWWNNN
28-Lead SSOP
XXXXXXXXXXXX
XXXXXXXXXXXX
YYWWNNN
28-Lead QFN
Legend: XX...X
Y
YY
WW
NNN
Example
PIC16F737
-I/SS
0410017
Example
XXXXXXXX
XXXXXXXX
YYWWNNN
Note:
PIC16F767-I/SO
0410017
16F737
-I/ML
0410017
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 PICmicro device marking consists of Microchip part number, year code, week code, and
traceability code. For PICmicro device 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.
DS30498C-page 251
PIC16F7X7
Package Marking Information (Continued)
40-Lead PDIP
Example
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
YYWWNNN
44-Lead TQFP
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
YYWWNNN
44-Lead QFN
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
YYWWNNN
DS30498C-page 252
PIC16F777-I/P
0410017
Example
PIC16F777
-I/PT
0410017
Example
PIC16F777
-I/ML
0410017
PIC16F7X7
20.2
Package Details
28-Lead Skinny Plastic Dual In-line (SP) 300 mil Body (PDIP)
E1
2
n
A2
A
L
B1
A1
eB
Units
Number of Pins
Pitch
Dimension Limits
n
p
INCHES*
MIN
NOM
MILLIMETERS
MAX
MIN
NOM
28
MAX
28
.100
2.54
.140
.150
.160
3.56
3.81
4.06
A2
.125
.130
.135
3.18
3.30
3.43
8.26
A1
.015
.300
.310
.325
7.62
7.87
E1
.275
.285
.295
6.99
7.24
7.49
Overall Length
1.345
1.365
1.385
34.16
34.67
35.18
L
c
.125
.130
.135
3.18
3.30
3.43
.008
.012
.015
0.20
0.29
0.38
B1
.040
.053
.065
1.02
1.33
1.65
Lead Thickness
Upper Lead Width
Lower Lead Width
Overall Row Spacing
Mold Draft Angle Top
Mold Draft Angle Bottom
0.38
.016
.019
.022
0.41
0.48
0.56
eB
.320
.350
.430
8.13
8.89
10.92
10
15
10
15
10
15
10
15
* Controlling Parameter
Significant Characteristic
Notes:
Dimension D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed
.010 (0.254mm) per side.
JEDEC Equivalent: MO-095
DS30498C-page 253
PIC16F7X7
28-Lead Plastic Small Outline (SO) Wide, 300 mil Body (SOIC)
E
E1
p
B
2
1
n
h
45
c
A2
L
Units
Dimension Limits
n
p
Number of Pins
Pitch
Overall Height
Molded Package Thickness
Standoff
Overall Width
Molded Package Width
Overall Length
Chamfer Distance
Foot Length
Foot Angle Top
Lead Thickness
Lead Width
Mold Draft Angle Top
Mold Draft Angle Bottom
* Controlling Parameter
Significant Characteristic
A
A2
A1
E
E1
D
h
L
c
B
A1
MIN
.093
.088
.004
.394
.288
.695
.010
.016
0
.009
.014
0
0
INCHES*
NOM
28
.050
.099
.091
.008
.407
.295
.704
.020
.033
4
.011
.017
12
12
MAX
.104
.094
.012
.420
.299
.712
.029
.050
8
.013
.020
15
15
MILLIMETERS
NOM
28
1.27
2.36
2.50
2.24
2.31
0.10
0.20
10.01
10.34
7.32
7.49
17.65
17.87
0.25
0.50
0.41
0.84
0
4
0.23
0.28
0.36
0.42
0
12
0
12
MIN
MAX
2.64
2.39
0.30
10.67
7.59
18.08
0.74
1.27
8
0.33
0.51
15
15
Notes:
Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed
.010 (0.254mm) per side.
JEDEC Equivalent: MS-013
Drawing No. C04-052
DS30498C-page 254
PIC16F7X7
28-Lead Plastic Shrink Small Outline (SS) 209 mil Body, 5.30 mm (SSOP)
E
E1
p
B
2
1
A
c
A2
f
A1
L
Units
Dimension Limits
n
p
MIN
INCHES
NOM
28
.026
.069
.307
.209
.402
.030
4
-
MAX
MILLIMETERS*
NOM
28
0.65
1.65
1.75
0.05
7.49
7.80
5.00
5.30
9.90
10.20
0.55
0.75
0.09
0
4
0.22
-
MIN
Number of Pins
Pitch
Overall Height
A
.079
Molded Package Thickness
A2
.065
.073
Standoff
A1
.002
Overall Width
E
.295
.323
Molded Package Width
E1
.009
.220
Overall Length
D
.390
.413
Foot Length
L
.022
.037
c
Lead Thickness
.004
.010
f
Foot Angle
0
8
Lead Width
B
.009
.015
*Controlling Parameter
Notes:
Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions
shall not exceed .010" (0.254mm) per side.
MAX
2.0
1.85
8.20
5.60
10.50
0.95
0.25
8
0.38
DS30498C-page 255
PIC16F7X7
28-Lead Plastic Quad Flat No Lead Package (ML) 6x6 mm Body (QFN)
With 0.55 mm Contact Length (Saw Singulated)
E
E2
EXPOSED
METAL
PAD
D2
b
2
1
n
OPTIONAL
INDEX
AREA
TOP VIEW
ALTERNATE
INDEX
INDICATORS
SEE DETAIL
BOTTOM VIEW
A1
A
DETAIL
ALTERNATE
PAD OUTLINE
Number of Pins
Pitch
Overall Height
Standoff
Contact Thickness
Overall Width
Exposed Pad Width
Overall Length
Exposed Pad Length
Contact Width
Contact Length
Units
Dimension Limits
n
e
A
A1
A3
E
E2
D
D2
b
L
MIN
.031
.000
.232
.140
.232
.140
.009
.020
INCHES
NOM
28
.026 BSC
.035
.001
.008 REF
.236
.146
.236
.146
.011
.024
MAX
MIN
.039
.002
0.80
0.00
.240
.152
.240
.152
.013
.028
5.90
3.55
5.90
3.55
0.23
0.50
MILLIMETERS*
NOM
28
0.65 BSC
0.90
0.02
0.20 REF
6.00
3.70
6.00
3.70
0.28
0.60
MAX
1.00
0.05
6.10
3.85
6.10
3.85
0.33
0.70
*Controlling Parameter
Notes:
JEDEC equivalent: MO-220
Drawing No. C04-105
DS30498C-page 256
Revised 05-24-04
PIC16F7X7
40-Lead Plastic Dual In-line (P) 600 mil Body (PDIP)
E1
2
1
n
E
A2
B1
A1
eB
B
Units
Dimension Limits
n
p
MIN
INCHES*
NOM
40
.100
.175
.150
MAX
MILLIMETERS
NOM
40
2.54
4.06
4.45
3.56
3.81
0.38
15.11
15.24
13.46
13.84
51.94
52.26
3.05
3.30
0.20
0.29
0.76
1.27
0.36
0.46
15.75
16.51
5
10
5
10
MIN
Number of Pins
Pitch
Top to Seating Plane
A
.160
.190
Molded Package Thickness
A2
.140
.160
Base to Seating Plane
.015
A1
Shoulder to Shoulder Width
E
.595
.600
.625
Molded Package Width
E1
.530
.545
.560
Overall Length
D
2.045
2.058
2.065
Tip to Seating Plane
L
.120
.130
.135
c
Lead Thickness
.008
.012
.015
Upper Lead Width
B1
.030
.050
.070
Lower Lead Width
B
.014
.018
.022
Overall Row Spacing
eB
.620
.650
.680
MAX
4.83
4.06
15.88
14.22
52.45
3.43
0.38
1.78
0.56
17.27
15
15
DS30498C-page 257
PIC16F7X7
44-Lead Plastic Thin Quad Flatpack (PT) 10x10x1 mm Body, 1.0/0.10 mm Lead Form (TQFP)
E
E1
#leads=n1
p
D1
2
1
B
n
CH x 45
A
c
A1
A2
(F)
Units
Dimension Limits
n
p
Number of Pins
Pitch
Pins per Side
Overall Height
Molded Package Thickness
Standoff
Foot Length
Footprint (Reference)
Foot Angle
Overall Width
Overall Length
Molded Package Width
Molded Package Length
Lead Thickness
Lead Width
Pin 1 Corner Chamfer
Mold Draft Angle Top
Mold Draft Angle Bottom
* Controlling Parameter
Significant Characteristic
n1
A
A2
A1
L
(F)
E
D
E1
D1
c
B
CH
MIN
.039
.037
.002
.018
0
.463
.463
.390
.390
.004
.012
.025
5
5
INCHES
NOM
44
.031
11
.043
.039
.004
.024
.039
3.5
.472
.472
.394
.394
.006
.015
.035
10
10
MAX
.047
.041
.006
.030
7
.482
.482
.398
.398
.008
.017
.045
15
15
MILLIMETERS*
NOM
44
0.80
11
1.00
1.10
0.95
1.00
0.05
0.10
0.45
0.60
1.00
0
3.5
11.75
12.00
11.75
12.00
9.90
10.00
9.90
10.00
0.09
0.15
0.30
0.38
0.64
0.89
5
10
5
10
MIN
MAX
1.20
1.05
0.15
0.75
7
12.25
12.25
10.10
10.10
0.20
0.44
1.14
15
15
Notes:
Dimensions D1 and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed
.010 (0.254mm) per side.
JEDEC Equivalent: MS-026
Drawing No. C04-076
DS30498C-page 258
PIC16F7X7
44-Lead Plastic Quad Flat No Lead Package (ML) 8x8 mm Body (QFN)
DS30498C-page 259
PIC16F7X7
NOTES:
DS30498C-page 260
PIC16F7X7
APPENDIX A:
REVISION HISTORY
APPENDIX B:
DEVICE
DIFFERENCES
TABLE B-1:
DEVICE DIFFERENCES
Difference
PIC16F737
PIC16F747
PIC16F767
PIC16F777
4K
4K
8K
8K
368
368
368
368
I/O Ports
A/D
Parallel Slave Port
Interrupt Sources
Packages
11 channels,
10 bits
14 channels,
10 bits
11 channels,
10 bits
14 channels,
10 bits
No
Yes
No
Yes
16
17
16
17
28-pin PDIP
28-pin SOIC
28-pin SSOP
28-pin QFN
40-pin PDIP
44-pin QFN
44-pin TQFP
28-pin PDIP
28-pin SOIC
28-pin SSOP
28-pin QFN
40-pin PDIP
44-pin QFN
44-pin TQFP
DS30498C-page 261
PIC16F7X7
APPENDIX C:
CONVERSION
CONSIDERATIONS
TABLE C-1:
CONVERSION CONSIDERATIONS
Characteristic
PIC16C7X
PIC16F87X
PIC16F7X7
28/40
28/40
28/40
11 or 12
13 or 14
16 or 17
20 MHz
20 MHz
20 MHz
A/D
8-bit
10-bit
10-bit
CCP
Program Memory
4K, 8K EPROM
4K, 8K Flash
(1,000 E/W cycles)
4K, 8K Flash
(100 E/W cycles)
RAM
368 bytes
Pins
Timers
Interrupts
Communication
Frequency
EEPROM Data
Other
DS30498C-page 262
None
None
In-Circuit Debugger,
Low-Voltage Programming
In-Circuit Debugger
PIC16F7X7
INDEX
A
Asynchronous Transmission
Associated Registers........................................ 139
Setup ................................................................ 139
Baud Rate Generator (BRG) .................................... 135
Associated Registers........................................ 135
Baud Rate Formula .......................................... 135
Baud Rates, Asynchronous Mode
(BRGH = 0)............................................... 136
Baud Rates, Asynchronous Mode
(BRGH = 1)............................................... 136
High Baud Rate Select (BRGH Bit) .................. 133
INTRC Baud Rates, Asynchronous Mode
(BRGH = 0)............................................... 137
INTRC Baud Rates, Asynchronous Mode
(BRGH = 1)............................................... 137
Sampling .......................................................... 135
Clock Source Select (CSRC Bit) .............................. 133
Continuous Receive Enable
(CREN Bit)........................................................ 134
Framing Error (FERR Bit) ......................................... 134
Overrun Error (OERR Bit)......................................... 134
Receive Data, 9th Bit (RX9D Bit).............................. 134
Receive Enable, 9-Bit (RX9 Bit) ............................... 134
Serial Port Enable (SPEN Bit) .......................... 133, 134
Single Receive Enable (SREN Bit)........................... 134
Synchronous Master Mode....................................... 144
Reception ......................................................... 146
Transmission .................................................... 144
Synchronous Master Reception
Associated Registers........................................ 146
Setup ................................................................ 146
Synchronous Master Transmission
Associated Registers........................................ 145
Setup ................................................................ 144
Synchronous Slave Mode......................................... 148
Reception ......................................................... 149
Transmit............................................................ 148
Synchronous Slave Reception
Associated Registers........................................ 149
Setup ................................................................ 149
Synchronous Slave Transmission
Associated Registers........................................ 148
Setup ................................................................ 148
Transmit Data, 9th Bit (TX9D) .................................. 133
Transmit Enable (TXEN Bit) ..................................... 133
Transmit Enable, 9-Bit (TX9 Bit)............................... 133
Transmit Shift Register Status
(TRMT Bit) ........................................................ 133
A/D
A/D Converter Interrupt, Configuring ........................ 155
Acquisition Requirements ......................................... 156
ADRESH Register..................................................... 154
Analog Port Pins ......................................................... 68
Analog-to-Digital Converter....................................... 151
Associated Registers ................................................ 160
Automatic Acquisition Time....................................... 157
Calculating Acquisition Time..................................... 156
Configuring Analog Port Pins.................................... 158
Configuring the Module............................................. 155
Conversion Clock...................................................... 157
Conversion Requirements ........................................ 236
Conversion Status (GO/DONE Bit) ........................... 154
Conversions .............................................................. 159
Delays ....................................................................... 156
Effects of a Reset...................................................... 160
Internal Sampling Switch (Rss)
Impedance ........................................................ 156
Operation During Sleep ............................................ 160
Operation in Power-Managed Modes ....................... 158
Source Impedance.................................................... 156
Time Delays .............................................................. 156
Use of the CCP Trigger............................................. 160
Absolute Maximum Ratings .............................................. 207
ACKSTAT ......................................................................... 123
ACKSTAT Status Flag ...................................................... 123
ADCON0 Register
GO/DONE Bit............................................................ 154
Addressable Universal Synchronous Asynchronous
Receiver Transmitter. See AUSART
ADRESL Register ............................................................. 154
Application Notes
AN546 (Using the Analog-to-Digital (A/D)
Converter) ......................................................... 151
AN552 (Implementing Wake-up
on Key Stroke) .................................................... 56
AN556 (Implementing a Table Read) ......................... 29
AN607 (Power-up Trouble Shooting)........................ 173
Assembler
MPASM Assembler................................................... 201
AUSART
Address Detect Enable (ADDEN Bit) ........................ 134
Addressable Universal Synchronous
Asynchronous Receiver Transmitter................. 133
Asynchronous
Receiver
(9-Bit Mode) .............................................. 142
Asynchronous Mode ................................................. 138
Receiver............................................................ 140
Transmitter........................................................ 138
Asynchronous Receive with Address Detect.
See Asynchronous Receive (9-bit Mode).
Asynchronous Reception
Associated Registers ................................ 141, 143
Setup ................................................................ 141
Asynchronous Reception with Address Detect
Setup ................................................................ 142
B
Banking, Data Memory ....................................................... 15
Baud Rate Generator ....................................................... 119
BF ..................................................................................... 123
BF Status Flag .................................................................. 123
DS30498C-page 263
PIC16F7X7
Block Diagrams
A/D ............................................................................ 155
Analog Input Model ........................................... 156, 165
AUSART Receive ............................................. 140, 142
AUSART Transmit .................................................... 138
Baud Rate Generator ................................................ 119
Capture Mode Operation ............................................ 89
Comparator I/O Operating Modes............................. 162
Comparator Output ................................................... 164
Comparator Voltage Reference ................................ 168
Compare ..................................................................... 89
Fail-Safe Clock Monitor............................................. 189
In-Circuit Serial Programming
Connections ...................................................... 192
Interrupt Logic ........................................................... 184
Low-Voltage Detect (LVD) ........................................ 175
Low-Voltage Detect (LVD) with
External Input.................................................... 175
Low-Voltage Detect Characteristics .......................... 221
MSSP (I2C Master Mode) ......................................... 117
MSSP (I2C Mode) ..................................................... 102
MSSP (SPI Mode)....................................................... 93
On-Chip Reset Circuit ............................................... 172
OSC1/CLKI/RA7 Pin ................................................... 54
OSC2/CLKO/RA6 Pin ................................................. 53
PIC16F737 and PIC16F767.......................................... 6
PIC16F747 and PIC16F777.......................................... 7
PORTC (Peripheral Output Override)
RC<2:0>, RC<7:5> Pins ..................................... 65
PORTC (Peripheral Output Override)
RC<4:3> Pins...................................................... 65
PORTD (In I/O Port Mode).......................................... 67
PORTD and PORTE
(Parallel Slave Port) ............................................ 70
PORTE (In I/O Port Mode) .......................................... 68
PWM Mode ................................................................. 91
RA0/AN0:RA1/AN1 Pins ............................................. 50
RA2/AN2/VREF-/CVREF Pin......................................... 51
RA3/AN3/VREF+ Pin.................................................... 50
RA4/T0CKI/C1OUT Pin .............................................. 51
RA5/AN4/LVDIN/SS/C2OUT Pin ................................ 52
RB0/INT/AN12 Pin ...................................................... 57
RB1/AN10 Pin ............................................................. 57
RB2/AN8 Pin ............................................................... 58
RB3/CCP2/AN9 Pin .................................................... 59
RB4/AN11 Pin ............................................................. 60
RB5/AN13/CCP3 Pin .................................................. 61
RB6/PGC Pin .............................................................. 62
RB7/PGD Pin .............................................................. 63
Recommended MCLR Circuit ................................... 173
System Clock .............................................................. 39
Timer0/WDT Prescaler ............................................... 73
Timer1 ......................................................................... 79
Timer2 ......................................................................... 85
Watchdog Timer (WDT) ............................................ 186
BOR. See Brown-out Reset.
BRG. See Baud Rate Generator.
BRGH Bit........................................................................... 135
Brown-out Reset (BOR) .................... 169, 172, 173, 179, 180
DS30498C-page 264
C
C Compilers
MPLAB C17 .............................................................. 202
MPLAB C18 .............................................................. 202
MPLAB C30 .............................................................. 202
Capture/Compare/PWM (CCP) .......................................... 87
Capture Mode ............................................................. 89
CCP Pin Configuration ....................................... 89
Prescaler ............................................................ 89
Compare Mode ........................................................... 89
CCP Pin Configuration ....................................... 90
Software Interrupt Mode ..................................... 90
Special Event Trigger ......................................... 90
Special Event Trigger Output ............................. 90
Timer1 Mode Selection....................................... 90
Interaction of Two CCP Modules ................................ 87
PWM Mode ................................................................. 91
Duty Cycle .......................................................... 91
Example Frequencies and
Resolutions................................................. 92
Period ................................................................. 91
Setup for Operation ............................................ 92
Registers Associated with Capture,
Compare and Timer1.......................................... 90
Registers Associated with PWM
and Timer2 ......................................................... 92
Timer Resources ........................................................ 87
CCP1 Module ..................................................................... 87
CCP2 Module ..................................................................... 87
CCP3 Module ..................................................................... 87
CCPR1H Register............................................................... 87
CCPR1L Register ............................................................... 87
CCPR2H Register............................................................... 87
CCPR2L Register ............................................................... 87
CCPR3H Register............................................................... 87
CCPR3L Register ............................................................... 87
CCPxM<3:0> Bits ............................................................... 88
CCPxX and CCPxY Bits ..................................................... 88
Clock Sources..................................................................... 37
Selection Using OSCCON Register............................ 37
Clock Switching .................................................................. 37
Modes (table).............................................................. 47
Transition and the Watchdog Timer............................ 38
Code Examples
Call of a Subroutine in Page 1
from Page 0 ........................................................ 29
Changing Between Capture Prescalers...................... 89
Changing Prescaler Assignment from
WDT to Timer0 ................................................... 76
Flash Program Read................................................... 32
Implementing a Real-Time Clock Using a
Timer1 Interrupt Service ..................................... 82
Indirect Addressing ..................................................... 30
Initializing PORTA....................................................... 49
Loading the SSPBUF (SSPSR) Register.................... 96
Reading a 16-Bit Free Running Timer ........................ 80
Saving Status and W Registers in RAM ................... 185
Writing a 16-Bit Free Running Timer .......................... 80
Code Protection ........................................................ 169, 192
PIC16F7X7
Comparator Module .......................................................... 161
Analog Input Connection
Considerations .................................................. 165
Associated Registers ................................................ 165
Configuration............................................................. 162
Effects of a Reset...................................................... 165
Interrupts................................................................... 164
Operation .................................................................. 163
Operation During Sleep ............................................ 165
Outputs ..................................................................... 163
Reference ................................................................. 163
External Signal.................................................. 163
Internal Signal ................................................... 163
Response Time......................................................... 163
Comparator Specifications ................................................ 220
Comparator Voltage Reference ........................................ 167
Associated Registers ................................................ 168
Computed GOTO ................................................................ 29
Configuration Bits.............................................................. 169
Conversion Considerations ............................................... 262
Crystal and Ceramic Resonators ........................................ 33
D
Data Memory ...................................................................... 15
Bank Select (RP1:RP0 Bits) ....................................... 15
General Purpose Registers......................................... 15
Map for PIC16F737 and
PIC16F767.......................................................... 16
Map for PIC16F747 and
PIC16F777.......................................................... 17
Special Function Registers ......................................... 18
DC and AC Characteristics
Graphs and Tables ................................................... 237
DC Characteristics .................................................... 209, 218
Internal RC Accuracy ................................................ 217
Power-Down and Supply Current ............................. 210
Demonstration Boards
PICDEM 1 ................................................................. 204
PICDEM 17 ............................................................... 205
PICDEM 18R ............................................................ 205
PICDEM 2 Plus ......................................................... 204
PICDEM 3 ................................................................. 204
PICDEM 4 ................................................................. 204
PICDEM LIN ............................................................. 205
PICDEM USB............................................................ 205
PICDEM.net Internet/Ethernet .................................. 204
Development Support ....................................................... 201
Device Differences ............................................................ 261
Device Overview ................................................................... 5
Features........................................................................ 5
Direct Addressing................................................................ 30
E
Electrical Characteristics................................................... 207
Errata .................................................................................... 4
Evaluation and Programming Tools .................................. 205
External Clock Input ............................................................ 34
F
Fail-Safe Clock Monitor............................................. 169, 189
FSR Register ...................................................................... 30
I
I/O Ports ............................................................................. 49
I2 Mode
Operation.................................................................. 106
I2 Slave Mode
Clock Stretching, 10-bit Receive Mode
(SEN = 1).......................................................... 112
Clock Stretching, 10-bit Transmit Mode ................... 112
Clock Stretching, 7-bit Receive Mode
(SEN = 1).......................................................... 112
Clock Stretching, 7-bit Transmit Mode ..................... 112
I2C Master Mode............................................................... 117
Clock Arbitration ....................................................... 120
Operation.................................................................. 118
Reception ................................................................. 123
Repeated Start Condition Timing ............................. 122
Start Condition Timing .............................................. 121
Transmission ............................................................ 123
I2C Mode .......................................................................... 102
ACK Pulse ........................................................ 106, 107
Acknowledge Sequence Timing ............................... 126
Baud Rate Generator ............................................... 119
Bus Collision
Repeated Start Condition ................................. 130
Start Condition.................................................. 128
Stop Condition .................................................. 131
Clock Synchronization and the CKP Bit ................... 113
Effect of a Reset ....................................................... 127
General Call Address Support .................................. 116
Multi-Master Communication, Bus Collision
and Arbitration .................................................. 127
Multi-Master Mode.................................................... 127
Read/Write Bit Information (R/W Bit)........................ 107
Registers .................................................................. 102
Serial Clock (RC3/SCK/SCL) ................................... 107
Sleep Operation........................................................ 127
Stop Condition Timing .............................................. 126
I2C Slave Mode ................................................................ 106
Addressing................................................................ 106
Clock Stretching ....................................................... 112
Reception ................................................................. 107
Transmission ............................................................ 107
ID Locations.............................................................. 169, 192
In-Circuit Debugger........................................................... 192
In-Circuit Serial Programming........................................... 169
In-Circuit Serial Programming (ICSP)............................... 192
INDF Register ..................................................................... 30
Indirect Addressing ............................................................. 30
FSR Register .............................................................. 15
Instruction Set
ADDLW..................................................................... 195
ADDWF .................................................................... 195
ANDLW..................................................................... 195
ANDWF .................................................................... 195
BCF .......................................................................... 195
BSF........................................................................... 195
BTFSC...................................................................... 195
BTFSS ...................................................................... 195
CALL......................................................................... 196
CLRF ........................................................................ 196
DS30498C-page 265
PIC16F7X7
CLRW ....................................................................... 196
CLRWDT................................................................... 196
COMF ....................................................................... 196
DECF ........................................................................ 196
DECFSZ.................................................................... 197
Firmware Instructions................................................ 193
General Format ......................................................... 193
GOTO ....................................................................... 197
INCF.......................................................................... 197
INCFSZ ..................................................................... 197
IORLW ...................................................................... 197
IORWF ...................................................................... 197
MOVF........................................................................ 198
MOVLW .................................................................... 198
MOVWF .................................................................... 198
NOP .......................................................................... 198
Opcode Field Descriptions ........................................ 193
Read-Modify-Write Operations ................................. 193
RETFIE ..................................................................... 198
RETLW ..................................................................... 198
RETURN ................................................................... 199
RLF ........................................................................... 199
RRF........................................................................... 199
SLEEP ...................................................................... 199
SUBLW ..................................................................... 199
SUBWF ..................................................................... 199
SWAPF ..................................................................... 200
XORLW ..................................................................... 200
XORWF..................................................................... 200
Summary Table......................................................... 194
INT Interrupt (RB0/INT). See Interrupt Sources.
INTCON Register
GIE Bit......................................................................... 23
INT0IE Bit.................................................................... 23
INT0IF Bit .................................................................... 23
PEIE Bit....................................................................... 23
RBIF Bit................................................................. 23, 56
TMR0IE Bit.................................................................. 23
Inter-Integrated Circuit. See I2C.
Internal Oscillator Block ...................................................... 35
INTRC Modes ............................................................. 36
Interrupt Sources....................................................... 169, 184
A/D Conversion Complete ........................................ 155
Interrupt-on-Change (RB7:RB4) ................................. 56
RB0/INT Pin, External ............................................... 185
TMR0 Overflow ......................................................... 185
Interrupts
Exiting Sleep with........................................................ 48
Synchronous Serial Port Interrupt ............................... 25
Interrupts, Context Saving During ..................................... 185
Interrupts, Enable Bits
Global Interrupt Enable (GIE Bit) ........................ 23, 184
Interrupt-on-Change (RB7:RB4)
Enable (RBIE Bit).............................................. 185
Peripheral Interrupt Enable (PEIE Bit) ........................ 23
RB0/INT Enable (INT0IE Bit) ...................................... 23
TMR0 Overflow Enable (TMR0IE Bit) ......................... 23
Interrupts, Flag Bits
Interrupt-on Change (RB7:RB4)
Flag (RBIF Bit) .................................................... 23
Interrupt-on-Change (RB7:RB4)
Flag (RBIF Bit) ...................................... 23, 56, 185
RB0/INT Flag (INT0IF Bit)........................................... 23
TMR0 Overflow Flag (TMR0IF Bit) ........................... 185
INTRC Modes
Adjustment .................................................................. 36
DS30498C-page 266
L
Load Conditions................................................................ 222
Loading of PC ..................................................................... 29
Low-Voltage Detect .......................................................... 174
Characteristics .......................................................... 221
Effects of a Reset ..................................................... 178
Operation .................................................................. 177
Current Consumption ....................................... 178
Reference Voltage Set Point ............................ 178
Operation During Sleep ............................................ 178
Time-out Sequence .................................................. 178
Low-Voltage Detect (LVD) ................................................ 169
LVD. See Low-Voltage Detect.
M
Master Clear (MCLR)
MCLR Reset, Normal Operation............... 172, 179, 180
MCLR Reset, Sleep .................................. 172, 179, 180
Master Synchronous Serial Port (MSSP).
See MSSP.
Master Synchronous Serial Port. See MSSP
MCLR/VPP/RE3 Pin .............................................................. 8
MCLR/VPP/RE3 Pin ............................................................ 11
Memory Organization ......................................................... 15
Data Memory .............................................................. 15
Program Memory ........................................................ 15
Program Memory and Stack Maps ............................. 15
MPLAB ASM30 Assembler, Linker, Librarian ................... 202
MPLAB ICD 2 In-Circuit Debugger ................................... 203
MPLAB ICE 2000 High-Performance
Universal In-Circuit Emulator .................................... 203
MPLAB ICE 4000 High-Performance
Universal In-Circuit Emulator .................................... 203
MPLAB Integrated Development
Environment Software .............................................. 201
MPLAB PM3 Device Programmer .................................... 203
MPLINK Object Linker/MPLIB Object Librarian ................ 202
MSSP.................................................................................. 93
I2C Mode. See I2C.
SPI Mode. See SPI.
MSSP Module
Control Registers (General)........................................ 93
Overview..................................................................... 93
Multi-Master Mode ............................................................ 127
O
OPTION_REG Register
INTEDG Bit ................................................................. 22
PS2:PS0 Bits .............................................................. 22
PSA Bit ....................................................................... 22
RBPU Bit .................................................................... 22
T0CS Bit ..................................................................... 22
T0SE Bit ..................................................................... 22
OSC1/CLKI/RA7 Pin....................................................... 8, 11
OSC2/CLKO/RA6 Pin ..................................................... 8, 11
Oscillator Configuration ...................................................... 33
ECIO ........................................................................... 33
EXTRC ..................................................................... 179
HS....................................................................... 33, 179
INTIO1 ........................................................................ 33
INTIO2 ........................................................................ 33
INTRC....................................................................... 179
LP ....................................................................... 33, 179
RC ........................................................................ 33, 35
RCIO........................................................................... 33
XT ....................................................................... 33, 179
PIC16F7X7
Oscillator Control Register
Modifying IRCF Bits .................................................... 39
Clock Transition Sequence ................................. 40
Oscillator Delay upon Power-up, Wake-up
and Clock Switching.................................................... 40
Oscillator Start-up Timer (OST) ................................ 169, 173
Oscillator Switching............................................................. 37
P
Packaging ......................................................................... 251
Details ....................................................................... 253
Marking Information .................................................. 251
Paging, Program Memory ................................................... 29
Parallel Slave Port
Associated Registers .................................................. 71
Parallel Slave Port (PSP) .............................................. 67, 70
RE0/RD/AN5 Pin......................................................... 68
RE1/WR/AN6 Pin........................................................ 68
RE2/CS/AN7 Pin......................................................... 68
Select (PSPMODE Bit) ......................................... 67, 68
PCL Register....................................................................... 29
PCLATH Register ............................................................... 29
PCON Register ................................................................. 178
POR Bit ....................................................................... 28
Peripheral Interrupt (PEIE Bit) ............................................ 23
PICkit 1 Flash Starter Kit................................................... 205
PICSTART Plus Development Programmer ..................... 204
Pinout Descriptions
PIC16F737/PIC16F767........................................... 810
PIC16F747/PIC16F777......................................... 1114
PMADR Register................................................................. 31
POP .................................................................................... 29
POR. See Power-on Reset.
PORTA............................................................................ 8, 11
Associated Registers .................................................. 55
PORTA Register ......................................................... 49
TRISA Register ........................................................... 49
PORTA Register ................................................................. 49
PORTB............................................................................ 9, 12
Associated Registers .................................................. 64
PORTB Register ......................................................... 56
Pull-up Enable (RBPU Bit) .......................................... 22
RB0/INT Edge Select (INTEDG Bit)............................ 22
RB0/INT Pin, External............................................... 185
RB7:RB4 Interrupt-on-Change.................................. 185
RB7:RB4 Interrupt-on-Change
Enable (RBIE Bit).............................................. 185
RB7:RB4 Interrupt-on-Change
Flag (RBIF Bit) ...................................... 23, 56, 185
TRISB Register ........................................................... 56
PORTB Register ................................................................. 56
PORTC ......................................................................... 10, 13
Associated Registers .................................................. 66
PORTC Register ......................................................... 65
RC3/SCK/SCL Pin .................................................... 107
RC6/TX/CK Pin ......................................................... 134
RC7/RX/DT Pin................................................. 134, 135
TRISC Register................................................... 65, 133
PORTC Register ................................................................. 65
PORTD ............................................................................... 14
Associated Registers .................................................. 67
Parallel Slave Port (PSP) Function ............................. 67
PORTD Register ......................................................... 67
TRISD Register........................................................... 67
PORTD Register................................................................. 67
PORTE ............................................................................... 14
Analog Port Pins......................................................... 68
Associated Registers.................................................. 68
Input Buffer Full Status (IBF Bit)................................. 69
Input Buffer Overflow (IBOV Bit)................................. 69
PORTE Register......................................................... 68
PSP Mode Select (PSPMODE Bit)....................... 67, 68
RE0/RD/AN5 Pin ........................................................ 68
RE1/WR/AN6 Pin ....................................................... 68
RE2/CS/AN7 Pin ........................................................ 68
TRISE Register........................................................... 68
PORTE Register ................................................................. 68
Postscaler, WDT
Assignment (PSA Bit) ................................................. 22
Rate Select (PS2:PS0 Bits) ........................................ 22
Power-Down Mode (Sleep)............................................... 190
Power-Down Mode. See Sleep.
Power-Managed Modes...................................................... 41
RC_RUN..................................................................... 41
SEC_RUN .................................................................. 42
SEC_RUN/RC_RUN to
Primary Clock Source......................................... 43
Power-on Reset (POR)..................... 169, 172, 173, 179, 180
POR Status (POR Bit) ................................................ 28
Power Control/Status
(PCON) Register .............................................. 178
Power-Down (PD Bit) ............................................... 172
Time-out (TO Bit)................................................ 21, 172
Power-up Timer (PWRT) .......................................... 169, 173
PR2 Register ...................................................................... 85
Prescaler, Timer0
Assignment (PSA Bit) ................................................. 22
Rate Select (PS2:PS0 Bits) ........................................ 22
PRO MATE II Universal Device
Programmer.............................................................. 203
Program Counter
Reset Conditions ...................................................... 179
Program Memory
Flash
Associated Registers.......................................... 32
Interrupt Vector........................................................... 15
Memory and Stack Maps ............................................ 15
Operation During Code-Protect .................................. 32
Organization ............................................................... 15
Paging ........................................................................ 29
PMADR Register ........................................................ 31
PMADRH Register...................................................... 31
Reading ...................................................................... 31
Reading Flash ............................................................ 32
Reading, PMADR Register......................................... 31
Reading, PMADRH Register ...................................... 31
Reading, PMCON1 Register ...................................... 31
Reading, PMDATA Register....................................... 31
Reading, PMDATH Register....................................... 31
Reset Vector............................................................... 15
Program Verification ......................................................... 192
Programming, Device Instructions.................................... 193
PUSH.................................................................................. 29
DS30498C-page 267
PIC16F7X7
R
RA0/AN0 Pin ................................................................... 8, 11
RA1/AN1 Pin ................................................................... 8, 11
RA2/AN2/VREF-/CVREF Pin ............................................. 8, 11
RA3/AN3/VREF+ Pin........................................................ 8, 11
RA4/T0CKI/C1OUT Pin................................................... 8, 11
RA5/AN4/LVDIN/SS/C2OUT Pin .................................... 8, 11
RAM. See Data Memory.
RB0/INT/AN12 Pin .......................................................... 9, 12
RB1/AN10 Pin ................................................................. 9, 12
RB2/AN8 Pin ................................................................... 9, 12
RB3/CCP2/AN9 Pin ........................................................ 9, 12
RB4/AN11 Pin ................................................................. 9, 12
RB5/AN13/CCP3 Pin ...................................................... 9, 12
RB6/PGC Pin .................................................................. 9, 12
RB7/PGD Pin .................................................................. 9, 12
RC0/T1OSO/T1CKI Pin ................................................ 10, 13
RC1/T1OSI/CCP2 Pin................................................... 10, 13
RC2/CCP1 Pin .............................................................. 10, 13
RC3/SCK/SCL Pin ........................................................ 10, 13
RC4/SDI/SDA Pin ......................................................... 10, 13
RC5/SDO Pin ................................................................ 10, 13
RC6/TX/CK Pin ............................................................. 10, 13
RC7/RX/DT Pin ............................................................. 10, 13
RCIO Oscillator ................................................................... 35
RCSTA Register
ADDEN Bit ................................................................ 134
CREN Bit................................................................... 134
FERR Bit ................................................................... 134
OERR Bit .................................................................. 134
RX9 Bit ...................................................................... 134
RX9D Bit ................................................................... 134
SPEN Bit ........................................................... 133, 134
SREN Bit ................................................................... 134
RD0/PSP0 Pin..................................................................... 14
RD1/PSP1 Pin..................................................................... 14
RD2/PSP2 Pin..................................................................... 14
RD3/PSP3 Pin..................................................................... 14
RD4/PSP4 Pin..................................................................... 14
RD5/PSP5 Pin..................................................................... 14
RD6/PSP6 Pin..................................................................... 14
RD7/PSP7 Pin..................................................................... 14
RE0/RD/AN5 Pin................................................................. 14
RE1/WR/AN6 Pin ................................................................ 14
RE2/CS/AN7 Pin ................................................................. 14
Register File ........................................................................ 15
Registers
ADCON0 (A/D Control 0) .......................................... 152
ADCON1 (A/D Control 1) .......................................... 153
ADCON2 (A/D Control 2) .......................................... 154
CCPxCON (CCPx Control) ......................................... 88
CMCON (Comparator Control) ................................. 161
CVRCON (Comparator Voltage
Reference Control)............................................ 167
Initialization Conditions (table) .......................... 180181
INTCON (Interrupt Control) ......................................... 23
LVDCON (Low-Voltage Detect Control).................... 176
OPTION_REG (Option Control) ............................ 22, 75
OSCCON (Oscillator Control) ..................................... 38
OSCTUNE (Oscillator Tuning) .................................... 36
PCON (Power Control/Status) .................................... 28
PIE1 (Peripheral Interrupt Enable 1) ........................... 24
PIE2 (Peripheral Interrupt Enable 2) ........................... 26
PIR1 (Peripheral Interrupt
Request (Flag) 1) ................................................ 25
DS30498C-page 268
S
SCI. See AUSART.
SCK .................................................................................... 93
SDI...................................................................................... 93
SDO .................................................................................... 93
Serial Clock, SCK ............................................................... 93
Serial Communication Interface. See AUSART.
Serial Data In, SDI .............................................................. 93
Serial Data Out, SDO ......................................................... 93
Serial Peripheral Interface. See SPI.
Slave Select, SS ................................................................. 93
Sleep................................................................. 169, 172, 190
Software Simulator (MPLAB SIM) .................................... 202
Software Simulator (MPLAB SIM30) ................................ 202
Special Features of the CPU ............................................ 169
Special Function Registers ..................................... 18, 1820
SPI Master Mode ................................................................ 98
SPI Mode ............................................................................ 93
Associated Registers ................................................ 101
Bus Mode Compatibility ............................................ 101
Clock........................................................................... 98
Effects of a Reset ..................................................... 101
Enabling SPI I/O ......................................................... 97
Master/Slave Connection............................................ 97
Serial Clock................................................................. 93
Serial Data In .............................................................. 93
Serial Data Out ........................................................... 93
Slave Select................................................................ 93
Slave Select Synchronization ..................................... 99
Sleep Operation........................................................ 101
Typical Connection ..................................................... 97
SPI Slave Mode .................................................................. 99
PIC16F7X7
SS ....................................................................................... 93
SSPBUF.............................................................................. 98
SSPIF Bit ............................................................................ 25
SSPOV.............................................................................. 123
SSPOV Status Flag .......................................................... 123
SSPSR ................................................................................ 98
SSPSTAT Register
R/W Bit...................................................................... 107
Stack ................................................................................... 29
Overflows .................................................................... 29
Underflows .................................................................. 29
Status Register
C Bit ............................................................................ 21
DC Bit.......................................................................... 21
IRP Bit......................................................................... 21
PD Bit.................................................................. 21, 172
TO Bit.................................................................. 21, 172
Z Bit............................................................................. 21
Synchronous Serial Port
Interrupt Flag Bit (SSPIF)........................................... 25
T
T1CKPS0 Bit ....................................................................... 78
T1CKPS1 Bit ....................................................................... 78
T1OSCEN Bit ...................................................................... 78
T1SYNC Bit......................................................................... 78
T2CKPS0 Bit ....................................................................... 86
T2CKPS1 Bit ....................................................................... 86
TAD .................................................................................... 157
Timer0 ................................................................................. 73
Associated Registers .................................................. 76
Clock Source Edge Select (T0SE Bit)......................... 22
Clock Source Select (T0CS Bit).................................. 22
Interrupt....................................................................... 73
Operation .................................................................... 73
Overflow Enable (TMR0IE Bit).................................... 23
Overflow Flag (TMR0IF Bit) ...................................... 185
Overflow Interrupt ..................................................... 185
Prescaler..................................................................... 74
T0CKI.......................................................................... 74
Use with External Clock .............................................. 74
Timer1 ................................................................................. 77
Associated Registers .................................................. 83
Asynchronous Counter Mode ..................................... 80
Reading and Writing ........................................... 80
Capacitor Selection..................................................... 81
Counter Operation ...................................................... 79
Operation .................................................................... 77
Operation in Synchronized
Counter Mode ..................................................... 79
Operation in Timer Mode ............................................ 79
Oscillator ..................................................................... 81
Oscillator Layout Considerations ................................ 81
Prescaler..................................................................... 82
Resetting Timer1 Register Pair................................... 82
Resetting Using a CCP Trigger Output....................... 81
Use as a Real-Time Clock .......................................... 82
Timer2 ................................................................................. 85
Associated Registers .................................................. 86
Output ......................................................................... 85
Postscaler ................................................................... 85
Prescaler..................................................................... 85
Prescaler and Postscaler ............................................ 85
Timing Diagrams
A/D Conversion ........................................................ 236
Acknowledge Sequence ........................................... 126
Asynchronous Master Transmission ........................ 139
Asynchronous Master Transmission
(Back to Back) .................................................. 139
Asynchronous Reception.......................................... 140
Asynchronous Reception with
Address Byte First ............................................ 143
Asynchronous Reception with
Address Detect ................................................. 143
AUSART Synchronous Receive
(Master/Slave) .................................................. 234
AUSART Synchronous Transmission
(Master/Slave) .................................................. 234
Baud Rate Generator with Clock Arbitration............. 120
BRG Reset Due to SDA Arbitration
During Start Condition ...................................... 129
Brown-out Reset....................................................... 225
Bus Collision During a Repeated
Start Condition (Case 1) ................................... 130
Bus Collision During a Repeated
Start Condition (Case 2) ................................... 130
Bus Collision During a Stop Condition
(Case 1)............................................................ 131
Bus Collision During a Stop Condition
(Case 2)............................................................ 131
Bus Collision During Start Condition
(SCL = 0) .......................................................... 129
Bus Collision During Start Condition
(SDA Only) ....................................................... 128
Bus Collision for Transmit and
Acknowledge .................................................... 127
Capture/Compare/PWM
(CCP1 and CCP2) ............................................ 227
CLKO and I/O ........................................................... 224
Clock Synchronization .............................................. 113
External Clock .......................................................... 223
Fail-Safe Clock Monitor ............................................ 189
First Start Bit ............................................................. 121
I2C Bus Data............................................................. 232
I2C Bus Start/Stop Bits ............................................. 231
I2C Master Mode (Reception,
7-bit Address) ................................................... 125
I2C Master Mode (Transmission,
7 or 10-bit Address) .......................................... 124
I2C Slave Mode (Transmission,
10-bit Address) ................................................. 111
I2C Slave Mode (Transmission,
7-bit Address) ................................................... 109
I2C Slave Mode with SEN = 0 (Reception,
10-bit Address) ................................................. 110
I2C Slave Mode with SEN = 0 (Reception,
7-bit Address) ................................................... 108
I2C Slave Mode with SEN = 1 (Reception,
10-bit Address) ................................................. 115
I2C Slave Mode with SEN = 1 (Reception,
7-bit Address) ................................................... 114
Low-Voltage Detect .................................................. 177
LP Clock to Primary System Clock after
Reset (EC, RC, INTRC)...................................... 46
LP Clock to Primary System Clock after
Reset (HS, XT, LP)............................................. 45
Parallel Slave Port .................................................... 228
Parallel Slave Port Read ............................................ 71
DS30498C-page 269
PIC16F7X7
Parallel Slave Port Write ............................................. 71
PWM Output ............................................................... 91
Repeated Start Condition.......................................... 122
Reset, Watchdog Timer,
Oscillator Start-up Timer and
Power-up Timer ................................................ 225
Slave Mode General Call Address Sequence
(7 or 10-Bit Address Mode)............................... 116
Slave Synchronization (SPI Mode) ............................. 99
Slow Rise Time (MCLR Tied to VDD
Through RC Network) ....................................... 183
SPI Master Mode (CKE = 0, SMP = 0) ..................... 229
SPI Master Mode (CKE = 1, SMP = 1) ..................... 229
SPI Mode (Master Mode) ............................................ 98
SPI Mode (Slave Mode with CKE = 0) ...................... 100
SPI Mode (Slave Mode with CKE = 1) ...................... 100
SPI Slave Mode (CKE = 0) ....................................... 230
SPI Slave Mode (CKE = 1) ....................................... 230
Stop Condition Receive or
Transmit Mode .................................................. 126
Switching to SEC_RUN Mode .................................... 42
Synchronous Reception
(Master Mode, SREN)....................................... 147
Synchronous Transmission....................................... 145
Synchronous Transmission
(Through TXEN)................................................ 145
Time-out Sequence on Power-up (MCLR Tied
to VDD Through Pull-up Resistor) ..................... 182
Time-out Sequence on Power-up (MCLR Tied
to VDD Through RC Network): Case 1 .............. 182
Time-out Sequence on Power-up (MCLR Tied
to VDD Through RC Network): Case 2 .............. 182
Timer0 and Timer1 External Clock ........................... 226
Timer1 Incrementing Edge.......................................... 79
Transition Between SEC_RUN/RC_RUN
and Primary Clock............................................... 44
Two-Speed Start-up .................................................. 188
Wake-up from Sleep via Interrupt ............................. 191
XT, HS, LP, EC, EXTRC to
RC_RUN Mode ................................................... 41
Timing Parameter Symbology........................................... 222
Timing Requirements
AUSART Synchronous Receive ............................... 234
AUSART Synchronous Transmission ....................... 234
Capture/Compare/PWM
(All CCP Modules) ............................................ 227
CLKO and I/O ........................................................... 224
External Clock ........................................................... 223
I2C Bus Data ............................................................. 233
I2C Bus Start/Stop Bits.............................................. 232
Parallel Slave Port .................................................... 228
Reset, Watchdog Timer,
Oscillator Start-up Timer,
Power-up Timer and Brown-out Reset.............. 225
SPI Mode .................................................................. 231
Timer0 and Timer1 External Clock ........................... 226
DS30498C-page 270
TMR1CS Bit........................................................................ 78
TMR1ON Bit ....................................................................... 78
TMR2ON Bit ....................................................................... 86
TOUTPS<3:0> Bits ............................................................. 86
TRISA Register................................................................... 49
TRISB Register................................................................... 56
TRISC Register................................................................... 65
TRISD Register................................................................... 67
TRISE Register................................................................... 68
IBF Bit ......................................................................... 69
IBOV Bit ...................................................................... 69
PSPMODE Bit....................................................... 67, 68
Two-Speed Clock Start-up Mode...................................... 188
Two-Speed Start-up.......................................................... 169
TXSTA Register
BRGH Bit .................................................................. 133
CSRC Bit .................................................................. 133
TRMT Bit................................................................... 133
TX9 Bit ...................................................................... 133
TX9D Bit ................................................................... 133
TXEN Bit ................................................................... 133
V
Voltage Reference Specifications..................................... 220
W
Wake-up from Sleep ................................................. 169, 190
Interrupts .......................................................... 179, 180
WDT Reset ............................................................... 180
Wake-up Using Interrupts ................................................. 191
Watchdog Timer (WDT)............................................ 169, 186
Associated Registers ................................................ 187
WDT Reset, Normal Operation................. 172, 179, 180
WDT Reset, Sleep .................................... 172, 179, 180
WCOL ....................................................... 121, 122, 123, 126
WCOL Status Flag.................................... 121, 122, 123, 126
WWW, On-Line Support ....................................................... 4
PIC16F7X7
ON-LINE SUPPORT
Microchip provides on-line support on the Microchip
World Wide Web site.
The web site is used by Microchip as a means to make
files and information easily available to customers. To
view the site, the user must have access to the Internet
and a web browser, such as Netscape or Microsoft
Internet Explorer. Files are also available for FTP
download from our FTP site.
DS30498C-page 271
PIC16F7X7
READER RESPONSE
It is our intention to provide you with the best documentation possible to ensure successful use of your Microchip product. If you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation
can better serve you, please FAX your comments to the Technical Publications Manager at (480) 792-4150.
Please list the following information, and use this outline to provide us with your comments about this document.
To:
RE:
Reader Response
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________
Application (optional):
Would you like a reply?
Device: PIC16F7X7
N
Literature Number: DS30498C
Questions:
1. What are the best features of this document?
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?
DS30498C-page 272
PIC16F7X7
PIC16F7X7 PRODUCT IDENTIFICATION SYSTEM
To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office.
PART NO.
Device
X
Temperature
Range
/XX
XXX
Package
Pattern
Examples:
a)
b)
Device
Temperature Range
I
E
=
=
c)
Package
ML
PT
SO
SP
P
SS
=
=
=
=
=
=
Pattern
2:
F = CMOS Flash
LF = Low-Power CMOS Flash
T = in tape and reel SOIC, SSOP,
TQFP packages only.
DS30498C-page 273
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
India - Bangalore
Tel: 91-80-2229-0061
Fax: 91-80-2229-0062
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
Austria - Weis
Tel: 43-7242-2244-399
Fax: 43-7242-2244-393
Denmark - Ballerup
Tel: 45-4450-2828
Fax: 45-4485-2829
China - Chengdu
Tel: 86-28-8676-6200
Fax: 86-28-8676-6599
Japan - Kanagawa
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
France - Massy
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
China - Fuzhou
Tel: 86-591-8750-3506
Fax: 86-591-8750-3521
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Germany - Ismaning
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Alpharetta, GA
Tel: 770-640-0034
Fax: 770-640-0307
Boston
Westford, MA
Tel: 978-692-3848
Fax: 978-692-3821
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
England - Berkshire
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Taiwan - Hsinchu
Tel: 886-3-572-9526
Fax: 886-3-572-6459
China - Qingdao
Tel: 86-532-502-7355
Fax: 86-532-502-7205
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
San Jose
Mountain View, CA
Tel: 650-215-1444
Fax: 650-961-0286
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
10/20/04
DS30498C-page 274