FACT003. Care and Feeding of the PIC16C74 and Its Peripherals. A/D Converter Mysteries. Assumptions

Similar documents
PIC14C000. Errata Sheet for PIC14C000 Revision A. USING THE I 2 C MODULE IN SMBus MODE USING AN1 AND AN5 AS ANALOG INPUTS

TC623. 3V, Dual Trip Point Temperature Sensor. Package Type. Features. Applications. General Description. Device Selection Table

AN820. System Supervisors in ICSP TM Architectures CIRCUITRY BACKGROUND INTRODUCTION. MCP120 Output Stage. Microchip Technology Inc.

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

AN603. Continuous Improvement THE EEPROM TECHNOLOGY TEAM INTRODUCTION TO MICROCHIP'S CULTURE. Continuous Improvement is Essential

M TC3682/TC3683/TC3684

TC52. Dual Channel Voltage Detector. Features. General Description. Typical Applications. Functional Block Diagram. Device Selection Table

TC51. 1µA Voltage Detector with Output Delay TC51. General Description. Features. Applications. Device Selection Table. Functional Block Diagram

rfpic Development Kit 1 Quick Start Guide

Using the TC1142 for Biasing a GaAs Power Amplifier. CTL High-Side. FET Switch GND V IN V OUT TC GND. Inductorless Boost/Buck Regulator

PIC16C622A PIC16F628 Migration

TC mA Charge Pump Voltage Converter with Shutdown. Features. Package Type. Applications. General Description. Device Selection Table

AN566. Using the PORTB Interrupt on Change as an External Interrupt USING A PORTB INPUT FOR AN EXTERNAL INTERRUPT INTRODUCTION

TC1221/TC1222. High Frequency Switched Capacitor Voltage Converters with Shutdown in SOT Packages. 6-Pin SOT-23A. Features. General Description

1.5A Dual Open-Drain MOSFET Drivers. 8-Pin PDIP/SOIC/CERDIP IN A A BOTTOM IN B B TOP A TOP B BOTTOM IN A B TOP IN B

TC620/TC621. 5V, Dual Trip Point Temperature Sensors. Features. Package Type. Applications. Device Selection Table. General Description

M TC1426/TC1427/TC1428

AN797. TC4426/27/28 System Design Practice INTRODUCTION. FIGURE 1: TC4426 output. FIGURE 2: Output stage IC layout.

TC652 Fan Control Demo Board User s Guide

AN765. Using Microchip's Micropower LDOs INTRODUCTION APPLICATIONS. Optimizing Output Voltage Accuracy of 1070/1071 Adjustable LDOs

TC Low Power, Quad Input, 16-Bit Sigma-Delta A/D Converter Features Package Type 16-Pin PDIP 16-Pin QSOP TC3402 Applications

TC1225 TC1226 TC1227. Inverting Dual ( V IN, 2V IN ) Charge Pump Voltage Converters FEATURES GENERAL DESCRIPTION TYPICAL APPLICATIONS

PIC16C65A. PIC16C65A Rev. A Silicon Errata Sheet. 2. Module: CCP (Compare Mode) 1. Module: CCP (Compare Mode) SWITCHING

FACT002. Mastering the PIC16C7X A/D Converter BASICS. General. Step by Step. Specifications

AN528. Implementing Wake-Up on Key Stroke. Implementing Wake-Up on Key Stroke INTRODUCTION IMPLEMENTATION FIGURE 1 - TWO KEY INTERFACE TO PIC16C5X

HCS362. HCS362 Data Sheet Errata. Clarifications/Corrections to the Data Sheet: 1. Module: Low Voltage Detector LOW VOLTAGE DETECTOR

TC7662A. Charge Pump DC-to-DC Converter. Features. Package Type. General Description. Applications. Device Selection Table. 8-Pin PDIP 8-Pin CERDIP

1.5A Dual High-Speed Power MOSFET Drivers. Temp. Range

TC1029. Linear Building Block Dual Low Power Op Amp. General Description. Features. Applications. Device Selection Table. Functional Block Diagram

HCS410/WM. Crypto Read/Write Transponder Module FEATURES PACKAGE TYPES BLOCK DIAGRAM HCS410 IMMOBILIZER TRANSPONDER. Security. Operating.

MCP100/101. Microcontroller Supervisory Circuit with Push-Pull Output FEATURES PACKAGES DESCRIPTION BLOCK DIAGRAM

