Datasheet PIC16C710, PIC16C71, PIC16C711, PIC16C715 Datasheet

PIC16C71X
8-Bit CMOS Microcontrollers with A/D Converter
Devices included in this data sheet:
• PIC16C710
• PIC16C71
• PIC16C711
• PIC16C715
PIC16C71X Microcontroller Core Features:
• High-performance RISC CPU
• Only 35 single word instructions to learn
• All single cycle instructions except for program branches which are two cycle
• Operating speed: DC - 20 MHz clock input
DC - 200 ns instruction cycle
• Up to 2K x 14 words of Program Memory, up to 128 x 8 bytes of Data Memory (RAM)
• Interrupt capability
• Eight level deep hardware stack
• Direct, indirect, and relative addressing modes
• Power-on Reset (POR)
• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code-protection
• Power saving SLEEP mode
• Selectable oscillator options
• Low-power, high-speed CMOS EPROM technology
• Fully static design
• Wide operating voltage range: 2.5V to 6.0V
• High Sink/Source Current 25/25 mA
• Commercial, Industrial and Extended temperature ranges
• Program Memory Parity Error Checking Circuitry with Parity Error Reset (PER) (PIC16C715)
• Low-power consumption:
- < 2 mA @ 5V, 4 MHz
- 15 µ A typical @ 3V, 32 kHz
- < 1 µ A typical standby current
PIC16C71X Peripheral Features:
• Timer0: 8-bit timer/counter with 8-bit prescaler
• 8-bit multichannel analog-to-digital converter
• Brown-out detection circuitry for Brown-out Reset (BOR)
• 13 I/O Pins with Individual Direction Control
PIC16C7X Features 710 71 711 715
Program Memory (EPROM)
512 1K 1K 2K
x 14 Data Memory (Bytes) x 8 36 36 68 128 I/O Pins 13 13 13 13 Timer Modules 1 1 1 1 A/D Channels 4 4 4 4 In-Circuit Serial Programming Yes Yes Yes Yes Brown-out Reset Yes Yes Yes Interrupt Sources 4 4 4 4
Pin Diagrams
PDIP, SOIC, Windowed CERDIP
RA2/AN2
RA3/AN3/V
RA4/T0CKI
MCLR/VPP
RB0/INT
SSOP
RA2/AN2
RA3/AN3/V
RA4/T0CKI
MCLR/VPP
RB0/INT
VSS
RB1 RB2 RB3
RB1 RB2 RB3
REF
REF
VSS VSS
• 1 2
PIC16C715
• 1 2 3 4 5 6 7
18 17
PIC16C710
PIC16C71
PIC16C711
16 15 14 13 12 11 10
20 19
PIC16C710
PIC16C711
PIC16C715
18 17 16 15 14 13 12 11
RA1/AN1 RA0/AN0 OSC1/CLKIN OSC2/CLKOUT
DD
V RB7 RB6
RB5 RB4
RA1/AN1 RA0/AN0 OSC1/CLKIN OSC2/CLKOUT VDD
DD
V RB7 RB6 RB5 RB4
1997 Microchip Technology Inc. DS30272A-page 1
PIC16C71X
Table of Contents
1.0 General Description.................................................................................................................................................................... 3
2.0 PIC16C71X Device Varieties......................................................................................................................................................5
3.0 Architectural Overview................................................................................................................................................................7
4.0 Memory Organization ............................................................................................................................................................... 11
5.0 I/O Ports.................................................................................................................................................................................... 25
6.0 Timer0 Module..........................................................................................................................................................................31
7.0 Analog-to-Digital Converter (A/D) Module ................................................................................................................................ 37
8.0 Special Features of the CPU .................................................................................................................................................... 47
9.0 Instruction Set Summary .......................................................................................................................................................... 69
10.0 Development Support............................................................................................................................................................... 85
11.0 Electrical Characteristics for PIC16C710 and PIC16C711....................................................................................................... 89
12.0 DC and AC Characteristics Graphs and Tables for PIC16C710 and PIC16C711..................................................................101
13.0 Electrical Characteristics for PIC16C715................................................................................................................................ 111
14.0 DC and AC Characteristics Graphs and Tables for PIC16C715 ............................................................................................ 125
15.0 Electrical Characteristics for PIC16C71.................................................................................................................................. 135
16.0 DC and AC Characteristics Graphs and Tables for PIC16C71 .............................................................................................. 147
17.0 Packaging Information............................................................................................................................................................ 155
Appendix A: ...................................................................................................................................................................................... 161
Appendix B: Compatibility................................................................................................................................................................. 161
Appendix C: What’s New.................................................................................................................................................................. 162
Appendix D: What’s Changed .......................................................................................................................................................... 162
Index .................................................................................................................................................................................................. 163
PIC16C71X Product Identification System......................................................................................................................................... 173
To Our Valued Customers
We constantly strive to improve the quality of all our products and documentation. We have spent an exceptional amount of time to ensure that these documents are correct. However, we realize that we may have missed a few things. If you find any information that is missing or appears in error, please use the reader response form in the back of this data sheet to inform us. We appreciate your assistance in making this a better document.
DS30272A-page 2
1997 Microchip Technology Inc.
PIC16C71X

1.0 GENERAL DESCRIPTION

The PIC16C71X is a family of mance, CMOS, fully-static, 8-bit microcontrollers with integrated analog-to-digital (A/D) converters, in the PIC16CXX mid-range family.
All PIC16/17 microcontrollers employ an advanced RISC architecture. The PIC16CXX microcontroller fam­ily has enhanced core features, eight-level deep stack, and multiple internal and external interrupt sources. The separate instruction and data buses of the Harvard architecture allow a 14-bit wide instruction word with the separate 8-bit wide data. The two stage instruction pipeline allows all instructions to execute in a single cycle, except for program branches which require two cycles. A total of 35 instructions (reduced instruction set) are available . Additionally , a large register set giv es some of the architectural innovations used to achie ve a very high performance.
PIC16CXX microcontrollers typically achieve a 2:1 code compression and a 4:1 speed improvement over other 8-bit microcontrollers in their class.
The PIC16C710/71 devices hav e 36 bytes of RAM, the
PIC16C711 has 68 bytes of RAM and the PIC16C715
has 128 bytes of RAM. Each device has 13 I/O addition a timer/counter is available. Also a 4-channel high-speed 8-bit A/D is provided. The 8-bit resolution is ideally suited for applications requiring low-cost analog interface, e.g. thermostat control, pressure sensing, etc.
The PIC16C71X family has special features to reduce external components, thus reducing cost, enhancing system reliability and reducing power consumption. There are four oscillator options, of which the single pin RC oscillator provides a low-cost solution, the LP oscil­lator minimizes power consumption, XT is a standard crystal, and the HS is for High Speed crystals. The SLEEP (power-down) feature provides a power saving mode. The user can wake up the chip from SLEEP through several external and internal interrupts and resets.
low-cost, high-perfor-
pins. In
A highly reliable Watchdog Timer with its own on-chip RC oscillator provides protection against software lock­up.
A UV erasable CERDIP packaged version is ideal for code development while the cost-effective One-Time­Programmable (OTP) version is suitable f or production in any volume.
The PIC16C71X family fits perfectly in applications ranging from security and remote sensors to appliance control and automotive. The EPROM technology makes customization of application programs (trans­mitter codes, motor speeds, receiver frequencies, etc.) extremely fast and convenient. The small footprint packages make this microcontroller series perfect for all applications with space limitations. Low cost, low power, high performance, ease of use and I/O flexibility make the PIC16C71X very versatile even in areas where no microcontroller use has been considered before (e.g. timer functions , serial communication, cap­ture and compare, PWM functions and coprocessor applications).
1.1 F
Users familiar with the PIC16C5X microcontroller fam­ily will realize that this is an enhanced version of the PIC16C5X architecture. Please refer to Appendix A for a detailed list of enhancements. Code written for the PIC16C5X can be easily ported to the PIC16CXX fam­ily of devices (Appendix B).
1.2 De
PIC16C71X devices are supported by the complete line of Microchip Development tools.
Please refer to Section 10.0 for more details about Microchip’s development tools.
amily and Upward Compatibility
velopment Support
1997 Microchip Technology Inc. DS30272A-page 3
PIC16C71X
TABLE 1-1: PIC16C71X FAMILY OF DEVICES
PIC16C71 PIC16C711 PIC16C715 PIC16C72 PIC16CR72
18-pin DIP, SOIC
Clock
Memory
Peripherals
Features
PIC16C710
Maximum Frequency
20 20 20 20 20 20
of Operation (MHz) EPROM Program Memory
512 1K 1K 2K 2K
(x14 words) ROM Program Memory
2K
(14K words) Data Memory (bytes) 36 36 68 128 128 128 Timer Module(s) TMR0 TMR0 TMR0 TMR0 TMR0,
Capture/Compare/PWM
1 1
Module(s) Serial Port(s)
2
(SPI/I
C, USART)
SPI/I
Parallel Slave Port — A/D Converter (8-bit) Channels 4 4 4 4 5 5 Interrupt Sources 4 4 4 4 8 8 I/O Pins 13 13 13 13 22 22 Voltage Range (Volts) 2.5-6.0 3.0-6.0 2.5-6.0 2.5-5.5 2.5-6.0 3.0-5.5 In-Circuit Serial Programming Yes Yes Yes Yes Yes Yes Brown-out Reset Yes Yes Yes Yes Yes Packages 18-pin DIP,
SOIC; 20-pin SSOP
18-pin DIP, SOIC; 20-pin SSOP
18-pin DIP, SOIC; 20-pin SSOP
TMR1, TMR2
2
C SPI/I
28-pin SDIP, SOIC, SSOP
TMR0, TMR1, TMR2
2
C
28-pin SDIP, SOIC, SSOP
(1)
PIC16C74A PIC16C76 PIC16C77
Clock
Memory
Maximum Frequency of Operation (MHz)
EPROM Program Memory (x14 words)
PIC16C73A
20 20 20 20
4K 4K 8K 8K
Data Memory (bytes) 192 192 376 376
Peripherals
Timer Module(s) TMR0,
TMR1, TMR2
Capture/Compare/PWM
2 2 2 2
Module(s) Serial Port(s)
2
(SPI/I
C, USART)
SPI/I
2
C, USART SPI/I
TMR0, TMR1, TMR2
2
C, USART SPI/I
TMR0, TMR1, TMR2
2
C, USART SPI/I
TMR0, TMR1, TMR2
2
C, USART
Parallel Slave Port Yes Yes A/D Converter (8-bit) Channels 5 8 5 8 Interrupt Sources 11 12 11 12 I/O Pins 22 33 22 33 Voltage Range (Volts) 2.5-6.0 2.5-6.0 2.5-6.0 2.5-6.0
Features
In-Circuit Serial Programming Yes Yes Yes Yes Brown-out Reset Yes Yes Yes Yes Packages 28-pin SDIP,
SOIC
40-pin DIP; 44-pin PLCC, MQFP, TQFP
28-pin SDIP, SOIC
40-pin DIP; 44-pin PLCC, MQFP, TQFP
All PIC16/17 Family devices ha ve Pow er-on Reset, selectab le Watchdog Timer, selectab le code protect and high I/O current capabil­ity . All PIC16C7XX Family devices use serial programming with clock pin RB6 and data pin RB7. Note 1: Please contact your local Microchip sales office for availability of these devices.
DS30272A-page 4
1997 Microchip Technology Inc.
PIC16C71X

2.0 PIC16C71X DEVICE VARIETIES

A variety of frequency ranges and packaging options are available . Depending on application and production requirements, the proper device option can be selected using the information in the PIC16C71X Product Iden­tification System section at the end of this data sheet. When placing orders, please use that page of the data sheet to specify the correct part number.
For the PIC16C71X family, there are two device “types” as indicated in the device number:
1. C , as in PIC16 C 71. These devices have EPROM type memory and operate over the standard voltage range.
2. LC , as in PIC16 LC 71. These devices have EPROM type memory and operate over an extended voltage range.
2.1 UV Erasab
The UV erasable version, offered in CERDIP package is optimal for prototype development and pilot programs. This version can be erased and reprogrammed to any of the oscillator modes.
Microchip's PICSTART programmers both support programming of the PIC16C71X.
le Devices
Plus and PRO MATE
2.3 Quic
k-Turnaround-Production (QTP)
Devices
Microchip offers a QTP Programming Service for fac­tory production orders. This service is made available for users who choose not to program a medium to high quantity of units and whose code patterns have stabi­lized. The devices are identical to the OTP devices but with all EPROM locations and configuration options already programmed by the factory. Certain code and prototype verification procedures apply before produc­tion shipments are available. Please contact your local Microchip Technology sales office for more details.
2.4 Serializ Production (SQTP
Microchip offers a unique programming service where a few user-defined locations in each device are pro­grammed with different serial numbers. The serial num­bers may be random, pseudo-random, or sequential.
Serial programming allows each device to have a unique number which can serve as an entry-code, password, or ID number.
II
ed Quick-Turnaround
SM
Devices
)
2.2 One-Time-Pr
ogrammable (OTP)
Devices
The availability of OTP devices is especially useful for customers who need the flexibility for frequent code updates and small volume applications.
The OTP devices, packaged in plastic packages, per­mit the user to program them once. In addition to the program memory, the configuration bits must also be programmed.
1997 Microchip Technology Inc. DS30272A-page 5
PIC16C71X
NOTES:
DS30272A-page 6
1997 Microchip Technology Inc.
PIC16C71X

3.0 ARCHITECTURAL OVERVIEW

The high performance of the PIC16CXX family can be attributed to a number of architectural features com­monly found in RISC microprocessors. To begin with, the PIC16CXX uses a Harvard architecture, in which, program and data are accessed from separate memo­ries using separate buses. This improves bandwidth over traditional v on Neumann architecture in which pro­gram and data are fetched from the same memory using the same bus. Separating program and data buses further allows instructions to be sized differently than the 8-bit wide data word. Instruction opcodes are 14-bits wide making it possible to have all single word instructions. A 14-bit wide program memory access bus fetches a 14-bit instruction in a single cycle. A two­stage pipeline overlaps fetch and execution of instruc­tions (Example 3-1). Consequently, all instructions (35) execute in a single cycle (200 ns @ 20 MHz) e xcept f or program branches.
The table below lists program memory (EPROM) and data memory (RAM) for each PIC16C71X device.
Device
PIC16C710 512 x 14 36 x 8 PIC16C71 1K x 14 36 x 8 PIC16C711 1K x 14 68 x 8 PIC16C715 2K x 14 128 x 8
The PIC16CXX can directly or indirectly address its register files or data memory. All special function regis­ters, including the program counter, are mapped in the data memory. The PIC16CXX has an orthogonal (sym­metrical) instruction set that makes it possible to carry out any operation on any register using any addressing mode. This symmetrical nature and lack of ‘special optimal situations’ make programming with the PIC16CXX simple yet efficient. In addition, the learning curve is reduced significantly.
Program
Memory
Data Memory
PIC16CXX devices contain an 8-bit ALU and working register. The ALU is a general purpose arithmetic unit. It performs arithmetic and Boolean functions between the data in the working register and any register file.
The ALU is 8-bits wide and capable of addition, sub­traction, shift and logical operations. Unless otherwise mentioned, arithmetic operations are two's comple­ment in nature. In two-operand instructions, typically one operand is the working register (W register). The other operand is a file register or an immediate con­stant. In single operand instructions, the operand is either the W register or a file register.
The W register is an 8-bit working register used f or ALU operations. It is not an addressable register.
Depending on the instruction executed, the ALU may affect the values of the Carry (C), Digit Carry (DC), and Zero (Z) bits in the STATUS register. The C and DC bits operate as a borro respectively, in subtraction. See the SUBLW and SUBWF instructions for examples.
w bit and a digit borrow out bit,
1997 Microchip Technology Inc. DS30272A-page 7
PIC16C71X
FIGURE 3-1: PIC16C71X BLOCK DIAGRAM
Device Program Memory Data Memory (RAM)
PIC16C710 PIC16C71 PIC16C711 PIC16C715
512 x 14
1K x 14 1K x 14 2K x 14
36 x 8 36 x 8 68 x 8
128 x 8
Program
Bus
OSC1/CLKIN OSC2/CLKOUT
EPROM
Program
Memory
14
Instruction reg
Instruction
Decode &
Control
Timing
Generation
13
Program Counter
8 Level Stack
Direct Addr
8
Start-up Timer
Watchdog
Brown-out
(13-bit)
Power-up
Timer
Oscillator
Power-on
Reset
Timer
(2)
Reset
RAM Addr
7
3
8
Data Bus
RAM
File
Registers
(1)
Addr MUX
FSR reg
STATUS reg
ALU
W reg
Timer0
9
8
MUX
8
Indirect
Addr
PORTA
RA0/AN0 RA1/AN1 RA2/AN2 RA3/AN3/VREF RA4/T0CKI
PORTB
RB0/INT
RB7:RB1
Note 1: Higher order bits are from the STATUS register.
2: Brown-out Reset is not available on the PIC16C71.
DS30272A-page 8
MCLR
VDD, VSS
A/D
1997 Microchip Technology Inc.
PIC16C71X
TABLE 3-1: PIC16C710/71/711/715 PINOUT DESCRIPTION
SSOP
Pin Name
DIP
Pin#
Pin#
OSC1/CLKIN 16 18 16 I OSC2/CLKOUT 15 17 15 O Oscillator crystal output. Connects to crystal or resonator in crystal
MCLR/V
PP
4 4 4 I/P ST Master clear (reset) input or programming voltage input. This pin is
RA0/AN0 17 19 17 I/O TTL RA0 can also be analog input0 RA1/AN1 18 20 18 I/O TTL RA1 can also be analog input1 RA2/AN2 1 1 1 I/O TTL RA2 can also be analog input2 RA3/AN3/V
REF
2 2 2 I/O TTL RA3 can also be analog input3 or analog reference voltage
RA4/T0CKI 3 3 3 I/O ST RA4 can also be the cloc k input to the Timer0 module . Output is
RB0/INT 6 7 6 I/O TTL/ST RB1 7 8 7 I/O TTL RB2 8 9 8 I/O TTL RB3 9 10 9 I/O TTL RB4 10 11 10 I/O TTL Interrupt on change pin. RB5 11 12 11 I/O TTL Interrupt on change pin. RB6 12 13 12 I/O TTL/ST RB7 13 14 13 I/O TTL/ST
SS
V
DD
V
5 4, 6 5 P Ground reference for logic and I/O pins.
14 15, 16 14 P Positive supply for logic and I/O pins.
Legend: I = input O = output I/O = input/output P = power
— = Not used TTL = TTL input ST = Schmitt Trigger input
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: The PIC16C71 is not available in SSOP package.
SOIC
(4)
Pin#
I/O/P Type
Buffer
Type
ST/CMOS
Description
(3)
Oscillator crystal input/external clock source input.
oscillator mode. In RC mode , OSC2 pin outputs CLKOUT which has 1/4 the frequency of OSC1, and denotes the instruction cycle rate.
an active low reset to the device. PORTA is a bi-directional I/O port.
open drain type.
PORTB is a bi-directional I/O port. PORTB can be software pro­grammed for internal weak pull-up on all inputs.
(1)
(2) (2)
RB0 can also be the external interrupt pin.
Interrupt on change pin. Serial programming clock. Interrupt on change pin. Serial programming data.
1997 Microchip Technology Inc. DS30272A-page 9
PIC16C71X
3.1 Cloc
king Scheme/Instruction Cycle
The clock input (from OSC1) is internally divided by four to generate four non-overlapping quadrature clocks namely Q1, Q2, Q3 and Q4. Internally, the pro­gram counter (PC) is incremented every Q1, the instruction is fetched from the program memory and latched into the instruction register in Q4. The instruc­tion is decoded and executed during the following Q1 through Q4. The clocks and instruction execution flow is shown in Figure 3-2.
FIGURE 3-2: CLOCK/INSTRUCTION CYCLE
Q2 Q3 Q4
OSC1
Q1 Q2 Q3
Q4 PC
OSC2/CLKOUT
(RC mode)
Q1
PC PC+1 PC+2
Fetch INST (PC)
Execute INST (PC-1) Fetch INST (PC+1)
Q1
3.2 Instruction Flo
w/Pipelining
An “Instruction Cycle” consists of four Q cycles (Q1, Q2, Q3 and Q4). The instruction fetch and execute are pipelined such that fetch takes one instruction cycle while decode and execute takes another instruction cycle. However, due to the pipelining, each instruction effectively executes in one cycle. If an instruction causes the program counter to change (e.g. GOTO ) then two cycles are required to complete the instruction (Example 3-1).
A fetch cycle begins with the program counter (PC) incrementing in Q1.
In the execution cycle , the fetched instruction is latched into the “Instruction Register” (IR) in cycle Q1. This instruction is then decoded and executed during the Q2, Q3, and Q4 cycles. Data memory is read during Q2 (operand read) and written during Q4 (destination write).
Q2 Q3 Q4
Execute INST (PC) Fetch INST (PC+2)
Q2 Q3 Q4
Q1
Execute INST (PC+1)
Internal phase clock
EXAMPLE 3-1: INSTRUCTION PIPELINE FLOW
Tcy0 Tcy1 Tcy2 Tcy3 Tcy4 Tcy5
1. MOVLW 55h
2. MOVWF PORTB
3. CALL SUB_1
4. BSF PORTA, BIT3 (Forced NOP)
5. Instruction @ address SUB_1
All instructions are single cycle, except for any program branches. These take two cycles since the fetch instruction is “flushed” from the pipeline while the new instruction is being fetched and then executed.
DS30272A-page 10
Fetch 1 Execute 1
Fetch 2 Execute 2
Fetch 3 Execute 3
Fetch 4 Flush
Fetch SUB_1 Execute SUB_1
1997 Microchip Technology Inc.
PIC16C71X

4.0 MEMORY ORGANIZATION

4.1 Pr
The PIC16C71X family has a 13-bit program counter capable of addressing an 8K x 14 program memory space. The amount of program memory available to each device is listed below:
PIC16C710 512 x 14 0000h-01FFh PIC16C71 1K x 14 0000h-03FFh PIC16C711 1K x 14 0000h-03FFh PIC16C715 2K x 14 0000h-07FFh
For those devices with less than 8K program memory, accessing a location above the physically implemented address will cause a wraparound.
The reset vector is at 0000h and the interrupt vector is at 0004h.
FIGURE 4-1: PIC16C710 PROGRAM
ogram Memory Organization
Device
Program
Memory
MEMORY MAP AND STACK
PC<12:0>
CALL, RETURN RETFIE, RETLW
Stack Level 1
Address Range
13
FIGURE 4-2: PIC16C71/711 PROGRAM
MEMORY MAP AND STACK
PC<12:0>
CALL, RETURN RETFIE, RETLW
Space
User Memory
Stack Level 1
Stack Level 8
Reset Vector
Interrupt Vector
On-chip Program
Memory
13
0000h
0004h 0005h
03FFh 0400h
1FFFh
FIGURE 4-3: PIC16C715 PROGRAM
MEMORY MAP AND STACK
User Memory
Space
Stack Level 8
Reset Vector
Interrupt Vector
On-chip Program
Memory
0000h
0004h 0005h
01FFh 0200h
1FFFh
1997 Microchip Technology Inc. DS30272A-page 11
PIC16C71X

4.2 Data Memory Organization

