Microchip PIC®16C5X EPROM-Based 8-Bit CMOS Microcontroller Series FEATURES • Oscillator start-up timer • Watchdog timer (WOT) with its own on-chip RC High Performance RISC-like CPU oscillator for reliable operation • Only 33 single word instructions to learn • Security EPROM fuse for code-protection • All single cycle instructions (200 ns) except for • Power saving SLEEP mode program branches which are two-cycle • EPROM fuse selectable oscillator options: • Operating speed: DC - 20 MHz clock input - Low cost RC oscillator: RC DC - 200 ns instruction cycle - Standard crystal/resonator: XT • 12-bit wide instructions - High speed crystal/resonator: HS • 8-bit wide data path - Power saving low frequency crystal: LP • 512 - 2K x 12 on-chip EPROM program memory • 25 - 72 x 8 general purpose registers (SRAM) CMOS Technology • 7 special function hardware registers • Low power, high speed CMOS EPROM technology • 2 level deep hardware stack • Fully static design • Direct, indirect and relative addressing modes for data • Wide operating voltage range: and instructions - Commercial: 2.5V to 6.25V - Industrial: 2.5V to 6.25V Peripheral Features - Automotive: 2.5V to 6.0V • 12 - 20 1/0 pins with individual direction control • Low power consumption • 8 bit real time clock/counter (RTCC) with 8-bit - < 2 mA typical@ 5V, 4 MHz programmable prescaler - 15 µA typical @ 3V, 32 KHz • Power on reset - < 3 µA typical standby current @ 3V, o·c to 70'C FIGURE A· PIN CONFIGURATIONS PDIP, SOIC, PDIP,SOIC, CERDIP Window CERDIP Window --RTCC •1 28 MCLR- - - Voo 2 27 osc1- - - - RA2 •1 18 RA1--- N/C 3 2S OSC2/CLKOUT - - 2 17 RAO--- - - Vss 4 2S RC?_.. - - - RA3 --RTCC 3 'ti 'ti 1S osc1-- N/C s 'ti 'ti 24 Ree--. --MCLR 4 00 .......... 1S OSC2/CLKOUT --- _..RAO 6 00 .......... 23 RCS_.. --vss s 0) 0) 14 Voo- _...RA1 7 0) 0) 22 RC4_... s 00 13 RB7--- _...RA2 8 00 21 Res--. ---ABO ---RB1 7 g: ~ 12 RBS--- _...RA3 _..ABO 9 10 UI UI .... UI 20 19 RC2_... Rc1--. ---RB2 8 11 RBS--- _...RB1 11 18 Rco--. ---RB3 9 10 RB4--- RB?_.. _...RB2 12 17 _...RB3 13 16 RB6_... _...RB4 14 1S RBS_.. SSOP SSOP - - - RA2 •1 20 RA1--- - - - RA3 2 19 RAO--- -RTCC 3 'ti 'ti 18 osc1-- __. Voo RC?_.. -MCLR 4 00 .......... 17 OSC2/CLKOUT - _..RAO RC6--. - - Vss s 0) 0) 1S Voo - - _...RA1 Res--. - - Vss s 00 UI UI 1S Voo - - _...RA2 RC4_... ---ABO 7 0) .r:i. 14 RB7--- _...RA3 RC3_... ---RB1 8 13 RBS - - - _..ABO RC2_... - - - RB2 9 12 RBS - - - _...RB1 Rc1--. - - - RB3 10 11 RB4 - - - RCO--. RB?_.. RB6_... RBS_.. © 1992 Microchip Technology Inc. 08300151 - page 1 PIC®16C5X Series Table of Contents 20.1.1 Host System Requirements; .............................................. 54 1.0 General Description ............................................................. 3 20.1.2 Emulator System Components .......................................... 54 1.1 Applications ..............•......., .................................................. 3 20.2 PIC-PAK™ Development Kit ............................................. 56 2.0 Architectural Description ...................................................... 3 20.3 PICALC Cross-Assembler ................................................. 56 2.1 Harvard Architecture ............................................................ 3 20.4 PICSIM™ Software Simulator ........................................... 56 2.2 Clocking Scheme/Instruction Cycle ......................;.............. 3 20.5 PICPRO™U Programmer .................................................. 56 2.3 Data Register File ................................................................ 4 20.6 PRO MASTER™ ................... ,........................................... 56 2.4 Arithmetic/Logic Unit (ALU) ................................................. 4 21.0 EPROM Programming ................................................ :...... 57 2.5 Program Memory ................................................................. 4 21.1 Prototype Programmers .................................................... 57 3.0 PIC16C5X Series Overview ................................................ 5 21.2 Production Quality Programmers ...................................... 57 3.1 UV Erasable Device.s ........................................................... 5 21.3 Gang Programmers ........................................................... 57 3.2 One-Time-Programmable (OTP) Devices ........................... 5 21.4 Factory Programming ........................................................ 57 3.3 Quick-Turnaround-Production (OTP) Devices ..................... 5 Index .......................................................................................... 59 4.0 Operational Register Files ................................................... 6 Sales and Support ........................................................................... 60 4.1 fO Indirect Data Addressing ............................................... 6 Table of Figures 4.2 f1 Real Time Clock/Counter Register (RTCC) .................. 6 2.1.1 PIC16C5X Series Block Diagram ........................................ 4 4.2.1 Using RTCC with External Clock ......................................... 6 2.2.1 Clock/Instruction Cycle ........................................................ 5 4.3 f2 Program Counter ........................................................... 8 4.1.1 RTCC Block Diagram (Simplified) ....................................... 6 4.4 Stack .............................................................:..................... 9 4.2.1 PIC16C5X Data Memory Map ............................................. 7 4.5 f3 Status Word Register .....................................,............ 11 4.2.2A RTCC Timing: INT Clock/No Prescale ................................ 8 4.5.1 Carry/Borrow and Digit Carry/Borrow Bits ......................... 12 4.2.2B RTCC Timing: INT Clock/Prescale 1:2 ................................ 8 4.5.2 Time Out and Power Down Status Bits (TO, PD) .............. 12 4.2.3 RTCC Timing with External Clock ....................................... 9 4.5.3 Program Page Preselect (PIC16C56, PIC16C57 Only) .... 12 4.3.1 Program Memory Organization ......................................... 1O 4.6 f4 File Select Register (FSA) ............................................ 12 4.5.1 Status Word Register f3 ................................................... 11 5.0 1/0 Registers (Ports) .......................................................... 13 5.4.1 Equivalent Circuit for a Single 1/0 Pin ............................... 13 ~ ~~-l- 5.5 5.5.1 : : : : : : : : : : : :::::l! 1/0 Programming Considerations ...................................... 14 Bidirectional 1/0 Ports ........................................................ 14 5.5.2.1 110 Port Read/Write Timing ............................................... 14 7.5.1 9.0.1 OPTION Register .............................................................. 15 Block Diagram RTCC/WDT Prescaler ............................... 17 12.2.1 Crystal Operation (or Ceramic Resonator) ........................ 24 12.2.2 External Clock Input Operation ......................................... 24 12.3.1 RC Oscillator (RC type only) ............................................. 24 5.5.2 Successive Operations on 1/0 Ports ................................. 14 13.1.1 External Power on Reset Circuit ........................................ 24 5.5.3 Operation in Noisy Environment ........................................ 14 13.1.2 Brown Out Protection Circuit ............................................. 25 6.0 General Purpose Registers ............................................... 15 13.1.3 Brown Out Protection Circuit ............................................. 25 7.0 Special Purpose Registers ................................................ 15 13.1.4 Simplified Power on Reset Block Diagram ........................ 26 7.1 W Working Register ....................................................... 15 13.1.5 Using External Reset Input ................................................ 26 7.2 TRISA 1/0 Control Register for Port A (f5) ....................... 15 13.1.6 Using On-Chip POR (FastVoo Rise Time) ....................... 26 7.3 TRISB 1/0 Control Register for Port B (f6) ....................... 15 13.1.7 Using On-Chip POR (SlowVoo Rise Time) ....................... 27 7.4 TRISC 1/0 Control Register for Port C (f7) ...................... 15 16.9.1 Electrical Structure of 1/0 Pins (RA, RB, RC) .................... 36 7.5 OPTION Prescaler/RTCC Option Register ....................... 15 16.9.2 Electrical Structure of MCl:Fi and RTCC Pins ................... 36 8.0 Reset Condition ................................................................. 16 17.0.1 RTCCTiming ..................................................................... 36 9.0 Prescaler ........................................................................... 16 17.0.2 Oscillator Start-up Timing (PIC16CXRC) .......................... 36 9.1 Switching Prescaler Assignment ....................................... 16 17.0.3 Input/Output Timing for 1/0 Ports (PIC16C5CRC) ............. 36 10.0 Basic Instruction Set Summary ......................................... 17 18.0.1 Typical RC Oscillator Frequency vs. Temperature ............ 37 10.1 Instruction Description ....................................................... 19 18.0.2 Typical RC Oscillator Frequency vs Voo ...................................... 37 11.0 Watchdog Timer (WOT) ..................................................... 23 18.0.3 Typical RC Oscillator Frequency vs Voo ........ ,............................. 37 11.1 WOT Period ....................................................................... 23 18.0.4 Typical RC Oscillator Frequency vs Voo ...................................... 38 11.2 WOT Programming Considerations ................................... 23 18.0.5 Typical IPo vs Voo (Watchdog Disabled 25'C) .................. 38 12.0 Oscillator Circuits .............................................................. 23 18.0.6 Typical IPO vs Voo (Watchdog Enabled 25"C) .................. 38 12.1 Oscillator Types ................................................................. 23 18.0.7 Maximum IPo vs Voo (Watchdog Disabled) ....................... 39 12.2 Crystal Oscillator .; ............................................................. 23 18.0.8 Maximum IPo vs Voe (Watchdog Enabled) ........................ 39 12.3 RC Oscillator ..................................................................... 23 18.0.9 VTH (Input Threshold Voltage) of 1/0 Pins vs Voo .............. 39 13.0 Oscillator Start-up Timer (OST) ......................................... 25 18.0.10 VIH, VIL for MCLR, RTCC and OSC1 13.1 Power On Reset (POR) ..................................................... 25 (in RC Mode) VS Voo ................................................................................. 40 14.0 Power Down Mode (SLEEP) ............................................. 27 18.0.11 VTH (Input Threshold Voltage) of OSC1 Input in XT, 14.1 Wake-Up ........................................................................... 27 HS, and LP Modes vs Voo ..........................................:......................... 40 15.0 Configuration Fuses .......................................................... 27 18.0.12 Typical loo vs Freq Ext Clock, 25"C .................................. 41 15.1 Customer ID Code ...... ;...................................................... 27 18.0.13 Maximum loo vs Freq Ext Clock, -40" to +85"C ................. 41 15.2 Code Protection ................................................................. 28 18.0.14 Maximum loo vs Freq Ext Clock, -55" to +125'C ............... 42 15.2.1 Verifying a Code-protected PIC ......................................... 28 18.0.15 WOT Timer Time-out Period vs Voo ................................................ 42 16.0 Electrical Characteristics ................................................... 29 18.0.16 Transconductance (gm) of HS Oscillator vs Voo ..................... 42 16.1 Absolute Maximum Ratings ....... ;....................................... 29 18.0.17 Transconductance (gm) of LP Oscillator vs Voo ...................... 43 16.3 DC Characteristics: PIC16C5X-RC, XT, HS, LP (Com) ... 30 18.0.18 Transconductance (gm) of XT Oscillator vs Voo ..................... 43 · 16.4 DC Characteristics: PIC16C5Xl-RC, XT, HS, LP (Ind) ..... 31 = 18.0.19 IOH VS VOH, Voo 3V ......................................................... 43 16.5 16.6 DC Characteristics: PIC16C5Xl-RC, XT, HS, LP (Auto) .. 32 DC Characteristics: PIC16C5X-RC, XT, HS, LP (Com) = 18.0.20 loL vs VOL, Voo 5V .......................................................... 43 18.0.21 loL vs \loL, Voo = 3V .......................................................... 44 16.7 and PIC16C5Xl-RC, XT, HS, LP (Ind) ............................... 33 DC Characteristics: PIC16C5Xl-RC, XT, HS, LP (Auto) .. 34 = 18.0.22 loH vs VoH, Voo 5V ......................................................... 44 20.1.1 PICMASTER ..................................................................... 55 16.8 AC Characteristics: PIC16C5X-RC, XT, HS, LP (Com) 20.1.2 PICMASTER System Configuration .................................. 55 and PIC16C5Xl·RC, XT, HS, LP (Ind) and (Auto) ............. 35 20.1.3 PICMASTER Typical Screen ............................................. 56 16.9 Electrical Structure of Pins ................................................ 36 17.0 Timing Diagrams ............................................................... 36 Table of Tables 18.0 DC & AC Charcteristics Graphs/Tables ............................. 37 1.0.1 Overview of PIC16C5X Devices ......................................... 3 19.0 Packaging Diagrams and Dimensions .............................. 45 2.1 :1 Pin Functions ...................................................................... 4 19.1 18-Lead Plastic Dual In-Line (.300 mil) .........................., .. 45 4.3.1 Program Counter Stack Width ............................................ 8 19.2 28-Lead Plastic Dual In-Line (.600 mil) ............................. 46 4.5.2.1 Events Affecting PD/TO Status Bits ................................. 12 19.3 28-Lead Dual In-Line Plastic (300 mil) .............................. 47 4.5.2.2 PD/TO Status After Reset ................................................ 12 19.4 18-Lead Plastic Surface Mount ......................................... 48 10.0.1 Instruction Set Summary ...............................,.................. 18 19.5 28-Lead Plastic Surface Mount ......................................... 49 12.2.1 Capacitor Selection for Ceramic Resonators ................... 24 19.6 20-Lead Plastic Surface Mount ......................................... 50 12.2.2 Capacitor Selection for Crystal Oscillator ......................... 24 19.7 28-Lead Plastic Surface Mount (.209 mil) ......................... 51 16.2 Pin Descriptions ............................................................... 29 19.8 Package Maiking Information ............................................ 52 18.0.1 RC Oscillator Frequencies ............................................... 38 20.0 Development Support ...........................................•............ 54 18.0.2 Input Capacitance for PIC16C54/56 ................................. 44 20.1 PICMASTER: High Performance Universal In-Circuit .......... . 18.0.3 Input Capacitance for PIC16C55/57 ................................. 44 Emulator System ................................................................ 54 21.2.1 List of Third Party Programmers ...................................... 57 05300151 - page 2 © 1992 Microchip Technology Inc. PIC®16C5X Series 1.0 GENERAL DESCRIPTION Programmable (OTP) versions are suitable for produc- tion in any volume. The customer can take full advan- The PIC16C5X from Microchip Technology is a family tage of Microchip's price leadership in OTP low cost, high performance, 8-bit, fully static, EPROM microcontroller while benefiting from the OTP flexibility. based CMOS microcontrollers. It employs a RISC-like architecture with only 33 single word/single cycle in- The PIC16C5X products are supported by an assem- structions to learn. All instructions are single cycle bler, a software simulator, an in-circuit emulator and a (200ns) except for program branches which take two production quality programmer. All the tools are sup- cycles. The PIC16C5X delivers performance an order of ported by IBM PC and compatible machines. magnitude higher than its competitors in similar price category. The 12-bit wide instructions are highly sym- 1.1 APPLICATIONS metrical resulting in 2: 1 code compression over other 8- bit microcontrollers in its class. The easy to use and The PIC 16C5X series fits perfectly in applications ranging easy to remember instruction set reduces development from high speed automotive and appliance motor control time significantly. to low-power remote transmitters/receivers, pointing devices, and telecom processors. The EPROM technol- The PIC16C5X products are equipped with special ogy makes customization of application programs microcontroller like features that reduce system cost (transmitter codes, motor speeds, receiver frequencies, and power requirements. The power on reset and oscil- etc.) extremely fast and convenient. The small footprint lator start up timer eliminate the need for external reset circuitry. There are fouroscillatorconfigurations to choose packages for through hole or surface mounting make from, including power saving LP (Low Power) oscillator this microcontroller series perfect for all applications and cost saving RC oscillator. Power saving SLEEP with space limitations. Low cost, low power, high perfor- mode, watchdog timer and code protection features mance, ease of use, and l/Oflexibilitymake the PIC16C5X improves system cost, power and reliablity. series very versatile even in areas where no microcontroller use has been considered before (e.g. The UV-erasable cerdip-packaged versions are ideal for timer functions, replacement of "glue" logic in larger code development while the cost-effective One Time systems, co-processor applications). TABLE 1.0.1 - OVERVIEW OF PIC16C5X DEVICES Part# EPROM RAM* l/Ot Package Options PIC16C54 512x12 32x8 13 18L windowed CERDIP, 18L PDIP, 18L SOIC (300 mil), 20L SSOP PIC16C55 512x12 32x8 21 28L windowed CERDIP, 28L PDIP (600 mil), 28L PDIP (300 mil), 28L SOIC (300 mil), 28L SSOP PIC16C56 1K x 12 32x8 13 18L windowed CERDIP, 18L PDIP, 18L SOIC (300 mil), 20L SSOP PIC16C57 2K x 12 80x 8 21 28L windowed CERDIP, 28L PDIP (600 mil), 28L PDIP (300 mil), 28L SOIC (300 mil), 28L SSOP * Including special function registers. ** The industrial versions and the HS version operates for VDD range of 4.5 V to 5.5 V (see DC specs). t Includes RTCC pin. 2.0 ARCHITECTURAL DESCRIPTION speed with overlapping instruction fetch and execution cycles. That means that, while one instruction is ex- 2.1 Harvard Architecture ecuted, the following instruction is already being read The PIC16C5X single-chip microcomputers are low- · from the program memory. A block diagram of the power, high-speed, full static CMOS devices containing PIC16C5X series is given in Figure 2.1.1. EPROM, RAM, 1/0, and a central processing unit on a single chip. 2.2 Clocking Scheme/Instruction Cycle The clock input (from pin OSC1) is internally divided by The architecture is based on a register file concept with four to generate four non overlapping quadrature clocks separate bus and memories for data and instructions namely 01, 02, 03 and 04. Internally, PC is incre- (Harvard architecture). The data bus and memory (RAM) mented every 01, instruction is fetched from program are 8-bits wide while the program bus and program memory and latched into instruction register in 04. ·it is memory (EPROM) have a width of 12-bits. This concept decoded and executed during the following 01 through allows a simple yet powerful instruction set designed to 04. The clocks and instruction execution flow is shown emphasize bit, byte and register operations under high in Figure 2.2.1. © 1992 Microchip Technology Inc. 08300151 - page 3 PIC®16C5X Series FIGURE 2.1.1 - PIC16C5X SERIES BLOCK DIAGRAM RTCC OSC1 OSC2 MCLR EPROM STACK1 CONFIGURATION EPROM PIN 512X 12TO STACK2 2048x12 'DISABLE" "OSC SELECT" 12 "CODE ~--~ PROTECT" OSCILLATOR/ TIMING& CONTROL 9 WDTTIME WDT/RTCC CLKOUT OUT PRESCALER 12 8 "SLEEP" - "OPTION" DIRECT ADDRESS DIRECT RAM FROMW ADDRESS GENERAL 5 8 PURPOSE REGISTER FILE 8 8 DATA BUS FROMW 8 RAO-RA3 RBO-RB7 fa RCO-RC7 (PIC16C55/C57 ONLY) TABLE 2.1.1 - PIN FUNCTIONS The register file is divided into two functional groups: operational registers and general purpose registers. Name Function The operational registers include the Real Time Clock Counter (RTCC) register, the Program Counter (PC), RAO- RA3 l/OPORTA RBO- RB7 1/0 PORT B the Status Register, the 1/0 registers (PORTs), and the RCO- RC7 1/0 PORT C (C55/57 only) File Select Register. The generaLpurpose registers are RTCC Real Time Clock/Counter used for data and control information under command of MGl::R Master Clear the instructions. OSC1 Oscillator (input) In addition, special purpose registers are used to control OSC2/CLKOUT Oscillator (output) the 1/0 port configuration, and the prescaler options. VDD Power supply Vss Ground N/C No (internal) Connection 2.4 Arithmetic/Logic Unit (ALU) The 8-bit wide ALU contains one temporary working 2.3 Data Register File register (W Register). It performs arithmetic and Bool- The 8-bit data bus connects two basic functional ele- ean functions between data held in the W Register and ments together: the Register File composed of up to 80 any file register. It also does single operand operations addressable 8-bit registers including the 1/0 Ports, and on either the W register or any file register. an 8-bit wide Arithmetic Logic Unit. The 32 bytes of RAM are directly addressable while a "banking" scheme, with 2.5 Program Memory banks of 16 bytes each, is employed to address larger data memories (Figure 4.2.1). Data can be addressed Up to 512 words of 12-bit wide on-chip program memory direct, or indirect using the file select register (f4). (EPROM) can be directly addressed. Larger program Immediate data addressing is supported by special memories can be addressed by selecting one of up to "literal" instructions which load data from program four available pages with 512 words each (Figure 4.3.1 ). memory into the W register. Sequencing of microinstructions is controlled via the DS3001 qi - page 4 © 1992 Microchip Technology Inc. PIC®16C5X Series FIGURE 2.2.1 • CLOCKS/INSTRUCTION CYCLE 01 02 03 I 04 01 02 03 I 04 01 02 OSC1 01 02 _ __, 03 - : - - - - - 041~ ,L---------' PC PC PC+ 1 PC+2 (Program Counter) OSC2/CLKOUT (RC Mode) Fetch INST PC Execute INST (PC-1) Fetch INST (PC+ 1) Execute INST (PC) Fetch INST (PC+2) Execute INST (PC+1) Program Counter (PC) which automatically increments 3.2 One-Time-Programmable (OTP) Devices to execute in-line programs. Program control opera- The availability of OTP devices is especially useful for tions, supporting direct, indirect, relative addressing customers expecting frequent code changes and up- modes, can be performed by Bit Test and Skip instruc- dates. OTP devices have the oscillator type pre-config- tions, Call instructions, Jump instructions or by loading ured by the factory, and they are tested only for this computed addresses into the PC. In addition, an on-chip special configuration (including voltage and frequency two-level stack is employed to provide easy to use ranges, current consumption). Table 3.2.1 gives an subroutine nesting. overview about devices available now and planned for future release. 3.0 PIC16C5X SERIES OVERVIEW A wide variety of EPROM and RAM sizes, number of The program EPROM is erased, allowing the user to 1/0 pins, oscillator types, frequency ranges, and packag- write the application code into it. In addition, the watch- ing options is available. Depending on application and dog timer can be disabled, and/or the code protection production requirements the proper device option can logic can be activated by programming special EPROM be selected using the information and tables in this fuses. The sixteen special EPROM bits for ID code section. When placing orders, please use the "PIC16C5X storage are also user programmable. Product Identification System" on the back page of this data sheet to specify the correct part number. 3.3 Quick-Turnaround-Production (QTP) Devices 3.1 UV Erasable Devices Microchip offers a OTP Programming Service for factory Four different device versions, as listed in Table 3.1.1, production orders. This service is made available for are available to accommodate the different EPROM, users who chose not to program a medium to high RAM, and 1/0 configurations. These devices are optimal quantity of units and whose code patterns have stabi- for prototype development and pilot series. The desired lized. The devices are identical to the OTP devices (see oscillator configuration is EPROM programmable as Table 3.2.1) but with all EPROM locations and fuse "RC", "XT", "HS" or "LP". An erased device is configured options already programmed by the factory. Certain as "RC" type by default. Depending on the selected code and prototype verification procedures do apply oscillator type and frequency, the operating supply volt- before production shipments are available. Please age must be within the same range as a OTP/OTP part contact your Microchip Technology sales office for more would be specified for. details. The available PIC development tools "PICPRO™ and PICPRO™II can program all PIC16C5X devices for prototyping and pilot series up to low-volume produc- tion. © 1992 Microchip Technology Inc. 08300151 - page 5 PIC®16C5X Series 4.0 OPERATIONAL REGISTER FILES RTS=1: The clock source for the RTCC or the pres- caler, if assigned to it, is the signal on the RTCC pin. Bit 4 of the OPTION register (RTE) deter- 4.1 fO Indirect Data Addressing mines, if an increment occurs on the falling (RTE=1) or rising (RTE=O) edge of the signal This is not a physically implemented register. Addressing presented to the RTCC pin. fO calls for the contents of the File Select Register to be used to select a file register. fO is useful as an indirect RTS=O: The RTCC register or its prescaler, respec- address pointer. For example, in the instruction ADDWF tively, will be incremented with the internal fO, W will add the contents of the register pointed to by instruction clock(= Fosc/4). The "RTE" bit in the the FSA (f4) to the content of the W Register and place OPTION register and the RTCC pin are "don't the result in W. care" in this case. However, the RTCC pin must be tied to VDD or Vss, whatever is con- If fO itself is read through indirect addressing (i.e. FSA= venient, to prevent unintended entering of test Oh), then OOh is read. If fO is written to via indirect modes and to reduce the current consumption addressing, the result will be a NOP. in low power applications. 4.2 f1 Real Time Clock/Counter Register As long as clocks are applied to the RTCC (from internal or external source, with or without prescaler), f1 keeps (RTCC) incrementing and just rolls over when the value "FFh" is reached. All increment pulses for f1 are delayed by two This register can be loaded and read by the program as instruction cycles. After writing to f1, for example, no any other register. In addition, its contents can be increment takes place for the following two instruction incremented by an external signal edge applied to the cycles. This is independent if internal or external clock RTCC pin, or by the internal instruction cycle clock source is selected. If a prescaler is assigned to the (CLKOUT=fosc/4). Figure 4.1.1 is a simplified block RTCC, the output of the prescaler will be delayed by two diagram of RTCC. cycles before f1 is incremented. This is true for in- structions that either write to or read-modify-write RTCC An 8-bit prescaler can be assigned to the RTCC by (e.g. MOVF f1, CLRF f1 ). For applications where RTCC writing the proper values to the PSA bit and the PS bits needs to be tested for zero without affecting its count, in the OPTION register. OPTION register is a special use of MOVF f1, W instruction is recommended. Timing register (not mapped in data memory) addressable diagrams in Figure 4.2.2 show RTCC read, write and using the 'OPTION' instruction. See section 7.5 for increment timing. details. If the prescaler is assigned to the RTCC, instructions writing to f1 (e.g. CLRF 1, or BSF1 ,5, ... etc.) 4.2.1 USING RTCC WITH EXTERNAL CLOCK clear the prescaler. When external clock input is used for RTCC, it is syn- The bit "ATS" (RTCC signal Source) in the OPTION chronized with the internal phase clocks. Therefore, the register determines, if f1 is incremented internally or external clock input must meet certain requirements. externally. FIGURE 4.1.1 - RTCC BLOCK DIAGRAM (SIMPLIFIED) DATA BUS fosc/4 0 RTCC PIN SYNC WITH n8 ~D-1 PROGRAMMABLE INTERNAL CLOCKS Psour RTCC (8) RTE PRESCALER (2 CYCLE DELAY) ATS PS2,PS1,PSO PSA Notes: 1. Bits, RTE, ATS, PS2, PS1, PSO are located in option register. 2. The prescaler is shared with Watchdog Timer (see Figure 9.0.1). DS30015I - page 6 © 1992 Microchip Technology Inc. PIC®16C5X Series FIGURE 4.2.1 - PIC16CSX DATA MEMORY MAP FILE ADDRESS 7 6 5 4 3 2 1 0 00 INDIRECT ADDR. (*) 01 RTCC CALL 10 9 B 7 6 5 4 3 2 1 0 10 9 B 7 6 5 4 3 2 1 0 RETLW 02 [ A10 IA9 JAB PC I STACK 1 1~1 STACK2 03 STATUS 04 FSR I-- 7 6 5 4 3 2 1 0 05 06 PORTA PORTB I TRISA TRISB 5 4 3 2 1 0 07 PORT C (**) 08 I-- ---1 t TRISC I OPTION 09 I-- ---1 OA GENERAL TO AND FROM I-- ---1 REGISTER FILE OB PURPOSE VIA ALU I-- ---1 J oc REGISTER w I-- ---1 OD L FILE I-- ----1 OE I-- - FROMP ROGRAM MEMORY OF BIT 6, 5 OF FSR: BANK SELECT (PIC16C57 ONLY) Joo J01 To T1 10 30 50 70 11 12 13 14 15 16 GENERAL PURPOSE GENERAL PURPOSE 17 REGISTER REGISTER FILE 18 FILE (ALL TYPES) (PIC16C57 ONLY) 19 1A 1B 1C 1D (BANK 0) (***) (BANK 1) (***) (BANK 2) (***) (BANK 3) (***) 1E 1F 3F 5F ?F (*) NOT A PHYSICALLY IMPLEMENTED REGISTER. SEE SECTION 4.0 OR DETAILS (**) FILE f7 IS A GENERAL PURPOSE REGISTER ON THE PIC16C54/C56 (***) BANK 0 IS AVAILABLE ON ALL MICROCONTROLLERS WHILE BANK 1 TO BANK 3 ARE ONLY AVAILABLE ON THE PIC16C57. (SEE SECTION 4.6 FOR DETAILS) © 1992 Microchip Technology Inc. 08300151 - page 7 PIC®16C5X Series Also there is some delay from the occurance of the Delay from external clock edge: Since the prescaler output external clock edge to the actual incrementing of RTCC. is synchronized with the internal clocks, there is a small Referring to Figure 4.1.1, the synchronization is done delay from the time the external clock edge occurs to the after the prescaler. The output of the prescaler is time the RTCC is actually incremented. Referring to sampled twice in every instruction cycle to detect rising Figure 4.2.3, the reader can see that this delay is or falling edges. Therefore, it is necessary for PsouT to be high for at least 2 tosc and low for at least 2 tosc where between 3 tosc and 7 tosc. Thus, for example, measur- tosc = oscillator time period. ing the interval between two edges (e.g. period) will be accurate within ±4 tosc (±200 ns @ 20 MHz). When no prescaler is used, PsouT (Prescaler output, see Figure 5) is the same as RTCC clock input and therefore 4.3 f2 Program Counter the requirements are: TRTH = RTCC high time 2 2tosc + 20 ns The program counter generates the addresses for up to TRTL = RTCC low time 2 2tosc + 20 ns 2048 x 12 on-chip EPROM cells containing the program instruction words (Figure 4.3.1 ). When prescaler is used, the RTCC input is divided by the asynchronous ripple counter-type prescaler and so the Depending on the device type, the program counter and prescaler output is symmetrical. N.TRT its associated two-level hardware stack is 9 - 11-bits = Then: PSOUT high time PSOUT low time 2 = wide. where TRT = RTCC input period and N = prescale value (2, 4, .... , 256). The requirement is, therefore N.TRT TABLE 4.3.1 - PROGRAM COUNTER STACK 2 2 tosc + 20 ns, or TRT 2 4 tosc + 40 ns 2 N WIDTH Part# PC width Stack width The user will notice that no requirement on RTCC high time or low time is specified. However, if the high time PIC16C54/PIC16C55 9 bit 9 bit or low time on RTCC is too small then the pulse may not PIC16C56 10 bit 10 bit be detected, hence a minimum high or low time of 1O ns PIC16C57 11 bit 11 bit is required. In summary, the RTCC input requirements The program counter is set to all ''1''s upon a RESET are: condition. During program execution it is auto TRT RTCC period 2 (4 tosc + 40 ns)/N incremented with each instruction unless the result of TRTH RTCC high time 2 10 ns that instruction changes the PC itself: TRTL RTCC low time 2 10 ns FIGURE 4.2.2A - RTCC TIMING: INT CLOCK/NO PRESCALE 'illlmlool~ 1 illlmlool~ 1 illlmlool~'illlmlool~'illlmlool~'illlmlool~'illlmlool~'illlmlool~' I I I I l I I I I PC (~~-P~C~-1~~~~P~C~~~~~P~C~+_1~~·~~P~C_+_2~~-~~P~C_+~3~~~~-P_C_+_4~~~~P_C_+_5~~~--'-P~C~+~6~~ (PROGRAM 1 INST~ MOVF Fl. W MOVF Fl, W MOVF F1, W MOVF Fl. W MOVF F1. W COUNTER) 1 MOVWF Fl RTCC RT x I RT+l x I Rf +2 x I NAT x I NAT x I NAT+ 1 X I NRT+2 x I NRT+3 0 I I t Write Fl I I t Read F1 t Read F1 I I t Read F1 reads I I t Read Fl reads I t Read Fl reads I I executed I reads NRT reads NRT I NRT+l I NRT+2 I NRT+3 FIGURE 4.2.28 - RTCC TIMING: INT CLOCK/PRESCALE 1:2 I 01102103104 1 01102103104 1 01102103104 1 01102I03I04 1 01I02I03I04 1 01102103104 1 01102103104 1 01102103104 1 I I I I I I I I I PC PC-1 PC PC+l PC+2 PC+3 PC+4 ~ PC+S PC+6 (PROGRAM I MOVWFF1 MOVFF1, W MOVF Fl, W MOVF Fl, W MOVFF1, W MOVF F1, W COUNTER) I RTCC RT RT+1 1 NRT x I NRT+1 I t WriteF1 I t ReadF1 I t Read Fl I tRead Fl t Read Fl t Read F1 executed reads NRT reads NRT reads NRT reads NRT reads NRT DS30015I - page 8 © 1992 Microchip Technology Inc. PIC®16C5X Series a) "GOTO" instructions allow the direct loading of the "200" (page 1). A "GOTO xxx" at "200" will return the lower 9 program counter bits (PC <8:0> ). In case of program to address "xxx" on page "O" (assuming that the PIC16C56/PIC16C57, the upper two bits of PC page preselect bits in file register f3 are "O"). (PC<10:9>) are loaded with page select bits PA 1, Upon a RESET condition, page 0 is pre-selected while PAO (bits 6,5 status register). Thus GOTO allows the program counter addresses the last location in the jump to any location on any page. last page. Thus, a "GOTO" instruction at this location will b) "CALL" instructions load the lower 8-bit of the PC automatically cause the program to continue in page 0. directly while the ninth bit is cleared to "O". The PC value, incremented by one, will be pushed into the 4.4 Stack stack. In case of PIC16C56, PIC16C57, the upper two bits of PC (PC<10:9>) are loaded with Page The PIC16C5X series employs a two level hardware Select bits PA 1, PAO (bits 6,5 status register). push/pop stack (Figure 4.3.1 ). c) "RETLW" instructions load the program counter with the top of stack contents. CALL instructions push the current program counter d) If PC is the destination in any instruction (e.g. value, incremented by "1 ", into stack level 1. Stack level MOVWF 2, ADDWF 2, or BSF 2,5) then the com- 1 is automatically pushed to level 2. If more than 2 puted 8-bit result will be loaded into the low 8-bits of subsequent "CALL"s are executed, only the most recent program counter. The ninth bit of PC will be cleared. two return addresses are stored. In case of PIC16C56/PIC16C57, PC<10:9> will be For the PIC16C56 and PIC16C57, the page preselect loaded with Page Select bits PA1, PAO (bits 6,5 in bits of f3 will be loaded into the most significant bits of the status register). program counter. The ninth bit is always cleared to "O" upon a CALL instruction. This means that subroutine It should be noted that because bit 8 (ninth bit) of PC is entry addresses have to be located always within the cleared in CALL instruction or any instruction which lower half of a memory page (addresses 000-0FF, 200- writes to the PC (e.g. MOVWF 2), all subroutine calls or 2FF, 400-4FF, 600-6FF). However, as the stack has computed jumps are limited to the first 256 locations of always the same width as the PC, subroutines can be any program memory page (512 words long). called from anywhere in the program. RETLW instructions load the contents of stack level 1 MORE ON PROGRAM MEMORY PAGE SELECT into the program counter while stack level 2 gets copied (PIC16C56/PIC16C57 ONLY): into level 1. If more than 2 subsequent "RETLW"s are executed, the stack will be filled with the address previ- Incrementing the program counter when it is pointing to ously stored in level 2. For the PIC16C56 and PIC16C57, the last address of a selected memory page is also the return will be always to the page from where the possible and will cause the program to continue in the subroutine was called, regardless of the current setting next higher page. However, the page pre-select bits in f3 of the page pre-select bits in file register f3. Note that the will not be changed, and the next "GOTO", "CALL", W register will be loaded with the literal value specified "ADDWF 2", "MOVWF 2" instruction will return to the in the RETLW instruction. This is particularly useful for previous page, unless the page pre-select bits have the implementation of "data" tables within the program been updated under program control. For example, a memory. "NOP" at location "1 FF" (page 0) increments the PC to FIGURE 4.2.3 - RTCC TIMING WITH EXTERNAL CLOCK 1 1 Q1IQ2103IQ4 1I Q1102IQ3IQ4 1I Q1IQ2IQ3IQ4 1I Q1IQ2IQ3IQ4 1I , Small pulse , EXT CLOCK INPUT OR ' PRESCALER OUT (NOTE 2) '\.l...J........._........__ ___;__1 '-'-'-""'--'-'.....,__ _ _ _ _ _,;__j \ misses sam~ling EXT CLOCK/PRESCALER OUTPUT AFTER SAMPLING t~,--~ ..______ __, t t t I (note 3) I INCREMENT RTCC (Q4) :--'-----~-----' RTCC Notes: 1. Delay from clock input change to RTCC increment is 3 tosc to 7 tosc. (Duration of Q = tosc). Therefore, the error in measuring the interval between two edges on RTCC input = ± 4 tosc max. 2. External clock if no prescaler selected, Prescaler output otherwise. 3. The arrows indicate the points in time where sampling occurs. © 1992 Microchip Technology Inc. 08300151 - page 9 PIC®16C5X Series FIGURE 4.3.1- PROGRAM MEMORY ORGANIZATION ~------ GOTO, CALL, INST WITH PC AS DESTINATION ............... FROM f3, BIT 6 (PIC16C57 ONLY) . - - - - - - - - - GOTO, CALL, INST WITH PC AS DESTINATION ............... FROM f3, BIT 5 (PIC16C56/C57 ONLY) ~-- -{~~~~ 1Nsr.wirH·;;c·,;;.5·c;EsriNAr10N·::::::::. ~~i:;;s~·~?M INsrnucnoN woRD c-{~oW~~L~iiSiiES'iiNiiT1CiN ::::::: ~=A~ INSTRUCTION WORC ~[~---+-~----1---~l_ RETLW J PC (f2) A10 A09 A08 A07-AOO J 9-11 BIT CALL -l STACK LEVEL 1 [ RETLW CALL J / 1 ) 8 STACK LEVEL 2 }' 2 000 MAX. EPROM ADDRESS FOR: OFF PAGEO - 100 1FF - - PIC16C54/PIC16C55 200 01 2FF i----..- PAGE 1 300 3FF - - - PIC16C56 400 10 4FF ~ PAGE2 500 5FF 600 11 6FF L- PAGE3 700 ?FF ~--------~ ---PIC16C57 08300151 - page 10 © 1992 Microchip Technology Inc. PIC®16C5X Series 4.5 f3 Status Word Register different than intended. For example, CLRF f3 will clear all bits except for TO and PD and then set the Z bit and This register contains the arithmetic status of the ALU, leave status register as OOOUU100 (where U = un- the RESET status, and the page preselect bits for larger changed). program memories than 512 words (PIC16C56, It is recommended, therefore, that only BCF, BSF and PIC16C57). MOVWF instructions are used to alter the status regis- The status register (f3) can be destination for any ters because these instructions do not affect any status instruction like any other register. However, the status bit. bits are set after the following write. Furthermore, TO and PD bits are not writable. Therefore, the result of an For other instructions, affecting any status bits, see instruction with status register as destination may be section "Instruction Set Summary" (Table 10.0.1 ). FIGURE 4.5.1 -STATUS WORD REGISTER f3 RESET CONDITION: (7) (6) (5) (4) (3) (2) (1) (0) PA2,PA1, PAO cleared to 'O'. [ PA21 PA1 PAO 1 TO l PD l z 1 De] c J TO, PD are set or reset as shown in Table 4.5.1.1 Z, DC, C are unknown on power on reset and \_ [ unchanged in any other reset. CARRY/BORROW BIT: For ADDWF and SUBWF instructions, this bit is set if there is a carry out from the most significant bit of the resultant. Note that 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. DIGIT CARRY/BORROW BIT: For ADDWF and SUBWF instructions, this bit is set if there is a carry out from the 4th low order bit of the resultant. ZERO BIT: Set if the result of an arithmetic or logic operation is zero. POWER DOWN BIT: Set to "1" during power up or by a CLRWDT command. This bit is reset to "O" by a SLEEP instruction. TIME-OUT BIT: Set to "1" during power up and by the CLRWDT and SLEEP command. This bit is reset to "O" by a watchdog timer time out. PIC16C54/C55 : Two general purpose read/write bits PIC16C56 : BIT 5 .. . Page preselect bit = 0 Page 0 (000 - 1 FF) 1 = Page 1 (200 - 3FF) BIT 6 ... General purpose read/write bit PIC16C57 : Two page preselect bits 00 = Page 0 (000 - 1FF) = 01 Page 1 (200 - 3FF) 10 = Page 2 (400 - 5FF) = 11 Page 3 (600 - ?FF) BIT 7: General purpose read/write bit (reserved for future use) © 1992 Microchip Technology Inc. 05300151 - page 11 PIC®16C5X Series 4.5.1 CARRY/BORROW AND DIGIT CARRY/ TABLE 4.5.2.2 - PD/TO STATUS AFTER BORROW BITS: RESET The Carry bit (C) is a carry out in addition operation TO PD RESET was caused by (ADDWF) and a borrow out in subtract operation (SUBWF). 0 0 WOT wake-up from SLEEP It is also affected by RRF and RLF instructions. The 0 1 WOT time-out (not during SLEEP) following examples explain carry/borrow bit operation: 1 0 MCLR wake-up from SLEEP ; SUBWF Example #1 1 1 Power-up ' clrf Ox20 ;f (20h)=0 x x = Low pulse on MCLR input movlw 1 ;wreg=l subwf Ox20 ;f(20h)=f(20h)-wreg=0-l=FFh Note: The PD and TO bit maintain their status (X) ;Carry=O: Result is negative until an event of Table 4.5.2.1 occurs. A low- ;' SUBWF Example #2 pulse on the MCLR input does not change the movlw OxFF PD and TO status bits. movwf Ox20 ';f(20h)=FFh clrw ;wreg=O subwf Ox20 ;f(20h)=f(20h)-wreg=FFh-0=FFh 4.5.3 PROGRAM PAGE PRESELECT (PIC16C56. ;Carry=l :Result is positive PIC16C57 ONLY) Bits 5-6 of the STATUS register are defined as PAGE The digit c~erates in the same way as the carry bit, address bits PAO - PA 1, and are used to preselect a i.e. it is a borrow in subtract operation. program memory page. When executing a GOTO, CALL, or an instruction with PC (f2) as destination (e.g. 4.5.2 TIME OUT AND POWER DOWN STATUS MOVWF 2), PAO - PA 1 are loaded into bit A9-A 10 of the BITS (TO. PD) program counter, selecting one of the available program memory pages. The direct address specified in the The "TO" and "PD" bits in the status register f3 can be instruction is only valid within this particular memory tested to determine if a RESET condition has been page. caused by a watchdog timer time-out, a power-up con- RETLW instructions do not change the page preselect dition, or a wake-up from SLEEP by the watchdog timer bits. or MCLR pin. Upon a RESET condition, PAO-PA2 are cleared to "O"s. These status bits are only affected by events listed in Table 4.5.2.1. 4.6 f4 File Select Register (FSR) PIC16C54/C55/C56 TABLE 4.5.2.1 - EVENTS AFFECTING PD/ TO STATUS BITS Bits 0-4 select one of the 32 available file registers in the indirect addressing mode (that is, calling for file fO in any of the file oriented instructions). Event TO PD Remarks Bits 5-7 of the FSR are read-only and are always read as "one"s. Power-up 1 1 If no indirect addressing is used, the FSR can be used WOT Timeout 0 x No effect on PD as a 5-bit wide general purpose register. SLEEP instruction 1 0 CLRWOT instruction 1 1 PIC16C57 ONLY Note: A WOT timeout will occur regardless of the Bit 5 and 6 of the FSR select the current data memory status of the TO bit. A SLEEP instruction will be bank (Figure 4.2.1 ). executed, regardless of the status of the PD bit. The lower 16 bytes of each bank are physically identical Table 4.5.2.2 reflects the status of PD and TO and are always selected when bit 4 of the FSR (in case after the corresponding event. of indirect addressing) is "O", or bit 4 of the direct file register address of the currently executing instruction is "O" (e.g. MOVWF 08). Only if bit 4 in the above mentioned cases is "1", bits 5 and 6 of the FSR select one of the four available register banks with 16 bytes each. Bit 7 is read-only and is always read as "one." 08300151 - page 12 © 1992 Microchip Technology Inc. PIC®16C5X Series 5.0 VO REGISTERS (PORTS} 5.4 VO INTERFACING The 1/0 registers can be written and read under program The equivalent circuit for an 1/0 port bit is shown in control like any other register of the register file. How- Figure 5.4.1. All ports may be used for both input and ever, "read" instructions (e.g. MOVF 6,W) always read output operations. For input operations these ports are the 1/0 pins, regardless if a pin is defined as "input" or non-latching. Any input must be present until read by an "output." Upon a RESET condition, all 1/0 ports are input instruction (e.g. MOVF 6, W). The outputs are defined as "input" (= high impedance mode) as the 1/0 latched and remain unchanged until the output latch is control registers (TRISA, TRISB, TRISC) are all set to rewritten. To use a port pin as output, the corresponding "ones." direction control bit (in TRISA, TRISB, TRISC) must be The execution of a "TRIS f" instruction with correspond- set to zero. For use as an input, the corresponding TRIS ing "zeros" in the W-register is necessary to define any bit must be "one". Any 1/0 pin can be programmed of the 1/0 pins as output. individually as input or output. 5.1 f5 (Port A) 4-bit 1/0 register. Low order 4 bits only are used (RAO - RA3). Bit 4 - 7 are unimplemented and read as "zeros." 5.2 f6 (Port B) 8-bit 1/0 register. 5.3 f7 (Port C) PIC16C55/C57: 8-bit 1/0 register. PIC16C54/C56: General purpose register. FIGURE 5.4.1 - EQUIVALENT CIRCUIT FOR A SINGLE 1/0 PIN FROM- D 0 Voo DATA DATA BUS LATCH 01 "WRITE" - CK ~ p TO DATA BUS 1/0 PIN "READ" FROM D 0 W-REGISTER 1/0 CONTROL 02 "TRISf" - LATCH Q ~ N vJ CK SET "RESET" © 1992 Microchip Technology Inc. DS300151- page 13 PIC®16C5X Series 5.5 1/0 PROGRAMMING CONSIDERATIONS 5.5.1 BIDIRECTIONAL 1/0 PORTS 5.5.2 ·suCCESSIVE OPERATIONS ON 1/0 PORTS a) Some instructions operate internally as read fol- The actual write to an 1/0 port happens at the end of an lowed by write operations. The BCF and BSF in- instruction cycle, whereas for reading, the data must be structions, for example, read the entire port into the valid at the beginning of the instruction cycle (see figure CPU, execute the bit operation, and re-output the 5.4.2.1 ). Therefore, care must be exercised if a write result. Caution must be used when these instructions followed by a read operation is carried out on the same are applied to a port where one or more pins are used 1/0 port. The sequence of instructions should be such to as input/outputs. For example, a BSF .operation on allow the pin voltage to stabilize (load dependent) before bit 5 of. f6 (Port 8) will cause all eight bits of f6 to be the next instruction which causes that file to be read into read into the CPU. Then the BSF operation takes the CPU is executed. Otherwise, the previous state of place on bit 5 and f6 is re-output to the output latches. that pin may be read into the CPU rather than the new If another bit of f6 is used as a bidirectional 1/0 pin state. When in doubt, it is better to separate these (say bit 0) and it is defined as an input at this time, the instructions with a NOP or an other instruction not input signal present on the pin itself would be read accessing this 1/0 port. into the CPU and re-written to the data latch of this particular pin, overwriting the previous content. As 5.5.3 OPERATION IN NOISY ENVIRONMENT long as the pin stays in the input mode, no problem occurs. However, if bit Ois switched into output mode In noisy application environments, such as keyboards later on, the content of the data latch may now be which are exposed to ESD (Electro Static Discharge), unknown. register contents can get corrupted due to noise spikes. The on-chip watchdog timer will take care of all situ- b) A pin actively outputting a "O" or "1" should not be ations involving program sequence "lock~ups." How" driven from external devices at the same time in ever, if an 1/0 control register gets corrupted, the pro- order to change the level on this pin ("wired-or", gram sequence may still be executed properly although "wired-and"). The resulting high output currents may an input pin may have switched unintentionally to an damage the chip. output. In this case, the program would always read the For "wired-or" outputs (assuming negative logic), it is same value on this pin. This may result, for example, in recommended to use external pull-up resistors on a keyboard "lock-up" situation without leading to a the corresponding pins. The pin should be left in watchdog timer timeout. Thus, it is recommended to high-impedance mode, unless a "O" has to be output. redefine all 1/0 pins in regular time intervals (inputs as Thus, external devices can drive this pin "O" as well. well as outputs). The optimal strategy is to update the "Wired-and" outputs can be realized in the same 1/0 control register every time before reading input data way, but with external pull-down resistors and only or writing output data . actively driving the "1" level from the PIC. The resistor values are user selectable, but should not force output currents above the specified limits (see DC Characteristics). FIGURE 5.5.2.1 - 1/0 PORT READ/WRITE TIMING I 01 I 02 I 03 I 04 I 01 I 02 I 03 I 04 I 01 I 02 I 03 I 04 I 01 I 02 I 03 I 04 I Note: I I I I I I PC PC x PC+ 1 X~--+-~P~C~+=2-.....X~-~P~C~+~3_ _, This example shows Instruction , MOVWF f6 MOVF f6, W NOP NOP write to port B followed fetched ' Write to f6 ' Read f6 (Port B) ' by a read from port B. (Port B) Note that the data setup RB (7:0) I Wit time = (0.25 TCY - TPD) ~,~~~~~~~~~~~--lf""1"~~t~~~~~~~~~~- where TCY = instruction I ,' Port pin cycle. Therefore, at I I , , sampled here , higher clock frequencies, --, ;4- write followed by a read Execute 1 TPo Execute Execute may be problematic. MOVWF f6 MOVF f6, W NOP DS30015I - page 14 © 1992 Microchip Technology Inc. PIC®16C5X Series 6.0 GENERAL PURPOSE REGISTERS 7.2 TRISA 1/0 Control Register For Port A (f5) PIC16C54/C55/C56: Only bits 0 - 3 are available. The corresponding 1/0 port f08h - f1 Fh: are general purpose register files. (f5} is only 4-bit wide. PIC16C57 only: 1/0 Control Register For f08h - fOFh: are general purpose register files which Port B (f6) are always selected, independent of bank select. 7.4 TRISC 1/0 Control Register For f1 Oh - f1 Fh: general purpose register files in memory Port C (f7) bank 0. The 1/0 control registers will be loaded with the content f20h - f2Fh: physically identical to fOO - fOF. of the W register by executing of the TRIS f instruction. f30h - f3Fh: general purpose register files in memory A "1" in the 1/0 control register puts the corresponding bank 1. 1/0 pin into a high impedance mode. A "O" puts the f40h - f4Fh: physically identical to fOO - fOF. contents of file register f5, f6, or f7 , respectively, out on f50h - f5Fh: general purpose register files in memory the selected 1/0 pins. bank 2. These registers are "write-only" and are set to all "ones" f60h - f6Fh: physically identical to fOO - fO. upon a RESET condition. f70h - f7Fh: general purpose register files in memory bank 3. 7.5 OPTION Prescaler/RTCC Option Register 7.0 SPECIAL PURPOSE REGISTERS Defines prescaler assignment (RTCC or WOT), pres- calervalue, signal source and signal edge for the RTCC. 7.1 W Working Register The OPTION register is "write-only" and is 6 bit wide. Holds second operand in two operand instructions and/ By executing the "OPTION" instruction, the contents of or supports the internal data transfer. the "W" register will be transferred to the option register. Upon a RESET condition, the option register is set to all "ones." FIGURE 7.5.1 - OPTION REGISTER 5 4 3 2 0 1 1 1 1 1 I RTS RTE PSA PS2 PS1 PSO RESET VALLIE: 111111 b ~ T I PRE SCALER VALUE RTCC RATE WOT RATE 0 0 0 1 : 2 1 : 1 0 0 1 1 : 4 1 : 2 0 0 1 : 8 1 : 4 0 1 1 1 : 16 1 : 8 0 0 1 : 32 1 : 16 0 1 1 : 64 1 : 32 0 1 : 128 1 : 64 1 : 256 1 : 128 ' - - - - - - - - - PRESCALER ASSIGNMENT BIT: 0 .... RTCC 1 .... WOT ~-------- RTCC SIGNAL EDGE: 0 .... INCREMENT ON LOW-TO-HIGH TRANSITION ON RTCC PIN 1 .... INCREMENT ON HIGH-TO-LOW TRANSITION ON RTCC PIN RTCC SIGNAL SOURCE: 0 .... INTERNAL INSTRUCTION CYCLE CLOCK (CLKOUT) 1 .... TRANSITION ON RTCC PIN © 1992 Microchip Technology Inc. 08300151 - page 15 PIC®16C5X Series 8.0 RESET CONDITION When assigned to the RTCC, all instructions writing to the RTCC (e.g. CLRF 1, MOVWF 1, BSF 1,x .... etc.) will A RESET condition can be caused by applying power to clear the prescaler. When assigned to WOT, a CLRWDT the chip (power-up), pulling the MCLR input "low", or by instruc,tion will clear the prescaler along with the watch- a Watchdog timer timeout. The device will stay in RE- dog timer. SET as long as the oscillator start-up timer (OST) is active or the MCLR input is "low." 9.1 Switching Prescaler Assignment The oscillator start-up timer is activated as soon as MCLR input is sensed to be high. This implies that in CHANGING PRESCALER FROM RTCC TO WOT case of power on reset with MCLR tied to Voo the OST The prescaler assignment is fully under software con- starts from power-up. In case of WOT time-out, it will trol, i.e., it can be changed "on the fly" during program start at the end of the time-out (since MCLR is high). In execution. To avoid an unintended device RESET, the case of MCLR reset, the OST will start when MCLR goes following instruction sequence must be executed when high. The nominal OST time-out period is 18 ms. See changing the prescaler assignment from RTCC to WOT: section 13.0 for detailed information on OST and power on reset. 1. MOVLW B'xxOxOxxx' ; Select internal clock and select new 2.0PTION ; prescaler value. If new prescale value During a RESET condition the state of the PIC is defined ; is= '000' or '001', then select any other as: ; prescale value temporarily. 3. CLRF 1 ; Clear RTCC and~- • The oscillator is running, or will be started (power~ 4. MOVLW B'xxxx1xxx' ; Select WOT, do not change prescale up or wake-up from SLEEP). ;value. • All 1/0 port pins (RAO- RA3, RBO- RB7, RCO - RC7) 5.0PTION are put into the high-impedance state by setting the 6.CLRWOT ; Clears WOT and~­ "TRIS" registers to all "ones" (= input mode). f7. MOVLW B'xxxx1xxx' ; Select new prescale value. • The Program Counter is set to all "ones" (1 FFh in la. OPTION PIC16C54/55, 3FFh in PIC16C56 and 7FFh in PIC16C57). Step 1 and 2 are only required if an external RTCC • The OPTION register is set to all "ones". source is used. Steps 7 and 8 are necessa~ only if the • The Watchdog Timer and its prescaler are cleared. desired prescale value is '000' or '001'. • The upper three bits (page select bits) in the Status CHANGING PRESCALER FROM WOT TO RTCC Register (f3) are cleared to "zero." • "RC" devices only: The· "CLKOUT" signal on the To change prescaler from WOT to RTCC use the follow- OSC2 pin is held at a"low" level. ing sequence: 1.CLRWOT ; Clear WOT and~ 9.0 PRESCALER 2.MOVLW B'xxxxOxxx' ; Select RTCC, new prescale value ; and clock source An 8-bit counter is available as a prescalerforthe RTCC, 3. OPTION or as a post-scaler for the watchdog timer, respectively (Figure9.0.1). For simplicity, this counter is being referred to as "prescaler" throughout this data sheet. Note that there is only one prescaler available which is mutually exclusively shared between the RTCC and the watch- dog timer. Thus, a prescaler assignment for the RTCC means that there is no prescaler for the watchdog timer, and vice versa. The PSA and PSO-PS2 bits in the OPTION register determine the prescaler assignment and pre-scale ratio. DS30015I - page 16 © 1992 Microchip Technology Inc. PlC®16C5X Series FIGURE 9.0.1 - BLOCK DIAGRAM RTCC/WDT PRESCALER CLKOUT (=Fosc/4) DATA BUS f, ~ M u x M SYNC u 2 RTCC (f1) PIN x CYCLES RTE 0 RTS PSA 8-BIT COUNTER WATCH DOG TIMER 8-T0-1 MUX - PSO-PS2 PSA WDTENABLE MUX PSA EPROM FUSE WDT Note: RTE, ATS, PSA, PSO-PS2 TIMEOUT are bits in the OPTION register. 10.0 BASIC INSTRUCTION SET counter is changed as a result of an instruction. In this SUMMARY case, the execution takes two instruction cycles. One instruction cycle consists of four oscillator periods. Thus, Each PIC instruction is a 12-bit word divided into an OP for an oscillator frequency of 4 MHz, the normal instruc- CODE which specifies the instruction type and one or tion execution time is 1 µsec. If a conditional test is true more operands which further specify the operation of the or the program counter is changed as a result of an instruction. The PIC instruction set summary in Table instruction, the instruction execution time is 2 µsec. 10.0.1 lists byte-oriented, bit-oriented, and literal and control operations. Notes to Table 10.0.1 For byte-oriented instructions, "f" represents a file regis- ter designator and "d" represents a destination designa- Note 1: The 9th bit of the program counter will be forced tor. The file register designator specifies which one of to a "zero" by any instruction that writes to the the 32 PIC file registers is to be utilized by the instruction. PC (f2) except for GOTO (e.g. CALL, MOVWF For the PIC16C57, bit 5 and 6 in the FSR determine the 2 etc.). See section 4.3 on page 8 for details. selected register bank. Note 2: When an 1/0 register is modified as a function of The destination designator specifies where the result of itself ( e.g. MOVF 6, 1 ), the value used will be the operation is to be placed. If "d" is zero, the result is that value present on the pins themselves. For placed in the W register. If "d" is one, the result is placed example, if the data latch is "1" for a pin con- in the file register specified in the instruction. figured as output and is driven low by an exter- nal device, the data will be written back with a For bit-oriented instructions, "b" represents a bit field 'O'. designator which selects the number of the bit affected Note 3: The instruction "TRIS f" , where f = 5,6, or 7 by the operation, while "f" represents the number of the causes the contents of the W register to be file in which the bit is located. written to the tristate latches of the specified file For literal and control operations, "k" represents an eight (port). A "one" forces the pin to a high imped- or nine bit constant or literal value. ance state and disables the output buffers. Note 4: If this instruction is executed on file register f1 All instructions are executed within one single instruc- (and, where applicable, d=1 ), the prescalerwill tion cycle, unless a conditional test is true or the program be cleared if assigned to the RTCC. © 1992 Microchip Technology Inc. 08300151- page 17 PIC®16C5X Series TABLE 10.0.1 - INSTRUCTION SET SUMMARY (11-6) (5) (4- 0) BYTE -ORIENTED FILE REGISTER OPERATIONS I OPCODE I d I f(FILE #) I d = 0 for destination W d = 1 for destination f Instruction-Binary (Hex) Name Mnemonic, Operands Operation Status Affected Notes 0001 lldf ff ff lCf Add Wand f ADDWF f, d W+f~d C,DC,Z 1,2,4 0001 Oldf ffff 14f ANDWandf ANDWF f, d w &f~d z 2,4 0000 Ollf ffff 06f Clear f CLRF f 0 ~f z 4 0000 0100 0000 040 ClearW CLRW - o~w z 0010 Oldf ffff 24f Complement f COMF f, d i~d z 2,4 0000 lldf ffff OCf Decrement f DECF f, d f -1 ~ d z 2,4 0010 lldf ffff 2Cf Decrement f,Skip if Zero DECFSZ f, d f - 1 ~ d, skip if zero None 2,4 0010 lOdf ffff 28f Increment f INCF f, d f+ 1 ~d z 2,4 0011 lldf ffff 3Cf Increment f,Skip if zero INCFSZ f, d f + 1 ~ d, skip if zero None 2,4 0001 OOdf ffff lOf Inclusive OR Wand f IORWF f, d Wvf~d z 2,4 0010 OOdf ffff 20f Move f MOVF f, d f~d z 2,4 0000 OOlf ffff 02f Move Wtof MOVWF f w~t None 1,4 0000 0000 0000 000 No Operation NOP - - None 0011 Oldf ff ff 34f Rotate left f RLF f, d f(n) ~ d(n+1), C ~ d(O), f(7) ~ C c 2,4 0011 OOdf ff ff 30f Rotate right f RRF f, d f(n) ~ d(n-1), C ~ d(7), f(O) ~ C c 2,4 0000 lOdf ffff 08f Subtract W from f SUBWF f, d f - w ~ d [f + w+ 1 ~ d] C,DC,Z 1,2,4 0011 lOdf ffff 38f Swap halves f SWAPF f, d f(Q-3) H f(4-7) ~ d None 2,4 0001 lOdf ffff 18f Exclusive OR W and f XORWF f, d Wffi f~d z 2,4 (11-8) (7-5) (4 - 0) BIT- ORIENTED FILE REGISTER OPERATIONS I OPCODE I b(BIT #)I f(FILE #) I Instruction-Binary (Hex) Name Mnemonic, Operands Operation Status Affected Notes 0100 bbbf ffff 4bf Bit Clear f BCF f, b 0 ~ f(b) None 2,4 0101 bbbf ffff 5bf Bit Set f BSF f, b 1 ~ f(b) None 2,4 0110 bbbf ff ff 6bf Bit Test f,Skip if Clear BTFSC f, b Test bit (b) in file (f): Skip if clear None 0111 bbbf ffff 7bf Bit Test f, Skip if Set BTFSS f, b Test bit (b) in file (f): Skip if set None (11-8) (7 - 0) LITERAL AND CONTROL OPERATIONS I OPCODE I k (LITERAL) I Instruction-Binary (Hex) Name Mnemonic, Operands Operation Status Affected Notes 1110 kkkk kkkk Ekk AND Literal and W ANDLW k k&W~W z 1001 kkkk kkkk 9kk Call subroutine CALL k PC + 1 ~ Stack, k ~ PC None 1 0000 0000 0100 004 Clear Watchdog timer CLRWDT - O~ WDT (and prescaler, if assigned) TO,PD lOlk kkkk kkkk Akk Go To address (k is 9 bit) GOTO k k ~ PC (9 bits) None 1101 kkkk kkkk Dkk Incl. OR Literal and W IORLW k kvw~w z 1100 kkkk kkkk Ckk Move Literal to W MOVLW k k~W None 0000 0000 0010 002 Load OPTION register OPTION - W ~ OPTION register None 1000 kkkk kkkk 8kk Return,place Literal in W RETLW k k ~ W, Stack ~ PC None 0000 0000 0011 003 Go into standby mode SLEEP - 0 ~ WOT, stop oscillator TO,PD 0000 0000 Of ff OOf Tristate po rt f TRIS f w~ 1/0 control register f None 3 1111 kkkk kkkk Fkk. Exel. OR Literal and W XORLW k kffiW~W z Notes: See previous page 0$300151 - page 18 © 1992 Microchip Technology Inc. PIC®16C5X Series 10.1 INSTRUCTION DESCRIPTION BSF Bit Set f Syntax: BSF f,b ADDWF ADD Wtof Encoding: I 0101 I bbbf ff ff Syntax: ADDWF f,d Words: 1 Encoding: I0001 I 11df I ffff Cycles: 1 Words: 1 Operation: 1 ~ f(b) Cycles: Status bits: None Operation: (W+f)~d Description: Bit "b" in register "f" is set to 1. Status bits: C,DC,Z BTFSC Bit Test. skip if Clear Description: Add the contents of the W register to register "f'. If "d" is Othe result is stored Syntax: BTFSC f,b in the W register. If "d" is 1 the result is stored back in register "f'. Encoding: I 0110 I bbbf I ffff Words: 1 ANDLW AND Literal and W Cycles: 1(2) Syntax: ANDLW k Operation: skip if f(b) = 0 Encoding: J 1110 I kkkk J kkkk Status bits: None Words: 1 Description: If bit "b" in register ''f" is "O" then the next Cycles: 1 instruction is skipped. Operation: (W .AND. k) ~ W If bit"b" is "O", the next instruction, fetched Status bits: z during the current instruction execution, is discarded and a NOP is executed in- Description: The contents of W register are AND'ed stead making this a 2 cycle instruction. with the eight bit literal "k". The result is placed in the W register. BTFSS Bit Test, skip if Set ANDWF ANDWwithf Syntax: BTFSS f,b Syntax: ANDWF f,d Encoding: I 0001 J Oldf J ffff Encoding: I0111 I bbbf ffff Words: 1 Words: 1 Cycles: 1 (2) Cycles: 1 Operation: skip if f(b) = 1 Operation: (W .AND. f) ~ d Status bits: None Status bits: z Description: If bit "b" in register "f" is "1" then the next Description: AND the W register with register "f'. If "d" instruction is skipped. is O the result is stored in the W register. If "d" is 1 the result is stored back in If bit "b" is "1 ",the next instruction, fetched register "f". during the current instruction execution, is discarded and a NOP is executed in- BCF Bit Clear f stead making this a 2 cycle instruction. Syntax: BCF f,b CALL Subroutine Call Encoding: I 0100 bbbf I ffff Syntax: CALL k Words: 1 Encoding: I 1001 Cycles: 1 Words: Operation: 0 ~ f(b) Cycles: 2 Status bits: None Operation: PC + 1 ~ TOS; k ~ PC<7:0>, Description: Bit "b" in register ''f" is reset to 0. 'O' ~ PC, PA2, PA1, PAO~ PC<11:9>; Status bits: None © 1992 Microchip Technology Inc. DS30015I- page 19 PIC®16C5X Series Description: Subroutine call. First, return address (PC DECF Decrement f + 1) is pushed into the stack. The eight bit value is loaded into PC bits <7:0>. PC bit Syntax: DECF f,d 9 is cleared. PC <2:0> bits are loaded into Encoding: I 0000 lldf ffff PC <11 :9>. CALL is a two cycle instruc- tion. Words: 1 Cycles: 1 CLRF Clear f and Clear d Operation: (f-1) ~ d Syntax: CLRF f,d Status bits: C,DC,Z Encoding: I 0000 I Ollf ffff Description: Decrement register''f". lf"d" is Othe result Words: is stored in the W register. If "d" is 1 the Cycles: result is stored back in register "f'. Operation: OOh~ f, OOh ~ d DECFSZ Decrement f, skip if O Status bits: None Syntax: DECFSZ f,d Description: The contents of register "f" are set to 0. If "d" is Othe contents of both data memory Encoding: I 0010 I lldf I ffff location "f' and W register are set to 0. If Words: 1 "d" is 1 the only contents of register ''f" are Cycles: 1 (2) set to 0. Operation: (f - 1) ~ d; skip if result= O CLRW Clear W Register Status bits: None Syntax: ~C_L_R_W~--~-- Description: The contents of register ''f" are decre- mented. If "d" is 0 the result is placed in Encoding: I 0000 I 0100 0000 the W register. If "d" is 1 the result is Words: placed back in register "f'. If the result is Cycles: O the next instruction is skipped. Operation: OOh~W If the result is 0, the next instruction, which is already fetched, is discarded. A Status bits: z NOP is executed instead making it a two Description: W registered is cleared. Zero bit (Z) is set. cycle instruction. CLRWDT Clear Watchdog Timer GOTO Unconditional Branch Syntax: CLRWDT Syntax: GOTO k Encoding: 1.--oo-o-o---..l_o_o_o_o---,--0-1-0-0_, Encoding: I 101k I kkkk kkkk Words: Words: 1 Cycles: Cycles: 2 Operation: OOh ~WOT, 0 ~WOT prescaler, Operation: k ~ PC<8:0>, PA2, PA1, PAO Status bits: 1~TO,1 ~PD ~ PC<11:9>; Description: CLRWDT instruction resets the watch- Status bits: None dog timer.It also resets the prescaler of Description: GOTO is an unconditional branch. The the WDT. Status bits TO and PD are set. eleven bit immediate value is loaded into PC bits <10:0>. The upper bits of PC are COMF Complement f loaded from PCLATH <4:3>. GOTO is a Syntax: COMF f,d two cycle instruction. Encoding: I 0010 I Oldf ffff INCF Increment f Words: 1 Syntax: INCF f,d Cycles: Encoding: I 0010 lOdf ffff Operation: f~ d Words: 1 Status bits: Z Cycles: Description: The contents of register "f" are comple- Operation: (f + 1) ~ d mented. If "d" is Othe result is stored in W. If "d" is 1 the result is stored back in Status bits: C, DC, Z register ''f". 08300151 - page 20 © 1992 Microchip Technology Inc. PIC®16C5X Series Description: The contents of register "f" are incre- MOVF Movef mented. If "d" is 0 the result is placed in the W register. If "d" is 1 the result is Syntax: MOVF f,d placed back in register "f". Encoding: I 0010 OOdf I ffff INCFSZ Increment f, skip if 0 Words: 1 Syntax: INCFSZ f,d Cycles: 1 Encoding: I 0011 I 11df ffff Operation: (f) ~ d Words: 1 Status bits: z Cycles: 1 (2) Description: The contents of register "f" are moved. If "d" is O the result is placed in the W Operation: (f + 1) ~ d, skip if result= 0 register. If "d" is 1 the result is placed Status bits: None back in register "f". Description: The contents of register "f" are incre- MOVLW Move Literal to W mented. If "d" is O the result is placed in the W register. If "d" is 1 the result is Syntax: MOVLW k placed back in register "f". If the result is Encoding: I 1100 j kkkk j kkkk O the next instruction is skipped. Words: 1 If the result is 0, the next instruction, which is already fetched, is discarded. A Cycles: NOP is executed instead making it a two Operation: k~W cycle instruction. Status bits: None IORLW Inclusive OR Literal with W Description: The eight bit literal "k" is loaded into W register. Syntax: IORLW k Encoding: I 1101 I kkkk I kkkk MOVWF Move Wtof Words: 1 Syntax: MOVWF f Cycles: 1 Encoding: I 0000 OOlf I ffff Operation: (W .OR. k) ~w Words: 1 Status bits: z Cycles: 1 Description: Operation: w~f The contents of the W register are OR'ed with the eight bit literal "k". The result is Status bits: None placed in the W register. Description: Move data from W register to register "f". IORWF Inclusive OR W with f NOP No Operation Syntax: IORWF f,d Syntax: NOP Encoding: I 0001 I OOdf ffff Encoding: I 0000 I 0000 0000 Words: 1 Words: Cycles: 1 Cycles: Operation: (W .OR. f) ~ d Operation: No operation Status bits: z Status bits: None Description: Inclusive OR the W register with register Description: No operation "f". If "d" is 0 the result is stored in the W OPTION Load Option Register register. If "d" is 1 the result is stored back in register "f". Syntax: OPTION Encoding: I 0000 I 0000 0010 Words: Cycles: Operation: W ~OPTION; Status bits: None Description: The contents of the W register is loaded in the OPTION register. © 1992 Microchip Technology Inc. 08300151 - page 21 PIC®16C5X Series RETL W Return Literal to W The processor is put into SLEEP mode with the oscillator stopped. See section Syntax: RETLW k on SLEEP mode for more details. Encoding: I 1000 j kkkk j kkkk SUBWF Subtract W from f Words: 1 Syntax: SUBWF f,d Cycles: 2 Operation: k -7 W; TOS -7 PC; Encoding: 10000 i 1oaf 1 ffff 1 Words: 1 Status bits: None Cycles: Description: The W register is loaded with the eight bit literal "k''. The program counter is loaded Operation: (f-W) -7 d from the top of the stack (the return Status bits: C, DC, Z address). This is a two cycle instruction. ; SUBWF Example #1 RLF Rotate Left f through Carry ' ;f (20h)=0 cl:r:f Ox20 movlw 1 ;wreg=l Syntax: RLF f,d subwf Ox20 ;f (20h)=f {20h)-wreg=0-l=FFh Encoding: I 0011 Oldf I ffff I ' ; Carry=O; Result is negative Words: 1 ; SUBWF Example #2 ' Cycles: movlw OxFF ' movwf Ox20 ;f (20h)=FFh Operation: kn> -7d, k7> -7 C, C -7 d; clrw ;wreg=O subwf Ox20 ;f (20h)=f (20h)-wreg=FFh-0=FFh Status bits: c ;Carry=l :Result is positive Description: 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 Description: Subtract (2's complement method) the W register. If "d" is 1 the result is stored back register from register ''f". If "d" is O the in register "f". result is stored in the W register. If "d" is 1 the result is stored back in register "f'. RRF Rotate Right f through Carry SWAPF Swapf Syntax: RRF f,d Encoding: I 0011 OOdf I ffff Syntax: SWAPF f,d Words: 1 Encoding: I 0011 I 1oaf I ffff Cycles: Words: 1 Cycles: Operation: kn> -7 d, kO> -7 C, C -7 d<7>; Status bits: C Operation: k0:3> -7 d<4:7>, k4:7> -7 d<0:3>; Description: The contents of register "f" are rotated Status bits: None one bit to the right through the Carry Flag. Description: The upper and lower nibbles of register "f" If "d" is O the result is placed in the W are exchanged. If "d" is O the result is register. If "d" is 1 the result is placed back placed in W register. If "d" is 1 the result in register "f'. is placed in register "f". SLEEP TRIS Load TRIS Register Syntax: SLEEP Syntax: TRIS ,~-oo_o_o~j-o_o_o_o~j-0_0_1_1~j Encoding: Encoding: I 0000 I 0000 I Offf I Words: 1 Words: Cycles: Cycles: Operation: O -7 PD, 1 -7 TO; Operation: W -7 TRIS register f; OOh -7 WOT, 0 -7 WOT prescaler; Status bits: None Status bits: TO, PD Description: TRIS register f (f = 5, 6 or 7) is loaded with Description: The power down status bit (PD) is cleared. the contents of the W register. Time-out status bit (TO) is set. Watchdog Timer and its prescaler are cleared. DS30015I- page 22 © 1992 Microchip Technology Inc. PIC®16C5X Series XORLW Exclusive OR literal with W The status bit "TO" in file register f3 will be cleared upon a watchdog timer timeout. Syntax: XORLW k The WOT period is a function of the supply voltage, Encoding: I 1111 I kkkk I kkkk I operating temperature, and will also vary from unit to unit Words: 1 due to variations in the manufacturing process. Please Cycles: 1 refer to the graphs in section 18.0 and DC specs for more details. Operation: (W .XOR. k) ~ W Status bits: z 11.2 WOT Programming Considerations Description: The contents of the W register are XOR'ed with the eight bit literal "k". The result is In a noisy application environment the OPTION register placed in the W register. can get corrupted. The OPTION register should be updated at regular intervals. XORWF Exclusive OR W with f It should also be taken in account that under worst case Syntax: XORWF f,d conditions (Voo =Min., Temperature= Max., max. WOT prescaler) it may take several seconds before a WOT Encoding: I 0001 ) 1odf ffff timeout occurs. Words: 1 Cycles: 1 12.0 OSCILLATOR CIRCUITS Operation: (W .XOR. f) ~ d 12.1 Oscillator Types Status bits: z The PIC16C5X series is available with 4 different oscil- Description: Exclusive OR the contents of the W reg- lator options. On windowed devices, a particular oscilla- ister with register "f". If "d" is 0 the result tor circuit can be selected by programming the configu- is stored in the W register. If "d" is 1 the ration EPROM accordingly. The PIC development tools result is stored back in register "f". (e.g. PICMASTER, PIC-PAK, PICPRO) provide special commands to select the desired oscillator configuration. 11.0 WATCHDOG TIMER (WOT) On OTP and OTP devices, the oscillator configuration is The watchdog timer is realized as a free running on-chip programmed by the factory and the parts are tested only RC oscillator which does not require any external com- to the according specifications. ponents. That means that the WOT will run, even if the clock on the OSC1/0SC2 pins of the device has been 12.2 Crystal Oscillator stopped, for example, by execution of a SLEEP instruc- The PIC16C5X-XT, -HS, or LP needs a crystal or ce- tion. A WOT timeout generates a device RESET condi- ramic resonator connected to the OSC1 and OSC2 pins tion. The WOT can be permanently disabled by pro- to establish oscillation (Figure 12.2.1 ). XT = Standard gramming a "zero" into a special EPROM fuse which is crystal oscillator, HS= High speed crystal oscillator. The not part of the normal program memory EPROM. The series resistor Rs may be required for the "HS" oscillator, PIC development tools "PICMASTER™, PIC-PAK™", especially at lower than 20 MHz oscillation frequency. It and "PICPRO™" provide special commands to program may also be required in XT mode with AT strip-cut type this fuse. crystals to avoid overdriving. 11.1 WOT Period 12.3 RC Oscillator The WOT has a nominal time-out period of 18 ms, (with For timing insensitive applications the "RC" device op- no prescaler). The time-out periods vary with tempera- tion offers additional cost savings. The RC oscillator ture, Voo and process variations from part to part (see frequency is a function of the supply voltage, the resistor DC specs). If longer time-out periods are desired, a (Rext) and capacitor (Cext) values, and the operation prescaler with a division ratio of up to 1:128 can be temperature. In addition to this, the oscillator frequency assigned to the WOT under software control by writing will vary from unit to unit due to normal process parameter to the OPTION register. Thus, time-out periods up to 2.5 variation. Furthermore, the difference in lead frame seconds can be realized. capacitance between package types will also affect the The "CLRWDT" and "SLEEP" instructions clear the oscillation frequency, especially for low Cext values. WOT and the prescaler, if assigned to the WOT, and The user also needs to take into account variation to due prevent it from timing out and generating a device tolerance of external Rand C components used. Figure RESET condition. 12.3.1 shows how the R/C combination is connected to the PIC16C5X. For Rext values below 2.2 kOhm, the © 1992 Microchip Technology Inc. DS30015I - page 23 PIC®16C5X Series oscillator operation may become unstable, or stop com- Higher capacitance increases the stability of oscillator pletely. For very high Rext values (e.g. 1 MOhm), the but also increases the start-up time. These values are oscillator becomes sensitive to noise, humidity and for design guidance only. Since each resonator has its leakage. Thus, we recommend to keep Rext between 5 own characteristics, the user should consult the resonator kOhm and 100 kOhm. manufacturer for appropriate values of external compo- Although the oscillator will operate with no external nents. capacitor (Cext = 0 pF), we recommend using values above 20 pF for noise and stability reasons. With no or FIGURE 12.2.2 - EXTERNAL CLOCK INPUT small external capacitance, the oscillation frequency OPERATION (HS, XT, or LP TYPES ONLY) can vary dramatically due to changes in external ca- pacitances, such as PCB trace capacitance or package CLOCK FROM lead frame capacitance. EXT. SYSTEM PIC16C5X See table in section 18.0 for RC frequency variation from OPEN OSC2 part to part due to normal process variation. The variation is larger for larger R (since leakage current variation will affect RC frequency more for large R) and TABLE 12.2.2 - CAPACITOR SELECTION for smaller C (since variation of input capacitance will FOR CRYSTAL OSCILLATOR affect RC frequency more). Osc Freq C1 C2 See characteristics in section 18.0 for variation of os- Type cillator frequency due to Voo for given Rext/Cext values LP 32 KHz 15_QF 15.Qf as well as frequency variation due to operating tempera- XT 100 KHz 15 - 30 pF 200 - 300 pF ture for given R, C, and Voo values. 200 KHz 15 - 30 pF 100 - 200 pF 455 KHz 15 - 30 pF 15-100pF 1 MHz 15 - 30 pF 15 - 30 pF The oscillator frequency, divided by 4, is available on the 2 MHz 15 pF 15 pF OSC2/CLKOUT pin, and can be used for test purposes 4MHz 15_QF 15_QF or to synchronize other logic (see Figure 2.2.1 for HS 4MHz 15 pF 15 pF 8 MHz 15 pF 15 pF timing). 20 MHz 15 pF 15 pF FIGURE 12.2.1 - CRYSTAL OPERATION (OR CERAMIC RESONATOR) (HS, XT OR Higher capacitance increases the stability of oscillator LP TYPES ONLY) but also increases the start-up time. These values are for design guidance only. Rs may be required in HS OSC1 mode as well as XT mode to avoid overdriving crystals - - •- - - I PIC16C5X with low drive level specification. Since each crystal has I I C1 its own characteristics, the user should consult the r L 1 I I ,- _1_....,. i::::::J XTAL ' ' -'--- SLEEP crystal manufacturer for appropriate values of external C2 J I ~ OSC2 ~r; \ ' - -~ - - -~~TO INTERNAL LOGIC . components. FIGURE 12.3.1 - RC OSCILLATOR (RC TYPE ONLY) Rs may be required in HS and XT modes for AT strip-cut Voo crystals to avoid overdriving. See Tables 12.2.1 and 12.2.2 for recommended values of C1, C2 per oscillator type and frequency. Rext D 1 f OSC1 - Cex1 PIC16C5XRC TABLE 12.2.1 - CAPACITOR SELECTION Vss -=- OSC2/CLKOUT FOR CERAMIC RESONATORS Fosc/4 ,---- Oscillator Resonator Capacitor Range Type Frequency C1 =C2 XT 455 KHz 150 - 330 pF 2.0 MHz 20 - 330 pF 4.0 MHz 20 - 330_QF HS 8.0 MHz 20 - 200 pF DS30015I - page 24 © 1992 Microchip Technology Inc. PIC®16C5X Series FIGURE 13.1.1 ·EXTERNAL POWER 13.0 OSCILLATOR START-UP TIMER ON RESET CIRCUIT {OST) Dlt Voo Oscillator circuits based on crystals or ceramic resona- tors require a certain time after power-up to establish a R1 stable oscillation. An on-chip oscillator start-up timer is ,- MCLR provided which keeps the device in a RESET condition c for approximately 18 ms after the voltage on the MCLR I PIC16C5X pin has reached a logic high (VIHMC) level. Thus, exter- Notes: 1. External power on reset circuit is required only if Voo nal RC networks connected to the MCLR input are not power-up slope is too slow or if a low frequency required in most cases, allowing for savings in cost- crystal oscillator is being used that need a long sensitive and/or space restricted applications. start-up time. The diode D helps discharge the The OST will also be triggered upon a watchdog timer capacitor quickly when VDD powers down. 2. R < 40 Kn must be observed to make sure that timeout. This is particularly important for applications voltage drop across R does not exceed 0.2 V (max using the WOT to awake the PIC16C5X from SLEEP leakage current spec on MCLR pin is 5 µA). A mode automatically. larger voltage drop will degrade V1H level on MCLR The OST is not adequate for low frequency crystals pin. which require much longer than 18 ms to start up and 3. R1= 100Q to 1KQ will limit any current flowing stabilize. into MCLR from external capacitor C in the event of MCLR pin breakdown due to ESD or 13.1 Power On Reset (POR) EOS. The PIC16C5X incorporates an on chip Power On Reset FIGURE 13.1.2 • BROWN OUT PROTECTION (POR) circuitry .which provides internal chip reset for CIRCUIT most power-up situations. To use this feature the user merely needs to tie MCLR pin to Voo. A simplified block diagram of the on-chip power on reset circuit is shown in Voo -------- 5.5 V MCLR (Schmitt trigger) VIHMC 0.85 VDD VDD v RTCC (Schmitt trigger) VIHRT 0.85 VDD VDD v OSC1 (Schmitt trigger) VIHOSC 0.85 VDD VDD v PIC16C5X-RC only (Note 5) OSC1 VIHOSC 0.7VDD Voo v PIC16C5X-XT, HS, LP Input Leakage Current For Voo :::; 5.5V (Notes 3, 4) 1/0 ports Ill -1 0.5 +1 µA Vss :::; VPIN :::; VDD, Pin at hi-impedance MCLR llLMCL -5 µA = VPIN Vss + 0.25V MCLR llLMCH 0.5 +5 µA = VPIN VDD RTCC llLRT -3 0.5 +3 µA Vss :::; VPIN :::; VDD OSC1 llLOSC1 -3 0.5 +3 µA Vss :::; VPIN :::; VDD ' PIC16C5X-XT, HS, LP Output Low Voltage 1/0 Ports VOL 0.6 v IOL =8.7 mA, VDD =4.5V OSC2/CLKOUT VOL 0.6 v IOL =1.6 mA, VDD =4.5V JPIC16C5X-RCl Output High Voltage 1/0 Ports (Note 4) VOH Vot>-0.7 v IOH =-5.4 mA, VDD =4.5V OSC2/CLKOUT VOH Voo-0.7 v IOH =-1.0 mA, VDD =4.5V (PIC16C5X-RC) Note 1: Data in the column labeled "Typical" is based on characterization results at25 • C. This data is for design guidance only and is not tested for, or guaranteed by Microchip Technology. Note 2 : Total power dissipation as stated under absolute maximum ratings must not be exceeded. Note 3 : 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. Note 4 : Negative current is defined as coming out of the pin. Note 5 : For PIC16C5XRC devices, the OSC1 pin is a Schmitt trigger input. It is not recommended that the PIC16C5X be driven with external clock in RC mode. Note 6: The user may use better of the two specifications. © 1992 Microchip Technology Inc. DS30015I - page 33 PIC®16C5X Series 16.7 DC CHARACTERISTICS: PIC16C5X-RC, XT, HS, LP (AUTOMOTIVE) DC CHARACTERISTICS, Standard Operating Conditions (unless otherwise stated) ALL PINS EXCEPT POWER SUPPLY Operating temperature -40 < TA < + 125°C Operating voltage Voo range as described in DC spec tables 16.3 and 16.4 Characteristic Sym Min Typ Max Units Conditions (Note 1) Input Low Voltage 1/0 ports VIL Vss 0.15 Voo v Pin at hi-impedance MCLR (Schmitt trigger) VILMC Vss 0.15 Voo v RTCC (Schmitt trigger) VILRT Vss 0.15 Voo v OSC1 (Schmitt trigger) VILOSC Vss 0.15 Voo v PIC16C5XRC only (Note 5) OSC1 VILOSC Vss 0.3 Voo v PIC16C5X-XT, HS, LP Input High Voltage 1/0 ports VIH 0.45 Voo Voo v For all Voo (Note 6) VIH 2.0 Voo v 4.0 V < Voo s;; 5.5 V (Note 6) VIH 0.36 Voo Voo v Voo > 5.5 V MCLR (Schmitt trigger) VIHMC 0.85 Voo Voo v RTCC (Schmitt trigger) VIHRT 0.85 Voo Voo v OSC1 (Schmitt trigger) VIHOSC 0.85 Voo Voo v PIC16C5X-RC only (Note 5) OSC1 VIHOSC 0.7 Voo Voo v PIC16C5X-XT, HS, LP Input Leakage Current For Voo s;; 5.5V (Notes 3, 4) 1/0 ports llL -1 0.5 +1 µA Vss s;; VPIN s;; VDD, Pin at hi-impedance - - MCLR llLMCL -5 µA VPIN = Vss + 0.25V -- MCLR llLMCH 0.5 +5 µA VPIN = VDD RTCC llLRT -3 0.5 +3 µA Vss s;; VPIN s;; Voo OSC1 llLOSC1 -3 0.5 +3 µA Vss s;; VPIN s;; VDD ' PIC16C5X-XT, HS, LP Output Low Voltage 1/0 Ports VOL 0.6 v IOL = 8.7 mA, VDD = 4.5V OSC2/CLKOUT VOL 0.6 v IOL = 1.6 mA, VDD = 4.5V (PIC16C5X-RC) Output High Voltage 1/0 Ports (Note 4) VoH VDD-0.7 v IOH = -5.4 mA, VDD = 4.5V OSC2/CLKOUT VoH Voo-0.7 v IOH = -1.0 mA, Voo = 4.5V (PIC16C5X-RC) Note 1: Data in the column labeled "Typical" is based on characterization results at 25 ° C. This data is for design guidance only and is not tested for, or guaranteed by Microchip Technology. Note 2: Total power dissipation as stated under absolute maximum ratings must not be exceeded. Note 3 : 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. Note 4 : Negative current is defined as coming out of the pin. Note 5 : For PIC16C5XRC devices, the OSC1 pin is a Schmitt trigger input. It is not recommended that the PIC16C5X be driven with external clock in RC mode. Note 6: The user may use better of the two specifications. 08300151 - page 34 © 1992 Microchip Technology Inc. PIC®16C5X Series 16.8 AC CHARACTERISTICS: PIC16C5X-RC, XT, HS, LP (COMMERCIAL) PIC16C5Xl-RC, XT, HS, LP (INDUSTRIAL) PIC16C5Xl-RC, XT, HS, LP (AUTOMOTIVE) AC CHARACTERISTICS Standard Operating Conditions (unless otherwise stated) Operating temperature TA= -40°C to +85°C (industrial), TA= -4o·c to +125"C (automotive) and o·c::;; TA::;; +70°C (commercial) Operating voltage Voo range as described in DC spec tables 16.3 and 16.4 Characteristic Sym Min Typ Max Units Conditions (Note 1) · External CLOCKIN FOSCRC DC 4 MHz RC mode Frequency (Note 2) FOSCXT DC 4 MHz XT mode FOSCHS1 DC 20 MHz HS mode (Com/Ind) FOSCHS2 DC 16 MHz HS mode (Automotive) FOSCLP DC 40 KHz LP mode Oscillator Frequency FOSCRC DC 4 MHz RC mode (Note 2) FOSCXT 0.1 4 MHz XT mode FOSCHS1 4 20 MHz HS mode (Com/Ind) FOSCHS2 4 16 MHz HS mode (Automotive) FOSCLP DC 40 KHz LP mode Instruction Cycle Time TCYRC 1.0 4/FOSCRC DC µs RC mode (Note 2) TCYXT 1.0 4/FOSCXT DC µs XT mode TCYHS 0.2 4/FOSCHS DC µs HS mode TCYLP 100 4/FOSCLP DC µs LP mode External Clock in Timing (Note 4) Clock in (OSC1) High or Low Time XT oscillator type TCKHLXT 50* ns LP oscillator type TCKHLLP 2* µs HS oscillator type TCKHLHS 20* ns Clock in (OSC1) Rise or Fall Time XT oscillator type TCKRFXT 25* ns LP oscillator type TCKRFLP 50* ns HS oscillator type TCKRFHS 25* ns RESET Timing MCLR Pulse Width (low) TMCL 100* ns RTCC Input Timing, No Prescaler RTCC High Pulse Width TRTH 0.5 Tcv+ 20* ns Note 3 RTCC Low Pulse Width TRTL 0.5 Tcv+ 20* ns Note 3 RTCC Input Timing, With Prescaler RTCC High Pulse Width TRTH 10* ns Note 3 RTCC Low Pulse Width TRTL 10* ns Note 3 RTCC Period TRTP ltY + 4C * ns Note 3. Where N = prescale N value (2,4, ... , 256) Watchdog Timer Timeout Period (No Prescaler) TWOT 9* 18* 30* ms Voo = 5.0V Oscillation Start-up Timer Period TOST 9* 18* 30* ms Voo = 5.0V l/OTiming 1/0 Pin Input Valid Before CLKOUTt (RC Mode) Tos 0.25 Tcv+ 30* ns 1/0 Pin Input Hold After CLKOUTt (RC Mode) TOH O* ns 1/0 Pin Output Valid After CLKOUT0 (RC Mode) TPD 40* ns * Guaranteed by characterization, but not tested. (Notes on next page) © 1992 Microchip Technology Inc. 08300151- page 35 PIC®16C5X Series NOTES TO AC CHARACTERISTICS: may result in an unstable oscillator operation and/or higher than PIC1 SCSX-RC, XT, HS, LP (COMMERCIAL) expected current consumption. All devices are tested to operate PIC16CSXl-RC, XT, HS, LP (INDUSTRIAL) at "min." values with an external clock applied to the OSC1 pin. 1. Data in the column labeled "Typical" is based on characteriza- When an external clock input is used, the "Max." cycle time limit is "DC" (no clock) for all devices. tion results at 25'C. This data is for design guidance only and is 3. For adetailed explanation of RTCC input clock requirements see not tested for, or guaranteed by Microchip Technology. section 4.2.1. 2. Instruction cycle period (Tcy) equals four times the input oscilla- 4. Clock-in high-time is the duration for which clock input is at tor time base period. VIHOSC or higher. All specified values are based on characterization data for that Clock-in low-time is the duration for which clock input is at V1wsc particular oscillator type under standard operating conditions or lower. with the device executing code. Exceeding these specified limits 16.9 Electrical Structure of Pins 17.0 TIMING DIAGRAMS FIGURE 16.9.1 - ELECTRICAL FIGURE 17.0.1 - RTCC TIMING STRUCTURE OF 1/0 PINS (RA, RB, RC) VDD ' :--TRTH ~ ~TRTL--: ' ' ' '' :' ' ' • ------- 0.9 VDD ' '' '' ------- 0.15 VDD RTCC : vss vss ' - - - - TRTP - - - - - - - , FIGURE 16.9.2- ELECTRICAL FIGURE 17.0.2 - OSCILLATOR START-UP TIMING (PIC16C5XRC) STRUCTURE OF MCLR AND RTCC PINS ' ~--------- MCLR : - - Tcy - - - - - Tcy Tost T1 T1 MCLR, Schmitt trigger RTCC Input buffer CLKOUT ' ' DEVICE - - - RESET _ __,1 FETCH 1. INSTRUCTION : FETCH 2. INSTRUCTION 1 FUNCTION : EXECUTE "FORCED" NOP : EXECUTE 1. INSTRUCTION :- - - - - Vss vss Notes to figures 16.9.1 and 16.9.2: The diodes and the grounded gate (or output driver) NMOS device are carefully designed to protect against ESD (Electrostatic discharge) and EOS (Electrical overstress). Rin is a small resistance to further protect the input buffer from ESD. FIGURE 17.0.3 - INPUT/OUTPUT TIMING FOR 110 PORTS (PIC16C5XRC*) ----------Tcy T1 OSC2/ CLKOUT I I Tdh I 1 ----:--Tds _._1 I I INPUT ~«,$/4 I~ VALID Wffio/,$/mAWmffiY I 1------1 'Tpd : : Tpd : ~-------------------~·~-- OUTPUT HIGH-Z * The CLKOUT output is available only on PIC16C5XRC devices. 083001 SI - page 36 © 1992 Microchip Technology Inc. PIC®16C5X Series 18.0 DC & AC CHARACTERISTICS GRAPHSfrABLES: The graphs and tables provided in this section are for FIGURE 18.0.1 -TYPICAL RC OSCILLATOR design guidance and are not tested or guaranteed. In FREQUENCY vs. TEMPERATURE some graphs or tables the data presented are outside specified operating range (e.g. outside specified VDD Fosc FREQUENCY NORMALIZED TO +25"C range). This is for information only and devices are Fosc (25"C) - - · - - --···-,--,------ - - 1 guaranteed to operate properly only within the specified i.10 Rext2: 10KQ Cext = 100pF range. 1.08 The data presented in this section is a statistical sum- 1.06 c----t- mary of data collected on units from different lots over a 1.04 period of time. 'Typical' represents the mean of the 1.02 distribution while 'max' or 'min' represents (mean + 3cr) 1.00 :----+--~,...,.....=-----+ and (mean " 3cr) respectively where cr is standard de- 0.98 f---+----+-·--""'OIUlll- viation. 0.96 j----j---- 0.92 t - - - - + - - - 0.90 10 25 40 50 60 70 T('C)- FIGURE 18.0.2 -TYPICAL RC OSCILLATOR FIGURE 18.0.3 -TYPICAL RC OSCILLATOR FREQUENCY vs Voo FREQUENCY vs Voo 5.0 R=3.3k r-:--1 1.8 - - - - - - - - - - 1- - - - t--- R=3.3k 1.6 IL,/"~.(______(._ _j__--=i===i===:1==1 1.4 1 - - t - - - - + - - - + - - - + - - - + - - - + - - - - - i I~ 1.2 1---+- 1--1-1-1c=-t-=r==+=:=1_1 R=5k "N .!: 6 1.0 l--+---+---+---+---+---+--1 () Cf) 0 u.. 1- 0.81 r----1----f--+_ R=1 Ok 0.6 l--+----+----+---+---+---+-----i 0.4 1 - - + - - - + - - - + - - - + - - - + - - - + - - - 1 Cext = 100pF, T = 25°C 0.2 l - - + - - - + - - - + - - - + - - - + - - - + - - - 1 R=100k 0 ~-+---~-+---~-~-~~ 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 VDD(Volts) © 1992 Microchip Technology Inc. DS300151 - page 37 PIC®16C5X Series FIGURE 18.0.4 -TYPICAL RC OSCILLATOR TABLE 18.0.1 - RC OSCILLATOR FREQUEN- FREQUENCY vs Voo CIES 0.8 - - - - - - - - - - - - - - Cext Rext Average Fosc @ sv, 25°C 0.7 i---- 20pf 3.3k 4.71 MHz ±28% 5k 3.31 MHz ±25% 0.6 1 - - - - 1 - - - - + - - - + - - - + - - - + - - - + - - - - - - - < 10k 1.91 MHz ±24% 100k 207.76 KHz ±39% 100pf 3.3k 1.65 MHz ±18% 5k 1.23 MHz · ±21% 10k 711.54 KHz ±18% 100k 75,62 KHz ±28% r--+- 0.3 f---1-"'""-.-._::::+-t-..__--+--+--+~-+----I 300pf 3.3k 672.78 KHz ±14% - I ----i-.._ I R=10k I __,r---+---L_ 5k 489.49 KHz ±13% 0.2 1----1----t----+---+--+---+----1 ·.10k 275.73 KHz ±13% 100k 28.12 KHz ±23% Cext =300pF, T =2s·c 0.1 t - - - t - - - + - - - + - - - + - - - + - - - + - - - - < The percentage variation indicated here is part to part R=100k variation due to normal process distribution. The varia- 0 tion indicated is ±3 standard deviation from average 2.5 3.o 3.5 4.o 4.5 5.o 5.5 6.o value for full VDD range. VDD(Volts) FIGURE 18.0.5 - TYPICAL lpd vs Voe FIGURE 18.0.6 - TYPICAL lpd vs Voe WATCHDOG DISABLED 25°C WATCHDOG ENABLED 25°C 3.5 3 2.5 <( 2. 2 "O .Q. 1.5 01---~~-~~-1---~~- 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 VDD(Volts) VDD(Volts) Note: The gray shaded regions are outside the normal PIC operating range. Do not operate in these regions. 0$300151 - page 38 © 1992 Microchip Technology Inc. PIC®16C5X Series FIGURE 18.0.7- MAXIMUM lpd vs Voo FIGURE 18.0.8 - MAXIMUM lpd vs Voo WATCHDOG DISABLED WATCHDOG ENABLED* 100 Temp. (°C) 85 10 < 2.. 30>---+--+--+--+----cl,<--_,.._,~.___ 'O _g. o~~-~~-~~-~-~ 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 VDD(Volts) VDD(Volts) * IPD, with watchdog timer enabled, has two components: The leakage current which increases with higher temperature and the operating current of the watchdog timer logic which increases with lower temperature. At -40'C, the latter dominates explaining the apparently anomalous behavior. Note: The gray shaded regions are outside the normal PIC operating range. Do not operate in these regions. FIGURE 18.0.9-VTH (INPUT THRESHOLD VOLTAGE) OF VO PINS vs Voo VrH(lnput threshold voltage) of 1/0 pins 2.00 1.60 Ci) ~ 1..40 i-----+--=--""""'----1----+-----+- Z- > 1.20 :i:: i-----+-----1--=_..,,.,:::+-----+-~ 0.60 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 Voo (volts) © 1992 Microchip Technology Inc. DS30015I - page 39 PIC®16C5X Series FIGURE 18.0.10-VIH, VIL OF MCLR, RTCC AND OSC1 (IN RC MODE) vs VDD 4.50 4.00 3.50 ~ 3.00 0 2.50 ..:::.. ...J :> 2.00 r :> 1.50 ,. max (-40"C to 85"C) v1L, 1.00 VlL, TYP, 25"C VlL, min (-40"C to 85"C) 0.50 0.00 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 Voo (volts) Note: These input pins have Schmitt trigger input buffer. FIGURE 18.0.11 - VTH (INPUT THRESHOLD VOLTAGE) OF OSC1 INPUT (IN XT, HS, AND LP MODES) vs Voo 3.40 3.20 3.00 2.80 2.60 ~ 2.40 0 ..:::.. 2.20 >i!= 2. 00 1.80 1.60 v ~ ~ 1.40 ~ ~ 1.20 ~ 1.00 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 Voo (volts) DS30015I - page 40 © 1992 Microchip Technology Inc. PIC®16C5X Series FIGURE 18.0.12 - TYPICAL loo vs FREQ (EXT CLOCK, 25°C) 10 ztJ-HHVA~ v~ o. 1 f-5.5 ?.o f:= 6.0 ~~B!EEl~z:~~z~iz:~z~ll~~~~111~1g~11~ F= """' f-- ::2:: ~ ?J2LL 2 f- 5.o -fi--'------=~'"""'f"l--1-1±-1-+'f"v~~'---="17~--+-+-+-H++---+---+-+-l-l-++++---+--+-+-l-l-+++-1 t- 4.5 -ff--1=-----:::1=-1-""'Ft---H-u.+'f'V:::::-:://,...e;.4---+--l-H-t+++--+--+-+--+-+-+-++-f------f-----+-+--+-+-+-++1 f- 4.0 -+-=-1---f"''f-+-±-H''bp-.-£--+----i--+-+-+-H++---+---+-+-l-l-++++---+--+-+-l-l-+++-I 3.5 i-- ~ f- 3.0 +V~E+-=--1--'Fl--+t++--+---+--l-H-t+++--+--+-+--+-+-+-++-f------f-----+-+--+-+-+-++1 2.5 0.01 ~-~~~~~--~~~~~-~-~~~~-~~~~~~ 10K 100K 1M 10M 100M External Clock freq (Hz) FIGURE 18.0.13- MAXIMUM loo vs FREQ (EXT CLOCK, -40° to +85°C) 10 g< Cl .a 0.01 10K 100K 1M 10M 100M External Clock freq (Hz) © 1992 Microchip Technology Inc. DS30015I - page 41 PIC®16C5X Series FIGURE 18.0.14 - MAXIMUM IDD vs FREQ (EXT CLOCK, -55° to +125°C) 10 t=:==:===:=J===:J:==:=t=:~~~l======~=l~~=:l:~~l======t===t===~=t=e~~~~rz~~~~~z~~~~ ':LL ~ .s 0 1-- 7.0 0 0.01 ~~~~~~~~---+-~~~~~~~~~~~~~~~~~·~~~~· 10K 100K 1M 10M External Clock freq (Hz) FIGURE 18.0.15 - WOT Timer Time-out Period FIGURE 18.0.16 - Transconductance (gm) of vsVDD HS Oscillator vs Voo 50.0 9000 45.0 8000 40.0 7000 35.0 6000 Ui s 30.0 "O 0 ~ E, 5000 -~ c.. E I- 25.0 Ol 4000 0 $: 20.0 3000 15.0 2000 10.0 1000 5.0 0 2 3 4 5 6 7 2 3 4 5 6 7 Voo(Volts) Voo(Volts) Note: The gray shaded regions are outside the normal PIC operating range. Do not operate in these regions. 08300~ 51 - page 42 © 1992 Microchip Technology Inc. PIC®16C5X Series FIGURE 18.0.17 -Transconductance (gm) of FIGURE 18.0.18-Transconductance (gm) of LP Oscillator vs VDD XT Oscillator vs VDD 35.0 30.0 !E Cl 25.0 !E 20.0 Cl 15.0 o~-~--~---'---~ 2 3 4 5 6 7 2 3 4 5 6 7 VDD(Volts) VDD(Volts) Note: The gray shaded regions are outside the normal PIC operating range. Do not operate in these regions. FIGURE 18.0.19- IOH vs VOH, VDD = 3V FIGURE 18.0.20 - IOH vs VoH, VDD = 5V 0 0 -10 -10 < ..S-20 < ..S-20 ~ :c: .Q -30 -30 -40 1.5 2 2.5 3 3.5 4 4.5 5 -40 VOH (Volts) 1.5 2 2.5 3 3.5 4 4.5 5 VOH (Volts) © 1992 Microchip Technology Inc. 05300151 - page 43 PIC®16C5X Series FIGURE 18.0.21 • IOL vs VOL, VDD = 3V FIGURE 18.0.22 • IOL vs VOL, VDD =SV 45 90 40 80 35 70 30 60 <( 25 ~ 50 5 ...J .Q 20 Q 40 15 30 10 20 5 10 0 0 0.5 1.5 2 2.5 3 0.5 1 1.5 2 2.5 3 VOL(Volts) VOL (Volts) Note: The gray shaded regions are outside the normal PIG operating range. Do not operate in these regions. TABLE 18.0.2 - INPUT CAPACITANCE FOR TABLE 18.0.3 - INPUT CAPACITANCE FOR PIC16C54/56 * PIC16C55/57 * Typical Capacitance (pF) Typical Capacitance (pF) Pin Name Pin Name 18L PDIP 18L SOIC 28LPDIP 28L SOIC (600 mil) RA port 5.0 4.3 RB port 5.0 4.3 RA port 5.2 4.8 MCLR 17.0 17.0 RB port 5.6 4.7 OSC1 4.0 3.5 RC port 5.0 4.1 OSC2/CLKOUT 4.3 3.5 MCLR 17.0· 17.0 RTCC 3.2 2.8 OSC1 6.6 3.5 OSC2/CLKOUT 4.6 3.5 * All capacitance values are typical at 25°C and mea- RTCC 4.5 3.5 sured at 1 MHz. A part to part variation of±25% (three standard deviations) should be taken into account. 08300151 - page 44 © 1992 Microchip Technology Inc. PIC®16C5X Series 19.0 PACKAGING DIAGRAMS AND DIMENSIONS 19.1 18-LEAD PLASTIC DUAL IN-LINE (300 mil) N ITT E1 E Pin No. 1 Indicator __..~......_~-~.,....,...~~--I~ JI Area A2A Package Group: Plastic Dual In-line (PLA) Millimeters Inches Symbol Min Max Notes Min Max Notes a oo 100 oo 100 A - 4.064 - 0.160 A1 0.381 - 0.015 - A2 3.048 3.810 0.120 0.150 B 0.356 0.559 0.014 0.022 81 1.524 1.524 Typical 0.060 0.060 Typical c 0.203 0.381 Typical 0.008 O.Q15 Typical D 22.479 23.495 0.885 0.925 D1 20.320 20.32 Reference 0.800 0.800 Reference E 7.620 8.255 0.300 0.325 E1 6.096 7.112 0.240 0.280 e1 2.489 2.591 Typical 0.098 0.102 Typical eA 7.620 7.620 Reference 0.300 0.300 Reference es 7.874 9.906 0.310 0.390 L 3.048 3.556 0.120 0.140 N 18 18 18 18 s 0.889 - 0.035 - 81 0.127 - 0.005 - © 1992 Microchip Technology Inc. 05300151- page 45 PIC®16C5X Series PACKAGING DIAGRAMS AND DIMENSIONS (CONT.) 19.2 28-LEAD DUAL IN-LINE PLASTIC (600 mil) N l'.t-------1 a---11 II \\ II ~:: __.1 \\ Package Group: Plastic Dual-In-LineJ_PLA) Millimeters Inches Symbol Min Max Notes Min Max Notes a oo 10° oo 100 A - 5.080 - 0.200 A1 0.508 -. 0.020 - A2 3.175 4.064 0.125 0.160 B 0.356 0.559 0.014 0.022 81 1.270 1.778 Typical 0.050 0.070 Typical c 0.2032 0.381 Typical 0.008 O.Q15 Typical D 35.560 37.084 1.400 1.460 01 33.020 33.020 Reference 1.300 1.300 Reference E 15.240 15.875 0.600 0.625 E1 12.827 13.970 0.505 0.550 e1 2.489 2.591 Typical 0.098 0.102 Typical eA 15.240 15.240 Reference 0.600 0.600 Reference es 15.240 17.272 0.600 0.680 L 2.921 3.683 0.115 0.145 N 28 28 28 28 s 0.889 - 0.035 - 81 0.508 - 0.020 - DS30015I - page 46 © 1992 Microchip Technology Inc. PIC®16C5X Series PACKAGING DIAGRAMS AND DIMENSIONS (CONT.) 19.3 28-LEAD DUAL IN-LINE PLASTIC (300 mil) N TI E1 E a~11 " II Ii--------; c~ \\ \\ Pin No. 1 ~ ""'f"l-r-,...,TT"",.,.,.-~ --.-.--.-r-T",...,..... _::!::::_i_ ... J I ~1~1---::==-=--=--:...~~~1 Indicator Area Base Plane~ Seating ~/ I - Plane _ . / I Bs.-1 ~I j--B ~i------ A2A Detail A : 01 _ _ _ _ _ __.._--<-i Detail A Package Group: Plastic Dual-In-Line (PLA) Millimeters Inches Symbol Min Max Notes Min Max Notes a oo 10° oo 100 A 3.63 4.57 .143 .180 A1 .38 - .015 - A2 3.25 3.65 .128 .140 B .41 .56 .016 .022 Typical 81 1.02 1.65 Typical .040 .065 82 .762 1.02 4 places .030 .040 4 places 83 .20 .51 4 places .008 .020 4 places c .20 .33 Typical .008 .013 Typical D 34.16 35.43 1.345 1.395 D1 33.02 33.02 Reference 1.300 1.300 Reference E 7.87 8.38 .310 .330 E1 7.1 7.52 .280 .296 e1 2.54 2.54 Typical .100 .100 Typical eA 7.87 7.87 Reference .310 .310 Reference es 8.64 9.65 .340 .380 L 3.18 3.68. .125 .145 N 28 - 28 - s .58 1.22 .023 .048 © 1992 Microchip Technology Inc. 08300151 - page 47 PIC®16C5X Series PACKAGING DIAGRAMS AND DIMENSIONS (CONT.) 19.4 18-LEAD PLASTIC SURFACE MOUNT (SOIC-WIDE. 300 mil BODY) h x45° ---, ~ _j_ ~ Ffc L Indicator Area Chamfer h x45° _L~ D ~1 CP Seating __... :::::!=;::::=~~ j 1 - Base Plane Plane A1 A Package Group: Plastic SOIC (SO} Millimeters Inches Symbol Min Max Notes Min Max Notes a oo so oo so A 2.3622 2.6416 0.093 0.104 A1 0.1016 0.2997 0.004 O.Q11S B 0.3556 0.4S26 0.014 0.019 c 0.2413 0.3175 0.0095 0.0125 D 11.353S 11.734S 0.447 0.462 E 7.416S 7.5946 0.292 0.299 e 1.270 1.270 Typical 0.050 0.050 Typical H 10.0076 10.6426 0.394 0.419 h 0.3S1 0.762 0.015 0.030 L 0.4064 1.143 0.016 0.045 N 1S 1S 1S 1S CP - 0.1016 - 0.004 08300151 - page 48 © 1992 Microchip Technology Inc. PIC®16C5X Series PACKAGE OUTLINES (CONT.) 19.5 28-LEAD PLASTIC SURFACE MOUNT (SOIC-WIDE. 300 mil BODY) B ~ e 14- ~~ h x45° --1 ~ Tl E H a~ _j_ -..J F1 c ~ Pin No. 1 _____.. L Indicator Area Chamfer _____.. h x 45° _l_I~ D ~1 CP Seating ___.. :;:*=;:::=~\RFJ- f 'I Base Plane Plane A1 A Package Group: Plastic SOIC (SO) Millimeters Inches Symbol Min Max Notes Min Max Notes a oo so oo so A 2.3622 2.6416 0.093 0.104 A, 0.1016 0.2997 0.004 0.011S B 0.3556 0.4S26 0.014 0.019 c 0.2413 0.3175 0.0095 0.0125 D 17.703S 1S.OS4S 0.697 0.712 E 7.416S 7.5946 0.292 0.299 e 1.270 1.270 Typical 0.050 0.050 Typical H 10.0076 10.6426 0.394 0.419 h 0.3S1 0.762 0.015 0.030 L 0.4064 1.143 0.016 0.045 N 2S 2S 2S 2S CP - 0.1016 - 0.004 © 1992 Microchip Technology Inc. 05300151 - page 49 PIC®16C5X Series PACKAGE OUTLINES (CONT.) 19.6 20-LEAD PLASTIC SURFACE MOUNT (SSOP - .209 mil BODY 5.30 mm) -, N Index area E _l 12 3 CP1 ~D--- Pack'!9_e Grol!e_: Plastic SSOP Millimeters Inches Symbol Min Max Notes Min Max Notes a oo so oo so A 1.73 1.99 0.6S 0.7S A1 0.05 0.21 0.002 o.oos B 0.25 0.3S 0.010 0.015 c 0.13 0.22 0.005 0.009 D 7.07 7.33 0.27S 0.2S9 E 5.20 5.3S 0.205 0.212 e 0.65 0.65 Typical 0.256 0.256 Typical H 7.65 7.90 0.301 0.311 L 0.55 0.95 0.022 0.037 N 20 20 20 20 CP - 0.1016 - 0.004 S_y_mbol List for Shrink Small Outline Pack'!9_e Parameter S__y_mbol Descr!m:ion of Parameters a Angular spacing between min. and max. lead positions measured at the guage plane A Distance between seating plane to highest point of body A Distance between seating plane and base plane B Width of terminals c Thickness of terminals D Largest overall package parameter of length E Largest overall package width parameter not including leads e Linear spacing of true minimum lead position center line to center line H Largest overall package dimension of width L Length of terminal for soldering to a substrate N Total number of potentially useable lead positions ; CP Seating plane coplanarity Notes: 1. Controlling parameter: mm. 2. All packages are gull wing lead form. 3. "D" and "E" are reference datums and do not include mold flash or protrusions. Mold flash or protrusions shall not exceed .006 package ends and .01 O on sides. 4. The chamfer on the body is optional. If it is not present, a visual index feature must be located within the crosshatched area to indicate pin 1 position. 5. Terminal numbers are shown for reference. DS30015I - page 50 © 1992 Microchip Technology Inc. PIC®16CSX Series PACKAGE OUTLINES (CONT.) 19.7 28-LEAD PLASTIC SURFACE MOUNT (SSOP - .209 mil BODY 5.30 mm) N Index area 12 3 CP- ·~· We Base plane D A1 ' - - Seating plane Paclalg_e Gro~ Plastic SSOP Millimeters Inches Symbol Min Max Notes Min Max Notes o; oo 80 oo 80 A 1.73 1.99 0.68 0.78 ~ 0.05 0.21 0.002 0.008 B 0.25 0.38 0.010 0.015 c 0.13 0.22 0.005 0.009 D 10.07 10.33 0.397 0.407 E 5.20 5.38 0.205 0.212 e 0.65 0.65 "!YJ>ical 0.256 0.256 Typical H 7.65 7.90 0.301 0.311 L 0.55 0.95 0.022 0.037 N 28 28 28 28 CP - 0.1016 - 0.004 S_ymbol List for Shrink Small Outline Pack1!9.e Parameter ~mbol Descr~ion of Parameters o; Angular spacing between min. and max. lead positions measured at the guage plane A Distance between seating plane to highest point of body ~ Distance between seati~plane and base plane B Width of terminals c Thickness of terminals D Largest overall package parameter of length E Largest overall package width parameter not including leads e Linear spacing of true minimum lead position center line to center line H Largest overall package dimension of width L Length of terminal for soldering to a substrate N Total number of potentially useable lead positions CP Seating plane coplanarity Notes: 1. Controlling parameter: mm. 2. All packages are gull wing lead form. 3. "D" and "E" are reference datums and do not include mold flash or protrusions. Mold flash or protrusions shall not exceed .006 package ends and .010 on sides. 4. The chamfer on the body is optional. If it is not present, a visual index feature must be located within the crosshatched area to indicate pin 1 position. 5. Terminal numbers are shown for reference. © 1992 Microchip Technology Inc. DS300151- page 51 PIC®16C5X Series 19.8 PACKAGE MARKING INFORMATION 18L PDIP Example MMMMMMMMMMMMXXX 0 MMMMMMMMXXXXXXX ~ AABB CDE o PIC16C56- RCI/P456 ~ 9123 CBA ----~ 18LSOIC Example MMMMMMMMM PIC16C54- MMMMMMMMM XTI/ S0218 O~ AABB CDE O~ 9118 CDK 28LSOIC Example MMMMMMMMMMMMMMM PTC16C57-XT/SO xxxxxxxxxxxxxxxxxxxx IO~ AABB CDE IQ_~ 9051 CBK 28L PDIP (.300 mil) Example xxxxxxxxxxxxxxx 0 xxxxxxxxxxxxxxx ~ AABB CDE o PIC16C56- RCI/P456 ~ 9123 CBA 0 28LSSOP Example xxxxxxxxxxxx PIC16C57-XT xxxxxxxxxxxx IO~ AABB CDE IQ_~ 9225 CBK 20LSSOP Example xxxxxxxx PIC16C54 xxxxxxxx XTI/218 O~ AABB CDE O~ 9051 CBP Legend: MM ... M Microchip part number information XX ... X Customer specific information* AA Year code (last 2 digits of calendar year) BB Week code (week of January 1 is week '01 ') C Facility code of the plant at which wafer is manufactured. C = Chandler, Arizona, U.S.A. D Mask revision number E Assembly code of the plant or country of origin in which part was assembled. Note: In the event the full Microchip part number can not be marked on one line, it will be carried over to the next line thus limiting the number of available characters for customer specific information. *Standard OTP marking consists of Microchip part number, year code, week code, facility code, mask rev#, and assembly code. For OTP marking beyond this, certain price adders apply. Please check with your Microchip Sales Office. For QTP devices, any special marking adders are incuded in QTP price. DS300151 - page 52 © 1992 Microchip Technology Inc. PIC®16C5X Series 19.8 PACKAGE MARKING INFORMATION (Cont.) 28L PDIP (.600 mil) Example 0 MMMMMMMMMMMMXXX MMMMMMMMXXXXXXX xxxxxxxxxxxxxxx ~ AABB CDE ,.., Microchip 0 o PIC16C55- XTI/P126 ~ 9042 ,.., Microchip CDA 0 0 0 18L Cerdip Example p ~ Microchip OMMMMMMMM ~ p ~ Microchip 0 PIC16C54 91 Ol CBA 28L Cerdip Example v v Microchip Microchip 0 MMMMMMMMMM MMMMMM 0 PIC16C57 AABB CDE 9038 CBA Legend: MM ... M Microchip part number information xx ... x Customer specific information* AA Year code {last 2 digits of calendar year) BB Week code (week of January 1 is week '01 ') c Facility code of the plant at which wafer is manufactured. C = Chandler, Arizona, U.S.A. D Mask revision number E Assembly code of the plant or country of origin in which part was assembled. Note: In the event the full Microchip part number can not be marked on one line, it will be carried over to the next line thus limiting the number of available characters for customer specific information. * Standard OTP marking consists of Microchip part number, year code, week code, facility code, mask rev#, and assembly code. For OTP marking beyond this, certain price adders apply. Please check with your Microchip Sales Office. For OTP devices, any special marking adders are included in OTP price. © 1992 Microchip Technology Inc. DS300151 - page 53 PIC®16C5X Series 20.0 DEVELOPMENT SUPPORT 20.1.1 Host System Requirements: Overview: The PIC16C5X family is supported by a The PICMASTER has been designed as a real-time variety of development tools: emulation system with advanced features generally found on more expensive development tools. The AT - High Performance In-Circuit Emulator (PICMASTER) platform and Windows 3.X environment was chosen to - Low Cost Production Quality Programmer (PICPRO II) best make these features available to you the end user. - Microchip's Universal Production Quality Program- To properly take advantages of these features, mer (PRO MASTER) PICMASTER requires installation on a system having - PC Based Assembler (PICALC) the following minimum configuration: - PC Based Simulator (PICSIM) • PC AT compatible machine: 80286, 386SX, 386DX, or 80486 with ISA or EISA Bus. Microchip offers several bundled development tool sys- tems for convenience and cost benefit to the customer. • EGA, VGA, 8514/A, Hercules graphic card (EGA or For PIC16C5X the following are available: higher recommended). - PICPAK II: Assembler, Simulator, PICPRO 11 • MSDOS I PCDOS version 3.1 or greater. Programmer and windowed • Microsoft Windows® version 3.0 or greater operating samples for development. in either standard or 386 enhanced mode). - PICMASTER-16: Assembler, Simulator, PICPRO II • 1 Mbyte RAM (2 Mbytes recommended). Programmer, PICMASTER emula- • One 5.25" floppy disk drive. tor and windowed samples for de- velopment. • Approximately 10 Mbytes of hard disk (1 Mbyte required for PICMASTER, remainder for Windows 20.1 PICMASTER™: High Performance 3.X system). Universal In-Circuit Emulator System • One 8-bit PC AT (ISA) 1/0 expansion slot (half size) The PICMASTER Universal In-Circuit Emulator System • Microsoft® mouse or compatible (highly recom- is intended to provide the product development engineer mended). with a complete microcontroller design tool set for all microcontrollers in the PIC16CXX and PIC17CXX fami- 20.1.2 Emulator System Components: lies. This system currently supports the PIC16CR54, PIC16C54, PIC16C55, PIC16C56 and PIC16C57, and The PICMASTER Emulator Universal System consists PIC17C42 processors. PIC16C71° support is planned. primarily of 4 major components: Interchangeable target probes allow the system to be • Host-Interface Card: The PC Host Interface Card easily reconfigured for emulation of different proces- connects the emulator system to an IBM PC compat- sors. The universal architecture of the PICMASTER ible system. This high-speed parallel interface re- allows expansion to support all new PIC16CXX and quires a single half-size standard AT I ISA slot in the PIC17CXX microcontrollers. host system. A 37-conductor cable connects the interface card to the external Emulator Control Pod. The Emulator System is designed to operate on low-cost PC compatible machines ranging from 80286-AT class • Emulator Control Pod: The Emulator Control Pod ISA-bus systems through the new 80486 EISA-bus contains all emulation and control logic common to all machines. The development software runs in the microcontroller devices. Emulation memory, trace Microsoft Windows® 3.0 environment, allowing the op- memory, event and cycle timers, and trace/breakpoint erator access to a wide range of supporting software and logic are contained here. The Pod controls and accessories. interfaces to an interchangeable target-specific emu- lator probe via a 14" precision ribbon cable. Provided with the PICMASTER System is a high perfor- mance real-time In-Circuit Emulator, a programmer unit • Target-specific Emulator Probe: A probe specific and a macro assembler program. to microcontroller family to be emulated is installed on the ribbon cable coming from the control pod. This Coupled with the user's choice of text editor, the system probe configures the universal system for emulation is ready for development of products containing any of of a specific microcontroller. Microchip's microcontroller products. • PC Host Emulation Control Software: Host soft- A "Quick Start" PIC Product Sample Pak containing ware necessary to control and provide a working user user programmable parts is included for additional con~ interface is the last major component of the system. venience. The emulation software runs in the Windows 3.X Microchip provides additional customer support to de- environment, and provides the user with full display, velopers through an Electronic Bulletin Board System alter, and control of the system under emulation. The (EBBS). Customers have access to the latest updates Control Software is also universal to allmicrocontroller in software as well as application source code ex- families. amples. Consult your local sales representative for information on accessing the BBS system. 08300151 - page 54 © 1992 Microchip Technology Inc. PIC®16C5X Series The Windows 3.X System is a multitasking operating between two or more Windows programs. With this system which will allows the developer to take full feature, data collected with PICMASTER can be auto- advantage of the many powerful features and func- matically transferred to a spreadsheet or database tions of the PICMASTER system. program for further analysis. PICMASTER emulation can operate in one window, Under Windows 3.X, two or more PICMASTER emula- while a text editor is running in a second window. tors can run simultaneously on the same PC making Dynamic Data Exchange (DDE), a feature of Windows development of multi-microcontroller systems possible 3.X, will be available in this and future versions of the (e.g., a system containing a PIC16Cxx processor and a software. DDE allows data to be dynamically transferred PIC17Cxx processor). FIGURE 20.1.1 - PICMASTER FIGURE 20.1.2- PICMASTER SYSTEM CONFIGURATION In-Line Power Supply 90-250VAC (Optional) Power Switch Power Connector Aux. PC-Interface Common Interface Card PICMASTER Emulator Pod PC Compatible Computer (AT/ISA Bus) (for Industry Standard Architecture) © 1992 Microchip Technology Inc. DS30015I- page 55 PIC®16C5X Series FIGURE 20.1.3 - PICMASTER TYPICAL radix can be set by the user and the execution can be SCREEN performed in single step, execute until break or in a trace mode. PICSIM uses two forms of symbolic debugging: PIC-MASTER-D~ICEWINIDDEDEMO.OBJ ~ • an internal symbol table for disassembling opcodes and Trace Memory Dump the displaying of source code from a listing file. PICSIM 0880 086a capl retlw retlw 080 06a offers the low cost flexibility to develop and debug code Microsoft Excel outside of the laboratory environment making it an excellent multi project software development tool. G 20.5 PICPRO™ II Programmer l0ata From PIC-MASTER via DDEI PICPRO 11 is a production quality programmer with both 2-400 stand-alone and PC based operation. The PICPRO II 2300 will program the entire family of PIC16C5X series of 8- 2200 bit microcontrollers. It can read, program, verify, and 2100 2000 code protect parts without the need of a PC host. Its EEPROM memory holds programming data and para- metric information even when power is removed making it ideal for duplicating Pl Cs. It can also operate with a PC 20.2 PICPAK-11™ Development Kit host and do complete read, program, verify, as in stand- When real time or in-circuit emulation is not required for alone mode with the additional features of program code development the PICPAK-11 (PIC Applications Kit) buffer editing, serialization of both code-protected and offers the right solution. This very low cost PC hosted non code-protected parts. The PICPRO II comes with software development tool combines the power and both 28 and 18 pin zero insertion force programming versatility of the PICALC assembler and PICSIM simu- sockets on a removable socket module. Additional lator software tools to compile, execute, debug and socket modules are available for the SOIC and PLCC analyze microcode in a PC hosted environment. Micro- packages. The PICPRO II conforms fully to Microchip's code debugging capability includes software trace, Programming Algorithm. Its programmable Vee and VPP breakpoints, symbolic debug and stimulus file genera- supplies allow the PICPRO II to support PIC microcon- tion. An EPROM PIC Programmer (PICPRO 11) and trollers with various operating voltage ranges. "Quick Start" PIC16C5X product sample PAK is included for final code verification. 20.6 PRO MASTER™ The PRO MASTER programmer is a production quality 20.3 PICALC Cross-Assembler programmer capable of operating in stand alone mode The PIC Cross Assembler PICALC is a PC hosted as well as PC-hosted mode. software development tool supporting the PIC16C5X The PRO MASTER has programmable Voo and VPP CMOS series and PIC16C5X/7X NMOS series micro- supplies which allows it to verify the PIC at Voo min and controllers. PICALC offers a full featured Macro and Voo max for maximum reliability. It has an LCD display Conditional assembly capability. It can also generate for displaying error messages, keys to enter commands various object code formats including several Hex for- and a modular detachable socket assembly to support mats to support Microchip's proprietary development various package types. In stand alone mode the PRO tools as well as third party tools. Also supports Hex MASTER can read, verify or program a part. It can also set fuse configuration and code-protect in this mode. It's (default), Decimal and Octal Source and listing formats. EEPROM memory holds data and parametric informa- An assembler users manual is available for detailed tion even when powered down. It is ideal for low to support. moderate volume production. In PC-hosted mode, the PRO MASTER connects to the 20.4 PICSIM™ Software Simulator PC via one of the COM (RS232) ports. A PC based user- interface software makes using the programmer simple PICSIM is a software tool which allows for PIC16C5X and efficient. The user interface is full-screen and menu- code development in a PC host environment. The based. Full screen display and editing of data, easy PICSIM software allows you to simulate the PIC16C5X selection of fuse configuration and part type, easy selec- series microcontroller products on an instruction level. tion of Voo min, Voo max and VPP levels, load and store On any given instruction, the user may examine or to and from disk files (intel hex format) are some of the modify any of the data areas within the PIC or provide features of the software. Essential commands such as external stimulus to any of the pins. The inpuVoutput read, verify, program, blank check can be issued from the screen. Additionally, serial programming support is DS30015I - page 56 © 1992 Microchip Technology Inc. PIC®16C5X Series possible where each part is programmed with a different 21.2 Production Quality Programmers serial number, sequential or random. Microchip's proprietary PICPRO II programmer can be The PRO MASTER has a modular "programming socket used for reliable programming for production. High module". Different socket modules are required for volume programming is also supported by production different processor types and/or package types. It is quality programmers from third party sources. See table planned that the PRO MASTER will support all current 21.2.1. and future PIC16CXX and PIC17CXX processors. Cur- rently socket modules are available for the PIC16C54, Microchip assumes no responsibility for replacing defec- PIC16C55, PIC16C56, PIC16C57, PIC17C42 and the tive units related to mechanical and/or electrical prob- PIC16C71. lems of any third party programming equipment or the improper use of such equipment. 21.0 EPROM PROGRAMMING Programming of the code protection bit (also called "security bit" or "security fuse") implies that the contents 21.1 Prototype Programmers of the PIC16C5X EPROM can no longer be verified, thus making programming related failure analysis an impos- Microchip's proprietary PIC16C5X series Development sibility. System and PICPRO, were not designed for high vol- ume production programming but were designed strictly Microchip warrants that PIC16C5X units will not exceed to support engineering development level programming a programming failure rate of 1% of shipment quality. of PIC16C5X EPROM and OTP units. Microchip as- Programming related failures beyond this level can be sumes no responsibility for the replacement of program- returned for replacement, again, if the security bit has ming rejects when these development tools are used to not been programmed. support high volume production level programming. 21.3 Gang Programmers Gang programmers are available from third party sources. See table 21.2.1. 21.4 Factory Programming High volume factory programming (QTP) is an available service from Microchip Technology. A small price adder and minimum quantity requirements apply. TABLE 21.2.1 LIST OF 3RD PARTY PROGRAMMERS* Company Model Contact Company Model Contact ADVIN Systems, lnc.t PILOTTM.U40 408-984-8600 U.S. Hl-LOt ALL-03 02 7640215 Taiwan Application Solutions Ltd. PIC Programmer 273 476608 U.K. Link Computer Graphicst CLK-3100 301-994-6669 U.S. Baradine Products Ltd. Micro-Burner™ 604-988-9853 Canada Logical Devices, Inc. ALLPROTM.88 800-331-7766 U.S. 305-974-0967 U.S. BP Microsystems CP-1128™ 800-225-2102 U.S. 713-461-4958 U.S. Magic 1/0 SPPIC 5957292 Taiwan Citadel Products Ltdt PC-82 44-819-511-848 u.K. Maple Technology, Ltd MQP-200 44-666-825-146 U.K. Data 1/0 Corporation Unisite™with 800-288-4065 U.S. Parallax, Inc. PIC16C5X-PGM 916-721-6669 U.S. Site-48™ module 31 (0) 6622866 Europe SMS Sprint™ Expert 49-7522-4460 Germany (03) 432-6991 Japan Stag Microsystemst PP39 44-707-332-148 U.K. Elan Digital Systems Ltd. EF-PER™ 0489 579 799 U.K. 5000 Series (408) 946 3864 U.S. Transdata PGM16 (214) 980 2960 Gang Programmer PGM 16x8 Gang Programmer * As of July, 1992 t Product is available but Microchip has not evaluated it yet (as of July, 1992). All trademarks shown in table 21.2.1 belong to their respective holders. © 1992 Microchip Technology Inc. 0$300151- page 57 PIC®16C5X Series Notes: 08300151 - page 58 © 1992 Microchip Technology Inc. PIC®16C5X Series Index Absolute maximum ratings ................. ~ .................... 29 Typical characteristics graphs AC characteristics (XT,RC,HS,LP) COM/IND ......... 35 loo vs freq ........................................................ 41 Block diagrams: IOH VS VOH ........................................................................ 43 Chip .................................................................... 4 IOL VS VOL ......................................................................... 43 1/0 Pin .............................................................. 13 IPo vs Voo .................................................................. 38,39 Power On Reset ............................................... 26 RC osc freq vs temp ........................................ 37 RTCC (Simplified) .............................................. 6 RC osc freq vs Voo ................................................ 37,38 RTCC & WOT .................................................. 17 VIH, VIL of MCLR, RTCC and OSC1 vs Voo ... ..40 Brown-out protection circuit ..................................... 25 VTH of 1/0 Pins vs Voo ................................................ 39 Code protection ....................................................... 28 VTH of OSC1 Input VS Voo ........................................ 39 Configuration fuses ................................................. 27 Transconductance of HS Oscillator vs Voo ....... 42 Data memory map ..................................................... 7 Transconductance of LP Oscillator vs Voo ........ 42 DC characteristics (XT,RC,HS,LP) COM ...... 30,33,35 Transconductance of XT Oscillator vs Voo ........ 42 DC characteristics (XT,RC,HS,LP) IND ........ 31,33,35 WOT Timer Time-out Period vs Voo ..................... 42 Development tools .................................................. 54 UV Erasable devices .............................................. 5,6 External power on reset circuit ................................ 25 W register ................................................................ 15 Features overview ..................................................... 1 WOT ........................................................................ 23 File register descriptions to ........................................................................ 6 f1 ........................................................................ 6 f2 ........................................................................ 8 f3 ...................................................................... 11 f4 ...................................................................... 12 1/0 ports ............................................................. 13, 14 ID locations ............................................................. 27 Indirect addressing .................................................... 6 Instruction set .......................................................... 18 OPTION register ..................................................... 15 Oscillator ....................................................... 23,24,25 Oscillator Start-up Timer ......................................... 25 OTP devices .............................................................. 5 Package information ................. 45,46,47,48,49,50,51 Page select (Program memory) ........................... 9, 1O PD bit ...................................................................... 12 Pin-out information ............................................... 1,29 Power Down mode (SLEEP) ................................... 27 Power On Reset ............................................ 25,26,27 Prescaler (RTCC/WDT) ..................................... 16, 17 Program Counter ....................................................... 8 Program memory map ............................................ 10 Programming information ........................................ 57 QTP devices ............................................................ 5,6 Real Time Clock/Counter (RTCC) ................ 8,9, 16, 17 RESET .................................................................... 16 Trademarks: SLEEP ..................................................................... 27 Stack ......................................................................... 9 PIC is a registered trademark of Microchip Technology Status register ......................................................... 11 Incorporated. Timing diagrams PIC-PAK, PICPRO, PICMASTER, PRO MASTER, and 1/0 pin ......................................................... 13,36 PICSIM are trademarks of Microchip Technology Incorpo- Oscillator Start-up timing .................................. 36 rated. Power On Reset .......................................... 25,26 IBM PC is a trademark of IBM Corporation. RTCC timing .............................................. 8,9,36 MS DOS and Microsoft Windows are registered trademarks TO bit ...................................................................... 12 of Microsoft Corporation. TRIS registers ......................................................... 15 © 1992 Microchip Technology Inc. DS300151 - page 59 PIC®16C5X Series SALES AND SUPPORT To order or to obtain information, e.g., on pricing or delivery, please use the listed part numbers, and refer to the factory or the listed sales offices. For the currently available code-combinations, refer to previous page. PART NO.~ x T -· ~ 3-Digit Pattern Code for OTP (blank for OTP and Window Parts) P = PDIP SS = SSOP (209 mil) yPackage: SO = 300 mil SOIC (Gull Wing Lead) JW* = CERDIP Window SP = 28L PDIP (300 mil) S = Die in Waffle Pack JTemperature - = o· C to +70'C (T for tape/reel) '------111 Range: ~ = -40' C to +85'C (S for tape/reel) -40'C to + 125'C Oscillator RC Examples: .____ _ _ _-1 Type: XT a) PIC16C54- XT/PXXX = "XT" oscillator, commercial HS temp., PDIP, OTP pattern LP b) PIC16C55 - XTl/SO = "XT" oscillator, industrial temp., SOIC (OTP device) Device: PIC16C54 c) PIC16C55 - JW = Commercial temp. PIC16C55 CERDIP with WINDOW PIC16C56 d) PIC16C57-RCl/S ="RC oscillator", industrial temp., dice PIC16C57 in waffle pack. e) PIC16C54-LPE/SS ="LP oscillator", Automotive temp., SSOP package Notes: • For UV-erasable devices, the oscillator type is RC by default (= erased device). The user can select XT, HS, or LP oscillators by programming the appropriate fuses. Microchip Technology Incorporated Printed in USA © 9207 ASIA I PACIFIC UNITED STATES South-East Region Microchip Technologylnc. Japan Corporate Office 1521 Johnson Ferry Road NE Microchip Technology Inc. Suite 170 Microchip Technology Inc. 2355 West Chandler Blvd. Marietta, GA 30062 Shinyokohama Gotoh Bldg. 8F, 3-22-4 Tel: 404 509-8800 Fax: 404 509-8600 Shinyokohama, Kohoku-Ku, Yokohama-Shi Chandler, AZ 85224-6199 Kanagawa 222 Japan Tel: 602 963-7373 Fax: 602 899-9210 Tel: 45/471 6166 Fax: 45/471 6122 North-Central Region North-East Region Microchip Technology Inc. Microchip Technology Inc. 665 Tollgate Road, Unit C Five The Mountain Road, Suite 120 Elgin, IL 60123-9312 EUROPE Framingham, MA 01701 Tel: 708 741-0171 Fax: 708 741-0638 Tel: 508 820-3334 Fax: 508 820-4326 United Kingdom South-Central Region Arizona Microchip Technology LTD. Mid-Atlantic Region Microchip Technology Inc. Unit 3, Meadow Bank, Furlong Road Microchip Technology Inc. 17480 N Dallas Parkway, Suite 114 Bourne End, Bucks SL8 5AJ 300 Wheeler Road, Suite 206 Dallas, TX 75287 Tel: 62 885 0303 Fax: 62 885 0178 Hauppauge, NY 11788 Tel: 214 733-0391 Fax: 214 250-4631 T~I: 516 232-1930 Fax: 516 232-1935 Germany North-West Region Arizona Microchip Technology GMBH Microchip Technology Inc. Alte Landstrasse 12-14 2107 N First Street, Suite 41 O D-8012 Ottobrunn, Germany San Jose, CA 95131 Tel: 089 609 6072 Fax: 089 609 1997 Tel: 408 436-7950 Fax: 408 436-7955 France South-Wes.t Region Arizona Microchip Technology SARL Microchip Technology Inc. 2, Rue Du Buisson aux Fraises ® 1411 W 190th Street, Suite 230 F-91300 Massy, France Gardena, CA 90248-4307 Tel: 1 69 30 90 90 Fax: 1 69 30 90 79 Microchip Tel: 310 323-1888 Fax: 310 323-1424 "Information contained In this publication regarding device applications and the like is intended by way of suggestion only. No representation or warranty is given and no liability Is assumed by Microchip Technology Inc. with respect to the accuracy or use of such Information. Use of Microchlp's products as critical components in life support systems is not authorized except with express written approval by Microchip. The Microchip logo and name is a registered trademark of Microchip Technology Incorporated. All rights reserved". DS300151- page 60 © 1992 Microchip Technology Inc.