FLASH Memory Programming Specification TABLE 1-1: PIN DESCRIPTIONS (DURING PROGRAMMING): PIC16F72



Similar documents
AN709. System Level Design Considerations When Using I 2 C TM Serial EEPROM Devices INTRODUCTION INSURING BUS-FREE DURING POWER-UP

PIC16F877A. FLASH Memory Programming Specification 1.0 PROGRAMMING THE PIC16F87XA

AN688. Layout Tips for 12-Bit A/D Converter Application GETTING A GOOD START INTRODUCTION. Microchip Technology Inc. / 2 MCP602

PIC10F200/202/204/206

AN680. Passive RFID Basics INTRODUCTION DEFINITIONS. Modulation. Reader. Tag. Carrier. Microchip Technology Inc.

TCM809/TCM Pin Microcontroller Reset Monitors. General Description. Features. Applications. Pin Configurations. Typical Application Circuit

M Floating Point to ASCII Conversion

How to Implement ICSP Using PIC12C5XX OTP MCUs VDD. GP3/MCLR/VPP ICSP Connector. To application circuit Isolation circuits

AN831. Matching Small Loop Antennas to rfpic Devices INTRODUCTION CALCULATING THE LOOP RADIATION RESISTANCE AND LOSS RESISTANCE EQUATION 2:

A CAN Physical Layer Discussion

Code Hopping Decoder Using a PIC16C56

M Floating Point to ASCII Conversion

AN713. Controller Area Network (CAN) Basics INTRODUCTION CAN PROTOCOL BASICS CAN OVERVIEW

Technical Brief Secure Learning RKE Systems Using KEELOQ Encoders

AN844. Simplified Thermocouple Interfaces and PICmicro MCUs INTRODUCTION. Linearization THERMOCOUPLE CIRCUITS. Absolute Temperature Reference.

AN699. Anti-Aliasing, Analog Filters for Data Acquisition Systems ANALOG VERSUS DIGITAL FILTERS INTRODUCTION. Microchip Technology Inc.

How To Use A Temperature Sensor On A Microchip Computer (For Microchip)

AN562. Using Endurance Predictive Software. Using the Microchip Endurance Predictive Software INTRODUCTION TOTAL ENDURANCE PREDICTIVE SOFTWARE

Voltage-to-Frequency/Frequency-to-Voltage Converter

TB026. Calculating Program Memory Checksums Using a PIC16F87X ACCESSING MEMORY INTRODUCTION. PIC16C7X vs. PIC16F87X. Microchip Technology Inc.

TCM V To ±10V Voltage Converter. General Description. Features. Applications. Package Type. Typical Operating Circuit

TC652/TC653. Integrated Temperature Sensor & Brushless DC Fan Controller with FanSense Detect & Over-Temperature. Features.

AN685. Thermistors in Single Supply Temperature Sensing Circuits INTRODUCTION THERMISTOR OVERVIEW. Current-Over-Time Mode. Voltage-Versus-Current Mode

TB040. Fast Integer Square Root THE ALGORITHM INTRODUCTION SQUARE ROOT FLOW CHART

Section 27. Device Configuration Bits

AN1303. Software Real-Time Clock and Calendar Using PIC16F1827 DATA INTERFACE INTRODUCTION IMPLEMENTATION INTERNAL REGISTER MAP

TB056. Demonstrating the Set_Report Request With a PS/2 to USB Keyboard Translator Example INTRODUCTION. The Set_Report Request.

AN679. Temperature Sensing Technologies SO MANY TEMPERATURE SENSORS INTRODUCTION. Microchip Technology Inc.

Driving Power MOSFETs in High-Current, Switch Mode Regulators V GS(TH) In equation form: and. I G = Q G /t (transition) where: For example:

TB3016. Using the PIC MCU CTMU for Temperature Measurement IMPLEMENTATION BASIC PRINCIPLE MEASUREMENT CIRCUIT

AN717. Building a 10-bit Bridge Sensing Circuit using the PIC16C6XX and MCP601 Operational Amplifier

WORKSHOP-IN-A-BOX 2: LOW POWER SOLUTIONS DEMONSTRATION BOARD

AN1286. Water-Resistant Capacitive Sensing INTRODUCTION THEORY OF OPERATION. Sensing Steps. Sensing Steps Description DESIGN

HCS200. KEELOQ Code Hopping Encoder DESCRIPTION FEATURES PACKAGE TYPES BLOCK DIAGRAM. Security. Operating. Other. Typical Applications

Analog-to-Digital Converters

AN826. Crystal Oscillator Basics and Crystal Selection for rfpic TM and PICmicro Devices INTRODUCTION OSCILLATOR MODELS. Microchip Technology Inc.

