6.0Overview of Timer Modules....................................................................................................................................................... 43
11.0 Synchronous Serial Port (SSP) Module .................................................................................................................................... 63
14.0 Special Features of the CPU...................................................................................................................................................103
15.0 Instruction Set Summary......................................................................................................................................................... 119
16.0 Development Support.............................................................................................................................................................. 137
18.0 DC and AC Characteristics Graphs and Tables......................................................................................................................161
Index .................................................................................................................................................................................................. 177
List of Equations And Examples ........................................................................................................................................................ 181
List of Figures..................................................................................................................................................................................... 181
List of Tables...................................................................................................................................................................................... 182
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.
DS30444E - page 4
1997 Microchip Technology Inc.
PIC16C9XX
1.0GENERAL DESCRIPTION
The PIC16C9XX is a family of
mance, CMOS, fully-static, 8-bit microcontrollers with
an integrated LCD Driver module, in the PIC16CXXX
mid-range family.
All PICmicro™ microcontrollers employ an advanced
RISC architecture. The PIC16CXXX 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 gives some of the architectural innov ations used
to achieve a very high performance.
PIC16CXXX microcontrollers typically achieve a 2:1
code compression and a 4:1 speed improvement over
other 8-bit microcontrollers in their class.
The PIC16C923 devices have 176 bytes of RAM and
25 I/O pins. In addition several peripheral features are
available including: three timer/counters, one Capture/Compare/PWM module, one serial port and one
LCD module. The Synchronous Serial P ort can be configured as either a 3-wire Serial Peripheral Interface
(SPI) or the two-wire Inter-Integrated Circuit (I
The LCD module features programmable multiplex
mode (static, 1/2, 1/3 and 1/4) and drive bias (static and
1/3). It is capable of driving up to 32 segments and up
to 4 commons. It can also drive the LCD panel while in
SLEEP mode.
The PIC16C924 devices have 176 bytes of RAM and
25 I/O pins. In addition several peripheral features are
available including: three timer/counters, one Capture/Compare/PWM module, one serial port and one
LCD module. The Synchronous Serial P ort can be configured as either a 3-wire Serial Peripheral Interface
(SPI) or the two-wire Inter-Integrated Circuit (I
The LCD module features programmable multiplex
mode (static, 1/2, 1/3 and 1/4) and drive bias (static and
1/3). It is capable of driving up to 32 segments and up
to 4 commons. It can also drive the LCD panel while in
SLEEP mode. The PIC16C924 also has an 5-channel
high-speed 8-bit A/D. The 8-bit resolution is ideally
suited for applications requiring low-cost analog interface, e.g. thermostat control, pressure sensing, and
meters.
The PIC16C9XX 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
low-cost, high-perfor-
2
C) bus.
2
C) bus.
mode. The user can wake up the chip from SLEEP
through several external and internal interrupts and
reset(s).
A highly reliable Watchdog Timer with its own on-chip
RC oscillator provides recovery in the event of a software lock-up.
A UV erasable CERQUAD (compatible with PLCC)
packaged version is ideal for code development while
the cost-effective One-Time-Programmable (OTP) version is suitable for production in any volume.
The PIC16C9XX family fits perfectly in applications
ranging from handheld meters, thermostats, to home
security products. The EPROM technology makes customization of application programs (LCD panels, calibration constants, sensor interfaces, etc.) extremely
fast and conv enient. The small f ootprint packages make
this microcontroller series perfect for all applications
with space limitations. Low cost, low pow er, high perf ormance, ease of use and I/O flexibility make the
PIC16C9XX very versatile even in areas where no
microcontroller use has been considered before (e.g.
timer functions, 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 PIC16CXXX
family of devices (Appendix B).
1.2De
PIC16C9XX devices are supported by the complete
line of Microchip Development tools.
Please refer to Section 16.0 for more details about
Microchip’s development tools.
amily and Upward Compatibility
velopment Support
1997 Microchip Technology Inc.DS30444E- page 5
PIC16C9XX
TABLE 1-1: PIC16C9XX FAMILY OF DEVICES
PIC16C923
Clock
Memory
Peripherals
Features
All PICmicro Family devices ha v e Power-on Reset, selectable Watchdog Timer, selectable code protect and high I/O current capability . All PIC16C9XX Family devices use serial programming with clock pin RB6 and data pin RB7.
Maximum Frequency of Operation (MHz)88
EPROM Program Memory 4K4K
Data Memory (bytes)176176
Timer Module(s)TMR0,
TMR1,
TMR2
Capture/Compare/PWM Module(s)11
Serial Port(s)
Interrupt Sources89
I/O Pins2525
Input Pins2727
Voltage Range (Volts)2.5-6.02.5-6.0
In-Circuit Serial ProgrammingYesYes
Brown-out Reset——
Packages64-pin SDIP,
2
SPI/I
CSPI/I
32 Seg
TQFP;
68-pin PLCC,
Die
PIC16C924
TMR0,
TMR1,
TMR2
2
C
4 Com,
32 Seg
64-pin SDIP,
TQFP;
68-pin PLCC,
Die
DS30444E - page 6
1997 Microchip Technology Inc.
PIC16C9XX
2.0PIC16C9XX 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 PIC16C9XX 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 PIC16C9XX family, there are two device “types”
as indicated in the device number:
1. C , as in PIC16 C 924. These devices have
EPROM type memory and operate over the
standard voltage range.
2. LC , as in PIC16 LC 924. These devices have
EPROM type memory and operate over an
extended voltage range.
2.1UV Erasab
The UV erasable version, offered in CERQUAD package, is optimal for prototype dev elopment and pilot programs.
The UV erasable version can be erased and reprogrammed to any of the configuration modes.
Microchip's PICSTART
grammers both support the PIC16C9XX. Third party
programmers also are available; refer to the
Third Party Guide
le Devices
Plus and PRO MATE
for a list of sources.
II pro-
Microchip
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.
ed Quick-Turnaround
SM
) De
vices
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.DS30444E - page 7
PIC16C9XX
NOTES:
DS30444E - page 8
1997 Microchip Technology Inc.
PIC16C9XX
3.0ARCHITECTURAL OVERVIEW
The high performance of the PIC16CXXX family can be
attributed to a number of architectural features commonly found in RISC microprocessors. To begin with,
the PIC16CXXX uses a Harvard architecture, in which,
program and data are accessed from separate memories using separate buses. This improves bandwidth
over traditional von Neumann architecture where 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 progr am memory access bus
fetches a 14-bit instruction in a single cycle. A
two-stage pipeline overlaps fetch and execution of
instructions (Example 3-1). Consequently, all instructions execute in a single cycle (500 ns @ 8 MHz) e xcept
for program branches.
The PIC16C923 and PIC16C924 both address 4K x 14
of program memory and 176 x 8 of data memory.
The PIC16CXXX 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 PIC16CXXX 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
PIC16CXXX simple yet efficient, thus significantly
reducing the learning curve.
PIC16CXXX devices contain an 8-bit ALU and working
register. The ALU is a general purpose ar ithmetic 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.
OSC1/CLKIN222414IST/CMOSOscillator crystal input or external clock source input. This
OSC2/CLKOUT232515O—Oscillator crystal output. Connects to crystal or resonator
MCLR/VPP1257I/PSTMaster clear (reset) input or programming voltage input.
RA0/AN04560I/OTTLRA0 can also be Analog input0.
RA1/AN15661I/OTTLRA1 can also be Analog input1.
RA2/AN27863I/OTTLRA2 can also be Analog input2.
RA3/AN3/VREF8964I/OTTLRA3 can also be Analog input3 or A/D Voltage Refer-
RA4/T0CKI9101I/OSTRA4 can also be the clock input to the Timer0
RA5/AN4/SS10112I/OTTLRA5 can be the slave select for the synchronous serial
RB0/INT12134I/OTTL/STRB0 can also be the external interrupt pin. This buffer
RB111123I/OTTL
RB23459I/OTTL
RB32358I/OTTL
RB4646856I/OTTLInterrupt on change pin.
RB5636755I/OTTLInterrupt on change pin.
RB6616553I/OTTL/STInterrupt on change pin. Serial programming clock.
RB7626654I/OTTL/STInterrupt on change pin. Serial programming data.
RC0/T1OSO/T1CKI242616I/OSTRC0 can also be the Timer1 oscillator output or
RC1/T1OSI252717I/OSTRC1 can also be the Timer1 oscillator input.
RC2/CCP1262818I/OSTRC2 can also be the Capture1 input/Compare1 out-
RC3/SCK/SCL13145I/OSTRC3 can also be the synchronous serial clock
RC4/SDI/SDA14156I/OSTRC4 can also be the SPI Data In (SPI mode) or data
RC5/SDO15167I/OSTRC5 can also be the SPI Data Out (SPI mode).
C116178PLCD Voltage Generation.
C217189PLCD Voltage Generation.
VLCD3192011P—LCD Voltage.
VDD20, 6022, 6412, 52P—Digital power.
VSS6, 217, 2313, 62P—Ground reference.
NC—1———These pins are not internally connected. These pins should
DS30444E - page 14 1997 Microchip Technology Inc.
PIC16C9XX
3.1Clocking 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-3.
FIGURE 3-3: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 Flow/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" 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.
DS30444E - page 16 1997 Microchip Technology Inc.
PIC16C9XX
4.0MEMORY ORGANIZATION
4.1Program Memory Organization
The PIC16C9XX family has a 13-bit program counter
capable of addressing an 8K x 14 program memory
space.
Only the first 4K x 14 (0000h-0FFFh) is physically
implemented. Accessing a location above the physically implemented addresses will cause a wraparound.
The reset vector is at 0000h and the interrupt vector is
at 0004h.
FIGURE 4-1:PROGRAM MEMORY MAP
AND STACK
PC<12:0>
CALL, RETURN
RETFIE, RETLW
Interrupt Vector
On-chip Program
Space
User Memory
Memory (Page 0)
On-chip Program
Memory (Page 1)
Stack Level 1
Stack Level 8
Reset Vector
13
0000h
0004h
0005h
07FFh
0800h
4.2Data Memory Organization
The data memory is partitioned into four Banks which
contain the General Purpose Registers and the Special
Function Registers. Bits RP1 and RP0 are the bank
select bits.
RP1:RP0 (STATUS<6:5>)
11 = Bank 3 (180h-1FFh)
10 = Bank 2 (100h-17Fh)
01 = Bank 1 (80h-FFh)
00 = Bank 0 (00h-7Fh)
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. All four banks contain special
function registers. Some “high use” special function
registers are mirrored in other banks 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 following General Purpose Registers are not physically implemented:
• F0h-FFh of Bank 1
• 170h-17Fh of Bank 2
• 1F0h-1FFh of Bank 3
These locations are used for common access across
DS30444E - page 18 1997 Microchip Technology Inc.
70h-7Fh
Bank 1
Unimplemented data memory locations, read as '0'.
Note 1: Not a physical register.
2: These registers are not implemented on the PIC16C923.
EFh
F0h
FFh
Mapped in
Bank 0
70h-7Fh
Bank 2
16F
170
17F
Mapped in
Bank 0
70h-7Fh
Bank 3
1EFh
1F0h
1FFh
PIC16C9XX
4.2.2SPECIAL FUNCTION REGISTERS
The special function registers can be classified into two
sets (core and peripheral). Those registers associated
The Special Function Registers are registers used by
the CPU and Peripheral Modules for controlling the
desired operation of the device. These registers are
implemented as static RAM.
with the “core” functions are described in this section,
and those related to the operation of the peripheral features are described in the section of that peripheral feature.
00hINDFAddressing this location uses contents of FSR to address data memory (not a physical register)0000 0000 0000 0000
01hTMR0Timer0 module’s registerxxxx xxxx uuuu uuuu
02hPCLProgram Counter's (PC) Least Significant Byte0000 0000 0000 0000
03hSTATUSIRPRP1RP0T
04hFSRIndirect data memory address pointerxxxx xxxx uuuu uuuu
05hPORTA
06hPORTBPORTB Data Latch when written: PORTB pins when readxxxx xxxx uuuu uuuu
07hPORTC
08hPORTDPORTD Data Latch when written: PORTD pins when read0000 0000 0000 0000
09hPORTEPORTE pins when read0000 0000 0000 0000
0AhPCLATH
0BhINTCONGIE PEIET0IEINTERBIET0IFINTFRBIF0000 000x 0000 000u
0ChPIR1LCDIFADIF
0Dh—Unimplemented——
0EhTMR1LHolding register for the Least Significant Byte of the 16-bit TMR1 registerxxxx xxxx uuuu uuuu
0FhTMR1HHolding register for the Most Significant Byte of the 16-bit TMR1 registerxxxx xxxx uuuu uuuu
10hT1CON
11hTMR2Timer2 module’s register0000 0000 0000 0000
12hT2CON
13hSSPBUFSynchronous Serial Port Receive Buffer/Transmit Registerxxxx xxxx uuuu uuuu
14hSSPCONWCOLSSPOVSSPENCKPSSPM3SSPM2SSPM1SSPM00000 0000 0000 0000
15hCCPR1LCapture/Compare/PWM Register (LSB)xxxx xxxx uuuu uuuu
16hCCPR1HCapture/Compare/PWM Register (MSB)xxxx xxxx uuuu uuuu
17hCCP1CON
18h—Unimplemented——
19h—Unimplemented——
1Ah—Unimplemented——
1Bh—Unimplemented——
1Ch—Unimplemented——
1Dh—Unimplemented——
(1)
1Eh
1Fh
Legend:x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0',
Note1: Registers ADRES, ADCON0, and ADCON1 are not implemented in the PIC16C923, read as '0'.
ADRESA/D Result Registerxxxx xxxx uuuu uuuu
(1)
ADCON0ADCS1ADCS0CHS2CHS1CHS0GO/DONE
shaded locations are unimplemented, read as ‘0’.
2: These bits are reserved on the PIC16C923, always maintain these bits clear.
3: These pixels do not display, but can be used as general purpose RAM.
4: PIC16C923 reset values for PORTA: --xx xxxx for a POR, and --uu uuuu for all other resets,
PIC16C924 reset values for PORTA: --0x 0000 when read.
5: Bit1 of ADCON0 is reserved on the PIC16C924, always maintain this bit clear.
——PORTA Data Latch when written: PORTA pins when read
——PORTC Data Latch when written: PORTC pins when read--xx xxxx --uu uuuu
———Write Buffer for the upper 5 bits of the Program Counter---0 0000 ---0 0000
80hINDFAddressing this location uses contents of FSR to address data memory (not a physical register)0000 0000 0000 0000
81hOPTIONRBPU
82hPCLProgram Counter's (PC) Least Significant Byte0000 0000 0000 0000
83hSTATUSIRPRP1RP0T
84hFSRIndirect data memory address pointerxxxx xxxx uuuu uuuu
85hTRISA
86hTRISBPORTB Data Direction Register1111 1111 1111 1111
87hTRISC
88hTRISDPORTD Data Direction Register1111 1111 1111 1111
89hTRISEPORTE Data Direction Register1111 1111 1111 1111
8AhPCLATH
8BhINTCONGIEPEIET0IEINTERBIET0IFINTFRBIF0000 000x 0000 000u
8ChPIE1LCDIEADIE
8Dh—Unimplemented——
8EhPCON
8Fh—Unimplemented——
90h—Unimplemented——
91h—Unimplemented——
92hPR2Timer2 Period Register1111 1111 1111 1111
93hSSPADDSynchronous Serial Port (I
94hSSPSTATSMPCKED/A
95h—Unimplemented——
96h—Unimplemented——
97h—Unimplemented——
98h—Unimplemented——
99h—Unimplemented——
9Ah—Unimplemented——
9Bh—Unimplemented——
9Ch—Unimplemented——
9Dh—Unimplemented——
9Eh—Unimplemented——
(1)
9Fh
Legend:x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0',
Note1: Registers ADRES, ADCON0, and ADCON1 are not implemented in the PIC16C923, read as '0'.
ADCON1—————PCFG2PCFG1PCFG0---- -000 ---- -000
shaded locations are unimplemented, read as ‘0’.
2: These bits are reserved on the PIC16C923, always maintain these bits clear.
3: These pixels do not display, but can be used as general purpose RAM.
4: PIC16C923 reset values for PORTA: --xx xxxx for a POR, and --uu uuuu for all other resets,
PIC16C924 reset values for PORTA: --0x 0000 when read.
5: Bit1 of ADCON0 is reserved on the PIC16C924, always maintain this bit clear.
INTEDGT0CST0SEPSAPS2PS1PS01111 1111 1111 1111
OPDZDCC0001 1xxx 000q quuu
——PORTA Data Direction Register--11 1111 --11 1111
——PORTC Data Direction Register--11 1111 --11 1111
———Write Buffer for the upper 5 bits of the PC---0 0000 ---0 0000
(2)
——————POR—---- --0- ---- --u-
——SSPIECCP1IETMR2IETMR1IE00-- 0000 00-- 0000
2
C mode) Address Register0000 0000 0000 0000
PSR/WUABF0000 0000 0000 0000
Value on
Power-on
Reset
Value on all
other resets
DS30444E - page 20 1997 Microchip Technology Inc.
PIC16C9XX
TABLE 4-1: SPECIAL FUNCTION REGISTER SUMMARY (Cont.’d)
100hINDFAddressing this location uses contents of FSR to address data memory (not a physical register)0000 0000 0000 0000
101hTMR0Timer0 module’s registerxxxx xxxx uuuu uuuu
102hPCLProgram Counter's (PC) Least Significant Byte0000 0000 0000 0000
103hSTATUSIRPRP1RP0T
104hFSRIndirect data memory address pointerxxxx xxxx uuuu uuuu
105h—Unimplemented——
106hPORTBPORTB Data Latch when written: PORTB pins when readxxxx xxxx uuuu uuuu
107hPORTFPORTF pins when read0000 0000 0000 0000
108hPORTGPORTG pins when read0000 0000 0000 0000
109h—Unimplemented——
10AhPCLATH
10BhINTCONGIEPEIET0IEINTERBIET0IFINTFRBIF0000 000x 0000 000u
10Ch—Unimplemented——
10DhLCDSESE29SE27SE20SE16SE12SE9SE5SE01111 1111 1111 1111
10EhLCDPS
10FhLCDCONLCDENSLPEN
110hLCDD00
111hLCDD01
112hLCDD02
113hLCDD03
114hLCDD04
115hLCDD05
116hLCDD06
117hLCDD07
118hLCDD08
119hLCDD09
11AhLCDD10
11BhLCDD11
11ChLCDD12
11DhLCDD13
11EhLCDD14
11FhLCDD15
Legend:x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0',
shaded locations are unimplemented, read as ‘0’.
Note1: Registers ADRES, ADCON0, and ADCON1 are not implemented in the PIC16C923, read as '0'.
2: These bits are reserved on the PIC16C923, always maintain these bits clear.
3: These pixels do not display, but can be used as general purpose RAM.
4: PIC16C923 reset values for PORTA: --xx xxxx for a POR, and --uu uuuu for all other resets,
PIC16C924 reset values for PORTA: --0x 0000 when read.
5: Bit1 of ADCON0 is reserved on the PIC16C924, always maintain this bit clear.
———Write Buffer for the upper 5 bits of the PC---0 0000 ---0 0000
180hINDFAddressing this location uses contents of FSR to address data memory (not a physical register)0000 0000 0000 0000
181hOPTIONRBPU
182hPCLProgram Counter's (PC) Least Significant Byte0000 0000 0000 0000
183hSTATUSIRPRP1RP0T
184hFSRIndirect data memory address pointerxxxx xxxx uuuu uuuu
185h—Unimplemented——
186hTRISBPORTB Data Direction Register1111 1111 1111 1111
187hTRISFPORTF Data Direction Register1111 1111 1111 1111
188hTRISGPORTG Data Direction Register1111 1111 1111 1111
189h—Unimplemented——
18AhPCLATH
18BhINTCONGIEPEIET0IEINTERBIET0IFINTFRBIF0000 000x 0000 000u
18Ch—Unimplemented——
18Dh—Unimplemented——
18Eh—Unimplemented——
18Fh—Unimplemented——
190h—Unimplemented——
191h—Unimplemented——
192h—Unimplemented——
193h—Unimplemented——
194h—Unimplemented——
195h—Unimplemented——
196h—Unimplemented——
197h—Unimplemented——
198h—Unimplemented——
199h—Unimplemented——
19Ah—Unimplemented——
19Bh—Unimplemented——
19Ch—Unimplemented——
19Dh—Unimplemented——
19Eh—Unimplemented——
19Fh—Unimplemented——
Legend:x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as '0',
shaded locations are unimplemented, read as ‘0’.
Note1: Registers ADRES, ADCON0, and ADCON1 are not implemented in the PIC16C923, read as '0'.
2: These bits are reserved on the PIC16C923, always maintain these bits clear.
3: These pixels do not display, but can be used as general purpose RAM.
4: PIC16C923 reset values for PORTA: --xx xxxx for a POR, and --uu uuuu for all other resets,
PIC16C924 reset values for PORTA: --0x 0000 when read.
5: Bit1 of ADCON0 is reserved on the PIC16C924, always maintain this bit clear.
INTEDGT0CST0SEPSAPS2PS1PS01111 1111 1111 1111
OPDZDCC0001 1xxx 000q quuu
———Write Buffer for the upper 5 bits of the PC---0 0000 ---0 0000
Value on
Power-on
Reset
Value on all
other resets
DS30444E - page 22 1997 Microchip Technology Inc.
PIC16C9XX
4.2.2.1STATUS REGISTER
The ST ATUS register, shown in Figure 4-3, 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 STATUS 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: The C and DC bits operate as a borrow
and digit borrow bit, respectively, in subtraction. See the SUBLW and SUBWF
instructions for examples.
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)
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) (for borrow the polarity is reversed)
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: A subtraction is executed by adding the two’s complement of the second operand. For rotate (RRF,RLF) instructions, this bit is loaded with either the high or low order bit of the source register.
W = Writable bit
U = Unimplemented bit,
read as ‘0’
1 = Enables all un-masked interrupts
0 = Disables all interrupts
bit 6:PEIE: Peripheral Interrupt Enable bit
1 = Enables all un-masked peripheral interrupts
0 = Disables all peripheral interrupts
bit 5:T0IE: TMR0 Overflow Interrupt Enable bit
1 = Enables the TMR0 interrupt
0 = Disables the TMR0 interrupt
bit 4:INTE: RB0/INT External Interrupt Enable bit
1 = Enables the RB0/INT external interrupt
0 = Disables the RB0/INT external interrupt
bit 3:RBIE: RB Port Change Interrupt Enable bit
1 = Enables the RB port change interrupt
0 = Disables the RB port change interrupt
bit 2:T0IF: TMR0 Overflow Interrupt Flag bit
1 = TMR0 register has overflowed (must be cleared in software)
0 = TMR0 register did not overflow
bit 1:INTF: RB0/INT External Interrupt Flag bit
1 = The RB0/INT external interrupt occurred (must be cleared in software)
0 = The RB0/INT external interrupt did not occur
bit 0:RBIF: RB Port Change Interrupt Flag bit
1 = At least one of the RB7:RB4 pins changed state (see Section 5.2 to clear interrupt)
0 = None of the RB7:RB4 pins have changed state
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.
This register contains the individual enable bits for the
enable any peripheral interrupt.
peripheral interrupts.
FIGURE 4-6:PIE1 REGISTER (ADDRESS 8Ch)
R/W-0R/W-0U-0U-0R/W-0R/W-0R/W-0R/W-0
LCDIEADIE
bit7bit0
bit 7:LCDIE: LCD Interrupt Enable bit
bit 6:ADIE: A/D Converter Interrupt Enable bit
bit 5-4: Unimplemented: Read as '0'
bit 3:SSPIE: Synchronous Serial Port Interrupt Enable bit
bit 2:CCP1IE: CCP1 Interrupt Enable bit
bit 1:TMR2IE: TMR2 to PR2 Match Interrupt Enable bit
bit 0:TMR1IE: TMR1 Overflow Interrupt Enable bit
Note 1: Bit ADIE is reserved on the PIC16C923, always maintain this bit clear.
(1)
——SSPIECCP1IETMR2IETMR1IER = Readable bit
1 = Enables the LCD interrupt
0 = Disables the LCD interrupt
(1)
1 = Enables the A/D interrupt
0 = Disables the A/D interrupt
1 = Enables the SSP interrupt
0 = Disables the SSP interrupt
1 = Enables the CCP1 interrupt
0 = Disables the CCP1 interrupt
1 = Enables the TMR2 to PR2 match interrupt
0 = Disables the TMR2 to PR2 match interrupt
1 = Enables the TMR1 overflow interrupt
0 = Disables the TMR1 overflow interrupt
W = Writable bit
U = Unimplemented bit,
read as ‘0’
- n = Value at POR reset
DS30444E - page 26 1997 Microchip Technology Inc.
PIC16C9XX
4.2.2.5PIR1 REGISTER
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-7:PIR1 REGISTER (ADDRESS 0Ch)
R/W-0R/W-0U-0U-0R/W-0R/W-0R/W-0R/W-0
LCDIFADIF
bit7bit0
bit 7:LCDIF: LCD Interrupt Flag bit
bit 6:ADIF: A/D Converter Interrupt Flag bit
bit 5-4: Unimplemented: Read as '0'
bit 3:SSPIF: Synchronous Serial Port Interrupt Flag bit
bit 2:CCP1IF: CCP1 Interrupt Flag bit
bit 1:TMR2IF: TMR2 to PR2 Match Interrupt Flag bit
bit 0:TMR1IF: TMR1 Overflow Interrupt Flag bit
Note 1: Bit ADIF is reserved on the PIC16C923, always maintain this bit clear.
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.
(1)
——SSPIFCCP1IFTMR2IFTMR1IFR = Readable bit
W = Writable bit
U = Unimplemented bit,
- n = Value at POR reset
1 = LCD interrupt occurred (must be cleared in software)
0 = LCD interrupt did not occur
(1)
1 = An A/D conversion completed (must be cleared in software)
0 = The A/D conversion is not complete
1 = The transmission/reception is complete (must be cleared in software)
0 = Waiting to transmit/receive
Capture Mode
1 = A TMR1 register capture occurred (must be cleared in software)
0 = No TMR1 register capture occurred
Compare Mode
1 = A TMR1 register compare match occurred (must be cleared in software)
0 = No TMR1 register compare match occurred
PWM Mode
Unused in this mode
1 = TMR2 to PR2 match occurred (must be cleared in software)
0 = No TMR2 to PR2 match occurred
1 = TMR1 register overflowed (must be cleared in software)
0 = TMR1 register did not overflow
4.2.2.6PCON REGISTER
The Power Control (PCON) register contains a flag bit
to allow differentiation between a Power-on Reset
(POR) to an external MCLR
Reset or WDT Reset.
For various reset conditions see Table 14-4 and
Table 14-5.
FIGURE 4-8:PCON REGISTER (ADDRESS 8Eh)
U-0U-0U-0U-0U-0U-0R/W-0U-0
——————POR—R = Readable bit
bit7bit0
bit 7-2: Unimplemented: Read as '0'
bit 1:POR
bit 0:Unimplemented: Read as '0'
: 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)
W = Writable bit
U = Unimplemented bit,
- n = Value at POR reset
read as ‘0’
DS30444E - page 28 1997 Microchip Technology Inc.
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 an y reset, the upper bits of the PC
will be cleared. Figure 4-9 sho ws 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
(PCLATH<4:0> → PCH). The lower example in the fig-
ure shows how the PC is loaded during a CALL or GOTO
instruction (PCLATH<4:3> → PCH).
FIGURE 4-9:LOADING OF PC IN
DIFFERENT SITUATIONS
PCHPCL
128 70
PC
PCLATH<4:0>
5
PCLATH
PCHPCL
12 11 100
PC
2
8 7
PCLATH<4:3>
PCLATH
11
8
Instr
uction with
PCL as
Destination
ALU result
GOTO, CALL
Opcode <10:0>
PIC16C9XX
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
PIC16C9XX devices are capable of addressing a continuous 8K word block of program memory. The CALL
and GOTO instructions provide only 11 bits of address
to allow branching within any 2K program memory
page. When doing a CALL or GOTO instruction the
upper 2 bits of the address are provided by
PCLATH<4:3>. When doing a CALL or GOTO instruction, the user must ensure that the page select bits are
programmed so that the desired program memory
page is addressed. If a return from a CALL instruction
(or interrupt) is executed, the entire 13-bit PC is pushed
onto the stack. Therefore, manipulation of the
PCLATH<4:3> bits are not required for the return
instructions (which POPs the address from the stack).
Note:The PIC16C9XX ignores paging bit
PCLATH<4>, which is used to access program memory pages 2 and 3. The use of
PCLATH<4> as a general purpose
read/write bit is not recommended since
this may affect upward compatibility with
future products.
4.3.1COMPUTED GOTO
A computed GOT O is accomplished by adding an offset
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).
4.3.2STACK
The PIC16CXXX family has an 8 level 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
stack 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).
Example 4-1 shows the calling of a subroutine in
page 1 of the program memory . This example 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 produce 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-10.
A simple program to clear RAM locations 20h-2Fh
using indirect addressing is shown in Example 4-2.