The data memory is partitioned into two Banks which contain the General Purpose Registers and the Special Function Registers. Bit RP0 is the bank select bit.
RP0 (STATUS<5>) = 1 Bank 1 RP0 (STATUS<5>) = 0 Bank 0 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 Regis­ters are General Purpose Registers implemented as static RAM. Both Bank 0 and Bank 1 contain special function registers. Some "high use" special function registers from Bank 0 are mirrored in Bank 1 for code reduction and quicker access.
4.2.1 GENERAL PURPOSE REGISTER FILE The register file can be accessed either directly , or indi-
rectly through the File Select Register FSR (Section 4.5).
FIGURE 4-4: PIC16C710/71 REGISTER FILE
MAP
File
Address
00h 01h 02h 03h 04h 05h 06h 07h 08h
09h 0Ah 0Bh 0Ch
2Fh
30h
(1)
INDF
TMR0
PCL
ST A TUS
FSR PORT A PORTB
ADCON0
ADRES
PCLA TH INTCON
General Purpose Register
INDF
OPTION
PCL
ST A TUS
FSR TRISA TRISB
PCON
ADCON1
ADRES PCLA TH INTCON
General Purpose Register
Mapped
in Bank 0
(1)
(2)
File
Address
80h 81h 82h 83h 84h 85h 86h 87h 88h 89h 8Ah 8Bh 8Ch
(3)
AFh B0h
7Fh
FFh
Bank 0 Bank 1
Unimplemented data memory locations, read
as '0'.
Note 1: Not a physical register.
2: The PCON register is not implemented on the
PIC16C71.
3: These locations are unimplemented in Bank 1.
Any access to these locations will access the corresponding Bank 0 register.
DS30272A-page 12 1997 Microchip Technology Inc.
PIC16C71X
FIGURE 4-5: PIC16C711 REGISTER FILE
MAP
File
Address
00h 01h 02h 03h 04h 05h 06h 07h 08h
09h 0Ah 0Bh 0Ch
(1)
INDF
TMR0
PCL
STATUS
FSR
PORTA
PORTB
ADCON0
ADRES
PCLATH INTCON
General Purpose Register
(1)
INDF
OPTION
PCL
STATUS
FSR TRISA TRISB PCON
ADCON1
ADRES PCLATH INTCON
General Purpose Register
Mapped
in Bank 0
4Fh 50h
7Fh
Bank 0 Bank 1
Unimplemented data memory locations, read
as '0'.
Note 1: Not a physical register.
2: These locations are unimplemented in Bank 1.
Any access to these locations will access the corresponding Bank 0 register.
File
Address
80h 81h 82h 83h 84h 85h 86h 87h 88h 89h 8Ah 8Bh 8Ch
(2)
CFh D0h
FFh
FIGURE 4-6: PIC16C715 REGISTER FILE
MAP
File
Address
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
(1)
INDF
TMR0
PCL
STATUS
FSR
PORTA
PORTB
PCLATH INTCON
PIR1
ADRES
ADCON0
General Purpose Register
(1)
INDF
OPTION
PCL
STATUS
FSR TRISA TRISB
PCLATH INTCON
PIE1
PCON
ADCON1
General Purpose Register
File
Address
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
A0h
BFh C0h
7Fh
Unimplemented data memory locations, read
Note 1: Not a physical register.
1997 Microchip Technology Inc. DS30272A-page 13
Bank 0 Bank 1
as '0'.
FFh
PIC16C71X
4.2.2 SPECIAL FUNCTION REGISTERS
The special function registers can be classified into two sets (core and peripheral). Those registers associated
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.
with the “core” functions are described in this section, and those related to the operation of the peripheral fea­tures are described in the section of that peripheral feature.
TABLE 4-1: PIC16C710/71/711 SPECIAL FUNCTION REGISTER SUMMARY
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Bank 0
(3)
00h 01h TMR0 Timer0 module’s register xxxx xxxx uuuu uuuu
02h 03h 04h
05h PORTA 06h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu 07h Unimplemented — 08h ADCON0 ADCS1 ADCS0 (6) CHS1 CHS0 GO/DONE ADIF ADON 00-0 0000 00-0 0000
09h 0Ah 0Bh
Bank 1
80h 81h OPTION RBPU
82h 83h 84h
85h TRISA 86h TRISB PORTB Data Direction Control Register 1111 1111 1111 1111 87h 88h ADCON1 PCFG1 PCFG0 ---- --00 ---- --00
89h 8Ah 8Bh
INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
(3)
PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(3)
STATUS
(3)
FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
(3)
ADRES A/D Result Register
(2,3)
PCLATH Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
(3)
INTCON GIE ADIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
(3)
INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
(3)
PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(3)
STATUS
(3)
FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
(4)
PCON POR BOR ---- --qq ---- --uu
(3)
ADRES A/D Result Register
(2,3)
PCLATH Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
(3)
INTCON GIE ADIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
(5)
IRP
PORTA Data Latch when written: PORTA pins when read ---x 0000 ---u 0000
(5)
IRP
PORTA Data Direction Register ---1 1111 ---1 1111
(5)
RP1
INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
RP1
RP0 TO PD Z DC C 0001 1xxx 000q quuu
(5)
RP0 TO PD Z DC C 0001 1xxx 000q quuu
Value on:
POR, BOR
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0'.
Shaded locations are unimplemented, read as ‘0’.
Note 1: Other (non power-up) resets include external reset through MCLR and Watchdog Timer Reset.
2: The upper byte of the program counter is not directly accessible. PCLATH is a holding register for the PC<12:8> whose
contents are transferred to the upper byte of the program counter. 3: These registers can be addressed from either bank. 4: The PCON register is not physically implemented in the PIC16C71, read as ’0’. 5: The IRP and RP1 bits are reserved on the PIC16C710/71/711, always maintain these bits clear. 6: Bit5 of ADCON0 is a General Purpose R/W bit for the PIC16C710/711 only. For the PIC16C71, this bit is unimplemented,
read as '0'.
Value on all
other resets
(1)
DS30272A-page 14 1997 Microchip Technology Inc.
PIC16C71X
TABLE 4-2: PIC16C715 SPECIAL FUNCTION REGISTER SUMMARY
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Value on:
POR,
BOR, PER
Bank 0
(1)
00h 01h TMR0 Timer0 module’s register xxxx xxxx uuuu uuuu 02h 03h 04h 05h PORTA PORTA Data Latch when written: PORTA pins when read ---x 0000 ---u 0000 06h PORTB PORTB Data Latch when written: PORTB pins when read xxxx xxxx uuuu uuuu 07h Unimplemented — 08h Unimplemented — 09h Unimplemented — 0Ah 0Bh 0Ch PIR1 ADIF -0-- ---- -0-- ---- 0Dh Unimplemented — 0Eh Unimplemented — 0Fh Unimplemented — 10h Unimplemented — 11h Unimplemented — 12h Unimplemented — 13h Unimplemented — 14h Unimplemented — 15h Unimplemented — 16h Unimplemented — 17h Unimplemented — 18h Unimplemented — 19h Unimplemented — 1Ah Unimplemented — 1Bh Unimplemented — 1Ch Unimplemented — 1Dh Unimplemented — 1Eh ADRES A/D Result Register xxxx xxxx uuuu uuuu 1Fh ADCON0 ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE ADON 0000 00-0 0000 00-0
INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
(1)
PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(1)
STATUS IRP
(1)
FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
(1,2)
PCLATH Write Buffer for the upper 5 bits of the Program Counter ---0 0000 ---0 0000
(1)
INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
(4)
RP1
(4)
RP0 TO PD Z DC C 0001 1xxx 000q quuu
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0'.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from either bank.
2: The upper byte of the program counter is not directly accessible. PCLATH is a holding register for the PC<12:8> whose
contents are transferred to the upper byte of the program counter. 3: Other (non power-up) resets include external reset through MCLR and Watchdog Timer Reset. 4: The IRP and RP1 bits are reserved on the PIC16C715, always maintain these bits clear.
Value on all
other resets
(3)
1997 Microchip Technology Inc. DS30272A-page 15
PIC16C71X
TABLE 4-2: PIC16C715 SPECIAL FUNCTION REGISTER SUMMARY (Cont.’d)
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Bank 1
(1)
80h 81h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111 82h 83h 84h 85h TRISA PORTA Data Direction Register --11 1111 --11 1111 86h TRISB PORTB Data Direction Register 1111 1111 1111 1111 87h Unimplemented — 88h Unimplemented — 89h Unimplemented — 8Ah 8Bh 8Ch PIE1 ADIE -0-- ---- -0-- ---- 8Dh Unimplemented — 8Eh PCON MPEEN PER POR BOR u--- -1qq u--- -1uu 8Fh Unimplemented — 90h Unimplemented — 91h Unimplemented — 92h Unimplemented — 93h Unimplemented — 94h Unimplemented — 95h Unimplemented — 96h Unimplemented — 97h Unimplemented — 98h Unimplemented — 99h Unimplemented — 9Ah Unimplemented — 9Bh Unimplemented — 9Ch Unimplemented — 9Dh Unimplemented — 9Eh Unimplemented — 9Fh ADCON1 PCFG1 PCFG0 ---- --00 ---- --00
INDF Addressing this location uses contents of FSR to address data memory (not a physical register) 0000 0000 0000 0000
(1)
PCL Program Counter's (PC) Least Significant Byte 0000 0000 0000 0000
(1)
STATUS IRP
(1)
FSR Indirect data memory address pointer xxxx xxxx uuuu uuuu
(1,2)
PCLATH Write Buffer for the upper 5 bits of the PC ---0 0000 ---0 0000
(1)
INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u
(4)
RP1
(4)
RP0 TO PD Z DC C 0001 1xxx 000q quuu
Value on:
POR,
BOR, PER
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0'.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from either bank.
2: The upper byte of the program counter is not directly accessible. PCLATH is a holding register for the PC<12:8> whose
contents are transferred to the upper byte of the program counter. 3: Other (non power-up) resets include external reset through MCLR and Watchdog Timer Reset. 4: The IRP and RP1 bits are reserved on the PIC16C715, always maintain these bits clear.
Value on all
other resets
(3)
DS30272A-page 16 1997 Microchip Technology Inc.
PIC16C71X
4.2.2.1 STATUS REGISTER
Applicable Devices 710 71 711 715
The STATUS register, shown in Figure 4-7, contains the arithmetic status 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 bits are set or cleared according to the device logic. Furthermore, the T writable. Therefore, the result of an instruction with the STATUS register as destination may be different than intended.
For example, CLRF STATUS will clear the upper-three bits and set the Z bit. This leaves the ST ATUS register as 000u u1uu (where u = unchanged).
O and PD bits are not
It is recommended, therefore, that only BCF, BSF, SWAPF and MOVWF instructions are used to alter the STATUS register because these instructions do not affect the Z, C or DC bits from the STA TUS register . For other instructions, not affecting any status bits, see the "Instruction Set Summary."
Note 1: For those devices that do not use bits IRP
and RP1 (STATUS<7:6>), maintain these bits clear to ensure upward compatibility with future products.
Note 2: The C and DC bits operate as a borro
and digit borrow bit, respectively, in sub­traction. See the SUBLW and SUBWF instructions for examples.
FIGURE 4-7: STATUS REGISTER (ADDRESS 03h, 83h)
R/W-0 R/W-0 R/W-0 R-1 R-1 R/W-x R/W-x R/W-x
IRP RP1 RP0 TO PD Z DC C R = Readable bit
bit7 bit0
bit 7: IRP: Register Bank Select bit (used for indirect addressing)
1 = Bank 2, 3 (100h - 1FFh) 0 = Bank 0, 1 (00h - FFh)
bit 6-5: RP1: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 4: T
bit 3: PD
bit 2: Z: Zero bit
bit 1: DC: Digit carry/borro
bit 0: C: Carry/borro
O: 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 by 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
w bit (ADDWF, ADDLW,SUBLW,SUBWF instructions)(for borrow the polarity is reversed) 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
w 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 borro the second operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high or low order bit of the source register.
w the polarity is reversed. A subtraction is executed by adding the two’s complement of
W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR reset
w
1997 Microchip Technology Inc. DS30272A-page 17
PIC16C71X
4.2.2.2 OPTION REGISTER
Applicable Devices 710 71 711 715
The OPTION register is a readable and writable regis-
Note: To achieve a 1:1 prescaler assignment for
the TMR0 register, assign the prescaler to the Watchdog Timer by setting bit PSA (OPTION<3>).
ter which contains various control bits to configure the TMR0/WDT prescaler, the External INT Interrupt, TMR0, and the weak pull-ups on PORTB.
FIGURE 4-8: OPTION REGISTER (ADDRESS 81h, 181h)
R/W-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 PS2 PS1 PS0 R = Readable bit
bit7 bit0
bit 7: RBPU: PORTB Pull-up Enable bit
1 = PORTB pull-ups are disabled 0 = PORTB pull-ups are enabled by individual port latch values
bit 6: INTEDG: Interrupt Edge Select bit
1 = Interrupt on rising edge of RB0/INT pin 0 = Interrupt on falling edge of RB0/INT pin
bit 5: T0CS: TMR0 Clock Source Select bit
1 = Transition on RA4/T0CKI pin 0 = Internal instruction cycle clock (CLKOUT)
bit 4: T0SE: TMR0 Source Edge Select bit
1 = Increment on high-to-low transition on RA4/T0CKI pin 0 = Increment on low-to-high transition on RA4/T0CKI pin
bit 3: PSA: Prescaler Assignment bit
1 = Prescaler is assigned to the WDT 0 = Prescaler is assigned to the Timer0 module
bit 2-0: PS2:PS0: Prescaler Rate Select bits
Bit Value TMR0 Rate WDT Rate
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
W = Writable bit U = Unimplemented bit,
read as ‘0’
- n = Value at POR reset
DS30272A-page 18 1997 Microchip Technology Inc.
PIC16C71X
4.2.2.3 INTCON REGISTER
Applicable Devices 710 71 711 715
The INTCON Register is a readable and writable regis­ter which contains various enable and flag bits for the TMR0 register overflow, RB Port change and Exter nal RB0/INT pin interrupts.
Note: Interrupt flag bits get set when an interrupt
condition occurs regardless of the state of its corresponding enable bit or the global enable bit, GIE (INTCON<7>).
FIGURE 4-9: INTCON REGISTER (ADDRESS 0Bh, 8Bh)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-x
GIE ADIE T0IE INTE RBIE T0IF INTF RBIF R = Readable bit
bit7 bit0
bit 7: GIE:
bit 6: ADIE: A/D Converter Interrupt Enable bit
bit 5: T0IE: TMR0 Overflow Interrupt Enable bit
bit 4: INTE: RB0/INT External Interrupt Enable bit
bit 3: RBIE: RB Port Change Interrupt Enable bit
bit 2: T0IF: TMR0 Overflow Interrupt Flag bit
bit 1: INTF: RB0/INT External Interrupt Flag bit
bit 0: RBIF: RB Port Change Interrupt Flag bit
Note 1: For the PIC16C71, if an interrupt occurs while the GIE bit is being cleared, the GIE bit may be uninten-
(1)
Global Interrupt Enable bit
1 = Enables all un-masked interrupts 0 = Disables all interrupts
1 = Enables A/D interrupt 0 = Disables A/D interrupt
1 = Enables the TMR0 interrupt 0 = Disables the TMR0 interrupt
1 = Enables the RB0/INT external interrupt 0 = Disables the RB0/INT external interrupt
1 = Enables the RB port change interrupt 0 = Disables the RB port change interrupt
1 = TMR0 register has overflowed (must be cleared in software) 0 = TMR0 register did not overflow
1 = The RB0/INT external interrupt occurred (must be cleared in software) 0 = The RB0/INT external interrupt did not occur
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
tionally re-enabled by the RETFIE instruction in the user’ s Interrupt Service Routine. Ref er to Section 8.5 for a detailed description.
W = Writable bit U = Unimplemented bit,
read as ‘0’
- n = Value at POR reset
Interrupt flag bits get set when an interrupt condition occurs regardless of the state of its corresponding enable bit or the global enable bit, GIE (INTCON<7>). User software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt.
1997 Microchip Technology Inc. DS30272A-page 19
PIC16C71X
4.2.2.4 PIE1 REGISTER
Applicable Devices 710 71 711 715
This register contains the individual enable bits for the Peripheral interrupts.
Note: Bit PEIE (INTCON<6>) must be set to
enable any peripheral interrupt.
FIGURE 4-10: PIE1 REGISTER (ADDRESS 8Ch)
U-0 R/W-0 U-0 U-0 U-0 U-0 U-0 U-0
ADIE R = Readable bit
bit7 bit0
bit 7: Unimplemented: Read as '0' bit 6: ADIE: A/D Converter Interrupt Enable bit
1 = Enables the A/D interrupt 0 = Disables the A/D interrupt
bit 5-0: Unimplemented: Read as '0'
W = Writable bit U = Unimplemented bit,
- n = Value at POR reset
read as ‘0’
DS30272A-page 20 1997 Microchip Technology Inc.
PIC16C71X
4.2.2.5 PIR1 REGISTER
Applicable Devices 710 71 711 715
This register contains the individual flag bits for the Peripheral interrupts.
Note: Interrupt flag bits get set when an interrupt
condition occurs regardless of the state of its corresponding enable bit or the global enable bit, GIE (INTCON<7>). User soft­ware should ensure the appropriate inter­rupt flag bits are clear prior to enabling an interrupt.
FIGURE 4-11: PIR1 REGISTER (ADDRESS 0Ch)
U-0 R/W-0 U-0 U-0 U-0 U-0 U-0 U-0
ADIF R = Readable bit
bit7 bit0
bit 7: Unimplemented: Read as '0' bit 6: ADIF: A/D Converter Interrupt Flag bit
1 = An A/D conversion completed 0 = The A/D conversion is not complete
bit 5-0: Unimplemented: Read as '0'
W = Writable bit U = Unimplemented bit,
- n = Value at POR reset
read as ‘0’
1997 Microchip Technology Inc. DS30272A-page 21
PIC16C71X
4.2.2.6 PCON REGISTER
Applicable Devices 710 71 711 715
The Power Control (PCON) register contains a flag bit to allow differentiation between a Power-on Reset (POR) to an external MCLR Those devices with brown-out detection circuitry con­tain an additional bit to differentiate a Brown-out Reset
Reset or WDT Reset.
Note: BOR is unknown on Power-on Reset. It
must then be set by the user and checked on subsequent resets to see if BOR clear, indicating a brown-out has occurred. The BOR
status bit is a don't care and is not necessarily predictable if the brown-out circuit is disabled (by clearing the BODEN bit in the Configuration word).
(BOR) condition from a Power-on Reset condition. For the PIC16C715 the PCON register also contains status bits MPEEN and PER. MPEEN reflects the v alue of the MPEEN bit in the configuration word. PER indicates a parity error reset has occurred.
FIGURE 4-12: PCON REGISTER (ADDRESS 8Eh), PIC16C710/711
U-0 U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-q
POR BOR R = Readable bit
bit7 bit0
bit 7-2: Unimplemented: Read as '0' bit 1: POR
: Power-on Reset Status bit 1 = No Power-on Reset occurred 0 = A Power-on Reset occurred (must be set in software after a Power-on Reset occurs)
bit 0: BOR
: Brown-out Reset Status bit 1 = No Brown-out Reset occurred 0 = A Brown-out Reset occurred (must be set in software after a Brown-out Reset occurs)
W = Writable bit U = Unimplemented bit,
- n = Value at POR reset
is
read as ‘0’
FIGURE 4-13: PCON REGISTER (ADDRESS 8Eh), PIC16C715
R-U U-0 U-0 U-0 U-0 R/W-1 R/W-0 R/W-q
MPEEN PER POR BOR
bit7 bit0
bit 7: MPEEN: Memory Parity Error Circuitry Status bit
Reflects the value of configuration word bit, MPEEN
bit 6-3: Unimplemented: Read as '0' bit 2: PER
bit 1: POR
bit 0: BOR
: Memory Parity Error Reset Status bit 1 = No Error occurred 0 = Program Memory Fetch Parity Error occurred (must be set in software after a Parity Error Reset)
: Power-on Reset Status bit 1 = No Power-on Reset occurred 0 = A Power-on Reset occurred (must be set in software after a Power-on Reset occurs)
: Brown-out Reset Status bit 1 = No Brown-out Reset occurred 0 = A Brown-out Reset occurred (must be set in software after a Brown-out Reset occurs)
(1)
R = Readable bit W = Writable bit U = Unimplemented bit,
read as ‘0’
- n = Value at POR reset
DS30272A-page 22 1997 Microchip Technology Inc.
PIC16C71X

4.3 PCL and PCLATH

The program counter (PC) is 13-bits wide. The lo w byte comes from the PCL register, which is a readable and writable register. The upper bits (PC<12:8>) are not readable, but are indirectly writable through the PCLATH register. On any reset, the upper bits of the PC will be cleared. Figure 4-14 shows the two situa­tions for the loading of the PC. The upper example in the figure shows how the PC is loaded on a write to PCL (PCLA TH<4:0> PCH). The low er example in the figure shows how the PC is loaded during a CALL or GOTO instruction (PCLATH<4:3> PCH).
FIGURE 4-14: LOADING OF PC IN
DIFFERENT SITUATIONS
PCH PCL
12 8 7 0
PC
PCLA TH<4:0>
5
PCLA TH
PCH PCL
12 11 10 0
PC
2
8 7
PCLATH<4:3>
PCLATH
11
8
Instr
uction with PCL as Destination
ALU
GOTO, CALL
Opcode <10:0>
4.3.2 STACK The PIC16CXX family has an 8 lev el deep x 13-bit wide
hardware stack. The stack space is not part of either program or data space and the stack pointer is not readable or writable. The PC is PUSHed onto the stac k when a CALL instruction is executed or an interrupt causes a branch. The stack is POPed in the event of a RETURN, RETLW or a RETFIE instruction execution. PCLATH is not affected by a PUSH or POP operation.
The stack operates as a circular buff er . This means that after the stack has been PUSHed eight times, the ninth push overwrites the value that was stored from the first push. The tenth push overwrites the second push (and so on).
Note 1: There are no status bits to indicate stack
overflow or stack underflow conditions.
Note 2: There are no instructions/mnemonics
called PUSH or POP. These are actions that occur from the execution of the CALL, RETURN, RETLW, and RETFIE instruc­tions, or the vectoring to an interrupt address.

4.4 Program Memory Paging

The PIC16C71X devices ignore both paging bits (PCLATH<4:3>, which are used to access program memory when more than one page is available. The use of PCLATH<4:3> as general purpose read/write bits for the PIC16C71X is not recommended since this may affect upward compatibility with future products.
4.3.1 COMPUTED GOTO A computed GOTO is accomplished by adding an off-
set to the program counter (ADDWF PCL). When doing a table read using a computed GOTO method, care should be exercised if the tab le location crosses a PCL memory boundary (each 256 byte block). Refer to the application note
“Implementing a Table Read"
(AN556).
1997 Microchip Technology Inc. DS30272A-page 23
PIC16C71X
Example 4-1 shows the calling of a subroutine in page 1 of the program memory. This e xample assumes that PCLA TH is sa ved and restored by the interrupt ser­vice routine (if interrupts are used).
EXAMPLE 4-1: CALL OF A SUBROUTINE IN
PAGE 1 FROM PAGE 0
ORG 0x500 BSF PCLATH,3 ;Select page 1 (800h-FFFh) BCF PCLATH,4 ;Only on >4K devices CALL SUB1_P1 ;Call subroutine in : ;page 1 (800h-FFFh) : : ORG 0x900 SUB1_P1: ;called subroutine : ;page 1 (800h-FFFh) : RETURN ;return to Call subroutine ;in page 0 (000h-7FFh)

4.5 Indirect Addressing, INDF and FSR Registers

The INDF register is not a physical register . Addressing the INDF register will cause indirect addressing.
Indirect addressing is possible by using the INDF reg­ister. Any instruction using the INDF register actually accesses the register pointed to by the File Select Reg­ister, FSR. Reading the INDF register itself indirectly (FSR = '0') will read 00h. Writing to the INDF register indirectly results in a no-operation (although status bits may be affected). An effective 9-bit address is obtained by concatenating the 8-bit FSR register and the IRP bit (STATUS<7>), as shown in Figure 4-15. However, IRP is not used in the PIC16C71X devices.
A simple program to clear RAM locations 20h-2Fh using indirect addressing is shown in Example 4-2.
EXAMPLE 4-2: INDIRECT ADDRESSING
movlw 0x20 ;initialize pointer movwf FSR ;to RAM NEXT clrf INDF ;clear INDF register incf FSR,F ;inc pointer btfss FSR,4 ;all done? goto NEXT ;no clear next CONTINUE : ;yes continue
FIGURE 4-15: DIRECT/INDIRECT ADDRESSING
RP1:RP0 6
bank select location select
For register file map detail see Figure 4-4. Note 1: The RP1 and IRP bits are reserved, always maintain these bits clear.
from opcode
Data Memory
0
00 01 10 11
00h
80h
100h
180h
Not
Used
7Fh
FFh
17Fh
1FFh
Bank 0 Bank 1 Bank 2 Bank 3
(1)
IRP
bank select
Indirect AddressingDirect Addressing
7
FSR register
location select
0
DS30272A-page 24 1997 Microchip Technology Inc.
PIC16C71X

5.0 I/O PORTS

Applicable Devices 710 71 711 715
Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin.

5.1 PORTA and TRISA Registers

PORTA is a 5-bit latch. The RA4/T0CKI pin is a Schmitt Trigger input and an
open drain output. All other RA port pins have TTL input levels and full CMOS output drivers . All pins have data direction bits (TRIS registers) which can configure these pins as output or input.
Setting a TRISA register bit puts the corresponding out­put driver in a hi-impedance mode. Clearing a bit in the TRISA register puts the contents of the output latch on the selected pin(s).
Reading the PORTA register reads the status of the pins whereas writing to it will write to the port latch. All write operations are read-modify-write operations. Therefore a write to a port implies that the port pins are read, this value is modified, and then written to the port data latch.
Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin.
Other PORTA pins are multiplexed with analog inputs and analog V selected by clearing/setting the control bits in the ADCON1 register (A/D Control Register1).
Note: On a Power-on Reset, these pins are con-
The TRISA register controls the direction of the RA pins, even when they are being used as analog inputs. The user must ensure the bits in the TRISA register are maintained set when using them as analog inputs.
EXAMPLE 5-1: INITIALIZING PORTA
BCF STATUS, RP0 ; CLRF PORTA ; Initialize PORTA by ; clearing output ; data latches BSF STATUS, RP0 ; Select Bank 1 MOVLW 0xCF ; Value used to ; initialize data ; direction MOVWF TRISA ; Set RA<3:0> as inputs ; RA<4> as outputs ; TRISA<7:5> are always ; read as '0'.
REF input. The operation of each pin is
figured as analog inputs and read as '0'.
FIGURE 5-1: BLOCK DIAGRAM OF
RA3:RA0 PINS
Data bus
WR Port
Data Latch
WR TRIS
TRIS Latch
RD PORT
To A/D Converter
Note 1: I/O pins have protection diodes to VDD and
VSS.
CK
CK
QD
Q
QD
Q
RD TRIS
Analog input mode
Q D
EN
VDD
P
N
V
I/O pin
SS
TTL input buffer
FIGURE 5-2: BLOCK DIAGRAM OF RA4/
T0CKI PIN
Data bus
WR PORT
WR TRIS
RD PORT
QD
Q
CK
Data Latch
QD
Q
CK
TRIS Latch
RD TRIS
Schmitt Trigger input buffer
Q D
EN
EN
I/O pin
N
V
SS
(1)
(1)
TMR0 clock input
Note 1: I/O pin has protection diodes to VSS only.
1997 Microchip Technology Inc. DS30272A-page 25
PIC16C71X
TABLE 5-1: PORTA FUNCTIONS
Name Bit# Buffer Function
RA0/AN0 bit0 TTL Input/output or analog input RA1/AN1 bit1 TTL Input/output or analog input RA2/AN2 bit2 TTL Input/output or analog input RA3/AN3/V RA4/T0CKI bit4 ST Input/output or external clock input for Timer0
Legend: TTL = TTL input, ST = Schmitt Trigger input
TABLE 5-2: SUMMARY OF REGISTERS ASSOCIATED WITH PORTA
REF bit3 TTL Input/output or analog input/VREF
Output is open drain type
Value on:
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
05h PORTA RA4 RA3 RA2 RA1 RA0 ---x 0000 ---u 0000 85h TRISA PORTA Data Direction Register ---1 1111 ---1 1111 9Fh ADCON1 PCFG1 PCFG0 ---- --00 ---- --00
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'. Shaded cells are not used by PORTA.
POR, BOR
Value on all
other resets
DS30272A-page 26 1997 Microchip Technology Inc.
PIC16C71X

5.2 PORTB and TRISB Registers

PORTB is an 8-bit wide bi-directional port. The corre­sponding data direction register is TRISB. Setting a bit in the TRISB register puts the corresponding output driver in a hi-impedance input mode. Clearing a bit in the TRISB register puts the contents of the output latch on the selected pin(s).
EXAMPLE 5-2: INITIALIZING PORTB
BCF STATUS, RP0 ; CLRF PORTB ; Initialize PORTB by ; clearing output ; data latches BSF STATUS, RP0 ; Select Bank 1 MOVLW 0xCF ; Value used to ; initialize data ; direction MOVWF TRISB ; Set RB<3:0> as inputs ; RB<5:4> as outputs ; RB<7:6> as inputs
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<7>). The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are dis­abled on a Power-on Reset.
FIGURE 5-3: BLOCK DIAGRAM OF
RB3:RB0 PINS
DD
TTL Input Buffer
V
P
weak pull-up
I/O pin
(1)
RBPU
Data bus
WR Port
WR TRIS
(2)
Data Latch
QD
CK
TRIS Latch
QD
CK
Four of PORTB’s pins, RB7:RB4, have an interrupt on change feature. Only pins configured as inputs can cause this interrupt to occur (i.e. an y RB7:RB4 pin con­figured as an output is excluded from the interrupt on 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 OR’ed together to generate the RB Port Change Inter­rupt with flag bit RBIF (INTCON<0>).
This interrupt can wake the device from SLEEP. The user, in the interrupt service routine, can clear the inter­rupt in the following manner:
a) Any read or write of PORTB. This will end the
mismatch condition.
b) Clear flag bit RBIF. 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.
This interrupt on mismatch feature, together with soft­ware configurable pull-ups on these four pins allow easy interface to a keypad and make it possible for wake-up on key-depression. Refer to the Embedded Control Handbook,
Stroke"
(AN552).
"Implementing Wake-Up on Key
Note: For the PIC16C71
if a change on the I/O pin should occur when the read operation is being executed (start of the Q2 cycle), then interrupt flag bit RBIF may not get set.
The interrupt on change feature is recommended for wake-up on key depression operation and operations where PORTB is only used for the interrupt on change feature. Polling of PORTB is not recommended while using the interrupt on change feature.
RD TRIS
Q D
RD Port
RB0/INT
Schmitt Trigger Buffer
Note 1: I/O pins have diode protection to V
2: TRISB = ’1’ enables weak pull-up if
1997 Microchip Technology Inc. DS30272A-page 27
= ’0’ (OPTION<7>).
RBPU
EN
RD Port
DD and VSS.
PIC16C71X
FIGURE 5-4: BLOCK DIAGRAM OF
RB7:RB4 PINS (PIC16C71)
(2)
RBPU
Data bus
WR Port
WR TRIS
Set RBIF
From other RB7:RB4 pins
RB7:RB6 in serial programming mode Note 1: I/O pins have diode protection to VDD and VSS.
2: TRISB = ’1’ enables weak pull-up if
RBPU
Data Latch
QD
CK
TRIS Latch
QD
CK
RD TRIS
RD Port
= ’0’ (OPTION<7>).
Latch
Q D
Q D
EN
EN
TTL Input Buffer
DD
V
weak
P
pull-up
Buffer
RD Port
I/O pin
ST
FIGURE 5-5: BLOCK DIAGRAM OF
RB7:RB4 PINS (PIC16C710/711/715)
DD
(2)
RBPU
Data bus
(1)
WR Port
WR TRIS
Set RBIF
From other RB7:RB4 pins
RB7:RB6 in serial programming mode
Note 1: I/O pins have diode protection to V
2: TRISB = ’1’ enables weak pull-up if
RBPU
Data Latch
QD
CK
TRIS Latch
QD
CK
RD TRIS
RD Port
= ’0’ (OPTION<7>).
Latch
Q D
Q D
V
P
TTL Input Buffer
EN
EN
DD and VSS.
weak pull-up
I/O
(1)
pin
ST
Buffer
Q1
RD Port
Q3
TABLE 5-3: PORTB FUNCTIONS
Name Bit# Buffer Function
(1)
RB0/INT bit0 TTL/ST
RB1 bit1 TTL Input/output pin. Internal software programmable weak pull-up. RB2 bit2 TTL Input/output pin. Internal software programmable weak pull-up. RB3 bit3 TTL Input/output pin. Internal software programmable weak pull-up. RB4 bit4 TTL Input/output pin (with interrupt on change). Internal software programmable
RB5 bit5 TTL Input/output pin (with interrupt on change). Internal software programmable
RB6 bit6 TTL/ST
RB7 bit7 TTL/ST
Legend: TTL = TTL input, ST = Schmitt Trigger input 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.
Input/output pin or external interrupt input. Internal software programmable weak pull-up.
weak pull-up.
weak pull-up.
(2)
Input/output pin (with interrupt on change). Internal software programmable weak pull-up. Serial programming clock.
(2)
Input/output pin (with interrupt on change). Internal software programmable weak pull-up. Serial programming data.
DS30272A-page 28 1997 Microchip Technology Inc.
TABLE 5-4: SUMMARY OF REGISTERS ASSOCIATED WITH PORTB
PIC16C71X
Value on:
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
06h, 106h PORTB RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 xxxx xxxx uuuu uuuu 86h, 186h TRISB PORTB Data Direction Register 1111 1111 1111 1111 81h, 181h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111
Legend: x = unknown, u = unchanged. Shaded cells are not used by PORTB.
POR,
BOR
Value on all
other resets
1997 Microchip Technology Inc. DS30272A-page 29
PIC16C71X