Connecting Sensor Buttons to PIC12CXXX MCUs

AN763. Latch-Up Protection For MOSFET Drivers INTRODUCTION. CONSTRUCTION OF CMOS ICs PREVENTING SCR TRIGGERING. Grounds. Equivalent SCR Circuit.

AN513. Analog to Digital Conversion Using a PIC16C54 INTRODUCTION THEORY OF OPERATION VOLTMETER A/D CONVERTER VOLTMETER MEASUREMENT CYCLE CYCLE

TC mA Fixed Low Dropout Positive Regulator TC2117. General Description. Features. Applications. Typical Application Device Selection Table

TB059. Using The MCP2150 Developer s Board With The MCP2155 INTRODUCTION MCP2150 DEVELOPER S BOARD LAYOUT

TC4426 TC4427 TC A DUAL HIGH-SPEED POWER MOSFET DRIVERS GENERAL DESCRIPTION FEATURES ORDERING INFORMATION

AN867. Temperature Sensing With A Programmable Gain Amplifier INTRODUCTION INTERFACING THE PGA TO THERMISTORS

TCM828 TCM829. Switched Capacitor Voltage Converters FEATURES GENERAL DESCRIPTION APPLICATIONS ORDERING INFORMATION

TB081. Soft-Start Controller For Switching Power Supplies IMPLEMENTATION OVERVIEW. Hardware SCHEMATIC. Keith Curtis Microchip Technology Inc.

TC1034/TC1035 Linear Building Block Single Operational Amplifiers in SOT Packages Features General Description Applications Device Selection Table

27LV K (32K x 8) Low-Voltage CMOS EPROM FEATURES PACKAGE TYPES DESCRIPTION PDIP

Design Alternatives To The TC682 For Performing Inverting Voltage Doubler Functions. DC/DC Converter +5V 6 V IN V OUT TC682 NC GND 5

TC Bit Digital-to-Analog Converter with Two-Wire Interface TC1321. General Description. Features. Applications. Device Selection Table

TC4423 TC4424 TC4425 3A DUAL HIGH-SPEED POWER MOSFET DRIVERS GENERAL DESCRIPTION FEATURES ORDERING INFORMATION

PICmicro Microcontroller Firmware Flow Chart of DV Demo Reader for MCRF3XX and MCRF4XX Devices. RFID Top-Level MAIN INITIALIZE

TC1030. Linear Building Block Quad Low Power Op Amp with Shutdown Modes. General Description. Features. Applications. Device Selection Table

Using External RAM with PIC17CXX Devices PIC17C42 PIC17C43 PIC17C Microchip Technology Inc. DS91004A-page 1

PIC16F818/819. PIC16F818/819 Rev. B0 Silicon Errata Sheet

TC115. PFM/PWM Step-Up DC/DC Converter. Package Type. Features. Applications. General Description. Device Selection Table. Functional Block Diagram

TC520A. Serial Interface Adapter for TC500 A/D Converter Family. General Description. Features. Applications. Device Selection Table.

AN824. KEELOQ Encoders Oscillator Calibration OVERVIEW WHY CALIBRATION? CALIBRATION BASICS. Microchip Technology Inc.

AN677. Designing a Base Station Coil for the HCS410 INTRODUCTION OVERVIEW FEATURES. Overview of Inductive Communication.

TC643 INTEGRATED FAN / MOTOR DRIVER GENERAL DESCRIPTION FEATURES APPLICATIONS ORDERING INFORMATION

PIC16F818/819. PIC16F818/819 Rev. A4 Silicon Errata Sheet. 2. Module: PORTB FIGURE 1: 1. Module: Internal RC Oscillator

TC1240/TC1240A. Positive Doubling Charge Pumps with Shutdown in a SOT-23 Package. Features. General Description. Applications

AN798. TC4420/4429 Universal Power MOSFET Interface IC INTRODUCTION PARAMETERS AND ATTRIBUTES OF THE TC4420/4429 TIMING. Rise and Fall Times

Optical Pyrometer. Functions

AN232. Low Frequency Magnetic Transmitter Design ABOUT THIS APPLICATION NOTE INTRODUCTION LFMC LINK COMPONENTS

TC7650. Chopper Stabilized Operational Amplifier. Package Type. Features. Applications. Device Selection Table. 8-Pin DIP TC7650CPA.