AN905. Brushed DC Motor Fundamentals INTRODUCTION PRINCIPLES OF OPERATION. Stator. Rotor SIMPLE TWO-POLE BRUSHED DC MOTOR. Microchip Technology Inc.

AN873. Using the MCP2515 CAN Developer s Kit INTRODUCTION. PC Node. PICmicro Node BLOCK DIAGRAM OF MCP2515 DEVELOPMENT BOARD

AN1142. USB Mass Storage Class on an Embedded Host INTRODUCTION. USB Mass Storage Class. Overview

MCP3021. Low Power 10-Bit A/D Converter With I 2 C Interface. Description. Features. Applications. Functional Block Diagram.

TB055. PS/2 to USB Mouse Translator IMPLEMENTATION OVERVIEW. Hardware FIGURE 1: PS/2 TO USB MOUSE TRANSLATOR HARDWARE DIAGRAM (1)

TC110. PFM/PWM Step-Up DC/DC Controller. Features. General Description. Applications. Functional Block Diagram. Device Selection Table

AN723. Operational Amplifier AC Specifications and Applications INTRODUCTION FREQUENCY DOMAIN SPECIFICATIONS

High Speed CAN Transceiver. 8 Externally controlled slope for reduced RFI emissions Detection of ground fault (permanent dominant) on TXD input

dspic30f3012/3013 dspic30f3012/3013 Rev. B0 Silicon Errata dspic30f3012/3013 (Rev. B0) Silicon Errata Silicon Errata Summary

Recommended Usage of Microchip 23X256/23X640 SPI Serial SRAM Devices RECOMMENDED CONNECTIONS FOR 23X256,23X640 SERIES DEVICES VCC 23X256/ HOLD.

Operational Amplifier Topologies and DC Specifications

Installing and Licensing MPLAB XC C Compilers

Interfacing Pressure Sensors to Microchip s Analog Peripherals V OUT- Silicon Substrate

RC Model Aircraft Motor Control. Solutions. PWM Rate khz 1 PIC12C508A limited None None PIC16F Yes Yes Yes 32, 8, 2

AN956. Migrating Applications to USB from RS-232 UART with Minimal Impact on PC Software OVERVIEW INTRODUCTION. Microchip Technology Inc.

AN1470. Manchester Decoder Using the CLC and NCO ABSTRACT INTRODUCTION MANCHESTER ENCODED DATA (AS PER G.E. THOMAS)

AN Wire Communication with PIC Microcontroller INTRODUCTION. OVERVIEW OF THE 1-Wire BUS. 1-Wire Protocol. Prerequisites

TC648. Fan Speed Controller with Auto-Shutdown and Over-Temperature Alert. Package Types. Features TC648. General Description.

dspic33e/pic24e dspic33e/pic24e Flash Programming Specification 1.0 DEVICE OVERVIEW 2.0 PROGRAMMING OVERVIEW OF THE dspic33e/pic24e

MCP3204/ V 4-Channel/8-Channel 12-Bit A/D Converters with SPI Serial Interface. Features. Description. Applications. Functional Block Diagram

HCS301. KEELOQ Code Hopping Encoder DESCRIPTION FEATURES PACKAGE TYPES HCS301 BLOCK DIAGRAM. Security. Operating. Other. Typical Applications

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Integrated Development Environment

AN734. Using the PICmicro SSP for Slave I 2 C TM Communication INTRODUCTION THE I 2 C BUS SPECIFICATION

HANDLING SUSPEND MODE ON A USB MOUSE

Section 28. In-Circuit Serial Programming (ICSP )

AN1325. mtouch Metal Over Cap Technology THEORY OF OPERATION INTRODUCTION CROSS SECTION OF METAL OVER CAPACITIVE (UNPRESSED)

PACKAGE OUTLINE DALLAS DS2434 DS2434 GND. PR 35 PACKAGE See Mech. Drawings Section

Timers: Timer0 Tutorial (Part 1)

Universal Programming Module 2

Fondamenti su strumenti di sviluppo per microcontrollori PIC

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

AN1265. KEELOQ with AES Microcontroller-Based Code Hopping Encoder INTRODUCTION DUAL ENCODER OPERATION BACKGROUND FUNCTIONAL INPUTS AND

General Porting Considerations. Memory EEPROM XRAM

AN1156. Battery Fuel Measurement Using Delta-Sigma ADC Devices INTRODUCTION REVIEW OF BATTERY CHARGING AND DISCHARGING CHARACTERISTICS

CAT28C64B F R E E. 64K-Bit CMOS PARALLEL EEPROM L E A D FEATURES DESCRIPTION BLOCK DIAGRAM

HT1632C 32 8 &24 16 LED Driver

AN974 APPLICATION NOTE