5.3 I/O Programming Considerations

5.3.1 BI-DIRECTIONAL I/O PORTS Any instruction which writes, operates internally as a
read followed by a write operation. The BCF and BSF instructions, for example, read the register into the CPU, execute the bit operation and write the result back to the register. Caution must be used when these instructions are applied to a port with both inputs and outputs defined. For example, a BSF operation on bit5 of PORTB will cause all eight bits of PORTB to be read into the CPU. Then the BSF operation takes place on bit5 and PORTB is written to the output latches. If another bit of PORTB is used as a bi-directional I/O pin (e.g., bit0) and it is defined as an input at this time, the input signal present on the pin itself would be read into the CPU and rewritten to the data latch of this particular pin, overwriting the previous content. As long as the pin stays in the input mode, no problem occurs. However, if bit0 is switched to an output, the content of the data latch may now be unknown.
Reading the port register, reads the values of the port pins. Writing to the port register writes the value to the port latch. When using read-modify-write instructions (ex. BCF, BSF , etc.) on a port, the value of the port pins is read, the desired operation is done to this value, and this value is then written to the port latch.
Example 5-3 shows the effect of two sequential read­modify-write instructions on an I/O port.
EXAMPLE 5-3: READ-MODIFY-WRITE
INSTRUCTIONS ON AN I/O PORT
;Initial PORT settings: PORTB<7:4> Inputs ; PORTB<3:0> Outputs ;PORTB<7:6> have external pull-ups and are ;not connected to other circuitry ; ; PORT latch PORT pins ; ---------- --------­ BCF PORTB, 7 ; 01pp pppp 11pp pppp BCF PORTB, 6 ; 10pp pppp 11pp pppp BSF STATUS, RP0 ; BCF TRISB, 7 ; 10pp pppp 11pp pppp BCF TRISB, 6 ; 10pp pppp 10pp pppp ; ;Note that the user may have expected the ;pin values to be 00pp ppp. The 2nd BCF ;caused RB7 to be latched as the pin value ;(high).
A pin actively outputting a Low or High should not be driven from external devices at the same time in order to change the level on this pin (“wired-or”, “wired-and”). The resulting high output currents may damage the chip.
5.3.2 SUCCESSIVE OPERATIONS ON I/O PORTS The actual write to an I/O port happens at the end of an
instruction cycle, whereas for reading, the data must be valid at the beginning of the instruction cycle (Figure 5-6). Therefore, care must be exercised if a write followed by a read operation is carried out on the same I/O port. The sequence of instructions should be such to allow the pin voltage to stabilize (load depen­dent) before the next instruction which causes that file to be read into the CPU is executed. Otherwise, the previous state of that pin may be read into the CPU rather than the new state. When in doubt, it is better to separate these instructions with a NOP or another instruction not accessing this I/O port.
FIGURE 5-6: SUCCESSIVE I/O OPERATION
Q3
PC + 3
NOP
NOP
Q4
Note: This example shows a write to PORTB
followed by a read from PORTB. Note that: data setup time = (0.25TCY - TPD) where TCY = instruction cycle
TPD = propagation delay
Therefore, at higher clock frequencies, a write followed by a read may be problematic.
NOP
Q3
Q4
Q1 Q2
Q4
Q1 Q2
PC
Instruction
fetched
RB7:RB0
Instruction
executed
DS30272A-page 30 1997 Microchip Technology Inc.
MOVWF PORTB
Q3
PC PC + 1 PC + 2
write to PORTB
Q1 Q2
MOVF PORTB,W
MOVWF PORTB
write to PORTB
Q3
Q4
Q1 Q2
Port pin sampled here
TPD
MOVF PORTB,W
PIC16C71X

6.0 TIMER0 MODULE

Applicable Devices 710 71 711 715
The Timer0 module timer/counter has the following f ea­tures:
• 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 Figure 6-1 is a simplified block diagram of the Timer0
module. Timer mode is selected by clearing bit T0CS
(OPTION<5>). In timer mode, the Timer0 module will increment every instruction cycle (without prescaler). If the TMR0 register is written, the increment is inhibited for the following two instruction cycles (Figure 6-2 and Figure 6-3). The user can work around this by writing an adjusted value to the TMR0 register.
Counter mode is selected by setting bit T0CS (OPTION<5>). In counter mode, Timer0 will increment either on every rising or falling edge of pin RA4/T0CKI. The incrementing edge is determined by the Timer0 Source Edge Select bit T0SE (OPTION<4>). Clear ing
bit T0SE selects the rising edge. Restrictions on the external clock input are discussed in detail in Section 6.2.
The prescaler is mutually exclusively shared between the Timer0 module and the Watchdog Timer. The pres­caler assignment is controlled in software by control bit PSA (OPTION<3>). Clearing bit PSA will assign the prescaler to the Timer0 module. The prescaler is not readable or writable. When the prescaler is assigned to the Timer0 module, prescale values of 1:2, 1:4, ..., 1:256 are selectable. Section 6.3 details the operation of the prescaler.

6.1 Timer0 Interrupt

The TMR0 interrupt is generated when the TMR0 reg­ister overflows from FFh to 00h. This overflow sets bit T0IF (INTCON<2>). The interr upt can be masked by clearing bit T0IE (INTCON<5>). Bit T0IF must be cleared in software by the Timer0 module interrupt ser­vice routine before re-enabling this interrupt. The TMR0 interrupt cannot awaken the processor from SLEEP since the timer is shut off during SLEEP. See Figure 6-4 for Timer0 interrupt timing.
FIGURE 6-1: TIMER0 BLOCK DIAGRAM
FOSC/4
RA4/T0CKI pin
T0SE
Note 1: T0CS, T0SE, PSA, PS2:PS0 (OPTION<5:0>).
2: The prescaler is shared with Watchdog Timer (refer to Figure 6-6 for detailed block diagram).
0
1
T0CS
Programmable
Prescaler
3
PS2, PS1, PS0
1
0
PSA
PSout
Sync with
Internal
clocks
(2 cycle delay)
FIGURE 6-2: TIMER0 TIMING: INTERNAL CLOCK/NO PRESCALE
PC (Program Counter)
Instruction
Fetch
TMR0
Instruction Executed
Q1 Q2 Q3 Q4
PC-1
T0
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
PC PC+1 PC+2 PC+3 PC+4 PC+5 PC+6
MOVWF TMR0
T0+1 T0+2 NT0 NT0 NT0 NT0+1 NT0+2
MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W
Write TMR0 executed
Read TMR0 reads NT0
Read TMR0 reads NT0
Read TMR0 reads NT0
PSout
Data bus
TMR0
Read TMR0 reads NT0 + 1
8
Set interrupt
flag bit T0IF on overflow
Read TMR0 reads NT0 + 2
T0
1997 Microchip Technology Inc. DS30272A-page 31
PIC16C71X
6
FIGURE 6-3: TIMER0 TIMING: INTERNAL CLOCK/PRESCALE 1:2
PC (Program Counter)
Instruction
Fetch
TMR0
Instruction Execute
Q1 Q2 Q3 Q4
PC-1
T0 NT0+1
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
PC PC+1 PC+2 PC+3 PC+4 PC+5 PC+6
MOVWF TMR0
MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W MOVF TMR0,W
T0+1
Write TMR0 executed
Read TMR0 reads NT0
FIGURE 6-4: TIMER0 INTERRUPT TIMING
Q2Q1 Q3 Q4Q2Q1 Q3 Q4 Q2Q1 Q3 Q4 Q2Q1 Q3 Q4 Q2Q1 Q3 Q4
OSC1
CLKOUT(3)
Timer0
T0IF bit (INTCON<2>)
GIE bit (INTCON<7>)
UCTION
INSTR
W
FLO
FEh
1
FFh 00h 01h 02h
1
NT0
Read TMR0 reads NT0
Read TMR0 reads NT0
Read TMR0 reads NT0
Read TMR0 reads NT0 + 1
PC+
Instruction fetched
Instruction executed
PC
PC
Inst (PC)
Inst (PC-1)
PC +1 PC +1 0004h 0005h
Inst (PC+1)
Inst (PC)
Note 1: Interrupt flag bit T0IF is sampled here (every Q1).
2: Interrupt latency = 4Tcy where Tcy = instruction cycle time. 3: CLKOUT is available only in RC oscillator mode.
Inst (0004h) Inst (0005h)
Inst (0004h)Dummy cycle Dummy cycle
DS30272A-page 32 1997 Microchip Technology Inc.
PIC16C71X

6.2 Using Timer0 with an External Clock

When an external clock input is used for Timer0, it must meet certain requirements. The requirements ensure the external clock can be synchronized with the internal phase clock (T incrementing of Timer0 after synchronization.
6.2.1 EXTERNAL CLOCK SYNCHRONIZATION
OSC). Also, there is a delay in the actual
caler so that the prescaler output is symmetrical. For the external clock to meet the sampling requirement, the ripple-counter must be taken into account. There­fore, it is necessary for T0CKI to have a period of at least 4Tosc (and a small RC delay of 40 ns) divided by the prescaler value. The only requirement on T0CKI high and low time is that they do not violate the mini­mum pulse width requirement of 10 ns. Refer to par am­eters 40, 41 and 42 in the electrical specification of the
When no prescaler is used, the external clock input is
desired device. the same as the prescaler output. The synchronization of T0CKI with the internal phase clocks is accom­plished by sampling the prescaler output on the Q2 and Q4 cycles of the internal phase clocks (Figure 6-5). Therefore, it is necessary for T0CKI to be high for at least 2Tosc (and a small RC delay of 20 ns) and low for at least 2Tosc (and a small RC delay of 20 ns). Refer to
6.2.2 TMR0 INCREMENT DELAY
Since the prescaler output is synchronized with the
internal clocks, there is a small delay from the time the
external clock edge occurs to the time the Timer0 mod-
ule is actually incremented. Figure 6-5 shows the delay
from the external clock edge to the timer incrementing. the electrical specification of the desired device.
When a prescaler is used, the external clock input is divided by the asynchronous ripple-counter type pres-
FIGURE 6-5: TIMER0 TIMING WITH EXTERNAL CLOCK
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
External Clock Input or Prescaler output
External Clock/Prescaler Output after sampling
Increment Timer0 (Q4)
(2)
(1)
(3)
Small pulse misses sampling
Timer0
Note 1: Delay from clock input change to Timer0 increment is 3Tosc to 7Tosc. (Duration of Q = Tosc).
Therefore, the error in measuring the interval between two edges on Timer0 input = ±4Tosc max. 2: External clock if no prescaler selected, Prescaler output otherwise. 3: The arrows indicate the points in time where sampling occurs.
T0 T0 + 1 T0 + 2
1997 Microchip Technology Inc. DS30272A-page 33
PIC16C71X

6.3 Prescaler

An 8-bit counter is available as a prescaler for the Timer0 module, or as a postscaler for the Watchdog Timer, respectively (Figure 6-6). For simplicity, this counter is being referred to as “prescaler” throughout this data sheet. Note that there is only one prescaler available which is m utually e xclusiv ely shared betw een the Timer0 module and the Watchdog Timer. Thus, a prescaler assignment for the Timer0 module means that there is no prescaler for the Watchdog Timer, and
When assigned to the Timer0 module, all instructions writing to the TMR0 register (e.g. CLRF 1, MOVWF 1,
BSF 1,x....etc.) will clear the prescaler. When
assigned to WDT, a CLRWDT instruction will clear the prescaler along with the Watchdog Timer. The pres­caler is not readable or writable.
Note: Writing to TMR0 when the prescaler is
assigned to Timer0 will clear the prescaler count, but will not change the prescaler assignment.
vice-versa. The PSA and PS2:PS0 bits (OPTION<3:0>) determine
the prescaler assignment and prescale ratio.
FIGURE 6-6: BLOCK DIAGRAM OF THE TIMER0/WDT PRESCALER
CLKOUT (=Fosc/4)
RA4/T0CKI
pin
T0SE
0
1
T0CS
M U
X
1
M
U
0
X
PSA
SYNC
2
Cycles
Data Bus
8
TMR0 reg
Set flag bit T0IF
on Overflow
0
M
U
1
Watchdog
Timer
WDT Enable bit
Note: T0CS, T0SE, PSA, PS2:PS0 are (OPTION<5:0>).
X
PSA
8-bit Prescaler
8 - to - 1MUX
0
8
M U X
WDT
Time-out
PS2:PS0
1
PSA
DS30272A-page 34 1997 Microchip Technology Inc.
PIC16C71X
6.3.1 SWITCHING PRESCALER ASSIGNMENT
Note: To a v oid an unintended device RESET, the
The prescaler assignment is fully under software con­trol, i.e., it can be changed “on the fly” during program execution.
EXAMPLE 6-1: CHANGING PRESCALER (TIMER0WDT)
BCF STATUS, RP0 ;Bank 0 CLRF TMR0 ;Clear TMR0 & Prescaler BSF STATUS, RP0 ;Bank 1 CLRWDT ;Clears WDT MOVLW b'xxxx1xxx' ;Selects new prescale value MOVWF OPTION_REG ;and assigns the prescaler to the WDT BCF STATUS, RP0 ;Bank 0
To change prescaler from the WDT to the Timer0 module use the sequence shown in Example 6-2.
EXAMPLE 6-2: CHANGING PRESCALER (WDTTIMER0)
CLRWDT ;Clear WDT and prescaler BSF STATUS, RP0 ;Bank 1 MOVLW b'xxxx0xxx' ;Select TMR0, new prescale value and MOVWF OPTION_REG ;clock source BCF STATUS, RP0 ;Bank 0
following instruction sequence (shown in Example 6-1) must be executed when changing the prescaler assignment from Timer0 to the WDT. This sequence must be followed even if the WDT is disabled.
TABLE 6-1: REGISTERS ASSOCIATED WITH TIMER0
Value on:
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
01h TMR0 Timer0 module’s register xxxx xxxx uuuu uuuu 0Bh,8Bh, INTCON GIE ADIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u 81h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111 85h TRISA PORTA Data Direction Register ---1 1111 ---1 1111
Legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'. Shaded cells are not used by Timer0.
POR, BOR
Value on all
other resets
1997 Microchip Technology Inc. DS30272A-page 35
PIC16C71X
NOTES:
DS30272A-page 36 1997 Microchip Technology Inc.
PIC16C71X

7.0 ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE

Applicable Devices 710 71 711 715
The analog-to-digital (A/D) converter module has four analog inputs.
The A/D allows conversion of an analog input signal to a corresponding 8-bit digital number (refer to Applica­tion Note AN546 for use of A/D Converter). The output of the sample and hold is the input into the converter, which generates the result via successive approxima­tion. The analog reference voltage is software select­able to either the device’ s positiv e supply v oltage (V or the voltage level on the RA3/AN3/V
REF pin.
DD)
The A/D converter has a unique feature of being able to operate while the device is in SLEEP mode. T o oper­ate in sleep, the A/D conversion clock must be derived from the A/D’s internal RC oscillator.
The A/D module has three registers. These registers are:
• A/D Result Register (ADRES)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
The ADCON0 register, shown in Figure 7-1 and Figure 7-2, controls the operation of the A/D module. The ADCON1 register, shown in Figure 7-3 configures the functions of the port pins. The port pins can be con­figured as analog inputs (RA3 can also be a voltage ref­erence) or as digital I/O.
FIGURE 7-1: ADCON0 REGISTER (ADDRESS 08h), PIC16C710/71/711
R/W-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
ADCS1 ADCS0
bit7 bit0
bit 7-6: ADCS1:ADCS0: A/D Conversion Clock Select bits
00 = F
OSC/2
01 = F
OSC/8
10 = F
OSC/32
11 = F
RC (clock derived from an RC oscillation)
bit 5: Unimplemented: Read as '0'. bit 4-3: CHS1:CHS0: Analog Channel Select bits
00 = channel 0, (RA0/AN0) 01 = channel 1, (RA1/AN1) 10 = channel 2, (RA2/AN2) 11 = channel 3, (RA3/AN3)
bit 2: GO/DONE
If ADON = 1 1 = A/D conversion in progress (setting this bit starts the A/D conversion) 0 = A/D conversion not in progress (This bit is automatically cleared by hardware when the A/D conver­sion is complete)
bit 1: ADIF: A/D Conversion Complete Interrupt Flag bit
1 = conversion is complete (must be cleared in software) 0 = conversion is not complete
bit 0: ADON: A/D On bit
1 = A/D converter module is operating 0 = A/D converter module is shutoff and consumes no operating current
Note 1: Bit5 of ADCON0 is a General Pur pose R/W bit for the PIC16C710/711 only. For the PIC16C71, this bit is
unimplemented, read as '0'.
(1)
: A/D Conversion Status bit
:
CHS1 CHS0 GO/DONE ADIF ADON R =Readable bit
W =Writable bit U =Unimplemented
bit, read as ‘0’
- n =Value at POR reset
1997 Microchip Technology Inc. DS30272A-page 37
PIC16C71X
g
FIGURE 7-2: ADCON0 REGISTER (ADDRESS 1Fh), PIC16C715
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0
ADCS1 ADCS0
bit7 bit0
bit 7-6: ADCS1:ADCS0: A/D Conversion Clock Select bits
00 = F 01 = F 10 = F 11 = F
bit 5: Unused bit 6-3: CHS1:CHS0: Analog Channel Select bits
000 = channel 0, (RA0/AN0) 001 = channel 1, (RA1/AN1) 010 = channel 2, (RA2/AN2) 011 = channel 3, (RA3/AN3) 100 = channel 0, (RA0/AN0) 101 = channel 1, (RA1/AN1) 110 = channel 2, (RA2/AN2) 111 = channel 3, (RA3/AN3)
bit 2: GO/DONE
If ADON = 1 1 = A/D conversion in progress (setting this bit starts the A/D conversion) 0 = A/D conversion not in progress (This bit is automatically cleared by hardware when the A/D conver-
sion is complete) bit 1: Unimplemented: Read as '0' bit 0: ADON: A/D On bit
1 = A/D converter module is operating
0 = A/D converter module is shutoff and consumes no operating current
CHS1 CHS0 GO/DONE ADON R =Readable bit
OSC/2 OSC/8 OSC/32 RC (clock derived from an RC oscillation)
: A/D Conversion Status bit
W =Writable bit U =Unimplemented bit,
read as ‘0’
- n = Value at POR reset
FIGURE 7-3: ADCON1 REGISTER, PIC16C710/71/711 (ADDRESS 88h),
PIC16C715 (ADDRESS 9Fh)
U-0 U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-0
PCFG1 PCFG0 R =Readable bit
bit7 bit0
bit 7-2: Unimplemented: Read as '0' bit 1-0: PCFG1:PCFG0: A/D Port Configuration Control bits
PCFG1:PCFG0 RA1 & RA0 RA2 RA3 V
00 A A A VDD 01 A A VREF RA3 10 A D D V 11 D D D VDD
A = Analog input D = Di
ital I/O
REF
DD
W =Writable bit U =Unimplemented
- n =Value at POR reset
bit, read as ‘0’
DS30272A-page 38 1997 Microchip Technology Inc.
PIC16C71X
The ADRES register contains the result of the A/D con­version. When the A/D conversion is complete, the result is loaded into the ADRES register, the GO/DONE bit (ADCON0<2>) is cleared, and A/D interrupt flag bit ADIF is set. The block diagram of the A/D module is shown in Figure 7-4.
After the A/D module has been configured as desired, the selected channel must be acquired before the con­version is started. The analog input channels must have their corresponding TRIS bits selected as an input. To determine acquisition time, see Section 7.1. After this acquisition time has elapsed the A/D conver­sion can be started. The following steps should be fol­lowed for doing an A/D conversion:
1. Configure the A/D module:
• Configure analog pins / voltage reference / and digital I/O (ADCON1)
• Select A/D input channel (ADCON0)
• Select A/D conversion clock (ADCON0)
• Turn on A/D module (ADCON0)
FIGURE 7-4: A/D BLOCK DIAGRAM
2. Configure A/D interrupt (if desired):
• Clear ADIF bit
• Set ADIE bit
• Set GIE bit
3. Wait the required acquisition time.
4. Start conversion:
• Set GO/DONE
bit (ADCON0)
5. Wait for A/D conversion to complete, by either:
• Polling for the GO/DONE
bit to be cleared
OR
• Waiting for the A/D interrupt
6. Read A/D Result register (ADRES), clear bit ADIF if required.
7. For next conversion, go to step 1 or step 2 as required. The A/D conversion time per bit is defined as T
AD. A minimum wait of 2TAD is
required before next acquisition starts.
CHS1:CHS0
A/D
Converter
VREF
(Reference
voltage)
VIN
(Input voltage)
PCFG1:PCFG0
V
DD
00 or 10 or 11
01
11
10
01
00
RA3/AN3/V
RA2/AN2
RA1/AN1
RA0/AN0
REF
1997 Microchip Technology Inc. DS30272A-page 39
PIC16C71X

7.1 A/D Acquisition Requirements

For the A/D converter to meet its specified accuracy, the charge holding capacitor (C
HOLD) must be allowed
to fully charge to the input channel voltage level. The analog input model is shown in Figure 7-5. The source impedance (R
S) and the internal sampling switch (RSS)
impedance directly affect the time required to charge the capacitor C impedance varies over the device voltage (V
HOLD. The sampling switch (RSS)
DD),
Figure 7-5. The source impedance affects the offset voltage at the analog input (due to pin leakage current).
The maximum recommended impedance for ana­log sources is 10 k. After the analog input channel is
selected (changed) this acquisition must be done before the conversion can be started.
To calculate the minimum acquisition time, Equation 7­1 may be used. This equation calculates the acquisition time to within 1/2 LSb error is used (512 steps for the A/D). The 1/2 LSb error is the maximum error allowed for the A/D to meet its specified accuracy.
EQUATION 7-1: A/D MINIMUM CHARGING
TIME
VHOLD = (VREF - (VREF/512)) • (1 - e Given: VHOLD = (VREF/512), for 1/2 LSb resolution The above equation reduces to: TCAP = -(51.2 pF)(1 k + RSS + RS) ln(1/511)
Example 7-1 shows the calculation of the minimum required acquisition time T based on the following system assumptions.
HOLD = 51.2 pF
C Rs = 10 k
1/2 LSb error
DD = 5V Rss = 7 k
V Temp (application system max.) = 50°C
HOLD = 0 @ t = 0
V
(-TCAP/CHOLD(RIC + RSS + RS))
ACQ. This calculation is
Note 1: The reference voltage (VREF) has no
effect on the equation, since it cancels itself out.
Note 2: The charge holding capacitor (C
HOLD) is
not discharged after each conversion.
Note 3: The maximum recommended impedance
for analog sources is 10 kΩ. This is required to meet the pin leakage specifi­cation.
Note 4: After a conversion has completed, a
2.0T
AD delay must complete before acqui-
sition can begin again. During this time the holding capacitor is not connected to the selected A/D input channel.
EXAMPLE 7-1: CALCULATING THE
MINIMUM REQUIRED AQUISITION TIME
TACQ = Amplifier Settling Time +
Holding Capacitor Charging Time + Temperature Coefficient
ACQ = 5 µs + TCAP + [(Temp - 25°C)(0.05 µs/°C)]
)
T
CAP = -CHOLD (RIC + RSS + RS) ln(1/511)
T
-51.2 pF (1 k + 7 k + 10 k) ln(0.0020)
-51.2 pF (18 k) ln(0.0020)
-0.921 µs (-6.2364)
5.747 µs
ACQ = 5 µs + 5.747 µs + [(50°C - 25°C)(0.05 µs/°C)]
T
10.747 µs + 1.25 µs
11.997 µs
FIGURE 7-5: ANALOG INPUT MODEL
VDD
ANx
Rs
VT I leakage
RIC SS C
HOLD
CPIN 5 pF
= input capacitance = threshold voltage
= leakage current at the pin due to
various junctions
= interconnect resistance = sampling switch = sample/hold capacitance (from DAC)
VA
Legend CPIN
DS30272A-page 40 1997 Microchip Technology Inc.
VT = 0.6V
V
T = 0.6V
IC 1k
R
I leakage ± 500 nA
Sampling Switch
SS
6V 5V
V
DD
4V 3V 2V
SS
R
CHOLD = DAC capacitance = 51.2 pF
SS
V
5 6 7 8 9 10 11
Sampling Switch
( k )
PIC16C71X