AN654. PWM, a Software Solution for the PIC16CXXX METHODS INTRODUCTION

SUPER CHARGE PUMP DC-TO-DC VOLTAGE CONVERTER

MCP1252/3. Low Noise, Positive-Regulated Charge Pump. Description. Features. Applications. Package Types

Electromechanical Switch Replacement

AN872. Upgrading from the MCP2510 to the MCP2515 MCP2515 ENHANCEMENTS AND DIFFERENCES INTRODUCTION. Enhancements. Differences

TC1026. Linear Building Block Low Power Comparator with Op Amp and Voltage Reference. General Description. Features. Applications

TC7652. Low Noise, Chopper Stabilized Operational Amplifier. General Description. Features. Applications. Device Selection Table.

TC1044S. Charge Pump DC-TO-DC Voltage Converter FEATURES GENERAL DESCRIPTION ORDERING INFORMATION

TCM680 +5V TO ±10V VOLTAGE CONVERTER GENERAL DESCRIPTION FEATURES APPLICATIONS ORDERING INFORMATION

AN861. Smart Air Handler using ProMPT and the PIC18F2539 APPLICATION OVERVIEW INTRODUCTION. Microchip Technology Inc.

PFM/PWM Step-Down DC/DC Controller. Operating Temp. Range C SS SHDN TC105333ECT EXT GND. 3.3V Regulated Supply Using 6V NiMH Battery Pack Input

TC57 Series. Linear Regulator Controller GENERAL DESCRIPTION FEATURES TYPICAL APPLICATIONS ORDERING INFORMATION PART CODE TC57 XX 02 ECT XX

27C K (32K x 8) CMOS EPROM FEATURES PACKAGE TYPES DESCRIPTION

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

TC4467 TC4468 TC4469 LOGIC-INPUT CMOS QUAD DRIVERS GENERAL DESCRIPTION FEATURES APPLICATIONS ORDERING INFORMATION

2-Wire Serial Temperature Sensor and Thermal Monitor

Single Cell Lithium-Ion Charge Management Controller with Mode Indicator and Charge Current Monitor. + Single Lithium-Ion

TB068. How to Modify the PICDEM LIN for the MCP201 SCOPE MASTER BOARD MODIFICATIONS EXAMPLE 1: CS CONNECTED TO RC0. Microchip Technology Inc.

Ultra Small Temperature Switches with Pin Selectable Hysteresis. 100 pf T UNDER TC6503 T UNDER TC6504 TC6502

Electromechanical Timer Replacement Solutions Cubed Real-Time Clock

AN762. Applications of the TC62X Solid-State Temperature Sensors INTRODUCTION. FIGURE 1: Block Diagram of the TC620 Temperature Sensor.

PIC18F24J10/25J10/44J10/45J10

AN1085. Using the Mindi Power Management Simulator Tool INTRODUCTION ACCESSING MINDI ON MICROCHIP S WEB SITE

TC /2 Digit Analog-to-Digital Converters with On-Chip LCD Drivers. Features. General Description. Applications. Device Selection Table

TC115. PFM/PWM Step-Up DC/DC Converter. Features. Package Type. General Description. Applications. Functional Block Diagram TC115

AN606. Low Power Design Using PICmicro Microcontrollers INTRODUCTION DESIGN TECHNIQUES RESISTOR TO LOWER POWER IN RC MODE CONTROL CIRCUIT

TC7116/A/TC7117/A. 3-1/2 Digit Analog-to-Digital Converters with Hold. General Description. Features. Applications. Device Selection Table

Single Cell Lithium-Ion Charge Management Controller with Charge Complete Indicator and Temperature Monitor. + Single - Lithium-Ion Cell

AN663. Simple Code Hopping Decoder KEY FEATURES OVERVIEW

HCS509. KEELOQ Code Hopping Decoder* FEATURES PACKAGE TYPE BLOCK DIAGRAM DESCRIPTION. Security. Operating. Other. Typical Applications

MCP V 10-Bit A/D Converter with SPI Serial Interface FEATURES PACKAGE TYPES APPLICATIONS FUNCTIONAL BLOCK DIAGRAM DESCRIPTION

TC32M. ECONOMONITOR 3-Pin System Supervisor with Power Supply Monitor and Watchdog. Features: General Description: Applications:

28C16A. Obsolete Device. 16K (2K x 8) CMOS EEPROM PACKAGE TYPES FEATURES BLOCK DIAGRAM DESCRIPTION

Using the PWM. PR1 x8. Comparator x8. TMR1 x8 Reset. TMR1ON (TCON2<0>) Comparator x10. Slave Latch x10 PW1DCH PW2DCH. Slave Latch x10.

TB003. An Introduction to KEELOQ Code Hopping INTRODUCTION. Remote Control Systems. The Solution. Code Scanning. Code Grabbing

AN1476. Combining the CLC and NCO to Implement a High Resolution PWM BACKGROUND INTRODUCTION EQUATION 2: EQUATION 1: EQUATION 3:

PIC16F87/88. PIC16F87/88 Rev. B1 Silicon Errata. 1. Module: Internal RC Oscillator

Low-Power Techniques for LCD Applications RTH = (2R*R)/(2R+R) RTH = 2R 2 /3R RTH = 2R/3 RSW = 4.7K RCOM = 0.4K

MCP V Dual Channel 12-Bit A/D Converter with SPI Serial Interface PACKAGE TYPES FEATURES APPLICATIONS FUNCTIONAL BLOCK DIAGRAM DESCRIPTION

HCS101. Fixed Code Encoder FEATURES PACKAGE TYPES HCS101 BLOCK DIAGRAM DESCRIPTION. Operating. Other. Typical Applications

Transcription:

M FACT003 Care and Feeding of the PIC16C74 and Its Peripherals Author: The PIC16C74 is one of the latest mid-range microcontrollers from Microchip Technology Inc. In this article we will be addressing a few of the new features and peripherals of this new part. The main focus will be on the A/D (Analog-to-Digital) Converter, the SCI (Serial Communication Interface), and the PWM (Pulse Width Modulator). Our intention is to give you a small program that initializes these peripherals as well as exercises them. A schematic is provided. The PICDEM TM 2 board from Microchip will run this program. The second trimpot does not exist on the PICDEM 2 board, so the second A/D value may float around. The second trimpot is only used to show a method of changing A/D input pins. If you are using the PICDEM 2 board, then the LED and a current limiting resistor must be connected to the PWM output. When the program is run, the RS-232 terminal will display two A/D values. The brightness of an LED is adjusted using pulse width modulation. The duty cycle is determined by the trimpot setting. Assumptions Robert Angelo Microchip Technology Inc. Although dangerous, sometimes we need to make assumptions. For this discussion on the PIC16C74, let us agree that RA0 and RA1 will be connected through a series resistor to the wipers on two potentiometers, with the other ends connecting across and ground (see schematic). The oscillator clock will be 4 MHz. First, we ll read an A/D input, send its result out the serial port (to be displayed on a PC terminal program), and then switch to the next channel. We will adjust the PWM output pulse width to match the first potentiometer. Each time we are ready to begin a new sequence, we will first send a pair of sync bytes to signal the receiving processor. To simplify our discussion, we will forgo using interrupts and we will do this in a polled fashion. The Watchdog Timer is disabled for this program. To ensure there are no surprises, it is a good idea to initialize every Special Function Register (SFR) and data register to some known value prior to use. A/D Converter Mysteries The A/D converter and its eight input channels will be our first topic. Setting up the A/D converter involves two special function registers: ADCON0 ADCON1 In the program included with this article, is a code segment initad that sets up the A/D. ADCON0 is the work horse register for this peripheral. This register is used to select the conversion clock frequency and channel. This register is also where we signal the start of a conversion and detect the completion of a conversion. ADCON1 has only one purpose in life for this part, and that is A/D port configuration. When ADCON1 is used, it does not override the TRISA register controls. The TRISA register must be set up. Once these registers are set up, all the program has to do is select the desired pin and set the GO/DONE bit in ADCON0. The program then waits for the conversion complete bit, GO/DONE, to be cleared by hardware. Then the ADRES (A/D conversion result register) register is read. The value from the first pot's conversion is then used to adjust the PWM pulse width, thereby adjusting the LED brightness. FIGURE 1: Period PWM PULSE WIDTH Duty Period Duty 2002 Microchip Technology Inc. DS00840A-page 1