AN1275. KEELOQ with Advanced Encryption Standard (AES) Receiver/Decoder KEY FEATURES OVERVIEW. Microchip Technology Inc.

In-Circuit Serial Programming (ICSP ) Guide

DS1821 Programmable Digital Thermostat and Thermometer

AN687. Precision Temperature-Sensing With RTD Circuits RTD OVERVIEW INTRODUCTION EQUATION 1:

AN880. Converting from 8051 to Microchip Assembler: A Quick Reference INTRODUCTION

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

Features. Instruction. Decoder Control Logic, And Clock Generators. Address Compare amd Write Enable. Protect Register V PP.

25AA640/25LC K SPI Bus Serial EEPROM. Device Selection Table. Description. Features. Block Diagram. Package Types

TC1047/TC1047A. Precision Temperature-to-Voltage Converter. General Description. Applications. Block Diagram. Features.

2-wire Serial EEPROM AT24C512

Dolphin In-Circuit programming Updating Firmware in the field

HT6P OTP Encoder

Production Flash Programming Best Practices for Kinetis K- and L-series MCUs

Uninstalling Incorrect USB Device Drivers

AN885. Brushless DC (BLDC) Motor Fundamentals INTRODUCTION CONSTRUCTION AND OPERATING PRINCIPLE. Stator. Padmaraja Yedamale Microchip Technology Inc.

MCP2515 Development Kit User s Guide

PRO MATE II USER S GUIDE

AN1754 APPLICATION NOTE

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

IRTC Compensation and 1 Hz Clock Generation

Section 15. Input Capture

Features. Dimensions

Transcription:

M PIC16F72 FLASH Memory Programming Specification This document includes the programming specifications for the following device: PIC16F72 1.0 PROGRAMMING THE PIC16F72 The PIC16F72 is programmed using a serial method. The Serial mode allows the PIC16F72 to be programmed while in the users system, allowing for increased design flexibility. This programming specification applies to PIC16F72 devices in all packages. 1.1 Hardware Requirements The PIC16F72 requires two programmable power supplies, one for VDD (2.0V to 5.5V) and the other for VPP of 12.75V to 13.25V. Both supplies should have a minimum resolution of 0.25V. 1.2 Programming Mode The Programming mode for the PIC16F72 allows programming of user program memory, special locations used for ID, and the configuration word. Pin Diagram PDIP, SOIC, SSOP, MLF MCLR/VPP RA0/AN0 RA1/AN1 RA2/AN2 RA3/AN3/VREF RA4/T0CKI RA5/AN4/SS VSS OSC1/CLKI OSC2/CLKO RC0/T1OSO/T1CKI RC1/T1OSI RC2/CCP1 RC3/SCK/SCL 1 2 3 4 5 6 7 8 9 10 11 PIC16F72 28 27 26 25 24 23 22 21 20 19 18 12 17 13 16 14 15 RB7/PGD RB6/PGC RB5 RB4 RB3 RB2 RB1 RB0/INT VDD VSS RC7 RC6 RC5/SDO RC4/SDI/SDA TABLE 1-1: PIN DESCRIPTIONS (DURING PROGRAMMING): PIC16F72 During Programming Pin Name Function Pin Type Pin Description RB6/PGC CLOCK I Clock Input RB7/PGD DATA I/O Data Input/Output MCLR/VPP VTEST MODE P Program Mode Select VDD VDD P Power Supply VSS VSS P Ground Legend: I = Input, O = Output, P = Power 2002 Microchip Technology Inc. Preliminary DS39588A-page 1

2.0 PROGRAM MODE ENTRY 2.1 User Program Memory Map The user memory space extends from 0x0000 to 0x07FF (2K). Table 2-1 shows the actual implementation of program memory in the PIC16F72. Configuration memory begins at 0x2000, and continues to 0x3FFF. The PC will increment from 0x0000 to 0x1FFF and wrap to 0x0000, 0x2000 to 0x3FFF and wrap around to 0x2000 (not to 0x0000). Once in configuration memory, the highest bit of the PC stays a 1, thus, always pointing to the configuration memory. The only way to point to program memory is to reset the part and re-enter Program/Verify mode, as described in Section 2.3. Configuration memory is selected when the PC points to any address in the range of 0x2000-0x201F; however, only locations 0x2000 through 0x2007 are implemented. Addressing locations beyond 0x201F will access program memory (see Figure 2-1). 2.2 ID Locations A user may store identification information (ID) in four ID locations mapped to [0x2000:0x2003]. It is recommended that each ID location word is written as 11 1111 1000 bbbb, where bbbb is ID information. The ID locations can be read even after code protection is enabled. To understand the program memory read mechanism after code protection is enabled, refer to Section 4.0. Table 4-1 shows specific calculations and behavior for the PIC16F72 device. TABLE 2-1: Device PIC16F72 PROGRAM MEMORY IMPLEMENTATION IN THE PIC16F72 Program Memory Size 0x0000 0x07FF (2K) DS39588A-page 2 Preliminary 2002 Microchip Technology Inc.