7.2 Selecting the A/D Conversion Clock

The A/D conversion time per bit is defined as TAD. The A/D conversion requires 9.5T The source of the A/D conversion clock is software selectable. The four possible options for T
OSC
• 2T
• 8TOSC
• 32TOSC
• Internal RC oscillator
For correct A/D conversions, the A/D conversion clock (T
AD) must be selected to ensure a minimum TAD time
of:
2.0 µs for the PIC16C71
1.6 µs for all other PIC16C71X devices Table 7-1 and Table 7-2 and show the resultant T
times derived from the device operating frequencies and the A/D clock source selected.
AD per 8-bit conversion.
AD are:
AD

7.3 Configuring Analog Port Pins

The ADCON1 and TRISA registers control the opera­tion of the A/D port pins. The port pins that are desired as analog inputs must have their corresponding TRIS bits set (input). If the TRIS bit is cleared (output), the digital output level (V
The A/D operation is independent of the state of the CHS2:CHS0 bits and the TRIS bits.
Note 1: When reading the port register, all pins
configured as analog input channels will read as cleared (a low level). Pins config­ured as digital inputs, will convert an ana­log input. Analog levels on a digitally configured input will not affect the conver­sion accuracy.
Note 2: Analog levels on any pin that is defined as
a digital input (including the AN7:AN0 pins), may cause the input buffer to con-
OH or VOL) will be converted.
sume current that is out of the devices specification.
TABLE 7-1: TAD vs. DEVICE OPERATING FREQUENCIES, PIC16C71
AD Clock Source (TAD) Device Frequency
Operation ADCS1:ADCS0 20 MHz 16 MHz 4 MHz 1 MHz 333.33 kHz
OSC 00
2T 8TOSC 01 32TOSC 10
RC
(5)
11
2 - 6 µs
100 ns 400 ns
1.6 µs
(2)
(2) (2) (1,4)
2 - 6 µs
Legend: Shaded cells are outside of recommended range. Note 1: The RC source has a typical T
AD time of 4 µs.
2: These values violate the minimum required T 3: For faster conversion times, the selection of another clock source is recommended. 4: When device frequency is greater than 1 MHz, the RC A/D conversion clock source is recommended for
sleep operation only.
5: For extended voltage devices (LC), please refer to Electrical Specifications section.
(2)
125 ns 500 ns
(2)
500 ns
2.0 µs 8.0 µs
2.0 µs 8.0 µs
(1,4)
AD time.
2 - 6 µs
(2)
(1,4)
2.0 µs 6 µs 24 µs
32.0 µs 2 - 6 µs
(3) (1)
96 µs
2 - 6 µs
(3) (3)
(1)
TABLE 7-2: TAD vs. DEVICE OPERATING FREQUENCIES, PIC16C710/711, PIC16C715
AD Clock Source (T
Operation ADCS1:ADCS0 20 MHz 5 MHz 1.25 MHz 333.33 kHz
OSC 00
2T 8TOSC 01 32TOSC 10 1.6 µs 6.4 µs
(5)
RC Legend: Shaded cells are outside of recommended range.
Note 1: The RC source has a typical T
2: These values violate the minimum required T 3: For faster conversion times, the selection of another clock source is recommended. 4: When device frequency is greater than 1 MHz, the RC A/D conversion clock source is recommended for
sleep operation only.
5: For extended voltage devices (LC), please refer to Electrical Specifications section.
1997 Microchip Technology Inc. DS30272A-page 41
AD) Device Frequency
100 ns 400 ns
(2) (2)
400 ns
(2)
1.6 µs 6 µs
1.6 µs 6.4 µs
25.6 µs
11
2 - 6 µs
AD time of 4 µs.
(1,4)
2 - 6 µs
AD time.
(1,4)
2 - 6 µs
(3)
(1,4)
24 µs 96 µs
2 - 6 µs
(3) (3)
(1)
PIC16C71X

7.4 A/D Conversions

Example 7-2 shows how to perform an A/D conv ersion. The RA pins are configured as analog inputs. The ana­log reference (V rupt is enabled, and the A/D conversion clock is F
REF) is the device VDD. The A/D inter-
RC.
The conversion is performed on the RA0 pin (channel
0).
EXAMPLE 7-2: A/D CON VER SION
BSF STATUS, RP0 ; Select Bank 1 CLRF ADCON1 ; Configure A/D inputs BCF STATUS, RP0 ; Select Bank 0 MOVLW 0xC1 ; RC Clock, A/D is on, Channel 0 is selected MOVWF ADCON0 ; BSF INTCON, ADIE ; Enable A/D Interrupt BSF INTCON, GIE ; Enable all interrupts ; ; Ensure that the required sampling time for the selected input channel has elapsed. ; Then the conversion may be started. ; BSF ADCON0, GO ; Start A/D Conversion : ; The ADIF bit will be set and the GO/DONE bit : ; is cleared upon completion of the A/D Conversion.
Note: The GO/DONE bit should NOT be set in
the same instruction that turns on the A/D.
Clearing the GO/DONE
bit during a conversion will abort the current conversion. The ADRES register will NOT be updated with the partially completed A/D con­version sample. That is, the ADRES register will con­tinue to contain the value of the last completed conversion (or the last value written to the ADRES reg­ister). After the A/D conversion is aborted, a 2T is required before the next acquisition is started. After this 2T
AD wait, an acquisition is automatically star ted
on the selected channel.
AD wait
DS30272A-page 42 1997 Microchip Technology Inc.
PIC16C71X
7.4.1 FASTER CONVERSION - LOWER RESOLUTION TRADE-OFF
Since the T
AD is based from the device oscillator, the
user must use some method (a timer, software loop, etc.) to determine when the A/D oscillator may be
Not all applications require a result with 8-bits of reso­lution, but may instead require a f aster conv ersion time. The A/D module allows users to make the trade-off of conversion speed to resolution. Regardless of the res­olution required, the acquisition time is the same. To speed up the conversion, the clock source of the A/D module may be switched so that the T
AD time violates
the minimum specified time (see the applicable electri­cal specification). Once the T
AD time violates the mini-
mum specified time, all the following A/D result bits are
changed. Example 7-3 shows a comparison of time required for a conversion with 4-bits of resolution, ver­sus the 8-bit resolution conversion. The example is for devices operating at 20 MHz and 16 MHz (The A/D clock is programmed for 32T immediately after 6T for 2T
OSC.
OSC violates the minimum TAD time since the
The 2T
AD, the A/D clock is programmed
OSC), and assumes that
last 4-bits will not be converted to correct values.
not valid (see A/D Conversion Timing in the Electrical Specifications section.) The clock sources may only be switched between the three oscillator versions (cannot be switched from/to RC). The equation to determine the time before the oscillator can be switched is as follows:
Conversion time = 2T
AD + N • TAD + (8 - N)(2TOSC)
Where: N = number of bits of resolution required.
EXAMPLE 7-3: 4-BIT vs. 8-BIT CONVERSION TIMES
Freq. (MHz)
(1)
TAD 20 1.6 µs 1.6 µs
16 2.0 µs 2.0 µs
T
OSC 20 50 ns 50 ns
16 62.5 ns 62.5 ns
2T
AD + N • TAD + (8 - N)(2TOSC) 20 10 µs 16 µs
16 12.5 µs 20 µs
Note 1: The PIC16C71 has a minimum T
All other PIC16C71X devices have a minimum T
AD time of 2.0 µs.
AD time of 1.6 µs.
Resolution
4-bit 8-bit
1997 Microchip Technology Inc. DS30272A-page 43
PIC16C71X

7.5 A/D Operation During Sleep

The A/D module can operate during SLEEP mode. This requires that the A/D clock source be set to RC (ADCS1:ADCS0 = 11). When the RC clock source is selected, the A/D module waits one instruction cycle before starting the conversion. This allows the SLEEP instruction to be executed, which eliminates all digital switching noise from the conversion. When the conver­sion is completed the GO/DONE the result loaded into the ADRES register. If the A/D interrupt is enabled, the device will wake-up from SLEEP. If the A/D interrupt is not enabled, the A/D mod­ule will then be turned off, although the ADON bit will remain set.
When the A/D clock source is another clock option (not RC), a SLEEP instruction will cause the present conver­sion to be aborted and the A/D module to be turned off, though the ADON bit will remain set.
Turning off the A/D places the A/D module in its lowest current consumption state.
Note: For the A/D module to operate in SLEEP,
the A/D clock source must be set to RC (ADCS1:ADCS0 = 11). To perform an A/D conversion in SLEEP, ensure the SLEEP instruction immediately follows the instruc­tion that sets the GO/DONE
bit will be cleared, and
bit.

7.6 A/D Accuracy/Error