Pulse Width Modulation (PWM) The PORTC<1> pin is used as the PWM output. The registers that need to be set up for this PWM operation are: TRISC T2CON CCPR2L PR2 CCP2CON. The code initpwm is an example of what might be done to initialize the PWM module. TRISC was cleared earlier, thus setting PORTC as output. By writing a "4" to the T2CON register, we will set the prescaler equal to 0 and select TIMER2 operation. Writing a 0Fh to the CCP2CON register selects PWM mode and standard resolution. The 0Fh written to the CCPR2L register sets the high period to a low value initially. Setting the PR2 register to FFh allows the CCPR2L value (from the A/D converter result) to approach a 100% duty cycle. Now we can control the brightness of the LED attached to this pin by adjusting the pot on pin RA0 and writing the A/D result to the CCPR2L register, as already described earlier. SCI The Serial Communications Interface Module is our RS-232 communications channel. We will configure the SCI as an asynchronous full duplex serial port. This is done with the routine at initsci in the program provided. There are a few fine points to remember relative to this peripheral. The baud rate is determined by a dedicated eight-bit baud rate generator and can be used to derive standard baud rate frequencies from the oscillator. Since we are not using interrupts, there are only five registers to deal with: RCSTA - receiver status TXSTA - transmitter status TXREG - transmit buffer RCREG - receive buffer SPBRG - to set the baud rate generator FIGURE 2: SERIAL COMMUNICATIONS INTERFACE MODULE First global interrupts are disabled. The initsci code does the serial port setup and the sendat code handles the actual sending of the data. The SCI is setup for 2400 baud, 8 data bits and 1 STOP bit with no parity. A terminal program, such as TERMINAL in Windows, set to the same settings can be used to see our output. If you use the Windows TERMINAL program, then set the communications parameters to 2400 baud, 8 data bits, 1 STOP bit, no parity and hardware handshake. Tying The Pieces Together The main loop for getting the process running and restarting it again is mloop. The adcnvrt routine handles port pin selection and actual conversion control. The dopwm routine handles updating the PWM duty cycle register CCPR2L. The routine sendat checks transmit ready status and loads the transmit buffer when the status reports ready. You will notice there is no error recovery routine. It is up to the user to determine. Here is what the program will do: Once all peripherals have been initialized, two sync bytes "< >" are sent to the terminal. The A/D conversion results are then sent and the LED brightness is adjusted to match the RA0 trimpot setting. To simplify displaying A/D values, only the highest nibble is used, and thirty is added to put it into an ASCII range. DS00840A-page 2 2002 Microchip Technology Inc.

Software License Agreement The software supplied herewith by Microchip Technology Incorporated (the "Company") is intended and supplied to you, the Company s customer, for use solely and exclusively on Microchip prod-ucts. The software is owned by the Company and/or its supplier, and is protected under applicable copyright laws. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license. THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATU- TORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU- LAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPE- CIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. APPENDIX A: CARE AND FEEDING OF PIC16C74 SOURCE CODE LIST P=16C74 INCLUDE P16CXX.INC ;new include file that comes with MPASM (on BBS) Adcnt equ 20h ;a/d converter pin count register Adcntw equ 21h ;a/d converter pin work register Temp equ 22h ;temporary data holding register seems we always need one org 0 goto init ;go to where our code really begins org 5h ;begin program above interrupt service vector address init bcf INTCON,7 ;make sure we don t get interrupted clrf PORTA ;don t rely on anything, set port latches where you want them clrf PORTB clrf PORTC clrf PORTD clrf PORTE clrf Adcnt ;clear RAM registers we will be using clrf Adcntw clrf Temp bsf STATUS,RP0 ;switch to page 1 to access trisx registers clrf TRISB ;set all ports outputs clrf TRISC ;just for this program to minimize current clrf TRISD ; and prevent pins from floating clrf TRISE movlw 0Bh movwf TRISA ;set analog inputs as inputs, the rest as outputs bcf STATUS,RP0 ; initad movlw 0C1h ;Internal RC A/D clock, input channel 0, A/D on movwf ADCON0 ;(user must wait for specified period before sampling) bsf STATUS,RP0 ;select page 1 of the SFRs movlw 4 movwf ADCON1 ;setup a/d inputs on RA0, RA1 and RA3 with Vref = Vdd ;we are still in page 1 of the SFRs initsci movlw 19h ;setup 2400 baud movwf SPBRG movlw 20h ;setup for async operations movwf TXSTA bcf STATUS,RP0 ;back to page 0 for a moment movlw 80h ;enable serial port operations and the associated pins movwf RCSTA clrf TXREG ;clear our serial port buffers for start up clrf RCREG initpwm movlw 4h ;setup T2CON with prescaler = 0 and timer2 on movwf T2CON movlw 0fh ;setup capture/compare to PWM mode standard resolution movwf CCP2CON movlw 0fh ;set compare register to half for now movwf CCPR2L bsf STATUS,RP0 ;select page 1 for the PR2 register movlw 0ffh movwf PR2 2002 Microchip Technology Inc. DS00840A-page 3