FIGURE 2-1: PROGRAM MEMORY MAPPING 2K words Implemented Implemented 0h 1FFh 3FFh 400h 7FFh Reserved 2000h 2001h 2002h ID Location ID Location ID Location Reserved 1FFFh 2000h 2007h 2008h 201Fh 2020h 2003h ID Location 2004h Reserved 2005h 2006h 2007h Reserved Device ID Configuration Word Accesses 0x0020 to 0X0FFF 3FFFh 2002 Microchip Technology Inc. Preliminary DS39588A-page 3

2.3 Program/Verify Mode The Program/Verify mode is entered by holding pins RB6 and RB7 low, while raising MCLR pin from VIL to VPP. Once in this mode, the user program memory and the configuration memory can be accessed and programmed in serial fashion (RB6 and RB7 are Schmitt Trigger inputs in this mode). The sequence that enters the device into the Programming/Verify mode places all other logic into the RESET state. All I/O are in the RESET state (high impedance inputs). A device RESET will clear the PC and point to address 0x0000. The Increment Address command will increment the PC. The Load Configuration command will set the PC to 0x2000. The available commands are shown in Table 2-2. The normal sequence for programming two program memory words at a time is as follows: 1. Issue the Load Data command to load a word at the current (even) program memory address. 2. Issue an Increment Address command. 3. Load a word at the current (odd) program memory address using the Load Data command. 4. Issue a Begin Programming command to begin programming. 5. Wait tprog (about 1 ms). 6. Issue an End Programming command. 7. Increment to the next address. 8. Repeat this sequence as required to write program and configuration memory. The alternative sequence for programming one program memory word at a time is as follows: 1. Set a word for the current memory location using the Load Data command. 2. Issue a Begin Programming command to begin programming. 3. Wait tprog. 4. Issue an End Programming command. 5. Increment to the next address. 6. Repeat this alternative sequence as required to write program and configuration memory. The address and program counter is reset to 0x0000 by resetting the device (taking MCLR below VIL) and re-entering Programming mode. Program and configuration memory may then be read or verified using the Read Data and Increment Address commands. 2.3.1 SERIAL PROGRAM/VERIFY OPERATION RB6 is used as a clock input pin, and RB7 is used for entering command bits and data input/output. To enter a command, the clock pin (RB6) is pulsed six times. Each command bit is latched on the falling edge of the clock (RB6), with the Least Significant bit (LSb) of the command being entered first. The data on pin RB7 needs a minimum setup (tset1) and hold time (thold1), with respect to the falling edge of the clock. The read and load commands are specified to have a minimum delay (tdly1) between the command and data. After this delay, the clock pin is cycled 16 times with the first cycle being a START bit (0) and the last cycle being a STOP bit (0). Data is transferred LSb first (see Figure 5-1). During a read operation, the LSb will be output to pin RB7 on the rising edge of the second clock pulse and during a load operation, the LSb will be latched on the falling edge of the second clock pulse. A minimum delay (tdly2) is required between consecutive commands (see Figure 5-2). To allow for decoding of commands and reversal of data pin configuration, a time separation of at least (tdly1) is required between a command and a data word, or another command (see Figure 5-3). The available commands are listed below: Load Configuration Load Data for Memory Read Data from Memory Increment Address Begin Programming Bulk Erase Program Memory End Programming TABLE 2-2: COMMAND MAPPING FOR PIC16F72 Command Mapping (MSb LSb) Data Load Configuration (Set PC = 2000h) X X 0 0 0 0 0, data (14), 0 Load Data for Memory X X 0 0 1 0 0, data (14), 0 Read Data from Memory X X 0 1 0 0 0, data (14), 0 Increment Address X X 0 1 1 0 Begin Programming X X 1 0 0 0 Bulk Erase Program Memory (Chip Erase) X X 1 0 0 1 End Programming X X 1 1 1 0 DS39588A-page 4 Preliminary 2002 Microchip Technology Inc.

