• 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 Features710 71 711 715
Program Memory (EPROM)
512 1K1K2K
x 14
Data Memory (Bytes) x 8363668 128
I/O Pins13131313
Timer Modules1111
A/D Channels4444
In-Circuit Serial Programming Yes Yes Yes Yes
Brown-out ResetYes—Yes Yes
Interrupt Sources4444
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
3
4
5
6
7
8
9
• 1
2
3
4
5
6
7
8
9
10
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
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
Index .................................................................................................................................................................................................. 163
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.0GENERAL 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 family 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 oscillator 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 lockup.
A UV erasable CERDIP packaged version is ideal for
code development while the cost-effective One-TimeProgrammable (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 (transmitter 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, capture and compare, PWM functions and coprocessor
applications).
1.1F
Users familiar with the PIC16C5X microcontroller family 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 family of devices (Appendix B).
1.2De
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 PIC16C715PIC16C72 PIC16CR72
18-pin DIP,
SOIC
Clock
Memory
Peripherals
Features
PIC16C710
Maximum Frequency
202020202020
of Operation (MHz)
EPROM Program Memory
5121K1K2K2K—
(x14 words)
ROM Program Memory
—————2K
(14K words)
Data Memory (bytes)363668128128128
Timer Module(s)TMR0TMR0TMR0TMR0TMR0,
Capture/Compare/PWM
————11
Module(s)
Serial Port(s)
2
(SPI/I
C, USART)
————SPI/I
Parallel Slave Port——————
A/D Converter (8-bit) Channels 444455
Interrupt Sources444488
I/O Pins131313132222
Voltage Range (Volts)2.5-6.03.0-6.02.5-6.02.5-5.52.5-6.03.0-5.5
In-Circuit Serial Programming YesYesYesYesYesYes
Brown-out ResetYes—YesYesYesYes
Packages18-pin DIP,
SOIC;
20-pin SSOP
18-pin DIP,
SOIC;
20-pin SSOP
18-pin DIP,
SOIC;
20-pin SSOP
TMR1,
TMR2
2
CSPI/I
28-pin SDIP,
SOIC, SSOP
TMR0,
TMR1,
TMR2
2
C
28-pin SDIP,
SOIC, SSOP
(1)
PIC16C74APIC16C76PIC16C77
Clock
Memory
Maximum Frequency
of Operation (MHz)
EPROM Program Memory
(x14 words)
PIC16C73A
20202020
4K4K8K8K
Data Memory (bytes)192192376376
Peripherals
Timer Module(s)TMR0,
TMR1,
TMR2
Capture/Compare/PWM
2222
Module(s)
Serial Port(s)
2
(SPI/I
C, USART)
SPI/I
2
C, USARTSPI/I
TMR0,
TMR1,
TMR2
2
C, USARTSPI/I
TMR0,
TMR1,
TMR2
2
C, USARTSPI/I
TMR0,
TMR1,
TMR2
2
C, USART
Parallel Slave Port—Yes—Yes
A/D Converter (8-bit) Channels 5858
Interrupt Sources11121112
I/O Pins22332233
Voltage Range (Volts)2.5-6.02.5-6.02.5-6.02.5-6.0
Features
In-Circuit Serial Programming YesYesYesYes
Brown-out ResetYesYesYesYes
Packages28-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 capability . 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.0PIC16C71X 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 Identification 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.1UV 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.3Quic
k-Turnaround-Production (QTP)
Devices
Microchip offers a QTP Programming Service for factory 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 stabilized. 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 production shipments are available. Please contact your local
Microchip Technology sales office for more details.
2.4Serializ
Production (SQTP
Microchip offers a unique programming service where
a few user-defined locations in each device are programmed with different serial numbers. The serial numbers 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.2One-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, permit 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.0ARCHITECTURAL OVERVIEW
The high performance of the PIC16CXX family can be
attributed to a number of architectural features commonly found in RISC microprocessors. To begin with,
the PIC16CXX uses a Harvard architecture, in which,
program and data are accessed from separate memories using separate buses. This improves bandwidth
over traditional v on Neumann architecture in which program 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 twostage pipeline overlaps fetch and execution of instructions (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
PIC16C710512 x 1436 x 8
PIC16C711K x 1436 x 8
PIC16C7111K x 1468 x 8
PIC16C7152K x 14128 x 8
The PIC16CXX can directly or indirectly address its
register files or data memory. All special function registers, including the program counter, are mapped in the
data memory. The PIC16CXX has an orthogonal (symmetrical) 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, subtraction, shift and logical operations. Unless otherwise
mentioned, arithmetic operations are two's complement 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 constant. 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
DeviceProgram 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/CLKIN161816I
OSC2/CLKOUT 151715O—Oscillator crystal output. Connects to crystal or resonator in crystal
MCLR/V
PP
444I/PSTMaster clear (reset) input or programming voltage input. This pin is
RA0/AN0171917I/OTTLRA0 can also be analog input0
RA1/AN1182018I/OTTLRA1 can also be analog input1
RA2/AN2111I/OTTLRA2 can also be analog input2
RA3/AN3/V
REF
222I/OTTLRA3 can also be analog input3 or analog reference voltage
RA4/T0CKI333I/OSTRA4 can also be the cloc k input to the Timer0 module . Output is
RB0/INT676I/OTTL/ST
RB1787I/OTTL
RB2898I/OTTL
RB39109I/OTTL
RB4101110I/OTTLInterrupt on change pin.
RB5111211I/OTTLInterrupt on change pin.
RB6121312I/OTTL/ST
RB7131413I/OTTL/ST
SS
V
DD
V
54, 65P—Ground reference for logic and I/O pins.
1415, 1614P—Positive supply for logic and I/O pins.
Legend: I = inputO = outputI/O = input/outputP = power
Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.
2: This buffer is a Schmitt Trigger input when used in serial programming mode.
3: This buffer is a Schmitt Trigger input when configured in RC oscillator mode and a CMOS input otherwise.
4: The PIC16C71 is not available in SSOP package.
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 programmed 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.1Cloc
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 program counter (PC) is incremented every Q1, the
instruction is fetched from the program memory and
latched into the instruction register in Q4. The instruction 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
Q2Q3Q4
OSC1
Q1
Q2
Q3
Q4
PC
OSC2/CLKOUT
(RC mode)
Q1
PCPC+1PC+2
Fetch INST (PC)
Execute INST (PC-1)Fetch INST (PC+1)
Q1
3.2Instruction 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).
Q2Q3Q4
Execute INST (PC)Fetch INST (PC+2)
Q2Q3Q4
Q1
Execute INST (PC+1)
Internal
phase
clock
EXAMPLE 3-1:INSTRUCTION PIPELINE FLOW
Tcy0Tcy1Tcy2Tcy3Tcy4Tcy5
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 1Execute 1
Fetch 2Execute 2
Fetch 3Execute 3
Fetch 4Flush
Fetch SUB_1 Execute SUB_1
1997 Microchip Technology Inc.
PIC16C71X
4.0MEMORY ORGANIZATION
4.1Pr
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:
PIC16C710512 x 140000h-01FFh
PIC16C711K x 140000h-03FFh
PIC16C7111K x 140000h-03FFh
PIC16C7152K x 140000h-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.2Data 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 Registers 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.1GENERAL PURPOSE REGISTER FILE
The register file can be accessed either directly , or indi-
rectly through the File Select Register FSR
(Section 4.5).
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 features are described in the section of that peripheral
feature.
TABLE 4-1:PIC16C710/71/711 SPECIAL FUNCTION REGISTER SUMMARY
———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
INTEDGT0CST0SEPSAPS2PS1PS01111 1111 1111 1111
RP1
RP0TOPDZDCC0001 1xxx 000q quuu
(5)
RP0TOPDZDCC0001 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
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)
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.1STATUS REGISTER
Applicable Devices710 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 subtraction. See the SUBLW and SUBWF
instructions for examples.
FIGURE 4-7:STATUS REGISTER (ADDRESS 03h, 83h)
R/W-0R/W-0R/W-0R-1R-1R/W-xR/W-xR/W-x
IRPRP1RP0TOPDZDCCR = Readable bit
bit7bit0
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.2OPTION REGISTER
Applicable Devices710 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-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1
RBPUINTEDGT0CST0SEPSAPS2PS1PS0R = Readable bit
bit7bit0
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
The INTCON Register is a readable and writable register which contains various enable and flag bits for the
TMR0 register overflow, RB Port change and 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-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-x
GIEADIET0IEINTERBIET0IFINTFRBIFR = Readable bit
bit7bit0
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 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.4PIE1 REGISTER
Applicable Devices710 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-0R/W-0U-0U-0U-0U-0U-0U-0
—ADIE——————R = Readable bit
bit7bit0
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.5PIR1 REGISTER
Applicable Devices710 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 software should ensure the appropriate interrupt flag bits are clear prior to enabling an
interrupt.
FIGURE 4-11: PIR1 REGISTER (ADDRESS 0Ch)
U-0R/W-0U-0U-0U-0U-0U-0U-0
—ADIF——————R = Readable bit
bit7bit0
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.6PCON REGISTER
Applicable Devices710 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 contain 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.
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.3PCL 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 situations 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
PCHPCL
128 70
PC
PCLA TH<4:0>
5
PCLA TH
PCHPCL
12 11 100
PC
2
8 7
PCLATH<4:3>
PCLATH
11
8
Instr
uction with
PCL as
Destination
ALU
GOTO, CALL
Opcode <10:0>
4.3.2STACK
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 instructions, or the vectoring to an interrupt
address.
4.4Program 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.1COMPUTED 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 service routine (if interrupts are used).
The INDF register is not a physical register . Addressing
the INDF register will cause indirect addressing.
Indirect addressing is possible by using the INDF register. Any instruction using the INDF register actually
accesses the register pointed to by the File Select Register, 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.
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
00011011
00h
80h
100h
180h
Not
Used
7Fh
FFh
17Fh
1FFh
Bank 0Bank 1Bank 2Bank 3
(1)
IRP
bank select
Indirect AddressingDirect Addressing
7
FSR register
location select
0
DS30272A-page 24 1997 Microchip Technology Inc.
PIC16C71X
5.0I/O PORTS
Applicable Devices710 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.1PORTA 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 output 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
QD
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
QD
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
NameBit#Buffer Function
RA0/AN0bit0TTLInput/output or analog input
RA1/AN1bit1TTLInput/output or analog input
RA2/AN2bit2TTLInput/output or analog input
RA3/AN3/V
RA4/T0CKIbit4STInput/output or external clock input for Timer0
Legend: TTL = TTL input, ST = Schmitt Trigger input
TABLE 5-2:SUMMARY OF REGISTERS ASSOCIATED WITH PORTA
05hPORTA———RA4RA3RA2RA1RA0---x 0000---u 0000
85hTRISA———PORTA Data Direction Register---1 1111---1 1111
9FhADCON1——————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.2PORTB and TRISB Registers
PORTB is an 8-bit wide bi-directional port. The corresponding 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 disabled 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 configured 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 Interrupt with flag bit RBIF (INTCON<0>).
This interrupt can wake the device from SLEEP. The
user, in the interrupt service routine, can clear the interrupt 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 software 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
QD
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.
06h, 106hPORTBRB7RB6RB5RB4RB3RB2RB1RB0xxxx xxxxuuuu uuuu
86h, 186hTRISBPORTB Data Direction Register1111 11111111 1111
81h, 181hOPTIONRBPUINTEDGT0CST0SEPSAPS2PS1PS01111 11111111 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.3I/O Programming Considerations
5.3.1BI-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 readmodify-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.2SUCCESSIVE 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 dependent) 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
PCPC + 1PC + 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.0TIMER0 MODULE
Applicable Devices710 71 711 715
The Timer0 module timer/counter has the following f eatures:
• 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 prescaler 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.1Timer0 Interrupt
The TMR0 interrupt is generated when the TMR0 register 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 service 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).
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 cycleDummy cycle
DS30272A-page 32 1997 Microchip Technology Inc.
PIC16C71X
6.2Using 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.1EXTERNAL 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. Therefore, 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 minimum pulse width requirement of 10 ns. Refer to par ameters 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 accomplished 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.2TMR0 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.
T0T0 + 1T0 + 2
1997 Microchip Technology Inc.DS30272A-page 33
PIC16C71X
6.3Prescaler
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 prescaler 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.1SWITCHING PRESCALER ASSIGNMENT
Note:To a v oid an unintended device RESET, the
The prescaler assignment is fully under software control, i.e., it can be changed “on the fly” during program
execution.
EXAMPLE 6-1:CHANGING PRESCALER (TIMER0→WDT)
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 (WDT→TIMER0)
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.
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.0ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
Applicable Devices710 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 Application 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 approximation. The analog reference voltage is software selectable 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 operate 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 configured as analog inputs (RA3 can also be a voltage reference) or as digital I/O.
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 conversion 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
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
—CHS1CHS0GO/DONE—ADONR =Readable bit
OSC/2
OSC/8
OSC/32
RC (clock derived from an RC oscillation)
bit 7-2: Unimplemented: Read as '0'
bit 1-0: PCFG1:PCFG0: A/D Port Configuration Control bits
PCFG1:PCFG0 RA1 & RA0RA2RA3V
00AAAVDD
01AAVREFRA3
10ADDV
11DDDVDD
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 conversion. 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 conversion 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 conversion can be started. The following steps should be followed 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.1A/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 analog 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 71 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 specification.
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
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.3Configuring Analog Port Pins
The ADCON1 and TRISA registers control the operation 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 configured as digital inputs, will convert an analog input. Analog levels on a digitally
configured input will not affect the conversion 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
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 µs8.0 µs
2.0 µs8.0 µs
(1,4)
AD time.
2 - 6 µs
(2)
(1,4)
2.0 µs6 µ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
OperationADCS1:ADCS020 MHz5 MHz1.25 MHz333.33 kHz
OSC00
2T
8TOSC01
32TOSC101.6 µs6.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 µs6 µs
1.6 µs6.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.4A/D Conversions
Example 7-2 shows how to perform an A/D conv ersion.
The RA pins are configured as analog inputs. The analog 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 conversion sample. That is, the ADRES register will continue to contain the value of the last completed
conversion (or the last value written to the ADRES register). After the A/D conversion is aborted, a 2T
is required before the next acquisition is started. After
this 2T
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 resolution, 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 resolution 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 electrical 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, versus 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)
TAD201.6 µs1.6 µs
162.0 µs2.0 µs
T
OSC2050 ns50 ns
1662.5 ns62.5 ns
2T
AD + N • TAD + (8 - N)(2TOSC)2010 µs16 µs
1612.5 µs20 µ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-bit8-bit
1997 Microchip Technology Inc.DS30272A-page 43
PIC16C71X
7.5A/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 conversion 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 module 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 conversion 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 instruction that sets the GO/DONE
bit will be cleared, and
bit.
7.6A/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, offset error, and monotonicity. It is defined as the maximum 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 digital conversion process. The only way to reduce quantization 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 system 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 software.
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 frequencies, 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.7Effects 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.8Connection Considerations
If the input voltage exceeds the rail v alues (VSS or VDD)
by greater than 0.2V, then the accuracy of the conversion 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-aliasing 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.9Transfer Function
The ideal transfer function of the A/D conv erter is as follows: the first transition occurs when the analog input
voltage (V
AIN) is Analog VREF/256 (Figure 7-6).
7.10References
A very good reference for understanding A/D converters is the "Analog-Digital Conversion Handbook" third
edition, published by Prentice Hall (ISBN 0-13-032848-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
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used for A/D conversion.
—
—
RA4RA3RA2RA1RA0
TRISA4TRISA3TRISA2TRISA1 TRISA0
---x 0000 ---u 0000
---1 1111 ---1 1111
DS30272A-page 46 1997 Microchip Technology Inc.
PIC16C71X
8.0SPECIAL FEATURES OF THE
CPU
Applicable Devices710 71 711 715
What sets a microcontroller apart from other processors are special circuits to deal with the needs of realtime applications. The PIC16CXX family has a host of
such features intended to maximize system reliability,
minimize cost through elimination of external components, 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 supply 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.1Configuration 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 program 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 programming.
FIGURE 8-1:CONFIGURATION WORD FOR PIC16C71
—————————CP0 PWRTE WDTE FOSC1 FOSC0
bit13bit0
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
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.2Oscillator 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:
• LPLow Power Crystal
• XTCrystal/Resonator
• HSHigh Speed Crystal/Resonator
• RCResistor/Capacitor
8.2.2CRYSTAL 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 parallel cut crystal. Use of a series cut crystal may give a
frequency out of the crystal manufacturers specifications. 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:
ModeFreqOSC1OSC2
XT455 kHz
2.0 MHz
4.0 MHz
HS8.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 kHzPanasonic EFO-A455K04B ± 0.3%
2.0 MHzMurata Erie CSA2.00MG± 0.5%
4.0 MHzMurata Erie CSA4.00MG± 0.5%
8.0 MHzMurata 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 FreqOSC1 OSC2
LP32 kHz
200 kHz
XT100 kHz
500 kHz
1 MHz
2 MHz
4 MHz
HS8 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:
ModeFreqOSC1OSC2
XT455 kHz
2.0 MHz
4.0 MHz
HS8.0 MHz
16.0 MHz
These values are for design guidance only. See
notes at bottom of page.
Resonators Used:
455 kHzPanasonic EFO-A455K04B ± 0.3%
2.0 MHzMurata Erie CSA2.00MG± 0.5%
4.0 MHzMurata Erie CSA4.00MG± 0.5%
8.0 MHzMurata 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
LP32 kHz33 pF33 pF
XT200 kHz47-68 pF47-68 pF
HS4 MHz15 pF15 pF
These values are for design guidance only. See
notes at bottom of page.
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.3EXTERNAL CRYSTAL OSCILLATOR
CIRCUIT
Either a prepackaged oscillator can be used or a simple
oscillator circuit with TTL gates can be built. Prepackaged 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 fundamental 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Ω potentiometer 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 frequency of the crystal. The inverter performs a 180degree phase shift in a series resonant oscillator circuit. The 330 kΩ resistors provide the negative feedback 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
74AS04PIC16CXXX
CLKIN
8.2.4RC 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 resistor (Rext) and capacitor (Cext) values, and the operating temperature. In addition to this, the oscillator
frequency will vary from unit to unit due to normal process 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 components used. Figure 8-8 shows how the R/C combination 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 package lead frame capacitance.
See characterization data for desired device f or RC frequency variation from part to part due to nor mal process 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 variation of oscillator frequency due to V
DD for given Rext/
Cext values as well as frequency v ariation due to operating 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 purposes 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.3Reset
WDT Reset, on MCLR reset during SLEEP, and Brownout Reset (BOR). They are not affected by a WDT
Applicable Devices710 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 differently in different reset situations as indicated in Table 87, Tab le 8-8 and Table 8-9. These bits are used in software to determine the nature of the reset. See Table 810 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.4Power-on Reset (POR), Power-up
Timer (PWRT) and Oscillator Start-up
Timer (OST), and Brown-out Reset
(BOR)
8.4.1POWER-ON RESET (POR)
Applicable Devices710 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.2POWER-UP TIMER (PWRT)
Applicable Devices710 71 711 715
The Power-up Timer provides a fixed 72 ms nominal
time-out on power-up only, from the POR. The Powerup 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.3OSCILLATOR START-UP TIMER (OST)
Applicable Devices710 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 oscillator 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.4BROWN-OUT RESET (BOR)
Applicable Devices710 71 711 715
A configuration bit, BODEN, can disable (if clear/programmed) or enable (if set) the Brown-out Reset circuitry. 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.5TIME-OUT SEQUENCE
Applicable Devices710 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 operating 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.6POWER CONTROL/STATUS REGISTER
high will begin execution immediately
(PCON)
Applicable Devices710 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.7PARITY ERROR RESET (PER)
(Parity Error Reset). It
Applicable Devices710 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 performed using even parity, the other using odd parity. As
a program ex ecutes, the parity is verified. The ev en parity bit is XOR’d with the even bits in the program memory 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 indication 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 parity. If left unprog rammed (read as ‘1’), parity is enabled.
flag
TABLE 8-5:TIME-OUT IN VARIOUS SITUATIONS, PIC16C71
Oscillator ConfigurationPower-upWake-up from SLEEP
PWRTE = 1PWRTE = 0
XT, HS, LP72 ms + 1024T
RC72 ms——
OSC1024TOSC1024 TOSC
TABLE 8-6:TIME-OUT IN VARIOUS SITUATIONS, PIC16C710/711/715
Oscillator ConfigurationPower-up
PWR
TE = 0PWRTE = 1
XT, HS, LP72 ms + 1024T
RC72 ms—72 ms—
DS30272A-page 54 1997 Microchip Technology Inc.
OSC1024TOSC72 ms + 1024TOSC1024TOSC
Brown-out
Wake-up from SLEEP
TABLE 8-7:STATUS BITS AND THEIR SIGNIFICANCE, PIC16C71
TOPD
11Power-on Reset
0xIllegal, T
x0Illegal, PD is set on POR
01WDT Reset
00WDT Wake-up
uuMCLR
10MCLR
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
BORTOPD
0x11Power-on Reset
0x0xIllegal, T
0xx0Illegal, PD is set on POR
10xxBrown-out Reset
1101WDT Reset
1100WDT Wake-up
11uuMCLR
1110MCLR
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
10x11Power-on Reset
x0x0xIllegal, T
x0xx0Illegal, PD is set on POR
110xxBrown-out Reset
11101WDT Reset
11100WDT Wake-up
111uuMCLR
11110MCLR
01111Parity Error Reset
00xxxIllegal, PER
0x0xxIllegal, PER
PORBORTOPD
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 Reset000h0001 1xxx---- --0x
Reset during normal operation000h000u uuuu---- --uu
MCLR
Reset during SLEEP000h0001 0uuu---- --uu
MCLR
WDT Reset000h0000 1uuu---- --uu
WDT Wake-upPC + 1uuu0 0uuu---- --uu
Brown-out Reset (PIC16C710/711)000h0001 1uuu---- --u0
Interrupt wake-up from SLEEPPC + 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 Reset000h0001 1xxxu--- -10x
Reset during normal operation000h000u uuuuu--- -uuu
MCLR
Reset during SLEEP000h0001 0uuuu--- -uuu
MCLR
WDT Reset000h0000 1uuuu--- -uuu
Program
Counter
STATUS
Register
PCON
Register
WDT Wake-upPC + 1uuu0 0uuuu--- -uuu
Brown-out Reset000h0001 1uuuu--- -uu0
Parity Error Reset000huuu1 0uuuu--- -0uu
Interrupt wake-up from SLEEPPC + 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 0uuuu--- -uuu
DS30272A-page 56 1997 Microchip Technology Inc.
PIC16C71X
TABLE 8-12:INITIALIZATION CONDITIONS FOR ALL REGISTERS, PIC16C710/71/711
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
The interrupt control register (INTCON) records individual interrupt requests in flag bits. It also has individual and global interrupt enable bits.
Note:Individual interrupt flag bits are set 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 disabled through their corresponding enable bits in various 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 interrupt and the TMR0 overflow interrupt flags are contained in the INTCON register.
The peripheral interrupt flags are contained in the special function registers PIR1 and PIR2. The corresponding interrupt enable bits are contained in special
function registers PIE1 and PIE2, and the peripheral
interrupt enable bit is contained in special function register 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 instructions. 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 Interrupt 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 Service Routine.
3.The Interrupt Service Routine completes 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 disable interrupts.
Perform the following to ensure that interrupts 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.1INT INTERRUPT
External interrupt on RB0/INT pin is edge triggered:
either rising if bit INTEDG (OPTION<6>) is set, or falling, 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 routine 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 interrupt enable bit GIE decides whether or not the processor branches to the interrupt vector following wake-up.
See Section 8.8 for details on SLEEP mode.
FIGURE 8-19: INT PIN INTERRUPT TIMING
Q2Q1Q3 Q4Q2Q1Q3 Q4Q2Q1Q3 Q4Q2Q1Q3 Q4Q2Q1Q3 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.2TMR0 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.3PORTB 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 interrupt 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.6Context Saving During Interrupts
During an interrupt, only the return PC value is saved
on the stack. Typically, users may wish to save ke y registers 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.7Watchdog Timer (WDT)
Applicable Devices710 71 711 715
The Watchdog Timer is as a free running on-chip RC
oscillator which does not require any external components. This RC oscillator is separate from the RC oscillator 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. During 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 (Watchdog Timer Wake-up). The WDT can be permanently
disabled by clearing configuration bit WDTE
(Section 8.1).
8.7.1WDT 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 condition.
The T
O bit in the STATUS register will be cleared upon
a Watchdog Timer time-out.
8.7.2WDT 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.
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)
WDTEFOSC1FOSC0
1997 Microchip Technology Inc.DS30272A-page 65
PIC16C71X
8.8Power-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.1WAKE-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 during 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 interrupt 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.2WAKE-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 execution of a SLEEP instruction, the device will immediately 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.
If the code protection bit(s) have not been programmed, the on-chip program memory can be read
out for verification purposes.
Note:Microchip does not recommend code pro-
8.10ID Locations
Four memory locations (2000h - 2003h) are designated
as ID locations where the user can store checksum or
other code-identification numbers. These locations are
not accessible during normal execution but are readable and writable during program/verify. It is 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 6bit command is then supplied to the device. Depending
on the command, 14-bits of program data are then supplied to or from the device, depending if the command
was a load or a read. For complete details of serial programming, please refer to the PIC16C6X/7X Programming 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.11In-Circuit Serial Programming
PIC16CXX microcontrollers can be serially programmed 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 firmware 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.0INSTRUCTION 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 register designator and 'd' represents a destination designator. 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 program 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 instruction 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 instruction, 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 instructions 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.
FieldDescription
fRegister file address (0x00 to 0x7F)
WWorking register (accumulator)
bBit address within an 8-bit file register
kLiteral field, constant data or label
xDon'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.
dDestination 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
PCProgram Counter
PCLATH
Program Counter High Latch
GIE Global Interrupt Enable bit
WDT Watchdog Timer/Counter
TOTime-out bit
PDPower-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:
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
] ADDLW k
Operands:0 ≤ k ≤ 255
Operation:(W) + k → (W)
Status Affected:C, DC, Z
Encoding:
Description:
11111xkkkkkkkk
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:Q1Q2Q3Q4
Example:
DecodeRead
literal 'k'
ADDLW0x15
Process
data
Write to
W
Before Instruction
W=0x10
After Instruction
W = 0x25
ANDLWAND Literal with W
label
Syntax:[
] ANDLW k
Operands:0 ≤ k ≤ 255
Operation:(W) .AND. (k) → (W)
Status Affected:Z
Encoding:
Description:
111001kkkkkkkk
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:Q1Q2Q3Q4
Example
DecodeRead
literal "k"
ANDLW0x5F
Process
data
Write to
W
Before Instruction
W=0xA3
After Instruction
W =0x03
ADDWFAdd 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:
000111dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
ADDWFFSR, 0
Process
'f'
data
Write to
Dest
Before Instruction
W=0x17
FSR =0xC2
After Instruction
W=0xD9
FSR =0xC2
ANDWFAND 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:
000101dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
ANDWFFSR, 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
BCFBit Clear f
label
Syntax:[
] BCF f,b
Operands:0 ≤ f ≤ 127
0 ≤ b ≤ 7
Operation:0 → (f<b>)
Status Affected:None
Encoding:
0100bbbfffffff
Description:Bit 'b' in register 'f' is cleared.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
Example
DecodeRead
register
BCFFLAG_REG, 7
Process
data
'f'
Write
register 'f'
Before Instruction
FLAG_REG = 0xC7
After Instruction
FLAG_REG = 0x47
BSFBit Set f
label
Syntax:[
] BSF f,b
Operands:0 ≤ f ≤ 127
0 ≤ b ≤ 7
Operation:1 → (f<b>)
Status Affected:None
Encoding:
Description:
0101bbbfffffff
Bit 'b' in register 'f' is set.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
DecodeRead
register
Process
data
'f'
Write
register 'f'
BTFSCBit 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:
0110bb bfffffff
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:Q1Q2Q3Q4
DecodeRead
register 'f'
Process
data
NOP
If Skip: (2nd Cycle)
Q1Q2Q3Q4
NOPNOPNOPNOP
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
BSFFLAG_REG, 7
Before Instruction
FLAG_REG = 0x0A
After Instruction
FLAG_REG = 0x8A
DS30272A-page 72 1997 Microchip Technology Inc.
PIC16C71X
BTFSSBit 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:
0111bbbfffffff
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:Q1Q2Q3Q4
DecodeRead
register 'f'
Process
data
NOP
If Skip: (2nd Cycle)
Q1Q2Q3Q4
NOPNOPNOPNOP
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
CALLCall 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:
100kkkkkkkkkkk
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:Q1Q2Q3Q4
Example
1st Cycle
2nd Cycle
DecodeRead
literal 'k',
Push PC
to Stack
NOPNOPNOPNOP
HERECALL 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
CLRFClear f
label
Syntax:[
] CLRF f
Operands:0 ≤ f ≤ 127
Operation:00h → (f)
1 → Z
Status Affected:Z
Encoding:
Description:
0000011fffffff
The contents of register 'f' are cleared
and the Z bit is set.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
Example
DecodeRead
register
CLRFFLAG_REG
Process
data
'f'
Write
register 'f'
Before Instruction
FLAG_REG=0x5A
After Instruction
FLAG_REG=0x00
Z=1
CLRWClear W
label
Syntax:[
] CLRW
Operands:None
Operation:00h → (W)
1 → Z
Status Affected:Z
Encoding:
Description:
0000010xxxxxxx
W register is cleared. Zero bit (Z) is
set.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
Example
DecodeNOPProcess
data
CLRW
Write to
W
Before Instruction
W=0x5A
After Instruction
W=0x00
Z=1
CLRWDTClear Watchdog Timer
label
Syntax:[
] CLRWDT
Operands:None
Operation:00h → WDT
0 → WDT prescaler,
O
1 → T
1 → PD
Status Affected:TO, PD
Encoding:
Description:
00000001100100
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:Q1Q2Q3Q4
Example
DecodeNOPProcess
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
COMFComplement f
label
Syntax:[
] COMF f,d
Operands:0 ≤ f ≤ 127
d ∈ [0,1]
Operation:(f
) → (dest)
Status Affected:Z
Encoding:
Description:
001001dfffffff
The contents of register 'f' are complemented. 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:Q1Q2Q3Q4
Example
DecodeRead
register
COMFREG1,0
Process
'f'
data
Write to
dest
Before Instruction
REG1=0x13
After Instruction
REG1=0x13
W=0xEC
DECFSZDecrement 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:
001011dfffffff
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:Q1Q2Q3Q4
DecodeRead
register
Process
data
'f'
Write to
dest
If Skip: (2nd Cycle)
Q1Q2Q3Q4
NOPNOPNOPNOP
DECFDecrement f
label
Syntax:[
] DECF f,d
Operands:0 ≤ f ≤ 127
d ∈ [0,1]
Operation:(f) - 1 → (dest)
Status Affected:Z
Encoding:
Description:
000011dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
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=addressHERE
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
GOTOUnconditional 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:
101kkkkkkkkkkk
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:Q1Q2Q3Q4
Example
1st Cycle
2nd Cycle
DecodeRead
literal 'k'
NOPNOPNOPNOP
GOTO THERE
Process
data
Write to
PC
After Instruction
PC =Address THERE
INCFIncrement f
label
Syntax:[
] INCF f,d
Operands:0 ≤ f ≤ 127
d ∈ [0,1]
Operation:(f) + 1 → (dest)
Status Affected:Z
Encoding:
Description:
001010dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
INCFCNT, 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
INCFSZIncrement 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:
001111dfffffff
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:Q1Q2Q3Q4
DecodeRead
register
Process
'f'
data
Write to
dest
If Skip: (2nd Cycle)
Q1Q2Q3Q4
NOPNOPNOPNOP
IORLWInclusive OR Literal with W
label
Syntax:[
] IORLW k
Operands:0 ≤ k ≤ 255
Operation:(W) .OR. k → (W)
Status Affected:Z
Encoding:
Description:
111000kkkkkkkk
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:Q1Q2Q3Q4
Example
DecodeRead
literal 'k'
IORLW0x35
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
IORWFInclusive 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:
000100dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
IORWFRESULT, 0
Process
data
'f'
Write to
dest
Before Instruction
RESULT =0x13
W=0x91
After Instruction
RESULT =0x13
W=0x93
Z=1
MOVLWMove Literal to W
label
Syntax:[
] MOVLW k
Operands:0 ≤ k ≤ 255
Operation:k → (W)
Status Affected:None
Encoding:
Description:
1100xxkkkkkkkk
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:Q1Q2Q3Q4
Example
DecodeRead
literal 'k'
MOVLW0x5A
Process
data
Write to
W
After Instruction
W=0x5A
MOVFMove f
label
Syntax:[
] MOVF f,d
Operands:0 ≤ f ≤ 127
d ∈ [0,1]
Operation:(f) → (dest)
Status Affected:Z
Encoding:
Description:
001000dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
MOVFFSR, 0
Process
data
'f'
Write to
dest
After Instruction
W = value in FSR register
Z = 1
MOVWFMove W to f
label
Syntax:[
] MOVWF f
Operands:0 ≤ f ≤ 127
Operation:(W) → (f)
Status Affected:None
Encoding:
Description:
0000001fffffff
Move data from W register to register
'f'
.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
Example
DecodeRead
register
MOVWFOPTION_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
NOPNo Operation
label
Syntax:[
] NOP
Operands:None
Operation:No operation
Status Affected:None
Encoding:
Description:
0000000xx00000
No operation.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
DecodeNOPNOPNOP
Example
NOP
RETFIEReturn from Interrupt
label
Syntax:[
] RETFIE
Operands:None
Operation:TOS → PC,
1 → GIE
Status Affected:None
Encoding:
Description:
00000000001001
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:Q1Q2Q3Q4
Example
1st Cycle
2nd Cycle
DecodeNOPSet the
GIE bit
NOPNOPNOPNOP
RETFIE
Pop from
the Stack
After Interrupt
PC =TOS
GIE =1
OPTIONLoad Option Register
Syntax:[
label
] OPTION
Operands:None
Operation:(W) → OPTION
Status Affected: None
Encoding:
Description:
00000001100010
The contents of the W register are
loaded in the OPTION register. This
instruction is supported for code compatibility 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
RETLWReturn with Literal in W
label
Syntax:[
] RETLW k
Operands:0 ≤ k ≤ 255
Operation:k → (W);
TOS → PC
Status Affected:None
Encoding:
Description:
1101xxkkkkkkkk
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:Q1Q2Q3Q4
Example
1st Cycle
2nd Cycle
TABLE
DecodeRead
NOPNOPNOPNOP
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'
NOPWrite to
W, Pop
from the
Stack
Before Instruction
W=0x07
After Instruction
W=value of k8
RETURNReturn from Subroutine
label
Syntax:[
] RETURN
Operands:None
Operation:TOS → PC
Status Affected:None
Encoding:
Description:
00000000001000
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:Q1Q2Q3Q4
1st Cycle
2nd Cycle
Example
DecodeNOPNOPPop from
the Stack
NOPNOPNOPNOP
RETURN
After Interrupt
PC =TOS
DS30272A-page 80 1997 Microchip Technology Inc.
PIC16C71X
RLFRotate 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:
001101dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
RLFREG1,0
Process
data
'f'
Write to
dest
Before Instruction
REG1=1110 0110
C=0
After Instruction
REG1=1110 0110
W=1100 1100
C=1
RRFRotate 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:
001100dfffffff
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:Q1Q2Q3Q4
Example
DecodeRead
register
RRFREG1,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:
00000001100011
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:Q1Q2Q3Q4
DecodeNOPNOPGo to
Sleep
Example:SLEEP
SUBLWSubtract W from Literal
label
Syntax:[
]SUBLW k
Operands:0 ≤ k ≤ 255
Operation:k - (W) → (W)
Status Affected: C, DC, Z
Encoding:11110xkkkkkkkk
Description:
The W register is subtracted (2’s complement method) from the eight bit literal 'k'.
The result is placed in the W register.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
DecodeRead
literal 'k'
Process
data
Write to W
Example 1:SUBLW0x02
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 negative
Z=0
DS30272A-page 82 1997 Microchip Technology Inc.
PIC16C71X
SUBWFSubtract 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:000010dfffffff
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:Q1Q2Q3Q4
DecodeRead
register 'f'
Process
data
Write to
dest
Example 1:SUBWFREG1,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
SWAPFSwap 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 register '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'.
1110dfffffff
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
Example
DecodeRead
register 'f'
SWAPF REG,0
Process
data
Write to
dest
Before Instruction
REG1=0xA5
After Instruction
REG1=0xA5
W=0x5A
TRISLoad TRIS Register
Syntax:[
label
] TRISf
Operands:5 ≤ f ≤ 7
Operation:(W) → TRIS register f;
Status Affected: None
Encoding:
Description:
00
000001100fff
The instruction is supported for code
compatibility with the PIC16C5X products. Since TRIS registers are readable 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
XORLWExclusive OR Literal with W
Syntax:[
label
]XORLW k
Operands:0 ≤ k ≤ 255
Operation:(W) .XOR. k → (W)
Status Affected:Z
Encoding:111010kkkkkkkk
Description:
The contents of the W register are
XOR’ed with the eight bit literal 'k'.
The result is placed in the W register.
Words:1
Cycles:1
Q Cycle Activity:Q1Q2Q3Q4
DecodeRead
literal 'k'
Process
data
Write to
W
Example:XORLW0xAF
Before Instruction
W=0xB5
After Instruction
W=0x1A
XORWFExclusive 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:
000110dfffffff
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:Q1Q2Q3Q4
DecodeRead
register
ExampleXORWF
'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.0DEVELOPMENT SUPPORT
10.1Development 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
• MPLAB SIM Software Simulator
• MPLAB-C (C Compiler)
• Fuzzy Logic Development System
(
fuzzy
10.2PICMASTER: 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 processors. The universal architecture of the PICMASTER
allows expansion to support all new Microchip microcontrollers.
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
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.4PRO MATE II: Universal Programmer
The PRO MATE II Universal Programmer is a full-featured 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 standalone mode the PRO MATE II can read, verify or program PIC12CXXX, PIC14C000, PIC16C5X,
PIC16CXXX and PIC17CXX devices. It can also set
configuration and code-protect bits in this mode.
DD and VPP
10.5PICSTART Plus Entry Level
Development System
The PICSTART programmer is an easy-to-use, lowcost 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.
The PICDEM-1 is a simple board which demonstrates
the capabilities of several of Microchip’s microcontrollers. 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 firmware. The user can also connect the PICDEM-1
board to the PICMASTER emulator and download
the firmware to the emulator for testing. Additional prototype area is available for the user to build some additional 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.
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 programmer 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 additional hardware and connecting it to the microcontroller
socket(s). Some of the f eatures include a RS-232 interface, push-button switches, a potentiometer for simulated analog input, a Serial EEPROM to demonstrate
usage of the I
tion to an LCD module and a keypad.
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 necessary hardware and software is included to run the
basic demonstration programs. The user can program the sample microcontrollers provided with
the PICDEM-3 board, on a PRO MATE II programmer 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 firmware. 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 potentiometer 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 segments, that is capable of displaying time, temperature
and day of the week. The PICDEM-3 provides an additional RS-232 interface and Windows 3.1 software for
showing the demultiplex ed LCD signals on a PC. A simple serial interface allows the user to construct a hardware demultiplexer for the LCD signals.
10.9MPLAB Integrated Development
Environment Software
The MPLAB IDE Software brings an ease of software
development previously unseen in the 8-bit microcontroller 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.10Assembler (MPASM)
The MPASM Universal Macro Assembler is a PChosted symbolic assembler. It suppor ts all microcontroller series including the PIC12C5XX, PIC14000,
PIC16C5X, PIC16CXXX, and PIC17CXX families.
MPASM offers full featured Macro capabilities, conditional 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 developing 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.11Software 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 outside of the laboratory environment making it an excellent multi-project software development tool.
10.12C Compiler (MPLAB-C)
10.14MP-DriveWay – Application Code
Generator
MP-DriveWay is an easy-to-use Windows-based Application 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 Microchip’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.15SEEVAL 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 tradeoff analysis and reliability calculations. The total kit can
significantly reduce time-to-market and result in an
optimized system.
10.16KEELOQ Evaluation and
Programming Tools
KEELOQ evaluation and programming tools support
Microchips HCS Secure Data Products. The HCS ev aluation kit includes an LCD display to show changing
codes, a decoder to decode transmissions, and a programming 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 microcontrollers. The compiler provides powerful integration
capabilities and ease of use not found with other
compilers.
For easier source level debugging, the compiler provides symbol information that is compatible with the
MPLAB IDE memory display.
10.13Fuzzy Logic Development System
(
fuzzy
TECH-MP)
fuzzy
TECH-MP fuzzy logic development tool is available 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.
11.0ELECTRICAL 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.5VVDD: 4.5V to 5.5VVDD: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.5VIPD: 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
*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 Devices710 71 711 715
11.2 DC Characteristics:PIC16LC710-04 (Commercial, Industrial, Extended)
PIC16LC711-04 (Commercial, Industrial, Extended)
Standard Operating Conditions (unless otherwise stated)
* 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
, RB0/INT0.8VDD-VDDV
D042AOSC1 (XT, HS and LP)0.7V
D043OSC1 (in RC mode)0.9V
D070PORTB weak pull-up currentI
PURB50250400µA VDD = 5V, VPIN = VSS
DD-VDDVFor entire VDD range
DD-VDDVNote1
DD-VDDV
Input Leakage Current (Notes 2, 3)
D060I/O portsI
D061MCLR
, RA4/T0CKI--±5µA Vss ≤ VPIN≤ VDD
IL--±1µA Vss ≤ VPIN≤ VDD, Pin at hi-
D063OSC1--±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.
Standard Operating Conditions (unless otherwise stated)
Operating temperature0˚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
CharacteristicSymMinT yp†MaxUnitsConditions
No.
Output Low Voltage
D080I/O portsV
OL--0.6VIOL = 8.5 mA, VDD = 4.5V,
D080A--0.6VI
D083OSC2/CLKOUT (RC osc config)--0.6VI
D083A--0.6VI
Output High Voltage
D090I/O ports (Note 3)V
D090AV
D092OSC2/CLKOUT (RC osc config)V
D092AV
D130*Open-Drain High VoltageV
OH VDD - 0.7 --VIOH = -3.0 mA, VDD = 4.5V,
DD - 0.7 --VIOH = -2.5 mA, VDD = 4.5V,
DD - 0.7 --VIOH = -1.3 mA, VDD = 4.5V,
DD - 0.7 --VIOH = -1.0 mA, VDD = 4.5V,
OD--14VRA4 pin
Capacitive Loading Specs on
Output Pins
D100OSC2 pinC
D101All I/O pins and OSC2 (in RC mode)C
OSC2--15pF In XT, HS and LP modes when
IO--50pF
*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.
11.5Timing Diagrams and Specifications
FIGURE 11-2: EXTERNAL CLOCK TIMING
Q4Q1Q2Q3Q4Q1
OSC1
1
3
2
CLKOUT
TABLE 11-2:EXTERNAL CLOCK TIMING REQUIREMENTS
PIC16C71X
Applicable Devices710 71 711 715
4
3
4
Parameter
No.
1Tosc External CLKIN Period
2T
3TosL,
4TosR,
Note 1: Instruction cycle period (TCY) equals four times the input oscillator time-base period. All specified values are based on
Sym CharacteristicMinTyp†MaxUnits Conditions
Fosc External CLKIN Frequency
(Note 1)
Oscillator Frequency
(Note 1)
(Note 1)
Oscillator Period
(Note 1)
CYInstruction Cycle Time (Note 1) 200—DCnsTCY = 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.
10*TosH2ckL OSC1↑ to CLKOUT↓—1530nsNote 1
11*TosH2ckH OSC1↑ to CLKOUT↑—1530nsNote 1
12*TckRCLKOUT rise time —515nsNote 1
13*TckFCLKOUT fall time —515nsNote 1
14*TckL2ioVCLKOUT ↓ to Port out valid ——0.5TCY + 20nsNote 1
15*TioV2ckH Port in valid before CLKOUT ↑0.25TCY + 25——ns Note 1
16*TckH2ioIPort in hold after CLKOUT ↑0——nsNote 1
17*TosH2ioV OSC1↑ (Q1 cycle) to
18*TosH2ioIOSC1↑ (Q2 cycle) to
19*TioV2osH Port input valid to OSC1↑ (I/O in setup time)TBD——ns
20*TioRPort output rise time PIC16C710/711—1025ns
21*TioFPort output fall timePIC16C710/711—1025ns
22††*TinpINT pin high or low time20——ns
23††*TrbpRB7:RB4 change INT high or low time20——ns
Note 1: Measurements are taken in RC Mode where CLKOUT output is 4 x T
SymCharacteristicMinTyp†MaxUnits Conditions
——80 - 100ns
Port out valid
TBD——ns
Port input invalid (I/O in hold time)
PIC16LC710/711——60ns
PIC16LC710/711——60ns
* 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 Devices710 71 711 715
FIGURE 11-4: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP
* 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
48Tcke2tmrI Delay from external clock edge to timer increment2Tosc— 7Tosc—
SymCharacteristicMinTyp† Max Units Conditions
Tt0HT0CKI High Pulse WidthNo Prescaler0.5TCY + 20*——ns Must also meet
With Prescaler10*——ns
With Prescaler10*——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
A03EIL Integral linearity error——
A04EDL Differential linearity error——
A05EFS Full scale error——
A06EOFF Offset error——
A10—Monotonicity—guaranteed——VSS≤ VAIN≤ VREF
A20VREF Reference voltage2.5V—VDD + 0.3V
A25VAIN Analog input voltageVSS - 0.3—VREF + 0.3 V
A30ZAIN Recommended impedance of
analog voltage source
A40IAD A/D conversion current (VDD)—180—µAAverage current consumption
A50IREF 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.
PIC16LC710/7112.0——µsTOSC based, VREF full range
PIC16C710/7112.0*4.06.0µsA/D RC mode
PIC16LC710/7113.0*6.09.0µsA/D RC mode
131TCNV Conversion time
—9.5—TAD
(not including S/H time). (Note 1)
132TACQ Acquisition time Note 25*20
—
µs
—
—
µsThe 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).
134TGO 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.
135TSWC Switching from convert → sample time1.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...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.