bcf STATUS,RP0 mloop movlw 0dh ;send a carriage return character call sendat movlw 3ch ;begin main loop for data gathering and serial transmission call sendat ;these are our sync bytes to tell receiving micro a new movlw 3eh ;sequence is beginning call sendat clrf Adcnt ;our first time through select AN0 pin adloop call adcnvrt ;go do a conversion and send the result movf Adcnt,0 ;get Adcnt into the W register xorlw 2 ;(# determines number of AD inputs to scan) btfss STATUS,2 ;have we sampled all of the pins yet? goto dopwm ;go adjust the PWM output goto mloop ;all done go do it again adcnvrt movf Adcnt,0 ;get a/d count value movwf Adcntw ;put in work register bcf STATUS,0 ;clear the carry flag for the upcoming rotate operations rlf Adcntw,1 ;rotate left and leave the number in adcntw rlf Adcntw,1 ;need to do it three times to put the count in the right rlf Adcntw,1 ;position to select the next A/D pin movlw 0C1h ;load the initial ADCON0 value excepting channel select iorwf Adcntw,0 ;set the pin select bits we want movwf ADCON0 ;set the new ADCON0 with new channels selected call wait ;wait about twenty micro seconds bsf ADCON0,2 ;start conversion incf Adcnt ;increment pin counter register adwait btfsc ADCON0,2 ;wait for conversion done goto adwait ;not done yet swapf ADRES,0 ;conversion done, swap result nibbles into W register andlw 0Fh ;mask off the upper nibble to limit number to an ascii range addlw 30h ;convert to ascii character to make it visible on terminal sendat bsf STATUS,RP0 ;select page one btfss TXSTA,1 ;check transmit status ready to send goto sendat ;if not ready go try again bcf STATUS,RP0 ;back to page 0 movwf TXREG ;transmit buffer empty send new data return dopwm movf ADRES,0 ;get the a/d conversion value movwf CCPR2L ;put the value into the PWM duty cycle register goto adloop wait movlw 08h ;do a wait loop of before using a/d converter movwf Temp w1 decfsz Temp goto w1 return end ;end of program DS00840A-page 4 2002 Microchip Technology Inc.

FIGURE A-1: PIC16C74 DEMO SCHEMATIC RP1 5K R2 470 RP2 5K C7 C1 15 pf C2 15 pf R3 470 11 32 1 13 X1 4 MHz 14 U1 PIC16C74 MCLR CLKIN CLKOUT RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 40 39 38 37 36 35 34 33 30 29 28 27 22 21 20 19 10 RE2 9 RE1 8 7 RE0 RA5 6 RA4 5 4 RA3 RA2 26 3 RC7 RA1 25 2 RC6 24 RA0 RC5 23 RC4 RC3 18 17 12 RC2 16 VSS 31 RC1 15 VSS RC0 C3 L1 C4 3 4 5 11 10 12 9 R1 330 C1- C2+ C2-1 C1+ T1IN T2IN R1OUT R2OUT GND 15 16 VCC V+ V- T1OUT T2OUT RB1IN RB2IN U2 MAX232A 2 6 14 7 13 8 C5 C6 C8 R4 10 P1 DB9 1 6 2 7 3 8 4 9 5 2002 Microchip Technology Inc. DS00840A-page 5

NOTES: DS00840A-page 6 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, microid, 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, ECONOMONITOR, FanSense, FlexROM, fuzzylab, In-Circuit Serial Programming, ICSP, ICEPIC, 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. DS00840A - page 7

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 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 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 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 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 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-6334-8870 Fax: 65-6334-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 03/01/02 DS00840A-page 8 2002 Microchip Technology Inc.