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 Microchip’s 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 Microchip’s code protection feature may be a violation of the Digit al Millennium Copyright Act. If suc h a c t s
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED,
WRITTEN OR ORAL, STATUTORY OR OTHERWISE,
RELATED TO THE INFORMATION, INCLUDING BUT NOT
LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE,
MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and
its use. Use of M icrochip’s prod ucts as critical components in
life support systems is not authorized except with express
written approval by Microchip. No licenses are conveyed,
implicitly or otherwise, under any Microchip intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K
EELOQ, 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, Sm art 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.
Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
10.0 Master Synchronous Serial Port (MSSP) Module ...................................................................................................................... 93
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
19.0 DC and AC Characteristics Graphs and Tables.......................................................................................................................237
Index .................................................................................................................................................................................................. 263
Systems Information and Upgrade Hot Line...................................................................................................................................... 271
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or c omm ents regarding t his publication, p lease c ontact the M arket ing Co mmunications Department via
E-mail at docerrors@microchip.com or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
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:
• Microchip’s 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.
Customer Notification System
Register on our web site at www.microchip.com to receive the most current information on all of our products.
DS30498C-page 4 2004 Microchip Technology Inc.
PIC16F7X7
1.0DEVICE OVERVIEW
This document contains device specific information
about the following devices:
• PIC16F737• PIC16F767
• PIC16F747• PIC16F777
PIC16F737/767 devices are available only in 28-pin
packages, while PIC16F747/777 devices are available
in 40-pin and 44-pin packages. All devices in the
PIC16F7X7 family sha re com mon archi tecture with the
following differences:
• The PIC16F737 and PIC1 6F7 67 ha ve on e-h alf of
the total on-chip memory of the PIC16F747 and
PIC16F777.
• The 28-pin devices have 3 I/O ports, while the
40/44-pin devices have 5.
• The 28-pin devices have 16 interrupts, while the
40/44-pin devices have 17.
• The 28-pin devices have 11 A/D input channels,
while the 40/44-pin devices have 14.
• The Parallel Slave Port is implemented only on
the 40/44-pin devices.
• Low-Power m od es: RC_RUN allows the core and
peripherals to be clocked from the INTRC, while
SEC_RUN allows the core and peripherals to be
clocked from the low-power Timer1. Refer to
Section 4.7 “Power-Managed Modes” for
further details.
• Internal R C o scil la t o r w i th ei gh t s e le ctable
frequencies , i nc lu di ng 3 1.2 5kHz, 125 kHz,
250kHz, 500kHz, 1MHz, 2 MHz, 4 MHz and
8 MHz. The INTRC can be configured as a primary
or secondary clock source. Refer to Section 4.5 “Internal Oscilla tor Bloc k” f or fur the r d etails.
• The Timer1 module current consumption has
been greatly reduced from 20µA (previous PIC16
devices) to 1.8 µA typical (32 kHz at 2V), which is
ideal for real-time clock applications. Refer to
Section 7.0 “Timer1 Module” for further details.
• Extended Watchdog Ti me r (W D T) tha t can have a
programmable period from 1 ms to 268s. The WDT
has its own 16-bit pre scaler . Refer to Section 15.17 “Watch dog Timer (WDT)” for further details.
• Two-Speed Start-up: When the oscillator is
configured for LP, XT or HS, this feature will clock
the device from the INTRC while the oscillator is
warming up. This, in turn, will enable almost
immediate code execution. Refer to
Section 15.17.3 “Two-Speed Clock Start-up
Mode” for further details.
• Fail-Safe Clo ck Monitor: This feat ure will allow the
device to continue operation if the primary or
secondary clock source fails by switching over to
the INTRC.
The available features are summarized in Table 1-1.
Block diagrams of the PIC16F737/767 and
PIC16F747/777 devic es are provided i n Figure 1-1 and
Figure 1-2, respectively. The pinouts for these device
families are listed in Table 1-2 and Table 1-3.
Additional information may be found in the “PICmicro
Mid-Range MCU Family Reference Manual”
(DS33023) which may be obtained from your local
Microchip Sales Representative or downloaded from
the Microchip web site. The Reference Manual should
be considered a complementary document to this data
sheet and is highly recommended reading for a better
understanding o f the d ev ic e arc hi tec ture a nd operation
of the peripheral modules.
Note 1: Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
CCP1, 2, 3
MSSP
Addressable
USART
PORTE
RE0/RD
/AN5
/AN6
RE1/WR
RE2/CS
/AN7
MCLR/VPP/RE3
2004 Microchip Technology Inc.DS30498C-page 7
PIC16F7X7
TABLE 1-2:PIC16F737 AND PIC16F767 PINOUT DESCRIPTION
PDIP
Pin Name
OSC1/CLKI/RA7
OSC1
CLKI
RA7
OSC2/CLKO/RA6
OSC2
CLKO
RA6
/VPP/RE3
MCLR
MCLR
VPP
RE3
RA0/AN0
RA0
AN0
RA1/AN1
RA1
AN1
RA2/AN2/V
RA3/AN3/V
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/SS
Legend:I = inputO = outputI/O = input/outputP = power
Note 1:This buffer is a Schmitt Trigger input when configured as the external interrupt.
REF-/CVREF
RA2
AN2
V
REF-
REF
CV
REF+
RA3
AN3
REF+
V
RA4
T0CKI
C1OUT
RA5
AN4
LVDIN
SS
C2OUT
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
4:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
Oscillator crystal input or external clock source input. ST
buffer when configured in RC mode; otherwise CMOS.
External clock source input. Always associated with pin
function OSC1 (see OSC1/CLKI, OSC2/CLKO pins).
Digital I/O.
Oscillator crystal or clock output.
Oscillator crystal output.
Connects to crystal or resonator in Crystal Oscillator
mode.
In RC mode, OSC2 pin outputs CLKO whic h has 1/4 t he
frequency of OSC1 and denotes the in str uctio n cycle rat e.
Digital I/O.
Master Clear (input) or programming voltage (output).
Master Clear (Reset) input. This pin is an active-low
Reset to the device.
Programming voltage input.
Digital input only pin.
PORTA is a bidirectional I/O port.
Digital I/O.
Analog input 0.
Digital I/O.
Analog input 1.
Digital I/O.
Analog input 2.
A/D reference voltage input (low).
Comparator voltage reference output.
Digital I/O.
Analog input 3.
A/D reference voltage input (high).
Digital I/O – Open-drain when configured as output.
Timer0 external clock input.
Comparator 1 output bit.
Digital I/O.
Analog input 4.
Low-Voltage Detect input.
SPI™ slave select input.
Comparator 2 output bit.
DS30498C-page 8 2004 Microchip Technology Inc.
PIC16F7X7
T ABLE 1-2:PIC16F737 AND PIC16F767 PINOUT DESCRIPTION (CONTINUED)
PDIP
Pin Name
RB0/INT/AN12
RB0
INT
AN12
RB1/AN10
RB1
AN10
RB2/AN8
RB2
AN8
RB3/CCP2/AN9
RB3
(4)
CCP2
AN9
RB4/AN11
RB4
AN11
RB5/AN13/CCP3
RB5
AN13
CCP3
RB6/PGC
RB6
PGC
RB7/PGD
RB7
PGD
Legend:I = inputO = outputI/O = input/outputP = power
Note 1:This buffer is a Schmitt Trigger input when configured as the external interrupt.
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
4:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
SOIC
SSOP
Pin #
2118
2219
2320
2421
2522
2623
2724
2825
QFN
Pin #
I/O/P
Type
I/O
I
I
I/O
I
I/O
I
I/O
I/O
I
I/O
I
I/O
I
I/O
I/O
I/O
I/O
I/O
Buffer
Type
TTL/ST
TTL
TTL
TTL
TTL
TTL
TTL/ST
TTL/ST
Description
PORTB is a bidirectional I/O port. PORTB can be software
programmed for internal weak pull-up on all inputs.
(1)
Digital I/O.
External interrupt.
Analog input channel 12.
Digital I/O.
Analog input channel 10.
Digital I/O.
Analog input channel 8.
Digital I/O.
CCP2 capture input, compare output, PWM output.
Analog input channel 9.
Digital I/O.
Analog input channel 11.
Digital I/O.
Analog input channel 13.
CCP3 capture input, compare output, PWM output.
(2)
Digital I/O.
In-Circuit Debugger and ICSP™ programming clock.
(2)
Digital I/O.
In-Circuit Debugger and ICSP programming data.
2004 Microchip Technology Inc.DS30498C-page 9
PIC16F7X7
TABLE 1-2:PIC16F737 AND PIC16F767 PINOUT DESCRIPTION (CONTINUED)
PDIP
Pin Name
RC0/T1OSO/T1CKI
RC0
T1OSO
T1CKI
RC1/T1OSI/CCP2
RC1
T1OSI
(4)
CCP2
RC2/CCP1
RC2
CCP1
RC3/SCK/SCL
RC3
SCK
SCL
RC4/SDI/SDA
RC4
SDI
SDA
RC5/SDO
RC5
SDO
RC6/TX/CK
RC6
TX
CK
RC7/RX/DT
RC7
RX
DT
SS8, 195, 16P—Ground reference for logic and I/O pins.
V
V
DD2017P—Positive supply for logic and I/O pins.
Legend:I = inputO = outputI/O = input/outputP = power
Note 1:This buffer is a Schmitt Trigger input when configured as the external interrupt.
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
4:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
SOIC
SSOP
Pin #
118
129
1310
1411
1512
1613
1714
1815
QFN
Pin #
I/O/P
Type
I/O
O
I
I/O
I
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I
I/O
I/O
O
I/O
O
I/O
I/O
I
I/O
Buffer
Type
ST
ST
ST
ST
ST
ST
ST
ST
Description
PORTC is a bidirectional I/O port.
Digital I/O.
Timer1 oscillator output.
Timer1 external clock input.
Digital I/O.
Capture1 input, Compare1 output, PWM1 output.
Digital I/O.
Synchronous serial clock input/output for SPI™ mode.
Synchronous serial clock input/output for I
Digital I/O.
SPI data in.
2
C data I/O.
I
Digital I/O.
SPI data out.
Digital I/O.
AUSART asynchronous transmit.
AUSART synchronous clock.
Digital I/O.
AUSART asynchronous receive.
AUSART synchronous data.
2
C™ mode.
DS30498C-page 10 2004 Microchip Technology Inc.
PIC16F7X7
TABLE 1-3:PIC16F747 AND PIC16F777 PINOUT DESCRIPTION
Pin Name
OSC1/CLKI/RA7
OSC1
CLKI
RA7
OSC2/CLKO/RA6
OSC2
CLKO
RA6
/VPP/RE3
MCLR
MCLR
VPP
RE3
RA0/AN0
RA0
AN0
RA1/AN1
RA1
AN1
RA2/AN2/V
RA3/AN3/V
RA4/T0CKI/C1OUT
RA5/AN4/LVDIN/SS
Legend:I = inputO = outputI/O = input/outputP = power
Note 1:This buffer is a Schmitt Trigger input when configured as an external interrupt.
REF-/CVREF
RA2
AN2
REF-
V
CV
REF
REF+
RA3
AN3
REF+
V
RA4
T0CKI
C1OUT
RA5
AN4
LVDIN
SS
C2OUT
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3:This buffer is a Schmitt Trigger input when configured as a general purpose I/O and a TTL input when used in the Parallel
4:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
5:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3: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).
4:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
5:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
PDIP
Pin #
QFN
TQFP
Pin #
3398
34109
351110
361211
371414
381515
391616
401717
Pin #
I/O/P
Type
I/O
I
I
I/O
I
I/O
I
I/O
I/O
I
I/O
I
I/O
I
I
I/O
I/O
I/O
I/O
Buffer
Type
TTL/ST
TTL
TTL
TTL
TTL
TTL
TTL/ST
TTL/ST
Description
PORTB is a bidirectional I/O port. PORTB can be
software programmed for internal weak pull-up on all
inputs.
(1)
Digital I/O.
External interrupt.
Analog input channel 12.
Digital I/O.
Analog input channel 10.
Digital I/O.
Analog input channel 8.
Digital I/O.
CCP2 capture input, compare output, PWM output.
Analog input channel 9.
Digital I/O.
Analog input channel 11
Digital I/O.
Analog input channel 13.
CCP3 capture input, compare output, PWM output.
(2)
Digital I/O.
In-Circuit Debugger and ICSP™ programming
clock.
(2)
Digital I/O.
In-Circuit Debugger and ICSP programming
data.
DS30498C-page 12 2004 Microchip Technology Inc.
PIC16F7X7
T ABLE 1-3:PIC16F747 AND PIC16F777 PINOUT DESCRIPTION (CONTINUED)
Pin Name
RC0/T1OSO/T1CKI
RC0
T1OSO
T1CKI
RC1/T1OSI/CCP2
RC1
T1OSI
(5)
CCP2
RC2/CCP1
RC2
CCP1
RC3/SCK/SCL
RC3
SCK
SCL
RC4/SDI/SDA
RC4
SDI
SDA
RC5/SDO
RC5
SDO
RC6/TX/CK
RC6
TX
CK
RC7/RX/DT
RC7
RX
DT
Legend:I = inputO = outputI/O = input/outputP = power
Note 1:This buffer is a Schmitt Trigger input when configured as an external interrupt.
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3: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).
4:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
5:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
PDIP
Pin #
QFN
Pin #
153432
163535
173636
183737
234242
244343
254444
2611
TQFP
Pin #
I/O/P
Type
I/O
O
I
I/O
I
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I
I/O
I/O
O
I/O
O
I/O
I/O
I
I/O
Buffer
Type
ST
ST
ST
ST
ST
ST
ST
ST
Description
PORTC is a bidirectional I/O port.
Digital I/O.
Timer1 oscillator output.
Timer1 external clock input.
Digital I/O.
Timer1 oscillator input.
Capture 2 input, Compare 2 output, PWM 2 output.
Digital I/O.
Capture 1 input, Compare 1 output, PWM 1 output.
Digital I/O.
Synchronous serial clock input/output
for SPI™ mode.
Synchronous serial clock input/output
2
C™ mode.
for I
Digital I/O.
SPI data in.
2
C data I/O.
I
Digital I/O.
SPI data out.
Digital I/O.
AUSART asynchronous transmit.
AUSART synchronous clock.
Digital I/O.
AUSART asynchronous receive.
AUSART synchronous data.
2004 Microchip Technology Inc.DS30498C-page 13
PIC16F7X7
TABLE 1-3:PIC16F747 AND PIC16F777 PINOUT DESCRIPTION (CONTINUED)
Pin Name
PDIP
Pin #
RD0/PSP0
RD0
PSP0
RD1/PSP1
RD1
PSP1
RD2/PSP2
RD2
PSP2
RD3/PSP3
RD3
PSP3
RD4/PSP4
RD4
PSP4
RD5/PSP5
RD5
PSP5
RD6/PSP6
RD6
PSP6
RD7/PSP7
RD7
PSP7
/AN5
RE0/RD
RE0
RD
AN5
RE1/WR
/AN6
RE1
WR
AN6
/AN7
RE2/CS
RE2
CS
AN7
SS—31—P—Analog ground reference.
V
V
SS12, 316, 306, 29P—Ground reference for logic and I/O pins.
DD—8—P—Analog positive supply.
V
DD11, 327, 287, 28P—Positive supply for logic and I/O pins.
V
NC—13, 29 12, 13,
Legend:I = inputO = outputI/O = input/outputP = power
Note 1:This buffer is a Schmitt Trigger input when configured as an external interrupt.
2:This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3: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).
4:This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
5:Pin location of CCP2 is determined by the CCPMX bit in Configuration Word Register 1.
QFN
TQFP
Pin #
Pin #
193838
203939
214040
224141
2722
2833
2944
3055
82525
92626
102727
33, 34
I/O/P
Type
Buffer
Type
Description
PORTD is a bidirectional I/O port or Parallel Slave Port
when interfacing to a microprocessor bus.
(3)
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
ST/TTL
ST/TTL
ST/TTL
ST/TTL
ST/TTL
ST/TTL
ST/TTL
ST/TTL
(3)
(3)
(3)
(3)
(3)
(3)
(3)
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
Digital I/O.
Parallel Slave Port data.
PORTE is a bidirectional I/O port.
(3)
ST/TTL
I/O
I/O
I/O
I
I
(3)
ST/TTL
I
I
(3)
ST/TTL
I
I
Digital I/O.
Read control for Parallel Slave Port.
Analog input 5.
Digital I/O.
Write control for Parallel Slave Port.
Analog input 6.
Digital I/O.
Chip select control for Parallel Slave Port.
Analog input 7.
——These pins are not internally connected. These pins
should be left unconnected.
DS30498C-page 14 2004 Microchip Technology Inc.
PIC16F7X7
2.0MEMORY ORGANIZATION
There are two memory blocks in each of these
PICmicro
memory have separate buses so that concurrent
access can oc cur and is detailed in this section. The
program memo ry can be read inte rnally b y user co de
(see Section 3.0 “Reading Program Memory”).
Additional informa tion on devi ce memory may be found
in the “PICmicroManual” (DS33023).
2.1Program Memory Organization
The PIC16F7X7 dev ices have a 13-b it program coun ter
capable of addressing an 8K word x 14-bit program
memory space. The PIC16F767/777 devices have
8K words of Flash program memory and the
PIC16F737/747 devices have 4K words. The program
memory maps for PIC16F7X7 devices are shown in
Figure 2-1. Accessing a location above the physically
implemented address will cause a wraparound.
The Reset vector is at 0000h an d the interrupt ve ctor is
at 0004h.
®
MCUs. The program memory and data
®
Mid-Range MCU Family Reference
2.2Data Memor y Organization
The data memory is partitioned into multiple banks
which contain the General Purpose Registers and the
Special Function Registers. Bits RP1 (Status<6>) and
RP0 (Status<5>) are the bank select bits:
RP1:RP0Bank
000
011
102
113
Each bank extends up to 7Fh (128 bytes). The lower
locations of each bank are reserved for the Special
Function Registers. Abo ve the Speci al Function Re gisters are General Purpose Registers, implemented as
static RAM. All implemented banks contain Special
Function Registers. Some frequently used Special
Function Registers from one bank may be mirrored in
another bank for code reduction and quicker access.
2.2.1GENERAL PURPOSE
REGISTER FILE
The register file (shown in Figure 2-2 and Figure 2-3)
can be accessed either directly, or indirectly, through
the File Select Register (FSR).
FIGURE 2-1:PROGRAM MEMORY MAPS AND STACKS FOR PIC16F7X7 DEVICES
PC<12:0>
CALL, RETURN
RETFIE, RETLW
On-Chip
Program
Memory
Stack Level 1
Stack Level 2
Stack Level 8
Reset Vector
Interrupt Vector
Page 0
Page 1
Page2
Page 3
13
0000h
0004h
0005h
07FFh
0800h
0FFFh
1000h
17FFh
1800h
1FFFh
Memory available on all
PIC16F7X7.
Memory available on PIC16F767
and PIC16F777. The memory
wraps to 000h through 0FFFh on
the PIC16F737 and PIC16F747.
2004 Microchip Technology Inc.DS30498C-page 15
PIC16F7X7
FIGURE 2-2:DATA MEMORY MAP FOR PIC16F737 AND THE PIC16F767
The Special Function Registers are registers used by
the CPU and peripheral modules for controlling the
desired operation of the device. These registers are
implemented as static RAM. A list of these registers is
given in Table 2-1.
The Special Function Registers can be classified into
two sets: core (CPU) and peripheral. Those registers
associated with the core functions are described in
detail in this section. Those related to the operation of
the peripheral features are described in detail in the
peripheral feature section.
04h
05hPORTAPORTA Data Latch when written: PORTA pins when readxx0x 0000 55, 180
06hPORTBPORTB Data Latch when written: PORTB pins when readxx00 0000 64, 180
07hPORTCPORTC Data Latch when written: PORTC pins when readxxxx xxxx 66, 180
(5)
08h
(5)
09h
(1,4)
0Ah
(4)
0Bh
0ChPIR1PSPIF
0DhPIR2OSFIFCMIFLVDIF
0EhTMR1LHolding Register for the Least Significant Byte of the 16-bit TMR1 Registerxxxx xxxx 83, 180
0FhTMR1HHolding Register for the Most Significant Byte of the 16-bit TMR1 Registerxxxx xxxx 83, 180
10hT1CON
11hTMR2Timer2 Module Register0000 0000 86, 180
12hT2CON
13hSSPBUFSynchronous Serial Port Receive Buffer/Transmit Registerxxxx xxxx 101, 180
14hSSPCONWCOLSSPOVSSPENCKPSSPM3SSPM2SSPM1SSPM0 0000 0000 101, 180
15hCCPR1LCapture/Compare/PWM Register 1 (LSB)xxxx xxxx 90, 180
16hCCPR1HCapture/Compare/PWM Register 1 (MSB)xxxx xxxx 90, 180
17hCCP1CON
18hRCSTASPENRX9SRENCRENADDENFERROERRRX9D0000 000x 134, 180
19hTXREGAUSART Transmit Data Register0000 0000 139, 180
1AhRCREGAUSART Receive Data Register0000 0000 141, 180
1BhCCPR2LCapture/Compare/PWM Register 2 (LSB)xxxx xxxx 92, 180
1ChCCPR2HCapture/Compare/PWM Register 2 (MSB)xxxx xxxx 92, 180
1DhCCP2CON
1EhADRESHA/D Result Register High Bytexxxx xxxx 160, 180
1FhADCON0ADCS1ADCS0CHS2CHS1CHS0GO/DONE
Legend: x = unknown, u = unchanged, q = value depends on condition, — = unimplemented, read as ‘0’, r = reserved.
Note 1: The upper byte of the progra m c oun ter is n ot dire ctly a ccessi bl e. PCLATH is a holding regis ter f or the P C<1 2:8 > bits, whose contents
NameBit 7Bit 6Bit 5Bit 4Bit 3Bit 2 Bit 1Bit 0
INDFAddressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 30, 180
PORTDPORTD Data Latch when written: PORTD pins when readxxxx xxxx 67, 180
PORTE————RE3RE2RE1RE0---- x000 68, 180
PCLATH———Write Buffer for the upper 5 bits of the Program Counter---0 0000 29, 180
INTCONGIE PEIETMR0IEINT0IERBIETMR0IFINT0IFRBIF0000 000x 23, 180
Shaded locations are unimplemented, read as ‘0’.
are transferred to the upper byte of the program counter during branches (CALL or GOTO).
2: Other (non Powe r-up) Resets include external Reset through MCLR
3: Bits PSPIE and PSPIF are reserved on the 28-pin devices; alway s maintain these bits clear .
4: These regist ers can be addressed from any bank.
5: PORTD, PORTE, TRISD and TRISE are not physically implement ed on the 28-pin devices (except for RE3), read as ‘ 0’.
6: This bit always reads as a ‘1’.
7: OSCCON<OSTS> bit resets to ‘0’ with dual-speed start-up and LP, HS or HS-PLL selected as the oscillator.
8: RE3 is an input only. The state of the TRISE3 bit has no effect and will always read ‘1’.
TABLE 2-1:SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
Address
NameBit 7Bit 6Bit 5Bit 4Bit 3Bit 2 Bit 1Bit 0
Value on:
POR, BOR
Bank 1
(4)
80h
81h
82h
83h
84h
INDFAddressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 30, 180
OPTION_REG
(4)
PCLProgram Counter’s (PC) Least Significant Byte0000 0000 29, 180
(4)
STATUSIRPRP1RP0TOPDZDCC0001 1xxx 21, 180
(4)
FSRIndirect Data Memory Address Pointerxxxx xxxx 30, 180
RBPUINTEDGT0CST0SEPSAPS2PS1PS01111 1111 22, 180
85hTRISAPORTA Data Direction Register1111 1111 55, 181
86hTRISBPORTB Data Direction Register1111 1111 64, 181
87hTRISCPORTC Data Direction Register1111 1111 66, 181
—CVR3CVR2CVR1CVR0000- 0000 55, 167
9EhADRESLA/D Result Register Low Bytexxxx xxxx180
9FhADCON1ADFMADCS2VCFG1VCFG0PCFG3PCFG2PCFG1PCFG0 0000 0000 153, 181
Legend: x = unknown, u = unchanged, q = value depends on condition, — = unimplemented, r ead as ‘0’, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: The upper byte of the pr ogra m coun ter is not dire ctly a cces sibl e. PCLATH is a holding regis ter f or the P C<1 2:8 > bit s, whos e con tents
are transferred to the upper byte of the program counter during branches (CALL or GOTO).
2: Other (non Powe r-up) Resets include external Reset through MCLR
and Watchdog Timer Reset.
3: Bits PSPIE and PSPIF are reserved on the 28-pin devices; alway s maintain these bits clear .
4: These regist ers can be addressed from any bank.
5: PORTD, PORTE, TRISD and TRISE are not physically implement ed on the 28-pin devices (except for RE3), read as ‘ 0’.
6: This bit always reads as a ‘1’.
7: OSCCON<OSTS> bit resets to ‘0’ with dual-speed start-up and LP, HS or HS-PLL selected as the oscillator.
8: RE3 is an input only. The state of the TRISE3 bit has no effect and will always read ‘1’.
Details
on page
2004 Microchip Technology Inc.DS30498C-page 19
PIC16F7X7
TABLE 2-1:SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
Address
NameBit 7Bit 6Bit 5Bit 4Bit 3Bit 2 Bit 1Bit 0
Value on:
POR, BOR
Bank 2
(4)
100h
INDFAddressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 30, 180
101hTMR0Timer0 Module Registerxxxx xxxx 76, 180
(4)
102h
103h
104h
105hWDTCON
PCLProgram Counter (PC) Least Significant Byte0000 0000 29, 180
(4)
STATUSIRPRP1RP0TOPDZDCC0001 1xxx 21, 180
(4)
FSRIndirect Data Memory Address Pointerxxxx xxxx 30, 180
———WDTPS3WDTPS2 WDTPS1 WDTPS0 SWDTEN ---0 1000187
106hPOR TBPORTB Data Latch when written: PORTB pins when readxxxx xxxx 64, 180
107h—Unimplemented——
108h—Unimplemented——
109hLVDCON
(1,4)
10Ah
10Bh
PCLATH———Write Buffer for the upper 5 bits of the Program Counter---0 0000 23, 180
——————RD1--- ---0 32, 181
18Dh—Reserved, maintain clear——
18Eh—Reserved, maintain clear——
18Fh—Reserved, maintain clear——
Legend: x = unknown, u = unchanged, q = value depends on condition, — = unimplemented, read as ‘0’, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: The upper byte of the progra m c oun ter is n ot dire ctly a ccessi bl e. PCLATH is a holding regis ter f or the P C<1 2:8 > bits, whose contents
are transferred to the upper byte of the program counter during branches (CALL or GOTO).
2: Other (non Powe r-up) Resets include external Reset through MCLR
and Watchdog Timer Reset.
3: Bits PSPIE and PSPIF are reserved on the 28-pin devices; alway s maintain these bits clear .
4: These regist ers can be addressed from any bank.
5: PORTD, PORTE, TRISD and TRISE are not physically implement ed on the 28-pin devices (except for RE3), read as ‘ 0’.
6: This bit always reads as a ‘1’.
7: OSCCON<OSTS> bit resets to ‘0’ with dual-speed start-up and LP, HS or HS-PLL selected as the oscillator.
8: RE3 is an input only. The state of the TRISE3 bit has no effect and will always read ‘1’.
Details
on page
DS30498C-page 20 2004 Microchip Technology Inc.
PIC16F7X7
2.2.2.1Status Register
The St atus reg ister co ntai ns the ar ithmetic st atu s of the
ALU, the Reset status and the bank select bits for data
memory.
The Status register can be the destination for any
instruction, as with any other register. If the Status
register is the destination for an instruction that affects
the Z, DC or C bits, then the write to these three bits is
disabled. These bit s are set or cleared ac cording to the
device logic. Furthermore, the TO
writable, therefore, the result of an instruction with the
Status register as destination may be different than
intended.
and PD bits are not
For example, CLRF STATUS, w ill c lear the upper three
bits and set the Z bit. Thi s leav es the Status register as
000u u1uu (where u = unchanged).
It is recommended, therefore, that only BCF, BSF,SWAPF and MOVWF instructions are used to alter the
Stat us regist er because the se inst ructions do not af fect
the Z, C or DC bits from the Status register. For other
instructions not affecting any Status bits, see
Section 16.0 “Instruction Set Summary”.
Note 1: The C and DC bits operate as a borrow
and digit borrow bit, respectively, in
subtraction. See the SUBLW and SUBWF
instructions for examples.
REGISTER 2-1:STATUS: ARITHMETIC STATUS REGISTER (ADDRESS 03h, 83h, 103h, 183h)
R/W-0R/W-0R/W-0R-1R-1R/W-xR/W-xR/W-x
IRPRP1RP0TO
bit 7bit 0
bit 7IRP: Register Bank Select bit (use d for indirect addressi ng)
1 = Bank 2, 3 (100h-1FFh)
0 = Bank 0, 1 (00h-FFh)
bit 6-5RP1:RP0: Register Bank Select bits (used for direct addressing)
11 = Bank 3 (180h-1FFh)
10 = Bank 2 (100h-17Fh)
01 = Bank 1 (80h-FFh)
00 = Bank 0 (00h-7Fh)
Each bank is 128 bytes.
bit 4TO
bit 3PD
bit 2Z: Zero bit
bit 1DC: Digit Carry/borrow
bit 0C: Carry/borrow
: Time-out bit
1 = After power-up, CLRWDT instruction or SLEEP instruction
0 = A WDT time-out occurred
: Power-Down bit
1 = After power-up or b y the CLRWDT instruction
0 = By execution of the SLEEP instruction
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit (ADDWF, ADDLW, SUBLW, SUBWF instructions)
1 = A carry-out from the 4th low-order bit of the result occurred
0 = No carry-out from the 4th low-order bit of the result
bit (ADDWF, ADDLW, SUBLW, SUBWF instructions)
1 = A carry-out from the Most Significant bit of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
Note:For borrow
two’s complement of the second operand. For rotate (RRF, RLF) instructions, this
bit is loaded with either the high or low-order bit of the source register.
, the polarity is reversed. A subtraction is executed by adding the
PDZDCC
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
2004 Microchip Technology Inc.DS30498C-page 21
PIC16F7X7
2.2.2.2OPTION_REG Register
The OPTION_REG register is a readable and writable
register which c ont ains vario us cont rol bi t s to c onfigu re
the TMR0 prescaler/WDT postscaler (single assignable register also known as the prescaler), the external
INT interrupt, TMR0 and the weak pull-u ps o n POR TB.
Note:To achieve a 1:1 prescaler assignment for
the TMR0 register, assign the prescaler to
the Watchdog Timer.
REGISTER 2-2:OPTION_REG: OPTION CONTROL REGISTER (ADDRESS 81h, 181h)
R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1
RBPU
bit 7bit 0
bit 7RBPU
1 = PORTB pull-u ps are disabled
0 = PORTB pull-ups are enabled by individual port latch values
bit 6INTEDG: Interrupt Edge Select bit
1 = Interrupt on rising edge of RB0/INT pin
0 = Interrupt on falling edge of RB0/INT pin
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
DS30498C-page 22 2004 Microchip Technology Inc.
PIC16F7X7
2.2.2.3 INTCON Register
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.
Note:Interrupt flag bits are set when an in terrupt
condition occurs regardles s of the sta te of
its corresponding enable bit or the Global
Interrupt Enable bit, GIE (INTCON<7>).
User software shoul d ensure the appropriate interrupt flag bits are clear prior to
enabling an interrupt.
REGISTER 2-3:INTCON: INTERRUPT CONTROL REGISTER (ADDRESS 0Bh, 8Bh, 10Bh, 18Bh)
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-x
GIEPEIETMR0IEINT0IERBIETMR0IFINT0IFRBIF
bit 7bit 0
bit 7GIE: Global Interrupt Enable bit
1 = Enables all unmasked interrupts
0 = Disables all interrupts
bit 6PEIE: Peripheral Interrupt Enable bit
1 = Enables all unmasked peripheral interrupts
0 = Disables all peripheral interrupts
bit 5TMR0IE: TMR0 Overflow Interrupt Enable bit
1 = Enables the TMR0 interrupt
0 = Disables the TMR0 interrupt
bit 4INT0IE: RB0/INT External Interrupt Enable bit
1 = Enables the RB0/INT external interrupt
0 = Disables the RB0/INT external interrupt
bit 3RBIE: RB Port Change Interrupt Enable bit
1 = Enables the RB port change interrupt
0 = Disables the RB port change interrupt
bit 2TMR0IF: TMR0 Overflow Interrupt Flag bit
1 = TMR0 regis ter has overflowed (must be cleared in software)
0 = TMR0 register did not overflow
bit 1INT0IF: RB0/INT External Interrupt Flag bit
1 = The RB0/INT external interrupt occurred (must be cleared in software)
0 = The RB0/INT external interrupt did not occur
bit 0RBIF: RB Port Change Interrupt Flag bit
A mismatch condition will continue to set flag bit RBIF. Reading PORTB will end the mismatch
condition and allow flag bit RBIF to be cleared.
1 = At least one of the RB7:RB4 pins changed state (must be cleared in software)
0 = None of the RB7:RB4 pins have changed state
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
2004 Microchip Technology Inc.DS30498C-page 23
PIC16F7X7
2.2.2.4PIE1 Register
The PIE1 register cont ains the ind ividual enab le bits for
the periph eral interrupts.
bit 7PSPIE: Parallel Slave Port Read/Write Interrupt Enable bit
1 = Enables the PSP read/write interrupt
0 = Disables the PSP read/write interrupt
Note 1: PSPIE is reserved on 28-pin devices; always maintain this bit clear.
bit 6ADIE: A/D Converter Interrupt Enable bit
1 = Enables the A/D converter interrupt
0 = Disables the A/D converter interrupt
bit 5RCIE: AUSART Receive Interrupt Enab le bit
1 = Enables the AUSART receive interrupt
0 = Disables the AUSART receive interru pt
bit 4TXIE: AUSART Transmit Interrupt Enable bit
1 = Enables the AUSART transmit interrupt
0 = Disables the AUSART transmit interrupt
bit 3SSPIE: Synchronous Serial Port Interrupt Enable bit
1 = Enables the SSP interrupt
0 = Disables the SSP interrupt
bit 2CCP1IE: CCP1 Interrupt Enable bit
1 = Enables the CCP1 interrupt
0 = Disables the CCP1 interrupt
bit 1TMR2IE: TMR2 to PR2 Match Interrupt Enable bit
1 = Enables the TMR2 to PR2 match interrupt
0 = Disables the TMR2 to PR2 match interrupt
bit 0TMR1IE: TMR1 Overflow Interrupt Enable bit
1 = Enables the TMR1 overflow interrupt
0 = Disables the TMR1 overflow interrupt
ADIERCIETXIESSPIECCP1IETMR2IETMR1IE
(1)
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
DS30498C-page 24 2004 Microchip Technology Inc.
PIC16F7X7
2.2.2.5PIR1 Register
The PIR1 register contains the individual flag bits for
the periph eral interrupts.
Note: Interrupt flag bits are set when an interrupt
condition occurs regardless of the state of its
corresponding enable bit or the Global Interrupt Enable bit, GIE (INTCON<7>). User
software should ensure the appropriate interrupt bits are clear prior to enabling an interrupt.
1 = System oscillator failed, clock input has changed to INTRC (must be cleared in software)
0 = System clock operating
bit 6CMIF: Comparator Interrupt Fl ag bit
1 = Comparator input has changed (must be cleared in software)
0 = Comparator input has not changed
bit 5LVDIF: Low-Voltage Detect Interrupt Flag bit
1 = The supply vol tage h as falle n below the spec ified LVD voltage ( must be c leared in softwar e)
0 = The supply voltage is greater then the specified LVD voltage
bit 4Unimplemented: Read as ‘0’
bit 3BCLIF: Bus Collision Interrupt Flag bit
1 = A bus collision has occurred in the SSP when configured for I
0 = No bus collision has occurred
bit 2Unimplemented: Read as ‘0’
bit 1CCP3IF: CCP3 Interrupt Flag bit
Capture mode:
1 = A TMR1 register capture occurred (must be cleared in software)
0 = No TMR1 register capture occurred
Compare mode:
1 = A TMR1 register compare match occurred (must be cleared in software)
0 = No TMR1 register compare match occurred
PWM mode:
Unused in this mode.
bit 0CCP2IF: CCP2 Interrupt Flag bit
Capture mode:
1 = A TMR1 register capture occurred (must be cleared in software)
0 = No TMR1 register capture occurred
Compare mode:
1 = A TMR1 register compare match occurred (must be cleared in software)
0 = No TMR1 register compare match occurred
PWM mode:
Unused.
Note:Interrupt flag bits are set when an in terrupt
condition occurs regardles s of the sta te of
its corresponding enable bit or the Global
Interrupt Enable bit, GIE (INTCON<7>).
User software shoul d ensure the appropriate interrupt flag bits are clear prior to
enabling an interrupt.
2
C Master mode
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
2004 Microchip Technology Inc.DS30498C-page 27
PIC16F7X7
2.2.2.8PCON Register
The Power Control (PCON) register contains flag bits
to allow differentiation between a Power-on Reset
(POR), a Brown-out Reset (BOR), a Watchdog Reset
(WDT) and an external MCLR
Reset.
Note:BOR is unknown on POR. It must be set
by the user and checked on subsequent
Resets to see if BOR is clear, indicating a
brown-out has occurred. The BOR status
bit is not predictab le if the brown-ou t circuit
is disabled (by clearing the BOREN bit in
the Configuration Word register).
REGISTER 2-8:PCON: POWER CONTROL/STATUS REGISTER (ADDRESS 8Eh)
U-0U-0U-0U-0U-0R/W-1R/W-0R/W-1
—————SBORENPORBOR
bit 7bit 0
bit 7-3Unimplemented: Read as ‘0’
bit 2SBOREN: Software Brown-out Reset Enable bit
If BORSEN in Configuration Word 2 is a ‘
1 = BOR enabled
0 = BOR disabled
bit 1POR
1 = No Power-on Reset occurred
0 = A Power-on Reset occurred (must be set in software after a Power-on Reset occurs)
bit 0BOR
1 = No Brown-out Reset occurred
0 = A Brown-out Reset occurred (must be set in software after a Brown-out Reset occurs)
: Power-on Reset Status bit
: Brown-out Reset Status bit
1’ and BOREN in Configuration Word 1 is ‘0’:
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
DS30498C-page 28 2004 Microchip Technology Inc.
Loading...
+ 246 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.