2.3.1.1 Load Configuration After receiving the Load Configuration command, the PC will be set to 0x2000 and the data sent with the command is discarded. The four ID locations and the configuration word can then be programmed using the normal programming sequence, as described in Section 2.3. A description of the memory mapping schemes of the program memory for normal operation and Configuration mode operation is shown in Figure 2-1. After the configuration memory is entered, the only way to get back to the user program memory is to exit the Program/Verify Test mode by taking MCLR low. 2.3.1.2 Load Data for Memory The device will load in a 14-bit data word when 16 cycles are applied, as described previously. A timing diagram for the load data command is shown in Figure 5-1. 2.3.1.3 Read Data from Memory The device will transmit data bits out of the memory (program or configuration) currently addressed by the PC, starting with the second rising edge of the clock input. RB7 will go into Output mode on the second rising clock edge and will revert back to Input mode (hi-impedance) after the 16th rising edge. A timing diagram for this command is shown in Figure 5-2. If the device is code protected, user program memory will read all 0 s. Configuration memory can still be read. 2.3.1.4 Increment Address The PC is incremented by one. A timing diagram for this command is shown in Figure 5-3. 2.3.1.6 Chip Erase (Program Memory) Erasure of configuration and program memory begins after this command is received and decoded. The erase sequence is self-timed and it is not necessary to issue an End Programming command, only to wait for the appropriate time interval (tera) for the entire erase sequence, before issuing another command. This procedure will disable code protection (code protect bit = 1); however, all data within the program memory will be erased when this command is executed and thus, the security of the data or code is not compromised. Note: 2.4 Programming Algorithm Requires Variable VDD The PIC16F72 uses an intelligent algorithm, which calls for program verification at VDDAPP. The actual chip erase and programming must be done with VDD in the VDDP range (see Table 5-1). VDDP =VDD range required during programming VDDAPP = VDD in the target application Programmers must verify the PIC16F72 at VDDAPP. Since Microchip may introduce future versions of the PIC16F72 with a broader VDD range, it is best that these levels are user selectable (defaults are OK). Note: All CHIP ERASE operations must take place with VDD between 4.75V and 5.25V. Any programmer not meeting this requirement may only be classified as a prototype or development programmer, but not a production quality programmer. 2.3.1.5 Begin Programming A Load Data command must be issued before every Begin Programming command. Programming of memory (configuration or program) will begin after this command is received and decoded. Programming requires (tprog) time and is terminated using an End Programming command. 2002 Microchip Technology Inc. Preliminary DS39588A-page 5

FIGURE 2-2: PROGRAMMING METHOD FLOW CHART (SHEET 1 OF 3) START CHIP ERASE BLANK CHECK AT VDD = VDDMIN LOAD CONFIGURATION PASS? REPORT POSSIBLE ERASE FAILURE. CONTINUE PROGRAMMING AT USER S OPTION PROGRAM TWO ID LOCATIONS VPP = 12.75 TO 13.25V VDD = VDDP PROGRAM TWO LOCATIONS VPP = 12.75 TO 13.25V VDD = VDDP ALL ID LOCATIONS DONE? A ALL LOCATIONS DONE? VERIFY ALL PROGRAM MEMORY LOCATIONS AT VDD = VDDAPP PASS? REPORT VERIFY FAILURE AT VDDAPP DS39588A-page 6 Preliminary 2002 Microchip Technology Inc.

FIGURE 2-3: PROGRAMMING METHOD FLOW CHART (SHEET 2 OF 3) A INCREMENT ADDRESS TO CONFIGURATION WORD LOAD DATA FOR MEMORY (ODD ADDRESS) BEGIN PROGRAMMING WAIT tprog END PROGRAMMING VERIFY ALL CONFIGURATION MEMORY LOCATIONS AT VDD = VDDAPP PASS? REPORT VERIFY ERROR DONE 2002 Microchip Technology Inc. Preliminary DS39588A-page 7

FIGURE 2-4: PROGRAMMING METHOD FLOW CHART (SHEET 3 OF 3) PROGRAM TWO LOCATIONS VERIFY ALL LOCATIONS START START LOAD DATA FOR MEMORY (EVEN ADDRESS) RESET DEVICE, RETURN TO PROGRAMMING MODE HAS PROGRAM MEMORY BEEN VERIFIED? LOAD CONFIGURATION INCREMENT ADDRESS READ DATA FROM MEMORY LOAD DATA FOR MEMORY (ODD ADDRESS) COMPARE DATA TO EXPECTED DATA BEGIN PROGRAMMING DOES DATA MATCH? FAIL WAIT tprog INCREMENT ADDRESS RETURN END PROGRAMMING ALL LOCATIONS VERIFIED? INCREMENT ADDRESS PASS RETURN RETURN DS39588A-page 8 Preliminary 2002 Microchip Technology Inc.

