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.
®
8-bit MCUs, KEELOQ
®
code hopping
DS41250B-page iiPreliminary 2004 Microchip Technology Inc.
PIC16F91X
28/40/44-Pin Flash-Based, 8-Bit CMOS Microcontrollers with nanoWatt Technology
High-Performance RISC CPU:
• Only 35 instructions to learn:
- All single-cycle instructions except branches
• Operating speed:
- DC – 20 MHz oscillator/clock input
- DC – 200 n s instruction cycle
• Program Memory Read (PMR) capability
• Interrupt capability
• 8-level deep hardware stack
• Direct, Indirect and Relative Addressing modes
Special Microcontroller Features:
• Precision Internal Oscillator:
- Factory calibrated to ±1%
- Software selectable frequency range of
8 MHz to 32 kHz
- Software tunable
- Two-Speed Start-up mode
- Crystal fail detect for critical applications
- Clock mode switching during operation for
power savings
• Power-saving Sleep mode
• Wide operating voltage range (2.0V-5.5V)
• Industrial and Extended tempera t ure range
• Power-on Reset (POR)
• Power-up Timer (PWRT) and Oscillator Start-up
Timer (OST)
• Brown-out Reset (BOR) with software control
option
• Enhanced Low-Current Watchdog Timer (WDT)
with on-chip oscillator (software selectable
nominal 268 seconds with full prescaler) wit h
software enable
• Multiplexed Master Clear with pull-up/input pin
• Programmable code protection
• High-Endurance Flash/EEPROM cell:
- 100,000 write Flash endurance
- 1,000,000 write EEPROM endurance
- Flash/Data EEPROM retention: > 40 years
Low-Power Features:
• Standby Current:
- 1 nA @ 2.0V, typical
• Operating Current:
-8.5µA @ 32 kHz, 2.0V, typical
-100µA @ 1 MHz, 2.0V , typical
• Watchdog Timer Current:
-1µA @ 2.0V, typical
Peripheral Features:
• Liquid Crystal Display module:
- Up to 60 pixel drive capability on 28-pin
devices
- Up to 96 pixel drive capability on 40-pin
devices
- Four commons
• Up to 35 I/O pins and 1 input-only pin:
- High-current source/sink for direct LED drive
- Interrupt-on-pin change
- Individually programmable weak pull-ups
• In-Circuit Serial Programming™ (ICSP™) via two
pins
• Analog comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference
REF) module (% of VDD)
(CV
- Comparator inputs and outputs externally
accessible
• A/D Converter:
- 10-bit resolution and up to 8 channels
• Timer0: 8-bit timer/counter with 8-bit
programmable prescaler
• Enhanced Timer1:
- 16-bit timer/counter with prescaler
- External Gate Input mode
- Option to use OSC1 and OSC2 as Timer1
oscillator if INTOSCIO or LP mode is
selected
• Timer2: 8-bit timer/counter with 8-bit period
register, prescaler and postscaler
13.0 Data EEPROM and Flash Program Memory Control............................................................................................................... 153
16.0 Special Features of the CPU.................................................... ..................... ........................................................................... 185
17.0 Instruction Set Summary.......................................................................................................................................................... 205
18.0 Development Support............................................................................................................................................................... 215
20.0 DC and AC Characteristics Graphs and Tables....................................................................................................................... 247
Appendix A: Data Sheet Revision History.......................................................................................................................................... 259
Appendix B: Migrating From Other PICmicro® Devices .................................................................................................................... 259
Index .................................................................................................................................................................................................. 261
Systems Information and Upgrade Hot Line...................................................................................................................................... 269
Product Identification System ............................................................................................................................................................ 271
TO OUR VALUED CUSTOMERS
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.
DS41250B-page 6Preliminary 2004 Microchip Technology Inc.
1.0DEVICE OVERVIEW
This documen t conta i ns dev ic e spec if i c in for m at i on fo r
the PIC16F91X. Addition al informatio n may be found i n
the “PICmicro® Mid-Range MCU Family Reference
Manual” (DS33023), downloaded from the Microchip
web site. The Reference Ma nu al should be consi dered
a complementary document to this data sheet and is
highly recommended reading for a better
understanding of the dev ice arc hitecture and operatio n
of the peripheral modules.
The PIC16F91X devices are covered by this data
sheet. It is available in 28/40/44-pin packages.
Figure 1-1 shows a block diagram of the PIC16F913/
916 device and Table 1-1 shows the pinout description.
Figure 1-2 shows a block diagram of the PIC16F914/
917 device and Table 1-1 shows the pinout description.
RC7/RX/DT/SDI/SDA/SEG8RC7STCMOS General purpose I/O.
RXST—USART asynchronous serial receive.
DTSTCMOS USART synchronou s se ri al data.
SDISTCMOS SPI™ da ta input.
SDASTCMOS I
SEG8—ANLCD analog output.
RD0/COM3
(1, 2)
RD0STCMOS General purpose I/O.
COM3—ANLCD analog output.
(2)
RD1
RD2/CCP2
(2)
RD1STCMOS General purpose I/O.
RD2STCMOS General purpose I/O.
CCP2STCMO S C apture 2 input/Compare 2 output / PW M 2 output.
RD3/SEG16
(2)
RD3STCMOS General purpose I/O.
SEG16—ANLCD analog output.
RD4/SEG17
(2)
RD4STCMOS General purpose I/O.
SEG17—ANLCD analog output.
RD5/SEG18
(2)
RD5STCMOS General purpose I/O.
SEG18—ANLCD analog output.
RD6/SEG19
(2)
RD6STCMOS General purpose I/O.
SEG19—ANLCD analog output.
RD7/SEG20
(2)
RD7STCMOS General purpose I/O.
SEG20—ANLCD analog output.
RE0/AN5/SEG21
(2)
RE0STCMOS General purpose I/O.
AN5AN—Analog input Channel 5.
SEG21—ANLCD analog output.
RE1/AN6/SEG22
(2)
RE1STCMOS General purpose I/O.
AN6AN—Analog input Channel 6.
SEG22—ANLCD analog output.
RE2/AN7/SEG23
(2)
RE2STCMOS General purpose I/O.
AN7AN—Analog input Channel 7.
SEG23—ANLCD analog output.
RE3/MCLR
/VPPRE3ST—Digital input only.
MCLRST—M aster Clear with internal pull-up.
PPHV—Programming voltage.
V
VDDVDDD—Power supply for microcontroller.
SSVSSD—Ground refer enc e f or m icrocontroller.
V
Legend:AN = Analog input or outputCMOS = CMOS compatible input or ou t putD = Direct
TTL = TTL compatible inputST= Schmitt Trigger input with CMOS levels
HV = High VoltageXTAL = Crystal
Note 1:COM 3 i s av ai labl e on RA3 for the PIC16F913 /916 and on RD0 for the PIC16F914/917.
2:Pins available on PIC16F914/917 only.
Type
Output
Type
2
C™ data.
Description
DS41250B-page 12Preliminary 2004 Microchip Technology Inc.
PIC16F91X
2.0MEMORY ORGANIZATION
2.1Program Memory Organization
The PIC16F91X has a 13-bit program counter capable
of addressing a 4k x 14 program memory space for the
PIC16F913/914 (0000h-0FFFh) and an 8k x 14 program
memory space for the PIC16F916/917 (0000h-1FFFh).
Accessing a location above the memory boundaries for
the PIC16F913 and PIC16F914 will cause a wrap
around within the first 4k x 14 space. The Reset vector
is at 0000h and the interrupt vector is at 0004h.
The data memory is partitioned into multiple banks,
which contain the General Purpose Registers (GPRs)
and the Special Function Registers (SFRs). Bits RP0
and RP1 are bank select bits.
RP0RP1 (Status<6:5>)
= 00: → Bank 0
= 01: → Bank 1
= 10: → Bank 2
= 11: → Bank 3
Each bank extends up to 7Fh (128 bytes). The lower
locations of each bank are reserved for the Special
Function Registers. Above the Special Function
Registers are the General Purpose Registers,
implemented as static RAM. All implemented banks
contain Special Function Registers. Some frequently
used Special Function Registers from one bank are
mirrored in another bank for code reduction and
quicker access.
2.2.1GENERAL PURPOSE REGISTER
FILE
The register file is organized as 256x 8 in the
PIC16F913/914 and 352 x 8 in the PIC16F916/917.
Each register is accessed either directly or indirectly
through the File Select Register (FSR) (see Section 2.5“Indirect Addressing, INDF and FSR Registers”).
2.2.2SPECIAL FUNCTION REGISTERS
The Special Function Registers are registers used by
the CPU and peripheral functions for controlling the
desired operation of the device (see Tables 2-1,
2-2, 2-3 and 2-4). These registers are static RAM.
The special re gisters can be classifi ed into two sets:
core and peripheral. The Special Function Registers
associated with the “c ore” are des cribed in this sect ion.
Those related to the operation of the peripheral
features are described in the section of that peripheral
feature.
DS41250B-page 14Preliminary 2004 Microchip Technology Inc.
PIC16F91X
FIGURE 2-3:PIC16F913/916 SPECIAL FUNCTION REGISTERS
2:On the PIC16F914, unimplemented data memory locations, read as ‘0’.
DS41250B-page 16Preliminary 2004 Microchip Technology Inc.
Purpose
Register
80 Bytes
accesses
70h-7Fh
EFh16Fh1EFh
F0haccesses
General
Purpose
Register
80 Bytes
70h-7Fh
170haccesses
70h-7Fh
1F0h
PIC16F91X
TABLE 2-1:PIC16F91X SPECIAL REGISTERS SUMMARY BANK 0
AddrNameBit 7Bit 6Bit 5Bit 4Bit 3Bit 2 Bit 1Bit 0
Bank 0
00hINDFAddressing this location uses contents of FSR to address data memory (not a physical register)xxxx xxxxxxxx xxxx
01hTMR0Timer0 Module Registerxxxx xxxx uuuu uuuu
02hPCLProgram Counter’s (PC) Least Significant Byte0000 0000 0000 0000
03hSTATUSIRPRP1RP0TO
04hFSRIndirect Data Memory Address Pointerxxxx xxxx uuuu uuuu
05hPORTARA7RA6RA5RA4RA3RA2RA1RA0xxxx xxxx uuuu uuuu
06hPORTBRB7RB6RB5RB4RB3RB2RB1RB0xxxx xxxx uuuu uuuu
07hPORTCRC7RC6RC5RC4RC3RC2RC1RC0xxxx xxxx uuuu uuuu
08hPORTD
09hPORTE
0AhPCLATH
0BhINTCONGIE PEIET0IEINTERBIET0IFINTFRBIF0000 000x 0000 000x
0ChPIR1
0DhPIR2
0EhTMR1LHolding Register for the Least Significant Byte of the 16-bit TMR1xxxx xxxx uuuu uuuu
0FhTMR1HHolding Register for the Most Significant Byte of the 16-bit TMR1xxxx xxxx uuuu uuuu
10hT1CONT1GINVT1GET1CKPS1 T1CKPS0 T1OSCEN T1SYNC
11hTMR2
12hT2CON
13hSSPBUFSynchron ous Seri al Port Receive Buffer/Transmit Registerxxxx xxxx uuuu uuuu
14hSSPCONWCOLSSPOVSSPENCKPS SPM3SSPM2SSPM1SSPM00000 0000 0000 0000
15hCCPR1LCapture/Compare/PWM Register 1 (LSB)xxxx xxxx uuuu uuuu
16hCCPR1HCapture/Compare/PWM Register 1 (MSB)xxxx xxxx uuuu uuuu
17hCCP1CON
18hRCSTASPENRX9SRENCRENADDENFERROERRRX9D0000 000x 0000 000x
19hTXREGUSART Transmit Data Register0000 0000 0000 0000
1AhRCREGUSART Receive Data Register0000 0000 0000 0000
(2)
1Bh
(2)
1Ch
(2)
1Dh
1EhADRESHA/D Result Register High Bytexxxx xxxx uuuu uuuu
1FhADCON0ADFMVCFG1VCFG0CHS2CHS1CHS0GO/DONE
Legend:— = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
Note 1:Other (non Power-up) Resets include MCLR
(2)
RD7RD6RD5RD4RD3RD2RD1RD0xxxx xxxx uuuu uuuu
————RE3RE2
———Write Buffer for upper 5 bits of Program Counter---0 0000 ---0 0000
Legend:— = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
Note 1:Other (non Power-up) Resets include MCLR
(2)
2:PI C 16F 91 4/9 17 only.
3:PI C 16F 91 4/9 17 only, forced ‘0’ on PIC16F91 3/9 16.
4:The value of the OSTS bit is dependent on the value of the Configuration Word (CONFIG) of the device. See Section 3.0 “Clock
Legend:— = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
Note 1:Other (non Power-up) Resets include MCLR
(3)
(3)
(2,3)
2:PIC16F914/917 only.
3:This register is only initialized by a POR or BOR reset and is unchanged by other Resets.
Legend:— = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
Note 1:Other (non Power-up) Resets include MCLR
Write Buffer for the upper 5 bits of the Program Counter---0 0000 ---0 0000
WRERRWRENWRRD0--- x000 0--- q000
Reset and Watchdog Timer Reset dur ing nor mal operation.
Value on
POR/BOR
Reset
xxxx xxxx xxxx xxxx
Value on
all other
Resets
(1)
DS41250B-page 20Preliminary 2004 Microchip Technology Inc.
PIC16F91X
2.2.2.1Status Register
The Status register, shown in Register 2-1, contains:
• the arithmetic status of the ALU
• the Reset status
• the bank select bits for data memory (SRAM)
The Status register can be the destination for any
instruction, like 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 will clear 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 register , beca use these instru ctions do not af fect
any Status bits. For other instructions not affecting any
Status bits (see Section 17.0 “Instruction Set
Summary”).
Note 1: The C and DC bits operate as a Borrow
and Digit Borrow out bit, respectively, in
subtraction. See the SUBLW and SUBWF
instructions for examples.
REGISTER 2-1:STATUS – STATUS REGISTER (ADDRESS: 03h, 83h, 103h OR 183h)
R/W-0R/W-0R/W-0R-1R-1R/W-xR/W-xR/W-x
IRPRP1RP0TOPDZDCC
bit 7bit 0
bit 7
bit 6-5
bit 4
bit 3
bit 2
bit 1
bit 0
IRP: Register Bank Select bit (used for indirect addressing)
1 = Bank 2, 3 (100h-1FFh)
0 = Bank 0, 1 (00h-FFh)
RP<1:0>: Register Bank Select bits (used for direct addressing)
00 = Bank 0 (00h-7Fh)
01 = Bank 1 (80h-FFh)
10 = Bank 2 (100h-17Fh)
11 = Bank 3 (180h-1FFh)
TO: Time-out bit
1 = After power-up, CLRWDT instruction or SLEEP instruction
0 = A WDT time-out occurred
PD: Power-down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
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
DC: Digit Carry/Borrow 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 resultC: Carry/Borrow 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 1: For Bo
rrow, the polarity is reversed. A subtraction is executed by adding the 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.
(1)
(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
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
DS41250B-page 22Preliminary 2004 Microchip Technology Inc.
PIC16F91X
2.2.2.3INTCON Register
The INTCON register is a readable and writable
register , which c ontains the various en able and fl ag bit s
for TMR0 register overflow, PORTB change and
external RB0/INT/SEG0 pin interrupts.
Note:Interrupt flag bits are set when an interr upt
condition occurs, regard less of the st ate of
its corresponding enable bit or the global
enable bit, GIE (INTCON<7>). User
software should ensure the appropriate
interrupt flag bits are clear prior to
enabling an interrupt.
REGISTER 2-3:INTCON – INTERRUPT CONTROL REGISTER (ADDRESS: 0Bh, 8Bh, 10Bh OR
18Bh)
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-x
GIEPEIET0IEINTERBIET0IFINTFRBIF
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 5T0IE: TMR0 Overflow Interrupt Enable bit
1 = Enables the TMR0 interrupt
0 = Disables the TMR0 in terrupt
bit 4INTE: RB0/INT/SEG0 External Interrupt Enable bit
1 = Enables the RB0/INT/SEG0 external interrupt
0 = Disables the RB0/INT/SEF0 external interrupt
bit 3RBIE: PORTB Change Interrupt Enable bit
1 = Enables the PORTB change interrupt
0 = Disables the PORTB change interrupt
bit 2T0IF: TMR0 Overflow Interrupt Flag bit
1 = TMR0 regis ter has overflowed (must be cleared in software)
0 = TMR0 register did not overflow
bit 1INTF: RB0/INT/SEG0 External Interrupt Flag bit
1 = The RB0/INT/SEG0 external interrupt occurred (must be cleared in software)
0 = The RB0/INT/SEG0 external interrupt did not occur
bit 0RBIF: PORTB Change Interrupt Flag bit
1 = When at least one of the PORTB <5:0> pins changed state (must be cleared in software)
0 = None of the PORTB <7:4> pins have changed state
Note 1: IOCB register must also be enabled.
2: T0IF bit is set when Timer0 rolls over. Timer0 is unchanged on Reset and should
be initialized before clearing T0IF bit.
(1)
(2)
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
1 = The write operation completed (must be cleared in software)
0 = The write operation has not completed or has not started
bit 6ADIF: A/D Converter Interrupt Flag bit
1 = The A/D conversion completed (must be cleared in software)
0 = The A/D conversion is not complete
bit 5RCIF: USART Receive Interrupt Flag bit
1 = The USART receive buffer is full (cleared by reading RCREG)
0 = The USART receive buffer is not full
bit 4TXIF: USART Transmit Interrupt Flag bit
1 = The USART transmit buffer is empty (cleared by writing to TXREG)
0 = The USART transmit buffer is full
bit 3SSPIF: Synchronous Serial Port (SSP) Interrupt Flag bit
1 = The Transmission/Reception is complete (must be cleared in software)
0 = Waiting to Transmit/Receive
bit 2CCP1IF: CCP1 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 1TMR2IF: TMR2 to PR2 Interrupt Flag bit
1 = A TMR2 to PR2 match occurred (must be cleared in software)
0 = No TMR2 to PR2 match occurred
bit 0TMR1IF: TMR1 Overflow Interrupt Flag bit
1 = The TMR 1 register overflowed (must be cleared in software)
0 = The TMR1 register did not overflow
Note:Interrupt flag bits are set when an interrupt
condition occurs, regardless of the state of
its corresponding enable bit or the global
enable bit, GIE (INTCON<7>). User
software should ensure the appropriate
interrupt flag bits are clear prior to enabling
an interrupt.
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
DS41250B-page 26Preliminary 2004 Microchip Technology Inc.
PIC16F91X
2.2.2.7PIR2 Register
The PIR2 register contains the interrupt flag bits, as
shown in Register 2-7.
1 = System oscillator failed, clock input ha s changed to INT OSC (must be c leared in s oftware)
0 = System clock operating
bit 6C2IF: Comparator 2 Interrupt Flag bit
1 = Comparator output (C2OUT bit) has changed (must be cleared in software)
0 = Comparator output (C2OUT bit) has not changed
bit 5C1IF: Comparator 1 Interrupt Flag bit
1 = Comparator output (C1OUT bit) has changed (must be cleared in software)
0 = Comparator output (C1OUT bit) has not changed
bit 4LCDIF: LCD Module Interrupt bit
1 = LCD has generated an interrupt
0 = LCD has not generated an int errupt
bit 3Unimplemented: Read as ‘0’
bit 2LVDIF: Low Voltage Detect Interrupt Flag bit
1 = LVD has generated an interrupt
0 = LVD has not generated an interrupt
bit 1Unimplemented: Read as ‘0’
bit 0CCP2IF: CCP2 Interrupt Flag bit (only available in 16F914/917)
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
Note:Interrupt flag bits are set when an interrupt
condition occurs, regardless of the state of
its corresponding enable bit or the global
enable bit, GIE (INTCON<7>). User
software should ensure the appropriate
interrupt flag bits are clear prior to enabling
an interrupt.
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