The absolute accuracy specified for the A/D converter includes the sum of all contributions for quantization error, integral error , diff erential error , full scale error, off­set error, and monotonicity. It is defined as the maxi­mum deviation from an actual transition versus an ideal transition for any code. The absolute error of the A/D converter is specified at < ±1 LSb for V the device’s specified operating range). However, the accuracy of the A/D converter will degrade as V diverges from VREF.
For a given range of analog inputs, the output digital code will be the same. This is due to the quantization of the analog input to a digital code. Quantization error is typically ± 1/2 LSb and is inherent in the analog to dig­ital conversion process. The only way to reduce quanti­zation error is to increase the resolution of the A/D converter.
Offset error measures the first actual transition of a code versus the first ideal transition of a code. Offset error shifts the entire transfer function. Offset error can be calibrated out of a system or introduced into a sys­tem through the interaction of the total leakage current and source impedance at the analog input.
Gain error measures the maximum deviation of the last actual transition and the last ideal transition adjusted for offset error . This error appears as a change in slope of the transfer function. The difference in gain error to
DD = VREF (over
DD
full scale error is that full scale does not take offset error into account. Gain error can be calibrated out in soft­ware.
Linearity error refers to the uniformity of the code changes. Linearity errors cannot be calibrated out of the system. Integral non-linearity error measures the actual code transition versus the ideal code transition adjusted by the gain error for each code.
Differential non-linearity measures the maximum actual code width versus the ideal code width. This measure is unadjusted.
In systems where the device frequency is low, use of the A/D RC clock is preferred. At moderate to high fre­quencies, T lator. T 8 µs for preferred operation. This is because T when derived from T phase clock transitions. This reduces, to a large e xtent, the effects of digital switching noise . This is not possib le with the RC derived clock. The loss of accuracy due to digital switching noise can be significant if many I/O pins are active.
In systems where the device will enter SLEEP mode after the start of the A/D conversion, the RC clock source selection is required. In this mode, the digital noise from the modules in SLEEP are stopped. This method gives high accuracy.
AD should be derived from the device oscil-
AD must not violate the minimum and should be
AD,
OSC, is kept away from on-chip

7.7 Effects of a RESET

A device reset forces all registers to their reset state. This forces the A/D module to be turned off, and any conversion is aborted.
The value that is in the ADRES register is not modified for a Power-on Reset. The ADRES register will contain unknown data after a Power-on Reset.

7.8 Connection Considerations

If the input voltage exceeds the rail v alues (VSS or VDD) by greater than 0.2V, then the accuracy of the conver­sion is out of specification.
Note: Care must be taken when using the RA0
pin in A/D conversions due to its proximity to the OSC1 pin.
An external RC filter is sometimes added for anti-alias­ing of the input signal. The R component should be selected to ensure that the total source impedance is kept under the 10 k recommended specification. Any external components connected (via hi-impedance) to an analog input pin (capacitor, zener diode , etc.) should have very little leakage current at the pin.
DS30272A-page 44 1997 Microchip Technology Inc.
PIC16C71X

7.9 Transfer Function

The ideal transfer function of the A/D conv erter is as fol­lows: the first transition occurs when the analog input voltage (V
AIN) is Analog VREF/256 (Figure 7-6).

7.10 References

A very good reference for understanding A/D convert­ers is the "Analog-Digital Conversion Handbook" third edition, published by Prentice Hall (ISBN 0-13-03­2848-0).
FIGURE 7-7: FLOWCHART OF A/D OPERATION
ADON = 0
FIGURE 7-6: A/D TRANSFER FUNCTION
FFh FEh
04h
Digital code output
03h 02h 01h 00h
1 LSb
2 LSb
3 LSb
0.5 LSb
4 LSb
Analog input voltage
255 LSb
256 LSb
(full scale)
ADON = 0?
No
Acquire
Selected Channel
GO = 0?
No
A/D Clock
= RC?
No
Device in SLEEP?
No
Finish Conversion
GO = 0
ADIF = 1
Yes
Yes
Yes
Yes
Start of A/D
Conversion Delayed
1 Instruction Cycle
Abort Conversion
GO = 0
ADIF = 0
SLEEP
Power-down A/D
SLEEP
Instruction?
No
Finish Conversion
GO = 0
ADIF = 1
Wait 2 T
AD
Yes
Finish Conversion
GO = 0
ADIF = 1
Wake-up
From Sleep?
No
Stay in Sleep
Power-down A/D
Yes
Wait 2 TAD
Wait 2 TAD
1997 Microchip Technology Inc. DS30272A-page 45
PIC16C71X
TABLE 7-3: REGISTERS/BITS ASSOCIATED WITH A/D, PIC16C710/71/711
Value on:
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0Bh,8Bh 89h 08h 88h 05h PORTA RA4 RA3 RA2 RA1 RA0 85h TRISA PORTA Data Direction Register
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
INTCON GIE ADIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u ADRES A/D Result Register xxxx xxxx uuuu uuuu ADCON0 ADCS1 ADCS0 CHS1 CHS0 GO/DONE ADIF ADON 00-0 0000 00-0 0000 ADCON1 PCFG1 PCFG0 ---- --00 ---- --00
POR,
BOR
---x 0000 ---u 0000
---1 1111 ---1 1111
TABLE 7-4: REGISTERS/BITS ASSOCIATED WITH A/D, PIC16C715
Value on:
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0Bh/8Bh 0Ch 8Ch 1Eh 1Fh
9Fh
INTCON GIE PEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000x 0000 000u PIR1 ADIF -0-- ---- -0-- ---- PIE1 ADIE -0-- ---- -0-- ---- ADRES A/D Result Register xxxx xxxx uuuu uuuu ADCON0ADCS1ADCS0CHS2 CHS1 CHS0 GO/
DONE
ADCON1 — PCFG1 PCFG0 ---- --00 ---- --00
ADON 0000 00-0 0000 00-0
POR,
BOR
Value on
all other
Resets
Value on all other
Resets
05h PORTA — 85h TRISA
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
— —
RA4 RA3 RA2 RA1 RA0
TRISA4 TRISA3TRISA2 TRISA1 TRISA0
---x 0000 ---u 0000
---1 1111 ---1 1111
DS30272A-page 46 1997 Microchip Technology Inc.
PIC16C71X

8.0 SPECIAL FEATURES OF THE CPU

Applicable Devices 710 71 711 715
What sets a microcontroller apart from other proces­sors are special circuits to deal with the needs of real­time applications. The PIC16CXX family has a host of such features intended to maximize system reliability, minimize cost through elimination of external compo­nents, provide power sa ving operating modes and off er code protection. These are:
• Oscillator selection
• Reset
- Power-on Reset (POR)
- Power-up Timer (PWRT)
- Oscillator Start-up Timer (OST)
- Brown-out Reset (BOR) (PIC16C710/711/715)
- Parity Error Reset (PER) (PIC16C715)
• Interrupts
• Watchdog Timer (WDT)
• SLEEP
• Code protection
• ID locations
• In-circuit serial programming The PIC16CXX has a Watchdog Timer which can be
shut off only through configuration bits. It runs off its own RC oscillator for added reliability. There are two timers that offer necessary delays on power-up. One is the Oscillator Start-up Timer (OST), intended to keep the chip in reset until the crystal oscillator is stable. The other is the Pow er-up Timer (PWRT), which provides a
fixed delay of 72 ms (nominal) on power-up only, designed to keep the part in reset while the power sup­ply stabilizes. With these two timers on-chip, most applications need no external reset circuitry.
SLEEP mode is designed to offer a very low current power-down mode. The user can wake-up from SLEEP through external reset, Watchdog Timer Wake-up, or through an interrupt. Se v er al oscillator options are also made available to allow the part to fit the application. The RC oscillator option saves system cost while the LP crystal option saves power. A set of configuration bits are used to select various options.
8.1 Configuration Bits
The configuration bits can be programmed (read as '0') or left unprogrammed (read as '1') to select various device configurations. These bits are mapped in pro­gram memory location 2007h.
The user will note that address 2007h is beyond the user program memory space. In fact, it belongs to the special test/configuration memory space (2000h ­3FFFh), which can be accessed only during program­ming.
FIGURE 8-1: CONFIGURATION WORD FOR PIC16C71
CP0 PWRTE WDTE FOSC1 FOSC0
bit13 bit0
bit 13-5: Unimplemented: Read as '1' bit 4: CP0: Code protection bit
1 = Code protection off 0 = All memory is code protected, but 00h - 3Fh is writable
bit 3: PWRTE: Power-up Timer Enable bit
1 = Power-up Timer enabled 0 = Power-up Timer disabled
bit 2: WDTE: Watchdog Timer Enable bit
1 = WDT enabled 0 = WDT disabled
bit 1-0: FOSC1:FOSC0: Oscillator Selection bits
11 = RC oscillator 10 = HS oscillator 01 = XT oscillator 00 = LP oscillator
1997 Microchip Technology Inc. DS30272A-page 47
Register: CONFIG Address 2007h
PIC16C71X
FIGURE 8-2: CONFIGURATION WORD, PIC16C710/711
CP0 CP0 CP0 CP0 CP0 CP0 CP0 BODEN CP0 CP0 PWRTE WDTE FOSC1 FOSC0
bit13 bit0
bit 13-7 CP0: Code protection bits 5-4: 1 = Code protection off
0 = All memory is code protected, but 00h - 3Fh is writable
bit 6: BODEN: Brown-out Reset Enable bit
1 = BOR enabled 0 = BOR disabled
bit 3: PWRTE: Power-up Timer Enable bit
1 = PWRT disabled 0 = PWRT enabled
bit 2: WDTE: Watchdog Timer Enable bit
1 = WDT enabled 0 = WDT disabled
bit 1-0: FOSC1:FOSC0: Oscillator Selection bits
11 = RC oscillator 10 = HS oscillator 01 = XT oscillator 00 = LP oscillator
Note 1: Enabling Brown-out Reset automatically enables Power-up Timer (PWRT) regardless of the value of bit PWRTE.
Ensure the Power-up Timer is enabled anytime Brown-out Reset is enabled.
2: All of the CP0 bits have to be given the same value to enable the code protection scheme listed.
(2)
(1)
(1)
Register: CONFIG Address 2007h
FIGURE 8-3: CONFIGURATION WORD, PIC16C715
CP1 CP0 CP1 CP0 CP1 CP0 MPEEN BODEN CP1 CP0 PWRTE WDTE FOSC1 FOSC0
bit13 bit0
bit 13-8 CP1:CP0: Code Protection bits 5-4: 11 = Code protection off
10 = Upper half of program memory code protected 01 = Upper 3/4th of program memory code protected 00 = All memory is code protected
bit 7: MPEEN: Memory Parity Error Enable
1 = Memory Parity Checking is enabled 0 = Memory Parity Checking is disabled
bit 6: BODEN: Brown-out Reset Enable bit
1 = BOR enabled 0 = BOR disabled
bit 3: PWRTE: Power-up Timer Enable bit
1 = PWRT disabled 0 = PWRT enabled
bit 2: WDTE: Watchdog Timer Enable bit
1 = WDT enabled 0 = WDT disabled
bit 1-0: FOSC1:FOSC0: Oscillator Selection bits
11 = RC oscillator 10 = HS oscillator 01 = XT oscillator 00 = LP oscillator
(2)
(1)
(1)
Register: CONFIG Address 2007h
Note 1: Enabling Brown-out Reset automatically enables Power-up Timer (PWRT) regardless of the value of bit PWRTE.
Ensure the Power-up Timer is enabled anytime Brown-out Reset is enabled.
2: All of the CP1:CP0 pairs have to be given the same value to enable the code protection scheme listed.
DS30272A-page 48 1997 Microchip Technology Inc.
PIC16C71X
8.2 Oscillator Configurations
8.2.1 OSCILLATOR TYPES The PIC16CXX can be operated in four different oscil-
lator modes. The user can program two configuration bits (FOSC1 and FOSC0) to select one of these four modes:
• LP Low Power Crystal
• XT Crystal/Resonator
• HS High Speed Crystal/Resonator
• RC Resistor/Capacitor
8.2.2 CRYSTAL OSCILLATOR/CERAMIC RESONATORS
In XT, LP or HS modes a cr ystal or ceramic resonator is connected to the OSC1/CLKIN and OSC2/CLKOUT pins to establish oscillation (Figure 8-4). The PIC16CXX Oscillator design requires the use of a par­allel cut crystal. Use of a series cut crystal may give a frequency out of the crystal manufacturers specifica­tions. When in XT, LP or HS modes, the device can have an external clock source to drive the OSC1/ CLKIN pin (Figure 8-5).
FIGURE 8-4: CRYSTAL/CERAMIC
RESONATOR OPERATION (HS, XT OR LP OSC CONFIGURATION)
OSC1
C1
XTAL
OSC2
RS
Note1
C2
See Table 8-1 and Table 8-1 for recommended values of C1 and C2.
Note 1: A series resistor may be required for AT strip
cut crystals.
2: The buffer is on the OSC2 pin.
RF
SLEEP
PIC16CXXX
(2)
To internal logic
TABLE 8-1: CERAMIC RESONATORS,
PIC16C71
Ranges Tested:
Mode Freq OSC1 OSC2
XT 455 kHz
2.0 MHz
4.0 MHz
HS 8.0 MHz
16.0 MHz
These values are for design guidance only. See notes at bottom of page.
47 - 100 pF 15 - 68 pF 15 - 68 pF
15 - 68 pF 10 - 47 pF
47 - 100 pF 15 - 68 pF 15 - 68 pF
15 - 68 pF 10 - 47 pF
Resonators Used:
455 kHz Panasonic EFO-A455K04B ± 0.3%
2.0 MHz Murata Erie CSA2.00MG ± 0.5%
4.0 MHz Murata Erie CSA4.00MG ± 0.5%
8.0 MHz Murata Erie CSA8.00MT ± 0.5%
16.0 MHz Murata Erie CSA16.00MX ± 0.5%
All resonators used did not have built-in capacitors.
TABLE 8-2: CAPACITOR SELECTION
FOR CRYSTAL OSCILLATOR, PIC16C71
Mode Freq OSC1 OSC2
LP 32 kHz
200 kHz
XT 100 kHz
500 kHz
1 MHz 2 MHz 4 MHz
HS 8 MHz
20 MHz
These values are for design guidance only. See notes at bottom of page.
33 - 68 pF 15 - 47 pF
47 - 100 pF
20 - 68 pF 15 - 68 pF 15 - 47 pF 15 - 33 pF
15 - 47 pF 15 - 47 pF
33 - 68 pF 15 - 47 pF
47 - 100 pF
20 - 68 pF 15 - 68 pF 15 - 47 pF 15 - 33 pF
15 - 47 pF 15 - 47 pF
FIGURE 8-5: EXTERNAL CLOCK INPUT
OPERATION (HS, XT OR LP OSC CONFIGURATION)
Clock from ext. system
Open
1997 Microchip Technology Inc. DS30272A-page 49
OSC1
PIC16CXXX
OSC2
PIC16C71X
TABLE 8-3: CERAMIC RESONATORS,
PIC16C710/711/715
Ranges Tested:
Mode Freq OSC1 OSC2
XT 455 kHz
2.0 MHz
4.0 MHz
HS 8.0 MHz
16.0 MHz
These values are for design guidance only. See notes at bottom of page.
Resonators Used:
455 kHz Panasonic EFO-A455K04B ± 0.3%
2.0 MHz Murata Erie CSA2.00MG ± 0.5%
4.0 MHz Murata Erie CSA4.00MG ± 0.5%
8.0 MHz Murata Erie CSA8.00MT ± 0.5%
16.0 MHz Murata Erie CSA16.00MX ± 0.5%
All resonators used did not have built-in capacitors.
68 - 100 pF 15 - 68 pF 15 - 68 pF
10 - 68 pF 10 - 22 pF
68 - 100 pF 15 - 68 pF 15 - 68 pF
10 - 68 pF 10 - 22 pF
TABLE 8-4: CAPACITOR SELECTION
FOR CRYSTAL OSCILLATOR, PIC16C710/711/715
Osc Type
LP 32 kHz 33 pF 33 pF
XT 200 kHz 47-68 pF 47-68 pF
HS 4 MHz 15 pF 15 pF
These values are for design guidance only. See notes at bottom of page.
32 kHz Epson C-001R32.768K-A ± 20 PPM
200 kHz STD XTL 200.000KHz ± 20 PPM
1 MHz ECS ECS-10-13-1 ± 50 PPM 4 MHz ECS ECS-40-20-1 ± 50 PPM 8 MHz EPSON CA-301 8.000M-C ± 30 PPM
20 MHz EPSON CA-301 20.000M-C ± 30 PPM
Crystal
Freq
200 kHz 15 pF 15 pF
1 MHz 15 pF 15 pF 4 MHz 15 pF 15 pF
8 MHz 15-33 pF 15-33 pF
20 MHz 15-33 pF 15-33 pF
Cap. Range C1Cap. Range
C2
Crystals Used
Note 1: Recommended values of C1 and C2 are identical to the ranges tested table.
2: Higher capacitance increases the stability of oscillator but also increases the start-up time. 3: Since each resonator/crystal has its own characteristics, the user should consult the resonator/crystal man-
ufacturer for appropriate values of external components.
4: Rs may be required in HS mode as well as XT mode to avoid overdriving crystals with low drive level speci-
fication.
DS30272A-page 50 1997 Microchip Technology Inc.
PIC16C71X
8.2.3 EXTERNAL CRYSTAL OSCILLATOR CIRCUIT
Either a prepackaged oscillator can be used or a simple oscillator circuit with TTL gates can be built. Prepack­aged oscillators provide a wide operating range and better stability. A well-designed crystal oscillator will provide good performance with TTL gates . Two types of crystal oscillator circuits can be used; one with series resonance, or one with parallel resonance.
Figure 8-6 shows implementation of a parallel resonant oscillator circuit. The circuit is designed to use the fun­damental frequency of the crystal. The 74AS04 inverter performs the 180-degree phase shift that a parallel oscillator requires. The 4.7 k resistor provides the negative feedback for stability. The 10 k potentiome­ter biases the 74AS04 in the linear region. This could be used for external oscillator designs.
FIGURE 8-6: EXTERNAL PARALLEL
RESONANT CRYSTAL OSCILLATOR CIRCUIT
+5V
10k
4.7k
74AS04
10k
XTAL
10k
20 pF
20 pF
Figure 8-7 shows a series resonant oscillator circuit. This circuit is also designed to use the fundamental fre­quency of the crystal. The inverter performs a 180­degree phase shift in a series resonant oscillator cir­cuit. The 330 k resistors provide the negative feed­back to bias the inverters in their linear region.
74AS04
To Other Devices
PIC16CXXX
CLKIN
FIGURE 8-7: EXTERNAL SERIES
RESONANT CRYSTAL OSCILLATOR CIRCUIT
To Other
330 k
74AS04
330 k
74AS04
0.1 µF XTAL
Devices
74AS04 PIC16CXXX
CLKIN
8.2.4 RC OSCILLATOR For timing insensitive applications the “RC” device
option offers additional cost savings. The RC oscillator frequency is a function of the supply voltage, the resis­tor (Rext) and capacitor (Cext) values, and the operat­ing temperature. In addition to this, the oscillator frequency will vary from unit to unit due to normal pro­cess parameter variation. Furthermore, the difference in lead frame capacitance between package types will also affect the oscillation frequency, especially for low Cext values. The user also needs to take into account variation due to tolerance of external R and C compo­nents used. Figure 8-8 shows how the R/C combina­tion is connected to the PIC16CXX. For Rext values below 2.2 kΩ, the oscillator operation may become unstable, or stop completely. For very high Rext values (e.g. 1 M), the oscillator becomes sensitive to noise, humidity and leakage. Thus, we recommend to keep Rext between 3 k and 100 kΩ.
Although the oscillator will operate with no external capacitor (Cext = 0 pF), we recommend using values above 20 pF for noise and stability reasons. With no or small external capacitance, the oscillation frequency can vary dramatically due to changes in external capacitances, such as PCB trace capacitance or pack­age lead frame capacitance.
See characterization data for desired device f or RC fre­quency variation from part to part due to nor mal pro­cess variation. The variation is larger for larger R (since leakage current variation will affect RC frequency more for large R) and for smaller C (since variation of input capacitance will affect RC frequency more).
See characterization data for desired device for varia­tion of oscillator frequency due to V
DD for given Rext/
Cext values as well as frequency v ariation due to oper­ating temperature for given R, C, and V
DD values.
The oscillator frequency, divided by 4, is available on the OSC2/CLKOUT pin, and can be used for test pur­poses or to synchronize other logic (see Figure 3-2 for waveform).
FIGURE 8-8: RC OSCILLATOR MODE
VDD
Rext
Cext
VSS
Fosc/4
OSC1
OSC2/CLKOUT
Internal
clock
PIC16CXXX
1997 Microchip Technology Inc. DS30272A-page 51
PIC16C71X
8.3 Reset
WDT Reset, on MCLR reset during SLEEP, and Brown­out Reset (BOR). They are not affected by a WDT
Applicable Devices 710 71 711 715
The PIC16CXX differentiates between various kinds of reset:
• Pow er-on Reset (POR)
• MCLR
• MCLR
• WDT Reset (normal operation)
• Brown-out Reset (BOR) (PIC16C710/711/715)
• Parity Error Reset (PIC16C715) Some registers are not affected in any reset condition;
their status is unknown on POR and unchanged in any other reset. Most other registers are reset to a “reset state” on Power-on Reset (POR), on the MCLR
reset during normal operation reset during SLEEP
and
Wake-up, which is viewed as the resumption of normal operation. The T
O and PD bits are set or cleared differ­ently in different reset situations as indicated in Table 8­7, Tab le 8-8 and Table 8-9. These bits are used in soft­ware to determine the nature of the reset. See Table 8­10 and Table 8-11 for a full descr iption of reset states of all registers.
A simplified block diagram of the on-chip reset circuit is shown in Figure 8-9.
The PIC16C710/711/715 have a MCLR the MCLR
reset path. The filter will detect and ignore
small pulses. It should be noted that a WDT Reset
MCLR
pin low.
FIGURE 8-9: SIMPLIFIED BLOCK DIAGRAM OF ON-CHIP RESET CIRCUIT
External

Reset

MCLR/VPP Pin
Program
Memory
Parity
MPEEN
(3)
noise filter in
does not drive
V
DD
OSC1/ CLKIN
Pin
Module
V
Brown-out
Reset
OST/PWRT
On-chip
RC OSC
WDT
detect
(1)
SLEEP
WDT Time-out
DD rise
Power-on Reset
(2)
OST
10-bit Ripple-counter
PWRT
10-bit Ripple-counter
BODEN
Enable PWRT
Enable OST
See Table 8-6 for time-out situations.
Note 1: This is a separate oscillator from the RC oscillator of the CLKIN pin.
2: Brown-out Reset is implemented on the PIC16C710/711/715. 3: Parity Error Reset is implemented on the PIC16C715.
S
Chip_Reset
R
Q
DS30272A-page 52 1997 Microchip Technology Inc.
PIC16C71X
8.4 Power-on Reset (POR), Power-up Timer (PWRT) and Oscillator Start-up Timer (OST), and Brown-out Reset (BOR)
8.4.1 POWER-ON RESET (POR)
Applicable Devices 710 71 711 715
A Power-on Reset pulse is generated on-chip when V
DD rise is detected (in the range of 1.5V - 2.1V). To
take advantage of the POR, just tie the MCLR directly (or through a resistor) to V
DD. This will eliminate
pin
external RC components usually needed to create a Power-on Reset. A maximum rise time f or V
DD is spec-
ified. See Electrical Specifications for details. When the device starts normal operation (exits the
reset condition), device operating parameters (v oltage , frequency, temperature, ...) must be met to ensure operation. If these conditions are not met, the device must be held in reset until the operating conditions are met. Bro wn-out Reset ma y be used to meet the startup conditions.
For additional information, refer to Application Note AN607, "
Power-up Trouble Shooting
."
8.4.2 POWER-UP TIMER (PWRT)
Applicable Devices 710 71 711 715
The Power-up Timer provides a fixed 72 ms nominal time-out on power-up only, from the POR. The Power­up Timer operates on an internal RC oscillator. The chip is kept in reset as long as the PWRT is active . The PWRT’ s time delay allows V level. A configuration bit is provided to enable/disable the PWRT.
DD to rise to an acceptable
The power-up time delay will v ary from chip to chip due to V
DD, temperature, and process variation. See DC
parameters for details.
8.4.3 OSCILLATOR START-UP TIMER (OST)
Applicable Devices 710 71 711 715
The Oscillator Start-up Timer (OST) provides 1024 oscillator cycle (from OSC1 input) delay after the PWRT delay is o ver. This ensures that the crystal oscil­lator or resonator has started and stabilized.
The OST time-out is invoked only for XT, LP and HS modes and only on Power-on Reset or wake-up from SLEEP.
8.4.4 BROWN-OUT RESET (BOR)
Applicable Devices 710 71 711 715
A configuration bit, BODEN, can disable (if clear/pro­grammed) or enable (if set) the Brown-out Reset cir­cuitry. If V greater than parameter #35, the brown-out situation will reset the chip. A reset may not occur if V
4.0V for less than parameter #35. The chip will remain in Brown-out Reset until V Power-up Timer will now be invoked and will keep the chip in RESET an additional 72 ms. If V BV go back into a Brown-out Reset and the Power-up Timer will be initialized. Once V the Power-up Timer will execute a 72 ms time delay. The Power-up Timer should always be enabled when Brown-out Reset is enabled. Figure 8-10 shows typical brown-out situations.
DD falls below 4.0V (3.8V - 4.2V range) for
DD falls below
DD rises above BVDD. The
DD drops below
DD while the Pow er-up Timer is running, the chip will
DD rises above BVDD,
FIGURE 8-10: BROWN-OUT SITUATIONS
VDD
DD
BV
Internal
Reset
VDD
Internal
Reset
VDD
Internal
Reset
1997 Microchip Technology Inc. DS30272A-page 53
72 ms
<72 ms
72 ms
72 ms
BVDD
DD
BV
PIC16C71X
8.4.5 TIME-OUT SEQUENCE
Applicable Devices 710 71 711 715
On power-up the time-out sequence is as follows: First PWRT time-out is inv oked after the POR time delay has expired. Then OST is activated. The total time-out will vary based on oscillator configuration and the status of the PWRT. For example, in RC mode with the PWRT disabled, there will be no time-out at all. Figure 8-11, Figure 8-12, and Figure 8-13 depict time-out sequences on power-up.
Since the time-outs occur from the POR pulse, if MCLR is kept low long enough, the time-outs will expire . Then bringing MCLR (Figure 8-12). This is useful for testing purposes or to synchronize more than one PIC16CXX device operat­ing in parallel.
Table 8-10 and T able 8-11 show the reset conditions for some special function registers, while Table 8-12 and Table 8-13 show the reset conditions for all the registers.
8.4.6 POWER CONTROL/STATUS REGISTER
high will begin execution immediately
(PCON)
Applicable Devices 710 71 711 715
The Power Control/Status Register, PCON has up to two bits, depending upon the device.
Bit0 is Brown-out Reset Status bit, BOR unknown on a Power-on Reset. It must then be set by the user and checked on subsequent resets to see if bit BOR
cleared, indicating a BOR occurred. The BOR bit is a "Don’t Care" bit and is not necessarily predictable if the Brown-out Reset circuitry is disabled (by clearing bit BODEN in the Configuration Word).
. Bit BOR is
Bit1 is POR (Power-on Reset Status bit). It is cleared on a Power-on Reset and unaffected otherwise. The user must set this bit following a Power-on Reset.
For the PIC16C715, bit2 is PER is cleared on a Parity Error Reset and must be set by user software. It will also be set on a Power-on Reset.
For the PIC16C715, bit7 is MPEEN (Memory Parity Error Enable). This bit reflects the status of the MPEEN bit in configuration word. It is unaff ected by an y reset of interrupt.
8.4.7 PARITY ERROR RESET (PER)
(Parity Error Reset). It
Applicable Devices 710 71 711 715
The PIC16C715 has on-chip parity bits that can be used to verify the contents of program memory. Parity bits may be useful in applications in order to increase overall reliability of a system.
There are two parity bits for each word of Program Memory. The parity bits are computed on alternating bits of the program word. One computation is per­formed using even parity, the other using odd parity. As a program ex ecutes, the parity is verified. The ev en par­ity bit is XOR’d with the even bits in the program mem­ory word. The odd parity bit is negated and XOR’d with the odd bits in the program memory word. When an error is detected, a reset is generated and the PER bit 2 in the PCON register is cleared (logic ‘0’). This indi­cation can allow software to act on a failure. However, there is no indication of the program memory location of the failure in Program Memory. This flag can only be set (logic ‘1’) by software.
The parity array is user selectable during programming. Bit 7 of the configuration word located at address 2007h can be programmed (read as ‘0’) to disable par­ity. If left unprog rammed (read as ‘1’), parity is enabled.
flag
TABLE 8-5: TIME-OUT IN VARIOUS SITUATIONS, PIC16C71
Oscillator Configuration Power-up Wake-up from SLEEP
PWRTE = 1 PWRTE = 0
XT, HS, LP 72 ms + 1024T
RC 72 ms
OSC 1024TOSC 1024 TOSC
TABLE 8-6: TIME-OUT IN VARIOUS SITUATIONS, PIC16C710/711/715
Oscillator Configuration Power-up
PWR
TE = 0 PWRTE = 1
XT, HS, LP 72 ms + 1024T
RC 72 ms 72 ms
DS30272A-page 54 1997 Microchip Technology Inc.
OSC 1024TOSC 72 ms + 1024TOSC 1024TOSC
Brown-out
Wake-up from SLEEP
TABLE 8-7: STATUS BITS AND THEIR SIGNIFICANCE, PIC16C71
TO PD
1 1 Power-on Reset 0 x Illegal, T x 0 Illegal, PD is set on POR 0 1 WDT Reset 0 0 WDT Wake-up u u MCLR 1 0 MCLR
O is set on POR
Reset during normal operation Reset during SLEEP or interrupt wake-up from SLEEP
TABLE 8-8: STATUS BITS AND THEIR SIGNIFICANCE, PIC16C710/711
PIC16C71X
POR
BOR TO PD
0 x 1 1 Power-on Reset 0 x 0 x Illegal, T 0 x x 0 Illegal, PD is set on POR 1 0 x x Brown-out Reset 1 1 0 1 WDT Reset 1 1 0 0 WDT Wake-up 1 1 u u MCLR 1 1 1 0 MCLR
O is set on POR
Reset during normal operation Reset during SLEEP or interrupt wake-up from SLEEP
TABLE 8-9: STATUS BITS AND THEIR SIGNIFICANCE, PIC16C715
PER
1 0 x 1 1 Power-on Reset x 0 x 0 x Illegal, T x 0 x x 0 Illegal, PD is set on POR 1 1 0 x x Brown-out Reset 1 1 1 0 1 WDT Reset 1 1 1 0 0 WDT Wake-up 1 1 1 u u MCLR 1 1 1 1 0 MCLR 0 1 1 1 1 Parity Error Reset 0 0 x x x Illegal, PER 0 x 0 x x Illegal, PER
POR BOR TO PD
O is set on POR
Reset during normal operation Reset during SLEEP or interrupt wake-up from SLEEP
is set on POR is set on BOR
1997 Microchip Technology Inc. DS30272A-page 55
PIC16C71X
TABLE 8-10: RESET CONDITION FOR SPECIAL REGISTERS, PIC16C710/71/711
Condition
Power-on Reset 000h 0001 1xxx ---- --0x
Reset during normal operation 000h 000u uuuu ---- --uu
MCLR
Reset during SLEEP 000h 0001 0uuu ---- --uu
MCLR WDT Reset 000h 0000 1uuu ---- --uu WDT Wake-up PC + 1 uuu0 0uuu ---- --uu Brown-out Reset (PIC16C710/711) 000h 0001 1uuu ---- --u0 Interrupt wake-up from SLEEP PC + 1 Legend: u = unchanged, x = unknown, - = unimplemented bit read as '0'.
Note 1: When the wake-up is due to an interrupt and the GIE bit is set, the PC is loaded
with the interrupt vector (0004h).
Program Counter
(1)
STATUS
Register
uuu1 0uuu ---- --uu
PCON
Register
PIC16C710/711
TABLE 8-11: RESET CONDITION FOR SPECIAL REGISTERS, PIC16C715
Condition
Power-on Reset 000h 0001 1xxx u--- -10x
Reset during normal operation 000h 000u uuuu u--- -uuu
MCLR
Reset during SLEEP 000h 0001 0uuu u--- -uuu
MCLR WDT Reset 000h 0000 1uuu u--- -uuu
Program Counter
STATUS
Register
PCON
Register
WDT Wake-up PC + 1 uuu0 0uuu u--- -uuu Brown-out Reset 000h 0001 1uuu u--- -uu0 Parity Error Reset 000h uuu1 0uuu u--- -0uu Interrupt wake-up from SLEEP PC + 1 Legend: u = unchanged, x = unknown, - = unimplemented bit read as '0'.
Note 1: When the wake-up is due to an interrupt and the GIE bit is set, the PC is loaded with the interrupt vector
(0004h).
(1)
uuu1 0uuu u--- -uuu
DS30272A-page 56 1997 Microchip Technology Inc.
PIC16C71X
TABLE 8-12: INITIALIZATION CONDITIONS FOR ALL REGISTERS, PIC16C710/71/711
Register Power-on Reset,
Brown-out Reset
W xxxx xxxx uuuu uuuu uuuu uuuu INDF N/A N/A N/A TMR0 xxxx xxxx uuuu uuuu uuuu uuuu PCL 0000h 0000h
STATUS 0001 1xxx FSR xxxx xxxx uuuu uuuu uuuu uuuu
PORTA ---x 0000 ---u 0000 ---u uuuu PORTB xxxx xxxx uuuu uuuu uuuu uuuu PCLATH ---0 0000 ---0 0000 ---u uuuu INTCON 0000 000x 0000 000u
ADRES xxxx xxxx uuuu uuuu uuuu uuuu ADCON0 00-0 0000 00-0 0000 uu-u uuuu OPTION 1111 1111 1111 1111 uuuu uuuu TRISA ---1 1111 ---1 1111 ---u uuuu TRISB 1111 1111 1111 1111 uuuu uuuu
(4)
PCON ADCON1 ---- --00 ---- --00 ---- --uu Legend: u = unchanged, x = unknown, - = unimplemented bit, read as '0', q = value depends on condition
Note 1: One or more bits in INTCON will be affected (to cause wake-up).
2: When the wake-up is due to an interrupt and the GIE bit is set, the PC is loaded with the interrupt vector
(0004h). 3: See Table 8-10 for reset value for specific condition. 4: The PCON register is not implemented on the PIC16C71. 5: Brown-out reset is not implemented on the PIC16C71.
---- --0u ---- --uu ---- --uu
(5)
MCLR Resets
WDT Reset
000q quuu
(3)
Wake-up via
WDT or
Interrupt
PC + 1
uuuq quuu
uuuu uuuu
(2)
(3)
(1)
1997 Microchip Technology Inc. DS30272A-page 57
PIC16C71X
TABLE 8-13: INITIALIZATION CONDITIONS FOR ALL REGISTERS, PIC16C715
Register Power-on Reset,
Brown-out Reset
Parity Error Reset
W xxxx xxxx uuuu uuuu uuuu uuuu INDF N/A N/A N/A TMR0 xxxx xxxx uuuu uuuu uuuu uuuu PCL 0000 0000 0000 0000
STATUS 0001 1xxx FSR xxxx xxxx uuuu uuuu uuuu uuuu
PORTA ---x 0000 ---u 0000 ---u uuuu PORTB xxxx xxxx uuuu uuuu uuuu uuuu PCLATH ---0 0000 ---0 0000 ---u uuuu INTCON 0000 000x 0000 000u
PIR1 ADCON0 0000 00-0 0000 00-0 uuuu uu-u
OPTION 1111 1111 1111 1111 uuuu uuuu TRISA ---1 1111 ---1 1111 ---u uuuu TRISB 1111 1111 1111 1111 uuuu uuuu PIE1 -0-- ---- -0-- ---- -u-- ---- PCON ---- -qqq ---- -1uu ---- -1uu ADCON1 ---- --00 ---- --00 ---- --uu Legend: u = unchanged, x = unknown, - = unimplemented bit, read as '0', q = value depends on condition
Note 1: One or more bits in INTCON and PIR1 will be affected (to cause wake-up).
2: When the wake-up is due to an interrupt and the GIE bit is set, the PC is loaded with the interrupt vector
(0004h).
3: See Table 8-11 for reset value for specific condition.
-0-- ---- -0-- ----
MCLR Resets
WDT Reset
000q quuu
(3)
Wake-up via
WDT or
Interrupt
PC + 1
uuuq quuu
uuuu uuuu
-u-- ----
(2)
(3)
(1)
(1)
DS30272A-page 58 1997 Microchip Technology Inc.
PIC16C71X
FIGURE 8-11: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 1
VDD
MCLR
INTERNAL POR
TPWRT
PWR
T TIME-OUT
OST TIME-OUT
INTERNAL RESET
FIGURE 8-12: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
TOST
MCLR
INTERNAL POR
TPWRT
T TIME-OUT
PWR
OST TIME-OUT
INTERNAL RESET
FIGURE 8-13: TIME-OUT SEQUENCE ON POWER-UP (MCLR
VDD
MCLR
INTERNAL POR
TPWRT
PWR
T TIME-OUT
TOST
TOST
TIED TO VDD)
OST TIME-OUT
INTERNAL RESET
1997 Microchip Technology Inc. DS30272A-page 59
PIC16C71X
FIGURE 8-14: EXTERNAL POWER-ON
RESET CIRCUIT (FOR SLOW VDD POWER-UP)
V
DD
D
R
R1
MCLR
C
Note 1: External Power-on Reset circuit is
required only if V slow. The diode D helps discharge the capacitor quickly when V
2: R < 40 k is recommended to make sure
that voltage drop across R does not violate the device’s electrical specification.
3: R1 = 100 to 1 k will limit any current
flowing into MCLR from external capacitor C in the event of MCLR/ down due to Electrostatic Discharge (ESD) or Electrical Overstress (EOS).
PIC16CXX
DD power-up slope is too
DD powers down.
VPP pin break-
FIGURE 8-15: EXTERNAL BROWN-OUT
PROTECTION CIRCUIT 1
VDD
33k
10k
40k
Note 1: This circuit will activate reset when VDD
goes below (Vz + 0.7V) where Vz = Zener voltage.
2: Internal brown-out detection on the
PIC16C710/711/715 should be disabled when using this circuit.
3: Resistors should be adjusted for the char-
acteristics of the transistor.
DD
V
MCLR
PIC16CXX
FIGURE 8-16: EXTERNAL BROWN-OUT
PROTECTION CIRCUIT 2
VDD
R1
R2
Q1
40k
VDD
MCLR
PIC16CXX
Note 1: This brown-out circuit is less expensive ,
albeit less accurate. Transistor Q1 turns off when V
DD is below a certain level
such that:
V
DD
R1
R1 + R2
= 0.7V
2: Internal brown-out detection on the
PIC16C710/711/715 should be disabled when using this circuit.
3: Resistors should be adjusted for the
characteristics of the transistor.
DS30272A-page 60 1997 Microchip Technology Inc.
PIC16C71X

8.5 Interrupts

Applicable Devices 710 71 711 715
The PIC16C71X family has 4 sources of interrupt.
Interrupt Sources
External interrupt RB0/INT TMR0 overflow interrupt PORTB change interrupts (pins RB7:RB4) A/D Interrupt
The interrupt control register (INTCON) records indi­vidual interrupt requests in flag bits. It also has individ­ual and global interrupt enable bits.
Note: Individual interrupt flag bits are set regard-
less of the status of their corresponding mask bit or the GIE bit.
A global interrupt enable bit, GIE (INTCON<7>) enables (if set) all un-masked interrupts or disables (if cleared) all interrupts. When bit GIE is enabled, and an interrupt’s flag bit and mask bit are set, the interrupt will vector immediately. Individual interrupts can be dis­abled through their corresponding enable bits in vari­ous registers. Individual interrupt bits are set regardless of the status of the GIE bit. The GIE bit is cleared on reset.
The “return from interrupt” instruction, RETFIE, exits the interrupt routine as well as sets the GIE bit, which re-enables interrupts.
The RB0/INT pin interrupt, the RB port change inter­rupt and the TMR0 overflow interrupt flags are con­tained in the INTCON register.
The peripheral interrupt flags are contained in the spe­cial function registers PIR1 and PIR2. The correspond­ing interrupt enable bits are contained in special function registers PIE1 and PIE2, and the peripheral interrupt enable bit is contained in special function reg­ister INTCON.
When an interrupt is responded to, the GIE bit is cleared to disable any further interrupt, the return address is pushed onto the stack and the PC is loaded with 0004h. Once in the interrupt service routine the source(s) of the interrupt can be determined by polling the interrupt flag bits. The interr upt flag bit(s) must be cleared in software before re-enabling interrupts to avoid recursive interrupts.
For external interrupt events, such as the INT pin or PORTB change interrupt, the interrupt latency will be three or four instruction cycles. The exact latency depends when the interrupt event occurs (Figure 8-19). The latency is the same for one or two cycle instruc­tions. Individual interrupt flag bits are set regardless of the status of their corresponding mask bit or the GIE bit.
Note: For the PIC16C71
If an interrupt occurs while the Global Inter­rupt Enable (GIE) bit is being cleared, the GIE bit may unintentionally be re-enabled by the user’s Interrupt Service Routine (the RETFIE instruction). The events that would cause this to occur are:
1. An instruction clears the GIE bit while an interrupt is acknowledged.
2. The program branches to the Interrupt vector and executes the Interrupt Ser­vice Routine.
3. The Interrupt Service Routine com­pletes with the execution of the RET- FIE instruction. This causes the GIE bit to be set (enables interrupts), and the program returns to the instruction after the one which was meant to dis­able interrupts.
Perform the following to ensure that inter­rupts are globally disabled:
LOOP BCF INTCON, GIE ; Disable global ; interrupt bit BTFSC INTCON, GIE ; Global interrupt ; disabled? GOTO LOOP ; NO, try again : ; Yes, continue ; with program ; flow
1997 Microchip Technology Inc. DS30272A-page 61
PIC16C71X
FIGURE 8-17: INTERRUPT LOGIC, PIC16C710, 71, 711
T0IF T0IE
INTF INTE
RBIF RBIE
ADIF ADIE
GIE
FIGURE 8-18: INTERRUPT LOGIC, PIC16C715
T0IF T0IE
INTF INTE
RBIF RBIE
ADIF ADIE
ADIF
GIE
Wakeup (If in SLEEP mode)
Interrupt to CPU
Wakeup (If in SLEEP mode)
Interrupt to CPU
DS30272A-page 62 1997 Microchip Technology Inc.
PIC16C71X
8.5.1 INT INTERRUPT External interrupt on RB0/INT pin is edge triggered:
either rising if bit INTEDG (OPTION<6>) is set, or fall­ing, if the INTEDG bit is clear. When a valid edge appears on the RB0/INT pin, flag bit INTF (INTCON<1>) is set. This interr upt can be disabled by clearing enable bit INTE (INTCON<4>). Flag bit INTF must be cleared in software in the interrupt service rou­tine before re-enabling this interrupt. The INT interrupt can wake-up the processor from SLEEP, if bit INTE was set prior to going into SLEEP. The status of global inter­rupt enable bit GIE decides whether or not the proces­sor branches to the interrupt vector following wake-up. See Section 8.8 for details on SLEEP mode.
FIGURE 8-19: INT PIN INTERRUPT TIMING
Q2Q1 Q3 Q4 Q2Q1 Q3 Q4 Q2Q1 Q3 Q4 Q2Q1 Q3 Q4 Q2Q1 Q3 Q4
OSC1
CLKOUT
INT pin
INTF flag (INTCON<1>)
GIE bit (INTCON<7>)
INSTR
PC
Instruction fetched
3
UCTION FLOW
1
PC
Inst (PC)
4
1
5
PC+1
Inst (PC+1)
8.5.2 TMR0 INTERRUPT An overflow (FFh 00h) in the TMR0 register will set
flag bit T0IF (INTCON<2>). The interrupt can be enabled/disabled by setting/clearing enable bit T0IE (INTCON<5>). (Section 6.0)
8.5.3 PORTB INTCON CHANGE An input change on PORTB<7:4> sets flag bit RBIF
(INTCON<0>). The interrupt can be enabled/disabled by setting/clearing enable bit RBIE (INTCON<4>). (Section 5.2)
Note: For the PIC16C71
if a change on the I/O pin should occur when the read operation is being executed (start of the Q2 cycle), then the RBIF inter­rupt flag may not get set.
Interrupt Latency
PC+1
2
0004h
Inst (0004h)
Inst (0005h)
0005h
Instruction executed
Note
1: INTF flag is sampled here (every Q1). 2: Interrupt latency = 3-4 Tcy where Tcy = instruction cycle time.
Latency is the same whether Inst (PC) is a single cycle or a 2-cycle instruction. 3: CLKOUT is available only in RC oscillator mode. 4: For minimum width of INT pulse, refer to AC specs. 5: INTF is enabled to be set anytime during the Q4-Q1 cycles.
1997 Microchip Technology Inc. DS30272A-page 63
Inst (PC-1)
Inst (PC)
Dummy Cycle
Dummy Cycle
Inst (0004h)
PIC16C71X

8.6 Context Saving During Interrupts

During an interrupt, only the return PC value is saved on the stack. Typically, users may wish to save ke y reg­isters during an interrupt i.e., W register and STATUS register. This will have to be implemented in software.
Example 8-1 stores and restores the STATUS and W registers. The user register, STATUS_TEMP, must be defined in bank 0.
The example: a) Stores the W register.
b) Stores the STATUS register in bank 0. c) Executes the ISR code. d) Restores the STATUS register (and bank select
bit).
e) Restores the W register.
EXAMPLE 8-1: SAVING STATUS AND W REGISTERS IN RAM
MOVWF W_TEMP ;Copy W to TEMP register, could be bank one or zero SWAPF STATUS,W ;Swap status to be saved into W MOVWF STATUS_TEMP ;Save status to bank zero STATUS_TEMP register : :(ISR) : SWAPF STATUS_TEMP,W ;Swap STATUS_TEMP register into W ;(sets bank to original state) MOVWF STATUS ;Move W into STATUS register SWAPF W_TEMP,F ;Swap W_TEMP SWAPF W_TEMP,W ;Swap W_TEMP into W
DS30272A-page 64 1997 Microchip Technology Inc.
PIC16C71X