3.0 CONFIGURATION WORD TABLE 3-1: DEVICE ID VALUE The PIC16F72 has configuration bits in a configuration word located at 0x2007. These bits can be cleared (reads 0 ), or left unchanged (reads 1 ), to select various device configurations. Device ID Word (0x2006) Device Dev Rev PIC16F72 000 000 101 n nnnn 3.1 Device ID Word The device ID word for the PIC16F72 is located at 2006h. The nine Most Significant bits are the device ID number, while the five Least Significant bits are the device revision number. REGISTER 3-1: CONFIGURATION WORD FOR PIC16F72 BOREN CP PWRTEN WDTEN F0SC1 F0SC0 bit 13 bit 0 bit 13-7 Unimplemented: Read as 1 bit 6 BOREN: Brown-out Reset Enable bit (1) 1 = BOR enabled 0 = BOR disabled bit 5 Unimplemented: Read as 1 bit 4 CP: Program Memory Code Protection bit 1 = Code protection off 0 = 0000h to 07FFh code protected (All) bit 3 PWRTEN: Power-up Timer Enable bit (1) 1 = PWRT disabled 0 = PWRT enabled bit 2 bit 1-0 WDTEN: Watchdog Timer Enable bit 1 = WDT enabled 0 = WDT disabled FOSC1:FOSC0: Oscillator Selection bits 11 = RC oscillator 10 = HS oscillator 01 = XT oscillator 00 = LP oscillator Note 1: Enabling Brown-out Reset automatically enables Power-up Timer (PWRT), regardless of the value of bit PWRTEN. Ensure the Power-up Timer is enabled any time Brown-out Reset is enabled. Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as 0 -n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown 2002 Microchip Technology Inc. Preliminary DS39588A-page 9

4.0 CODE PROTECTION Once code protection is enabled, all program memory locations read all 0 s; further programming of program memory is disabled. ID locations and the configuration word may still be read and programmed (1 s to 0 s only). 4.1 Disabling Code Protection The following procedure should be performed before any other programming is attempted. This procedure also turns off code protection (code protect bit = 1); however, all program memory will be erased when this procedure is executed and thus, the security of the code is not compromised. Procedure to disable code protection: a) Issue the Chip Erase command. b) Wait for the erase cycle time (tera) to pass. The program memory is erased, then the configuration memory is erased. 4.2 Embedding Configuration Word and ID Information in the HEX File To allow portability of code, the programmer is required to read the configuration word and ID locations from the HEX file, when loading the HEX file. If configuration word information was not present in the HEX file, then a simple warning message may be issued. Similarly, while saving a HEX file, configuration word and ID information must be included. An option to not include this information may be provided. Microchip Technology Inc. feels strongly that this feature is important for the benefit of the end customer. 4.3 Checksum Computation The checksum is calculated by reading the contents of the PIC16F72 memory locations and adding up the opcodes, up to the maximum user addressable location (i.e., 0x07FFh for the PIC16F72). Any carry bits exceeding 16 bits are neglected. Finally, the configuration word (appropriately masked) is added to the checksum. The checksum is calculated by summing the following: The contents of all program memory locations The configuration word, appropriately masked Masked ID locations (when applicable) The Least Significant 16 bits of this sum are the checksum. Table 4-1 describes how to calculate the checksum for the PIC16F72. Note that the checksum calculation differs depending on the code protection setting. Since the program memory locations read out differently depending on the code protection setting, the table describes how to manipulate the actual program memory values to simulate the values that would be read from a protected device. When calculating a checksum of a non-protected device, the entire program memory can simply be read and summed. The configuration word and ID locations can always be read. TABLE 4-1: Device CHECKSUM COMPUTATION Code Protect Checksum Blank Value 0x05E6 at 0x0000 and max address PIC16F72 OFF SUM[0x000:0x07FF] + CFWD & 0x005F 0xF85F 0x842D ALL CFWD & 0x005F + SUM_ID 0x005E 0x005E Legend: CFWD = Configuration Word SUM[a:b] = [Sum of locations a to b inclusive] SUM_ID = ID locations masked by 0x0F, then concatenated into a 16-bit value with ID0 as the most significant nibble. For example, ID0 = 0x01, ID2 = 0x02, ID3 = 0x03, ID4 = 0x04, then SUM_ID = 0x1234 Checksum = [Sum of all the individual expressions] MODULO [0xFFFF] + = Addition & = Bitwise AND DS39588A-page 10 Preliminary 2002 Microchip Technology Inc.

