M microIDTM 125 kHz RFID System Design Guide INCLUDES: * * * * * * * * * * 1998 Microchip Technology Inc. Passive RFID Basics Application Note MCRF200 Data Sheet MCRF250 Data Sheet Contact Programming Support RFID Coil Design FSK Reader Reference Design PSK Reader Reference Design ASK Reader Reference Design FSK Anti-Collision Reader Reference Design Using the microID Programmer December 1998 /DS51115E M December 1998 /DS51115E 1998 Microchip Technology Inc. M DATA SHEET MARKINGS Microchip uses various data sheet markings to designate each document phase as it relates to the product development stage. The markings appear at the bottom of the data sheet, between the copyright and document and page numbers. The definitions for each marking are provided below for your use. Marking Description Advance Information The information is on products in the design phase. Your designs should not be finalized with this information as revised information will be published when the product becomes available. Preliminary This is preliminary information on new products in production but not yet fully characterized. The specifications in these data sheets are subject to change without notice. Before you finalize your design, please ensure that you have the most current revision of the data sheet by contacting your Microchip sales office. No Marking Information contained in the data sheet is on products in full production. "All rights reserved. Copyright (c) 1998, Microchip Technology Incorporated, USA. Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. 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. The Microchip logo and name are registered trademarks of Microchip Technology Inc. in the U.S.A. and other countries. All rights reserved. All other trademarks mentioned herein are the property of their respective companies. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights." 1998 Microchip Technology Inc. Trademarks The Microchip name, logo, KEELOQ, and PICmicro are registered rademarks of Microchip Technology Incorporated in the U.S.A. microID and RFLAB are a trademarks of Microchip Technology Inc. All other trademarks mentioned herein are property of their respective companies. December 1998 /DS51115E M December 1998 /DS51115E 1998 Microchip Technology Inc. M Table of Contents PAGE AN680 PASSIVE RFID BASICS Introduction ........................................................................................................................................ 1 Definitions .......................................................................................................................................... 1 Reader ........................................................................................................................................ 1 Tag ............................................................................................................................................. 1 Carrier ........................................................................................................................................ 1 Modulation .................................................................................................................................. 1 System Handshake ........................................................................................................................... 2 Backscatter Modulation ..................................................................................................................... 2 Data Encoding ................................................................................................................................... 3 Data Modulation ................................................................................................................................ 4 Anticollision ....................................................................................................................................... 5 MCRF200 DATA SHEET Features ............................................................................................................................................ 7 Application ......................................................................................................................................... 7 Package Type ................................................................................................................................... 7 Description ........................................................................................................................................ 7 Block Diagram ................................................................................................................................... 7 1.0 Electrical Characteristics ............................................................................................................ 8 1.1 Maximum Ratings ................................................................................................................ 8 2.0 Functional Description ................................................................................................................ 9 2.1 Rectifier - AC Clamp ........................................................................................................... 9 2.2 Coil Load Modulation ........................................................................................................... 9 2.3 VDD Regulator ..................................................................................................................... 9 2.4 VPP Regulator ..................................................................................................................... 9 2.5 Clock Generator .................................................................................................................. 9 2.6 IRQ Detector ....................................................................................................................... 9 2.7 Power-On Reset .................................................................................................................. 9 2.8 Modulation Logic ................................................................................................................. 9 3.0 Configuration Logic Control Bit Register .................................................................................. 10 3.1 Organization ...................................................................................................................... 10 3.2 Baud Rate Timing .............................................................................................................. 10 3.3 Column and Row Decoder Logic and Bit Counter ............................................................. 10 4.0 Modes of Operation .................................................................................................................. 12 4.1 Native Mode ...................................................................................................................... 12 4.2 Read Mode ........................................................................................................................ 12 microIDTM Design Guide Product Identification System .................................................................. 13 1998 Microchip Technology Inc. DS51115E-page v M Table of Contents (Continued) PAGE MCRF250 DATA SHEET Features .......................................................................................................................................... 15 Description ...................................................................................................................................... 15 Application ....................................................................................................................................... 15 Block Diagram ................................................................................................................................. 15 1.0 Electrical characteristics ........................................................................................................... 16 1.1 Maximum Ratings .............................................................................................................. 16 2.0 Functional Description .............................................................................................................. 17 2.1 Rectifier - AC Clamp ......................................................................................................... 17 2.2 Coil Load Modulation ......................................................................................................... 17 2.3 VDD Regulator ................................................................................................................... 17 2.4 VPP Regulator ................................................................................................................... 17 2.5 Clock Generator ................................................................................................................ 17 2.6 IRQ Detector ..................................................................................................................... 17 2.7 Power On Reset ................................................................................................................ 17 2.8 Modulation Logic ............................................................................................................... 17 3.0 ConfigurationLogic ................................................................................................................... 18 3.1 Control Bit Register ........................................................................................................... 18 3.2 Organization ...................................................................................................................... 18 3.3 Baud Rate Timing .............................................................................................................. 18 3.4 Column and Row Decoder Logic and Bit Counter ............................................................. 18 4.0 Modes of operation ................................................................................................................... 20 4.1 Native Mode ...................................................................................................................... 20 4.2 Read Mode ........................................................................................................................ 20 5.0 Anticollision .............................................................................................................................. 21 MCRF250 Product Identification System ........................................................................................ 22 TB023 CONTACT PROGRAMMING SUPPORT Introduction ...................................................................................................................................... 23 Definitions ........................................................................................................................................ 23 File Specification ............................................................................................................................. 23 DS51115E-page vi 1998 Microchip Technology Inc. M Table of Contents PAGE AN678 RFID COIL DESIGN Introduction ...................................................................................................................................... 25 Review of a Basic Theory for Antenna Coil Design ......................................................................... 25 Current and Magnetic Fields .................................................................................................... 25 Induced Voltage in Antenna Coil ..................................................................................................... 27 Wire Types and Ohmic Losses ....................................................................................................... 30 Wire Size and DC Resistance .................................................................................................. 30 AC Resistance of Wire ............................................................................................................. 30 Inductance of Various Antenna Coils .............................................................................................. 32 Inductance of a Straight Wire ................................................................................................... 32 Inductance of a Single Layer Coil ............................................................................................. 32 Inductance of a Circular Loop Antenna Coil with Multilayer ..................................................... 33 Inductance of a Square Loop Coil with Multilayer .................................................................... 33 Configuration of Antenna Coils ........................................................................................................ 34 Tag Antenna Coil ...................................................................................................................... 34 Reader Antenna Coil ................................................................................................................ 35 Resonance Circuits, Quality Factor Q, and Bandwidth ................................................................... 36 Parallel Resonant Circuit .......................................................................................................... 36 Series Resonant Circuit ............................................................................................................ 37 Q and Bandwidth ...................................................................................................................... 39 Limitation on Q ......................................................................................................................... 39 Tuning Method ......................................................................................................................... 40 FSK READER REFERENCE DESIGN Read Range of RFID Devices ......................................................................................................... 41 References ...................................................................................................................................... 42 1.0 Introduction ............................................................................................................................... 43 2.0 Reader Circuits ......................................................................................................................... 43 2.1 Transmitting Section .......................................................................................................... 44 2.2 Receiving Section .............................................................................................................. 44 3.0 microIDTM FSK Reader ............................................................................................................ 45 4.0 FSK Reader Schematic ............................................................................................................ 46 5.0 FSK Reader Bill of Materials .................................................................................................... 47 6.0 FSK Source Code for the PICmicro(R) MCU .............................................................................. 49 PSK READER REFERENCE DESIGN 1.0 Introduction ............................................................................................................................... 59 2.0 Reader Circuits ......................................................................................................................... 59 2.1 Transmitting Section .......................................................................................................... 60 2.2 Receiving Section .............................................................................................................. 60 3.0 microIDTM PSK Reader ............................................................................................................ 61 4.0 PSK Reader Schematic ............................................................................................................ 63 5.0 PSK Reader Bill of Materials .................................................................................................... 64 6.0 PSK Source Code for the PICmicro(R) MCU .............................................................................. 67 1998 Microchip Technology Inc. DS51115E-page vii M Table of Contents PAGE ASK READER REFERENCE DESIGN 1.0 Introduction ............................................................................................................................... 77 2.0 Reader Circuits ......................................................................................................................... 77 2.1 Transmitting Section .......................................................................................................... 78 2.2 Receiving Section .............................................................................................................. 78 3.0 microIDTM ASK Reader ............................................................................................................ 79 4.0 ASK Reader Schematic ............................................................................................................ 80 5.0 ASK Reader Bill of Materials .................................................................................................... 81 6.0 ASK Reader Source Code for the PICmicro(R) MCU ................................................................. 83 FSK ANTICOLLISION READER REFERENCE DESIGN 1.0 2.0 3.0 4.0 5.0 Introduction ............................................................................................................................... 99 Reader Circuits ....................................................................................................................... 100 AntiCollision Reader Schematic ............................................................................................. 102 Anticollision Reader Bill of Materials ...................................................................................... 103 FSK Anticollision Source Code for the PICmicro(R) MCU ........................................................ 105 USING THE microIDTM PROGRAMMER 1.0 Introduction ............................................................................................................................. 117 2.0 Programming Signal Waveform ............................................................................................. 118 2.1 Power-up, Gap, and Verification Signals ......................................................................... 118 2.2 Programming Sequence .................................................................................................. 118 3.0 Calibration of Programming Voltage ...................................................................................... 120 4.0 Programming Procedure ........................................................................................................ 121 4.1 Error Conditions .............................................................................................................. 121 5.0 Programming in a Standard Terminal Mode .......................................................................... 123 5.1 Programmer Wake-up ..................................................................................................... 123 5.2 Blank Check .................................................................................................................... 123 5.3 Program and Verify the Device ....................................................................................... 123 5.4 Error Conditions .............................................................................................................. 123 6.0 microIDTM Programmer Schematic ....................................................................................... 126 7.0 microIDTM Programmer Bill of Materials ................................................................................. 127 8.0 Programmer Source Code for PIC16C73 ............................................................................... 129 WORLDWIDE SALES AND SERVICE DS51115E-page viii 1998 Microchip Technology Inc. M Author: AN680 Passive RFID Basics Pete Sorrells Microchip Technology Inc. INTRODUCTION Radio Frequency Identification (RFID) systems use radio frequency to identify, locate and track people, assets, and animals. Passive RFID systems are composed of three components - an interrogator (reader), a passive tag, and a host computer. The tag is composed of an antenna coil and a silicon chip that includes basic modulation circuitry and non-volatile memory. The tag is energized by a time-varying electromagnetic radio frequency (RF) wave that is transmitted by the reader. This RF signal is called a carrier signal. When the RF field passes through an antenna coil, there is an AC voltage generated across the coil. This voltage is rectified to supply power to the tag. The information stored in the tag is transmitted back to the reader. This is often called backscattering. By detecting the backscattering signal, the information stored in the tag can be fully identified. Modulation Periodic fluctuations in the amplitude of the carrier, used to transmit data back from the tag to the reader. Systems incorporating passive RFID tags operate in ways that may seem unusual to anyone who already understands RF or microwave systems. There is only one transmitter - the passive tag is not a transmitter or transponder in the purest definition of the term, yet bidirectional communication is taking place. The RF field generated by a tag reader (the energy transmitter) has three purposes: 1. 2. DEFINITIONS Reader Usually a microcontroller-based unit with a wound output coil, peak detector hardware, comparators, and firmware designed to transmit energy to a tag and read information back from it by detecting the backscatter modulation. Tag 3. Induce enough power into the tag coil to energize the tag. Passive tags have no battery or other power source; they must derive all power for operation from the reader field. 125 kHz and 13.56 MHz tag designs must operate over a vast dynamic range of carrier input, from the very near field (in the range of 200 VPP) to the maximum read distance (in the range of 5 VPP). Provide a synchronized clock source to the tag. Most RFID tags divide the carrier frequency down to generate an on-board clock for state machines, counters, etc., and to derive the data transmission bit rate for data returned to the reader. Some tags, however, employ on-board oscillators for clock generation. Act as a carrier for return data from the tag. Backscatter modulation requires the reader to peak-detect the tag's modulation of the reader's own carrier. See Section for additional information on backscatter modulation. An RFID device incorporating a silicon memory chip (usually with on-board rectification bridge and other RF front-end devices), a wound or printed input/output coil, and (at lower frequencies) a tuning capacitor. Carrier A Radio Frequency (RF) sine wave generated by the reader to transmit energy to the tag and retrieve data from the tag. In these examples the ISO frequencies of 125 kHz and 13.56 MHz are assumed; higher frequencies are used for RFID tagging but the communication methods are somewhat different. 2.45 GHz, for example, uses a true RF link. 125 kHz and 13.56 MHz, utilize transformer-type electromagnetic coupling. 1998 Microchip Technology Inc. DS00680A-page 1 AN680 SYSTEM HANDSHAKE BACKSCATTER MODULATION Typical handshake of a tag and reader is as follows: This terminology refers to the communication method used by a passive RFID tag to send data back to the reader. By repeatedly shunting the tag coil through a transistor, the tag can cause slight fluctuations in the reader's RF carrier amplitude. The RF link behaves essentially as a transformer; as the secondary winding (tag coil) is momentarily shunted, the primary winding (reader coil) experiences a momentary voltage drop. The reader must peak-detect this data at about 60 dB down (about 100 mV riding on a 100V sine wave) as shown in Figure 1. 1. 2. 3. 4. 5. The reader continuously generates an RF carrier sine wave, watching always for modulation to occur. Detected modulation of the field would indicate the presence of a tag. A tag enters the RF field generated by the reader. Once the tag has received sufficient energy to operate correctly, it divides down the carrier and begins clocking its data to an output transistor, which is normally connected across the coil inputs. The tag's output transistor shunts the coil, sequentially corresponding to the data which is being clocked out of the memory array. Shunting the coil causes a momentary fluctuation (dampening) of the carrier wave, which is seen as a slight change in amplitude of the carrier. The reader peak-detects the amplitude-modulated data and processes the resulting bitstream according to the encoding and data modulation methods used. This amplitude-modulation loading of the reader's transmitted field provides a communication path back to the reader. The data bits can then be encoded or further modulated in a number of ways. FIGURE 1: AMPLITUDE - MODULATED BACKSCATTERING SIGNAL 100 mV 100V DS00680A-page 2 1998 Microchip Technology Inc. AN680 DATA ENCODING 2. Data encoding refers to processing or altering the data bitstream in-between the time it is retrieved from the RFID chip's data array and its transmission back to the reader. The various encoding algorithms affect error recovery, cost of implementation, bandwidth, synchronization capability, and other aspects of the system design. Entire textbooks are written on the subject, but there are several popular methods used in RFID tagging today: 1. NRZ (Non-Return to Zero) Direct. In this method no data encoding is done at all; the 1's and 0's are clocked from the data array directly to the output transistor. A low in the peak-detected modulation is a `0' and a high is a `1'. FIGURE 2: VARIOUS DATA CODING WAVEFORMS DESCRIPTION WAVEFORM SIGNAL Data 3. Differential Biphase. Several different forms of differential biphase are used, but in general the bitstream being clocked out of the data array is modified so that a transition always occurs on every clock edge, and 1's and 0's are distinguished by the transitions within the middle of the clock period. This method is used to embed clocking information to help synchronize the reader to the bitstream; and because it always has a transition at a clock edge, it inherently provides some error correction capability. Any clock edge that does not contain a transition in the data stream is in error and can be used to reconstruct the data. Biphase_L (Manchester). This is a variation of biphase encoding, in which there is not always a transition at the clock edge. 1 0 1 Bit Rate CLK NRZ_L (Direct) Biphase_L (Manchester) 1 0 0 0 1 1 0 1 0 Digital Data Clock Signal Non-Return to Zero - Level `1' is represented by logic high level. `0' is represented by logic low level. Biphase - Level (Split Phase) A level change occurs at middle of every bit clock period. `1' is represented by a high to low level change at midclock. `0' is represented by a low to high level change at midclock. Differential Biphase_S Differential Biphase - Space A level change occurs at middle of every bit clock period. `1' is represented by a change in level at start of clock. `0' is represented by no change in level at start of clock. 1998 Microchip Technology Inc. DS00680A-page 3 AN680 DATA MODULATION Although all the data is transferred to the host by amplitude-modulating the carrier (backscatter modulation), the actual modulation of 1's and 0's is accomplished with three additional modulation methods: 1. 2. Direct. In direct modulation, the Amplitude Modulation of the backscatter approach is the only modulation used. A high in the envelope is a `1' and a low is a `0'. Direct modulation can provide a high data rate but low noise immunity. FSK (Frequency Shift Keying). This form of modulation uses two different frequencies for data transfer; the most common FSK mode is Fc/8/10. In other words, a `0' is transmitted as an amplitude-modulated clock cycle with period corresponding to the carrier frequency divided by 8, and a `1' is transmitted as an amplitude-modulated clock cycle period corresponding to the carrier frequency divided by 10. The amplitude modulation of the carrier thus switches from Fc/8 to Fc/10 corresponding to 0's FIGURE 3: 8 cycles = 0 10 cycles = 1 10 cycles = 1 8 cycles = 0 PSK MODULATED SIGNAL Phase Shift DS00680A-page 4 PSK provides fairly good noise immunity, a moderately simple reader design, and a faster data rate than FSK. Typical applications utilize a backscatter clock of Fc/2, as shown in Figure 4. FSK MODULATED SIGNAL, FC/8 = 0, FC/10 = 1 8 cycles = 0 FIGURE 4: 3. and 1's in the bitstream, and the reader has only to count cycles between the peak-detected clock edges to decode the data. FSK allows for a simple reader design, provides very strong noise immunity, but suffers from a lower data rate than some other forms of data modulation. In Figure 3, FSK data modulation is used with NRZ encoding: PSK (Phase Shift Keying). This method of data modulation is similar to FSK, except only one frequency is used, and the shift between 1's and 0's is accomplished by shifting the phase of the backscatter clock by 180 degrees. Two common types of PSK are: * Change phase at any `0', or * Change phase at any data change (0 to 1 or 1 to 0). Phase Shift Phase Shift Phase Shift 1998 Microchip Technology Inc. AN680 ANTICOLLISION In many existing applications, a single-read RFID tag is sufficient and even necessary: animal tagging and access control are examples. However, in a growing number of new applications, the simultaneous reading of several tags in the same RF field is absolutely critical: library books, airline baggage, garment, and retail applications are a few. In order to read multiple tags simultaneously, the tag and reader must be designed to detect the condition that more than one tag is active. Otherwise, the tags will all backscatter the carrier at the same time, and the amplitude-modulated waveforms shown in Figures 3 and 4 would be garbled. This is referred to as a collision. No data would be transferred to the reader. The tag/reader interface is similar to a serial bus, even though the "bus" travels through the air. In a wired serial bus application, arbitration is necessary to prevent bus contention. The RFID interface also requires arbitration so that only one tag transmits data over the "bus" at one time. A number of different methods are in use and in development today for preventing collisions; most are patented or patent pending, but all are related to making sure that only one tag "talks" (backscatters) at any one time. See the MCRF250 Data Sheet (page 15) and the FSK Anticollision Reader Reference Design (page 99) chapters for more information. 1998 Microchip Technology Inc. DS00680A-page 5 AN680 NOTES: DS00680A-page 6 1998 Microchip Technology Inc. M MCRF200 Contactless Programmable Passive RFID Device FEATURES PACKAGE TYPE * Contactless programmable after encapsulation * Read only data transmission * 96 or 128 bits of One-Time Programmable (OTP) user memory (also supports 48 and 64-bit protocols) * Typical operates at 125 kHz * On chip rectifier and voltage regulator * Ultra low power operation * Factory programming and device serialization available * Encoding options: - NRZ Direct, Differential Biphase, Manchester Biphase * Modulation options: - Direct, FSK, PSK (change on data change), PSK (change at the beginning of a one) PDIP/SOIC 1 8 VB NC 2 7 NC NC 3 6 NC NC 4 5 NC DESCRIPTION This device is a Radio Frequency Identification (RFID) tag that provides a bidirectional interface for programming and reading the contents of the user array. The device is powered by an external RF transmitter through inductive coupling. When in read mode, the device transmits the contents of its memory array by damping (modulating) the incoming RF signal. The reader is able to detect the damping and decodes the data being transmitted. Code length, modulation option, encoding option, and bit rate are set at the factory to fit the needs of particular applications. APPLICATION RF Signal Transmitter/ Receiver VA The user memory array of this device can be programmed contactlessly after encapsulation. This allows the user to keep encapsulated blank tags in stock for on-demand personalization. The tags can then be programmed with data as they are needed. MCRF200 Data These devices are available in die, wafer, PDIP, SOIC, and COB module form. The encoding, modulation, frequency, and bit rate options are specified by the customer and programmed by Microchip Technology Inc. prior to shipment. Array programming and serialization (SQTP) can also be arranged upon request. See TB023 (page 23) for more information. BLOCK DIAGRAM Data Modulation Control Load coil connections Clock Generator Vcc Row Decode Memory Array Rectifier Vss Counter 1998 Microchip Technology Inc. Column Decode DS21219D-page 7 MCRF200 1.0 1.1 ELECTRICAL CHARACTERISTICS TABLE 1-1: PAD FUNCTION TABLE Name Maximum Ratings* Function Coil connection VA,VB NC Storage temperature ....................................- 65C to +150C Ambient temp. with power applied ................-40C to +125C Maximum current into coil pads ....................................50 mA No connection, test pad *Notice: Stresses above those listed under "Maximum ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operational listings of this specification is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability. TABLE 1-2: AC AND DC CHARACTERISTICS All parameters apply across the specified operating ranges unless otherwise noted. Parameter Industrial (I): Tamb = -40C to +85C Symbol Min. Typ. Max. Units Clock frequency FCLK 100 -- 150 kHz Contactless programming time TWC -- 2 -- s 200 -- -- Years Data retention Coil current (Dynamic) ICD -- 50 A Operating current IDD -- 5 A VAVB 10 -- -- VPP VCC 2 -- -- VDC CIN -- 2 -- pF Turn-on-voltage (Dynamic) for modulation Input Capacitance FIGURE 1-1: NC DIE PLOT NC NC TABLE 1-3 Conditions 128-bit array 25C VCC = 2V Between VA and VB RFID PAD COORDINATES (MICRONS) NC Passivation Openings Pad Name Pad Width Pad Height Pad Pad Center X Center Y VA 90.0 90.0 427.50 -734.17 VB 90.0 90.0 -408.60 -734.17 Note 1: All coordinates are referenced from the center of the die. 2: Die size 1.1215 mm x 1.7384 mm. VB DS21219D-page 8 VA 1998 Microchip Technology Inc. MCRF200 2.0 FUNCTIONAL DESCRIPTION The RF section generates all the analog functions needed by the transponder. These include rectification of the carrier, on-chip regulation of VPP (programming voltage), and VDD (operating voltage), as well as high voltage clamping to prevent excessive voltage from being applied to the transponder. This section generates a system clock from the interrogator carrier of the same frequency, detects carrier interrupts, and modulates the tuned LC antenna for transmission to the interrogator. The chip detects a power-up condition and resets the transponder when sufficient voltage develops. 2.1 Rectifier - AC Clamp The AC voltage generated by the transponder tuned LC circuit is full wave rectified. This unregulated voltage is used as the maximum DC supply voltage for the rest of the chip. The peak voltage on the tuned circuit is clamped by the internal circuitry to a safe level to prevent damage to the IC. This voltage is adjusted during programming to allow sufficient programming voltage to the EEPROM. 2.2 Coil Load Modulation The MCRF200 communicates to the reader by AM-modulating the coil voltage across the tuned LC circuit. 2.3 VDD Regulator The device generates a fixed supply voltage from the unregulated coil voltage. 2.4 VPP Regulator This regulates a programming voltage during the programming mode. The voltage is used for the EEPROM array to perform block erasure of the memory as well as single-bit programming during both contact and contactless programming. During reading, this voltage is level-shifted down and kept below the programming voltages to insure that the part is not inadvertently programmed. 1998 Microchip Technology Inc. 2.5 Clock Generator This circuit generates a clock based on the interrogator frequency. This clock is used to derive all timing in the tag, including the baud rate, modulation rate, and programming rate. 2.6 IRQ Detector This circuitry detects an interrupt in the continuous electromagnetic field of the interrogator. An IRQ (interrupt request) is defined as the absence of the electromagnetic field for a specific number of clock cycles. This feature is used during contactless programming. 2.7 Power-On-Reset This circuit generates a power-on-reset when the tag first enters the interrogator field. The reset releases when sufficient power has developed on the VDD regulator to allow correct operation. The reset trip points are set such that sufficient voltage across VDD has developed, which allows for correct clocking of the logic for reading of the EEPROM and configuration data, and correct modulation. 2.8 Modulation Logic This logic acts upon the serial data being read from the EEPROM and performs two operations on the data. The logic first encodes the data according to the configuration bits CB6 and CB7. The data can be sent out direct to the modulation logic or encoded Biphase Differential, Biphase Manchester or Manchester with IDI option. The encoded data is then either passed NRZ Direct out to modulate the coil, or FSK modulated, or PSK modulated with changes on the change of data, or PSK with changes on the bit edge of a one. Configuration bits CB8 and CB9 determine the modulation option. CB10 is used if the PSK option has been selected, and determines if the return carrier rate is FCLK/2 or FCLK/4. DS21219D-page 9 MCRF200 3.0 CONFIGURATION LOGIC CONTROL BIT REGISTER The configuration register determines the operational parameters of the device. The configuration register cannot be programmed contactlessly; it is programmed during wafer probe at the Microchip factory. CB11 is always a zero; CB12 is set when successful contact or contactless programming of the data array has been completed. Once CB12 is set, device programming and erasing is disabled. Figure 3-1 contains a description of the control register bit functions. 3.1 Organization The configuration bit register directly controls logic blocks which generate the baud rate, memory size, encoded data, and modulated data. This register also contains bits which lock the data array. 3.2 Baud Rate Timing The chip will access data at a baud rate determined by bits CB2, CB3, CB4, and CB5 of the configuration register. CB2, CB3, and CB4 determine the return data rate (CACLK). The default rate of FCLK/128 is used for contact and contactless programming. Once the array is successfully programmed, the lock bit CB12 is set. When the lock bit is cleared, programming and erasing the device becomes permanently disabled. The configuration register has no effect on device timing until after the EEPROM data array is programmed. If CB2 is set to a one and CB5 is set to a one, the 1.5 bit SYNC word option is enabled. 3.3 Column and Row Decoder Logic and Bit Counter The column and row decoders address the EEPROM array at the clock rate and generate a serial data stream for modulation. This data stream can be up to 128 bits in length. The size of the stream is user programmable with CB1 and can be set to 96 or 128 bits. Data lengths of 48 and 64 bits are available by programming the data twice in the array, end-to-end. The data is then encoded by the modulation logic. The data length during contactless programming is 128 bits. The column and row decoders route the proper voltage to the array for programming and reading. In the programming modes, each individual bit is addressed serially from bit 1 to bit 128. DS21219D-page 10 1998 Microchip Technology Inc. MCRF200 FIGURE 3-1: CONFIGURATION REGISTER CB12 CB11 CB10 CB9 CB8 CB7 CB6 CB5 CB4 CB3 CB2 CB1 ARRAY SIZE CB1 = 1 128-bit user array CB1 = 0 96-bit user array TIMING CB2 CB3 CB4 Rate 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 MOD128 MOD100 MOD80 MOD32 MOD64 MOD50 MOD40 MOD16 SYNC WORD CB5 = 1 1.5-bit sync word enable CB5 = 0 1.5-bit sync word disable DATA ENCODING CB6 = 0; CB7 = 0 NRZ_L (Direct) CB6 = 0; CB7 = 1 Biphase_S (Differential) CB6 = 1; CB7 = 0 Biphase_L (Manchester) CB6 = 1; CB7 = 1 (Not Used) MODULATION OPTIONS CB8 = 0; CB9 = 0 FSK 0 = Fc/8, 1 = Fc/10 CB8 = 0; CB9 = 1 Direct CB8 = 1; CB9 = 0 psk_1 (phase change on change of data) CB8 = 1; CB9 = 1 psk_2 (phase change at beginning of a one) PSK RATE OPTION CB10 = 1 clk/4 carrier CB10 = 0 clk/2 carrier (READ ONLY) CB11 = 0 ARRAY LOCK BIT (READ ONLY) CB12 = 0 array not locked CB12 = 1 array is locked 1998 Microchip Technology Inc. DS21219D-page 11 MCRF200 4.0 MODES OF OPERATION The device has two basic modes of operation: Native Mode and Read Mode. 4.1 Native Mode In native mode, a transponder will have an unprogrammed array and will be in the default mode for contactless programming (default baud rate FCLK/128, FSK, NRZ_direct). 4.2 Read Mode The second mode is a read mode after the contactless or contact programming has been completed and for the rest of the lifetime of the device. The lock bit CB12 will be set, and when the transponder is powered, it will have the ability to transmit according to the protocol in the configuration register. FIGURE 4-1: From oscillator TYPICAL APPLICATION CIRCUIT IAC 740 H Energy 4.05 mH 390 pF Input capacitance: 2 pF 125 kHz Pad VA Pad VB To reader amplifier/filter MCRF200 Data 2.2 nF 1 fres = ------------------ = 125 kHz 2 LC DS21219D-page 12 1998 Microchip Technology Inc. MCRF200 MCRF200 PRODUCT IDENTIFICATION SYSTEM To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office. MCRF 200 - I /WFxxx Hex Code = Three digit hex value to be programmed into the configuration register. Three hex characters correConfiguration: spond to 12 binary bits. These bits are programmed into the configuration register MSB first (CB12, CB11...CB1). See the example below. Package: Temperature Range: Sample Part Number: WF W S SN P 1C 3C = = = = = = = Sawed wafer on frame (7 mil backgrind) Wafer (11 mil backgrind) Dice in waffle pack 150 mil SOIC PDIP 0.45 mm COB module with 1000 pF capacitor 0.70 mmCOB module with 330 pF capacitor I = -40C to +85C MCRF200-I /W00A MCRF200-I/W00A = 125 kHz, industrial temperature, wafer package, contactlessly programmable, 96 bit, FSK Fc/8 Fc/10, direct encoded, Fc/50 data return rate tag. The configuration register is: CB12 CB11 CB10 CB9 CB8 CB7 CB6 CB5 CB4 CB3 CB2 CB1 0 0 0 0 0 0 0 0 1 0 1 0 1998 Microchip Technology Inc. DS21219D-page 13 MCRF200 NOTES: DS21219D-page 14 1998 Microchip Technology Inc. M MCRF250 Contactless Programmable Passive RFID Device With Anticollision FEATURES APPLICATION * Anticollision feature to resolve multiple tags in the same RF field * Read-only data transmission * 96 or 128 bits of One-Time Programmable (OTP) user memory (also supports 48 and 64-bit protocols) * Operates up to 150 kHz * On-chip rectifier and voltage regulator * Low power operation * Factory programming and device serialization available * Encoding options: - NRZ Direct, Differential Biphase, Manchester Biphase, Biphase IDI * Modulation options: - FSK, Direct, PSK (change on data change), PSK (change at the beginning of a one) * Contactless programmable after encapsulation RF Signal Transmitter/ Receiver MCRF250 Data The MCRF250 is equipped with an anticollision feature that allows multiple tags in the same field to be read simultaneously. This revolutionary feature eliminates the issue of data corruption due to simultaneous transmissions from multiple tags. DESCRIPTION This device is a Radio Frequency Identification (RFID) tag that provides a variety of operating modes. The device is powered by an external RF transmitter (reader) through inductive coupling. When in the reader field, the device will transmit the contents of its memory array by damping (modulating) the incoming RF signal. A reader is able to detect the damping and decodes the data being transmitted. Code length, modulation option, encoding option and bit rate are set at the factory to fit the needs of particular applications. The user memory array of this device can be programmed contactlessly after encapsulation. This allows the user to keep encapsulated blank tags in stock for on-demand personalization. The tags can then be programmed with data as they are needed. These devices are available in die form or packaged in SOIC, PDIP or COB modules. The encoding, modulation, frequency, and bit rate options are specified by the customer and programmed by Microchip Technology Inc. prior to shipment. Array programming and serialization (SQTP) can also be arranged upon request. See TB023 (page 23) for more information. BLOCK DIAGRAM Data Coil Connections Modulation Circuit Modulation Control Anticollision Circuitry Clock Generator Rectifier VCC Row Decode Memory Array VSS Counter 1998 Microchip Technology Inc. Column Decode DS21267C-page 15 MCRF250 1.0 1.1 ELECTRICAL CHARACTERISTICS TABLE 1-1: Maximum Ratings* Name Function VA,VB Coil connection NC Storage temperature .....................................-65C to +150C Ambient temp. with power applied ................-40C to +125C Maximum current into coil pads ....................................50 mA PAD FUNCTION TABLE No connection, test pad *Notice: Stresses above those listed under "Maximum ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operational listings of this specification is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability. TABLE 1-2: AC AND DC CHARACTERISTICS All parameters apply across the specified operating ranges unless otherwise noted. Parameter Industrial (I): Tamb = -40C to +85C Symbol Min. Typ. Max. Units Clock frequency FCLK 100 -- 150 kHz Contactless programming time TWC Data retention -- 2 -- 200 -- -- s 128-bit array Years 25C Coil current (Dynamic) ICD -- 50 A Operating current IDD -- 2 A VAVB 10 -- -- VPP VCC 2 -- -- VDC Turn-on-voltage (Dynamic) for modulation FIGURE 1-1: NC Conditions DIE PLOT NC NC TABLE 1-3: NC RFID PAD COORDINATES (MICRONS) Passivation Openings Pad Name Pad Width Pad Height Pad Center X Pad Center Y VA 90.0 VB 90.0 90.0 427.50 -734.17 90.0 -408.60 -734.17 Note 1: All coordinates are referenced from the center of the die. 2: Die size 1.1215 mm x 1.7384 mm. FIGURE 1-2: PIN DIAGRAM PDIP, SOIC VB DS21267C-page 16 1 2 3 4 MCRF250 VA NC NC NC 8 7 6 5 VB NC NC NC VA 1998 Microchip Technology Inc. MCRF250 2.0 FUNCTIONAL DESCRIPTION The RF section generates all the analog functions needed by the transponder. These include rectification of the carrier, on-chip regulation of VPP (programming voltage), and VDD (operating voltage), as well as high voltage clamping to prevent excessive voltage from being applied to the device. This section generates a system clock from the interrogator carrier frequency, detects carrier interrupts and modulates the tuned LC antenna for transmission to the interrogator. The chip detects a power up condition and resets the transponder when sufficient voltage develops. 2.1 Rectifier - AC Clamp The AC voltage induced by the tuned LC circuit is full wave rectified. This unregulated voltage is used as the DC supply voltage for the rest of the chip. The peak voltage on the tuned circuit is clamped by the internal circuitry to a safe level to prevent damage to the IC. This voltage is adjusted during programming to allow sufficient programming voltage to the EEPROM. 2.2 Coil Load Modulation The MCRF250 communicates by shunting a transistor across the tuned LC circuit, which modulates the received RF field. 2.3 VDD Regulator The device generates a fixed supply voltage from the unregulated coil voltage. 2.4 VPP Regulator This regulates a programming voltage during the programming mode. The voltage is switched into the EEPROM array to perform block erasure of the memory as well as single bit programming during both contact and contactless programming. During reading this voltage is level shifted down and kept below the programming voltages to insure that the part is not inadvertently programmed. 1998 Microchip Technology Inc. 2.5 Clock Generator This circuit generates a clock with a frequency equal to the interrogator frequency. This clock is used to derive all timing in the device, including the baud rate, modulation rate, and programming rate. 2.6 IRQ Detector This circuitry detects an interrupt in the continuous electromagnetic field of the interrogator. An IRQ (interrupt request) is defined as the absence of the electromagnetic field for a specific number of clock cycles. Detection of an IRQ will trigger the device to enter the Anticollision mode. This mode is discussed in detail in Section 5.0. 2.7 Power-On-Reset This circuit generates a power-on-reset when the tag first enters the interrogator field. The reset releases when sufficient power has developed on the VDD regulator to allow correct operation. The reset trip points are set such that sufficient voltage across VDD has developed which allows for correct clocking of the logic for reading of the EEPROM and configuration data, and correct modulation. 2.8 Modulation Logic This logic acts upon the serial data being read from the EEPROM and performs two operations on the data. The logic first encodes the data according to the configuration bits CB6 and CB7. The data can be sent out direct to the modulation logic or encoded Biphase_s (Differential), Biphase_l (Manchester) or IDI (Manchester). The encoded data is then either passed NRZ Direct out to modulate the coil, or FSK modulated, or PSK modulated with phase changes on the change of data, or PSK with phase changes on the bit edge of a one. Configuration bits CB8 and CB9 determine the modulation option. CB10 is used if the PSK option has been selected and determines whether the return carrier rate is FCLK/2 or FCLK/4. DS21267C-page 17 MCRF250 3.0 CONFIGURATIONLOGIC 3.3 3.1 Control Bit Register The configuration register determines the operational parameters of the device. The configuration register can not be programmed contactlessly; it is programmed during wafer probe at the Microchip factory. CB11 is always a one; CB12 is set when successful contact or contactless programming of the data array has been completed. Once CB12 is set, programming and erasing of the device is disabled. Figure 3-1 contains a description of the control register bit functions. The chip will access data at a baud rate determined by bits CB2, CB3, CB4, and CB5 of the configuration register. CB2, CB3, and CB4 determine the return data rate (CACLK). The default rate of FCLK/128 is used for contact and contactless programming. Once the array is successfully programmed, the lock bit CB12 is set. When the lock bit is set, programming and erasing the device becomes permanently disabled. The configuration register has no effect on device timing or modulation until after the EEPROM data array is programmed. If CB2 is set to a one and CB5 is set to a one, the 1.5 bit SYNC word option is enabled. 3.2 3.4 Organization The configuration bit register directly controls logic blocks, which generate the baud rate, memory size, encoded data, and modulated data. This register also contains bits which lock the data array. Baud Rate Timing Column and Row Decoder Logic and Bit Counter The column and row decoders address the EEPROM array at the CACLK rate and generate a serial data stream for modulation. This data stream can be up to 128 bits in length. The size of the stream is user programmable with CB1, and can be set to 96 or 128 bits. Data lengths of 48 and 64 bits are available by programming the data twice in the array end to end. The data is then encoded by the modulation logic. The data length during contactless programming is 128 bits. The column and row decoders route the proper voltage to the array for programming and reading. In the programming modes, each individual bit is addressed serially from bit 1 to bit 128. DS21267C-page 18 1998 Microchip Technology Inc. MCRF250 FIGURE 3-1: CONFIGURATION REGISTER CB12 CB11 CB10 CB9 CB8 CB7 CB6 CB5 CB4 CB3 CB2 CB1 ARRAY SIZE CB1 = 1: 128-bit user array CB1 = 0: 96-bit user array TIMING CB2 CB3 CB4 Rate 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 MOD128 MOD100 MOD80 MOD32 MOD64 MOD50 MOD40 MOD16 SYNC WORD CB5 = 1: 1.5-bit sync word enable CB5 = 0: 1.5-bit sync word disable DATA ENCODING CB6 = 0; CB7 = 0 nrz_I (direct) CB6 = 0; CB7 = 1 biphase_s (differential) CB6 = 1; CB7 = 0 biphase_I (manchester) CB6 = 1; CB7 = 1 (Not Used) MODULATION OPTIONS CB8 = 0; CB9 = 0 FSK 0 = /8, 1 = /10 CB8 = 0; CB9 = 1 Direct CB8 = 1; CB9 = 0 psk_1 (phase change on change of data) CB8 = 1; CB9 = 1 psk_2 (phase change at beginning of a one PSK RATE OPTION CB10 = 1 clk/4 carrier CB10 = 0 clk/2 carrier (READ ONLY) CB11 = 1 ARRAY LOCK BIT (READ ONLY) CB12 = 0 array not locked CB12 = 1 array is locked 1998 Microchip Technology Inc. DS21267C-page 19 MCRF250 4.0 MODES OF OPERATION The device has two basic modes of operation: Native Mode and Read Mode. 4.1 Native Mode In native mode, the MCRF250 will have an unprogrammed array and will be in the default mode for contactless programming (default baud rate FCLK/128, FSK, NRZ_direct). 4.2 Read Mode The second mode is a read mode after the contactless or contact programming has been completed and for the rest of the lifetime of the device. The lock bit CB12 will be set, and the transponder will have the ability to transmit when powered and enter the anticollision algorithm. FIGURE 4-1: TYPICAL APPLICATION CIRCUIT From carrier signal generator IAC 740 H 4.05 mH RF Energy 390 pF Input parasitic capacitance 2pF 125 kHz Pad VA Pad VB To reader amplifier/ data detector 2.2 nF MCRF250 Data (Backscattering Signal) 1 fres = ------------------ = 125 kHz 2 LC DS21267C-page 20 1998 Microchip Technology Inc. MCRF250 5.0 ANTICOLLISION FIGURE 5-1: The anticollision feature is enabled when the array is locked. In this mode, the MCRF250 has the ability to stop transmitting when a collision has occurred. The device will begin transmitting again when its internal anticollision algorithm indicates that it is time to do so. ANTICOLLISION FLOWCHART Begin Multiple tags can enter the same reader field and be read by the reader in a short period of time. The reader must provide "gaps" (RF field off) at proper timing intervals as shown in Figure 5-1 in order to inform the MCRF250 of collisions, and to sequence from one tag to another. Provide Gap* Wait 5-bit times Is modulation present? No Yes Is only one tag modulating? No Yes Read Tag Provide gap in the first half of the first bit time to make tag stop transmitting Note: 1998 Microchip Technology Inc. *Gap = lack of RF carrier signal = 60 s 20%. DS21267C-page 21 MCRF250 MCRF250 PRODUCT IDENTIFICATION SYSTEM To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office. MCRF250 - I /WFxxx Configuration: Package: Temperature Range: Device: Sample Part Number: Hex = Three digit hex value to be programmed into the Code configuration register. Three hex characters correspond to 12 binary bits. These bits are programmed into the configuration register MSB first (CB12, CB11...CB1). See the example below. WF W S SN P 1C 3C = = = = = = = Sawed wafer on frame (7 mil backgrind) Wafer Dice in wafer pack 150 mil SOIC PDIP COB module with 1000 pF capacitor COB module with 330 pF capacitor I = -40C to +85C 250 = 125 kHz MCRF250-I /40A MCRF250-I/W40A = 125 kHz, Industrial temperature, wafer package, anticollision, 96 bit, FSK/8 /10,direct encoded, F/50 data return rate tag. The configuration register is: CB12 CB11 CB10 CB9 CB8 CB7 CB6 CB5 CB4 CB3 CB2 CB1 0 1 0 0 0 0 0 0 1 0 1 0 DS21267C-page 22 1998 Microchip Technology Inc. M TB023 Contact Programming Support INTRODUCTION FILE SPECIFICATION The MCRF200 and MCRF250 are 125 kHz RF tags, which can be contact or contactlessly programmed. The contact programming of the device is performed by Microchip Technology, Inc. upon customer request. The customer can choose any ID code suitable to their application subject to a minimum order quantity. These devices can also be contactlessly programmed after encapsulation using the Microchip microID contactless programmer (PG103001). SQTP codes supplied to Microchip must comply with the following format: DEFINITIONS Used (i.e., programmed) code files are discarded by Microchip after use. First, the customer has to define the following operation options of the MCRF200 and MCRF250 (refer to individual data sheets page 7 and page 15, respectively): Each line of the code file must contain one ID code for one IC. * Bit rate Defined as clocks per bit e.g., Fc/16, Fc/32, Fc/40, Fc/50, Fc/64, Fc/80, Fc/100, and Fc/128 * Modulation FSK, PSK1, PSK2, ASK Direct * Encoding NRZ_L (Direct), Biphase_L (Manchester), Differential Biphase_S * Code length 32, 48, 64, 96, and 128 bits Second, the ID codes and series numbers must be supplied by the customer or an algorithm can be specified by the customer. This section describes only the case in which actual serial numbers are supplied. The customer must supply the ID codes and series numbers on floppy disk or via email. The codes should conform to the SQTP format below: FIGURE 1: The ID code file is a plain ASCII text file from floppy disk or email (no headers). The code files should be compressed. Please make self-extracting files. The code files are used in alphabetical order of their file names (including letters and numbers). The code is in hexadecimal format. The code line is exactly as long as the selected code length (e.g., code length = 64, ID code = 16 hex characters = 64-bit number). Each line must end with a carriage return. Each hexadecimal ID code must be preceded by a decimal series number. Series number and ID code must be separated by a space. The series number must be unique and ascending to avoid double programming. The series numbers of two consecutive files must also count up for proper linking. EXAMPLE OF TWO CODE FILES, CODE LENGTH = 64 BITS Filename FILE0000.TXT 00001 A34953DBCA001F26 00002 C4F55308B492A783 00003 38FAC359981200B7 " " 12345 9278256DCAFE8756 ID Code Serial Number 1998 Microchip Technology Inc. Next Code FILE0001.TXT 12346 EA43786937DCFB87 12347 459724FCA487ED24 " " " " Code File Last Code Carriage Return Space Necessary DS91023A-page 23 TB023 NOTES: DS91023A-page 24 1998 Microchip Technology Inc. M Author: AN678 RFID Coil Design Youbok Lee Microchip Technology Inc. REVIEW OF A BASIC THEORY FOR ANTENNA COIL DESIGN Current and Magnetic Fields INTRODUCTION In a Radio Frequency Identification (RFID) application, an antenna coil is needed for two main reasons: * To transmit the RF carrier signal to power up the tag * To receive data signals from the tag An RF signal can be radiated effectively if the linear dimension of the antenna is comparable with the wavelength of the operating frequency. In an RFID application utilizing the VLF (100 kHz - 500 kHz) band, the wavelength of the operating frequency is a few kilometers ( = 2.4 Km for 125 kHz signal). Because of its long wavelength, a true antenna can never be formed in a limited space of the device. Alternatively, a small loop antenna coil that is resonating at the frequency of the interest (i.e., 125 kHz) is used. This type of antenna utilizes near field magnetic induction coupling between transmitting and receiving antenna coils. The field produced by the small dipole loop antenna is not a propagating wave, but rather an attenuating wave. The field strength falls off with r-3 (where r = distance from the antenna). This near field behavior (r-3) is a main limiting factor of the read range in RFID applications. When the time-varying magnetic field is passing through a coil (antenna), it induces a voltage across the coil terminal. This voltage is utilized to activate the passive tag device. The antenna coil must be designed to maximize this induced voltage. This application note is written as a reference guide for antenna coil designers and application engineers in the RFID industry. It reviews basic electromagnetics theories to understand the antenna coils, a procedure for coil design, calculation and measurement of inductance, an antenna-tuning method, and the relationship between read range vs. size of antenna coil. Ampere's law states that current flowing on a conductor produces a magnetic field around the conductor. Figure 1 shows the magnetic field produced by a current element. The magnetic field produced by the current on a round conductor (wire) with a finite length is given by: EQUATION 1: o I B = --------- ( cos 2 - cos 1 ) 4r where: I = current r = distance from the center of wire o = permeability of free space and given as o = 4 x 10-7 (Henry/meter) In a special case with an infinitely long wire where 1 = -180 and 2 = 0, Equation 1 can be rewritten as: EQUATION 2: o I B = --------2r FIGURE 1: 2 ( Weber m ) CALCULATION OF MAGNETIC FIELD B AT LOCATION P DUE TO CURRENT I ON A STRAIGHT CONDUCTING WIRE Wire 2 dL I R 1 0 1998 Microchip Technology Inc. 2 ( Weber m ) r P X B (into the page) DS00678B-page 25 AN678 The magnetic field produced by a circular loop antenna coil with N-turns as shown in Figure 2 is found by: FIGURE 2: CALCULATION OF MAGNETIC FIELD B AT LOCATION P DUE TO CURRENT I ON THE LOOP EQUATION 3: 2 o INa B z = -------------------------------2 2 32 2(a + r ) 2 = o INa 1 ------------------ ----3 2 r 2 for r >>a coil 2 I a R where: a = radius of loop Equation 3 indicates that the magnetic field produced by a loop antenna decays with 1/r3 as shown in Figure 3. This near-field decaying behavior of the magnetic field is the main limiting factor in the read range of the RFID device. The field strength is maximum in the plane of the loop and directly proportional to the current (I), the number of turns (N), and the surface area of the loop. r y P Bz FIGURE 3: z DECAYING OF THE MAGNETIC FIELD B VS. DISTANCE r B Equation 3 is frequently used to calculate the ampere-turn requirement for read range. A few examples that calculate the ampere-turns and the field intensity necessary to power the tag will be given in the following sections. r-3 r Note: DS00678B-page 26 The magnetic field produced by a loop antenna drops off with r-3. 1998 Microchip Technology Inc. AN678 INDUCED VOLTAGE IN ANTENNA COIL Faraday's law states a time-varying magnetic field through a surface bounded by a closed path induces a voltage around the loop. This fundamental principle has important consequences for operation of passive RFID devices. Figure 4 shows a simple geometry of an RFID application. When the tag and reader antennas are within a proximity distance, the time-varying magnetic field B that is produced by a reader antenna coil induces a voltage (called electromotive force or simply EMF) in the tag antenna coil. The induced voltage in the coil causes a flow of current in the coil. This is called Faraday's law. The magnetic flux in Equation 4 is the total magnetic field B that is passing through the entire surface of the antenna coil, and found by: EQUATION 5: = B* dS where: The induced voltage on the tag antenna coil is equal to the time rate of change of the magnetic flux . EQUATION 4: d V = - N -------dt where: N = number of turns in the antenna coil = magnetic flux through each turn B = magnetic field given in Equation 3 S = surface area of the coil * = inner product (cosine angle between two vectors) of vectors B and surface area S Note: Both magnetic field B and surface S are vector quantities. The inner product presentation of two vectors in Equation 5 suggests that the total magnetic flux that is passing through the antenna coil is affected by an orientation of the antenna coils. The inner product of two vectors becomes maximized when the two vectors are in the same direction. Therefore, the magnetic flux that is passing through the tag coil will become maximized when the two coils (reader coil and tag coil) are placed in parallel with respect to each other. The negative sign shows that the induced voltage acts in such a way as to oppose the magnetic flux producing it. This is known as Lenz's Law and it emphasizes the fact that the direction of current flow in the circuit is such that the induced magnetic field produced by the induced current will oppose the original magnetic field. FIGURE 4: A BASIC CONFIGURATION OF READER AND TAG ANTENNAS IN AN RFID APPLICATION Tag Coil V = V0sin(t) Tag B = B0sin(t) Reader Coil Reader Electronics 1998 Microchip Technology Inc. Tuning Circuit I = I0sin(t) DS00678B-page 27 AN678 From Equations 3, 4, and 5, the induced voltage V0 for an untuned loop antenna is given by: EQUATION 6: B-FIELD REQUIREMENT The strength of the B-field that is needed to turn on the tag can be calculated from Equation 7: EQUATION 8: Vo = 2fNSB o cos Vo B o = -----------------------------------2f o NQS cos where: f = frequency of the arrival signal N = number of turns of coil in the loop S = area of the loop in square meters (m2) Bo = strength of the arrival signal = angle of arrival of the signal If the coil is tuned (with capacitor C) to the frequency of the arrival signal (125 kHz), the output voltage Vo will rise substantially. The output voltage found in Equation 6 is multiplied by the loaded Q (Quality Factor) of the tuned circuit, which can be varied from 5 to 50 in typical low-frequency RFID applications: EQUATION 7: 7 ( 2.4 ) = ------------------------------------------------------------------------------------------2 ( 2 ) ( 125 kHz ) ( 100 ) ( 15 ) ( 38.71cm ) 1.5 Wb/m 2 where the following parameters are used in the above calculation: tag coil size = 2 x 3 inches = 38.71 cm2: (credit card size) frequency = 125 kHz number of turns = 100 Q of antenna coil = 15 AC coil voltage to turn on the tag = 7V cos V o = 2f o NQSB o cos where the loaded Q is a measure of the selectivity of the frequency of the interest. The Q will be defined in Equations 30, 31, and 37 for general, parallel, and serial resonant circuit, respectively. FIGURE 5: EXAMPLE 1: ORIENTATION DEPENDENCY OF THE TAG ANTENNA. Line of axis (Tag) = 1 (normal direction, = 0). EXAMPLE 2: NUMBER OF TURNS AND CURRENT (AMPERETURNS) OF READER COIL Assuming that the reader should provide a read range of 10 inches (25.4 cm) with a tag given in Example 1, the requirement for the current and number of turns (Ampere-turns) of a reader coil that has an 8 cm radius can be calculated from Equation 3: EQUATION 9: B-field 2 2 32 2B z ( a + r ) ( NI ) = -----------------------------2 a Tag -6 2 2 32 2 ( 1.5 x 10 ) ( 0.08 + 0.254 ) = -------------------------------------------------------------------------7 ( 4 x 10 ) ( 0.08 ) = 7.04 ( ampere - turns ) The induced voltage developed across the loop antenna coil is a function of the angle of the arrival signal. The induced voltage is maximized when the antenna coil is placed perpendicular to the direction of the incoming signal where = 0. DS00678B-page 28 This is an attainable number. If, however, we wish to have a read range of 20 inches (50.8 cm), it can be found that NI increases to 48.5 ampere-turns. At 25.2 inches (64 cm), it exceeds 100 ampere-turns. 1998 Microchip Technology Inc. AN678 For a longer read range, it is instructive to consider increasing the radius of the coil. For example, by doubling the radius (16 cm) of the loop, the ampere-turns requirement for the same read range (10 inches: 25.4 cm) becomes: The optimum radius of loop that requires the minimum number of ampere-turns for a particular read range can be found from Equation 3 such as: EQUATION 11: EQUATION 10: 3 --2 2 2 -6 2 (a + r ) NI = K ----------------------2 a 2 32 2 ( 1.5 x 10 ) ( 0.16 + 0.25 ) NI = ----------------------------------------------------------------------7 2 ( 4 x 10 ) ( 0.16 ) where: = 2.44 (ampere-turns) At a read range of 20 inches (50.8 cm), the ampere-turns becomes 13.5 and at 25.2 inches (64 cm), 26.8. Therefore, for a longer read range, increasing the tag size is often more effective than increasing the coil current. Figure 6 shows the relationship between the read range and the ampere-turns (IN). FIGURE 6: AMPERE-TURNS VS. READ RANGE FOR AN ACCESS CONTROL CARD (CREDIT CARD SIZE) 2Bz K = --------o By taking derivative with respect to the radius a, 2 12 2 2 2 NI for 1.5 -Weber/m2 2 32 2 12 2 The above equation becomes minimized when: 2 2 a - 2r = 0 The above result shows a relationship between the read range vs. tag size. The optimum radius is found as: 10 0.1 2 ( a - 2r ) ( a + r ) = K ----------------------------------------------------3 a 100 1 3 3 2 ( a + r ) ( 2a ) - 2a ( a + r ) d ( NI ) -------------- = K ----------------------------------------------------------------------------------------------4 da a a = 50 cm a = 20 cm a = 10 cm a = 5 cm a = 2 cm 0.01 0.001 0.001 Note: a= a = sqrt(2)*r 0.01 2r where: 0.1 r (m) 1 BO = 1.5 Wb/m2 is used. 1998 Microchip Technology Inc. 10 a = radius of coil r = read range The above result indicates that the optimum radius of loop for a reader antenna is 1.414 times the read range r. DS00678B-page 29 AN678 WIRE TYPES AND OHMIC LOSSES EXAMPLE 3: The skin depth for a copper wire at 125 kHz can be calculated as: Wire Size and DC Resistance The diameter of electrical wire is expressed as the American Wire Gauge (AWG) number. The gauge number is inversely proportional to diameter and the diameter is roughly doubled every six wire gauges. The wire with a smaller diameter has higher DC resistance. The DC resistance for a conductor with a uniform cross-sectional area is found by: EQUATION 14: 1 = --------------------------------------------------------------------7 -7 f ( 4 x 10 ) ( 5.8 x 10 ) 0.06608 = ------------------f EQUATION 12: l RDC = -----S () = 0.187 ( m) ( mm ) where: l = total length of the wire = conductivity S = cross-sectional area Table 1 shows the diameter for bare enamel-coated wires, and DC resistance. and AC Resistance of Wire At DC, charge carriers are evenly distributed through the entire cross section of a wire. As the frequency increases, the reactance near the center of the wire increases. This results in higher impedance to the current density in the region. Therefore, the charge moves away from the center of the wire and towards the edge of the wire. As a result, the current density decreases in the center of the wire and increases near the edge of the wire. This is called a skin effect. The depth into the conductor at which the current density falls to 1/e, or 37% of its value along the surface, is known as the skin depth and is a function of the frequency and the permeability and conductivity of the medium. The skin depth is given by: The wire resistance increases with frequency, and the resistance due to the skin depth is called an AC resistance. An approximated formula for the ac resistance is given by: EQUATION 15: 1 a Rac ------------- = ( R DC ) -----2 2 () where: a = coil radius For copper wire, the loss is approximated by the DC resistance of the coil, if the wire radius is greater than 0.066 f cm. At 125 kHz, the critical radius is 0.019 cm. This is equivalent to #26 gauge wire. Therefore, for minimal loss, wire gauge numbers of greater than #26 should be avoided if coil Q is to be maximized. EQUATION 13: 1 = ----------------f where: f = frequency = permeability of material = conductivity of the material DS00678B-page 30 1998 Microchip Technology Inc. AN678 TABLE 1: AWG WIRE CHART Wire Size (AWG) Dia. in Mils (bare) Dia. in Mils (coated) Ohms/ 1000 ft. Cross Section (mils) Wire Size (AWG) Dia. in Mils (bare) Dia. in Mils (coated) Ohms/ 1000 ft. Cross Section (mils) 1 289.3 -- 0.126 83690 26 15.9 17.2 41.0 253 2 287.6 -- 0.156 66360 27 14.2 15.4 51.4 202 12.6 13.8 65.3 159 3 229.4 -- 0.197 52620 28 4 204.3 -- 0.249 41740 29 11.3 12.3 81.2 123 10.0 11.0 106.0 100 5 181.9 -- 0.313 33090 30 6 162.0 -- 0.395 26240 31 8.9 9.9 131 79.2 8.0 8.8 162 64.0 7 166.3 -- 0.498 20820 32 8 128.5 131.6 0.628 16510 33 7.1 7.9 206 50.4 6.3 7.0 261 39.7 9 114.4 116.3 0.793 13090 34 10 101.9 106.2 0.999 10380 35 5.6 6.3 331 31.4 5.0 5.7 415 25.0 11 90.7 93.5 1.26 8230 36 12 80.8 83.3 1.59 6530 37 4.5 5.1 512 20.2 4.0 4.5 648 16.0 13 72.0 74.1 2.00 5180 38 14 64.1 66.7 2.52 4110 39 3.5 4.0 847 12.2 3.1 3.5 1080 9.61 15 57.1 59.5 3.18 3260 40 16 50.8 52.9 4.02 2580 41 2.8 3.1 1320 7.84 2.5 2.8 1660 6.25 17 45.3 47.2 5.05 2060 42 18 40.3 42.4 6.39 1620 43 2.2 2.5 2140 4.84 2.0 2.3 2590 4.00 19 35.9 37.9 8.05 1290 44 20 32.0 34.0 10.1 1020 45 1.76 1.9 3350 3.10 1.57 1.7 4210 2.46 21 28.5 30.2 12.8 812 46 22 25.3 28.0 16.2 640 47 1.40 1.6 5290 1.96 1.24 1.4 6750 1.54 23 22.6 24.2 20.3 511 48 24 20.1 21.6 25.7 404 49 1.11 1.3 8420 1.23 320 50 0.99 1.1 10600 0.98 25 17.9 19.3 Note: 1 mil = 2.54 x 10-3 cm 1998 Microchip Technology Inc. 32.4 -3 Note: 1 mil = 2.54 x 10 cm DS00678B-page 31 AN678 INDUCTANCE OF VARIOUS ANTENNA COILS Inductance of a Straight Wire The electrical current flowing through a conductor produces a magnetic field. This time-varying magnetic field is capable of producing a flow of current through another conductor. This is called inductance. The inductance L depends on the physical characteristics of the conductor. A coil has more inductance than a straight wire of the same material, and a coil with more turns has more inductance than a coil with fewer turns. The inductance L of inductor is defined as the ratio of the total magnetic flux linkage to the current through the inductor: i.e., The inductance of a straight wound wire shown in Figure 1 is given by: EQUATION 17: 3 L = 0.002l log 2l - - --e ---a 4 where: l and a = length and radius of wire in cm, respectively. EXAMPLE 4: CALCULATION OF INDUCTANCE FOR A STRAIGHT WIRE EQUATION 16: N L = -------I (Henry) where: N = number of turns I = current = magnetic flux In a typical RFID antenna coil for 125 kHz, the inductance is often chosen as a few (mH) for a tag and from a few hundred to a few thousand (H) for a reader. For a coil antenna with multiple turns, greater inductance results with closer turns. Therefore, the tag antenna coil that has to be formed in a limited space often needs a multi-layer winding to reduce the number of turns. The design of the inductor would seem to be a relatively simple matter. However, it is almost impossible to construct an ideal inductor because: a) b) The coil has a finite conductivity that results in losses, and The distributed capacitance exists between turns of a coil and between the conductor and surrounding objects. The actual inductance is always a combination of resistance, inductance, and capacitance. The apparent inductance is the effective inductance at any frequency, i.e., inductive minus the capacitive effect. Various formulas are available in literatures for the calculation of inductance for wires and coils[ 1, 2]. The parameters in the inductor can be measured. For example, an HP 4285 Precision LCR Meter can measure the inductance, resistance, and Q of the coil. The inductance of a wire with 10 feet (304.8 cm) long and 2 mm diameter is calculated as follows: EQUATION 18: ( 304.8 ) 3 L = 0.002 ( 304.8 ) ln 2-------------------- - -- 0.1 4 = 0.60967 ( 7.965 ) = 4.855 ( H ) Inductance of a Single Layer Coil The inductance of a single layer coil shown in Figure 7 can be calculated by: EQUATION 19: 2 ( aN ) L = -------------------------------22.9l + 25.4a ( H ) where: a = coil radius (cm) l = coil length (cm) N = number of turns FIGURE 7: A SINGLE LAYER COIL l a Note: DS00678B-page 32 ( H ) For best Q of the coil, the length should be roughly the same as the diameter of the coil. 1998 Microchip Technology Inc. AN678 Inductance of a Circular Loop Antenna Coil with Multilayer To form a big inductance coil in a limited space, it is more efficient to use multilayer coils. For this reason, a typical RFID antenna coil is formed in a planar multi-turn structure. Figure 8 shows a cross section of the coil. The inductance of a circular ring antenna coil is calculated by an empirical formula[2]: 2 0.31 ( aN ) L = ---------------------------------6a + 9h + 10b ( H ) where: a = average radius of the coil in cm N = number of turns b = winding thickness in cm h = winding height in cm Equation 21 results in N = 200 turns for L = 3.87 mH with the following coil geometry: a h b = = = 1 inch (2.54 cm) 0.05 cm 0.5 cm EQUATION 22: 1 1 - = ---------------------------------------------------------------------------C = -----------------2 2 3 -3 ( 2f ) L ( 4 ) ( 125 x 10 ) ( 3.87 x 10 ) = 419 A CIRCULAR LOOP AIR CORE ANTENNA COIL WITH N-TURNS N-Turn Coil b EXAMPLE ON NUMBER OF TURNS To form a resonant circuit for 125 kHz, it needs a capacitor across the inductor. The resonant capacitor can be calculated as: EQUATION 20: FIGURE 8: EXAMPLE 5: ( pF ) Inductance of a Square Loop Coil with Multilayer If N is the number of turns and a is the side of the square measured to the center of the rectangular cross section that has length b and depth c as shown in Figure 9, then[2]: a center of coil a X b h The number of turns needed for a certain inductance value is simply obtained from Equation 20 such that: EQUATION 21: N = L H ( 6a + 9h + 10b ) ------------------------------------------------2 ( 0.31 )a EQUATION 23: 2 a b+c L = 0.008aN 2.303log 10 ------------ + 0.2235 ------------ + 0.726 ( H ) b + c a The formulas for inductance are widely published and provide a reasonable approximation for the relationship between inductance and number of turns for a given physical size[1]-[4]. When building prototype coils, it is wise to exceed the number of calculated turns by about 10%, and then remove turns to achieve resonance. For production coils, it is best to specify an inductance and tolerance rather than a specific number of turns. FIGURE 9: A SQUARE LOOP ANTENNA COIL WITH MULTILAYER b N-Turn Coil c a (a) Top View 1998 Microchip Technology Inc. a (b) Cross Sectional View DS00678B-page 33 AN678 CONFIGURATION OF ANTENNA COILS inductance of the coil. A typical number of turns of the coil is in the range of 100 turns for 125 kHz and 3~5 turns for 13.56 MHz devices. Tag Antenna Coil For a longer read range, the antenna coil must be tuned properly to the frequency of interest (i.e., 125 kHz). Voltage drop across the coil is maximized by forming a parallel resonant circuit. The tuning is accomplished with a resonant capacitor that is connected in parallel to the coil as shown in Figure 10. The formula for the resonant capacitor value is given in Equation 22. An antenna coil for an RFID tag can be configured in many different ways, depending on the purpose of the application and the dimensional constraints. A typical inductance L for the tag coil is a few (mH) for 125 kHz devices. Figure 10 shows various configurations of tag antenna coils. The coil is typically made of a thin wire. The inductance and the number of turns of the coil can be calculated by the formulas given in the previous section. An Inductance Meter is often used to measure the FIGURE 10: VARIOUS CONFIGURATIONS OF TAG ANTENNA COIL a N-turn Coil 2a b d = 2a 2a Co DS00678B-page 34 Co Co 1998 Microchip Technology Inc. AN678 (125 kHz). The other loop is called a coupling loop (primary), and it is formed with less than two or three turns of coil. This loop is placed in a very close proximity to the main loop, usually (but not necessarily) on the inside edge and not more than a couple of centimeters away from the main loop. The purpose of this loop is to couple signals induced from the main loop to the reader (or vise versa) at a more reasonable matching impedance. Reader Antenna Coil The inductance for the reader antenna coil is typically in the range of a few hundred to a few thousand micro-Henries (H) for low frequency applications. The reader antenna can be made of either a single coil that is typically forming a series resonant circuit or a double loop (transformer) antenna coil that forms a parallel resonant circuit. The series resonant circuit results in minimum impedance at the resonance frequency. Therefore, it draws a maximum current at the resonance frequency. On the other hand, the parallel resonant circuit results in maximum impedance at the resonance frequency. Therefore, the current becomes minimized at the resonance frequency. Since the voltage can be stepped up by forming a double loop (parallel) coil, the parallel resonant circuit is often used for a system where a higher voltage signal is required. The coupling (primary) loop provides an impedance match to the input/output impedance of the reader. The coil is connected to the input/output signal driver in the reader electronics. The main loop (secondary) must be tuned to resonate at the resonance frequency and is not physically connected to the reader electronics. The coupling loop is usually untuned, but in some designs, a tuning capacitor C2 is placed in series with the coupling loop. Because there are far fewer turns on the coupling loop than the main loop, its inductance is considerably smaller. As a result, the capacitance to resonate is usually much larger. Figure 11 shows an example of the transformer loop antenna. The main loop (secondary) is formed with several turns of wire on a large frame, with a tuning capacitor to resonate it to the resonance frequency FIGURE 11: A TRANSFORMER LOOP ANTENNA FOR READER Coupling Coil (primary coil) C2 To reader electronics Main Loop (secondary coil) C1 1998 Microchip Technology Inc. DS00678B-page 35 AN678 RESONANCE CIRCUITS, QUALITY FACTOR Q, AND BANDWIDTH In RFID applications, the antenna coil is an element of resonant circuit and the read range of the device is greatly affected by the performance of the resonant circuit. Figures 12 and 13 show typical examples of resonant circuits formed by an antenna coil and a tuning capacitor. The resonance frequency (fo) of the circuit is determined by: EQUATION 24: 1 f o = -----------------2 LC Parallel Resonant Circuit Figure 12 shows a simple parallel resonant circuit. The total impedance of the circuit is given by: EQUATION 25: jL Z ( j ) = --------------------------------------------L 2 ( 1 - LC ) + j ------R () where: = angular frequency = 2f R = load resistor The ohmic resistance r of the coil is ignored. The maximum impedance occurs when the denominator in the above equation minimized such as: where: L = inductance of antenna coil C = tuning capacitance The resonant circuit can be formed either series or parallel. The series resonant circuit has a minimum impedance at the resonance frequency. As a result, maximum current is available in the circuit. This series resonant circuit is typically used for the reader antenna. On the other hand, the parallel resonant circuit has maximum impedance at the resonance frequency. It offers minimum current and maximum voltage at the resonance frequency. This parallel resonant circuit is used for the tag antenna. EQUATION 26: 2 LC = 1 This is called a resonance condition and the resonance frequency is given by: EQUATION 27: 1 f o = -----------------2 LC By applying Equation 26 into Equation 25, the impedance at the resonance frequency becomes: EQUATION 28: Z = R FIGURE 12: PARALLEL RESONANT CIRCUIT R C L The R and C in the parallel resonant circuit determine the bandwidth, B, of the circuit. EQUATION 29: 1 B = --------------2RC DS00678B-page 36 ( Hz ) 1998 Microchip Technology Inc. AN678 The quality factor, Q, is defined by various ways such as: EQUATION 30: Energy Stored in the System per One Cycle Q = -----------------------------------------------------------------------------------------------------------------Energy Dissipated in the System per One Cycle fo = ---B Series Resonant Circuit A simple series resonant circuit is shown in Figure 13. The expression for the impedance of the circuit is: EQUATION 33: Z ( j ) = r + j ( XL - XC ) () where: r = ohmic resistance of the circuit where: fo = resonant frequency B = bandwidth By applying Equation 27 and Equation 29 into Equation 30, the loaded Q in the parallel resonant circuit is: EQUATION 34: X L = 2fo L EQUATION 35: EQUATION 31: 1 Xc = --------------2f o C C Q = R ---L The Q in parallel resonant circuit is directly proportional to the load resistor R and also to the square root of the ratio of capacitance and inductance in the circuit. When this parallel resonant circuit is used for the tag antenna circuit, the voltage drop across the circuit can be obtained by combining Equations 7 and 31, () () The impedance in Equation 33 becomes minimized when the reactance component cancelled out each other such that XL = XC. This is called a resonance condition. The resonance frequency is same as the parallel resonant frequency given in Equation 27. FIGURE 13: SERIES RESONANCE CIRCUIT r EQUATION 32: C Eo V o = 2fo NQSBo cos C = 2f o N R ---- SB o cos L EIN L 125 kHz The above equation indicates that the induced voltage in the tag coil is inversely proportional to the square root of the coil inductance, but proportional to the number of turns and surface area of the coil. The parallel resonant circuit can be used in the transformer loop antenna for a long-range reader as discussed in "Reader Antenna Coil" (Figure 11). The voltage in the secondary loop is proportional to the turn ratio (n2/n1) of the transformer loop. However, this high voltage signal can corrupt the receiving signals. For this reason, a separate antenna is needed for receiving the signal. This receiving antenna circuit should be tuned to the modulating signal of the tag and detunned to the carrier signal frequency for maximum read range. 1998 Microchip Technology Inc. The half power frequency bandwidth is determined by r and L, and given by: EQUATION 36: r B = ---------2L ( Hz ) DS00678B-page 37 AN678 The quality factor, Q, in the series resonant circuit is given by: EQUATION 37: fo Q = ---- = B L 1 ------- = -----------r C r 1 L --- ---r C ; for unloaded circuit EXAMPLE 6: CIRCUIT PARAMETERS. If the series resistance of the circuit is 15 , then the L and C values form a 125 kHz resonant circuit with Q = 8 are: EQUATION 40: X L = Qr s = 120 ; for loaded circuit The series circuit forms a voltage divider; the voltage drops in the coil is given by: XL 120 L = -------- = --------------------------------- = 153 2f 2 ( 125 kHz ) 1 1 C = ----------------- = ----------------------------------------------- = 10.6 2fX L 2 ( 125 kHz ) ( 120 ) ( H ) ( nF ) EQUATION 38: jX L V o = -------------------------------V in r + jX L - jX c or EQUATION 39: XL XL Vo Q --------- = ---------------------------------------------- = ----------------------------------------------- = -------------------------------------------Vin 2 2 2 2 X L - X c X L - X c r + ( X L - Xc ) r 1 + --------------------- 1 + --------------------- r r DS00678B-page 38 EXAMPLE 7: CALCULATION OF READ RANGE Let us consider designing a reader antenna coil with L = 153 H, diameter = 10 cm, and winding thickness and height are small compared to the diameter. The number of turns for the inductance can be calculated from Equation 21, resulting in 24 turns. If the current flow through the coil is 0.5 amperes, the ampere-turns becomes 12. Therefore, the read range for this coil will be about 20 cm with a credit card size tag. 1998 Microchip Technology Inc. AN678 This problem may be solved by separating the transmitting and receiving coils. The transmitting coil can be designed with higher Q and the receiving coil with lower Q. Q and Bandwidth Figure 14 shows the approximate frequency bands for common forms of Amplitude Shift Keying (ASK), Frequency Shift Keying (FSK), and Phase Shift Keying (PSK) modulation. For a full recovery of data signal from the tag, the reader circuit needs a bandwidth that is at least twice the data rate. Therefore, if the data rate is 8 kHz for an ASK signal, the bandwidth must be at least 16 kHz for a full recovery of the information that is coming from the tag. Limitation on Q When designing a reader antenna circuit, the temptation is to design a coil with very high Q. There are three important limitations to this approach. a) The data rate for FSK (/ 10) signal is 12.5 kHz. Therefore, a bandwidth of 25 kHz is needed for a full data recovery. For example, a 1 ampere of current flow in a 2 mH coil will produce a voltage drop of 1500 VPP. Such voltages are easy to obtain but difficult to isolate. In addition, in the case of single coil reader designs, recovery of the return signal from the tag must be accomplished in the presence of these high voltages. The Q for this FSK (/ 10) signal can be obtained from Equation 30. EQUATION 41: fo 125 kHz Q = ---- = -------------------B 25 kHz b) Tuning becomes critical. To implement a high Q antenna circuit, high voltage components with a close tolerance and high stability would have to be used. Such parts are generally expensive and difficult to obtain. = 5 For a PSK (/ 2) signal, the data rate is 62.5 kHz (if the carrier frequency is 125 kHz) therefore, the reader circuit needs 125 kHz of bandwidth. The Q in this case is 1, and consequently the circuit becomes Q-independent. FIGURE 14: Very high voltages can cause insulation breakdown in either the coil or resonant capacitor. c) As the Q of the circuit gets higher, the amplitude of the return signal relative to the power of the carrier gets proportionally smaller complicating its recovery by the reader circuit. Q FACTOR VS. MODULATION SIGNALS 35 30 Q = 30 25 20 15 Q = 14 10 Q=8 Q =5 5 PSK FSK /2 /8,10 0 50 1998 Microchip Technology Inc. 75 100 125 FSK PSK /8,10 ASK 150 /2 175 200 DS00678B-page 39 AN678 Tuning Method * S-parameter or Impedance Measurement Method using Network Analyzer: a) Set up an S-Parameter Test Set (Network Analyzer) for S11 measurement, and do a calibration. b) Measure the S11 for the resonant circuit. c) Reflection impedance or reflection admittance can be measured instead of the S11. d) Tune the capacitor or the coil until a maximum null (S11) occurs at the resonance frequency, fo. For the impedance measurement, the maximum peak will occur for the parallel resonant circuit, and minimum peak for the series resonant circuit. The circuit must be tuned to the resonance frequency for a maximum performance (read range) of the device. Two examples of tuning the circuit are as follows: * Voltage Measurement Method: a) Set up a voltage signal source at the resonance frequency (125 kHz) b) Connect a voltage signal source across the resonant circuit. c) Connect an Oscilloscope across the resonant circuit. d) Tune the capacitor or the coil while observing the signal amplitude on the Oscilloscope. e) Stop the tuning at the maximum voltage. FIGURE 15: VOLTAGE VS. FREQUENCY FOR RESONANT CIRCUIT V f fo FIGURE 16: FREQUENCY RESPONSES FOR RESONANT CIRCUIT S11 Z Z f f fo (a) fo f fo (b) (c) Note 1: (a) S11 Response, (b) Impedance Response for a Parallel Resonant Circuit, and (c) Impedance Response for a Series Resonant Circuit. 2: In (a), the null at the resonance frequency represents a minimum input reflection at the resonance frequency. This means the circuit absorbs the signal at the frequency while other frequencies are reflected back. In (b), the impedance curve has a peak at the resonance frequency. This is because the parallel resonant circuit has a maximum impedance at the resonance frequency. (c) shows a response for the series resonant circuit. Since the series resonant circuit has a minimum impedance at the resonance frequency, a minimum peak occurs at the resonance frequency. DS00678B-page 40 1998 Microchip Technology Inc. AN678 READ RANGE OF RFID DEVICES With a given operating frequency, the above conditions (a - c) are related to the antenna configuration and tuning circuit. The conditions (d - e) are determined by a circuit topology of the reader. The condition (f) is called the communication protocol of the device, and (g) is related to a firmware program for data interpretation. Read range is defined as a maximum communication distance between the reader and tag. The read range of typical passive RFID products varies from about 1 inch to 1 meter, depending on system configuration. The read range of an RFID device is, in general, affected by the following parameters: a) b) c) d) e) f) g) h) Assuming the device is operating under a given condition, the read range of the device is largely affected by the performance of the antenna coil. It is always true that a longer read range is expected with the larger size of the antenna. Figures 17 and 18 show typical examples of the read range of various passive RFID devices. Operating frequency and performance of antenna coils Q of antenna and tuning circuit Antenna orientation Excitation current and voltage Sensitivity of receiver Coding (or modulation) and decoding (or demodulation) algorithm Number of data bits and detection (interpretation) algorithm Condition of operating environment (metallic, electrical noise), etc. FIGURE 17: READ RANGE VS. TAG SIZE FOR PROXIMITY APPLICATIONS 0.5" diameter Tag ch 1 in 1" diameter Tag s 2 inche Proximity Reader Antenna (4" x 3") 2" diameter 3 ~ 4 inches Tag 4 ~ 5 inch 3.37" x 2.125" (Credit Card Type: ISO Card) es Tag FIGURE 18: READ RANGE VS. TAG SIZE FOR LONG RANGE APPLICATIONS 0.5" diameter Tag 4 i ~5 nc he 1" diameter 8~ Long Range Reader Antenna (16" x 32") s Tag he s 12 inc 2" diameter Tag 18 ~ 22 inches 27 ~ 3 2 inch es 3.37" x 2.125" (Credit Card Type: ISO Card) Tag 1998 Microchip Technology Inc. DS00678B-page 41 AN678 REFERENCES 1. 2. 3. 4. Frederick W. Grover, Inductance Calculations: Working Formulas and Tables, Dover Publications, Inc., New York, NY., 1946. Keith Henry, Editor, Radio Engineering Handbook, McGraw-Hill Book Company, New York, NY., 1963. V. G. Welsby, The Theory and Design of Inductance Coils, John Wiley and Sons, Inc., 1960. James K. Hardy, High Frequency Circuit Design, Reston Publishing Company, Inc., Reston, Virginia, 1975. DS00678B-page 42 1998 Microchip Technology Inc. M 1.0 microIDTM 125 kHz DESIGN GUIDE FSK Reader Reference Design INTRODUCTION 2.0 This application note is written as a reference guide for FSK reader designers. Microchip Technology Inc. provides basic reader electronics circuitry for the MCRF200 customers as a part of this design guide. The circuit is designed for a read range of 3 ~ 5 inches with an access control card. The microID FSK Reader (demo unit), which is built based on the FSK reference design, is available in the microID Designers Kit (DV103001). The circuit can be modified for longer read range or other applications with the MCRF200. An electronic copy of the FSK microID PICmicro(R) source code is available upon request. FIGURE 2-1: READER CIRCUITS The RFID reader consists of transmitting and receiving sections. It transmits a carrier signal, receives the backscattering signal, and performs data processing. The reader also communicates with an external host computer. A basic block diagram of the typical RFID reader is shown in Figure 2-1. BLOCK DIAGRAM OF TYPICAL RFID READER FOR FSK SIGNAL (125 kHz) Transmitting Section Time Base Signal Generator (4 MHz Crystal Oscillator) Carrier Signal Amplifier (Power Driver) / 32 Antenna Coil 125 kHz CLK Microcontroller Data Decoding Interface with Host Computer Serial Interface (RS-232) Filter, Amplifier, and Pulse Shaping Envelope Detector Receiving Section To Host Computer PICmicro is a registered trademark of Microchip Technology Inc. 1998 Microchip Technology Inc. DS51137B-page 43 microIDTM 125 kHz Design Guide 2.1 Transmitting Section The transmitting section contains circuitry for a carrier signal (125 kHz), power amplifiers, and a tuned antenna coil. The 125 kHz carrier signal is typically generated by dividing a 4 MHz (4 MHz/32 = 125 kHz) crystal oscillator signal. The signal is amplified before it is fed into the antenna tuning circuit. A complementary power amplifier circuit is typically used to boost the transmitting signal level. An antenna impedance tuning circuit consisting of capacitors is used to maximize the signal level at the carrier frequency. This tuning circuit is also needed to form an exact LC resonant circuit for the carrier signal. The tuning compensates the variations in the component values and the perturbation of coil inductance due to environment effect. A design guide for the antenna coil is given in AN678, RFID Coil Design, page 25. 2.1.1 LIMITS ON TRANSMITTING SIGNAL LEVEL (FCC PART 15) IN THE USA Each country limits the signal strength of the RF wave that is intentionally radiated by a device. In the USA, the signal strength of the carrier signal (125 kHz) radiating from the antenna coil must comply with the FCC (Federal Communications Commission) part 15 regulation. The signal level is specified by the 47 CFR Part 15.209a of the federal regulation. For a 125 kHz signal, the FCC limits the signal level to 19.2 v per meter, or 25.66 dBV (i.e., 20 log(19.2) = 25.66 dBV), at 300 meters away from the antenna. For a close distance measurement, an extrapolation rule (40 dB per decade) is applied (Part 15.31.f.2). For example, the signal level at 30 meters away from the device must not exceed: 2.2 Receiving Section The receiving section consists of an antenna coil, demodulator, filters, amplifiers, and microcontroller. In applications for close proximity read range, a single coil is often used for both transmitting and receiving. For long read-range applications, however, separated antennas may be used. More details on the antenna coil are given in AN678, RFID Coil Design, page 25. In the FSK communication protocol, a `0' and a `1' are represented by two different frequencies. In the MCRF200, a `0' and a `1' are represented by Fc/8 and Fc/10, respectively. Fc is the carrier frequency. The MCRF200 sends this FSK signal to the reader by an amplitude modulation of the carrier signal. The FSK reader needs two steps for a full recovery of the data. The first step is demodulating the backscattering signal, and the second step is detecting the frequency (or period) of the demodulation signal. The demodulation is accomplished by detecting the envelope of the carrier signal. A half-wave capacitor-filtered rectifier circuit is used for the demodulation process. A diode detects the peak voltage of the backscattering signal. The voltage is then fed into an RC charging/discharging circuit. The RC time constant must be small enough to allow the voltage across C to fall fast enough to keep in step with the envelope. However, the time constant must not be so small as to introduce excessive ripple. The demodulated signal must then pass through a filter and signal shaping circuit before it is fed to the microcontroller. The microcontroller performs data decoding and communicates with the host computer through an RS-232 or other serial interface protocols. 25.66 dBV + 40 dBV = 65.66 dBV DS51137B-page 44 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 3.0 microID FSK READER The electronic circuitry for an FSK reader is shown in Figure 3-1. The reader needs +9 VDC power supply. The 125 kHz carrier signal is generated by dividing the 4 MHz time base signal that is generated by a crystal oscillator. A 16-stage binary ripple counter (74HC4060) is used for this purpose. The 74HC4060 also provides a clock signal for the PIC16C84 microcontroller. The 125 kHz signal is passed to an RF choke (L1) and filter before it is fed into a power amplifier that is formed by a pair of complementary bipolar transistors (Q2 and Q3). For long read-range applications, this power amplifier circuit can be modified. Power MOSFETs may be used instead of the bipolar transistors (2N2222). These power MOSFETs can be driven by +24 VDC power supply. A push-pull predriver can be added at the front of the complementary circuit. This modification will enhance the signal level of the carrier signal. The reader circuit uses a single coil for both transmitting and receiving signals. An antenna coil (L2: 1.62 mH) and a resonant capacitor (C2: 1000 pF) forms a series resonant circuit for a 125 kHz resonance FIGURE 3-1: frequency. Since the C2 is grounded, the carrier signal (125 kHz) is filtered out to ground after passing the antenna coil. The circuit provides a minimum impedance at the resonance frequency. This results in maximizing the antenna current, and therefore, the magnetic field strength is maximized. L2, C15, D7, and the other bottom parts in the circuit form a signal receiving section. The voltage drop in the antenna coil is a summation (superposition) of transmitting signal and backscattering signal. The D7 is a demodulator which detects the envelope of the backscattering signal. The FSK signal waveforms are shown in Figure 3-1. D7 and C19 form a half-wave capacitor-filtered rectifier circuit. The detected envelope signal is charged into the C19. R21 provides a discharge path for the voltage charged in the C19. This voltage passes active filters (U8) and the pulse shaping circuitry (U8) before it is fed into the PIC16C84 for data processing. The PIC16C84 microcontroller performs data decoding and communicates with the host computer via an RS-232 serial interface. SIGNAL WAVEFORM FOR FSK PROTOCOL (Fc = 125 KHZ) 1 2 3 4 5 6 7 8 9 10 o i / u o u i 1 2 3 4 5 6 7 8 9 10 oi /u ou i (`1') (`0') 1 2 3 Transmitting Signal Fc/10 = 12.5 kHz (`1') Fc/8 = 15.625 kHz (`0') Data Signal 80 sec 64 sec 80 sec 64 sec Backscattering Signal Signal in Receiver Coil Output Signal of Envelop Detector Detected Signal after Pulse Shaping Circuit 1998 Microchip Technology Inc. DS51137B-page 45 microIDTM 125 kHz Design Guide FSK READER SCHEMATIC PIC16C84 4.0 DS51137B-page 46 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 5.0 FSK READER BILL OF MATERIALS Part # Reference Designator Item # Qty Manufacturer Vendor Vendor Part # 1 1 110-93-318-41-001 xU5 SOCKET, 18P OPEN FRAME COLLET (0.300) MILL-MAX DIGIKEY ED3318-ND 2 1 DE9S-FRS P2 CONN, D-SUB 9P RECPT RT ANGLE SPC TECHNOLOGY 3 1 DJ005B P1 JACK, POWER, 2.5 mm DC PC MOUNT LZR ELECTRONICS 4 1 PKM22EPP-4001 SP1 BUZZER, PIEZO, 4kHz, 3-20V MURATA 5 2 D220J20COGHAAAC C2, C3 CAP, 22 pF CER DISK RAD COG 100V PHILIPS DIGIKEY 1330PH-ND 6 6 ECQ-P6102JU C7, C8, C10, C14, C16, C18 CAP, 0.001 uF POLYPROPYLENE 630V PHILIPS DIGIKEY P3497-ND 7 2 2222 370 52102 C15, C17 CAP, 0.001 uF METAL FILM, 5%, RAD, 400V PHILIPS DIGIKEY 3001PH-ND 8 1 ECU-S2A182JCB C9 CAP, 1800 pF MONOLITH CERM, 5%, RAD, 100V PHILIPS DIGIKEY P4864-ND 9 1 2222 370 52222 C19 CAP, 0.0022 UF 400V 5% MF BOX PHILIPS DIGIKEY 3003PH-ND 10 1 ECU-S1H682JCB C12 CAP, 6800 pF 50V CERAMIC MONO 5% PANASONIC DIGIKEY P4946-ND 11 2 ECQ-E1104KF C4, C11 CAP, 0.1UF 100VDC 10% RAD METAL POLY CAP PANASONIC DIGIKEY EF1104-ND 12 3 ECS-F1CE106K C5, C6, C13 CAP, TANT, 10uF, 16V PANASONIC DIGIKEY P2038-ND 13 1 ECS-F1AE107 C1 CAP, 100 UFD @ 10VDC 20% TANTALUM CAP PANASONIC DIGIKEY P2032-ND 14 6 1N4148 D1-D6 DIODE, GENERAL PURPOSE, 1N4148 (DO-35) DIODES INC. DIGIKEY 1N4148DITRND 15 1 1N4936 D7 DIODE, 1A 400V FAST-RECOVERY RECTIFIER DIODES INC DIGIKEY 1N4936CT-ND 16 1 -SPARE- LED1 -SPARE- LOCATION DO NOT INSTALL 17 1 78F102J L1 INDUCTOR, 1000 H, COATED JW MILLER DIGIKEY M7849-ND 18 1 MCT0003-001 L2 INDUCTOR, 1.62 mH CORNELL DUBILIER 19 3 2N2907A Q1, Q3, Q4 TRANSISTOR, PNP, 2N2907A, TO-92 MOTOROLA 20 1 2N2222A Q2 TRANSISTOR, NPN, 2N2222A, TO-92 MOTOROLA ALLIED 2N2222A 21 2 5043CX10R0J R10, R13 RES, CF 10 OHM 1/4W 5% PHILLIPS 22 1 82E CR-1/4W-B 5% R11 RES, CF 82 OHM 1/4W 5% YAGEO DIGIKEY 82QBK-ND 23 2 5043CX100R0J R18, R21 RES, CF 100 OHM 1/4W 5% PHILLIPS 24 3 5043CX330R0J R4, R14, R17 RES, CF 330 OHM 1/4W 5% PHILLIPS 1998 Microchip Technology Inc. Part Description DS51137B-page 47 microIDTM 125 kHz Design Guide Part # Reference Designator Item # Qty 25 1 5043CX470R0J R7 RES, CF 470 OHM 5% 1/4W PHILLIPS 26 1 1K8 CR-1/4W-B 5% R3 RES, CF 1.8K OHM 1/4W 5% 27 1 1K82 MF-1/4W-B 1% R12 28 1 2K67 MF-1/4W-B 1% 29 1 30 Vendor Vendor Part # YAGEO DIGIKEY 1.8KQBK-ND RES, MF 1.82K OHM 1/4W 1% YAGEO DIGIKEY 1.82KXBK-ND R15 RES, 2.67K OHM 1/4W 1% MF YAGEO DIGIKEY 2.67KXBK-ND 3K3 CR-1/4W-B 5% R2 RES, CF 3.3K OHM 1/4W 5% YAGEO DIGIKEY 3.3KQBK-ND 4 10K CR-1/4W-B 5% R1, R26, R27, RES, CF 10K OHM R28 1/4W 5% YAGEO DIGIKEY 10KQBK-ND 31 3 5043ED10K00F R16, R29, R30 RES, MF 10K 1/4W 1% 32 2 12K CR-1/4W-B 5% R20, R25 RES, CF 12K OHM 1/4W 5% YAGEO DIGIKEY 12KQBK-ND 33 1 16K5 MF-1/4W-B 1% R22 RES, MF 16.5K OHM 1/4W 1% YAGEO DIGIKEY 16.5KXBK-ND 34 1 22K CR-1/4W-B 5% R6 RES, CF 22K OHM 1/4W 5% YAGEO DIGIKEY 22KQBK-ND 35 1 47K5 MF-1/4W-B 1% R19 RES, MF 47.5K OHM 1/4W 1% YAGEO DIGIKEY 47.5KXBK-ND 36 1 82K5 MF-1/4W-B 1% R23 RES, 82.5K OHM 1/4W 1% MF YAGEO DIGIKEY 82.5KXBK-ND 37 1 5043CX100K0J R9 RES, CF 100K 5% 1/4W 38 2 1M0 CR-1/4W-B 5% R5, R24 RES, CF 1.0M OHM 1/4W 5% YAGEO DIGIKEY 1.0MQBK-ND 39 1 390K CR-1/4W-B 5% R31 RES, 390K OHM 1/4W 5% CF YAGEO DIGIKEY 390KQBK-ND 40 1 LM78M12Ct U1 IC, REG 12V 3 TERM POS (TO-220) NATIONAL DIGIKEY LM78M12CTND 41 1 LM78L05ACZ U2 IC, REG, +5V 0.1A TO-92 NATIONAL DIGIKEY LM78L05ACZND 42 1 MM74HC04N U3 IC, HEX INVERTER 14P DIP FAIRCHILD SEMICONDUCTOR DIGIKEY MM74HC04NND 43 1 MM74HC4060N U4 IC, 14 STAGE BINARY COUNTER, 16P DIP FAIRCHILD SEMICONDUCTOR DIGIKEY MM74HC4060N -ND 44 1 PIC16C84/P U5 IC, PIC16C84 PLASTIC, 14P DIP MICROCHIP 45 1 CD4017BCN U6 IC, DECADE COUNTER FAIRCHILD DIGIKEY CD4017BCNND 46 1 MM74HC74AN U7 IC, DUAL D TYPE FLIP FLOP 14P DIP FAIRCHILD DIGIKEY MM74HC74ANND 47 1 TL084CN U8 IC, QUAD OP AMP, 14P DIP SGS THOMPSON MOUSER 511-TL084CN 48 1 EFO-EC4004A4 Y1 RESONATOR, 4.00MHZ CERAMIC W/CAP PANASONIC DIGIKEY PX400-ND DS51137B-page 48 Part Description Manufacturer PHILLIPS PHILLIPS 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide FSK SOURCE CODE FOR THE PICmicro(R) MCU 6.0 The following source code is for the PIC16C84 microcontroller used in the FSK reader electronics. ; #=#=#=#=#=#=#=#=#=#=#= PROJECT Microchip FSK Reader =#=#=#=#=#=#=#=#=#=#=# ; ; PIC16C84 running at 4MHz, Ti=1us ; ; ; ; ; ; ; ; ; ; ; ; ; ; /////////////////////////////////////////////////////////////////////////// Revision history /////////////////////////////////////////////////////////////////////////// Ver Date Comment 0.01 0.03 29 Dec 97 28 Jan 98 20 Aug 98 Copied from MChip\Reader\FSK TRANSMIT TAB (h'09') REGULARLY Modified to correct FSK comments Tbit=50Tcy=400Ti Ttag=96Tbit Header=h'802A' processor pic16c84 #include "p16c84.inc" __config b'11111111101001' ; Code Protect on, power-up timer on, WDT off, XT oscillator #define #define #define #define _CARRY _ZERO _TO _RP0 STATUS,0 STATUS,2 STATUS,4 STATUS,5 #define _BUZZ1 #define _BUZZ2 #define _RS232TX #define _RS232RX #define _T0CKI StartPORTA = StartTRISA = BeepPort = Beep0 = Beep1 = Beep2 = PORTA,0 PORTA,1 PORTA,2 PORTA,3 PORTA,4 b'01100' b'11000' PORTA StartPORTA StartPORTA | b'00001' StartPORTA | b'00010' #define _DATA_IN PORTB,0 #define _UNUSED1 PORTB,1 #define _LED1 PORTB,2 #define _LED2 PORTB,3 #define _UNUSED2 PORTB,4 #define _UNUSED3 PORTB,5 #define _UNUSED4 PORTB,6 #define _UNUSED5 PORTB,7 StartPORTB = b'00000000' StartTRISB = b'00000001' StartOPTION = b'00001111' ; TMR0 internal, prescaler off BO3 DelayReg BitCtr BeepCtrHi TxByte BeepCtrLo = = = = = = Buffer0 = h'10' ; --- IMMOBILE --- IMMOBILE --- IMMOBILE --- IMMOBILE h'0C' h'0C' h'0D' h'0D' h'0E' h'0E' 1998 Microchip Technology Inc. DS51137B-page 49 microIDTM 125 kHz Design Guide Buffer1 Buffer2 Buffer3 Buffer4 Buffer5 Buffer6 Buffer7 Buffer8 Buffer9 BufferA BufferB ;BufferC ;BufferD ;BufferE ;BufferF Old0 Old1 Old2 Old3 Old4 Old5 Old6 Old7 Old8 Old9 OldA OldB ;OldC ;OldD ;OldE ;OldF = = = = = = = = = = = h'11' ; | h'12' ; | h'13' ; | h'14' ; | h'15' ; | h'16' ; | h'17' ; | h'18' ; | h'19' ; | h'1A' ; | h'1B' ; | = h'1C' ; | = h'1D' ; | = h'1E' ; | = h'1F' ; | = h'20' ; | = h'21' ; | = h'22' ; | = h'23' ; | = h'24' ; | = h'25' ; | = h'26' ; | = h'27' ; | = h'28' ; | = h'29' ; | = h'2A' ; | = h'2B' ; | = h'2C' ; | = h'2D' ; | = h'2E' ; | = h'2F' ; | SKIP macro BTFSC endm PCLATH,7 org h'0000' CLRF PCLATH CLRF INTCON CLRF STATUS GOTO RESET_A ; *#*#*#* RESET VECTOR *#*#*#* org h'0004' CLRF PCLATH CLRF INTCON CLRF STATUS GOTO RESET_A ; *#*#*#* INTERRUPT VECTOR *#*#*#* ; ***** Subroutines, Page 0 Delay07 NOP Delay06 NOP Delay05 NOP Delay04 RETLW 0 RS232CR MOVLW GOTO RS232TxDigit ANDLW MOVWF MOVLW DS51137B-page 50 d'13' RS232TxW h'0F' TxByte h'0A' ;[0] ; | ;[0] ; | ;[0] ; | ;[0] ; | Delay 7Ti Delay 6Ti Delay 5Ti Delay 4Ti ;[1] Transmit CR on RS232 ; | ; | ;[1] Transmit LSnybble of W on RS232 ; | ; | ; | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide SUBWF BTFSS GOTO DigitGE10 MOVLW ADDWF DigitLT10 MOVLW ADDWF RS232TxW MOVWF RS232Tx BSF MOVLW MOVLW RS232TxD1 DECFSZ GOTO BCF NOP MOVLW MOVWF RS232TxD2 DECFSZ GOTO CLRF BSF RS232TxL1 BTFSC GOTO NOP RS232TxBit0 BCF BCF GOTO RS232TxBit1 BSF BSF GOTO RS232TxBitDone RRF MOVLW MOVWF GOTO RS232TxD3 DECFSZ GOTO DECFSZ GOTO CALL BSF RETLW TxByte,W _CARRY DigitLT10 `A'-'0'-h'0A' TxByte,f `0' TxByte,W TxByte _RS232TX d'35' DelayReg DelayReg,f RS232TxD1 _RS232TX d'32' DelayReg DelayReg,f RS232TxD2 BitCtr BitCtr,3 TxByte,0 RS232TxBit1 _RS232TX _CARRY RS232TxBitDone _RS232TX _CARRY RS232TxBitDone TxByte,f d'30' DelayReg RS232TxD3 DelayReg,f RS232TxD3 BitCtr,f RS232TxL1 Delay04 _RS232TX 0 ; | ; | ; | ; | ; | ; | ; | ; | ; | ;[1] Transmit W on RS232 at 9615 baud ; | TxByte=W ;[1] Transmit TxByte - 104us = 9615.4 baud ; | Stop bit ; | | ; | | ; | | ; | | ; | | ; | Start bit ; | | ; | | ; | | ; | | ; | | ; | | ; | BitCtr=#8 ; | | ; | {% -4Ti ; | Transmit TxByte.0, RR TxByte ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | |% 4Ti ; | delay 1 bit ; | | ; | | ; | | ; | | ; | | ; | DEC BitCtr ; | } until (BitCtr==#0) ; | delay ; | stop bit ; end ; ***** End of subroutines, Page 0 RESET_A CLRWDT CLRF CLRF MOVLW MOVWF MOVLW MOVWF BSF MOVLW STATUS FSR StartPORTA PORTA StartPORTB PORTB _RP0 StartTRISA 1998 Microchip Technology Inc. ; Initialise registers ; | Access register page 0 ; | FSR=#0 ; | Initialise PORT and TRIS registers ; | | ; | | ; | | ;^| | ;^| | DS51137B-page 51 microIDTM 125 kHz Design Guide MOVWF MOVLW MOVWF MOVLW MOVWF BCF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF BigLoop1 ;303-581-1041 BSF CALL BCF MOVLW CALL MOVLW MOVWF GetEdge BTFSC GOTO NOP PreSync_L BTFSC GOTO BTFSC GOTO DoSync_L CLRWDT BTFSS GOTO BTFSS GOTO GOTO TRISA StartTRISB TRISB StartOPTION OPTION_REG _RP0 Old0 Old1 Old2 Old3 Old4 Old5 Old6 Old7 Old8 Old9 OldA OldB ;^| ;^| ;^| ;^| ;^| ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | _LED1 Delay07 _LED2 h'09' RS232TxW d'96' BitCtr ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; _DATA_IN PreSync_H _DATA_IN PreSync_H _DATA_IN PreSync_H _DATA_IN DoSync_L _DATA_IN DoSync_L Sync_Done PreSync_H BTFSS _DATA_IN GOTO PreSync_L BTFSS _DATA_IN GOTO PreSync_L DoSync_H CLRWDT BTFSC _DATA_IN GOTO DoSync_H BTFSC _DATA_IN GOTO DoSync_H GOTO Sync_Done Sync_Done ;% -192Ti from sample MOVLW d'62' MOVWF DelayReg ;% -190Ti from sample ReadBit GOTO ReadBitD1 ReadBitD1 DECFSZ DelayReg,f DS51137B-page 52 | | | Initialise OPTION register | | Clear Old buffer | | | | | | | | | | | LEDs "reading" | | Transmit TAB regularly | set BitCtr | Get an edge on _DATA_IN | | | | | | | | | | | | | | | | | | | | | | | | | | | | |% 6 to (+4) from edge, say 8 from edge ; {% -4-DelayReg*3 Ti from sample ; delay ; | ; | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide GOTO CLRF BTFSC INCF BTFSC INCF BTFSC INCF BCF BTFSC BSF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF | BO3.1=_DATA_IN | |% effective sample time | | | | _CARRY=BO3.1 | | roll in _CARRY | | | | | | | | | | | % 19Ti from sample = -381Ti from sample MOVLW d'124' set bit delay MOVWF DelayReg |% -379Ti from sample ;% -7-DelayReg*3 Ti from sample DECFSZ BitCtr,f ; DEC BitCtr GOTO ReadBit ; } until (BitCtr==#0) HeadSearch MOVLW MOVWF HeadSearchL1 MOVLW XORWF BTFSS GOTO MOVLW XORWF BTFSS GOTO GOTO NotHead0 RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF BCF BTFSC BSF DECFSZ GOTO GOTO ReadBitD1 BO3 _DATA_IN BO3,f _DATA_IN BO3,f _DATA_IN BO3,f _CARRY BO3,1 _CARRY Buffer0,f Buffer1,f Buffer2,f Buffer3,f Buffer4,f Buffer5,f Buffer6,f Buffer7,f Buffer8,f Buffer9,f BufferA,f BufferB,f ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; d'96' BitCtr ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; h'80' BufferB,W _ZERO NotHead0 h'2A' BufferA,W _ZERO NotHead0 HeadFound Buffer0,f Buffer1,f Buffer2,f Buffer3,f Buffer4,f Buffer5,f Buffer6,f Buffer7,f Buffer8,f Buffer9,f BufferA,f BufferB,f Buffer0,0 _CARRY Buffer0,0 BitCtr,f HeadSearchL1 BigLoop1 set BitCtr | { if (header found) | | | | | | { goto HeadFound } ROL Buffer | | | | | | | | | | | | | | DEC BitCtr } until (BitCtr==#0) goto BigLoop1 HeadFound CheckSame 1998 Microchip Technology Inc. DS51137B-page 53 microIDTM 125 kHz Design Guide MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO GOTO Buffer0,W Old0,W _ZERO NotSame Buffer1,W Old1,W _ZERO NotSame Buffer2,W Old2,W _ZERO NotSame Buffer3,W Old3,W _ZERO NotSame Buffer4,W Old4,W _ZERO NotSame Buffer5,W Old5,W _ZERO NotSame Buffer6,W Old6,W _ZERO NotSame Buffer7,W Old7,W _ZERO NotSame Buffer8,W Old8,W _ZERO NotSame Buffer9,W Old9,W _ZERO NotSame BufferA,W OldA,W _ZERO NotSame BufferB,W OldB,W _ZERO NotSame Same MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF Buffer0,W Old0 Buffer1,W Old1 Buffer2,W Old2 Buffer3,W Old3 Buffer4,W Old4 Buffer5,W Old5 Buffer6,W Old6 Buffer7,W Old7 NotSame DS51137B-page 54 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF GOTO Buffer8,W Old8 Buffer9,W Old9 BufferA,W OldA BufferB,W OldB BigLoop1 Same TxTag BSF CALL BCF MOVLW MOVWF MOVLW MOVWF BeepLoopJ1 GOTO BeepLoopJ2 MOVLW MOVWF MOVLW MOVWF BeepD1 CLRWDT DECFSZ GOTO MOVLW MOVWF MOVLW MOVWF NOP GOTO BeepD2 CLRWDT DECFSZ GOTO DECFSZ GOTO DECFSZ GOTO NOP MOVLW MOVWF CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW Beep0 BeepPort ;- Transmit tag ; LEDs "Found tag" ; | ; | ; Beep at 3597Hz for 1024 cycles ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | RS232CR `F' RS232TxW `S' RS232TxW `K' RS232TxW ` ` RS232TxW `/' RS232TxW `8' RS232TxW `-' RS232TxW `/' RS232TxW `1' ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; _LED2 Delay07 _LED1 d'4' BeepCtrHi d'0' BeepCtrLo BeepLoopJ2 Beep1 BeepPort d'34' DelayReg DelayReg,f BeepD1 Beep2 BeepPort d'32' DelayReg BeepD2 DelayReg,f BeepD2 BeepCtrLo,f BeepLoopJ1 BeepCtrHi,f BeepLoopJ2 1998 Microchip Technology Inc. Transmit tag info | | | | | | | | | | | | | | | | | DS51137B-page 55 microIDTM 125 kHz Design Guide CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW DS51137B-page 56 RS232TxW `0' RS232TxW RS232CR `T' RS232TxW `b' RS232TxW `i' RS232TxW `t' RS232TxW `=' RS232TxW `5' RS232TxW `0' RS232TxW `T' RS232TxW `c' RS232TxW `y' RS232TxW RS232CR `C' RS232TxW `o' RS232TxW `n' RS232TxW `s' RS232TxW `t' RS232TxW `a' RS232TxW `n' RS232TxW `t' RS232TxW RS232CR `T' RS232TxW `t' RS232TxW `a' RS232TxW `g' RS232TxW `=' RS232TxW `9' RS232TxW `6' RS232TxW `T' RS232TxW `b' RS232TxW `i' RS232TxW `t' RS232TxW RS232CR `P' ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL RS232TxW `o' RS232TxW `l' RS232TxW `a' RS232TxW `r' RS232TxW `i' RS232TxW `t' RS232TxW `y' RS232TxW ` ` RS232TxW `0' RS232TxW RS232CR ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | | | | MOVLW MOVWF BufferB FSR SWAPF CALL MOVF CALL DECF BTFSC GOTO CALL INDF,W RS232TxDigit INDF,W RS232TxDigit FSR,f FSR,4 TxLoop1 RS232CR ; ; ; ; ; ; ; ; ; ; ; Transmit tag ID | | | | | | | | | | GOTO BigLoop1 ; goto BigLoop1 TxLoop1 end 1998 Microchip Technology Inc. DS51137B-page 57 microIDTM 125 kHz Design Guide NOTES: DS51137B-page 58 1998 Microchip Technology Inc. M 1.0 microIDTM 125 kHz DESIGN GUIDE PSK Reader Reference Design INTRODUCTION 2.0 This application note is written as a reference guide for PSK reader designers. Microchip Technology Inc. provides basic reader schematic for the MCRF200 customers as a part of this design guide. The circuit is designed for a read range of 3 ~ 5 inches with an access control card. The microID PSK Reader (demo unit), which is built based on the PSK reference design, is available in the microID Designers Kit (DV103001). The circuit can be modified for longer read range or other applications with the MCRF200. An electronic copy of the PSK microID PICmicro(R) source code is available upon request. FIGURE 2-1: READER CIRCUITS The RFID reader consists of transmitting and receiving sections. It transmits a carrier signal, receives the backscattering signal, and performs data processing. The reader also communicates with an external host computer. A basic block diagram of the typical RFID reader is shown in Figure 2-1. BLOCK DIAGRAM OF TYPICAL RFID READER FOR PSK SIGNAL (125 kHz) Transmitting Section Time Base Signal Generator (4 MHz Crystal Oscillator) Carrier Signal Amplifier (Power Driver) / 32 Antenna Coil 125 kHz CLK Microcontroller Data Decoding Interface with Host Computer Serial Interface (RS-232) Filter, Amplifier Pulse Shaping, and Phase Comparator Circuits Envelope Detector Receiving Section To Host Computer PICmicro is a registered trademark of Microchip Technology Inc. 1998 Microchip Technology Inc. DS51138B-page 59 microIDTM 125 kHz Design Guide 2.1 Transmitting Section The transmitting section contains circuitry for a carrier signal (125 kHz), power amplifiers, and a tuned antenna coil. The 125 kHz carrier signal is typically generated by dividing a 4 MHz (4 MHz/32 = 125 kHz) crystal oscillator signal. The signal is amplified before it is fed into the antenna tuning circuit. A complementary power amplifier circuit is typically used to boost the transmitting signal level. An antenna impedance tuning circuit consisting of capacitors is used to maximize the signal level at the carrier frequency. This tuning circuit is needed to form an exact LC resonant circuit for the carrier signal. The tuning compensates the variations in the component values and the perturbation of coil inductance due to environment effect. A design guide for the antenna coil is given in AN678, RFID Coil Design, page 25. 2.1.1 LIMITS ON TRANSMITTING SIGNAL LEVEL (FCC PART 15) IN THE USA Each country limits the signal strength of the RF wave that is intentionally radiated by a device. In the USA, the signal strength of the carrier signal (125 kHz) radiating from the antenna coil must comply with the FCC (Federal Communications Commission) part 15 regulation. The signal level is specified by the 47 CFR Part 15.209a of the federal regulation. For a 125 kHz signal, the FCC limits the signal level to 19.2 V per meter, or 25.66 dBV (i.e., 20 log(19.2) = 25.66 dBV), at 300 meters away from the antenna. For a close distance measurement, an extrapolation rule (40 dB per decade) is applied (Part 15.31.f.2). For example, the signal level at 30 meters away from the device must not exceed: 2.2 Receiving Section The receiving section consists of an antenna coil, demodulator, filter, amplifier, pulse shaping, phase comparator, and microcontroller. In applications for proximity read-range, a single coil is often used for both transmitting and receiving. For long read range application, however, separated antennas may be used. More details on the antenna coil are given in AN678, RFID Coil Design, page 25. In the PSK communication protocol, the phase of the modulation signal changes with the data. Two most common types of phase encoding method are: (a) change phase at any data change (`0' to `1' or `1' to `0'), and (b) change phase at `1'. A typical data rate for PSK applications is one half of the carrier frequency, and it is faster than FSK. However, it requires a wider bandwidth than FSK. The PSK reader needs two steps for a full recovery of the data. The first step is demodulating the backscattering signal, and the second step is detecting the phase changes in the demodulation signal. The demodulation is accomplished by detecting the envelope of the carrier signal. A full-wave capacitor-filtered rectifier circuit is used for the demodulation process. A diode detects the peak voltage of the backscattering signal. The voltage is then fed into an RC charging/discharging circuit. The RC time constant must be small enough to allow the voltage across C to fall fast enough to keep in step with the envelope. However, the time constant must not be so small as to introduce excessive ripple. The demodulated signal must then pass through a filter, an amplifier, signal shaping, and phase comparator circuits before it is fed to the microcontroller. The microcontroller performs data decoding and communicates with the host computer through an RS-232 or other serial interface protocols. 25.66 dBV + 40 dBV = 65.66 dBV DS51138B-page 60 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 3.0 microID PSK READER at the resonance frequency. This results in maximizing the antenna current, and therefore, the magnetic field strength is maximized. The MCRF200 can be configured with either PSK_1 or PSK_2 modulation. The PSK_1 changes the phase of the modulation signal on any change of the data (i.e., 0 to 1 or 1 to 0). The PSK_2 changes the phase of the modulation signal on the first clock edge of a data `1'. Figure 3-1 shows the optional PSK encoding protocols. The PSK encoded data is amplitude modulating the carrier signal. A typical PSK modulated signal is shown in Figure 3 in AN680, Passive RFID Basics page 15. In the circuit, D7 and D8 are amplitude demodulators that are detecting the envelope of the backscattering signal. D7 provides a current path during a positive half cycle and the D8 during the negative half cycle. The detected envelope signal is charged into the C27. A discharge path for the voltage charged in the C27 is provided by R33. This voltage passes active filters (U11:C) and the pulse shaping circuitry (U11:A). The output from the U11 is a square wave at 62.5 kHz, which exhibits 180 degree phase-shifts in accordance with changes in the data stream from the tag. This signal is used as a clock for D flip-flop (U6:A) for which the D input is a reference 62.5 kHz square wave derived from the 125 kHz transmitting signal. As the phase of the received signal changes, the output of the flip-flop changes, based on whether the clocking occurs during the high or low portions of the reference signal. The recovered data signal is fed to the input I/O pin of the PICmicro MCU (U7) for decoding. This reference reader was designed for use with an MCRF200 with 08Dh in its configuration register, which represents PSK_1, NRZ Direct, Fc/32, data rate, and 128 bits. The electronic circuitry for the PSK reader is shown in Figure 3-1. The reader needs +9 to +15 VDC power supply. The 125 kHz carrier signal is generated by dividing the 4 MHz time-base signal that is generated by a crystal oscillator. A 16-stage binary ripple counter (74HC4060) is used for this purpose. The 74HC4060 also provides a clock signal for the PIC16C84 microcontroller. Signal from the U8 is also used as a phase reference for receiving signals. One of the major problems encountered with the PSK reader is that the phase of the returned signal with respect to a reference signal is, for several reasons, indeterminate. If the transitions of the incoming signal and the reference are occurring at the same time, the output of the D flip-flop will be unpredictable. To guarantee that this does not happen, additional circuits have been added. The 125 kHz signal is passed to an RF choke (L1) and filter before it is fed into a power amplifier that is formed by a pair of complementary bipolar transistors (Q2 and Q3). For long read-range applications, this power amplifier circuit can be modified. Power MOSFETs may be used instead of bipolar transistors (2N2222). These power MOSFETs can be driven by +24 VDC power supply. A push-pull predriver can be added at the front of the complementary circuit. This modification will enhance the signal level of the carrier signal. The received 62.5 kHz signal is buffered by U9:D and a pulse is generated upon every transition of the received signal by U4:C. Likewise, U4:B provides a string of pulses on every transition of the reference 62.5 kHz signal. Note that these pulse strings are at 125 kHz and are independent of the phase state of the received signal. The reader circuit uses a single coil for both transmitting and receiving signals. An antenna coil (L2: 1.62 mH) and a resonant capacitor (C21: 1000 pF) forms a series resonant circuit for 125 kHz resonance frequency. Since the C21 is grounded, the carrier signal (125 kHz) is filtered out to the ground after passing the antenna coil. The circuit provides minimum impedance FIGURE 3-1: These pulses are fed to the set and reset lines of U5:A and result in a 125 kHz output at Q whose duty cycle is proportional to the phase difference between the two pulse signals. If the duty cycle is near 50%, then the transitions of the 62.5 kHz signals are approximately 90 degrees different which is ideal for PSK demodulation. PSK DATA MODULATION `0' `0' `1' `1' PP EE Data PP PSK 1 Change on Data PP P PSK 2 Change on `1' PP P 1998 Microchip Technology Inc. PP DS51138B-page 61 microIDTM 125 kHz Design Guide R6 and C10 filter the output of U5:A resulting in a DC level proportional to the phase shift. This level is the input to a window detector consisting of U10 and U4:A. If the DC level is near the midpoint, the output of comparator U10:B would be high and the output of comparator U10:A would be low. Therefore, the output of U4:A would be high. If the DC level is higher than the reference level set by R21, R26, and R30 then the outputs of both comparators would be high, resulting in a low output from U4:A. Similarly, if the DC level is low, both outputs would be low, which would also result in a low output at U4:A. Note that the 125 kHz signal from which the 62.5 kHz reference is obtained passes through gate U4:D. A change of the state on the control output to this gate allows the 125 kHz signal to be 180 degree phase-shifted. This results in a phase-shift in the 62.5 kHz reference of 90 degrees. If the output of the U9:C is low, the flip-flop U5:B will maintain its current state. If the output of U4:A goes low, which would signify an undesirable phase relationship between the 62.5 kHz signals, then the output of U9:C would have a transition to high, causing U5:B to change state. This would change the reference phase 90 degrees, thus bringing the phases of the 62.5 kHz signals back into a desirable relationship and return the output of U4:A to a high state. In the event that no tag is present, Q of U5:A is always high which makes the output of U10:B low. This turns on an oscillator consisting of U9:A, U9:B, C8, R15, and R19. This oscillator toggles U5:B at about 200 Hz, allowing the reader to be looking for a tag signal with both reference signal phases. When a good tag signal appears, the circuit locks on in a good phase relationship and demodulates the incoming 62.5 kHz signal. As the tag comes closer to the reader, the phase will be shift for a number of reasons. If the shift is sufficient, the reference signal will shift as necessary to maintain good demodulation. The PIC16C84 microcontroller performs data decoding and communicates with host computer via an RS-232 serial interface. DS51138B-page 62 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide PSK READER SCHEMATIC PIC16C84 4.0 1998 Microchip Technology Inc. DS51138B-page 63 microIDTM 125 kHz Design Guide 5.0 PSK READER BILL OF MATERIALS Item # Qty Part # 1 1 110-93-314-41-001 2 1 3 Reference Designator Part Description Manufacturer Vendor Vendor Part # xU6 SOCKET, 14P COLLET OPEN FRAME (0.300W) MILL-MAX DIGIKEY ED3314-ND DE9S-FRS P2 CONN, D-SUB 9P RECPT RT ANGLE 1 DJ005B P1 JACK, POWER, 2.5mm LZR DC PC MOUNT ELECTRONICS 4 1 PKM22EPP-4001 SP1 BUZZER, PIEZO, 4KHz, 3-20V MURATA 5 2 D100D20U2MHAAAC C7, C15 CAP, 10 pF CER DISK RAD, 100V PHILIPS DIGIKEY 1301PH-ND 6 2 D220J20COGHAAAC C2, C3 CAP, 22 pF CER DISK RAD COG 100V PHILIPS DIGIKEY 1330PH-ND 7 7 ECU-S1H221JCA C13, C14, C23-C25, C29, C31 CAP, 220pF, CER MONO, RAD, 50V, 5% PANASONIC DIGIKEY P4929-ND 8 1 ECQ-P6102JU C21 CAP, 0.001 F POLYPROPYLENE 630V PHILIPS DIGIKEY P3497-ND 9 2 2222 370 52102 C26, C27 CAP, 0.001 F METAL FILM, 5%, RAD, 400V PHILIPS DIGIKEY 3001PH-ND 10 1 ECU-S2A152JCB C22 CAP, 1500 pF MONOLITH CERM, 5%, RAD, 100V PHILIPS DIGIKEY P4863-ND 11 3 ECU-S2A182JCB C9, C18, C20 CAP, 1800 pF MONOLITH CERM, 5%, RAD, 100V PHILIPS DIGIKEY P4864-ND 12 1 ECU-S1H682JCB C12 CAP, 6800 pF 50V CERAMIC MONO 5% PANASONIC DIGIKEY P4946-ND 13 2 ECK-F1H103ZF C8, C10 CAP, 0.01 F CERM DISK, +80/-20%, RAD, 50V PHILIPS DIGIKEY P4066A-ND 14 1 ECQ-V1103JM C16 CAP, 0.01 F 100V STACK METAL FILM PANASONIC DIGIKEY P4713-ND 15 3 ECQ-E1104KF C4, C11, C30 CAP, 0.1 UF 100VDC 10% RAD METAL POLY CAP PANASONIC DIGIKEY EF1104-ND 16 1 ECU-S1H121JCA C28 CAP, 120 pF, CER MONO, RAD, 50V, 5% PANASONIC DIGIKEY P4926-ND 17 3 ECE-A16Z10 C5, C6, C19 CAP, 10 F, ELECTRO, RAD, 16V, 20% PANASONIC DIGIKEY P6616-ND 18 1 ECE-A25Z100 C1 CAP, 100 F, ELECTRO, RAD, 25V, 20% PANASONIC DIGIKEY P6616-ND 19 6 1N4148 D1-D6 DIODE, GENERAL PURPOSE, 1N4148 (DO-35) DIODES INC. DIGIKEY 1N4148DITRND 20 2 1N4936 D7, D8 DIODE, 1A 400V FASTRECOVERY RECTIFIER DIODES INC DIGIKEY 1N4936CT-ND 21 1 -SPARE- LED1, C17 -SPARE- LOCATION DO NOT INSTALL 22 2 78F102J L1, L3 INDUCTOR, 1000 H, COATED JW MILLER DIGIKEY M7849-ND 23 1 MCT0003-001 L2 INDUCTOR, 1.62 mH CORNELL DUBILIER DS51138B-page 64 SPC TECHNOLOGY 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide Part # Reference Designator Item # Qty Vendor Vendor Part # 24 3 2N2907A Q1, Q3, Q4 TRANSISTOR, PNP, 2N2907A, TO-92 MOTOROLA 25 1 2N2222A Q2 TRANSISTOR, NPN, 2N2222A, TO-92 MOTOROLA ALLIED 2N2222A 26 2 5043CX10R0J R10, R13 RES, CF 10 OHM 1/4W 5% PHILLIPS 27 1 82E CR-1/4W-B 5% R11 RES, CF 82 OHM 1/4W 5% YAGEO DIGIKEY 82QBK-ND 28 1 5043CX100R0J R18 RES, CF 100 OHM 1/4W 5% PHILLIPS 29 1 5043CX220R0J R40 RES, CF 220 OHM 5% 1/4W PHILLIPS 30 3 5043CX330R0J R4, R14, R17 RES, CF 330 OHM 1/4W 5% PHILLIPS 31 1 5043CX470R0J R7 RES, CF 470 OHM 5% 1/4W PHILLIPS 32 1 1K21 MF-1/4W-B 1% R27 RES, MF 1.21K OHM 1/ 4W 1% YAGEO DIGIKEY 1.21KXBK-ND 33 1 1K8 CR-1/4W-B 5% R3 RES, CF 1.8K OHM 1/4W 5% YAGEO DIGIKEY 1.8KQBK-ND 34 1 1K82 MF-1/4W-B 1% R24 RES, MF 1.82K OHM 1/ 4W 1% YAGEO DIGIKEY 1.82KXBK-ND 35 1 3K3 CR-1/4W-B 5% R2 RES, CF 3.3K OHM 1/4W 5% YAGEO DIGIKEY 3.3KQBK-ND 36 1 5043CX4K700J R29 RES, CF 4.7K 5% 1/4W, AXIAL 37 6 10K CR-1/4W-B 5% R1, R12, R25, RES, CF 10K OHM R35, R39, 1/4W 5% R41 DIGIKEY 10KQBK-ND 38 3 5043ED10K00F R31, R43, R44 RES, MF 10K 1/4W 1% 39 2 12K CR-1/4W-B 5% R20, R38 RES, CF 12K OHM 1/4W 5% YAGEO DIGIKEY 12KQBK-ND 40 1 16K5 MF-1/4W-B 1% R34 RES, MF 16.5K OHM 1/4W 1% YAGEO DIGIKEY 16.5KXBK-ND 41 2 22K CR-1/4W-B 5% R6, R8 RES, CF 22K OHM 1/4W 5% YAGEO DIGIKEY 22KQBK-ND 42 1 47K5 MF-1/4W-B 1% R37 RES, MF 47.5K OHM 1/4W 1% YAGEO DIGIKEY 47.5KXBK-ND 43 1 56K CR-1/4W-B 5% R32 RES, CF 56K OHM 1/4W 5% YAGEO DIGIKEY 56KQBK-ND 44 5 5043CX100K0J R9, R16, R21, RES, CF 100K 5% R22, R30 1/4W 45 1 180K CR-1/4W-B 5% R26 RES, CF 180K OHM 1/4W 5% YAGEO DIGIKEY 180KQBK-ND 46 1 270K CR-1/4W-B 5% R15 RES, CF 270K OHM 1/4W 5% YAGEO DIGIKEY 270KQBK-ND 47 7 1M0 CR-1/4W-B 5% R5, R19, R23, RES, CF 1.0M OHM R28, R33, 1/4W 5% R36, R42 YAGEO DIGIKEY 1.0MQBK-ND 48 1 LM78M12CT U1 IC, REG 12V 3 TERM POS (TO-220) NATIONAL DIGIKEY LM78M12CTND 49 1 LM78L05ACZ U2 IC, REG, +5V 0.1 A TO-92 NATIONAL DIGIKEY LM78L05ACZND 1998 Microchip Technology Inc. Part Description Manufacturer PHILLIPS YAGEO PHILLIPS PHILLIPS DS51138B-page 65 microIDTM 125 kHz Design Guide Part # Reference Designator Item # Qty 50 1 MM74HC04N U3 51 1 CD4030CN 52 2 53 Manufacturer Vendor Vendor Part # IC, HEX INVERTER 14P DIP FAIRCHILD SEMICONDUCTOR DIGIKEY MM74HC04NND U4 IC, QUAD EXCLUSIVE OR GATE, 14P DIP FAIRCHILD SEMICONDUCTOR DIGIKEY CD4030CNND CD4013BCN U5, U6 IC, DUAL D FLIP FLOP, FAIRCHILD 14P DIP SEMICONDUCTOR DIGIKEY CD4013BCNND 1 PIC16C84/P U7 IC, PIC16C84 PLASTIC, 14P DIP 54 1 MM74HC4060N U8 IC, 14 STAGE BINARY COUNTER, 16P DIP FAIRCHILD SEMICONDUCTOR DIGIKEY MM74HC4060 N-ND 55 1 CD4001BCN U9 IC, QUAD 2-IN NOR GATE, 14P DIP FAIRCHILD SEMICONDUCTOR DIGIKEY CD4001BCNND 56 1 TLC3702CP U10 IC, DUAL VOLTAGE COMPARATORS, 1000mW, 8P DIP TEXAS INSTRUMENTS MOUSER TLC3702CP 57 1 TL084CN U11 IC, QUAD OP AMP, 1 4P DIP SGS THOMPSON MOUSER 511-TL084CN 58 1 EFO-EC4004A4 Y1 RESONATOR, 4.00MHZ CERAMIC W/CAP PANASONIC DIGIKEY PX400-ND DS51138B-page 66 Part Description MICROCHIP 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide PSK SOURCE CODE FOR THE PICmicro(R) MCU 6.0 The following source code is for the PIC16C84 microcontroller used in the PSK reader electronics. ; #=#=#=#=#=#=#=#=#=#=#= PROJECT Microchip PSK Reader =#=#=#=#=#=#=#=#=#=#=# ; ; PIC16C84 running at 4MHz, Ti=1us ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; /////////////////////////////////////////////////////////////////////////// Revision history /////////////////////////////////////////////////////////////////////////// Ver Date Comment 0.01 0.03 29 Dec 97 28 Jan 98 20 Aug 98 Copied from MChip\Reader\PSK TRANSMIT TAB (h'09') REGULARLY Modified to correct PSK comments Tbit=32Tcy=256Ti Ttag=128Tbit Header=h'802A' processor pic16c84 #include "p16c84.inc" __config b'11111111101001' ; Code Protect on, power-up timer on, WDT off, XT oscillator #define #define #define #define _CARRY _ZERO _TO _RP0 STATUS,0 STATUS,2 STATUS,4 STATUS,5 #define _BUZZ1 #define _BUZZ2 #define _RS232TX #define _RS232RX #define _T0CKI StartPORTA = StartTRISA = BeepPort = Beep0 = Beep1 = Beep2 = PORTA,0 PORTA,1 PORTA,2 PORTA,3 PORTA,4 b'01100' b'11000' PORTA StartPORTA StartPORTA | b'00001' StartPORTA | b'00010' #define _DATA_IN PORTB,0 #define _UNUSED1 PORTB,1 #define _LED1 PORTB,2 #define _LED2 PORTB,3 #define _UNUSED2 PORTB,4 #define _UNUSED3 PORTB,5 #define _UNUSED4 PORTB,6 #define _UNUSED5 PORTB,7 StartPORTB = b'00000000' StartTRISB = b'00000001' StartOPTION = b'00001111' ; TMR0 internal, prescaler off BO3 DelayReg BitCtr BeepCtrHi TxByte BeepCtrLo = = = = = = Buffer0 = h'10' ; --- IMMOBILE --- IMMOBILE --- IMMOBILE --- IMMOBILE h'0C' h'0C' h'0D' h'0D' h'0E' h'0E' 1998 Microchip Technology Inc. DS51138B-page 67 microIDTM 125 kHz Design Guide Buffer1 Buffer2 Buffer3 Buffer4 Buffer5 Buffer6 Buffer7 Buffer8 Buffer9 BufferA BufferB BufferC BufferD BufferE BufferF Old0 Old1 Old2 Old3 Old4 Old5 Old6 Old7 Old8 Old9 OldA OldB OldC OldD OldE OldF = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = h'11' h'12' h'13' h'14' h'15' h'16' h'17' h'18' h'19' h'1A' h'1B' h'1C' h'1D' h'1E' h'1F' h'20' h'21' h'22' h'23' h'24' h'25' h'26' h'27' h'28' h'29' h'2A' h'2B' h'2C' h'2D' h'2E' h'2F' SKIP macro BTFSC endm PCLATH,7 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | org h'0000' CLRF PCLATH CLRF INTCON CLRF STATUS GOTO RESET_A ; *#*#*#* RESET VECTOR *#*#*#* org h'0004' CLRF PCLATH CLRF INTCON CLRF STATUS GOTO RESET_A ; *#*#*#* INTERRUPT VECTOR *#*#*#* ; ***** Subroutines, Page 0 Delay07 NOP Delay06 NOP Delay05 NOP Delay04 RETLW 0 RS232CR MOVLW GOTO RS232TxDigit ANDLW MOVWF MOVLW DS51138B-page 68 d'13' RS232TxW h'0F' TxByte h'0A' ;[0] ; | ;[0] ; | ;[0] ; | ;[0] ; | Delay 7Ti Delay 6Ti Delay 5Ti Delay 4Ti ;[1] Transmit CR on RS232 ; | ; | ;[1] Transmit LSnybble of W on RS232 ; | ; | ; | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide SUBWF BTFSS GOTO DigitGE10 MOVLW ADDWF DigitLT10 MOVLW ADDWF RS232TxW MOVWF RS232Tx BSF MOVLW MOVLW RS232TxD1 DECFSZ GOTO BCF NOP MOVLW MOVWF RS232TxD2 DECFSZ GOTO CLRF BSF RS232TxL1 BTFSC GOTO NOP RS232TxBit0 BCF BCF GOTO RS232TxBit1 BSF BSF GOTO RS232TxBitDone RRF MOVLW MOVWF GOTO RS232TxD3 DECFSZ GOTO DECFSZ GOTO CALL BSF RETLW TxByte,W _CARRY DigitLT10 `A'-'0'-h'0A' TxByte,f `0' TxByte,W TxByte _RS232TX d'35' DelayReg DelayReg,f RS232TxD1 _RS232TX d'32' DelayReg DelayReg,f RS232TxD2 BitCtr BitCtr,3 TxByte,0 RS232TxBit1 _RS232TX _CARRY RS232TxBitDone _RS232TX _CARRY RS232TxBitDone TxByte,f d'30' DelayReg RS232TxD3 DelayReg,f RS232TxD3 BitCtr,f RS232TxL1 Delay04 _RS232TX 0 ; | ; | ; | ; | ; | ; | ; | ; | ; | ;[1] Transmit W on RS232 at 9615 baud ; | TxByte=W ;[1] Transmit TxByte - 104us = 9615.4 baud ; | Stop bit ; | | ; | | ; | | ; | | ; | | ; | Start bit ; | | ; | | ; | | ; | | ; | | ; | | ; | BitCtr=#8 ; | | ; | {% -4Ti ; | Transmit TxByte.0, RR TxByte ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | |% 4Ti ; | delay 1 bit ; | | ; | | ; | | ; | | ; | | ; | DEC BitCtr ; | } until (BitCtr==#0) ; | delay ; | stop bit ; end ; ***** End of subroutines, Page 0 RESET_A CLRWDT CLRF CLRF MOVLW MOVWF MOVLW MOVWF BSF MOVLW STATUS FSR StartPORTA PORTA StartPORTB PORTB _RP0 StartTRISA 1998 Microchip Technology Inc. ; Initialise registers ; | Access register page 0 ; | FSR=#0 ; | Initialise PORT and TRIS registers ; | | ; | | ; | | ;^| | ;^| | DS51138B-page 69 microIDTM 125 kHz Design Guide MOVWF MOVLW MOVWF MOVLW MOVWF BCF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF TRISA StartTRISB TRISB StartOPTION OPTION_REG _RP0 Old0 Old1 Old2 Old3 Old4 Old5 Old6 Old7 Old8 Old9 OldA OldB OldC OldD OldE OldF ;^| ;^| ;^| ;^| ;^| ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | BSF CALL BCF MOVLW CALL MOVLW MOVWF _LED1 Delay07 _LED2 h'09' RS232TxW d'128' BitCtr ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | Initialise OPTION register | | Clear Old buffer | | | | | | | | | | | | | | | BigLoop1 GetEdge BTFSC GOTO NOP PreSync_L BTFSC GOTO BTFSC GOTO DoSync_L CLRWDT BTFSS GOTO BTFSS GOTO GOTO _DATA_IN PreSync_H _DATA_IN PreSync_H _DATA_IN PreSync_H _DATA_IN DoSync_L _DATA_IN DoSync_L Sync_Done PreSync_H BTFSS _DATA_IN GOTO PreSync_L BTFSS _DATA_IN GOTO PreSync_L DoSync_H CLRWDT BTFSC _DATA_IN GOTO DoSync_H BTFSC _DATA_IN GOTO DoSync_H GOTO Sync_Done Sync_Done ;% -120Ti from sample NOP MOVLW d'38' MOVWF DelayReg ;% -117Ti from sample DS51138B-page 70 LEDs "reading" | | Transmit TAB regularly | set BitCtr | Get an edge on _DATA_IN | | | | | | | | | | | | | | | | | | | | | | | | | | | | |% 6 to (+4) from edge, say 8 from edge 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide ReadBit ; {% -3-DelayReg*3 Ti from sample ; delay ; | DelayReg,f ; | ReadBitD1 ; | BO3 ; BO3.1=_DATA_IN _DATA_IN ; | BO3,f ; |% effective sample time _DATA_IN ; | BO3,f ; | _DATA_IN ; | BO3,f ; | _CARRY ; _CARRY=BO3.1 BO3,1 ; | _CARRY ; | Buffer0,f ; roll in _CARRY Buffer1,f ; | Buffer2,f ; | Buffer3,f ; | Buffer4,f ; | Buffer5,f ; | Buffer6,f ; | Buffer7,f ; | Buffer8,f ; | Buffer9,f ; | BufferA,f ; | BufferB,f ; | BufferC,f ; | BufferD,f ; | BufferE,f ; | BufferF,f ; | ; % 23Ti from sample = -233Ti from sample MOVLW d'75' ; set bit delay MOVWF DelayReg ; |% -231Ti from sample ;% -6-DelayReg*3 Ti from sample DECFSZ BitCtr,f ; DEC BitCtr GOTO ReadBit ; } until (BitCtr==#0) NOP ReadBitD1 DECFSZ GOTO CLRF BTFSC INCF BTFSC INCF BTFSC INCF BCF BTFSC BSF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF HeadSearch MOVLW MOVWF HeadSearchL1 MOVLW XORWF BTFSS GOTO MOVLW XORWF BTFSS GOTO GOTO NotHead0 MOVLW XORWF BTFSS GOTO MOVLW XORWF BTFSS GOTO GOTO NotHead1 RLF RLF RLF RLF d'128' BitCtr h'80' BufferF,W _ZERO NotHead0 h'2A' BufferE,W _ZERO NotHead0 HeadPolarity0 h'7F' BufferF,W _ZERO NotHead1 h'D5' BufferE,W _ZERO NotHead1 HeadPolarity1 Buffer0,f Buffer1,f Buffer2,f Buffer3,f 1998 Microchip Technology Inc. ; set BitCtr ; | ; { ; if (header found) ; | ; | ; | ; | ; | ; | ; { ; goto HeadPolarity0 ; } ; if (inverse header found) ; | ; | ; | ; | ; | ; | ; { ; goto HeadPolarity1 ; } ; ROL Buffer ; | ; | ; | DS51138B-page 71 microIDTM 125 kHz Design Guide RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF BCF BTFSC BSF DECFSZ GOTO GOTO HeadPolarity1 COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF COMF HeadPolarity0 HeadFound CheckSame MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF DS51138B-page 72 Buffer4,f Buffer5,f Buffer6,f Buffer7,f Buffer8,f Buffer9,f BufferA,f BufferB,f BufferC,f BufferD,f BufferE,f BufferF,f Buffer0,0 _CARRY Buffer0,0 BitCtr,f HeadSearchL1 BigLoop1 ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; DEC BitCtr ; } until (BitCtr==#0) ; goto BigLoop1 Buffer0,f Buffer1,f Buffer2,f Buffer3,f Buffer4,f Buffer5,f Buffer6,f Buffer7,f Buffer8,f Buffer9,f BufferA,f BufferB,f BufferC,f BufferD,f BufferE,f BufferF,f Buffer0,W Old0,W _ZERO NotSame Buffer1,W Old1,W _ZERO NotSame Buffer2,W Old2,W _ZERO NotSame Buffer3,W Old3,W _ZERO NotSame Buffer4,W Old4,W _ZERO NotSame Buffer5,W Old5,W _ZERO NotSame Buffer6,W Old6,W 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO MOVF XORWF BTFSS GOTO GOTO _ZERO NotSame Buffer7,W Old7,W _ZERO NotSame Buffer8,W Old8,W _ZERO NotSame Buffer9,W Old9,W _ZERO NotSame BufferA,W OldA,W _ZERO NotSame BufferB,W OldB,W _ZERO NotSame BufferC,W OldC,W _ZERO NotSame BufferD,W OldD,W _ZERO NotSame BufferE,W OldE,W _ZERO NotSame BufferF,W OldF,W _ZERO NotSame Same MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF Buffer0,W Old0 Buffer1,W Old1 Buffer2,W Old2 Buffer3,W Old3 Buffer4,W Old4 Buffer5,W Old5 Buffer6,W Old6 Buffer7,W Old7 Buffer8,W Old8 Buffer9,W Old9 BufferA,W OldA BufferB,W OldB BufferC,W OldC NotSame 1998 Microchip Technology Inc. DS51138B-page 73 microIDTM 125 kHz Design Guide MOVF MOVWF MOVF MOVWF MOVF MOVWF GOTO BufferD,W OldD BufferE,W OldE BufferF,W OldF BigLoop1 Same TxTag BSF CALL BCF MOVLW MOVWF MOVLW MOVWF BeepLoopJ1 GOTO BeepLoopJ2 MOVLW MOVWF MOVLW MOVWF BeepD1 CLRWDT DECFSZ GOTO MOVLW MOVWF MOVLW MOVWF NOP GOTO BeepD2 CLRWDT DECFSZ GOTO DECFSZ GOTO DECFSZ GOTO NOP MOVLW MOVWF CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL DS51138B-page 74 Beep0 BeepPort ;- Transmit tag ; LEDs "Found tag" ; | ; | ; Beep at 3597Hz for 1024 cycles ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | RS232CR `P' RS232TxW `S' RS232TxW `K' RS232TxW `/' RS232TxW `2' RS232TxW RS232CR `T' RS232TxW `b' RS232TxW `i' RS232TxW `t' RS232TxW ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; _LED2 Delay07 _LED1 d'4' BeepCtrHi d'0' BeepCtrLo BeepLoopJ2 Beep1 BeepPort d'34' DelayReg DelayReg,f BeepD1 Beep2 BeepPort d'32' DelayReg BeepD2 DelayReg,f BeepD2 BeepCtrLo,f BeepLoopJ1 BeepCtrHi,f BeepLoopJ2 Transmit tag info | | | | | | | | | | | | | | | | | | | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW `=' RS232TxW `3' RS232TxW `2' RS232TxW `T' RS232TxW `c' RS232TxW `y' RS232TxW RS232CR `C' RS232TxW `o' RS232TxW `n' RS232TxW `s' RS232TxW `t' RS232TxW `a' RS232TxW `n' RS232TxW `t' RS232TxW RS232CR `T' RS232TxW `t' RS232TxW `a' RS232TxW `g' RS232TxW `=' RS232TxW `1' RS232TxW `2' RS232TxW `8' RS232TxW `T' RS232TxW `b' RS232TxW `i' RS232TxW `t' RS232TxW RS232CR `P' RS232TxW `o' RS232TxW `l' RS232TxW `a' RS232TxW `r' RS232TxW `i' 1998 Microchip Technology Inc. ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DS51138B-page 75 microIDTM 125 kHz Design Guide CALL MOVLW CALL MOVLW CALL MOVLW CALL MOVLW CALL CALL RS232TxW `t' RS232TxW `y' RS232TxW ` ` RS232TxW `0' RS232TxW RS232CR ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | MOVLW MOVWF BufferF FSR SWAPF CALL MOVF CALL DECF BTFSC GOTO CALL INDF,W RS232TxDigit INDF,W RS232TxDigit FSR,f FSR,4 TxLoop1 RS232CR ; ; ; ; ; ; ; ; ; ; ; Transmit tag ID | | | | | | | | | | GOTO BigLoop1 ; goto BigLoop1 TxLoop1 end DS51138B-page 76 1998 Microchip Technology Inc. M 1.0 microIDTM 125 kHz DESIGN GUIDE ASK Reader Reference Design INTRODUCTION 2.0 This application note is written as a reference guide for ASK reader designers. Microchip Technology Inc. provides basic reader electronics circuitry for the MCRF200 customers as a part of this design guide. The circuit is designed for a read range of 3 ~ 5 inches with an access control card. The microID ASK Reader (demo unit), which is built based on the ASK reference design, is available in the microID Designers Kit (DV103001). The circuit can be modified for longer read range or other applications with the MCRF200. An electronic copy of the ASK microID PICmicro(R) source code is available upon request. FIGURE 2-1: READER CIRCUITS The RFID reader consists of transmitting and receiving sections. It transmits a carrier signal, receives the backscattering signal, and performs data processing. The reader also communicates with an external host computer. A basic block diagram of the typical ASK RFID reader is shown in Figure 2-1. BLOCK DIAGRAM OF TYPICAL RFID READER FOR ASK SIGNAL (125 kHz) Transmitting Section Time Base Signal Generator (4 MHz Crystal Oscillator) Carrier Signal Amplifier (Power Driver) / 32 Antenna Coil 125 kHz CLK Microcontroller Data Decoding Interface with Host Computer Serial Interface (RS-232) Filter, Amplifier, and Pulse Shaping Envelope Detector Receiving Section To Host Computer PICmicro is a registered trademark of Microchip Technology Inc. 1998 Microchip Technology Inc. DS51166C-page 77 microIDTM 125 kHz Design Guide 2.1 Transmitting Section The transmitting section contains circuitry for a carrier signal (125 kHz), power amplifiers, and a tuned antenna coil. The 125 kHz carrier signal is typically generated by dividing a 4 MHz (4 MHz/32 = 125 kHz) crystal oscillator signal. The signal is amplified before it is fed into the antenna tuning circuit. A complementary power amplifier circuit is typically used to boost the ransmitting signal level. An antenna impedance tuning circuit consisting of capacitors is used to maximize the signal level at the carrier frequency. The tuning compensates the variations in the component values and the perturbation of coil inductance due to environment effect. A design guide for the antenna coil is given in AN678, RFID Coil Design. 2.1.1 LIMITS ON TRANSMITTING SIGNAL LEVEL (FCC PART 15) IN THE USA Each country limits the signal strength of the RF wave that is intentionally radiated by a device. In the USA, the signal strength of the carrier signal (125 kHz) radiating from the antenna coil must comply with the FCC (Federal Communications Commission) part 15 regulation. The signal level is specified by the 47 CFR Part 15.209a of the federal regulation. For a 125 kHz signal, the FCC limits the signal level to 19.2 v per meter, or 25.66 dBV (i.e., 20 log(19.2) = 25.66 dBV), at 300 meters away from the antenna. For a close distance measurement, an extrapolation rule (40 dB per decade) is applied (Part 15.31.f.2). For example, the signal level at 30 meters away from the device must not exceed: 25.66 dBV + 40 dBV = 65.66 dBV DS51166C-page 78 2.2 Receiving Section The receiving section consists of an antenna coil, demodulator, filters, amplifiers, and microcontroller. In applications for close proximity read range, a single coil is often used for both transmitting and receiving. For long read-range applications, however, separated antennas may be used. More details on the antenna coil are given in AN678, RFID Coil Design page 25. In the ASK communication protocol, a `0' and a `1' are represented by an amplitude status of receiving signal. Various data coding waveforms that are available by MCRF200 are shown in Figure 1 in AN680 Passive RFID Basics, page 1. The demodulation of the ASK signal is accomplished by detecting the envelope of the carrier signal. A halfwave capacitor-filtered rectifier circuit is used for the demodulation process. The peak voltage of the back-scattering signal is detected by a diode, and this voltage is then fed into an RC charging/discharging circuit. The RC time constant must be small enough to allow the voltage across C to fall fast enough to keep in step with the envelope. However, the time constant must not be so small as to introduce excessive ripple. The charging capacitor and load R has the following relationship for a full recovery of the data signal. 1 1 ----------- > R > ----------o C oC where s and o are the angular frequencies of the modulation (data) and carrier (125 kHz), respectively. R is the load (discharging) resistor. The demodulated signal must then pass through a filter and signal shaping circuit before it is fed to the microcontroller. The microcontroller performs data decoding and communicates with the host computer through an RS-232 or other serial interface protocols. 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 3.0 microID ASK READER The electronic circuitry for an ASK reader is shown in Section 4.0. The reader needs +9 VDC power supply. The 125 kHz carrier signal is generated by dividing the 4 MHz time base signal that is generated by a crystal oscillator. A 16-stage binary ripple counter (74HC4060) is used for this purpose. The 74HC4060 also provides a clock signal for the PIC16C84 microcontroller. The 125 kHz signal is passed to an RF choke (L1) and filter before it is fed into a power amplifier that is formed by a pair of complementary bipolar transistors (Q2 and Q3). For long read-range applications, this power amplifier circuit can be modified. Power MOSFETs may be used instead of the bipolar transistors (2N2222). These power MOSFETs can be driven by +24 VDC power supply. A push-pull predriver can be added at the front of the complementary circuit. This modification will enhance the signal level of the carrier signal and the read range of the ASK Reader. The reader circuit uses a single coil for both transmitting and receiving signals. An antenna coil (L2: 1.62 mH) and a resonant capacitor (C14: 1000 pF) forms a series resonant circuit for a 125 kHz resonance frequency. Since the C14 is grounded, the carrier signal (125 kHz) is filtered out to ground after passing the antenna coil. The circuit provides a minimum impedance at the resonance frequency. This results in maximizing the antenna current, and therefore, the magnetic field strength is maximized. L2, C14, D7, C15, R24, and the other components in the bottom part of the circuit form a signal receiving section. D9 is a demodulator which detects the envelope of the backscattering signal. D9 and C15 form a half-wave capacitor-filtered rectifier. The detected envelope signal is charged into C15. R24 provides a discharge path for the voltage charged in C15. This voltage passes active filters (U5:B and C) and the pulse shaping circuitry (U5:A) before it is fed into the PIC16C84 for data processing. The PIC16C84 microcontroller performs data decoding and communicates with the host computer via an RS-232 serial interface. 1998 Microchip Technology Inc. DS51166C-page 79 microIDTM 125 kHz Design Guide 4.0 ASK READER SCHEMATIC DS51166C-page 80 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 5.0 ASK READER BILL OF MATERIALS Quantity: Part Number Part Description Reference Design 1 02-01518-D PCB ASSEMBLY DWG, microID ASK READER 1 03-01518 SCHEMATIC, microID ASK READER 1 04-01518 PCB FAB, microID ASK READER 1 08-00161 LABEL, microID ASK READER,U3,CHKS:C1AAh, v1.0, ASK1.HEX @U3 1 110-93-318-41-001 SOCKET, 18P OPEN FRAME COLLET (0.300) xU3 1 DE9S-FRS CONN, D-SUB 9P RECPT RT ANGLE P2 1 DJ005B JACK, POWER, 2.5 mm DC PC MOUNT SP1 1 PKM22EPP-4001 BUZZER, PIEZO, 4 kHz, 3-20V 2 D470J25COGHAAAC CAP, 47PF 100V D220J20COGHAAAC CAP, 22 pF CER CERAMIC DISC C0G C10,C11 2 DISK RAD COG 100V 1 ECU-S1H221JCA CAP, 220pF, CER MONO, RAD, 50V, 5% C15 1 ECQ-P1102JZ CAP, 0.001uF POLYPROPYLENE 100V C17 3 ECQ-P6102JU CAP, 0.001uF POLYPROPYLENE 630V C13, C14, C16 1 ECU-S2A182JCB CAP, 1800pF MONOLITH CERM, 5%, RAD, 100V 1 ECQ-V1103JM CAP, 0.01uF 100V STACK METAL FILM C9 2 ECQ-E1104KF CAP, 0.1UF 100VDC 10% RAD METAL POLY CAP C7, C8 3 ECE-A16Z10 CAP, 10uF, ELECTRO, RAD, 16V, 20% C3, C5, C12 1 ECE-A25Z100 CAP, 100uF, ELECTRO, RAD, 25V, 20% C4 8 1N4148 DIODE, GENERAL PURPOSE, 1N4148 (DO-35) D1-D8 1 1N4936 DIODE, 1A 400V FAST-RECOVERY RECTIFIER D9 1 -SPARE- -SPARE- LOCATION DO NOT INSTALL LED1, 1 78F102J INDUCTOR, 1000uH, COATED 1 MCT0003-001 INDUCTOR, 1.62 H, L2 3 2N2907A-TO18 TRANSISTOR, 2N2907A PNP, GEN PURPOUS TO-18 Q1, Q3, Q4 1 2N2222A-TO18 TRANSISTOR, 2N2222A NPN, GEN PURPOUS TO-18 Q2 2 5043CX10R0J RES, CF 10 OHM 1/4W 5% R10,R8 1 82E CR-1/4W-B 5% RES, CF 82 OHM 1/4W 5% R9 1 5043CX100R0J RES, CF 100 OHM 1/4W 5% R15 1 5043CX1K000J RES, CF 1K 1/4W 5% R6 3 5043CX330R0J RES, CF 330 OHM 1/4W 5% R1, R12, R14 1 5043CX470R0J RES, CF 470 OHM 5% 1/4W R4 1 1K8 CR-1/4W-B 5% RES, CF 1.8K OHM 1/4W 5% R7 BZ1 C1, C2 C6 L1 1 390K CR-1/4W-T 5% RES, CF 390K-OHM,5%,1/4W R24 1 220K CR-1/4W-T 5% RES, CF 220K OHM 1/4W 5% R21 1 8K2 CR-1/4W-T 5% RES, 8.2K OHM 1/4W 5% CF R20 3 10K CR-1/4W-B 5% RES, CF 10K OHM 1/4W 5% R2, R23, R25 1998 Microchip Technology Inc. DS51166C-page 81 microIDTM 125 kHz Design Guide Quantity: Part Number 1 5043CX47K00J 1 3 Part Description Reference Design RES, CF 47K 5% 1/4W R18 12K CR-1/4W-B 5% RES, CF 12K OHM 1/4W 5% R16 22K CR-1/4W-B 5% RES, CF 22K OHM 1/4W 5% R5, R11, R19 2 5043CX100K0J RES, CF 100K 5% 1/4W R13,R26 3 1M0 CR-1/4W-B 5% RES, CF 1.0M OHM 1/4W 5% R3, R17, R22 1 LM78L05ACZ IC, REG, +5V 0.1A TO-92 U1 1 MM74HC04N IC, HEX INVERTER 14P DIP U2 1 PIC16F84-10/P IC, PIC16F84 PLASTIC, 18P DIP U3 1 MM74HC4060N IC, 14 STAGE BINARY COUNTER, 16P DIP U4 1 TL084CN IC, QUAD OP AMP, 14P DIP 1 EFO-EC4004A4 RESONATOR, 4.00MHZ CERAMIC W/CAP Y1 2 JS-01 SCREW, JACKSCREW, #4-40x0.416" P2 DS51166C-page 82 U5 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide ASK READER SOURCE CODE FOR THE PICmicro(R) MCU 6.0 The following source code is for the PIC16C84 microcontroller used in the ASK reader electronics. ; #=#=#=#=#=#=#=#=#=#=#= PROJECT Microchip ASK Reader =#=#=#=#=#=#=#=#=#=#=# ; v002.asm ; PIC16C84 running at 4MHz, Ti=1us ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; /////////////////////////////////////////////////////////////////////////// Revision history /////////////////////////////////////////////////////////////////////////// Ver Date Comment 0.01 0.02 01 Jul 98 29 Jul 98 Copied from MCHIP\READER\FSK MICROCHIP TAG HAS 128 BITS Tbit=64Tcy=512Ti Manchester encoded Microchip - Header=h'802A' Ttag=128Tbit - OR EM ASK - Header=b'111111111' trailer=b'0' Ttag=64Tbit processor pic16c84 #include "p16c84.inc" __config b'11111111101001' ; Code Protect on, power-up timer on, WDT off, XT oscillator #define bit_CARRY #define bit_ZERO #define bit_RP0 #define _BUZZ1 #define _BUZZ2 #define _RS232TX #define _RS232RX #define _T0CKI StartPORTA = StartTRISA = BeepPort = Beep0 = Beep1 = Beep2 = STATUS,0 STATUS,2 STATUS,5 PORTA,0 PORTA,1 PORTA,2 PORTA,3 PORTA,4 b'01100' b'11000' PORTA StartPORTA StartPORTA | b'00001' StartPORTA | b'00010' #define _DATA_IN PORTB,0 #define _UNUSED1 PORTB,1 #define _LED2 PORTB,2 #define _LED1 PORTB,3 #define _UNUSED2 PORTB,4 #define _UNUSED3 PORTB,5 #define _UNUSED4 PORTB,6 #define _UNUSED5 PORTB,7 StartPORTB = b'00000000' StartTRISB = b'00000001' StartOPTION = b'10001111' BO3 DelayReg1 Mask BitCtr BeepCtrHi TxByte BeepCtrLo ParityReg1 = = = = = = = = ; TMR0 internal, prescaler off ; PORTB pullups off h'0C' h'0C' h'0C' h'0D' h'0D' h'0E' h'0E' h'0E' 1998 Microchip Technology Inc. DS51166C-page 83 microIDTM 125 kHz Design Guide Period ParityReg2 = h'0F' = h'0F' Buffer0 Buffer1 Buffer2 Buffer3 Buffer4 Buffer5 Buffer6 Buffer7 Buffer8 Buffer9 BufferA BufferB BufferC BufferD BufferE BufferF Old0 Old1 Old2 Old3 Old4 Old5 Old6 Old7 Old8 Old9 OldA OldB OldC OldD OldE OldF = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = SKIP macro BTFSC endm PCLATH,7 h'10' h'11' h'12' h'13' h'14' h'15' h'16' h'17' h'18' h'19' h'1A' h'1B' h'1C' h'1D' h'1E' h'1F' h'20' h'21' h'22' h'23' h'24' h'25' h'26' h'27' h'28' h'29' h'2A' h'2B' h'2C' h'2D' h'2E' h'2F' ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; --- IMMOBILE --- IMMOBILE --- IMMOBILE --- IMMOBILE | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | org h'0000' CLRF PCLATH CLRF INTCON CLRF STATUS GOTO RESET_A ; *#*#*#* RESET VECTOR *#*#*#* org h'0004' CLRF PCLATH CLRF INTCON CLRF STATUS GOTO RESET_A ; *#*#*#* INTERRUPT VECTOR *#*#*#* ; ***** Subroutines, Page 0 Delay07: RETLW 0 ;[0] ; | ;[0] ; | ;[0] ; | ;[0] ; | MOVLW GOTO d'13' RS232TxW ;[1] Transmit CR on RS232 ; | ; | NOP Delay06: NOP Delay05: NOP Delay04: RS232CR: DS51166C-page 84 Delay 7Ti Delay 6Ti Delay 5Ti Delay 4Ti 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide RS232TxDigit: ANDLW MOVWF MOVLW SUBWF BTFSS GOTO DigitGE10: MOVLW ADDWF DigitLT10: MOVLW ADDWF RS232TxW: MOVWF RS232Tx: BSF MOVLW MOVLW RS232TxD1: DECFSZ GOTO BCF NOP MOVLW MOVWF RS232TxD2: DECFSZ GOTO CLRF BSF RS232TxL1: BTFSC GOTO NOP RS232TxBit0: BCF BCF GOTO RS232TxBit1: BSF BSF GOTO RS232TxBitDone: RRF MOVLW MOVWF GOTO RS232TxD3: DECFSZ GOTO DECFSZ GOTO CALL BSF RETLW ParityCheck: CLRF MOVLW MOVWF ParityL1: CLRF MOVLW MOVWF ParityL2: h'0F' TxByte h'0A' TxByte,W bit_CARRY DigitLT10 `A'-'0'-h'0A' TxByte,f `0' TxByte,W TxByte _RS232TX d'35' DelayReg1 DelayReg1,f RS232TxD1 _RS232TX d'32' DelayReg1 DelayReg1,f RS232TxD2 BitCtr BitCtr,3 TxByte,0 RS232TxBit1 _RS232TX bit_CARRY RS232TxBitDone _RS232TX bit_CARRY RS232TxBitDone TxByte,f d'30' DelayReg1 RS232TxD3 DelayReg1,f RS232TxD3 BitCtr,f RS232TxL1 Delay04 _RS232TX 0 ParityReg1 d'10' BitCtr ParityReg2 h'10' Mask 1998 Microchip Technology Inc. ;[1] Transmit LSnybble of W on RS232 ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ; | ;[1] Transmit W on RS232 at 9615 baud ; | TxByte=W ;[1] Transmit TxByte - 104us = 9615.4 baud ; | Stop bit ; | | ; | | ; | | ; | | ; | | ; | Start bit ; | | ; | | ; | | ; | | ; | | ; | | ; | BitCtr=#8 ; | | ; | {% -4Ti ; | Transmit TxByte.0, RR TxByte ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | | ; | |% 4Ti ; | delay 1 bit ; | | ; | | ; | | ; | | ; | | ; | DEC BitCtr ; | } until (BitCtr==#0) ; | delay ; | stop bit ; end ;[0] Check parity ; | ParityReg1=0 ; | BitCtr=10 ; | | ; | { ; | ParityReg2=0 ; | Mask=h'10' ; | | ; | { DS51166C-page 85 microIDTM 125 kHz Design Guide BCF RLF RLF RLF RLF RLF RLF RLF RLF BTFSC INCF MOVF BTFSC XORWF BCF RRF BTFSS GOTO BTFSC GOTO DECFSZ GOTO MOVLW MOVWF ParityL3: BCF RLF RLF RLF RLF RLF RLF RLF RLF MOVF BTFSC XORWF BCF RRF BTFSS GOTO MOVF ANDLW BTFSS GOTO ParityGood: MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF BCF RETLW ParityBad: MOVF DS51166C-page 86 bit_CARRY Buffer0,f Buffer1,f Buffer2,f Buffer3,f Buffer4,f Buffer5,f Buffer6,f Buffer7,f Buffer6,7 ParityReg2,f Mask,W Buffer6,7 ParityReg1,f bit_CARRY Mask,f bit_CARRY ParityL2 ParityReg2,0 ParityBad BitCtr,f ParityL1 h'10' Mask bit_CARRY Buffer0,f Buffer1,f Buffer2,f Buffer3,f Buffer4,f Buffer5,f Buffer6,f Buffer7,f Mask,W Buffer6,7 ParityReg1,f bit_CARRY Mask,f Mask,0 ParityL3 ParityReg1,W h'1E' bit_ZERO ParityBad BufferF,W Buffer7 BufferE,W Buffer6 BufferD,W Buffer5 BufferC,W Buffer4 BufferB,W Buffer3 BufferA,W Buffer2 Buffer9,W Buffer1 Buffer8,W Buffer0 bit_CARRY 0 BufferF,W ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LSL Buffer0-7 | | | | | | | | if (Buffer6.7==1) { INC ParityReg2 } W=Mask if (Buffer6.7==1) { ParityReg1=ParityReg1 XOR W } LSR Mask | } until (bit_CARRY==1) | if (ParityReg2.0==1) { goto ParityBad } DEC BitCtr } until (BitCtr==0) Mask=h'10' | { LSL Buffer0-7 | | | | | | | | W=Mask if (Buffer6.7==1) { ParityReg1=ParityReg1 XOR W } LSR Mask | } until (Mask.0==1) | if ((ParityReg1 AND h'1E')!=0) | | { goto ParityBad } Buffer0-7=Buffer8-F | | | | | | | | | | | | | | | bit_CARRY=0 Buffer0-7=Buffer8-F 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF MOVF MOVWF BSF RETLW Buffer7 BufferE,W Buffer6 BufferD,W Buffer5 BufferC,W Buffer4 BufferB,W Buffer3 BufferA,W Buffer2 Buffer9,W Buffer1 Buffer8,W Buffer0 bit_CARRY 0 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bit_CARRY=1 ; ***** End of subroutines, Page 0 RESET_A: CLRWDT CLRF CLRF MOVLW MOVWF MOVLW MOVWF BSF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF BCF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF BigLoop1: BSF CALL BCF MOVLW CALL MOVLW MOVWF STATUS FSR StartPORTA PORTA StartPORTB PORTB bit_RP0 StartTRISA TRISA StartTRISB TRISB StartOPTION OPTION_REG bit_RP0 Old0 Old1 Old2 Old3 Old4 Old5 Old6 Old7 ; Initialise registers ; | Access register page 0 ; | FSR=#0 ; | Initialise PORT and TRIS registers ; | | ; | | ; | | ;^| | ;^| | ;^| | ;^| | ;^| | ;^| Initialise OPTION register ;^| | ; | | ; | Clear Old buffer ; | | ; | | ; | | ; | | ; | | ; | | ; | | _LED1 Delay07 _LED2 h'09' RS232TxW d'128' BitCtr ; ; ; ; ; ; ; LEDs "reading" | | Transmit TAB regularly | set BitCtr | ; ; ; ; ; ; ; ; ; ; ; Get an edge on _DATA_IN | | | |% 3 from low sample | | | | Period=0 | { % 7+Period*8 from low sample | INC Period GetEdge: BTFSC GOTO NOP PreSync_L0: NOP BTFSC GOTO CLRF PreSync_L1: INCF _DATA_IN PreSync_H0 _DATA_IN PreSync_H0 Period Period,f 1998 Microchip Technology Inc. DS51166C-page 87 microIDTM 125 kHz Design Guide BTFSC BTFSS SKIP GOTO BTFSS GOTO Period,6 Period,4 MOVLW SUBWF BTFSC GOTO d'48' Period,W bit_CARRY Sync_Done CALL DoSync_H: MOVLW MOVWF CALL GOTO DoSync_HL: INCF BTFSC BTFSS SKIP GOTO BTFSC GOTO BigLoop1 _DATA_IN PreSync_L1 Delay05 d'2' Period Delay04 DoSync_HL Period,f Period,6 Period,4 BigLoop1 _DATA_IN DoSync_HL MOVLW SUBWF BTFSS GOTO d'16' Period,W bit_CARRY BigLoop1 MOVLW SUBWF BTFSS GOTO GOTO d'48' Period,W bit_CARRY DoSync_L Sync_Done PreSync_H0: NOP BTFSS GOTO CLRF PreSync_H1: INCF BTFSC BTFSS SKIP GOTO BTFSC GOTO MOVLW SUBWF BTFSC GOTO CALL DoSync_L: MOVLW MOVWF CALL GOTO DS51166C-page 88 _DATA_IN PreSync_L0 Period Period,f Period,6 Period,4 BigLoop1 _DATA_IN PreSync_H1 d'48' Period,W bit_CARRY Sync_Done Delay05 d'2' Period Delay04 DoSync_LL ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | if ((Period*8Ti)>=Tbit*1.25=512Ti*1.25=640Ti) | | | | | { goto BigLoop1 } | } until (_DATA_IN==1) | | |% 6+Period*8 from low sample |% 6 from rise | if ((Period*8)>=Tbit*0.75=512Ti*0.75=384Ti) | | | | | { goto Sync_Done } |% 10 from rise | delay |% 15 from rise | Period=2 | | | delay | | | {% 7+Period*8 from rise | INC Period | if ((Period*8Ti)>=Tbit*1.25=512Ti*1.25=640Ti) | | | | | { goto BigLoop1 } | } until (_DATA_IN==0) | | |% 6+Period*8 from rise |% 6 from fall | if ((Period*8Ti)=Tbit*1.25=512Ti*1.25=640Ti) | | | | | { goto BigLoop1 } | } until (_DATA_IN==0) | | |% 6+Period*8 from high sample |% 6 from fall | if ((Period*8Ti)>=Tbit*0.75=512Ti*0.75=384Ti) | | | | | { goto Sync_Done } |% 10 from fall | delay |% 15 from fall | Period=2 | | | delay | | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide DoSync_LL: INCF BTFSC BTFSS SKIP GOTO BTFSS GOTO Period,f Period,6 Period,4 BigLoop1 _DATA_IN DoSync_LL MOVLW SUBWF BTFSS GOTO d'16' Period,W bit_CARRY BigLoop1 MOVLW SUBWF BTFSS GOTO GOTO d'48' Period,W bit_CARRY DoSync_H Sync_Done Sync_Done: MOVLW MOVWF NOP ReadBit: ReadBitD1: DECFSZ GOTO CLRF BTFSC INCF BTFSC INCF BTFSC INCF BCF BTFSC BSF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF MOVLW MOVWF NOP ReadBitD2: DECFSZ GOTO CLRF BTFSC d'121' DelayReg1 DelayReg1,f ReadBitD1 BO3 _DATA_IN BO3,f _DATA_IN BO3,f _DATA_IN BO3,f bit_CARRY BO3,1 bit_CARRY Buffer0,f Buffer1,f Buffer2,f Buffer3,f Buffer4,f Buffer5,f Buffer6,f Buffer7,f Buffer8,f Buffer9,f BufferA,f BufferB,f BufferC,f BufferD,f BufferE,f BufferF,f d'76' DelayReg1 DelayReg1,f ReadBitD2 BO3 _DATA_IN 1998 Microchip Technology Inc. ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; | {% 7+Period*8 from fall | INC Period | if ((Period*8Ti)>=Tbit*1.25=512Ti*1.25=640Ti) | | | | | { goto BigLoop1 } | } until (_DATA_IN==1) | | |% 6+Period*8 from fall |% 6 from rise | if ((Period*8Ti)=#22) | { goto Gap0 } // after 1st half of bit % -1Ti from first bit Delay 1568Ti | |% 1567Ti from first bit DS51167B-page 111 microIDTM 125 kHz Design Guide CheckTtag: MOVLW MOVWF MOVLW MOVWF CheckTTagLoop: BTFSS GOTO MOVF MOVWF MOVLW ADDWF MOVF XORWF BTFSS GOTO MOVLW ADDWF DECFSZ GOTO HeadSearch: MOVLW MOVWF HeadSearchL1: BTFSS GOTO BSF MOVF XORLW BTFSS BCF MOVF XORLW BTFSS BCF BTFSC GOTO RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF RLF BCF BTFSC BSF DECFSZ GOTO GOTO HeadFound: HeadDelay: BTFSS GOTO CALL CALL CALL CALL DS51167B-page 112 Buffer00 FSR h'0C' Counter1 _COLLISION Gap1 INDF,W Counter2 h'0C' FSR,f INDF,W Counter2,W _ZERO Gap2 low(0-h'0C'+1) FSR,f Counter1,f CheckTTagLoop d'96' BitCtr _COLLISION Gap1 _GotHeader Buffer0B,W h'80' _ZERO _GotHeader Buffer0A,W h'2A' _ZERO _GotHeader _GotHeader HeadFound Buffer00,f Buffer01,f Buffer02,f Buffer03,f Buffer04,f Buffer05,f Buffer06,f Buffer07,f Buffer08,f Buffer09,f Buffer0A,f Buffer0B,f Buffer00,0 _CARRY Buffer00,0 BitCtr,f HeadSearchL1 Gap2 _COLLISION Gap1 Delay08 Delay08 Delay06 Delay04 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; if (tag is not 96 bits long) { goto Gap2 } | FSR=#Buffer00 | | | Counter1=h'0C' | | | {% 1571+(12-Counter1)*15Ti from first bit | if (collision occurred) | { goto Gap1 } // never happens during first bit | Counter2=INDF | | | FSR=FSR+h'0C' | | | if (Couter2!=INDF) | | | | | { goto Gap2 } // never happens during first bit | FSR=FSR-h'0C'+1 | | | DEC Counter1 | } until (Counter1==#0) % 1570+12*15Ti = 1752Ti from first bit if (no header in Buffer) { goto Gap2 } | set BitCtr | | | {% 1752+(96-BitCtr)*31 Ti from first bit | if (collision occurred) | { goto Gap1 } // never happens during 1st bit | if (header found) { goto HeadFound } | | | | | | | | | | | | | | | | | | | | | ROL Buffer | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DEC BitCtr | } until (BitCtr==#0) |% 1751+96*31 Ti = 4727Ti from first bit | goto Gap2 // never happens during first bit % 1766+(96-BitCtr)*29 Ti from first bit Delay to fixed time | {% 1766+(96-BitCtr)*31 Ti from first bit | if (collision occurred) | { goto Gap1 } // never happens during 1st bit | Delay 26Ti | | | | | | 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide DECFSZ GOTO BitCtr,f HeadDelay ; ; ; BTFSS GOTO _COLLISION Gap1 ; ; BSF CALL BCF SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL SWAPF CALL MOVF CALL ;% 30145Ti from | DEC BitCtr | } until (BitCtr==#0) % 1765+96*31 = 4741Ti from first bit if (collision occurred) { goto Gap1 } // never happens during 1st bit ; % 4743Ti from first bit _LED2 Delay08 _LED1 ; ; ; ; LEDs "Found tag" | | % 4753Ti from first bit Buffer0B,W RS232TxDigit Buffer0B,W RS232TxDigit Buffer0A,W RS232TxDigit Buffer0A,W RS232TxDigit Buffer09,W RS232TxDigit Buffer09,W RS232TxDigit Buffer08,W RS232TxDigit Buffer08,W RS232TxDigit Buffer07,W RS232TxDigit Buffer07,W RS232TxDigit Buffer06,W RS232TxDigit Buffer06,W RS232TxDigit Buffer05,W RS232TxDigit Buffer05,W RS232TxDigit Buffer04,W RS232TxDigit Buffer04,W RS232TxDigit Buffer03,W RS232TxDigit Buffer03,W RS232TxDigit Buffer02,W RS232TxDigit Buffer02,W RS232TxDigit Buffer01,W RS232TxDigit Buffer01,W RS232TxDigit Buffer00,W RS232TxDigit Buffer00,W RS232TxDigit first bit ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; CALL RS232CR ;% 31197Ti from first bit 1998 Microchip Technology Inc. Transmit |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL | |%% CALL tag ID RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti RS232TxDigit takes 1057Ti ;%% CALL RS232CR takes 1052Ti DS51167B-page 113 microIDTM 125 kHz Design Guide MOVLW MOVWF WaitingL1: CLRWDT CALL CALL CALL DECFSZ GOTO d'255' DelayReg1 Delay10 Delay10 Delay05 DelayReg1,f WaitingL1 ;% 38593Ti from first bit ;% 38400+193 = 193Ti from first INCFSZ GapCountLo,f SKIP INCF GapCountHi,f BTFSC GapCountHi,0 BTFSS GapCountLo,1 GOTO GapLoop GOTO BigLoop1 ; ; ; ; ; ; ; ; ; Delay 7396Ti | | | | | | | | bit, -7Ti from gap ; INC GapCount ; | ; | ; } until (GapCount>#257) ; | ; | Gap1: ; !!!!! goto here after collision ; CLRF CLRF GOTO % -4Ti from gap GapCountHi GapCountLo GapLoop GapX: GapXDelay: BTFSC GOTO INCF NOP GOTO GapXDelayJ1: GOTO GapXDelayDone: ;% 76+(Counter1*8)Ti from bit ; Delay 3+(128-Counter1)*8Ti Counter1,7 ; | GapXDelayDone ; | Counter1,f ; | ; | GapXDelayJ1 ; | ; | GapXDelay ; | ; | ;% 76+(oldCounter1)*8+3+128*8-(oldCounter1)*8Ti from bit ;% 1103Ti from bit = (400*2)+303Ti from bit ;// Not in first half of bit Gap0: ; !!!!! goto here for gap which does NOT occur in first half of first bit ; % -7Ti from gap INCFSZ GapCountLo,f ; INC GapCount SKIP ; | INCF GapCountHi,f ; | BTFSC BTFSS GOTO GOTO GapCountHi,0 GapCountLo,1 GapLoop BigLoop1 ; } until (GapCount>#257) ; | ; | Gap2: ; !!!!! goto here for valid INCFSZ GapCountLo,f ; SKIP ; INCF GapCountHi,f ; BTFSC GapCountHi,0 ; BTFSS GapCountLo,1 ; GOTO GapLoop ; GOTO BigLoop1 FSK but invalid code INC GapCount | | } until (GapCount>#257) | | org h'0200' P1Delay20: GOTO P1Delay18 P1Delay18: NOP DS51167B-page 114 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide P1Delay17: NOP P1Delay16: GOTO P1Delay14: NOP P1Delay13: NOP P1Delay12: GOTO P1Delay10: GOTO P1Delay08: GOTO P1Delay06: GOTO P1Delay04: RETLW P1Delay14 P1Delay10 P1Delay08 P1Delay06 P1Delay04 0 BigDelay: ;!!!!! delay (1568-6)Ti = 1562Ti MOVLW MOVWF BigDelayL1: CALL CALL CALL CALL CALL DECFSZ GOTO CALL CALL CALL NOP BCF GOTO P1DelayTtag: CLRF P1DelayTtagL1: CALL CALL CALL CALL CALL CALL CALL CALL DECFSZ GOTO MOVLW MOVLW P1DelayTtagL2: CALL DECFSZ GOTO NOP BCF RETLW ResetDelay: CALL d'15' DelayReg1 P1Delay20 P1Delay20 P1Delay20 P1Delay20 P1Delay17 DelayReg1,f BigDelayL1 P1Delay20 P1Delay20 P1Delay20 ; ; ; ; ; ; ; ; ; ; ; ; ; ; Delay 1501Ti | | | | | | | | | Delay 61Ti | | | _PAGE0 BigDelayDone DelayReg1 P1Delay20 P1Delay20 P1Delay20 P1Delay20 P1Delay20 P1Delay20 P1Delay20 P1Delay06 DelayReg1,f P1DelayTtagL1 d'19' DelayReg1 P1Delay10 DelayReg1,f P1DelayTtagL2 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Delay 38393Ti | Delay 38144Ti | | | | | | | | | | | | | | | | | | | | | | | Delay 248Ti | | | | | | | | | | | Delay 1Ti _PAGE0 0 RS232CR 1998 Microchip Technology Inc. ; Transmit CR regularly DS51167B-page 115 microIDTM 125 kHz Design Guide MOVLW MOVWF MOVLW MOVWF BeepLoopJ1: GOTO BeepLoopJ2: MOVLW MOVWF MOVLW MOVWF BeepD1: CLRWDT DECFSZ GOTO MOVLW MOVWF MOVLW MOVWF NOP GOTO BeepD2: CLRWDT DECFSZ GOTO DECFSZ GOTO DECFSZ GOTO NOP MOVLW MOVWF d'4' BeepCtrHi d'0' BeepCtrLo MOVLW MOVWF ResetGapL1: MOVLW MOVWF ResetGapL2: CLRWDT DECFSZ GOTO DECFSZ GOTO BSF d'20' Counter1 Coil_On MOVLW MOVWF ResetDelayL1: MOVLW MOVWF ResetDelayL2: CLRWDT DECFSZ GOTO DECFSZ GOTO BCF GOTO BeepLoopJ2 Beep1 BeepPort d'34' DelayReg1 DelayReg1,f BeepD1 Beep2 BeepPort d'32' DelayReg1 BeepD2 DelayReg1,f BeepD2 BeepCtrLo,f BeepLoopJ1 BeepCtrHi,f BeepLoopJ2 Beep0 BeepPort d'124' DelayReg1 DelayReg1,f ResetGapL2 Counter1,f ResetGapL1 _FirstTime d'6' Counter1 d'250' DelayReg1 DelayReg1,f ResetDelayL2 Counter1,f ResetDelayL1 _PAGE0 ResetDelayDone ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Beep at 3597Hz for 1024 cycles | | |% 27277Ti from first bit | | | | | | Delay 137Ti | | | | | | | | | | | | | Delay 132Ti | | | | | | | | | | | | | | | | | | | | | ; ; ; ; ; ; ; ; ; ; ; Wait ~10ms (reset gap) | | | Wait ~500us | | | | | | | | | | | | ; ; ; ; ; ; ; ; ; ; ; ; Turn coil on Wait ~6ms | | | | | | | | | | end DS51167B-page 116 1998 Microchip Technology Inc. M microIDTM 125 kHz DESIGN GUIDE Using the microIDTM Programmer 1.0 INTRODUCTION The following is a description of how to program Microchip's MCRF2XX family of RFID products. A contactless programmer (PG103001), user interface software (RFLABTM), and a host computer are needed to program the MCRF2XX devices. The device can also be programmed in a standard terminal mode (i.e., c:\windows\terminal.exe) rather than the RFLAB. See Figure 5-1 for the programming sequence. The microID programmer requires an external power supply (+9 VDC, >750 mA). The RFLAB software runs under Microsoft(R) (MS) Windows(R) 95 environment only. The programmer communicates with a host computer via an RS-232 serial interface at 9600 baud, 8 data bits, 1 stop bit, and no parity. Since the MCRF2XX is a One-Time-Programmable (OTP) device, only a blank (unlocked) device can be programmed by the programmer. Therefore, the programmer first checks the status of the memory in the device before initiating programming. A blank device contains an array of all `1's. FIGURE 1-1: The device can be programmed with 16 bytes (128 bits) or 12 bytes (96 bits) of data length. Once the MCRF2XX enters its programming mode, it sets a lock bit at the same time. If the programming is interrupted for any reason during the programming period, the programming will be stopped, and the device may be left partially programmed. The device will still be locked even though it has not been programmed completely. In this case, the programmer will return a fail code to the host computer. Any device that has been programmed, either fully or partially, will remain in a locked status; therefore, it cannot to be reprogrammed. If programming has been successfully completed, the programmer will return a verification code to the host computer. In order to program the MCRF2XX device, it is necessary to provide a proper programming signal level to the device. The device requires specific peakto-peak voltages for programming. Since the voltage induced in the tag coil varies depending on the coil parameters, the output signal level of the programmer must be calibrated to provide a proper programming signal level at the tag coil. A detailed calibration procedure is described in Section 3.0. RFLAB SOFTWARE RUNNING UNDER MS WINDOWS 95 RFLAB is a trademark of Microchip Technology Inc. 1998 Microchip Technology Inc. DS51139A-page 117 microIDTM 125 kHz Design Guide 2.0 PROGRAMMING SIGNAL WAVEFORM Figure 2-1 shows the waveform of the programming signal. Once the programmer sends a power-up and gap signal to the device, the device transmits back a verification bitstream in FSK. The verification signal represents the contents of the memory in the device. The blank device has all `1's in its memory. A bit `1' in FSK is represented by a low signal level for five cycles and a high signal level for an additional five cycles (Figure 2-1). The device will respond with a nonmodulated (no data) signal if the device has not recognized the power-up signal. In this case, the power-up signal level should be calibrated to provide a proper signal level to the device. The calibration procedure is explained in Section 3.0. After the device is verified as blank, the programmer sends a programming signal to the device. The programming data is represented by an amplitude modulation signal. Therefore, bit `1' and `0' are represented by a low-power (level) signal and a high power (level) signal, respectively, as shown in Figure 2-1. Each data bit is represented by 128 cycles of the carrier signal. An MCRF200 configured for 128 bits uses all bits in the transfer; an MCRF200 configured for 96 bits ignores bits 33 through 64, although they are present in the programming sequence. Therefore, for a 125 kHz carrier signal, it takes 1.024 ms for one data bit (128 cycles x 8 s/cycles) and 131.072 ms for 128 data bits (128 cycles/bit x 8 s/cycle x 128 bits). A guard-band of t = 10 cycles (80 s) should be kept at each end of a high-power (0) bit as shown in Figure 2-1. This is to prevent accidental programming or disturbing of adjacent bits in the array. The memory array is locked at the start of the programming cycle. Therefore, when the device leaves the programming field, it locks the memory permanently, regardless of the programming status. The device should not be interrupted during the programming cycle. The device transmits the programmed (data contents) circuits back to the programmer for verification. If the verification bitstream is correct, the programmer sends a verified signal (`v') to the host computer; otherwise, it sends an error message (`n', see Figure 5-1). The programming signal level must be within a limit of the programming voltage window for successful programming. The calibration of the signal level is explained in Section 3.0. DS51139A-page 118 2.1 Power-up, Gap, and Verification Signals The programming signal starts with a power-up signal for 80 ~ 180 S, followed by a gap signal (0 volt) for 50 ~ 100 S. The purpose of these signals is to check whether the device is blank and establish a programming mode in the device. Once the device recognizes the power-up signal, it transmits back the contents of its memory. If the device transmits back with the blank bitstream (FSK with all `1's), it is ready to be programmed. If the device is not blank, the programmer informs the host computer that it is nonprogrammable. If the power-up signal level is out of the programming voltage range, the device will transmit back a non-modulated signal (no data). The nonmodulated signal has no variation in the amplitude (constant voltage signal). A variable resistor, R5 in the microID programmer, should be adjusted to provide a proper power-up signal level. A typical signal level is about 22 3 VPP across the tag coil. This calibration procedure is described in Section 3.0. 2.2 Programming Sequence Once the device has been verified blank for programming, the programmer sends a programming sequence to the device. The programming data entered in the RFLAB software is sent to the device via the programmer. The programming signal waveforms are shown in Figure 2-1. One bit of data is represented by 128 cycles of the carrier signal. It takes 131.072 ms to complete one programming cycle for the total of 128 data bits. An MCRF200 configured for 128 bits uses all bits in the transfer; an MCRF200 configured for 96 bits ignores bits 33 through 64, although they are present in the programming sequence. After the programming sequence, the device transmits back a verification bitstream. The programmer reports to the host computer the status of the programming. The data is programmed only if the programming signal level is within the limit in the programming voltage requirement of the device. It takes several programming/verify cycles to completely program each bit of the MCRF200. The microID programmer uses ten (10) blind program/verify cycles before checking the final verify sequence for correct programming. Faster programmers can be designed by checking each program/verify cycle; after approximately 3 ~ 5 cycles, the device will verify correctly. Once a correct verify sequence is received, one additional program cycle should be run to ensure proper programming margin. 1998 Microchip Technology Inc. FIGURE 2-1: POWER UP GAP VERIFY FSK Signal PROGRAM Bit 2 Low 80 - 180 s High Power Signal Power Signal Not Modulating ~ 50 - 100 s Bit 3... t t Modulating 22 3 VPP (R5) 22 3 VPP (R5) 128 bits x 128 cycles/bit x 8 s/cycle = 131.1 ms 0V 33 1VPP (R7) 22 3 VPP 128 bits DS51139A-page 119 1 bit = 128 cycles x 8 s/cycle = 1.024 ms t = Guard Band Default programming protocol = FSK, Fc/8/10, 128 bits For 96-bit programming, bits 33 - 64 are `don't care', but all 128-bit cycles must be in the sequence. Note: Low-power signal leaves bit = 1 High-power signal programs bit = 0 microIDTM 125 kHz Design Guide Bit 1 CONTACTLESS PROGRAMMING WAVEFORM 1998 Microchip Technology Inc. Contactless Programming Protocol f = 125 kHz t = 8 s microIDTM 125 kHz Design Guide 3.0 CALIBRATION OF PROGRAMMING VOLTAGE If you are using your own tag coil (with resonant capacitor) with the MCRF200 or MCRF250, you may need to calibrate the programmer for your circuit. Follow this procedure, if you are unable to program your tag. a) b) Open the programmer, and turn R5 and R6 full counter-clockwise. Remove the four screws at the back of the programmer. Set up the programmer and calibration tag as shown in Figure 3-1. Programming Signal Level: e) f) g) h) i) Set Up: * Connect the +9 VDC power supply to the programmer. * Connect the RS-232 cable from the external serial port in the programmer box to a COM port in the host. * Open up the RFLAB software on the host computer. * Place the calibration tag in the center of the tag area on the programmer. A calibration tag is any tag using MCRF200 or MCRF250 silicon and your own coil and capacitor. c) Run the programming software (RFLAB). If the programming has been unsuccessful due to insufficient programming signal levels, a message indicating Programming unsuccessful will appear in the RFLAB. See Figure 1-1. In this case, R7 ("High Power") must be adjusted to provide a proper programming signal level to the tag coil. Turn R7 clockwise in 1/16-inch increments, repeating steps (f) through (h) until programming is successful. Then turn R7 clockwise one more increment. Note: Power-up Signal Level: d) Click the Blank Check button in the RFLAB software. If the device is blank, a green bar appears in the window with a message indicating that it is blank. If the device is not blank or the power-up signal is out of range, a red bar appears in the window with an error message indicating that it is not blank. The variable resistor (R5) in the programmer should be adjusted to provide a proper "low-power" voltage level to the tag coil. A typical signal level is about 22 3 VPP at the tag coil, but it can vary outside of this range. R5: Turn clockwise in 1/16-inch increments Repeat step (d) while adjusting R5. Once the device has been verified as a blank, turn it clockwise one more increment. Then move to the next step. Click on the buttons in RFLAB for the appropriate data type and protocol for your tag. Enter the programming data in the text box. Click the Program button. This will send the programming data to the device. A typical signal level for programming is 33 1 VPP at the tag coil, but can vary outside of this range. After the device has been programmed, it transmits back the programmed data for verification. If the data has been programmed correctly, a green bar will appear for a few seconds with a message indicating Programming successful. j) The MCRF200 or MCRF250 lock may be locked even if the programming cycle was unsuccessful; therefore, a new MCRF200 sample may be required for each pass through steps (f) through (h). After programming is completed successfully, keep these R5 and R7 settings for future programming of your tags. Once this calibration has been done, remove the calibration tag from the programmer and reinstall the four screws. FIGURE 3-1: MCRF2XX microID PROGRAMMER AND CALIBRATION TAG COIL ARRANGEMENT FOR PROGRAMMING SIGNAL LEVEL MEASUREMENT Place your coil in the center of the red outlined area. DS51139A-page 120 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 4.0 a) PROGRAMMING PROCEDURE Set up the programmer and open up the RFLAB software on the host computer. Set Up: * Connect the +9 VDC power supply to the programmer. * Connect from the external serial port in the programmer box to a COM port in the host computer using the RS-232 cable. b) Place the RFID device at the center of the programmer. c) Click Blank Check button if you want to check whether the device is blank. This button can also be used to verify that the device is assembled properly. 4.1 Error Conditions If the host computer does not send programming data to the programmer for more than 3 seconds, the programmer will timeout and reset. If the programmer does not respond to the host computer, there will be an error message indicating Programmer time out. If invalid programming data is sent to the programmer during the loading of the program buffer, the programmer will return a message indicating Invalid. Note: d) e) f) g) The device can't be programmed unless it is blank. Enter the programming data in the RFLAB and select appropriate data type. If several devices are going to be programmed sequentially by any number, click the Auto Increment button and specify the increment number. Click the Program button. This will send the data to the device. If the data has been programmed correctly, there will be a green bar with a message indicating Programming successful. If the programming has been unsuccessful due to out-of-range in the programming signal level, a message and red bar will show up indicating Programming unsuccessful. In this case, the programming signal voltage may need to be calibrated for your tag. See the calibration procedure for the programming signal level in the previous section. h) Repeat step (a) through (g) for other tags. 1998 Microchip Technology Inc. DS51139A-page 121 microIDTM 125 kHz Design Guide FIGURE 4-1: PROGRAMMING FLOWCHART USING RFLAB Start Check Cable Connection and COM Port Place a blank tag on programmer Click "Programmer" Menu Button in RFLAB. Click "COM Port" Menu Button Select a COM Port Number Programmer power-up and connection ok? No Error Message: "Programmer Time-out" Yes Adjust the Programming Power-up Signal Level (R5) or try a new tag. Click "Blank Check" Button in RFLAB (Due to not blank or incorrect power-up Error message with a signal level) No "Device not Blank" or "Device not present" Adjust Programming Signal Level (R5 and R7) Blank and power-up signal level ok? Yes Message with a Green Bar: "Blank/Programmable" Type in Programming Data in RFLAB Send Program Data: Click "Program" Button Prog Successful? No Error Message with a Red Bar: "Programming Unsuccessful" Yes Message with a Green Bar: "Programming Successful" Stop DS51139A-page 122 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 5.0 PROGRAMMING IN A STANDARD TERMINAL MODE In special cases, the device can also be programmed in a standard terminal mode by executing the terminal.exe program (c:\windows\terminal.exe) or by any customer production software. The programmer setup, signal waveforms, and calibration procedure are the same as programming with the RFLAB. The following is a description of how to interface a host computer to Microchip's contactless programmer without the use of RFLAB software. The programmer will check for a blank, unlocked MCRF2XX tag before initiating programming. Once programming has been completed, the programmer will return a pass or fail code. The programmer communicates at 9600 baud, 8 data bits, 1 stop bit, and no parity. Figure 5-1 shows the programming flow and communication handshakes between host and programmer. 5.1 Programmer Wake-up Sending an ASCII `W' (57h) to the programmer on the RS-232 interface will tell the programmer to wake up and be prepared to receive commands. The programmer will reply with ASCII `R' (52h) when it is ready. 5.2 5.3 Program and Verify the Device After 16 bytes of data have been received by the programmer, it is ready to begin programming the data buffer into the MCRF2XX. Sending an ASCII `V' (56h) will tell the programmer to program the 16 bytes it has received and verify that the device has programmed properly. When the device programs properly, the programmer replies with ASCII `y' (79h). If the programming was not successful, the programmer replies with ASCII `n' (6Eh). A successful programming operation should take about 3 to 4 seconds per device. 5.4 Error Conditions If the PC does not send a byte to the programmer for more than 3 seconds, the programmer will timeout and reset. The entire programming sequence will need to be repeated, beginning with the programmer wake-up byte ASCII `W'. If invalid bytes are sent to the programmer during the loading of the program buffer, the programmer will return an ASCII `I' (49h). In this case, the entire programming sequence must be repeated, beginning with the programmer wake-up byte ASCII `W'. Blank Check Sending an ASCII `T' (54h) will signal the programmer to read the part about being contactlessly programmed and check to see if it is blank (all 1's) and unlocked. If the part is blank and unlocked, the programmer will reply with an ASCII `Y' (59h) to signify programming should continue. If the part is not blank or not unlocked, the programmer will reply with an ASCII `N' (4Eh) to indicate an error. It is always necessary to perform a blank check before programming MCRF2XX devices. 5.2.1 SENDING DATA TO THE PROGRAMMER If the programmer responds with an ASCII `Y', indicating that the part is blank, the PC can begin passing the 16 bytes of required data to the programmer data buffer. AnMCRF200 configured for 128 bits uses all 16 bytes of data in the transfer; when programming a 96-bit device, however, bits 33 through 64 are `don't care' and are ignored by the MCRF200. The data should be passed in ASCII equivalent hex bytes and the programmer will acknowledge the receipt of each byte by echoing back what it has received. For example, to program 05 hex data into the first byte, the PC would send ASCII `0' (30h), the programmer would echo `0' back. Next, the programmer would send ASCII `5' (35h), and the programmer will echo back `5'. All of the data must be sent in UPPERCASE ASCII equivalent only. See Figure 5-1 for a typical programming sequence. 1998 Microchip Technology Inc. DS51139A-page 123 microIDTM 125 kHz Design Guide FIGURE 5-1: TYPICAL SEQUENCE The following is the programming sequence necessary to wake up the programmer, check if a MCRF2XX part is blank, unlocked and ready to be programmed, send F1E2D3C4B5A6978888796A5B4C3D2E1F ASCII data to the programmer, and instruct the programmer to program and verify the device. STEP1 PC Send `W' to the programmer Programmer replies with `R' to the PC PC Send `T' to the programmer Programmer replies with `Y' if the device is OK and `N' if there is an error F PC Send `F' to prog. Programmer replies with `F' 1 PC Send `1' to prog. Programmer replies with `1' E PC Send `E' to prog. Programmer replies with `E' 2 PC Send `2' to prog. Programmer replies with `2' 2 PC Send `2' to prog. Programmer replies with `2' E PC Send `E' to prog. Programmer replies with `E' 1 PC Send `1' to prog. Programmer replies with `1' F PC Send `F' to prog. Programmer replies with `F' WAKE UP STEP2 VERIFY BLANK STEP3 PASS 16 BYTES OF DATA Byte 1 Byte 2 Byte 15 Byte 16 STEP4 PROGRAM/VERIFY PC Send `V' to the programmer to initiate a program/verify sequence (ID internal program/verify) Note: DS51139A-page 124 Programmer replies with `y' if the device programs OK and `n' if there is an error See the signal waveforms and calibration procedure in Sections 2.0 and 3.0. 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide TABLE 5-1 ASCII CHARACTER SET Most Significant Characters Least Significant Characters Hex 0 1 2 3 4 5 6 7 0 NUL DLE Space 0 @ P ` p 1 SOH DC1 ! 1 A Q a q 2 STX DC2 " 2 B R b r 3 ETX DC3 # 3 C S c s 4 EOT DC4 $ 4 D T d t 5 ENQ NAK % 5 E U e u 6 ACK SYN & 6 F V f v 7 Bell ETB ' 7 G W g w 8 BS CAN ( 8 H X h x 9 HT EM ) 9 I Y i y A LF SUB * : J Z j z B VT ESC + ; K [ k { C FF FS , < L \ l | D CR GS - = M ] m } E SO RS . > N ^ n ~ F SI US / ? O _ o DEL 1998 Microchip Technology Inc. DS51139A-page 125 microIDTM 125 kHz Design Guide 6.0 microIDTM PROGRAMMER SCHEMATIC DS51139A-page 126 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 7.0 microIDTM PROGRAMMER BILL OF MATERIALS Reference Designator Item # Qty Part # Vendor Vendor Part # 1 1 ICA-328-S-ST U4 SOCKET, 28 PIN,.300, MACHINED COLLET 2 1 -SPARE- SP1, LED1, R1, R2 -SPARELOCATION DO NOT INSTALL 3 1 PCC220CNCT-ND C7 CAP SMT, 22 pF NPO 0805 PANASONIC 4 2 0805N471J101NT C8, C9 CAP SMT, 470 pF 5% 100V 0805 MALLORY 5 1 CD15FC561JO3 C18 CAP, 560 pF, MICA, DIPPED, 300V, AX (0.234LS) CORNELL DUBILIER MOUSER 5982-15300V560 6 1 ECU-V1H102JCX C11 CAP SMT, 1000 pF 50V NPO CER, 0805 PANASONIC 7 1 CD19FD472JO3 CAP, 4700 pF, MICA, DIPPED, 500V, AX (0.344LS) CORNELL DUBILIER MOUSER 5982-19500V4700 8 9 250R18Z104MV4 C1, C3-C6, C12, E-6 C15-C17 CAP SMT, 0.1 F 20% 50V 0805 JOHANSON NEWARK 50F3674 9 1 ECS-H1ED106R C13 CAP SMT, 10 F, TANT ELEC, 25V, 7343 PANASONIC DIGIKEY PCT5106CTND 10 1 ECE-V0JA101SP C14 CAP SMT, 100 F, TANT ELEC, 6.3V, (VS-D) PANASONIC DIGIKEY PCE3058CTND 11 1 LL4148 D1 DIODE SMT, 5uA, 100V, 500 mW, FAST SWITCHING, DL-35 DIODES INC DIGIKEY LL4148DITRND 12 1 DL4002 D2 DIODE SMT, RECTIFIER, 1N4002, 1A, 100V, DL-41 DIODES INC. DIGIKEY DL4002DITRND 13 1 3345P-1-101 R7 RES, POT, 100 OHM 1/2 RD WW ST SL BOURNS DIGIKEY 3345P-101-ND 14 1 3345P-1-501 R5 RES, POT, 500 OHM 1/2 RD WW ST SL BOURNS DIGIKEY 3345P-501-ND 15 1 ERJ-6GEYJ100 R6 RES SMT, 10 OHM 1/10W 5% TYPE 0805 PANASONIC 16 1 ERJ-6GEYJ470V R4 RES SMT, 47 OHM 1/10W 5% TYPE 0805 PANASONIC 17 1 ERJ-6GEYJ471V R3 RES SMT, 470 OHM 1/10W 5% TYPE 0805 PANASONIC P470ATR-ND 18 1 ERJ-6GEYJ222V R13 RES SMT, 2.2K OHM 1/10W 5% TYPE 0805 PANASONIC P2.2KATR-ND 19 1 ERJ-6GEYJ103V R8 RES SMT, 10K 1/8W 5% TYPE 0805 PANASONIC 1998 Microchip Technology Inc. C2 Part Description Manufacturer SAMTEC P10ACT-ND DIGIKEY DIGIKEY P470ATR-ND P10KATR-ND DS51139A-page 127 microIDTM 125 kHz Design Guide Item # Qty Part # 20 1 ERJ-6GEYJ473V 21 2 22 Reference Designator Part Description Manufacturer Vendor Vendor Part # R11 RES SMT, 47K OHM 1/10W 5% TYPE 0805 PANASONIC DIGIKEY P473ATR-ND ERJ-6GEYJ104V R12, R14 RES SMT, 100K OHM 1/10W 5% TYPE 0805 PANASONIC DIGIKEY P100KATR-ND 1 ERJ-6GEYJ154V R10 RES SMT, 150K OHM 1/8W 5% 0805 PANASONIC DIGIKEY P150KATR-ND 23 1 ERJ-6GEYJ474V R9 RES SMT, 470K OHM 1/8W 5% 0805 PANASONIC DIGIKEY P470KATR-ND 24 1 MM74HC00M U1 IC, SMT, 74HC00 QUAD 2 IN NAND (SO-14) FAIRCHILD SEMICONDUCTOR DIGIKEY MM74HC00MND 25 3 NDS9942 U2, U5, U6 IC, SMT, 9942 MOSFAIRCHILD FET N-CH & P-CH SEMICONDUCTOR 20V (SO-8) DIGIKEY NDS9942TRND 26 1 MM74HC86MX U3 IC, SMT, 74HC86, QUAD XOR GATE (SO-14) FAIRCHILD SEMICONDUCTOR DIGIKEY 27 1 PIC16C73A /P U4 IC, PIC16C73A /P, PLASTIC DIP, 28P, 0.300 MICROCHIP 28 1 MAX232ACSE U7 IC, MAX232ACSE DUAL RS-232 TRANSMITTER/ RCVR, (SO-16) MAXIM 29 1 MC34072D U8 IC, DUAL OP AMP, (SO-8) MOTOROLA 30 1 L7805CV U9 IC, REG, +5V, 1.5A, 10%, TO-220 31 1 EFO-EC8004A4 Y1 OSC, 8.00 MHz CER RESONATOR W/ CAP 3 PIN 32 1 MCT0003-000 L1 INDUCTOR, 162 H CORNEL DUBILIER 33 1 DE9S-FRS P2 CONN, D-SUB 9P RECPT RT ANGLE SPC TECHNOLOGY 34 1 DJ005B P1 JACK, POWER, 2.5mm DC PC MOUNT LZR ELECTRONICS DS51139A-page 128 DIGIKEY MAX232ACSEND SGS THOMSON MOUSER 511-L7805CV PANASONIC DIGIKEY PX800-ND 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide 8.0 PROGRAMMER SOURCE CODE FOR PIC16C73 ; ; ; ; ; #=#=#=#=#=#=#=#=#=#=# PROJECT Microchip Programmer Reader #=#=#=#=#=#=#=#=#=#=# #=#=#=#=#=#=#=#=#=#=# 16C73A module #=#=#=#=#=#=#=#=#=#=# rfgopr5.asm PIC16C73A running at 8.5MHz, Ti = 0.47us Tcy = 16 Ti ; ; ; ; ; ; ; ; ; /////////////////////////////////////////////////////////////////////////// Revision history /////////////////////////////////////////////////////////////////////////// Ver Date Comment 1.00 1.04 10/24/97 13 Feb 98 Shannon/Hugh first pass ADDED TIMEOUT TO TESTMOD LISTP=PIC16C73A INCLUDE "P16C73A.INC" __config b'11111111110010' ; Code Protect off, Brown-out detect on, Power-up timer on, WDT off, ; HS oscillator constant StartPORTA constant StartTRISA = b'000000' = b'010111' #define _LED1 PORTB,4 #define _LED2 PORTB,5 #define _BUZZ1 PORTB,6 constant StartPORTB = b'00010010' constant StartTRISB = b'00000100' constant StartOPTION = b'10001000' ; Pullups disabled, TMR0 internal, WDT*1 COUNT1EQU0x20 DATA0EQU0x21 DATA1EQU0x22 DATA2EQU0x23 DATA3EQU0x24 DATA4EQU0x25 DATA5EQU0x26 DATA6EQU0x27 DATA7EQU0x28 DATA8EQU0x29 DATA9EQU0x2A DATAAEQU0x2B DATABEQU0x2C DATACEQU0x2D DATADEQU0x2E DATAEEQU0x2F DATAFEQU0x30 BIT EQU 0x31 OVERPROEQU0x32 DELAY1EQU0x33 DELAY2EQU0x34 DelayReg?H = DelayReg?L = CycleCtr?H = CycleCtr?L = TimerHi = TimerMid = TimerLo = BitCtr = BO3 = RxByte = TxByte = ByteCtr = ; COUNT REGISTER h'35' h'36' h'37' h'38' h'39' h'3A' h'3B' h'3C' h'3D' h'3E' h'3F' h'40' 1998 Microchip Technology Inc. DS51139A-page 129 microIDTM 125 kHz Design Guide NoiseTimeout = h'41' SampTimeout = h'42' CycleCtr2?L = h'43' CycleCtr2?H = h'44' #define _RAW_DATA #define _RS232OUT #define _CARRY #define _TMR2ON #define _RS232IN #define _ZERO #define _COIL_PWR_0 #define _COIL_EN SKIP macro BTFSC endm PORTA,4 PORTC,6 STATUS,0 T2CON,2 PORTC,7 STATUS,2 PORTB,3 PORTB,1 ; cycle at 30ms period (1=low power) PORTA,7 ; ***** Reset Vector org h'000' CLRF STATUS CLRF PCLATH CLRF INTCON GOTO RESET_A ; ***** Interrupt Vector - no interrupts yet org h'004' CLRF STATUS CLRF PCLATH GOTO RESET_A RS232StopBit BSF _RS232OUT ; | MOVLW d'208'-d'12'+d'40'; DelayW12 MOVWF DelayReg?L ; | Delay1 MOVLW d'4' ; | Delay1L SUBWF DelayReg?L,f ; | BTFSC _CARRY ; | GOTO Delay1L ; | COMF DelayReg?L,W ; | ADDWF PCL,f ; | Delay07 NOP ; | Delay06 NOP ; | Delay05 NOP ; | Delay04 RETLW h'00' ; | ;[0] Delay >=208 cycles with _RS232OUT high | ;[0] Delay 12+W cycles ;[0] Delay 11+Delay cycles ; | ;[0] Delay 7 cycles ;[0] Delay 6 cycles ;[0] Delay 5 cycles ;[0] Delay 4 cycles RESET_A CLRWDT CLRF CLRF MOVLW MOVWF MOVLW MOVWF CLRF MOVLW MOVWF MOVLW DS51139A-page 130 STATUS FSR StartPORTA PORTA StartPORTB PORTB INTCON b'110001' T1CON b'0000000' ; ; ; ; ; ; ; ; ; ; ; Initialise registers, clear watchdog timer | Access register page 0 | FSR=#0 | Initialise PORT registers | | | | | | | Interrupts off | TMR1 prescale *8, on | | | TMR2 postscale *1, off, prescale *1 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF BSF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF BCF T2CON d'8' CCPR1L b'001100' CCP1CON b'00000000' ADCON0 STATUS,RP0 StartTRISA TRISA StartTRISB TRISB 0x82 TRISC StartOPTION OPTION_REG d'15' PR2 h'03' PCON b'110' ADCON1 STATUS,RP0 ; !!!!! BCF CLRF BCF set TRIS registers, and other hardware registers. T2CON,2; turn coil off TMR2 PORTB,3 CALL RS232On BigLoop1 CALL CheckRxByte MOVF XORLW BTFSC GOTO CALL MOVLW CALL GOTO ; | ; | ; | ; | ; | ; | ; | ;^| ;^| ;^| ;^| ;^| | Duty on period = 8 Ti @@@ | CCP1 to PWM, 0,0 extra duty time @@@ | A/D convertor OFF | Initialise TRIS registers | | | | ;^| ;^| ;^| ;^| ;^| ;^| ;^| ;^| ; | Initialise OPTION register | PR2=7 (period of TMR2=16) @@@ | (It says so on page 2-584) | No analog inputs | | RS232WaitForever RxByte,W `W' _ZERO INTERRUPT RS232On `Q' RS232TxW BigLoop1 INTERRUPT CALL Delay07 BSF _LED1 CALL Delay07 BSF _LED2 CALL Delay07 INT_WAKEUP MOVLW `R' MOVWF RxByte CALL RS232On MOVF RxByte,W CALL RS232TxW CALL RS232Rx BTFSC _CARRY GOTO INT_END MOVF RxByte,W XORLW `T' BTFSS _ZERO GOTO CheckRxByte MOVLW ; ; ; ; ; LED1 on, LED2 on (orange/yellow) | | | | ; ; ; ; ; ; ; ; ; ; delay Transmit RxByte | Read byte from RS-232 | (if timeout, goto INT_END) | if (RxByte<>#'T') | | { goto CheckRxByte } d'10' 1998 Microchip Technology Inc. DS51139A-page 131 microIDTM 125 kHz Design Guide MOVWF CLRF CycleCtr?H CycleCtr?L Top1 BCFPORTB,3; SET FOR LOW VOLTAGE CALLDELAY ; CALL A SMALL DELAY GAP1; THIS IS THE ROUTINE THAT SETS THE GAP BCF CALL PORTB,3 DELAY BSF T2CON,2 ; TURN ON THE COIL MOVLW0x32 ; MOVE 32 HEX TO W, NUMBER CYCLES BEFORE A GAP MOVWFCOUNT1 ; MOVW W INTO COUNT1 LOOP11DECFSZCOUNT1,1; DECREMENT COUNT 1 UNTIL IT IS ZERO GOTOLOOP11 BCF T2CON,2 ; TURN OFF THE COIL MOVLW0x40 ; MOVE 10 HEX TO W, DURATION OF GAP MOVWFCOUNT1 ; MOVW W INTO COUNT1 LOOP21DECFSZCOUNT1,1; DECREMENT COUNT 1 UNTIL IT IS ZERO GOTOLOOP21 BSF T2CON,2 ; TURN THE COIL BACK ON CALL CALL CALL CALL CALL WaitFall1 WaitFall1A MOVLW MOVWF CLRF WaitFall1AL DECFSZ SKIP DECFSZ SKIP GOTO BTFSS GOTO NOP DECFSZ SKIP DECFSZ SKIP GOTO BTFSS GOTO WaitFall1B MOVLW MOVWF CLRF WaitFall1BL DECFSZ SKIP DECFSZ SKIP GOTO BTFSC DS51139A-page 132 TWC TWC TWC TWC TWC d'200' DelayReg?H DelayReg?L DelayReg?L,f DelayReg?H,f INT_ErrorN _RAW_DATA WaitFall1AL DelayReg?L,f DelayReg?H,f INT_ErrorN _RAW_DATA WaitFall1AL d'200' DelayReg?H DelayReg?L DelayReg?L,f DelayReg?H,f INT_ErrorN _RAW_DATA ; CALL A DELAY FOR AMP TO SETTLE ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Wait for falling edge | Wait for high | | Set timeout | | | | | | | | { { | | if (timeout) | | | | | | | | | | | { goto INT_ErrorN } | | } until (_RAW_DATA==#1) | | | | | | | | if (timeout) | | | | | | | | | | | { goto INT_ErrorN } | | } until (_RAW_DATA==#1) | | | Wait for low | | Set timeout | | | | | | | | { { | | if (timeout) | | | | | | | | | | | { goto INT_ErrorN } | | } until (_RAW_DATA==#0) 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide GOTO NOP DECFSZ SKIP DECFSZ SKIP GOTO BTFSC GOTO WaitFall1BL DelayReg?L,f DelayReg?H,f INT_ErrorN _RAW_DATA WaitFall1BL ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | | | | | | } | | | | if (timeout) | | | { goto INT_ErrorN } until (_RAW_DATA==#0) CLRF DelayReg?L ; Clear timer WaitFall2 ; Time falling edge WaitFall2A ; | Wait for high WaitFall2AL ; | | { { NOP ; NOP ; INCF DelayReg?L,f ; | | Increment timer BTFSC DelayReg?L,7 ; | | if timeout, GOTO INT_ErrorN ; | | { goto INT_ErrorN } BTFSS _RAW_DATA ; | | } until (_RAW_DATA==#1) GOTO WaitFall2AL ; | | | NOP ; | | | NOP ; NOP ; INCF DelayReg?L,f ; | | Increment timer BTFSC DelayReg?L,7 ; | | if timeout, GOTO INT_ErrorN ; | | { goto INT_ErrorN } BTFSS _RAW_DATA ; | | } until (_RAW_DATA==#1) GOTO WaitFall2AL ; | | NOP ; WaitFall2B ; | Wait for low WaitFall2BL ; | | { { NOP ; NOP ; INCF DelayReg?L,f ; | | Increment timer BTFSC DelayReg?L,7 ; | | if timeout, GOTO INT_ErrorN ; | | { goto INT_ErrorN } BTFSC _RAW_DATA ; | | } until (_RAW_DATA==#0) GOTO WaitFall2BL ; | | | NOP ; | | | NOP ; NOP ; INCF DelayReg?L,f ; | | Increment timer BTFSC DelayReg?L,7 ; | | if timeout, GOTO INT_ErrorN ; | | { goto INT_ErrorN } BTFSC _RAW_DATA ; | | } until (_RAW_DATA==#0) GOTO WaitFall2BL ; | | | ; DelayReg?L*8Ti = period of signal ; period of _RAW_DATA on FSK = Tcy*10 = Ti*160 ; DelayReg?L = 20 if FSK present ; if period does not match FSK, goto INT_ErrorN MOVF DelayReg?L,W ; | if (DelayReg?L<14) ADDLW low(0-d'14') ; | | BTFSS _CARRY ; | | GOTO INT_ErrorN ; | { goto INT_ErrorN } ADDLW low(d'14'-d'22'); | if (DelayReg?L>=22) BTFSC _CARRY ; | | GOTO INT_ErrorN ; | { goto INT_ErrorN } MOVLW MOVWF MOVLW MOVWF TestGotLo DECFSZ SKIP d'7' CycleCtr?H d'164' CycleCtr?L ; ; ; ; CycleCtr > 13*128=1664 | | | CycleCtr?L,f 1998 Microchip Technology Inc. DS51139A-page 133 microIDTM 125 kHz Design Guide DECFSZ SKIP GOTO MOVLW MOVWF BTFSS GOTO TestGotLoLoop BTFSS GOTO DECFSZ GOTO GOTO CycleCtr?H,f INT_ErrorN 0x20 COUNT1 _RAW_DATA TestGotHi _RAW_DATA TestGotHi COUNT1,1 TestGotLoLoop MChip_Prog TestGotHi MOVLW 0x20 MOVWF COUNT1 BTFSC _RAW_DATA GOTO TestGotLo TestGotHiLoop BTFSC _RAW_DATA GOTO TestGotLo DECFSZ COUNT1,1 GOTO TestGotHiLoop ;END TEST FOR NO MODULATION MChip_Prog BCF CALL CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF MOVLW MOVWF MOVLW MOVWF MOVLW MOVWF RS_ByteLoop CALL MOVF CALL CALL BTFSC GOTO MOVF MOVWF MOVLW SUBWF BTFSS GOTO _TMR2ON TWC DATA0 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7 DATA8 DATA9 DATAA DATAB DATAC DATAD DATAE DATAF `Y' RxByte DATAF FSR h'20' ByteCtr ; ; ; ; ; ; RS232On RxByte,W RS232TxW RS232Rx _CARRY INT_END RxByte,W BO3 h'30' BO3,W _CARRY CheckRxByte ; ; ; ; ; ; ; ; ; ; ; ; DS51139A-page 134 RxByte='Y' | FSR=#DATAF | ByteCtr=#h'20' | ; { delay Transmit RxByte on RS-232 | Read RS-232 byte into RxByte |(if timeout, goto INT_END) | BO3=RxByte | if (BO3<#h'30') | | { goto CheckRxByte } 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide MOVWF MOVLW SUBWF BTFSS GOTO MOVWF MOVLW SUBWF BTFSS GOTO MOVWF MOVLW SUBWF BTFSC GOTO MOVLW ADDWF RSDataJ1 SWAPF BTFSC MOVF IORWF BTFSC DECF DECFSZ GOTO CALL MOVF CALL CALL BTFSC GOTO MOVF XORLW BTFSS GOTO BO3 h'3A'-h'30' BO3,W _CARRY RSDataJ1 BO3 h'41'-h'3A' BO3,W _CARRY CheckRxByte BO3 h'47'-h'41' BO3,W _CARRY CheckRxByte h'0A' BO3,f ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; BO3,W ByteCtr,0 BO3,W INDF,f ByteCtr,0 FSR,f ByteCtr,f RS_ByteLoop ; ; ; ; ; ; ; ; BO3=BO3-#h'30' if (BO3>=#h'3A'-#h'30') | | { BO3=BO3-#h'3A'+#h'30' if (BO3<#h'41'-#h'3A') | | { goto CheckRxByte } BO3=BO3-#h'41'+#h'3A' if (BO3>=#h'47'-#h'41') | | { goto CheckRxByte } BO3=BO3+#h'0A' | ; } W = { BO3 swapped if ByteCtr,0==#0 | { BO3 if ByteCtr,0==#1 | INDF=INDF OR W if (ByteCtr,0==#1) { FSR=FSR-#1 } DEC ByteCtr } until (ByteCtr==#0) RS232On RxByte,W RS232TxW RS232Rx _CARRY INT_END RxByte,W `V' _ZERO CheckRxByte ; ; ; ; ; ; ; ; ; ; delay Transmit RxByte on RS-232 | Read RS-232 byte into RxByte |( if timeout, goto INT_END) | if (RxByte!=#'V') | | { goto CheckRxByte } ; ******** Top BCF PORTB,3 ; SET FOR LOW VOLTAGE CALLDELAY ; CALL A SMALL DELAY GAP ; THIS IS THE ROUTINE THAT SETS THE GAP BCF CALL PORTB,3 DELAY BSF T2CON,2 ; TURN ON THE COIL MOVLW0x32 ; MOVE 32 HEX TO W, NUMBER CYCLES BEFORE A GAP MOVWFCOUNT1 ; MOVW W INTO COUNT1 LOOP1DECFSZCOUNT1,1; DECREMENT COUNT 1 UNTIL IT IS ZERO GOTOLOOP1 BCF T2CON,2 ; TURN OFF THE COIL MOVLW0x40 ; MOVE 10 HEX TO W, DURATION OF GAP MOVWFCOUNT1 ; MOVW W INTO COUNT1 LOOP2DECFSZCOUNT1,1; DECREMENT COUNT 1 UNTIL IT IS ZERO GOTOLOOP2 BSF T2CON,2 ; TURN THE COIL BACK ON 1998 Microchip Technology Inc. DS51139A-page 135 microIDTM 125 kHz Design Guide MOVLWd'8'; MOVE 5 INTO THE W REGISTER MOVWFOVERPRO; THIS IS THE NUMBER OF OVERPROGRAMMING MODING BIGDLY CALL CALL CALL CALL CALL TWC TWC TWC TWC TWC CALL CALL TESTMOD PROGRAM MOVLW MOVWF CALL DECFSZ GOTO 0x60 COUNT1 TWC COUNT1,f BIGDLY ; CALL A DELAY FOR AMP TO SETTLE ; CALL A DELAY TO ALLOW THE AMP TO SETTLE DECFSZ OVERPRO,1 ; DECREMENT THE OVERPROGRAMMING NUMBER GOTOMODING ; GOTO LOOK FOR THE MODULATION TO STOP GOTOVERIFY ;*************************************** VERIFY CALL TESTMOD StartWatch MOVLW MOVWF VerifyD1a MOVLW MOVWF VerifyD1b CLRWDT DECFSZ GOTO DECFSZ GOTO StopWatch CLRF BSF ; Wait >~Ttag (for mod to start again) h'00' DelayReg?H h'FF' DelayReg?L DelayReg?L,f VerifyD1b DelayReg?H,f VerifyD1a BitCtr BitCtr,7 VerifyL1 ;% reftime-1345 CLRF CycleCtr?L ;% reftime-1344 ;% reftime-3-10*6-183*7 MOVLW d'10' MOVWF NoiseTimeout ;% reftime-1-10*6-183*7 ;% reftime-1-NTO*6-183*7 MOVLW d'183' MOVWF SampTimeout ;% reftime+1-NTO*6-183*7 ;% reftime+1-NTO*6-STO*7 BTFSC GOTO NOP ; Wait for modulation to stop ;% 167Ti of constant _RAW_DATA ; ; ; ; ; ; ; ; ; ; ; ; Delay >~262144Ti | | | delay 1021Ti | | | | | | | | | | | | | ; BitCtr=#128 ; | ; { ; ; set NoiseTimeout | ; ; set SampTimeout to 80Tcy | _RAW_DATA VerS1 VerS0 ;% reftime+4-NTO*6-STO*7 DS51139A-page 136 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide DECFSZ SKIP GOTO BTFSC GOTO NoiseTimeout,f VerFail _RAW_DATA VerS1 VerGot0 ;% reftime+3-NTO*6-STO*7 VerGot0a ;% reftime+3-NTO*6-STO*7 CLRWDT DECFSZ SampTimeout,f SKIP GOTO SampleDone BTFSS _RAW_DATA GOTO VerGot0 NOP VerGot0b ;% reftime+3-NTO*6-STO*7 CLRWDT DECFSZ SampTimeout,f SKIP GOTO SampleDone BTFSS _RAW_DATA GOTO VerGot0 NOP VerGotRise ;% reftime+3-NTO*6-STO*7 CLRWDT DECFSZ SampTimeout,f SKIP GOTO SampleDone INCF CycleCtr?L,f GOTO VerGot1 VerS1 ;% reftime+4-NTO*6-STO*7 DECFSZ NoiseTimeout,f SKIP GOTO VerFail BTFSS _RAW_DATA GOTO VerS0 VerGot1 ;% reftime+3-NTO*6-STO*7 VerGot1a ;% reftime+3-NTO*6-STO*7 CLRWDT DECFSZ SampTimeout,f SKIP GOTO SampleDone BTFSC _RAW_DATA GOTO VerGot1 NOP VerGot1b ;% reftime+3-NTO*6-STO*7 CLRWDT DECFSZ SampTimeout,f SKIP GOTO SampleDone BTFSC _RAW_DATA GOTO VerGot1 NOP VerGotFall ;% reftime+3-NTO*6-STO*7 CLRWDT DECFSZ SampTimeout,f SKIP 1998 Microchip Technology Inc. DS51139A-page 137 microIDTM 125 kHz Design Guide GOTO INCF GOTO SampleDone CycleCtr?L,f VerGot0 SampleDone ;% reftime+1-NTO*6-STO*7 ;& STO=0 ;% reftime+1-NTO*6 NoiseMargin ;% reftime+1-NTO*6 NOP NOP NOP DECFSZ NoiseTimeout,f GOTO NoiseMargin ;% reftime+0-NTO*6 ;% NTO=0 ;% reftime+0 BTFSC GOTO NOP DATAF,7 Verify1 Verify0 ;% 3 from ref time ; if `0' bit, _DATA_IN cycles 10 times in 80 Tcy ; CycleCtr?L should be 20 MOVF CycleCtr?L,W ADDLW low(0-d'18') BTFSS _CARRY GOTO INT_Failure ADDLW low(d'18'-d'22') BTFSS _CARRY GOTO Bit_Verified GOTO INT_Failure Verify1 ;% 3 from ref time ; if `1' bit, _DATA_IN cycles 8 times in 80Tcy ; CycleCtr?L should be 16 MOVF CycleCtr?L,W ADDLW low(0-d'14') BTFSS _CARRY GOTO INT_Failure ADDLW low(d'14'-d'18') BTFSS _CARRY GOTO Bit_Verified GOTO INT_Failure Bit_Verified ;% 11 from ref time BCF _CARRY BTFSC DATAF,7 BSF _CARRY RLF DATA0,f RLF DATA1,f RLF DATA2,f RLF DATA3,f RLF DATA4,f RLF DATA5,f RLF DATA6,f RLF DATA7,f RLF DATA8,f RLF DATA9,f RLF DATAA,f RLF DATAB,f DS51139A-page 138 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide RLF RLF RLF RLF DATAC,f DATAD,f DATAE,f DATAF,f ;% 30 from ref time MOVLW MOVWF NOP d'167' DelayReg?L VerDelay CLRWDT DECFSZ GOTO DelayReg?L,f VerDelay ; ; ; ; ; ; ; Delay 670Ti | | | | | | ;% 700 from ref time ;% (ref times 128*16Ti apart = 2048Ti apart) ;% -1348 from ref time DECFSZ BitCtr,f ; DEC BitCtr GOTO VerifyL1 ; } until (BitCtr==#0) ;*************************************** INT_Success CALL RS232On MOVLW `y' CALL RS232TxW GOTO BigLoop1 VerFail INT_Failure CALL MOVLW CALL GOTO RS232On `n' RS232TxW BigLoop1 INT_END ; RS-232 TIMEOUT NOP GOTO BigLoop1 INT_ErrorN CALL MOVLW CALL GOTO RS232On `N' RS232TxW BigLoop1 DELAYMOVLW0x05 MOVWFDELAY1 HOLD4DECFSZDELAY1,1 GOTOHOLD4 RETLW0 ; TWC lasts TWC MOVLW0xB0 ; WRITE CYCLE TIMER SUBROUTINE MOVWFDELAY1 HOLD1MOVLW0x02 MOVWFDELAY2 HOLD2DECFSZDELAY2,1 GOTOHOLD2 DECFSZDELAY1,1 GOTOHOLD1 RETLW0 BUFFERMOVLW0x58 MOVWFDELAY1 1998 Microchip Technology Inc. DS51139A-page 139 microIDTM 125 kHz Design Guide HOLD3DECFSZDELAY1,1 GOTOHOLD3 NOP NOP RETLW0 TESTMOD; THIS ROUTINE TESTS THE RAW DATA LINE TO SEE IF THE ; PART IS MODULATING OR NOT ; This routine returns when _RAW_DATA stays constant for some time ; some time = 7Ti+32*5Ti = 167Ti = 10.4375Tcy MOVLW MOVWF MOVLW MOVWF d'7' CycleCtr2?H d'164' CycleCtr2?L ; ; ; ; CycleCtr2 > 13*128=1664 | | | TestModLo DECFSZ CycleCtr2?L,f SKIP DECFSZ CycleCtr2?H,f SKIP GOTO INT_Failure MOVLW 0x20 MOVWF COUNT1 BTFSS _RAW_DATA GOTO TestModHi TestModLoLoop BTFSS _RAW_DATA GOTO TestModHi DECFSZ COUNT1,1 GOTO TestModLoLoop RETLW 0 TestModHi MOVLW 0x20 MOVWF COUNT1 BTFSC _RAW_DATA GOTO TestModLo TestModHiLoop BTFSC _RAW_DATA GOTO TestModLo DECFSZ COUNT1,1 GOTO TestModHiLoop ;END TEST FOR NO MODULATION RETLW 0 PROGRAM BCFPORTB,3; CLEAR THE HIGH VOLTAGE MOVLW0x07; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITEFBTFSSDATAF,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATAF,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATAF,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITEF; GOTO WRITEF IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP DS51139A-page 140 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide NOP NOP NOP MOVLW0x07; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITEEBTFSSDATAE,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATAE,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATAE,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITEE; GOTO WRITEE IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITEDBTFSSDATAD,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATAD,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATAD,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITED; GOTO WRITEF IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITECBTFSSDATAC,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATAC,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATAC,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITEC; GOTO WRITEC IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP 1998 Microchip Technology Inc. DS51139A-page 141 microIDTM 125 kHz Design Guide NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITEBBTFSSDATAB,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATAB,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATAB,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITEB; GOTO WRITEB IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITEABTFSSDATAA,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATAA,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATAA,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITEA; GOTO WRITEA IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE9BTFSSDATA9,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA9,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA9,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE9; GOTO WRITE9 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP DS51139A-page 142 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE8BTFSSDATA8,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA8,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA8,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE8; GOTO WRITE8 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE7BTFSSDATA7,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA7,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA7,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE7; GOTO WRITE7 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE6BTFSSDATA6,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA6,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA6,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE6; GOTO WRITE6 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP 1998 Microchip Technology Inc. DS51139A-page 143 microIDTM 125 kHz Design Guide NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE5BTFSSDATA5,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA5,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA5,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE5; GOTO WRITE5 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE4BTFSSDATA4,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA4,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA4,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE4; GOTO WRITE4 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE3BTFSSDATA3,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA3,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA3,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE3; GOTO WRITE3 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP DS51139A-page 144 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE2BTFSSDATA2,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA2,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA2,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE2; GOTO WRITE2 IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE1BTFSSDATA1,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA1,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA1,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE1; GOTO WRITEF IF BIT IS NOT EQUAL TO ZERO NOP NOP NOP NOP NOP NOP NOP MOVLW0x07 ; MOVW 7 HEX INTO W MOVWFBIT ; MOVE THIS INTO THE BIT COUNTER WRITE0BTFSSDATA0,7 ; TEST MOST BYTE BSF PORTB,3 ; SET THE HIGH VOLTAGE CALLTWC ; CALL THE WRITE CYCLE TIMER BCF STATUS,C ; CLEAR THE CARRY BIT BTFSC DATA0,7 ; TEST THE MSB BSF STATUS,C ; SET THE CARRY BIT RLF DATA0,1 ; ROTATE DATAF BCFPORTB,3; CLEAR THE HIGH VOLTAGE CALL BUFFER; CALL THE BUFFER TIMER DECF BIT,1; DECREMENT BIT, SKIP IF ZERO BTFSS BIT,7 ; SKIP IF SET GOTOWRITE0; GOTO WRITE0 IF BIT IS NOT EQUAL TO ZERO RETLW 0 Delay12 NOP 1998 Microchip Technology Inc. DS51139A-page 145 microIDTM 125 kHz Design Guide Delay11 GOTO Delay09 GOTO Delay07 Delay09 RS232On BCF CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL RETLW _TMR2ON RS232StopBit RS232StopBit RS232StopBit RS232StopBit RS232StopBit RS232StopBit RS232StopBit RS232StopBit RS232StopBit RS232StopBit h'00' RS232WaitForever BigWaitL1 CLRWDT BTFSS _RS232IN GOTO RS232RxL1Done NOP GOTO BigWaitL1 RS232Rx MOVLW MOVWF CLRF CLRF RS232RxL1 CLRWDT BTFSS GOTO DECFSZ GOTO DECFSZ GOTO DECFSZ GOTO BSF RETLW d'16' TimerHi TimerMid TimerLo ; ; ; ; ; ; ; ; ; ; ; ; | | | | | | | | | | | | ;[1] Initialise RS-232 Turn coil off Transmit stop bits | | | | | | | | | return ;[1] ~9600 baud ; | { ;!| ; | if (_RS232IN==#0) ; | { goto RS232RxL1Done } ;!| ; | } until (0) ; ; ; ; | | | | ;[1] ~9600 baud Set timeout of ~2.9s | | | ; | { ;!| _RS232IN ; | if (_RS232IN==#0) RS232RxL1Done ; | { goto RS232RxL1Done } TimerLo,f ; | } RS232RxL1 ; | | TimerMid,f ; | | RS232RxL1 ; | | TimerHi,f ; | | RS232RxL1 ; | | _CARRY ; | return with error h'00' ; | | ; | RS232RxL1Done ; |% 3 to (+6, +8, +10) - say 10us ; |% 10-104=-94 MOVLW d'90' ;!| CALL DelayW12 ;!|% 9 CLRF BitCtr ; | BitCtr=#8 BSF BitCtr,3 ; | | RS232RxLoop ; | {% 11 MOVLW d'181' ;!| CALL DelayW12 ;!| % 205 CLRF BO3 ; | BO3,1=_RS232IN BTFSC _RS232IN ; | | INCF BO3,f ; | |% 208 BTFSC _RS232IN ; | |% 1 INCF BO3,f ; | | BTFSC _RS232IN ; | | INCF BO3,f ; | |% 4 RRF RxByte,f ; | RR RxByte BCF RxByte,7 ; | RxByte,7=BO3,1 BTFSC BO3,1 ; | | BSF RxByte,7 ; | |% 8 DECFSZ BitCtr,f ; | DEC BitCtr DS51139A-page 146 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide GOTO BCF RETLW RS232TxW MOVWF CALL CLRF BSF BCF MOVLW CALL RS232TxLoop BTFSS BCF BTFSC BSF RRF MOVLW CALL DECFSZ GOTO GOTO RS232TxJ1 NOP BSF RETLW RS232RxLoop _CARRY h'00' ; | } until (BitCtr==#0) ; | return with no error ; | | TxByte RS232StopBit BitCtr BitCtr,3 _RS232OUT d'191' DelayW12 ; ; ; ; ; ; ; TxByte,0 _RS232OUT TxByte,0 _RS232OUT TxByte,f d'187' DelayW12 BitCtr,f RS232TxLoop RS232TxJ1 ; | ; | ; | ; | ; | ;!| ;!| % 202 ; | DEC BitCtr ; | } until (BitCtr==#0) ; | ; | ; |% 207 ; | Stop bit ; | return _RS232OUT h'00' | | | | | | | ;[1] Transmit W on RS232 at ~9600 baud TxByte=W stop bit BitCtr=#8 | Start bit | | ; | {% 205 _RS232OUT=TxByte,0 |% 207 |% 208 |% 1 RR TxByte end 1998 Microchip Technology Inc. DS51139A-page 147 microIDTM 125 kHz Design Guide NOTES: DS51139A-page 148 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide NOTES: 1998 Microchip Technology Inc. DS51139A-page 149 microIDTM 125 kHz Design Guide NOTES: DS51139A-page 150 1998 Microchip Technology Inc. microIDTM 125 kHz Design Guide NOTES: 1998 Microchip Technology Inc. DS51139A-page 151 WORLDWIDE SALES AND SERVICE AMERICAS AMERICAS (continued) Corporate Office Toronto Singapore Microchip Technology Inc. 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-786-7200 Fax: 480-786-7277 Technical Support: 480-786-7627 Web Address: http://www.microchip.com Microchip Technology Inc. 5925 Airport Road, Suite 200 Mississauga, Ontario L4V 1W1, Canada Tel: 905-405-6279 Fax: 905-405-6253 Microchip Technology Singapore Pte Ltd. 200 Middle Road #07-02 Prime Centre Singapore 188980 Tel: 65-334-8870 Fax: 65-334-8850 Atlanta Microchip Asia Pacific Unit 2101, Tower 2 Metroplaza 223 Hing Fong Road Kwai Fong, N.T., Hong Kong Tel: 852-2-401-1200 Fax: 852-2-401-3431 Microchip Technology Inc. 500 Sugar Mill Road, Suite 200B Atlanta, GA 30350 Tel: 770-640-0034 Fax: 770-640-0307 Boston Microchip Technology Inc. 5 Mount Royal Avenue Marlborough, MA 01752 Tel: 508-480-9990 Fax: 508-480-8575 Chicago Microchip Technology Inc. 333 Pierce Road, Suite 180 Itasca, IL 60143 Tel: 630-285-0071 Fax: 630-285-0075 Dallas Microchip Technology Inc. 4570 Westgrove Drive, Suite 160 Addison, TX 75248 Tel: 972-818-7423 Fax: 972-818-2924 Dayton Microchip Technology Inc. Two Prestige Place, Suite 150 Miamisburg, OH 45342 Tel: 937-291-1654 Fax: 937-291-9175 Detroit Microchip Technology Inc. Tri-Atria Office Building 32255 Northwestern Highway, Suite 190 Farmington Hills, MI 48334 Tel: 248-538-2250 Fax: 248-538-2260 Los Angeles Microchip Technology Inc. 18201 Von Karman, Suite 1090 Irvine, CA 92612 Tel: 949-263-1888 Fax: 949-263-1338 New York Microchip Technology Inc. 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 ASIA/PACIFIC Hong Kong ASIA/PACIFIC (continued) Taiwan, R.O.C Microchip Technology Taiwan 10F-1C 207 Tung Hua North Road Taipei, Taiwan, ROC Tel: 886-2-2717-7175 Fax: 886-2-2545-0139 EUROPE Beijing United Kingdom Microchip Technology, Beijing Unit 915, 6 Chaoyangmen Bei Dajie Dong Erhuan Road, Dongcheng District New China Hong Kong Manhattan Building Beijing 100027 PRC Tel: 86-10-85282100 Fax: 86-10-85282104 Arizona Microchip Technology Ltd. 505 Eskdale Road Winnersh Triangle Wokingham Berkshire, England RG41 5TU Tel: 44 118 921 5858 Fax: 44-118 921-5835 India Denmark Microchip Technology Inc. India Liaison Office No. 6, Legacy, Convent Road Bangalore 560 025, India Tel: 91-80-229-0061 Fax: 91-80-229-0062 Microchip Technology Denmark ApS Regus Business Centre Lautrup hoj 1-3 Ballerup DK-2750 Denmark Tel: 45 4420 9895 Fax: 45 4420 9910 Japan France Microchip Technology Intl. Inc. 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 Arizona 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 Korea Germany Microchip Technology Korea 168-1, Youngbo Bldg. 3 Floor Samsung-Dong, Kangnam-Ku Seoul, Korea Tel: 82-2-554-7200 Fax: 82-2-558-5934 Arizona Microchip Technology GmbH Gustav-Heinemann-Ring 125 D-81739 Munchen, Germany Tel: 49-89-627-144 0 Fax: 49-89-627-144-44 Shanghai Arizona 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 Microchip Technology RM 406 Shanghai Golden Bridge Bldg. 2077 Yan'an Road West, Hong Qiao District Shanghai, PRC 200335 Tel: 86-21-6275-5700 Fax: 86 21-6275-5060 Italy 11/15/99 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(R) 8-bit MCUs, KEELOQ(R) 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. All rights reserved. (c) 1999 Microchip Technology Incorporated. Printed in the USA. 11/99 Printed on recycled paper. Information contained in this publication regarding device applications and the like is intended for suggestion only and may be superseded by updates. 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. The Microchip logo and name are registered trademarks of Microchip Technology Inc. in the U.S.A. and other countries. All rights reserved. All other trademarks mentioned herein are the property of their respective companies. 1999 Microchip Technology Inc.