8.7 Watchdog Timer (WDT)

Applicable Devices 710 71 711 715
The Watchdog Timer is as a free running on-chip RC oscillator which does not require any external compo­nents. This RC oscillator is separate from the RC oscil­lator of the OSC1/CLKIN pin. That means that the WDT will run, even if the clock on the OSC1/CLKIN and OSC2/CLKOUT pins of the device has been stopped, for example, by execution of a SLEEP instruction. Dur­ing normal operation, a WDT time-out generates a device RESET (Watchdog Timer Reset). If the device is in SLEEP mode, a WDT time-out causes the device to wake-up and continue with normal operation (Watch­dog Timer Wake-up). The WDT can be permanently disabled by clearing configuration bit WDTE (Section 8.1).
8.7.1 WDT PERIOD The WDT has a nominal time-out period of 18 ms, (with
no prescaler). The time-out periods vary with tempera-
DD
ture, V DC specs). If longer time-out periods are desired, a prescaler with a division ratio of up to 1:128 can be
and process variations from part to part (see
assigned to the WDT under software control by writing to the OPTION register. Thus, time-out periods up to
2.3 seconds can be realized. The CLRWDT and SLEEP instructions clear the WDT and
the postscaler, if assigned to the WDT, and prevent it from timing out and generating a device RESET condi­tion.
The T
O bit in the STATUS register will be cleared upon
a Watchdog Timer time-out.
8.7.2 WDT PROGRAMMING CONSIDERATIONS It should also be taken into account that under worst
case conditions (V
DD = Min., Temperature = Max., and
max. WDT prescaler) it may take several seconds before a WDT time-out occurs.
Note: When a CLRWDT instruction is executed
and the prescaler is assigned to the WDT, the prescaler count will be cleared, but the prescaler assignment is not changed.
FIGURE 8-20: WATCHDOG TIMER BLOCK DIAGRAM
From TMR0 Clock Source (Figure 6-6)
0
M
1
WDT Timer
WDT
Enable Bit
Note: PSA and PS2:PS0 are bits in the OPTION register.
U X
PSA
Postscaler
8 - to - 1 MUX
0
MUX
WDT
Time-out
8
PS2:PS0
To TMR0 (Figure 6-6)
1
PSA
FIGURE 8-21: SUMMARY OF WATCHDOG TIMER REGISTERS
Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
2007h Config. bits 81h,181h OPTION
(1)
BODEN
RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
(1)
CP1 CP0
PWRTE
Legend: Shaded cells are not used by the Watchdog Timer. Note 1: See Figure 8-1, Figure 8-2 and Figure 8-3 for operation of these bits.
(1)
WDTE FOSC1 FOSC0
1997 Microchip Technology Inc. DS30272A-page 65
PIC16C71X

8.8 Power-down Mode (SLEEP)

Power-down mode is entered by executing a SLEEP instruction.
If enabled, the Watchdog Timer will be cleared but keeps running, the PD T
O (STATUS<4>) bit is set, and the oscillator driver is turned off. The I/O por ts maintain the status they had, before the SLEEP instruction was executed (driving high, low, or hi-impedance).
For lowest current consumption in this mode, place all I/O pins at either V cuitry is drawing current from the I/O pin, power-down the A/D, disable external clocks. Pull all I/O pins, that are hi-impedance inputs, high or low externally to av oid switching currents caused by floating inputs. The T0CKI input should also be at V current consumption. The contribution from on-chip pull-ups on PORTB should be considered.
The MCLR
8.8.1 WAKE-UP FROM SLEEP The device can wake up from SLEEP through one of
the following events:
1. External reset input on MCLR
2. Watchdog Timer Wake-up (if WDT was
3. Interrupt from INT pin, RB port change, or some
External MCLR other events are considered a continuation of program execution and cause a "wake-up". The T in the STATUS register can be used to determine the cause of device reset. The PD power-up, is cleared when SLEEP is in vok ed. The T is cleared if a WDT time-out occurred (and caused wake-up).
The following peripheral interrupts can wake the de vice from SLEEP:
1. TMR1 interrupt. Timer1 must be operating as
2. A/D conversion (when A/D clock source is RC).
pin must be at a logic high level (VIHMC).
enabled).
Peripheral Interrupts.
an asynchronous counter.
bit (STATUS<3>) is cleared, the
DD, or VSS, ensure no external cir-
DD or VSS for lowest
pin.
Reset will cause a device reset. All
O and PD bits
bit, which is set on
O bit
Other peripherals cannot generate interrupts since dur­ing SLEEP, no on-chip Q clocks are present.
When the SLEEP instruction is being executed, the ne xt instruction (PC + 1) is pre-fetched. For the device to wake-up through an interrupt event, the corresponding interrupt enable bit must be set (enabled). Wake-up is regardless of the state of the GIE bit. If the GIE bit is clear (disabled), the device continues execution at the instruction after the SLEEP instruction. If the GIE bit is set (enabled), the device executes the instruction after the SLEEP instruction and then branches to the inter­rupt address (0004h). In cases where the execution of the instruction following SLEEP is not desirable, the user should have a NOP after the SLEEP instruction.
8.8.2 WAKE-UP USING INTERRUPTS When global interrupts are disabled (GIE cleared) and
any interrupt source has both its interrupt enable bit and interrupt flag bit set, one of the following will occur:
• If the interrupt occurs before the the execution of a SLEEP instruction, the SLEEP instruction will complete as a NOP. Theref ore, the WDT and WDT postscaler will not be cleared, the T be set and PD
• If the interrupt occurs during or after the execu­tion of a SLEEP instruction, the device will immedi­ately wake up from sleep . The SLEEP instruction will be completely executed before the wake-up. Therefore, the WDT and WDT postscaler will be cleared, the T be cleared.
Even if the flag bits were checked before executing a SLEEP instruction, it may be possible for flag bits to become set before the SLEEP instruction completes. To determine whether a SLEEP instruction executed, test the PD
bit. If the PD bit is set, the SLEEP instruction was
executed as a NOP. To ensure that the WDT is cleared, a CLRWDT instruc-
tion should be executed before a SLEEP instruction.
bits will not be cleared.
O bit will be set and the PD bit will
O bit will not
DS30272A-page 66 1997 Microchip Technology Inc.
FIGURE 8-22: WAKE-UP FROM SLEEP THROUGH INTERRUPT
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
OST(2)
CLKOUT(4)
INT pin
INTF flag (INTCON<1>)
GIE bit (INTCON<7>)
INSTRUCTION FLOW
PC
Instruction fetched
Instruction executed
Inst(PC) = SLEEP
Processor in
SLEEP
PC PC+1 PC+2
Inst(PC + 1)
Inst(PC - 1)
SLEEP
T
PC+2
Inst(PC + 2)
Inst(PC + 1)
PIC16C71X
Interrupt Latency
(Note 2)
PC + 2 0004h 0005h
Inst(0004h)
Dummy cycle
Dummy cycle
Inst(0005h)
Inst(0004h)
Note 1: XT, HS or LP oscillator mode assumed.
8.9 Program Verification/Code Protection
If the code protection bit(s) have not been pro­grammed, the on-chip program memory can be read out for verification purposes.
Note: Microchip does not recommend code pro-

8.10 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 read­able and writable during program/verify. It is recom-
OST = 1024TOSC (drawing not to scale) This delay will not be there for RC osc mode.
2: T 3: GIE = '1' assumed. In this case after wake- up, the processor jumps to the interrupt routine. If GIE = '0', execution will continue in-line. 4: CLKOUT is not available in these osc modes, but shown here for timing reference.
The device is placed into a program/verify mode by holding the RB6 and RB7 pins low while raising the MCLR
(VPP) pin from VIL to VIHH (see programming specification). RB6 becomes the programming clock and RB7 becomes the programming data. Both RB6 and RB7 are Schmitt Trigger inputs in this mode.
tecting windowed devices.
After reset, to place the device into programming/verify mode, the program counter (PC) is at location 00h. A 6­bit command is then supplied to the device. Depending on the command, 14-bits of program data are then sup­plied to or from the device, depending if the command was a load or a read. For complete details of serial pro­gramming, please refer to the PIC16C6X/7X Program­ming Specifications (Literature #DS30228).
mended that only the 4 least significant bits of the ID location are used.
FIGURE 8-23: TYPICAL IN-CIRCUIT SERIAL
PROGRAMMING

8.11 In-Circuit Serial Programming

PIC16CXX microcontrollers can be serially pro­grammed while in the end application circuit. This is simply done with two lines for clock and data, and three other lines for power, ground, and the programming voltage. This allows customers to manufacture boards with unprogrammed devices, and then program the microcontroller just before shipping the product. This also allows the most recent firmware or a custom firm­ware to be programmed.
External Connector Signals
+5V
0V
VPP
CLK
CONNECTION
To Normal Connections
PIC16CXX
DD
V VSS MCLR/VPP
RB6
Data I/O
RB7
VDD
To Normal Connections
1997 Microchip Technology Inc. DS30272A-page 67
PIC16C71X
NOTES:
DS30272A-page 68 1997 Microchip Technology Inc.
PIC16C71X

9.0 INSTRUCTION SET SUMMARY

Each PIC16CXX instruction is a 14-bit word divided into an OPCODE which specifies the instruction type and one or more operands which further specify the operation of the instruction. The PIC16CXX instruction set summary in Table 9-2 lists byte-oriented, bit-ori- ented, and literal and control operations. Table 9-1 shows the opcode field descriptions.
For byte-oriented instructions, 'f' represents a file reg­ister designator and 'd' represents a destination desig­nator. The file register designator specifies which file register is to be used by the instruction.
The destination designator specifies where the result of the operation is to be placed. If 'd' is zero, the result is placed in the W register . If 'd' is one , the result is placed in the file register specified in the instruction.
For bit-oriented instructions, 'b' represents a bit field designator which selects the number of the bit affected by the operation, while 'f' represents the number of the file in which the bit is located.
For literal and control operations, 'k' represents an eight or eleven bit constant or literal value.
TABLE 9-1: OPCODE FIELD
DESCRIPTIONS
Byte-oriented operations
Bit-oriented operations
Literal and control operations All instructions are executed within one single instruc-
tion cycle, unless a conditional test is true or the pro­gram counter is changed as a result of an instruction. In this case, the execution takes two instruction cycles with the second cycle executed as a NOP. One instruc­tion cycle consists of four oscillator periods. Thus, for an oscillator frequency of 4 MHz, the normal instruction execution time is 1 µs . If a conditional test is true or the program counter is changed as a result of an instruc­tion, the instruction execution time is 2 µs.
Table 9-2 lists the instructions recognized by the MPASM assembler.
Figure 9-1 shows the general formats that the instruc­tions can have.
Note: To maintain upward compatibility with
future PIC16CXX products, do not use
the
OPTION and TRIS instructions.
All examples use the following format to represent a hexadecimal number:
0xhh
where h signifies a hexadecimal digit.
Field Description
f Register file address (0x00 to 0x7F) W Working register (accumulator) b Bit address within an 8-bit file register k Literal field, constant data or label x Don't care location (= 0 or 1)
The assembler will generate code with x = 0. It is the recommended form of use for compatibility with all Microchip software tools.
d Destination select; d = 0: store result in W,
d = 1: store result in file register f. Default is d = 1
label Label name
TOS Top of Stack
PC Program Counter
PCLATH
Program Counter High Latch
GIE Global Interrupt Enable bit WDT Watchdog Timer/Counter
TO Time-out bit PD Power-down bit
dest Destination either the W register or the specified
register file location
[ ] Options
Contents
( )
Assigned to
Register bit field
< >
In the set of
User defined term (font is courier)
i
talics
FIGURE 9-1: GENERAL FORMAT FOR
INSTRUCTIONS
Byte-oriented file register operations
13 8 7 6 0
OPCODE d 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 0
OPCODE b (BIT #) f (FILE #)
b = 3-bit bit address f = 7-bit file register address
Literal and control operations
General
13 8 7 0
OPCODE k (literal)
k = 8-bit immediate value
CALL and GOTO instructions only
13 11 10 0
OPCODE k (literal)
k = 11-bit immediate value
The instruction set is highly orthogonal and is grouped into three basic categories:
1997 Microchip Technology Inc. DS30272A-page 69
PIC16C71X
TABLE 9-2: PIC16CXX INSTRUCTION SET
Mnemonic, Operands
BYTE-ORIENTED FILE REGISTER OPERATIONS ADDWF
ANDWF CLRF CLRW COMF DECF DECFSZ INCF INCFSZ IORWF MOVF MOVWF NOP RLF RRF SUBWF SWAPF XORWF
BIT-ORIENTED FILE REGISTER OPERATIONS BCF
BSF BTFSC BTFSS
LITERAL AND CONTROL OPERATIONS ADDLW
ANDLW CALL CLRWDT GOTO IORLW MOVLW RETFIE RETLW RETURN SLEEP SUBLW XORLW
Note 1: 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'.
2: If this instruction is executed on the TMR0 register (and, where applicab le , d = 1), the prescaler will be cleared if assigned
to the Timer0 Module.
3: 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.
Description Cycles 14-Bit Opcode Status
MSb LSb
f, d
Add W and f
f, d
AND W with f
f
Clear f
-
Clear W
f, d
Complement f
f, d
Decrement f
f, d
Decrement f, Skip if 0
f, d
Increment f
f, d
Increment f, Skip if 0
f, d
Inclusive OR W with f
f, d
Move f
f
Move W to f
-
No Operation
f, d
Rotate Left f through Carry
f, d
Rotate Right f through Carry
f, d
Subtract W from f
f, d
Swap nibbles in f
f, d
Exclusive OR W with f
f, b
Bit Clear f
f, b
Bit Set f
f, b
Bit Test f, Skip if Clear
f, b
Bit Test f, Skip if Set
k
Add literal and W
k
AND literal with W
k
Call subroutine
-
Clear Watchdog Timer
k
Go to address
k
Inclusive OR literal with W
k
Move literal to W
-
Return from interrupt
k
Return with literal in W
-
Return from Subroutine
-
Go into standby mode
k
Subtract W from literal
k
Exclusive OR literal with W
1 1 1 1 1 1
1(2)
1
1(2)
1 1 1 1 1 1 1 1 1
1
1 1 (2) 1 (2)
1
1
2
1
2
1
1
2
2
2
1
1
1
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 01 01 01
11 11 10 00 10 11 11 00 11 00 00 11 11
0111 0101 0001 0001 1001 0011 1011 1010 1111 0100 1000 0000 0000 1101 1100 0010 1110 0110
00bb 01bb 10bb 11bb
111x 1001 0kkk 0000 1kkk 1000 00xx 0000 01xx 0000 0000 110x 1010
dfff dfff lfff 0xxx dfff dfff dfff dfff dfff dfff dfff lfff 0xx0 dfff dfff dfff dfff dfff
bfff bfff bfff bfff
kkkk kkkk kkkk 0110 kkkk kkkk kkkk 0000 kkkk 0000 0110 kkkk kkkk
ffff ffff ffff xxxx ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff
ffff ffff ffff ffff
kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk
Affected
C,DC,Z Z Z Z Z Z
Z
Z Z
C C C,DC,Z
Z
C,DC,Z Z
O,PD
T
Z
TO,PD C,DC,Z Z
Notes
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
1,2 1,2 3 3
DS30272A-page 70 1997 Microchip Technology Inc.

9.1 Instruction Descriptions

PIC16C71X
ADDLW Add Literal and W
label
Syntax: [
] ADDLW k Operands: 0 k 255 Operation: (W) + k (W) Status Affected: C, DC, Z Encoding: Description:
11 111x kkkk kkkk
The contents of the W register are added to the eight bit literal 'k' and the result is placed in the W register
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example:
Decode Read
literal 'k'
ADDLW 0x15
Process
data
Write to
W
Before Instruction
W = 0x10
After Instruction
W = 0x25
ANDLW AND Literal with W
label
Syntax: [
] ANDLW k Operands: 0 k 255 Operation: (W) .AND. (k) (W) Status Affected: Z Encoding: Description:
11 1001 kkkk kkkk
The contents of W register are AND’ed with the eight bit literal 'k'. The result is placed in the W register
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
literal "k"
ANDLW 0x5F
Process
data
Write to
W
Before Instruction
W = 0xA3
After Instruction
W = 0x03
ADDWF Add W and f
label
Syntax: [
] ADDWF f,d
Operands: 0 f 127
d ∈ [0,1] Operation: (W) + (f) (dest) Status Affected: C, DC, Z Encoding: Description:
00 0111 dfff ffff
Add the contents of the W register
with 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'
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
ADDWF FSR, 0
Process
'f'
data
Write to
Dest
Before Instruction
W = 0x17 FSR = 0xC2
After Instruction
W = 0xD9 FSR = 0xC2
ANDWF AND W with f
label
Syntax: [
] ANDWF f,d
Operands: 0 f 127
d ∈ [0,1] Operation: (W) .AND. (f) (dest) Status Affected: Z Encoding: Description:
00 0101 dfff ffff
AND the W register with 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'
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
ANDWF FSR, 1
Process
data
'f'
Write to
Dest
Before Instruction
W = 0x17 FSR = 0xC2
After Instruction
W = 0x17 FSR = 0x02
1997 Microchip Technology Inc. DS30272A-page 71
PIC16C71X
BCF Bit Clear f
label
Syntax: [
] BCF f,b
Operands: 0 f 127
0 b 7 Operation: 0 (f<b>) Status Affected: None Encoding:
01 00bb bfff ffff
Description: Bit 'b' in register 'f' is cleared. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
BCF FLAG_REG, 7
Process
data
'f'
Write
register 'f'
Before Instruction
FLAG_REG = 0xC7
After Instruction
FLAG_REG = 0x47
BSF Bit Set f
label
Syntax: [
] BSF f,b
Operands: 0 f 127
0 b 7 Operation: 1 (f<b>) Status Affected: None Encoding: Description:
01 01bb bfff ffff
Bit 'b' in register 'f' is set.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register
Process
data
'f'
Write
register 'f'
BTFSC Bit Test, Skip if Clear
label
Syntax: [
] BTFSC f,b
Operands: 0 f 127
0 b 7 Operation: skip if (f<b>) = 0 Status Affected: None Encoding: Description:
01 10bb bfff ffff
If bit 'b' in register 'f' is '1' then the next
instruction is executed.
If bit 'b', in register 'f', is '0' then the next
instruction is discarded, and a NOP is
executed instead, making this a 2TCY
instruction
. Words: 1 Cycles: 1(2) Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register 'f'
Process
data
NOP
If Skip: (2nd Cycle)
Q1 Q2 Q3 Q4
NOP NOP NOP NOP
Example
HERE FALSE TRUE
BTFSC GOTO
FLAG,1 PROCESS_CODE
Before Instruction
PC = address HERE
After Instruction
if FLAG<1> = 0, PC = address TRUE if FLAG<1>=1, PC = address FALSE
Example
BSF FLAG_REG, 7
Before Instruction
FLAG_REG = 0x0A
After Instruction
FLAG_REG = 0x8A
DS30272A-page 72 1997 Microchip Technology Inc.
PIC16C71X
BTFSS Bit Test f, Skip if Set
label
Syntax: [
] BTFSS f,b
Operands: 0 f 127
0 b < 7 Operation: skip if (f<b>) = 1 Status Affected: None Encoding: Description:
01 11bb bfff ffff
If bit 'b' in register 'f' is '0' then the next
instruction is executed.
If bit 'b' is '1', then the next instruction is
discarded and a NOP is executed
instead, making this a 2TCY instruction.
Words: 1 Cycles: 1(2) Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register 'f'
Process
data
NOP
If Skip: (2nd Cycle)
Q1 Q2 Q3 Q4
NOP NOP NOP NOP
Example
HERE FALSE TRUE
BTFSC GOTO
FLAG,1 PROCESS_CODE
Before Instruction
PC = address HERE
After Instruction
if FLAG<1> = 0, PC = address FALSE if FLAG<1> = 1, PC = address TRUE
CALL Call Subroutine
label
Syntax: [
] CALL k Operands: 0 k 2047 Operation: (PC)+ 1 TOS,
k PC<10:0>,
(PCLATH<4:3>) PC<12:11> Status Affected: None Encoding: Description:
10 0kkk kkkk kkkk
Call Subroutine. First, return address
(PC+1) is pushed onto the stack. The
eleven bit immediate address is loaded
into PC bits <10:0>. The upper bits of
the PC are loaded from PCLATH.
CALL is a two cycle instruction.
Words: 1 Cycles: 2 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
1st Cycle
2nd Cycle
Decode Read
literal 'k',
Push PC
to Stack
NOP NOP NOP NOP
HERE CALL THERE
Process
data
Write to
PC
Before Instruction
PC = Address HERE
After Instruction
PC = Address THERE TOS= Address HERE+1
1997 Microchip Technology Inc. DS30272A-page 73
PIC16C71X
CLRF Clear f
label
Syntax: [
] CLRF f Operands: 0 f 127 Operation: 00h (f)
1 Z Status Affected: Z Encoding: Description:
00 0001 1fff ffff
The contents of register 'f' are cleared
and the Z bit is set.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
CLRF FLAG_REG
Process
data
'f'
Write
register 'f'
Before Instruction
FLAG_REG = 0x5A
After Instruction
FLAG_REG = 0x00 Z = 1
CLRW Clear W
label
Syntax: [
] CLRW Operands: None Operation: 00h (W)
1 Z Status Affected: Z Encoding: Description:
00 0001 0xxx xxxx
W register is cleared. Zero bit (Z) is
set.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode NOP Process
data
CLRW
Write to
W
Before Instruction
W = 0x5A
After Instruction
W = 0x00 Z = 1
CLRWDT Clear Watchdog Timer
label
Syntax: [
] CLRWDT Operands: None Operation: 00h WDT
0 WDT prescaler,
O
1 T
1 PD Status Affected: TO, PD Encoding: Description:
00 0000 0110 0100
CLRWDT instruction resets the Watch-
dog Timer. It also resets the prescaler
of the WDT. Status bits TO and PD
are set.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode NOP Process
data
CLRWDT
Clear
WDT
Counter
Before Instruction
WDT counter = ?
After Instruction
WDT counter = 0x00 WDT prescaler= 0
TO = 1 PD = 1
DS30272A-page 74 1997 Microchip Technology Inc.
PIC16C71X
COMF Complement f
label
Syntax: [
] COMF f,d
Operands: 0 f 127
d [0,1]
Operation: (f
) (dest) Status Affected: Z Encoding: Description:
00 1001 dfff ffff
The contents of register 'f' are comple­mented. If 'd' is 0 the result is stored in W. If 'd' is 1 the result is stored back in register 'f'.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
COMF REG1,0
Process
'f'
data
Write to
dest
Before Instruction
REG1 = 0x13
After Instruction
REG1 = 0x13 W = 0xEC
DECFSZ Decrement f, Skip if 0
label
Syntax: [
] DECFSZ f,d
Operands: 0 f 127
d [0,1] Operation: (f) - 1 (dest); skip if result = 0 Status Affected: None Encoding: Description:
00 1011 dfff ffff
The contents of register 'f' are decre-
mented. If 'd' is 0 the result is placed in
the W register. If 'd' is 1 the result is
placed back in register 'f'.
If the result is 1, the next instruction, is
executed. If the result is 0, then a NOP is
executed instead making it a 2T
instruction.
CY
Words: 1 Cycles: 1(2) Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register
Process
data
'f'
Write to
dest
If Skip: (2nd Cycle)
Q1 Q2 Q3 Q4
NOP NOP NOP NOP
DECF Decrement f
label
Syntax: [
] DECF f,d
Operands: 0 f 127
d [0,1] Operation: (f) - 1 (dest) Status Affected: Z Encoding: Description:
00 0011 dfff ffff
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'
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
DECF CNT, 1
Process
'f'
data
Write to
dest
Before Instruction
CNT = 0x01 Z = 0
After Instruction
CNT = 0x00 Z = 1
Example
HERE DECFSZ CNT, 1 GOTO LOOP CONTINUE
Before Instruction
PC = address HERE
After Instruction
CNT = CNT - 1 if CNT = 0, PC = address CONTINUE if CNT 0, PC = address HERE+1
1997 Microchip Technology Inc. DS30272A-page 75
PIC16C71X
GOTO Unconditional Branch
label
Syntax: [
] GOTO k Operands: 0 k 2047 Operation: k PC<10:0>
PCLATH<4:3> PC<12:11> Status Affected: None Encoding: Description:
10 1kkk kkkk kkkk
GOTO is an unconditional branch. The
eleven bit immediate value is loaded
into PC bits <10:0>. The upper bits of
PC are loaded from PCLATH<4:3>.
GOTO is a two cycle instruction.
Words: 1 Cycles: 2 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
1st Cycle
2nd Cycle
Decode Read
literal 'k'
NOP NOP NOP NOP
GOTO THERE
Process
data
Write to
PC
After Instruction
PC = Address THERE
INCF Increment f
label
Syntax: [
] INCF f,d
Operands: 0 f 127
d [0,1] Operation: (f) + 1 (dest) Status Affected: Z Encoding: Description:
00 1010 dfff ffff
The contents of register 'f' are incre-
mented. If 'd' is 0 the result is placed
in the W register . If 'd' is 1 the result is
placed back in register 'f'.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
INCF CNT, 1
Process
data
'f'
Write to
dest
Before Instruction
CNT = 0xFF Z = 0
After Instruction
CNT = 0x00 Z = 1
DS30272A-page 76 1997 Microchip Technology Inc.
PIC16C71X
INCFSZ Increment f, Skip if 0
label
Syntax: [
] INCFSZ f,d
Operands: 0 f 127
d [0,1] Operation: (f) + 1 (dest), skip if result = 0 Status Affected: None Encoding: Description:
00 1111 dfff ffff
The contents of register 'f' are incre-
mented. If 'd' is 0 the result is placed
in the W register . If 'd' is 1 the result is
placed back in register 'f'.
If the result is 1, the next instruction is
executed. If the result is 0, a NOP is
executed instead making it a 2TCY
instruction
. Words: 1 Cycles: 1(2) Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register
Process
'f'
data
Write to
dest
If Skip: (2nd Cycle)
Q1 Q2 Q3 Q4
NOP NOP NOP NOP
IORLW Inclusive OR Literal with W
label
Syntax: [
] IORLW k Operands: 0 k 255 Operation: (W) .OR. k (W) Status Affected: Z Encoding: Description:
11 1000 kkkk kkkk
The contents of the W register is OR’ed with the eight bit literal 'k'. The result is placed in the W register
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
literal 'k'
IORLW 0x35
Process
data
Write to
W
Before Instruction
W = 0x9A
After Instruction
W = 0xBF Z = 1
Example
HERE INCFSZ CNT, 1 GOTO LOOP CONTINUE
Before Instruction
PC = address HERE
After Instruction
CNT = CNT + 1 if CNT= 0, PC = address CONTINUE if CNT 0, PC = address HERE +1
1997 Microchip Technology Inc. DS30272A-page 77
PIC16C71X
IORWF Inclusive OR W with f
label
Syntax: [
] IORWF f,d
Operands: 0 f 127
d [0,1] Operation: (W) .OR. (f) (dest) Status Affected: Z Encoding: Description:
00 0100 dfff ffff
Inclusive OR the W register with regis-
ter 'f'. If 'd' is 0 the result is placed in
the W register. If 'd' is 1 the result is
placed back in register 'f'.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
IORWF RESULT, 0
Process
data
'f'
Write to
dest
Before Instruction
RESULT = 0x13 W = 0x91
After Instruction
RESULT = 0x13 W = 0x93 Z = 1
MOVLW Move Literal to W
label
Syntax: [
] MOVLW k Operands: 0 k 255 Operation: k (W) Status Affected: None Encoding: Description:
11 00xx kkkk kkkk
The eight bit literal 'k' is loaded into W register
. The don’t cares will assemble
as 0’s.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
literal 'k'
MOVLW 0x5A
Process
data
Write to
W
After Instruction
W = 0x5A
MOVF Move f
label
Syntax: [
] MOVF f,d
Operands: 0 f 127
d [0,1] Operation: (f) (dest) Status Affected: Z Encoding: Description:
00 1000 dfff ffff
The contents of register f is moved to
a destination dependant upon the sta-
tus of d. If d = 0, destination is W reg-
ister. If d = 1, the destination is file
register f itself. d = 1 is useful to test a
file register since status flag Z is
affected.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
MOVF FSR, 0
Process
data
'f'
Write to
dest
After Instruction
W = value in FSR register Z = 1
MOVWF Move W to f
label
Syntax: [
] MOVWF f Operands: 0 f 127 Operation: (W) (f) Status Affected: None Encoding: Description:
00 0000 1fff ffff
Move data from W register to register 'f'
. Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
MOVWF OPTION_REG
Process
data
'f'
Write
register 'f'
Before Instruction
OPTION = 0xFF W = 0x4F
After Instruction
OPTION = 0x4F W = 0x4F
DS30272A-page 78 1997 Microchip Technology Inc.
PIC16C71X
NOP No Operation
label
Syntax: [
] NOP Operands: None Operation: No operation Status Affected: None Encoding: Description:
00 0000 0xx0 0000
No operation.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode NOP NOP NOP
Example
NOP
RETFIE Return from Interrupt
label
Syntax: [
] RETFIE Operands: None Operation: TOS PC,
1 GIE Status Affected: None Encoding: Description:
00 0000 0000 1001
Return from Interrupt. Stack is POP ed
and Top of Stack (TOS) is loaded in
the PC. Interrupts are enabled by set-
ting Global Interrupt Enable bit, GIE
(INTCON<7>). This is a two cycle
instruction.
Words: 1 Cycles: 2 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
1st Cycle
2nd Cycle
Decode NOP Set the
GIE bit
NOP NOP NOP NOP
RETFIE
Pop from
the Stack
After Interrupt
PC = TOS GIE = 1
OPTION Load Option Register
Syntax: [
label
] OPTION
Operands: None
Operation: (W) OPTION Status Affected: None Encoding: Description:
00 0000 0110 0010
The contents of the W register are loaded in the OPTION register. This instruction is supported for code com­patibility with PIC16C5X products. Since OPTION is a readable/writable register, the user can directly address it.
Words: 1 Cycles: 1 Example
To maintain upward compatibility with future PIC16CXX products, do not use this instruction.
1997 Microchip Technology Inc. DS30272A-page 79
PIC16C71X
RETLW Return with Literal in W
label
Syntax: [
] RETLW k Operands: 0 k 255 Operation: k (W);
TOS PC Status Affected: None Encoding: Description:
11 01xx kkkk kkkk
The W register is loaded with the eight
bit literal 'k'. The program counter is
loaded from the top of the stack (the
return address). This is a two cycle
instruction.
Words: 1 Cycles: 2 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
1st Cycle
2nd Cycle
TABLE
Decode Read
NOP NOP NOP NOP
CALL TABLE ;W contains table
;offset value
;W now has table value
ADDWF PC ;W = offset
RETLW k1 ;Begin table
RETLW k2 ;
RETLW kn ; End of table
literal 'k'
NOP Write to
W, Pop
from the
Stack
Before Instruction
W = 0x07
After Instruction
W = value of k8
RETURN Return from Subroutine
label
Syntax: [
] RETURN Operands: None Operation: TOS PC Status Affected: None Encoding: Description:
00 0000 0000 1000
Return from subroutine. The stack is POPed and the top of the stack (TOS) is loaded into the program counter. This is a two cycle instruction.
Words: 1 Cycles: 2 Q Cycle Activity: Q1 Q2 Q3 Q4
1st Cycle
2nd Cycle
Example
Decode NOP NOP Pop from
the Stack
NOP NOP NOP NOP
RETURN
After Interrupt
PC = TOS
DS30272A-page 80 1997 Microchip Technology Inc.
PIC16C71X
RLF Rotate Left f through Carry
label
Syntax: [
] RLF f,d
Operands: 0 f 127
d [0,1] Operation: See description below Status Affected: C Encoding: Description:
00 1101 dfff ffff
The contents of register 'f' are rotated
one bit to the left through the Carry
Flag. If 'd' is 0 the result is placed in
the W register. If 'd' is 1 the result is
stored back in register 'f'.
Register fC
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
RLF REG1,0
Process
data
'f'
Write to
dest
Before Instruction
REG1 = 1110 0110 C = 0
After Instruction
REG1 = 1110 0110 W = 1100 1100 C = 1
RRF Rotate Right f through Carry
label
Syntax: [
] RRF f,d
Operands: 0 f 127
d [0,1] Operation: See description below Status Affected: C Encoding: Description:
00 1100 dfff ffff
The contents of register 'f' are rotated
one bit to the right through the Carry
Flag. If 'd' is 0 the result is placed in
the W register. If 'd' is 1 the result is
placed back in register 'f'.
Register fC
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register
RRF REG1,0
Process
data
'f'
Write to
dest
Before Instruction
REG1 = 1110 0110 C = 0
After Instruction
REG1 = 1110 0110 W = 0111 0011 C = 0
1997 Microchip Technology Inc. DS30272A-page 81
PIC16C71X
SLEEP
Syntax: [
label
] SLEEP Operands: None Operation: 00h WDT,
0 WDT prescaler,
O,
1 T
0 PD Status Affected: TO, PD Encoding: Description:
00 0000 0110 0011
The power-down status bit, PD is
cleared. Time-out status bit, TO is
set. Watchdog Timer and its pres-
caler are cleared.
The processor is put into SLEEP
mode with the oscillator stopped.
See Section 8.8 for more details.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode NOP NOP Go to
Sleep
Example: SLEEP
SUBLW Subtract W from Literal
label
Syntax: [
] SUBLW k Operands: 0 k 255 Operation: k - (W) → (W) Status Affected: C, DC, Z Encoding: 11 110x kkkk kkkk Description:
The W register is subtracted (2’s comple­ment method) from the eight bit literal 'k'. The result is placed in the W register.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
literal 'k'
Process
data
Write to W
Example 1: SUBLW 0x02
Before Instruction
W = 1 C = ? Z = ?
After Instruction
W = 1 C = 1; result is positive Z = 0
Example 2: Before Instruction
W = 2 C = ? Z = ?
After Instruction
W = 0 C = 1; result is zero Z = 1
Example 3: Before Instruction
W = 3 C = ? Z = ?
After Instruction
W = 0xFF C = 0; result is nega­tive Z = 0
DS30272A-page 82 1997 Microchip Technology Inc.
PIC16C71X
SUBWF Subtract W from f
label
Syntax: [
] SUBWF f,d
Operands: 0 f 127
d [0,1] Operation: (f) - (W) → (dest) Status Affected: C, DC, Z Encoding: 00 0010 dfff ffff Description:
Subtract (2’s complement method) W reg-
ister from 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'.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register 'f'
Process
data
Write to
dest
Example 1: SUBWF REG1,1
Before Instruction
REG1 = 3 W = 2 C = ? Z = ?
After Instruction
REG1 = 1 W = 2 C = 1; result is positive Z = 0
Example 2: Before Instruction
REG1 = 2 W = 2 C = ? Z = ?
After Instruction
REG1 = 0 W = 2 C = 1; result is zero Z = 1
Example 3: Before Instruction
REG1 = 1 W = 2 C = ? Z = ?
After Instruction
REG1 = 0xFF W = 2 C = 0; result is negative Z = 0
SWAPF Swap Nibbles in f
label
Syntax: [
] SWAPF f,d
Operands: 0 f 127
d [0,1]
Operation: (f<3:0>) (dest<7:4>),
(f<7:4>) (dest<3:0>)
Status Affected: None
00
Encoding: Description:
The upper and lower nibbles of regis­ter 'f' are exchanged. If 'd' is 0 the result is placed in W register. If 'd' is 1 the result is placed in register 'f'.
1110 dfff ffff
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Example
Decode Read
register 'f'
SWAPF REG, 0
Process
data
Write to
dest
Before Instruction
REG1 = 0xA5
After Instruction
REG1 = 0xA5 W = 0x5A
TRIS Load TRIS Register
Syntax: [
label
] TRIS f
Operands: 5 f 7
Operation: (W) TRIS register f; Status Affected: None Encoding: Description:
00
0000 0110 0fff
The instruction is supported for code compatibility with the PIC16C5X prod­ucts. Since TRIS registers are read­able and writable, the user can directly address them.
Words: 1 Cycles: 1
Example
To maintain upward compatibility with future PIC16CXX products, do not use this instruction.
1997 Microchip Technology Inc. DS30272A-page 83
PIC16C71X
XORLW Exclusive OR Literal with W
Syntax: [
label
] XORLW k Operands: 0 k 255 Operation: (W) .XOR. k → (W) Status Affected: Z Encoding: 11 1010 kkkk kkkk Description:
The contents of the W register are XOR’ed with the eight bit literal 'k'. The result is placed in the W regis­ter.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
literal 'k'
Process
data
Write to
W
Example: XORLW 0xAF
Before Instruction
W = 0xB5
After Instruction
W = 0x1A
XORWF Exclusive OR W with f
label
Syntax: [
] XORWF f,d
Operands: 0 f 127
d [0,1] Operation: (W) .XOR. (f) → (dest) Status Affected: Z Encoding: Description:
00 0110 dfff ffff
Exclusive OR the contents of the W
register with 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'.
Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 Q3 Q4
Decode Read
register
Example XORWF
'f'
REG 1
Process
data
Write to
dest
Before Instruction
REG = 0xAF W = 0xB5
After Instruction
REG = 0x1A W = 0xB5
DS30272A-page 84 1997 Microchip Technology Inc.
PIC16C71X

10.0 DEVELOPMENT SUPPORT

10.1 Development Tools

The PICmicrο microcontrollers are supported with a full range of hardware and software dev elopment tools:
• PICMASTER/PICMASTER CE Real-Time In-Circuit Emulator
• ICEPIC Low-Cost PIC16C5X and PIC16CXXX In-Circuit Emulator
• PRO MATE
• PICSTART Programmer
• PICDEM-1 Low-Cost Demonstration Board
• PICDEM-2 Low-Cost Demonstration Board
• PICDEM-3 Low-Cost Demonstration Board
• MPASM Assembler
• MPLABSIM Software Simulator
• MPLAB-C (C Compiler)
• Fuzzy Logic Development System (
fuzzy
10.2 PICMASTER: High Performance
The PICMASTER Universal In-Circuit Emulator is intended to provide the product development engineer with a complete microcontroller design tool set for all microcontrollers in the PIC12CXXX, PIC14C000, PIC16C5X, PIC16CXXX and PIC17CXX families. PICMASTER is supplied with the MPLAB Integrated Development Environment (IDE), which allows editing, “make” and download, and source debugging from a single environment.
Interchangeable target probes allow the system to be easily reconfigured for emulation of different proces­sors. The universal architecture of the PICMASTER allows expansion to support all new Microchip micro­controllers.
The PICMASTER Emulator System has been designed as a real-time emulation system with advanced features that are generally found on more expensive development tools. The PC compatible 386 (and higher) machine platform and Microsoft Windows
3.x environment were chosen to best make these fea-
tures available to you, the end user. A CE compliant version of PICMASTER is availab le for
European Union (EU) countries.
II Universal Programmer
Plus Entry-Level Prototype
TECH−MP)
Universal In-Circuit Emulator with MPLAB IDE
10.3 ICEPIC: Low-Cost PIC16CXXX In-Circuit Emulator
ICEPIC is a low-cost in-circuit emulator solution for the Microchip PIC16C5X and PIC16CXXX families of 8-bit OTP microcontrollers.
ICEPIC is designed to operate on PC-compatible machines ranging from 286-AT based machines under Windows 3.x environment. ICEPIC features real time, non-intrusive emulation.
through Pentium

10.4 PRO MATE II: Universal Programmer

The PRO MATE II Universal Programmer is a full-fea­tured programmer capable of operating in stand-alone mode as well as PC-hosted mode.
The PRO MATE II has programmable V supplies which allows it to verify programmed memory at V
DD min and VDD max for maximum reliability. It has
an LCD display for displaying error messages, keys to enter commands and a modular detachable socket assembly to support various package types. In stand­alone mode the PRO MATE II can read, verify or pro­gram PIC12CXXX, PIC14C000, PIC16C5X, PIC16CXXX and PIC17CXX devices. It can also set configuration and code-protect bits in this mode.
DD and VPP
10.5 PICSTART Plus Entry Level Development System
The PICSTART programmer is an easy-to-use, low­cost prototype programmer. It connects to the PC via one of the COM (RS-232) ports. MPLAB Integrated Development Environment software makes using the programmer simple and efficient. PICSTART Plus is not recommended for production programming.
PICSTART Plus supports all PIC12CXXX, PIC14C000, PIC16C5X, PIC16CXXX and PIC17CXX devices with up to 40 pins. Larger pin count devices such as the PIC16C923 and PIC16C924 may be supported with an adapter socket.
1997 Microchip Technology Inc. DS30272A-page 85
PIC16C71X
10.6 PICDEM-1 Low-Cost PIC16/17 Demonstration Board
The PICDEM-1 is a simple board which demonstrates the capabilities of several of Microchip’s microcontrol­lers. The microcontrollers supported are: PIC16C5X (PIC16C54 to PIC16C58A), PIC16C61, PIC16C62X, PIC16C71, PIC16C8X, PIC17C42, PIC17C43 and PIC17C44. All necessary hardware and software is included to run basic demo programs. The users can program the sample microcontrollers provided with the PICDEM-1 board, on a PRO MATE II or PICSTART-Plus programmer, and easily test firm­ware. The user can also connect the PICDEM-1 board to the PICMASTER emulator and download the firmware to the emulator for testing. Additional pro­totype area is available for the user to build some addi­tional hardware and connect it to the microcontroller socket(s). Some of the features include an RS-232 interface, a potentiometer for simulated analog input, push-button switches and eight LEDs connected to PORTB.
10.7 PICDEM-2 Low-Cost PIC16CXX Demonstration Board
The PICDEM-2 is a simple demonstration board that supports the PIC16C62, PIC16C64, PIC16C65, PIC16C73 and PIC16C74 microcontrollers. All the necessary hardware and software is included to run the basic demonstration programs. The user can program the sample microcontrollers provided with the PICDEM-2 board, on a PRO MATE II pro­grammer or PICSTART-Plus, and easily test firmware. The PICMASTER emulator may also be used with the PICDEM-2 board to test firmware. Additional prototype area has been provided to the user for adding addi­tional hardware and connecting it to the microcontroller socket(s). Some of the f eatures include a RS-232 inter­face, push-button switches, a potentiometer for simu­lated analog input, a Serial EEPROM to demonstrate usage of the I tion to an LCD module and a keypad.
2
C bus and separate headers for connec-
10.8 PICDEM-3 Low-Cost PIC16CXXX Demonstration Board
The PICDEM-3 is a simple demonstration board that supports the PIC16C923 and PIC16C924 in the PLCC package. It will also support future 44-pin PLCC microcontrollers with a LCD Module. All the neces­sary hardware and software is included to run the basic demonstration programs. The user can pro­gram the sample microcontrollers provided with the PICDEM-3 board, on a PRO MATE II program­mer or PICSTART Plus with an adapter socket, and easily test firmware. The PICMASTER emulator may also be used with the PICDEM-3 board to test firm­ware. Additional prototype area has been provided to the user for adding hardware and connecting it to the microcontroller socket(s). Some of the f eatures include
an RS-232 interface, push-button switches, a potenti­ometer for simulated analog input, a thermistor and separate headers for connection to an external LCD module and a keypad. Also provided on the PICDEM-3 board is an LCD panel, with 4 commons and 12 seg­ments, that is capable of displaying time, temperature and day of the week. The PICDEM-3 provides an addi­tional RS-232 interface and Windows 3.1 software for showing the demultiplex ed LCD signals on a PC. A sim­ple serial interface allows the user to construct a hard­ware demultiplexer for the LCD signals.
10.9 MPLAB Integrated Development Environment Software
The MPLAB IDE Software brings an ease of software development previously unseen in the 8-bit microcon­troller market. MPLAB is a windows based application which contains:
• A full featured editor
• Three operating modes
- editor
- emulator
- simulator
• A project manager
• Customizable tool bar and key mapping
• A status bar with project information
• Extensive on-line help
MPLAB allows you to:
• Edit your source files (either assembly or ‘C’)
• One touch assemble (or compile) and download
to PIC16/17 tools (automatically updates all project information)
• Debug using:
- source files
- absolute listing file
• Transfer data dynamically via DDE (soon to be
replaced by OLE)
• Run up to four emulators on the same PC
The ability to use MPLAB with Microchip’s simulator allows a consistent platform and the ability to easily switch from the low cost simulator to the full featured emulator with minimal retraining due to development tools.

10.10 Assembler (MPASM)

The MPASM Universal Macro Assembler is a PC­hosted symbolic assembler. It suppor ts all microcon­troller series including the PIC12C5XX, PIC14000, PIC16C5X, PIC16CXXX, and PIC17CXX families.
MPASM offers full featured Macro capabilities, condi­tional assembly , and se ver al source and listing formats. It generates various object code formats to support Microchip's development tools as well as third party programmers.
MPASM allows full symbolic debugging from PICMASTER, Microchip’s Universal Emulator System.
DS30272A-page 86 1997 Microchip Technology Inc.
PIC16C71X
MPASM has the following features to assist in develop­ing software for specific use applications.
• Provides translation of Assembler source code to object code for all Microchip microcontrollers.
• Macro assembly capability.
• Produces all the files (Object, Listing, Symbol, and special) required for symbolic debug with Microchip’s emulator systems.
• Supports Hex (default), Decimal and Octal source and listing formats.
MPASM provides a rich directive language to suppor t programming of the PIC16/17. Directives are helpful in making the development of y our assemble source code shorter and more maintainable.

10.11 Software Simulator (MPLAB-SIM)

The MPLAB-SIM Software Simulator allows code development in a PC host environment. It allows the user to simulate the PIC16/17 series microcontrollers on an instruction level. On any given instruction, the user may examine or modify any of the data areas or provide external stimulus to any of the pins. The input/ output radix can be set by the user and the execution can be performed in; single step , ex ecute until break, or in a trace mode.
MPLAB-SIM fully supports symbolic debugging using MPLAB-C and MPASM. The Software Simulator offers the low cost flexibility to develop and debug code out­side of the laboratory environment making it an excel­lent multi-project software development tool.

10.12 C Compiler (MPLAB-C)

10.14 MP-DriveWay – Application Code
Generator
MP-DriveWay is an easy-to-use Windows-based Appli­cation Code Generator. With MP-DriveWay you can visually configure all the peripherals in a PIC16/17 device and, with a click of the mouse, generate all the initialization and many functional code modules in C language. The output is fully compatible with Micro­chip’s MPLAB-C C compiler. The code produced is highly modular and allows easy integration of your o wn code. MP-DriveWay is intelligent enough to maintain your code through subsequent code generation.
10.15 SEEVAL Evaluation and Programming System
The SEEVAL SEEPROM Designer’s Kit supports all Microchip 2-wire and 3-wire Serial EEPROMs. The kit includes everything necessary to read, write, erase or program special features of any Microchip SEEPROM product including Smart Serials and secure serials. The Total Endurance Disk is included to aid in trade­off analysis and reliability calculations. The total kit can significantly reduce time-to-market and result in an optimized system.
10.16 KEELOQ Evaluation and Programming Tools
KEELOQ evaluation and programming tools support Microchips HCS Secure Data Products. The HCS ev al­uation kit includes an LCD display to show changing codes, a decoder to decode transmissions, and a pro­gramming interface to program test transmitters.
The MPLAB-C Code Development System is a complete ‘C’ compiler and integrated development environment for Microchip’s PIC16/17 family of micro­controllers. The compiler provides powerful integration capabilities and ease of use not found with other compilers.
For easier source level debugging, the compiler pro­vides symbol information that is compatible with the MPLAB IDE memory display.
10.13 Fuzzy Logic Development System (
fuzzy
TECH-MP)
fuzzy
TECH-MP fuzzy logic development tool is avail­able in two versions - a low cost introductory version, MP Explorer, for designers to gain a comprehensive working knowledge of fuzzy logic system design; and a full-featured version, menting more complex systems.
Both versions include Microchip’s stration board for hands-on experience with fuzzy logic systems implementation.
fuzzy
TECH-MP, edition for imple-
fuzzy
LAB demon-
1997 Microchip Technology Inc. DS30272A-page 87
PIC16C71X
TABLE 10-1: DEVELOPMENT TOOLS FROM MICROCHIP
HCS200
HCS300
HCS301
24CXX
25CXX
93CXX
3Q97
Available
PIC12C5XX PIC14000 PIC16C5X PIC16CXXX PIC16C6X PIC16C7XX PIC16C8X PIC16C9XX PIC17C4X PIC17C75X
/
-MP
TECH
II
PICMASTER-CE
In-Circuit Emulator
PICMASTER
DS30272A-page 88 1997 Microchip Technology Inc.
ICEPIC Low-Cost
In-Circuit Emulator
MPLAB
Integrated
Development
Emulator Products
Environment
MPLAB C
fuzzy
Compiler
MP-DriveWay
Applications
Explorer/Edition
Fuzzy Logic
Dev. Tool
Code Generator
Software Tools
Total Endurance
Software Model
PICSTART
Lite Ultra Low-Cost
Dev. Kit
PICSTART
Plus Low-Cost
Universal Dev. Kit
PRO MATE
KEELOQ
Universal
Programmer
Programmer
Programmers
SEEVAL
Designers Kit
PICDEM-1
PICDEM-2
PICDEM-3
Demo Boards
KEELOQ
Evaluation Kit
PIC16C71X
Applicable Devices 710 71 711 715

11.0 ELECTRICAL CHARACTERISTICS FOR PIC16C710 AND PIC16C711

Absolute Maximum Ratings †
Ambient temperature under bias.................................................................................................................-55 to +125˚C
Storage temperature.............................................................................................................................. -65˚C to +150˚C
Voltage on any pin with respect to V Voltage on V Voltage on MCLR
DD with respect to VSS ........................................................................................................... -0.3 to +7.5V
with respect to VSS................................................................................................................0 to +14V
Voltage on RA4 with respect to Vss...................................................................................................................0 to +14V
Total power dissipation (Note 1)................................................................................................................................1.0W
Maximum current out of V Maximum current into V Input clamp current, I Output clamp current, I
SS pin ...........................................................................................................................300 mA
DD pin..............................................................................................................................250 mA
IK (VI < 0 or VI > VDD).....................................................................................................................± 20 mA
OK (VO < 0 or VO > VDD).............................................................................................................± 20 mA
Maximum output current sunk by any I/O pin..........................................................................................................25 mA
Maximum output current sourced by any I/O pin ....................................................................................................25 mA
Maximum current sunk by PORTA ........................................................................................................................200 mA
Maximum current sourced by PORTA...................................................................................................................200 mA
Maximum current sunk by PORTB........................................................................................................................200 mA
Maximum current sourced by PORTB...................................................................................................................200 mA
Note 1: Power dissipation is calculated as follows: Pdis = V
† NOTICE: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at those or an y other conditions abo v e those indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability.
SS (except VDD, MCLR, and RA4)..........................................-0.3V to (VDD + 0.3V)
DD x {IDD - IOH} + {(VDD - VOH) x IOH} + (VOl x IOL)
TABLE 11-1: CROSS REFERENCE OF DEVICE SPECS FOR OSCILLATOR CONFIGURATIONS
AND FREQUENCIES OF OPERATION (COMMERCIAL DEVICES)
OSC
RC
XT
HS
LP
PIC16C710-04 PIC16C711-04
VDD: 4.0V to 6.0V IDD: 5 mA max. at 5.5V IPD: 21 µA max. at 4V Freq:4 MHz max.
VDD: 4.0V to 6.0V IDD: 5 mA max. at 5.5V IPD: 21 µA max. at 4V Freq: 4 MHz max.
VDD: 4.5V to 5.5V VDD: 4.5V to 5.5V VDD:4.5V to 5.5V IDD: 13.5 mA typ. at
5.5V IPD: 1.5 µA typ. at 4.5V IPD: 1.5 µA typ. at 4.5V IPD: 1.5 µA typ. at 4.5V IPD: 1.5 µA typ. at 4.5V Freq: 4 MHz max. Freq: 10 MHz max. Freq:20 MHz max. Freq: 10 MHz max. VDD: 4.0V to 6.0V
IDD: 52.5 µA typ. at
32 kHz, 4.0V IPD: 0.9 µA typ. at 4.0V Freq: 200 kHz max.
PIC16C710-10 PIC16C711-10
VDD: 4.5V to 5.5V IDD: 2.7 mA typ. at 5.5V IPD: 1.5 µA typ. at 4V Freq: 4 MHz max.
VDD: 4.5V to 5.5V IDD: 2.7 mA typ. at 5.5V IPD: 1.5 µA typ. at 4V Freq: 4 MHz max.
IDD: 30 mA max. at
5.5V
Not recommended for
use in LP mode
PIC16C710-20 PIC16C711-20
VDD: 4.5V to 5.5V IDD: 2.7 mA typ. at 5.5V IPD: 1.5 µA typ. at 4V Freq: 4 MHz max.
VDD: 4.5V to 5.5V IDD: 2.7 mA typ. at 5.5V IPD: 1.5 µA typ. at 4V Freq: 4 MHz max.
IDD: 30 mA max. at
5.5V
Not recommended for
use in LP mode
PIC16LC710-04 PIC16LC711-04
VDD: 2.5V to 6.0V IDD: 3.8 mA typ. at 3.0V IPD: 5.0 µA typ. at 3V Freq: 4 MHz max.
VDD: 2.5V to 6.0V IDD: 3.8 mA typ. at 3.0V IPD: 5.0 µA typ. at 3V Freq: 4 MHz max.
Not recommended for
use in HS mode
VDD: 2.5V to 6.0V IDD: 48 µA max. at
32 kHz, 3.0V IPD: 5.0 µA max. at 3.0V Freq: 200 kHz max.
PIC16C710/JW PIC16C711/JW
VDD: 4.0V to 6.0V IDD: 5 mA max. at 5.5V IPD: 21 µA max. at 4V Freq:4 MHz max.
VDD: 4.0V to 6.0V IDD: 5 mA max. at 5.5V IPD: 21 µA max. at 4V Freq: 4 MHz max.
VDD: 4.5V to 5.5V IDD: 30 mA max. at
5.5V
VDD: 2.5V to 6.0V IDD: 48 µA max. at
32 kHz, 3.0V
IPD: 5.0 µA max. at
3.0V
Freq: 200 kHz max.
1997 Microchip Technology Inc. DS30272A-page 89
PIC16C71X
Applicable Devices 710 71 711 715
11.1 DC Characteristics: PIC16C710-04 (Commercial, Industrial, Extended) PIC16C711-04 (Commercial, Industrial, Extended) PIC16C710-10 (Commercial, Industrial, Extended) PIC16C711-10 (Commercial, Industrial, Extended) PIC16C710-20 (Commercial, Industrial, Extended) PIC16C711-20 (Commercial, Industrial, Extended)
Standard Operating Conditions (unless otherwise stated)
DC CHARACTERISTICS
Param.
Characteristic Sym Min Typ† Max Units Conditions
No.
D001
Supply Voltage V
D001A D002* RAM Data Retention
Voltage (Note 1)
D003 V
DD start voltage to
ensure internal Power­on Reset signal
D004* V
DD rise rate to ensure
internal Power-on Reset signal
D005 Brown-out Reset Voltage B
D010
Supply Current (Note 2) I
Operating temperature 0˚C T
-40˚C T
-40˚C T
DD 4.0
4.5--
DR - 1.5 - V
V
6.0
5.5VV
XT, RC and LP osc configuration HS osc configuration
VPOR - VSS - V See section on Power-on Reset for details
SVDD 0.05 - - V/ms See section on Power-on Reset for details
VDD 3.7 4.0 4.3 V BODEN configuration bit is enabled
3.7 4.0 4.4 V Extended Range Only
DD -
2.7
XT, RC osc configuration F
OSC = 4 MHz, VDD = 5.5V (Note 4)
A +70˚C (commercial) A +85˚C (industrial) A +125˚C (extended)
D013
D015 Brown-out Reset Current
-
13.5530mAmA
BOR - 300* 500 µA BOR enabled VDD = 5.0V
I
HS osc configuration F
OSC = 20 MHz, VDD = 5.5V
(Note 5)
D020 D021
Power-down Current
(Note 3) D021A D021B
D023 Brown-out Reset Current
I
PD -
BOR - 300* 500 µA BOR enabled VDD = 5.0V
I
10.5 21
1.5
­24
1.5
­30
1.5
-
DD = 4.0V, WDT enabled, -40°C to +85°C
µA
V
DD = 4.0V, WDT disabled, -0°C to +70°C
µA
V
DD = 4.0V, WDT disabled, -40°C to +85°C
µA
V
DD = 4.0V, WDT disabled, -40°C to +125°C
V
µA
42
(Note 5)
* These parameters are characterized but not tested. † Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: This is the limit to which V
DD can be lowered without losing RAM data.
2: The supply current is mainly a function of the operating voltage and frequency. Other f actors such as I/O pin
loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption. The test conditions for all I OSC1 = external square wave, from rail to rail; all I/O pins tristated, pulled to V MCLR
= VDD; WDT enabled/disabled as specified.
DD measurements in active operation mode are:
DD
3: The power-down current in SLEEP mode does not depend on the oscillator type. Power-down current is
measured with the part in SLEEP mode, with all I/O pins in hi-impedance state and tied to V
DD and VSS.
4: For RC osc configuration, current through Rext is not included. The current through the resistor can be esti-
mated by the formula Ir = V
DD/2Rext (mA) with Rext in kOhm.
5: The current is the additional current consumed when this peripheral is enabled. This current should be
added to the base I
DD or IPD measurement.
DS30272A-page 90 1997 Microchip Technology Inc.
PIC16C71X
Applicable Devices 710 71 711 715
11.2 DC Characteristics: PIC16LC710-04 (Commercial, Industrial, Extended) PIC16LC711-04 (Commercial, Industrial, Extended)
Standard Operating Conditions (unless otherwise stated)
DC CHARACTERISTICS
Param
Characteristic Sym Min Typ† Max Units Conditions
No.
D001 Supply Voltage
Commercial/Industrial Extended
D002* RAM Data Retention
Voltage (Note 1)
D003 V
DD start voltage to
ensure internal Power­on Reset signal
D004* VDD rise rate to ensure
internal Power-on Reset signal
D005 Brown-out Reset
Voltage
D010
Supply Current (Note 2)
Operating temperature 0˚C T
-40˚C T
-40˚C T
DD
V VDD
V
2.5
3.0
DR - 1.5 - V
--6.0
6.0VV
LP, XT, RC osc configuration (DC - 4 MHz) LP, XT, RC osc configuration (DC - 4 MHz)
VPOR - VSS - V See section on Power-on Reset for details
S
VDD 0.05 - - V/ms See section on Power-on Reset for details
B
VDD 3.7 4.0 4.3 V BODEN configuration bit is enabled
DD
I
-
2.0
3.8
mA
XT, RC osc configuration F
A +70˚C (commercial) A +85˚C (industrial) A +125˚C (extended)
OSC = 4 MHz, VDD = 3.0V (Note 4)
D010A D015
Brown-out Reset
IBOR
-
22.5
-
300*
48
500
LP osc configuration
µA
F
OSC = 32 kHz, VDD = 3.0V, WDT disabled
BOR enabled V
µA
DD = 5.0V
Current (Note 5)
D020 D021 D021A D021B D023
Power-down Current (Note 3)
Brown-out Reset
I
PD
IBOR
7.5
-
0.9
-
0.9
-
0.9
­300*
-
5 5
10
500
DD = 3.0V, WDT enabled, -40°C to +85°C
µA
V
DD = 3.0V, WDT disabled, 0°C to +70°C
µA
V
DD = 3.0V, WDT disabled, -40°C to +85°C
µA
V
DD = 3.0V, WDT disabled, -40°C to +125°C
µA
BOR enabled V
DD = 5.0V
V
µA
30
Current (Note 5)
* These parameters are characterized but not tested. † Data in "Typ" column is at 5V , 25˚C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: This is the limit to which V
DD can be lowered without losing RAM data.
2: The supply current is mainly a function of the operating voltage and frequency. Other factors such as I/O pin
loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption. The test conditions for all I OSC1 = external square wave, from rail to rail; all I/O pins tristated, pulled to V MCLR
= VDD; WDT enabled/disabled as specified.
DD measurements in active operation mode are:
DD
3: The power-down current in SLEEP mode does not depend on the oscillator type. Power-down current is
measured with the part in SLEEP mode, with all I/O pins in hi-impedance state and tied to V
DD and VSS.
4: For RC osc configuration, current through Rext is not included. The current through the resistor can be esti-
mated by the formula Ir = V
DD/2Rext (mA) with Rext in kOhm.
5: The current is the additional current consumed when this peripheral is enabled. This current should be
added to the base I
DD or IPD measurement.
1997 Microchip Technology Inc. DS30272A-page 91
PIC16C71X
Applicable Devices 710 71 711 715
11.3 DC Characteristics: PIC16C710-04 (Commercial, Industrial, Extended) PIC16C711-04 (Commercial, Industrial, Extended) PIC16C710-10 (Commercial, Industrial, Extended) PIC16C711-10 (Commercial, Industrial, Extended) PIC16C710-20 (Commercial, Industrial, Extended) PIC16C711-20 (Commercial, Industrial, Extended) PIC16LC710-04 (Commercial, Industrial, Extended) PIC16LC711-04 (Commercial, Industrial, Extended)
Standard Operating Conditions (unless otherwise stated)
Operating temperature 0˚C T
DC CHARACTERISTICS
Operating voltage V
-40˚C T
-40˚C T
DD range as described in DC spec Section 11.1 and
Section 11.2.
Param
Characteristic Sym Min T yp†Max Units Conditions
No.
Input Low Voltage
I/O ports V
IL
D030 with TTL buffer VSS - 0.15VDD V For entire VDD range D030A V D031 with Schmitt Trigger buffer V D032 MCLR
, OSC1
SS - 0.8V V 4.5 VDD 5.5V SS - 0.2VDD V
VSS - 0.2VDD V
(in RC mode)
D033 OSC1 (in XT, HS and LP) V
SS - 0.3VDD V Note1
Input High Voltage
I/O ports V D040 with TTL buffer 2.0 - V D040A 0.25V
IH -
DD
DD V 4.5 VDD 5.5V DD V For entire VDD range
- V
+ 0.8V D041 with Schmitt Trigger buffer 0.8V D042 MCLR
, RB0/INT 0.8VDD - VDD V D042A OSC1 (XT, HS and LP) 0.7V D043 OSC1 (in RC mode) 0.9V D070 PORTB weak pull-up current I
PURB 50 250 400 µA VDD = 5V, VPIN = VSS
DD - VDD V For entire VDD range
DD - VDD V Note1 DD - VDD V
Input Leakage Current (Notes 2, 3)
D060 I/O ports I
D061 MCLR
, RA4/T0CKI - - ±5 µA Vss VPIN VDD
IL - - ±1 µA Vss VPIN VDD, Pin at hi-
D063 OSC1 - - ±5 µA Vss VPIN ≤ VDD, XT, HS and LP
* These parameters are characterized but not tested. † Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended that the
PIC16C7X be driven with external clock in RC mode.
2: The leakage current on the MCLR
pin is strongly dependent on the applied voltage level. The specified levels
represent normal operating conditions. Higher leakage current may be measured at different input voltages.
3: Negative current is defined as current sourced by the pin.
A +70˚C (commercial) A +85˚C (industrial) A +125˚C (extended)
impedance
osc configuration
DS30272A-page 92 1997 Microchip Technology Inc.
PIC16C71X
Applicable Devices 710 71 711 715
Standard Operating Conditions (unless otherwise stated)
Operating temperature 0˚C T
DC CHARACTERISTICS
Operating voltage V
-40˚C T
-40˚C T
DD range as described in DC spec Section 11.1 and
Section 11.2.
Param
Characteristic Sym Min T yp†Max Units Conditions
No.
Output Low Voltage
D080 I/O ports V
OL - - 0.6 V IOL = 8.5 mA, VDD = 4.5V,
D080A - - 0.6 V I
D083 OSC2/CLKOUT (RC osc config) - - 0.6 V I
D083A - - 0.6 V I
Output High Voltage
D090 I/O ports (Note 3) V
D090A V
D092 OSC2/CLKOUT (RC osc config) V
D092A V
D130* Open-Drain High Voltage V
OH VDD - 0.7 - - V IOH = -3.0 mA, VDD = 4.5V,
DD - 0.7 - - V IOH = -2.5 mA, VDD = 4.5V,
DD - 0.7 - - V IOH = -1.3 mA, VDD = 4.5V,
DD - 0.7 - - V IOH = -1.0 mA, VDD = 4.5V,
OD - - 14 V RA4 pin
Capacitive Loading Specs on Output Pins
D100 OSC2 pin C
D101 All I/O pins and OSC2 (in RC mode) C
OSC2 - - 15 pF In XT, HS and LP modes when
IO - - 50 pF
* These parameters are characterized but not tested. † Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only
and are not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended that the
PIC16C7X be driven with external clock in RC mode.
2: The leakage current on the MCLR
pin is strongly dependent on the applied voltage level. The specified levels
represent normal operating conditions. Higher leakage current may be measured at different input voltages.
3: Negative current is defined as current sourced by the pin.
A +70˚C (commercial) A +85˚C (industrial) A +125˚C (extended)
-40°C to +85°C
OL = 7.0 mA, VDD = 4.5V,
-40°C to +125°C
OL = 1.6 mA, VDD = 4.5V,
-40°C to +85°C
OL = 1.2 mA, VDD = 4.5V,
-40°C to +125°C
-40°C to +85°C
-40°C to +125°C
-40°C to +85°C
-40°C to +125°C
external clock is used to drive OSC1.
1997 Microchip Technology Inc. DS30272A-page 93
PIC16C71X
Applicable Devices 710 71 711 715

11.4 Timing Parameter Symbology

The timing parameter symbols have been created following one of the following formats:
1. TppS2ppS
2. TppS
T
F Frequency T Time Lowercase letters (pp) and their meanings:
pp
cc CCP1 osc OSC1 ck CLKOUT rd RD cs CS rw RD or WR di SDI sc SCK do SDO ss SS dt Data in t0 T0CKI io I/O port t1 T1CKI mc MCLR Uppercase letters and their meanings:
S
F Fall P Period H High R Rise I Invalid (Hi-impedance) V Valid L Low Z Hi-impedance
wr WR
FIGURE 11-1: LOAD CONDITIONS
Load condition 1
VDD/2
Pin Pin
V
RL = 464
L = 50 pF for all pins except OSC2
C
15 pF for OSC2 output
SS
RL
Load condition 2
L
C
CL
VSS
DS30272A-page 94 1997 Microchip Technology Inc.
11.5 Timing Diagrams and Specifications FIGURE 11-2: EXTERNAL CLOCK TIMING
Q4 Q1 Q2 Q3 Q4 Q1
OSC1
1
3
2
CLKOUT
TABLE 11-2: EXTERNAL CLOCK TIMING REQUIREMENTS
PIC16C71X
Applicable Devices 710 71 711 715
4
3
4
Parameter
No.
1 Tosc External CLKIN Period
2 T 3 TosL,
4 TosR,
Note 1: Instruction cycle period (TCY) equals four times the input oscillator time-base period. All specified values are based on
Sym Characteristic Min Typ† Max Units Conditions
Fosc External CLKIN Frequency
(Note 1)
Oscillator Frequency (Note 1)
(Note 1)
Oscillator Period (Note 1)
CY Instruction Cycle Time (Note 1) 200 DC ns TCY = 4/FOSC
External Clock in (OSC1) High
TosH
or Low Time
External Clock in (OSC1) Rise
TosF
or Fall Time
† Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
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/CLKIN pin. When an external clock input is used, the "Max." cycle time limit is "DC" (no clock) for all devices. OSC2 is disconnected (has no loading) for the PIC16C710/711.
DC 4 MHz XT osc mode DC 4 MHz HS osc mode (-04) DC 10 MHz HS osc mode (-10) DC 20 MHz HS osc mode (-20) DC 200 kHz LP osc mode DC 4 MHz RC osc mode
0.1 4 MHz XT osc mode 4
5
— 250 ns XT osc mode 250 ns HS osc mode (-04) 100 ns HS osc mode (-10)
50 ns HS osc mode (-20)
5 µs LP osc mode 250 ns RC osc mode 250 10,000 ns XT osc mode 250 250 ns HS osc mode (-04) 10050—
5 µs LP osc mode
50 ns XT oscillator
2.5 µs LP oscillator
10 ns HS oscillator — 25 ns XT oscillator — 50 ns LP oscillator — 15 ns HS oscillator
20
200
250 250
MHz
HS osc mode
kHz
LP osc mode
nsnsHS osc mode (-10)
HS osc mode (-20)
1997 Microchip Technology Inc. DS30272A-page 95
PIC16C71X
Applicable Devices 710 71 711 715
FIGURE 11-3: CLKOUT AND I/O TIMING
OSC1
CLKOUT
I/O Pin (input)
I/O Pin (output)
Q4
10
13
old value
Note: Refer to Figure 11-1 for load conditions.
Q1
14
17
20, 21
19
18
Q2 Q3
11
12
16
15
new value
TABLE 11-3: CLKOUT AND I/O TIMING REQUIREMENTS
Parameter
No.
10* TosH2ckL OSC1 to CLKOUT 15 30 ns Note 1 11* TosH2ckH OSC1 to CLKOUT 15 30 ns Note 1 12* TckR CLKOUT rise time 5 15 ns Note 1 13* TckF CLKOUT fall time 5 15 ns Note 1 14* TckL2ioV CLKOUT to Port out valid 0.5TCY + 20 ns Note 1 15* TioV2ckH Port in valid before CLKOUT 0.25TCY + 25 ns Note 1 16* TckH2ioI Port in hold after CLKOUT 0 ns Note 1 17* TosH2ioV OSC1 (Q1 cycle) to
18* TosH2ioI OSC1 (Q2 cycle) to
19* TioV2osH Port input valid to OSC1(I/O in setup time) TBD ns 20* TioR Port output rise time PIC16C710/711 10 25 ns
21* TioF Port output fall time PIC16C710/711 10 25 ns
22††* Tinp INT pin high or low time 20 ns 23††* Trbp RB7:RB4 change INT high or low time 20 ns
Note 1: Measurements are taken in RC Mode where CLKOUT output is 4 x T
Sym Characteristic Min Typ† Max Units Conditions
80 - 100 ns
Port out valid
TBD ns
Port input invalid (I/O in hold time)
PIC16LC710/711 60 ns
PIC16LC710/711 60 ns
* These parameters are characterized but not tested. † Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
†† These parameters are asynchronous events not related to any internal clock edges.
OSC.
DS30272A-page 96 1997 Microchip Technology Inc.
PIC16C71X
Applicable Devices 710 71 711 715
FIGURE 11-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP
TIMER TIMING
VDD
MCLR
Internal
POR
PWRT
Time-out
OSC
Time-out
Internal
RESET
Watchdog
Timer
RESET
I/O Pins
Note: Refer to Figure 11-1 for load conditions.
33
32
FIGURE 11-5: BROWN-OUT RESET TIMING
34
30
31
34
VDD
BVDD
35
TABLE 11-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER,
AND BROWN-OUT RESET REQUIREMENTS
Parameter
No.
30 TmcL MCLR Pulse Width (low) 1 µs VDD = 5V, -40˚C to +125˚C 31 Twdt Watchdog Timer Time-out Period
32 Tost Oscillation Start-up Timer Period 1024TOSC TOSC = OSC1 period 33 Tpwrt Power up Timer Period 28* 72 132* ms VDD = 5V, -40˚C to +125˚C 34 TIOZ I/O Hi-impedance from MCLR Low
35 TBOR Brown-out Reset pulse width 100 µs 3.8V VDD 4.2V
* These parameters are characterized but not tested. † Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
Sym Characteristic Min Typ† Max Units Conditions
7* 18 33* ms VDD = 5V, -40˚C to +125˚C
(No Prescaler)
1.1 µs
or Watchdog Timer Reset
tested.
1997 Microchip Technology Inc. DS30272A-page 97
PIC16C71X
Applicable Devices 710 71 711 715
FIGURE 11-6: TIMER0 EXTERNAL CLOCK TIMINGS
RA4/T0CKI
40
41
42
TMR0
Note: Refer to Figure 11-1 for load conditions.
TABLE 11-5: TIMER0 EXTERNAL CLOCK REQUIREMENTS
Param
No.
40
41 Tt0L T0CKI Low Pulse Width No Prescaler 0.5TCY + 20* ns
42 Tt0P T0CKI Period Greater of:
48 Tcke2tmrI Delay from external clock edge to timer increment 2Tosc — 7Tosc
Sym Characteristic Min Typ† Max Units Conditions
Tt0H T0CKI High Pulse Width No Prescaler 0.5TCY + 20* ns Must also meet
With Prescaler 10* ns
With Prescaler 10* ns
ns N = prescale value 20 ns or TCY + 40* N
* These parameters are characterized but not tested. † Data in "Typ" column is at 5V, 25˚C unless otherwise stated. These parameters are for design guidance only and are not
tested.
parameter 42
Must also meet parameter 42
(2, 4,..., 256)
DS30272A-page 98 1997 Microchip Technology Inc.
TABLE 11-6: A/D CONVERTER CHARACTERISTICS:
PIC16C710/711-04 (COMMERCIAL, INDUSTRIAL, EXTENDED) PIC16C710/711-10 (COMMERCIAL, INDUSTRIAL, EXTENDED) PIC16C710/711-20 (COMMERCIAL, INDUSTRIAL, EXTENDED) PIC16LC710/711-04 (COMMERCIAL, INDUSTRIAL, EXTENDED)
PIC16C71X
Applicable Devices 710 71 711 715
Param
Note 1: When A/D is off, it will not consume any current other than minor leakage current.
Sym Characteristic Min Typ† Max Units Conditions
No.
A01 NR Resolution 8-bits bit VREF = VDD, VSS AIN VREF A02 EABS Absolute error
A03 EIL Integral linearity error — A04 EDL Differential linearity error — A05 EFS Full scale error — A06 EOFF Offset error — A10 Monotonicity guaranteed VSS VAIN VREF
A20 VREF Reference voltage 2.5V VDD + 0.3 V A25 VAIN Analog input voltage VSS - 0.3 VREF + 0.3 V A30 ZAIN Recommended impedance of
analog voltage source
A40 IAD A/D conversion current (VDD) 180 µA Average current consumption
A50 IREF VREF input current (Note 2) 10
* These parameters are characterized but not tested. † Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only and are not
tested.
The power-down current spec includes any such leakage from the A/D module.
2: VREF current is from RA3 pin or VDD pin, whichever is selected as reference input.
10.0 k
< ± 1 LSb < ± 1 LSb < ± 1 LSb < ± 1 LSb < ± 1 LSb
1000
10
VREF = VDD, VSS AIN VREF VREF = VDD, VSS AIN VREF VREF = VDD, VSS AIN VREF VREF = VDD, VSS AIN VREF VREF = VDD, VSS AIN VREF
when A/D is on. (Note 1)
µAµADuring VAIN acquisition.
Based on differential of VHOLD to VAIN. To charge CHOLD see Section 7.1. During A/D Conversion cycle
1997 Microchip Technology Inc. DS30272A-page 99
PIC16C71X
Applicable Devices 710 71 711 715
FIGURE 11-7: A/D CONVERSION TIMING
BSF ADCON0, GO
Q4
A/D CLK
A/D DATA
ADRES
ADIF
GO
SAMPLE
132
(1)
OSC/2)
(T
7 6 5 4 3 2 1 0
OLD_DATA
SAMPLING STOPPED
131
130
1 Tcy
NEW_DATA
DONE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
TABLE 11-7: A/D CONVERSION REQUIREMENTS
Param
Sym Characteristic Min Typ† Max Units Conditions
No.
130 TAD A/D clock period PIC16C710/711 1.6 µs TOSC based, VREF 3.0V
PIC16LC710/711 2.0 µs TOSC based, VREF full range PIC16C710/711 2.0* 4.0 6.0 µs A/D RC mode PIC16LC710/711 3.0* 6.0 9.0 µs A/D RC mode
131 TCNV Conversion time
9.5 TAD
(not including S/H time). (Note 1)
132 TACQ Acquisition time Note 25*20
µs
µs The minimum time is the amplifier
settling time. This may be used if the "new" input voltage has not changed by more than 1 LSb (i.e., 19.5 mV @
5.12V) from the last sampled voltage (as stated on CHOLD).
134 TGO Q4 to AD clock start TOSC/2§ 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.
135 TSWC Switching from convert sample time 1.5§ TAD
* These parameters are characterized but not tested. † Data in “Typ” column is at 5V, 25°C unless otherwise stated. These parameters are for design guidance only and are not
tested.
§ This specification ensured by design.
Note 1: ADRES register may be read on the following TCY cycle.
2: See Section 7.1 for min conditions.
DS30272A-page 100 1997 Microchip Technology Inc.
Loading...