5.0 PROGRAM/VERIFY MODE ELECTRICAL CHARACTERISTICS 5.1 AC/DC Characteristics TABLE 5-1: TIMING REQUIREMENTS FOR PROGRAM/VERIFY MODE Standard Operating Conditions (unless otherwise stated) Operating Temperature: +10 C TA +40 C Operating Voltage: 4.5V VDD 5.5V Characteristics Sym Min Typ Max Units Conditions/Comments General VDD level for read and verification VDD 2.0 5.5 V VDD level for programming and erasing VDDP 4.75 5.25 V High voltage on MCLR for chip erase and program write operations VPP 12.75 13.25 V (Notes 1, 2) MCLR rise time (VSS to VPP) for Test mode entry tvhhr 1.0 µs (RB6, RB7) input high level VIH1 0.8 VDD V Schmitt Trigger input (RB6, RB7) input low level VIL1 0.2 VDD V Schmitt Trigger input Serial Program/Verify Data in setup time before clock tset1 100 ns Data in hold time after clock thld1 100 ns Data input not driven to next clock input (delay required between command/data or command/command) tdly1 1.0 µs Delay between clock to clock of next command or data tdly2 1.0 µs Clock to data out valid (during read data) tdly3 200 ns Erase cycle time tera 30 ms (Note 3) Programming cycle time tprog 1 3 (4) ms Note 1: VPP should be current limited to about 100 ma. 2: VPP must remain above VDDP + 4.0V to remain in Programming mode, while not actually erasing or programming. 3: The chip erase is self-timed. 4: tprog is expected to be reduced to 1 ms max. 2002 Microchip Technology Inc. Preliminary DS39588A-page 11

FIGURE 5-1: VPP MCLR tset0 RB6 (CLOCK) RB7 (DATA) RESET LOAD DATA COMMAND MODE (PROGRAM/VERIFY) 1 2 3 4 5 6 thld0 0 1 0 0 X X 100 ns min. tset1 thld1 1 µs min. tdly2 tdly1 1 µs min. Program/Verify Test Mode 1 2 3 4 5 15 16 START bit tset1 thld1 100 ns min. STOP bit FIGURE 5-2: READ DATA COMMAND MODE (PROGRAM/VERIFY) VPP MCLR tset0 RB6 (CLOCK) RB7 (DATA) thld0 1 µs min. 1 2 3 4 5 6 1 2 3 4 5 15 16 0 0 1 0 X X tset1 100 ns min. thld1 RB7 = Input tdly2 tdly1 1 µs min. START bit tdly3 RB7 = Output STOP bit RB7 Input RESET Program/Verify Test Mode FIGURE 5-3: INCREMENT ADDRESS COMMAND MODE (PROGRAM/VERIFY) MCLR RB6 (CLOCK) VPP 1 2 3 4 5 6 tdly2 Next Command 1 µs min. 1 2 RB7 (DATA) 0 1 1 0 X X tset1 tdly1 X 0 100 ns min. thld1 1 µs min. RESET Program/Verify Test Mode DS39588A-page 12 Preliminary 2002 Microchip Technology Inc.

Note the following details of the code protection feature on PICmicro MCUs. The PICmicro family meets the specifications contained in the Microchip Data Sheet. Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today, when used in the intended manner and under normal conditions. There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet. The person doing so may be engaged in theft of intellectual property. Microchip is willing to work with the customer who is concerned about the integrity of their code. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as unbreakable. Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our product. If you have any further questions about this matter, please contact the local sales office nearest to you. Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No representation or warranty is given and no liability is assumed by Microchip Technology Incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Microchip s products as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, FilterLab, KEELOQ, MPLAB, PIC, PICmicro, PICMASTER, PICSTART, PRO MATE, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. dspic, ECOMONITOR, FanSense, FlexROM, fuzzylab, In-Circuit Serial Programming, ICSP, ICEPIC, microid, microport, Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM, MXDEV, PICC, PICDEM, PICDEM.net, rfpic, Select Mode and Total Endurance are trademarks of Microchip Technology Incorporated in the U.S.A. Serialized Quick Term Programming (SQTP) is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. 2002, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received QS-9000 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona in July 1999. The Company s quality system processes and procedures are QS-9000 compliant for its PICmicro 8-bit MCUs, KEELOQ code hopping devices, Serial EEPROMs and microperipheral products. In addition, Microchip s quality system for the design and manufacture of development systems is ISO 9001 certified. 2002 Microchip Technology Inc. Preliminary DS39588A - page 13

M WORLDWIDE SALES AND SERVICE AMERICAS Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: 480-792-7627 Web Address: http://www.microchip.com Rocky Mountain 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7966 Fax: 480-792-7456 Atlanta 500 Sugar Mill Road, Suite 200B Atlanta, GA 30350 Tel: 770-640-0034 Fax: 770-640-0307 Boston 2 Lan Drive, Suite 120 Westford, MA 01886 Tel: 978-692-3848 Fax: 978-692-3821 Chicago 333 Pierce Road, Suite 180 Itasca, IL 60143 Tel: 630-285-0071 Fax: 630-285-0075 Dallas 4570 Westgrove Drive, Suite 160 Addison, TX 75001 Tel: 972-818-7423 Fax: 972-818-2924 Detroit Tri-Atria Office Building 32255 Northwestern Highway, Suite 190 Farmington Hills, MI 48334 Tel: 248-538-2250 Fax: 248-538-2260 Kokomo 2767 S. Albright Road Kokomo, Indiana 46902 Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles 18201 Von Karman, Suite 1090 Irvine, CA 92612 Tel: 949-263-1888 Fax: 949-263-1338 New York 150 Motor Parkway, Suite 202 Hauppauge, NY 11788 Tel: 631-273-5305 Fax: 631-273-5335 San Jose Microchip Technology Inc. 2107 North First Street, Suite 590 San Jose, CA 95131 Tel: 408-436-7950 Fax: 408-436-7955 Toronto 6285 Northam Drive, Suite 108 Mississauga, Ontario L4V 1X5, Canada Tel: 905-673-0699 Fax: 905-673-6509 ASIA/PACIFIC Australia Microchip Technology Australia Pty Ltd Suite 22, 41 Rawson Street Epping 2121, NSW Australia Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Microchip Technology Consulting (Shanghai) Co., Ltd., Beijing Liaison Office Unit 915 Bei Hai Wan Tai Bldg. No. 6 Chaoyangmen Beidajie Beijing, 100027, No. China Tel: 86-10-85282100 Fax: 86-10-85282104 China - Chengdu Microchip Technology Consulting (Shanghai) Co., Ltd., Chengdu Liaison Office Rm. 2401, 24th Floor, Ming Xing Financial Tower No. 88 TIDU Street Chengdu 610016, China Tel: 86-28-6766200 Fax: 86-28-6766599 China - Fuzhou Microchip Technology Consulting (Shanghai) Co., Ltd., Fuzhou Liaison Office Unit 28F, World Trade Plaza No. 71 Wusi Road Fuzhou 350001, China Tel: 86-591-7503506 Fax: 86-591-7503521 China - Shanghai Microchip Technology Consulting (Shanghai) Co., Ltd. Room 701, Bldg. B Far East International Plaza No. 317 Xian Xia Road Shanghai, 200051 Tel: 86-21-6275-5700 Fax: 86-21-6275-5060 China - Shenzhen Microchip Technology Consulting (Shanghai) Co., Ltd., Shenzhen Liaison Office Rm. 1315, 13/F, Shenzhen Kerry Centre, Renminnan Lu Shenzhen 518001, China Tel: 86-755-2350361 Fax: 86-755-2366086 Hong Kong Microchip Technology Hongkong Ltd. Unit 901-6, Tower 2, Metroplaza 223 Hing Fong Road Kwai Fong, N.T., Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 India Microchip Technology Inc. India Liaison Office Divyasree Chambers 1 Floor, Wing A (A3/A4) No. 11, O Shaugnessey Road Bangalore, 560 025, India Tel: 91-80-2290061 Fax: 91-80-2290062 Japan Microchip Technology Japan K.K. Benex S-1 6F 3-18-20, Shinyokohama Kohoku-Ku, Yokohama-shi Kanagawa, 222-0033, Japan Tel: 81-45-471-6166 Fax: 81-45-471-6122 Korea Microchip Technology Korea 168-1, Youngbo Bldg. 3 Floor Samsung-Dong, Kangnam-Ku Seoul, Korea 135-882 Tel: 82-2-554-7200 Fax: 82-2-558-5934 Singapore Microchip Technology Singapore Pte Ltd. 200 Middle Road #07-02 Prime Centre Singapore, 188980 Tel: 65-334-8870 Fax: 65-334-8850 Taiwan Microchip Technology Taiwan 11F-3, No. 207 Tung Hua North Road Taipei, 105, Taiwan Tel: 886-2-2717-7175 Fax: 886-2-2545-0139 EUROPE Denmark Microchip Technology Nordic ApS Regus Business Centre Lautrup hoj 1-3 Ballerup DK-2750 Denmark Tel: 45 4420 9895 Fax: 45 4420 9910 France Microchip Technology SARL Parc d Activite du Moulin de Massy 43 Rue du Saule Trapu Batiment A - ler Etage 91300 Massy, France Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany Microchip Technology GmbH Gustav-Heinemann Ring 125 D-81739 Munich, Germany Tel: 49-89-627-144 0 Fax: 49-89-627-144-44 Italy Microchip Technology SRL Centro Direzionale Colleoni Palazzo Taurus 1 V. Le Colleoni 1 20041 Agrate Brianza Milan, Italy Tel: 39-039-65791-1 Fax: 39-039-6899883 United Kingdom Arizona Microchip Technology Ltd. 505 Eskdale Road Winnersh Triangle Wokingham Berkshire, England RG41 5TU Tel: 44 118 921 5869 Fax: 44-118 921-5820 01/18/02 DS39588A-page 14 Preliminary 2002 Microchip Technology Inc.