MCP3909 and PIC18F85J90 Single Phase Energy Meter Reference Design © 2009 Microchip Technology Inc. DS51884A Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code. • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Octopus, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, PIC32 logo, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2009, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. DS51884A-page 2 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Table of Contents Preface ........................................................................................................................... 5 Introduction............................................................................................................ 5 Document Layout .................................................................................................. 6 Conventions Used in this Guide ............................................................................ 7 Recommended Reading........................................................................................ 8 The Microchip Web Site ........................................................................................ 8 Customer Support ................................................................................................. 8 Document Revision History ................................................................................... 8 Chapter 1. Product Overview 1.1 Introduction ..................................................................................................... 9 1.2 What the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Kit Includes ................................................................................. 10 1.3 Getting Started ............................................................................................. 11 Chapter 2. Hardware 2.1 Input and Analog Front End ......................................................................... 13 2.2 Power Supply Circuit .................................................................................... 14 2.3 Microcontroller connections .......................................................................... 15 Chapter 3. PIC18F85J90 Calculation and Register Description 3.1 Register Overview ........................................................................................ 17 3.2 active energy calculation .............................................................................. 18 3.3 Complete Register List ................................................................................. 19 3.4 Configuration And Output Registers ............................................................. 20 3.5 Calibration Registers .................................................................................... 27 Chapter 4. Meter Protocol and Timings 4.1 PIC18F85J90 Protocol ................................................................................. 31 Chapter 5. Meter Calibration 5.1 Calibration Overview .................................................................................... 33 5.2 Active Power Signal Flow and Calibration .................................................... 35 5.3 RMS Current, RMS Voltage, Apparent Power Signal Flow and Calibration . 36 © 2009 Microchip Technology Inc. DS51884A-page 3 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Appendix A. Schematic and Layouts A.1 Introduction .................................................................................................. 49 A.2 Board Schematic - Page 1 ........................................................................... 50 A.3 Board Schematic - Page 2 ........................................................................... 51 A.4 Board Schematic - Page 3 ........................................................................... 52 A.5 Board - Top Layer And Silk-screen .............................................................. 53 A.6 Board - Top Copper ..................................................................................... 54 A.7 Board - Bottom Layer and Silk-screen ........................................................ 55 A.8 Board - Bottom Copper ................................................................................ 56 Appendix B. Bill of Materials Worldwide Sales and Service .....................................................................................60 DS51884A-page 4 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Preface NOTICE TO CUSTOMERS All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available. Documents are identified with a “DS” number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document. For the most up-to-date information on development tools, see the MPLAB® IDE on-line help. Select the Help menu, and then Topics to open a list of available on-line help files. INTRODUCTION This chapter contains general information that will be useful to know before using the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design. Items discussed in this chapter include: • • • • • • Document Layout Conventions Used in this Guide Recommended Reading The Microchip Web Site Customer Support Document Revision History © 2009 Microchip Technology Inc. DS51884A-page 5 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design DOCUMENT LAYOUT This document describes how to use the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design as a development tool to emulate and debug firmware on a target board. The manual layout is as follows: • Chapter 1. “Product Overview” – Important information on using the MCP3909 3-Phase Energy Meter Reference Design including a getting started section that describes wiring the line and load connections. • Chapter 2. “Hardware” – Includes detail on the function blocks of the meter including the analog front end design, phase lock loop circuitry, and power supply design. • Chapter 3. “PIC18F85J90 Calculation and Register Description” – This section describes the digital signal flow for all power output quantities such as RMS current, RMS voltage, active power, and apparent power. This section also includes the calibration registers detail. • Chapter 4. “Meter Protocol and Timings”– Here is described the protocol used for accessing the registers includes commands that are used to interface to the meter. • Chapter 5. “Meter Calibration” – This chapter provides detail on how to calibrate the meter. The PC calibration software that is included with the meter automates the steps and calculations described in this chapter. • .Appendix A. “Schematic and Layouts” – Shows the schematic and layout diagrams • Appendix B. “Bill of Materials” – Lists the parts used to build the meter. DS51884A-page 6 © 2009 Microchip Technology Inc. Preface CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Arial font: Italic characters Represents Examples Referenced books Emphasized text A window A dialog A menu selection A field name in a window or dialog A menu path MPLAB® IDE User’s Guide ...is the only compiler... the Output window the Settings dialog select Enable Programmer “Save project before build” A dialog button A tab A number in verilog format, where N is the total number of digits, R is the radix and n is a digit. A key on the keyboard Click OK Click the Power tab 4‘b0010, 2‘hF1 Italic Courier New Sample source code Filenames File paths Keywords Command-line options Bit values Constants A variable argument Square brackets [ ] Optional arguments Curly brackets and pipe character: { | } Ellipses... Choice of mutually exclusive arguments; an OR selection Replaces repeated text #define START autoexec.bat c:\mcc18\h _asm, _endasm, static -Opa+, -Opa0, 1 0xFF, ‘A’ file.o, where file can be any valid filename mcc18 [options] file [options] errorlevel {0|1} Initial caps Quotes Underlined, italic text with right angle bracket Bold characters N‘Rnnnn Text in angle brackets < > Courier New font: Plain Courier New Represents code supplied by user © 2009 Microchip Technology Inc. File>Save Press <Enter>, <F1> var_name [, var_name...] void main (void) { ... } DS51884A-page 7 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design RECOMMENDED READING This user's guide describes how to use MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. MCP3909 Data Sheet, “Energy Metering IC with SPI Interface and Active Power Pulse Output“ (DS22025) This data sheet provides detailed information regarding the MCP3909 device. AN994 Application Note “IEC61036 Meter Design using the MCP3905A/06A Energy Metering Devices” (DS00994) This application note documents the design decisions associated with using the MCP390X devices for energy meter design and IEC compliance. THE MICROCHIP WEB SITE Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information: • Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software • General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing • Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives CUSTOMER SUPPORT Users of Microchip products can receive assistance through several channels: • • • • Distributor or Representative Local Sales Office Field Application Engineer (FAE) Technical Support Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document. Technical support is available through the web site at: http://support.microchip.com DOCUMENT REVISION HISTORY Revision A (December 2009) • Initial Release of this Document. DS51884A-page 8 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Chapter 1. Product Overview 1.1 INTRODUCTION The MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design is a fully functional single phase meter. The design is intended to be low cost and is transformerless. The design uses a half-wave rectified power supply circuit and a shunt current sensing element. A single MCP3909 acts as the analog front end measurement circuitry. The PIC18F85J90 directly drives the LCD glass and displays active energy consumption. The meter design contains serially accessible registers and is intended to be flexible and upgraded to a variety of PIC® micro-based energy meter designs using the firmware presented herein. The “Single Phase Energy Meter Software” offers a functional and simple means to monitor and control the PIC18F85J90 and can be used to create custom calibration setups. In some situations, only a single point calibraton may be required. The energy meter software offers an automated step by step calibration process that can be used to quickly calibrate energy meters. FIGURE 1-1: Design. © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 Single Phase Energy Meter Reference DS51884A-page 9 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design RS-232 RX / TX Active Reactive Power Power In-Circuit Programming KWH PIC18F85J90 SPI MCP3909 FIGURE 1-2: 1.2 25LC256 Power Supply & Protection Circuitry Functional Block Diagram. WHAT THE MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN KIT INCLUDES This MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Kit includes: • MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design, 102-00130 • Important Information Sheet DS51884A-page 10 © 2009 Microchip Technology Inc. Product Overview 1.3 GETTING STARTED To describe how to use the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design, the following example is given using a 2-Wire 1-phase, 220V AC line voltage and connections using an energy meter calibrator equipment or other programmable load source. The meter design uses a 5A load for calibration current and a maximum current (IMAX) of 10A. All connections described in this section are dependent on the choice of current sensing element and a secondary external transformer may be required in higher current meter designs. For testing a calibrated meter, the following connections apply for a 4-wire connection. 1.3.1 Step 1: Wiring connections 1 2 3 4 Line Line Neutral Neutral MAIN LOAD FIGURE 1-3: 1.3.2 Example Connections using a 4-Wire System. Step 2: Turn On Line/Load Power to the Meter (Power the Meter) The meter will turn on when the line connection has 220V connected. The LCD display will show total energy accumulated. © 2009 Microchip Technology Inc. DS51884A-page 11 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 12 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Chapter 2. Hardware 2.1 INPUT AND ANALOG FRONT END This meter comes populated with components designed for 220V line voltage. At the bottom of the main board are the high voltage line and neutral connections. There are four total connections that are made from the PCB to the meter casing, labeled as LINE, NEUTRAL, SHUNT1 and SHUNT2. The shunt sits on the high or line side of a two wire system and the meter employes a hot or “live” ground. The wires going into the shunt to SHUNT1 and SHUNT2 should be twisted together. The wires going into the LINE and NEUTRAL side of the meter should also be twisted together and kept away from the SHUNT1 and SHUNT2 wires if possible. The neutral side of the 2-wire system goes into a resistor divider on the voltage channel input. Anti-aliasing low-pass filters will be included on both differential channels. The voltage channel uses two 332 kΩ resistors to achieve a divider ratio of 664:1. For a line voltage of 230 VRMS, the channel 1 input signal size will be 490 mVPEAK. The current channel of each phase uses current transformer with a turns ratio of 2000:1 and burden resistance of 56.4 kΩ. The resulting channel 0 signal size is 340 mVPEAK for 20A, or twice the rated maximum current of the meter, still within the input range of the A/D converter of the MCP3909. 150 FB (Note) 1.0 kΩ CH0+ LINE_SHUNT1 68 nF Shunt (external to PCB part of meter case) MCP3909 150 FB (Note) 1.0 kΩ CH0- LINE_SHUNT2 68 nF 332 kΩ 332 kΩ 0Ω NEUTRAL CH1+ 68 nF 1.0 kΩ 10 step optional resistor ladder 1.0 kΩ CH1+ 68 nF Note: FIGURE 2-1: FB = ferrite beads. Ferrite beads have an impedance of the specified value at 100 MHz. Analog Front End, Phase A Connections and Reference Designators shown. © 2009 Microchip Technology Inc. DS51884A-page 13 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 2.2 POWER SUPPLY CIRCUIT The power supply circuit for the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design uses a half wave rectified signal and a single +5V voltage regulator, and a 3.3V LDO. 1 3 2 +9V DS Power In (DO NOT USE WHILE METER IS CONNECTED TO MAINS!) +5V 150 FB (Note) 1 uF 470Ω NEUTRAL Out 100 nF Gnd 10 uF 1uF LINE A A A B +3.3V +5V In 100 nF 100 nF B DS51884A-page 14 Out EN Byp Gnd 100 nF FIGURE 2-2: A A B B B B Low-Cost Power Supply Circuit. © 2009 Microchip Technology Inc. Hardware 2.3 MICROCONTROLLER CONNECTIONS PIC18F85J90 RH4 RH5 ACTIVE REACTIVE POWER (FUTURE) POWER RC7/RX UART - PC RC6/TX MAX3323 RA2 RA3 RC2/CCP1 G1 ANALOG FRONT END MCLK RA0 G0 MCLR RJ7 CS RC3/SCK SCK RC5/SDO SDI RC4/SDI SDO HPF1 16-bit Multi-level ΔΣ ADC + PGA – CH0+ CH0- 16-bit Multi-level ΔΣ ADC + HPF1 CH1+ CH1- – MCP3909 SPI - EEPROM SCK SDO SDI CS RA0 25LC256 FIGURE 2-3: RB4 SWITCH RB5 SWITCH MCP3909/PIC18F85J90 Digital Connections. © 2009 Microchip Technology Inc. DS51884A-page 15 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 16 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Chapter 3. Calculation and Register Description 3.1 REGISTER OVERVIEW The PIC18F85J90 contains registers that are used during calibration and registers that can be read through the UART. The registers are named to describe each phase, specific measurement, and in the case of the calibration registers, the calibration function. The intent of the calibration process is to yield output registers that are decimal representation of the final energy, power, current or voltage value. Instantaneous Power Registers The PHy_W and PHy_VA registers contain the decimal representation of the active power (W) and apparent power (VA) post calibration. The reactive power calculation is not implemented at this time. The final correction factors to convert these registers to units of energy are located in the _GLSB registers. These correction factors can be automatically calculated and loaded by using the PC calibration software. The exact representation depends on the meter values that are entered in the software. For example, at 10A and 220V, power in the PHy_W register is 0.1 mW/LSB. Calibration Registers The calibration registers fall into one of three categories: offset, gain, and LSB, denoted by _OFF, _GAIN and _GLSB register names. In addition there are two registers, CFNUM and CFDEN, that calibrate the output pulse, CF. © 2009 Microchip Technology Inc. DS51884A-page 17 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.2 ACTIVE ENERGY CALCULATION Active Energy is described through the process described in Figure 3-1. The calibration registers for each calculation are shown as well as the output registers. ADC PHA_W_OFF:32 CURRENT PHA_DELAY:8 ADC / Digital to Frequency Converter CF OUTPUT FREQUENCY ON PIN PHA_W:32 CF_DEN:16 CF_NUM:16 X 2 X X ENERGY_W_GLSB:16 Φ VOLTAGE Σ 1 PHA_W_GLSB:16 X PHA_W:48 MCP3909 ENERGY_W_LRAW:48 ENERGY_W_Z:64 ENERGY_W:64 PHA_W_RAW:48 PERIOD:16 PGA ENERGY_W_L:64 kWh (Displayed on LCD) FIGURE 3-1: DS51884A-page 18 Active Energy Calculation. © 2009 Microchip Technology Inc. Calculation and Register Description 3.3 COMPLETE REGISTER LIST TABLE 3-1: INTERNAL REGISTER SUMMARY Address Name Bits R/W 0x000 MODE1 16 R/W Description 0x002 RESERVED 16 — Reserved 0x004 STATUS1 16 R Status Register Configuration register for operating mode of the meter 0x006 RESERVED 16 — 0x008 CAL_CONTROL 16 R/W Configuration register for calibration control Reserved 0x00A LINE_CYC 16 R/W 2nd number of line cycles to be used during energy accumulation 0x00C LINE_CYC_CNT 16 R Counter for number of line cycles 0x00E RESERVED 16 — Reserved 0x04F RESERVED 8 — Reserved 0x064 PHA_W_RAW 48 R Raw phase A active power 0x076 PHA_W 32 R Final Phase A active power, units in watts (W) 0x0A0 PHA_VAR_RAW 48 R Not implemented 0x0B2 PHA_VAR 32 R Not implemented 0x0BE RESERVED 16 — Not implemented 0x0C0 PERIOD 32 R Period register 0x0C4 ENERGY_W 64 R Total active energy accumulated 0x0CC ENERGY_W_Z 64 R Total active energy accumulated since last read of this register 0x0D4 ENERGY_W_L_RAW 48 R Total energy accumulated over last LINE_CYC line cycles 0x0DA ENERGY_W_L 32 R Not implemented 0x0FE RESERVED 16 — Reserved 0x100 ENERGY_VAR 64 R Not implemented 0x108 ENERGY_VAR_Z 64 R Not implemented 0x116 ENERGY_VAR_L 32 R Not implemented 0x11A Reserved 272 — Reserved 0x13C Reserved 16 — Reserved 0x13E Reserved 16 — Reserved 0x13F End — — End of PIC18F85J90 RAM 8 R/W CALIBRATION REGISTERS 0x140 PHA_DELAY Phase A delay (delay between voltage and current, voltage is time shifted) 0x143 RESERVED 8 — 0x170 PHA_W_OFF 32 R/W Active power offset, Phase A Reserved 0x17C PHA_W_GAIN 16 R/W Active power gain adjust for Phase A, for CF matching 0x182 PHA_W_GLSB 16 R/W Active power gain adjust for Phase A, to produce X W/LSB Not implemented 0x194 PHA_VAR_GAIN 16 R/W 0x19A PHA_VAR_GLSB 16 R/W Not implemented 0x1A0 ENERGY_W_GLSB 16 R/W Not implemented 0x1A4 ENERGY_VAR_GLSB 16 R/W Not implemented 0x1A6 CREEP_THRESH 32 R/W Not implemented 0x1AA CF_PULSE_WIDTH 8 R/W Defines CF pulse width from 0 to 255 * 1.25 ms for 50 Hz. For 60 Hz line 0 to 255 * 1.042 ms 0x1AB RESERVED 8 — 0x1AC CFDEN 8 R/W 0x1AD RESERVED 8 — 0x1AE CFNUM 16 R/W CF Calibration Pulse correction factor 0x1B0 MODE1DEF 16 R/W Power Up Configuration Register 0x1B2 PHA_CAL_STATUS 16 R/W Status of Phase A Calibration 0x1B8 STAND_W_RAW 48 R/W Standard Phase Active Power Reading (place holder register used during calibration for gain matching) © 2009 Microchip Technology Inc. Reserved CF Calibration Pulse correction factor Reserved DS51884A-page 19 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4 CONFIGURATION AND OUTPUT REGISTERS 3.4.1 MODE1 Register REGISTER 3-1: Name MODE1 REGISTER Bits Address Cof 0x000 R/W The mode register controls the operation of the energy meter. The bit functions are defined below. MODE1 16 R/W-0 R/W R/W R/W R/W U-0 U-0 U-0 APP2 APP1 APP0 ACT1 ACT0 — — — bit 15 bit 8 R/W R/W R/W R/W R/W R/W R/W R/W PGA1 PGA0 CF_C CF_B CF_A ABSOLUTE PHASE CREEP bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 13-15 APP: Apparent Power Calculation Mode Bits (not implemented) bit 11-12 ACT: Active Power Calculation Mode Bits (not implemented) bit 8-10 Unimplemented: Read as ‘0’ bit 6-7 PGA: PGA Bits (not implemented) bit 3-5 CF Phase y: Active Energy CF Phase Enable Bits 1 = Enabled to be accumulated into the total energy registers or CF pulse output 0 = Disabled and is not acculated into the total energy registers or CF pulse output bit 2 Absolute: Positive Only Energy Accumulation Mode 1 = Positive Energy Only 0 = Both negative and positive energy accumulated (negative energy is subtracted) bit 1 Phase: The Phase Bit 1 = Single Point Phase Correction 0 = Multi-Point Phase Correction (future) bit 0 CREEP: No-Load Threshold Bit 1 = Enabled 0 = Disabled DS51884A-page 20 © 2009 Microchip Technology Inc. Calculation and Register Description 3.4.2 STATUS1 Register REGISTER 3-2: Name STATUS1 REGISTER Bits Address Cof STATUS1 16 0x004 R The STATUS1 register contains the operational status of the energy meter. The bit functions are defined below. U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0 — — — — — — — — bit 15 bit 8 U-0 U-0 U-0 U-0 U-0 R U-0 U-0 — — — — — PHA_S — — bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15-3 Unimplemented: Read as ‘0’ bit 2 PHA_S: Phase A Sign Bit. This is the sign bit of raw active power before absolute value taken (if enabled, see MODE1 bits). Negative active power, this may indicate the CT is wired in backwards 1= 0= bit 1-0 Operation Normal Unimplemented: Read as ‘0’ © 2009 Microchip Technology Inc. DS51884A-page 21 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4.3 CAL_CONTROL Register REGISTER 3-3: CAL_CONTROL Register Name Bits Address Cof CAL_CONTROL 16 0x008 R/W This is the calibration mode control register. Bit 0 enables calibration mode. When bit 1 is set high, the energy accumulation registers are updated for LINE_CYC line cycles. After this time, bit 1 is set low by the PIC18F85J90 and the update of the energy accumulation registers will stop. This allows the calibration software to set bit 0, clear the registers, set bit 1, and then start reading the energy accumulation registers as well as this register to check the status of bit 1. When bit 1 goes low, then LINE_CYC lines cycles have passed and the energy accumulation registers are final. Note that bit 0 takes effect immediately and bit 1 will take effect on the very next line cycle. When bit 1 goes low, all energy accumulation registers will be ready to read. While in calibration mode, those registers that are used as part of the meter calibration and normally dependent on calibration registers will not be dependent while in calibration mode. For example, PHA_W_RAW is not dependent on PHA_W_OFF in calibration mode. U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0 — — — — — — — — bit 15 bit 8 U-0 U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-0 — — — — — Reserved CAL_Update Cal_Mode bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15-3 Unimplemented: Read as ‘0’ bit 2 Reserved: bit 1 CAL_UPDATE: Calbration Update Bit Power and energy registers updated for LINE_CYC line cycles when set. Bit must be set for registers to begin updating, which starts on the next line cycle after bit is set. 1 = When CAL_MODE bit is set, set this bit to enable update of power and energy registers starting on next line cycle 0 = When CAL_MODE bit is set and this bit has been set, this bit will be cleared after LINE_CYC line cycles. At that point, all registers will be updated, and no further updates will be done until this bit is set again or CAL_MODE bit is cleared bit 0 CAL_MODE: Calibration Mode Bit This bit enables calibration mode. 1 = Calibration Mode Enabled 0 = Calibration Mode Disabled DS51884A-page 22 © 2009 Microchip Technology Inc. Calculation and Register Description 3.4.4 LINE_CYC REGISTER 3-4: LINE_CYC REGISTER Name Bits Address Cof LINE_CYC 16 0x00A R/W Number of line cycles as a power of two. A setting of 0 indicates 20 or 1 line cycle. A setting of 1 is 2 line cycles (21), a setting of 2 is 4 lines cycles (22), up to a setting of 8 which is 256 line cycles. When written, this register will not take effect until the previous number of line cycles has been acquired. 3.4.5 LINE_CYC_CNT REGISTER 3-5: LINE_CYC_CNT REGISTER Name Bits Address Cof LINE_CYC_CNT 16 0x00C R This register counts from 0 and finishes at 2 (LINE_CYC) -1 and then re-starts at 0, where LINE_CYC represents the value in the LINE_CYC register. 3.4.6 PHA_W_RAW REGISTER 3-6: PHA_W_RAW REGISTER Name Bits Address Cof PHA_W_RAW 48 0x064 R These registers are the raw phase A active power as it represents the sum of each phase y current A/D value times phase y voltage A/D value results over LINE_CYC line cycles (each line cycle has 128 results). Each current times voltage multiplication results in a 32-bit word. There are up to 256 line cycles with each line cycle being 128 results and each result being 32-bit. Thus, a 48-bit register is needed. This is the register to be read during calibration for calculating the offset and gain values associated with active phase y power, PHy_W_OFF, PHy_W_GAIN, and PHy_W_GLSB. These registers are overwritten every line cycle, however if calibration is enabled, updates will stop once LINE_CYC line cycles have elapsed. 3.4.7 PHA_W REGISTER 3-7: PHA_W REGISTER Name Bits Address Cof PHA_W 32 0x076 R These registers are the value for phase A active power. The goal of calibration is to get these registers values to equal X 0.1 mW/LSB. When displaying the active power for phase y, simply display the value in these registers with the decimal point one digit in from the right, in milli-watts. (Note this decimal point location, or LSB resolution of 0.1 mW, is specific for the 5(10)A, 220V rating that this meter is designed for). This register is overwritten every LINE_CYC line cycles (written only once if calibration is enabled). © 2009 Microchip Technology Inc. DS51884A-page 23 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4.8 PHA_VAR_RAW (NOT IMPLEMENTED) REGISTER 3-8: PHA_VAR_RAW REGISTER Name Bits Address Cof PHA_VAR_RAW 48 0x0A0 R This is the raw phase A reactive power. This is the register to be read during calibration for calculating the gain values associated with reactive phase y power, PHA_VAR_GAIN and PHA_VAR_GLSB. This register is overwritten every LINE_CYC line cycles (written only once if calibration is enabled). NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.4.9 PHA_VAR (NOT IMPLEMENTED) REGISTER 3-9: PHA_VAR REGISTER Name Bits Address Cof PHA_VAR 32 0x0B2 R This is the value for phase A reactive power. The goal is to get this value to equal X VAR/LSB. This is done with the PHA_VAR_GLSB registers. When displaying the reactive power for phase A, simply display the value in these registers with the decimal point one digit in from the right, in milli-volt-amperes-reactive. (Note this decimal point location, or LSB resolution of 0.1 mVAR, is specific for the 5(10)A, 220V rating that this meter is designed for). This register is overwritten every LINE_CYC line cycles (written only once if calibration is enabled). NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.4.10 PERIOD REGISTER 3-10: PERIOD REGISTER Name Bits Address Cof PERIOD 32 0x0C0 R This 32-bit register represents the total number of clock ticks that elapsed over the most recent LINE_CYC line cycles. Each LSB represents 1.6 us with a 40 MHz clock on the microcontroller. This register is overwritten every LINE_CYC line cycles (written only once if calibration is enabled). DS51884A-page 24 © 2009 Microchip Technology Inc. Calculation and Register Description 3.4.11 ENERGY_W_ REGISTER 3-11: ENERGY_W_ REGISTERS Name Bits Address Cof ENERGY_W 64 0x0C4 R ENERGY_W_Z 64 0x0CC R ENERGY_W_L 32 0x0DA R ENERGY_W_L_RAW 48 0x0D4 R These four registers represent the total active energy accumulated. The ENERGY_W_L_RAW register is the total active energy accumulated over the previous LINE_CYC line cycles. Accumulation is done every line cycle and is: EQUATION 3-1: PHA_W_GAIN ENERGY_W = ENERGY_W + ( PHA_W_RAW + PHA_W_OFF ) • ⎛ ------------------------------------⎞ ⎝ ⎠ 32768 PHB_W_GAIN + ( PHB_W_RAW + PHB_W_OFF ) • ⎛⎝ ------------------------------------⎞⎠ 32768 PERIOD PHC_W_GAIN ⎛ + ( PHC_W_RAW + PHC_W_OFF ) • -------------------------------------⎞ • ----------------------⎝ ⎠ 65536 32768 Where: PERIOD = the period (in 1.6 µs clock ticks) for the most recent line cycle. During calibration, ENERGY_W_Z, ENERGY_W, and ENERGY_W_L_RAW will all have the same value. Also, during calibration, the PHA_W_OFF register additions are skipped and the PHA_W_GAIN values are all set to their default value of 0x4000 (16,384). The ENERGY_W_L_RAW register is the register that should be read when calibrating CFNUM and CFDEN. This register is updated every line cycle (updating ends once LINE_CYC line cycles have passed if calibration is enabled). © 2009 Microchip Technology Inc. DS51884A-page 25 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4.12 ENERGY_VA_ REGISTER 3-12: ENERGY_VA_ REGISTERS Name Bits Address Cof ENERGY_VA 64 0x0DE R ENERGY_VA_Z 64 0x0E6 R ENERGY_VA_L 32 0x0F4 R ENERGY_VA_L_RAW 48 0x0EE R These four registers represent the total apparent energy accumulated so far. Energy from each LINE_CYC line cycles is: EQUATION 3-2: ENERGY_VA = ENERGY_VA + ( PHA_I_RMS_RAW ---------------------------------------⎞ • PHA_V_RMS_RAW ) • ⎛⎝ PHA_VA_GAIN ⎠ 32768 + ( PHB_I_RMS_RAW ---------------------------------------⎞ • PHB_V_RMS_RAW ) • ⎛⎝ PHB_VA_GAIN ⎠ 32768 + ( PHC_I_RMS_RAW ---------------------------------------⎞ • PHC_V_RMS_RAW ) • ⎛⎝ PHC_VA_GAIN ⎠ 32768 PERIOD • 128 • -------------------------------------65536 Where: PERIOD = the period (in 1.6 µs clock ticks) for the most recent LINE_CYC line cycles. Note that during calibration, this value, ENERGY_VA_Z, and ENERGY_VA_L_RAW will all have the same value. This register is updated every LINE_CYC line cycles (updating ends after first update if calibration is enabled). 3.4.13 ENERGY_VAR (NOT IMPLEMENTED) REGISTER 3-13: ENERGY_VAR REGISTER Name Bit Address Cof ENERGY_VAR 64 0x100 R ENERGY_VAR_Z 64 0x108 R ENERGY_VAR_L 32 0x116 R ENERGY_VAR_L_RAW 48 0x110 R NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. DS51884A-page 26 © 2009 Microchip Technology Inc. Calculation and Register Description 3.5 CALIBRATION REGISTERS The calibration register set contains all of the offset, gain, LSB adjust, phase delay, and calibration output pulse adjustment settings. The values to be placed in these configuration registers come during meter calibration and can be automatically generated using the “3-Phase Meter Calibration Software” available for download on Microchip’s website. 3.5.1 PHA_DELAY REGISTER 3-14: PHA_DELAY REGISTER Name Bit Address Cof PHA_DELAY 8 0x140 R/W Phase A delay, signed 8-bit value, ±2.8125 degrees (±130 µs for 60 Hz, ±156 µs for 50 Hz) 3.5.2 PHA_W_OFF REGISTER 3-15: PHA_W_OFF REGISTER Name Bits Address Cof PHA_W_OFF 32 0x170 R/W Phase A active power offset (this is straight offset, not the square as with voltage and current). A much larger value is need because the power is a running sum. This is a 32-bit signed value. 3.5.3 PHA_W_GAIN REGISTER 3-16: PHA_W_GAIN REGISTER Name Bits Address Cof PHA_W_GAIN 16 0x17C R/W Phase A active power gain so that all results can be calibrated to produce equal CF pulses/watt-hour. The signed 16-bit number produces a change in the PHA_W_RAW value before being added to the energy registers. A value of 32,767 represents a 99.9939% increase while a value of 8192 represents a decrease of 50%. 3.5.4 PHA_W_GLSB REGISTER 3-17: PHA_W_GLSB REGISTER Name Bits Address Cof PHA_W_GLSB 16 0x182 R/W Phase A active power gain to produce X W/LSB. The value is always less than one (for example, 32,767 = 0.9999695). 3.5.5 PHA_VAR_GAIN (NOT IMPLEMENTED) NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.6 PHA_VAR_GLSB (NOT IMPLEMENTED) NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. © 2009 Microchip Technology Inc. DS51884A-page 27 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.5.7 ENERGY_W_GLSB (NOT IMPLEMENTED) REGISTER 3-18: ENERGY_W_GLSB REGISTER Name Bits Address Cof ENERGY_W_GLSB 16 0x1A0 R/W NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.8 ENERGY_VAR_GLSB (NOT IMPLEMENTED) REGISTER 3-19: ENERGY_VAR_GLSB REGISTER Name Bits Address Cof ENERGY_VAR_GLSB 16 0x1A4 R/W NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.9 CREEP_THRESH (NOT IMPLEMENTED) REGISTER 3-20: CREEP_THRESH REGISTER Name Bits Address Cof CREEP_THRESH 32 0x1A6 R/W NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.10 CF_PULSE_WIDTH REGISTER 3-21: CF_PULSE_WIDTH REGISTER Name Bits Address Cof CF_PULSE 8 0x1AA R/W Defines CF pulse width from 0 to 255. Length of width is value * 8 * (1/LINEFREQ) / 128) ms. A maximum of 0.266 seconds for 60 Hz and 0.319 seconds for 50 Hz. If the value is 0, no CF pulse is produced. 3.5.11 CFDEN REGISTER 3-22: CFDEN REGISTER Name Bits Address Cof CF_DEN 16 0x1AC R/W 8-bit signed value. Represents the number of shifts for active power energy register ENERGY_W_L before CFNUM is applied. 3.5.12 CFNUM REGISTER 3-23: CFNUM REGISTER Name Bits Address Cof CF_NUM 16 0x1AE R/W Active power gain to produce a specified pulses per watt-hour. The value is always less than one (for example, 32,767 = 0.9999695). DS51884A-page 28 © 2009 Microchip Technology Inc. Calculation and Register Description 3.5.13 MODE1_DEF REGISTER 3-24: MODE1_DEF REGISTER Name Bits Address Cof MODE1_DEF 16 0x1B0 R/W Mode 1 default power-up settings. On power-up, this register will be read and placed into the MOD1 register. 3.5.14 PHA_CAL_Status Register REGISTER 3-25: PHA_CAL_STATUS REGISTER Name Bits Address Cof PHA_CAL_STATUS 16 0x1B2 R/W The PHASE_A CAL_STATUS registers holds the calibration status for each individual phase. Broken down by phase, these are the values that can be calibrated. Each bit has the status of ‘0’ = Not calibrated, ‘1’ = Calibrated. R/W-0 R/W-0 R/W-0 DELAY I_RMS_OFF V_RMS_OFF R/W-0 R/W-0 I_RMS_GAIN V_RMS_GAIN R/W-0 R/W-0 R/W-0 I_RMS_GLSB V_RMS_GLSB W_OFF bit 15 bit 8 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0 W_GAIN W_GLSB VA_GAIN VA_GLSB VAR_GAIN VAR_GLSB — STANDARD bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15-2 CALIBRATION REGISTER: Calibration register status for offset, gain, LSB, and phase delay 1 = This register has been calibrated 0 = This register is NOT calibrated bit 1 Unimplemented: Read as ‘0’ bit 0 STANDARD: Standard Phase Bit 1 = Standard Phase is THIS phase 0 = This phase is NOT the standard phase 3.5.15 STANDARD_W_RAW REGISTER 3-26: STANDARD_W_RAW REGISTER Name Bits Address Cof STANDARD_W_RAW 48 0x1B8 R/W This calibration register holds the energy value that was accumulated during the standard phase measurement under calibration configuration C1. The software will read this value when performing phase to phase gain matching during active power calibration. © 2009 Microchip Technology Inc. DS51884A-page 29 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 30 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Chapter 4. Meter Protocol and Timings 4.1 PIC18F85J90 PROTOCOL The RS-232 port of the PIC18F85J90 is used to access the register map of the meter. In addition to reading and writing of registers, there are also dedicated commands for clearing calibration registers, loading calibration registers, and storing calibration registers to flash. The first byte RS-232 data is an ASCII character that represents the command, and each command has a specific protocol. Each command ends with the ASCII character “X”. 4.1.1 Command Description The first byte of the data (byte 0) is an ASCII character E, L, S, W and R. • • • • • E - Echo All Data Received (ECHO) L - Load Calibration Registers from Flash (LOAD) S - Store Calibration Registers (STORE) W - Write Bytes (WRITE) R - Read Bytes (READ) The last data byte is always an 'X' character. All commands will result in the same command being returned. The exception is the 'R' (read) command which will return additional data in lieu of the number of bytes. 4.1.1.1 “E” ECHO: - ECHO ALL DATA RECEIVED Example: 'EABCDEFGHIJKLMNOPQRSTUVWYZ1234567890X'. Returns: 'EABCDEFGHIJKLMNOPQRSTUVWYZ1234567890X'. 4.1.1.2 “L” LOAD: LOAD CALIBRATION REGISTERS FROM FLASH. Example: 'LX'. Returns: 'LX'. This command is used to verify that the calibration values were actually written into flash (or EEPROM). Once the software executes a 'SX' command, it should verify that the values were stored by issuing an 'LX' command and then reading the calibration values with a 'R' command. 4.1.1.3 “S” STORE: STORE CALIBRATION REGISTERS INTO FLASH Note that the store command will write all calibration values to internal EEPROM and this function takes some time. During that time, the meter is not functional. The store command should only be used after calibrating the meter and not while it is in actual use. Example: 'SX'. Returns: 'SX'. © 2009 Microchip Technology Inc. DS51884A-page 31 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 4.1.1.4 “W” WRITE: WRITE STARTING AT SPECIFIED ADDRESS Write specified bytes. Example: 'W030000102030405060708090A0B0C0D0E0FX'. Returns: 'W030000102030405060708090A0B0C0D0E0FX'. Note: If number of data characters is odd, the last character (the one just prior to the 'X') will be ignored. 3 Address Bytes (ASCII) Command Byte 7 6 5 4 3 2 1 7 0 6 5 4 3 2 1 0 7 6 5 ASCII Data 7 6 5 4 3 2 TABLE 4-1: 1 0 3 2 1 0 7 6 5 4 3 2 1 0 “X” (ASCII) 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 WRITE COMMAND EXAMPLES Description WRITE of 255d to PHA_W_OFF Register FIGURE 4-1: 4 Command ASCII Command Hex “W 170 00 F F X” 57 31 37 30 30 30 46 46 58 WRITE Command Protocol. 4.1.1.5 “R” READ: READ STARTING AT SPECIFIED ADDRESS Example: 'R03010X' (read 16 bytes starting at address 30h). Returns: 'R030000102030405060708090A0B0C0D0E0FX' Note: For 16 bytes, there are 32 ASCII characters returned or two characters per byte. 3 Address Bytes (ASCII) Command Byte 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 # Bytes to Read (2 Bytes ASCII) 7 6 5 4 TABLE 4-2: 3 2 1 0 7 6 5 4 3 2 3 2 1 0 1 0 7 6 5 4 3 2 1 0 1 0 7 6 5 4 3 2 READ COMMAND EXAMPLES READ on ENERGY_W_L_RAW Register DS51884A-page 32 4 “X” (ASCII) DESCRIPTION FIGURE 4-2: 5 COMMAND ASCII COMMAND HEX “R 0D4 06 X” 52 00 44 34 30 36 58 Read Command Protocol. © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Chapter 5. Meter Calibration 5.1 CALIBRATION OVERVIEW The method to calculate the values for the calibration registers in “Chapter 3. “PIC18F85J90 Calculation and Register Description” are described in this chapter. These registers are used to remove offset, set gain and phase adjustments, and include (units)/LSB adjustments for the meter outputs. The calibration flow charts and equations presented in this section are all automated using Microchip’s “Single Phase Energy Meter Calibration Software”, downloadable from Microchip’s energy metering web site. The following calibration routines are described in this chapter. • Active Power Calibration • RMS Current and Voltage Calibration • Apparent Power Calibration The method of calibrating these three separate signal flows can be combined into 4 different calibration configurations. These configurations consist of supplying specific voltages and currents at specific phase angles to the meter during calibration. Depending on the accuracy and meter type, not all 4 calibration configurations are required to fully calibrate a meter. In some cases only a single point calibraton is required. The software allows individual configurations to be turned on or off when going through the calibration flow. © 2009 Microchip Technology Inc. DS51884A-page 33 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.1.1 IB, VB, Meter Constant and Calibration Configurations Calibration of the single phase energy meter involves up to four different test configurations. For example, meter design example 5(10)A, IB = 5, IMAX = 10A. The four different test configuraitons are listed here: : 1. Configuration C1: Gain - Basic voltage VB and basic current IB at a power factor of 1. For example, 220V and 5A. 2. Configuration C2: Phase - Basic voltage VB and basic current IB at a power factor of 0.5. 3. Configuration C3: Offset - Basic voltage VB and 1/100 of IB at a power factor of 1. For example, 220V and 50 mA. 4. Configuration C4: Mid-range - 1/10 of Basic voltage VB and 1/10 of IB at a power factor of 1. For example, 22V and 1A. These calibration configurations are typically steps in a sequence. Almost always, configuration C1 is the most important and must be done first. The other configurations require values obtained from configuration C1, but are not dependent on values obtained from the other configurations. In other words, C1 is probably the first step, while the other configurations can be done in any order, and are optional depending on the meter type. The meter constant is typically given in units of impulses per kilo-watt hour. As an example, the calibration output frequency of CF, METER_CONSTANT = 3200 imp/kWh or 6400 imp/kWh. DS51884A-page 34 © 2009 Microchip Technology Inc. Meter Calibration 5.2 ACTIVE POWER SIGNAL FLOW AND CALIBRATION 5.2.1 Active Power Calibration Overview and Signal Path The active power signal flow leads to the CF output pulse frequency, which is proportional to the total active power being measured by the energy meter, the active energy registers, which are in units of kWh and can also be phase gated using the MODE1 register, and the active power output register (PHA_W). Table 5-1 represents the registers being set during active power calibration. TABLE 5-1: CALIBRATION REGISTERS GENERATED THROUGH THIS ROUTINE Register Name Equations Configurations Needed CFDEN Section 5.3.3 C1 ONLY CFNUM Section 5.3.3 C1 ONLY PHA_DELAY Section 5.3.5 C1, C2 PHA_W_OFF Section 5.3.7 C1, C3 PHA_W_GLSB Section 5.3.3 C1 ONLY ENERGY_W_GLSB Not Implemented C1 ONLY ADC NOTE 1 CURRENT PHy_DELAY:8 Σ X |X| Φ ADC PHA_W_OFF:32 VOLTAGE PHA_W_GLSB:16 MCP3909 PHA_W_RAW:48 Digital to Frequency Converter kW X PHA_W:32 ENERGY_W_GLSB:16 (NOT IMPLEMENTED) CFNUM:16 / CFDEN:8 PERIOD:16 (INTERNAL REGISTER) ENERGY_W_L:32 ENERGY_W_L_RAW:48 ENERGY_W_Z:64 ENERGY_W:64 FIGURE 5-1: kWh X X Note 1: CF OUTPUT FREQUENCY! This absolute value is controlled by the MODE1 register. See Section 3.4.1 for more information. Active Power Signal Path showing Output and Calibration Registers. © 2009 Microchip Technology Inc. DS51884A-page 35 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3 RMS CURRENT, RMS VOLTAGE, APPARENT POWER SIGNAL FLOW AND CALIBRATION 5.3.1 RMS Current, RMS Voltage, and Apparent Power Overview and Signal Path The RMS current and voltage outputs require a two point calibration reading at configurations C1 and C4. The automated USB software performs these calibrations suggested on the calibration values entered in the text boxes on the meter design window. The following table represents the registers being set for RMS Current and Voltage calibration. TABLE 5-2: RMS CURRENT, RMS VOLTAGE, AND APPARENT POWER CALIBRATION REGISTERS Register Equation Configurations Needed PHA_V_RMS_OFF Section 5.3.9 C1, C4 PHA_I_RMS_OFF Section 5.3.9 C1, C4 PHA_V_RMS_GLSB Section 5.3.9 C1, C4 PHA_I_RMS_GLSB Section 5.3.9 C1, C4 PHA_VA_GLSB Section 5.3.3 C1 ONLY ENERGY_VA_GLSB Not Implemented C1 ONLY PHA_I_RMS_OFF:16 ADC Σ X2 CURRENT PHA_I_RMS_RAW:16 X A PHA_I_RMS:16 RMS Current PHA_I_RMS_GLSB:16 PHA_V_RMS_OFF:16 ADC Σ X2 VOLTAGE PHA_V_RMS_GLSB:16 X V PHA_V_RMS:16 RMS Voltage MCP3909 PH_V_RMS_RAW:16 X PHA_VA_RAW X X ENERGY_VA_GLSB:16 PHA_VA_GAIN:16 ENERGY_VA_L:32 kVAh X X ENERGY_VA_L_RAW:48 ENERGY_VA_Z:64 ENERGY_VA:64 FIGURE 5-2: DS51884A-page 36 kVA PERIOD:32 (INTERNAL REGISTER) PHA_VA_GLSB:16 Apparent Power PHA_VA:32 RMS Current, Voltage, and Apparent Power Flow. © 2009 Microchip Technology Inc. Meter Calibration 5.3.2 Main Flow Chart for Calibration Configuration C1 Begin Calibration Set MODE1 register bits and LINE_CYC register Put meter in Calibration Configuration C1 (VB and IB at PF=1) Enable Calibration Mode by setting bit 0 and 1 of CAL_CONTROL register to 1 Is CAL_MODE bit 1 low ? NO YES Read contents of ENERGY_W_RAW, PHA_W_RAW Calculate & Write CFNUM, CFDEN, PHA_W_GLSB, and PHA_VA_GLSB contents based equations in Section 5.3.3 End FIGURE 5-3: Main Calibration Flow Chart. © 2009 Microchip Technology Inc. DS51884A-page 37 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.3 Equations for Configuration C1 Calibration The following equations represent the proper method for calculating the calibration and correction factors after configuration C1. The PC calibration software handles these calculations automatically. The following equations only apply when calibrating a standard phase. The first four equations apply for calculating the proper output frequency of the CF output. See Figure 5-3 for meter input conditions. EQUATION 5-1: Meter Constant V B I B CF_IMP_S = ------------------------------------- • -----------1000 3600 EQUATION 5-2: LINE_CYC_NUM = 2 LINE_CYC EQUATION 5-3: 32 2 • CF_IMP_S LINE_CYC_NUM • 256 LOG ---------------------------------------- ---------------------------------------------------------Line Freq • 128 ENERGY_W_L_RAW CFDEN = --------------------------------------------------------------------------------------------------------------------------- + 1 LOG(2) Note: Convert to 8-bit signed integer for compatibility with PIC18F2520 register and firmware calculations. EQUATION 5-4: 32 • CF_IMP_S⎞ ⎛ 2---------------------------------------⎝ Line Freq • 128 ⎠ CFDEN CFNUM = ---------------------------------------------------------------- • 2 • 32768 ENERGY_W_L_RAW -⎞ ⎛ --------------------------------------------------------⎝ LINE_CYC_NUM • 256⎠ Note: Convert to 16-bit signed integer for compatibility with PIC18F2520 register and firmware calculations. The gain matching registers for the standard phase need to be set to the following values when calibrating a standard phase: EQUATION 5-5: PHA_W_GAIN = 16, 384 The following equations apply for calculating the proper GLSB registers when calibrating both a standard phase, and a non-standard phase. See flow chart for meter input conditions. DS51884A-page 38 © 2009 Microchip Technology Inc. Meter Calibration EQUATION 5-6: PLSB = Value from Table 5-4 based on VB and IMAX values EQUATION 5-7: B • I B⎞ ⎛V ---------------⎝ PLSB ⎠ PHA_W_GLSB = ------------------------------------------------------------- • 32768 PHA_W_RAW -⎞ ⎛ -----------------------------------------------------⎝ 64 • LINE_CYC_NUM⎠ Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations. The calculation for PHA_VA_GLSB is identical except that it uses the PHA_VA_RAW register instead of PHA_W_RAW: EQUATION 5-8: V B • I B⎞ ⎛ ---------------⎝ PLSB ⎠ PHA_VA_GLSB = ------------------------------------------------------------- • 32768 PHA_VA_RAW -⎞ ⎛ -----------------------------------------------------⎝ 64 • LINE_CYC_NUM⎠ Note: © 2009 Microchip Technology Inc. Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations. DS51884A-page 39 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.4 Configuration C2 Flow Chart - Phase Delay Set MODE1 register bits and LINE_CYC register Put meter in Calibration Configuration C2 (VB and IB at PF=0.5) Enable Calibration Mode by setting bit 0 and 1 of CAL_CONTROL reg to 1 Is CAL_MODE bit 1 low? NO YES Read contents of PHA_W_RAW register Read contents of STAND_W_RAW register Calculate & Write PHA_DELAY calibration register contents based on equations in Section 5.3.5 End This Phase FIGURE 5-4: DS51884A-page 40 Configuration C2 Flow Chart. - Phase Delay. © 2009 Microchip Technology Inc. Meter Calibration 5.3.5 Configuration C2 Equations - Phase Delay For active power the following equations apply for calculating the time shift delay for a given phase. EQUATION 5-9: W1 = PHA_W_RAW @ PF = 1, Configuration C1 EQUATION 5-10: W2 = PHA_W_RAW @ PF = 0.5, Configuration C2 EQUATION 5-11: LINE_CYC_NUM_1 = LINE_CYC_NUM @ PF = 1, Configuration C1 EQUATION 5-12: LINE_CYC_NUM_2 = LINE_CYC_NUM @ PF = 0.5, Configuration C2 EQUATION 5-13: 180 – 1 W2 ⁄ LINE_CYC_NUM2 COS ⎛⎝ -----------------------------------------------------------⎞⎠ × --------- – 60 W1 ⁄ LINE_CYC_NUM1 PI PHA_DELAY = ------------------------------------------------------------------------------------------------------------------- • 128 2.8125 Note 1: 2: © 2009 Microchip Technology Inc. Convert to 8-bit signed integer for compatibility with PIC18F2520 register and firmware calculations. Since 60 degrees (default) is being subtracted from the measured quantity, the current should lag the voltage under configuration C2. DS51884A-page 41 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.6 Configuration C3 Flow Chart - Offset Set MODE1 register bits LINE_CYC register (suggest 256 Line Cycles) Put meter in Calibration Configuration C3 (VB and 1/100 IB at PF=1) Enable Calibration Mode by setting bit 0 and 1 of CAL_CONTROL register to 1 Is CAL_MODE bit 1 low ? NO YES Read contents of ENERGY_W_L_RAW Register Calculate & Write PHA_W_OFF register contents based on equations in Section 5.3.7 End of This Phase FIGURE 5-5: DS51884A-page 42 Configuration C3 Flow Chart - Active Power Offset . © 2009 Microchip Technology Inc. Meter Calibration 5.3.7 Configuration C3 Equations - PA Offset For active power offset, the following equations apply for a given phase. W1 corresponds to the PHA_W_RAW register obtained during configuration C1. LINE_CYC_W1 corresponds to the LINE_CYC during this measurement. W2 corresponds to the PHA_W_RAW register obtained during configuration C3. LINE_CYC_W2 is the LINE_CYC during this measurement. EQUATION 5-14: W1 = PHA_W_RAW @ I B, Configuration C1 EQUATION 5-15: W2 = PHA_W_RAW @ 1/100 I B , Configuration C3 EQUATION 5-16: LINE_CYC_NUM_1 = LINE_CYC_NUM in Configuration C1 EQUATION 5-17: LINE_CYC_NUM_2 = LINE_CYC_NUM in Configuration C3 EQUATION 5-18: W1 ⁄ 100 W2 PHA_W_OFF = ------------------------------------------------------ – -----------------------------------------------------LINE_CYC_NUM_W1 LINE_CYC_NUM_W2 Note: Convert to 32-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations The PHA_W_OFF registers hold a signed 32-bit value. However, the math in the microcontroller could overflow for some values near the limits. Limit check the resulting value to make sure the value is between -2,130,706,432 and 2,130,706,431 (inclusive). Values less than -2,130,706,432 should be set to -2,130,706,432 while values greater than 2,130,706,431 should be set to 2,130,706,431. If the value is limited, the user should be aware that the meter could not completely correct the offset. It is expected that this value will always be negative. If the value is positive, it may indicate that the user has not provided a large enough number of line cycles for configuration C4 (where the number of line cycles should be set to a larger value such as 64 or 128). This may also be true if offset does not contribute a large enough percentage to W2 (for example, 10% to 50% or more). © 2009 Microchip Technology Inc. DS51884A-page 43 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.8 Configuration C4 Flow Chart - Mid-Range Set MODE1 register bits and LINE_CYC register Put meter in Calibration Configuration C4 (VB and 1/10 IB at PF=1) Is CAL_MODE bit 1 low? NO YES Read contents of PhA_I_RMS_RAW2 and PhA_V_RMS_RAW2 registers (referred to as IR2 and VR2 in equation set) Fetch values from Calibration Configuration C1 Calculate & Write PHA_I_RMS_OFF, PHA_V_RMS_OFF, PHA_I_RMS_GLSB, PHA_V_RMS_GLSB, calibration register contents based equations in Section 5.3.9 End of This Phase FIGURE 5-6: DS51884A-page 44 Flow Chart for RMS Calibration. © 2009 Microchip Technology Inc. Meter Calibration 5.3.9 Equations for RMS Calibration The following equations represent the proper method for calculating the calibration and correction factors for the RMS current and RMS voltage. The PC calibration software handles these calculations automatically. Typically, the VMIN and IMIN voltages and currents will be 1/10 of the VB and IB values. For RMS Offset, the following equations apply: EQUATION 5-19: IR1 = PHA_I_RMS_RAW2 @ I B , Configuration C1 EQUATION 5-20: VR1 = PHA_V_RMS_RAW2 @ I B , Configuration C1 EQUATION 5-21: IR2 = PHA_I_RMS_RAW2 @ I B , Configuration C4 EQUATION 5-22: VR2 = PHA_V_RMS_RAW2 @ I B , Configuration C4 EQUATION 5-23: I B @ C1 I G = -------------------I B @ C4 EQUATION 5-24: V B @ C1 V G = ---------------------V B @ C4 EQUATION 5-25: IR1 – IR2-⎞ ⎛ --------------------------– IR 2 ⎝ IG • IG – 1⎠ PHA_I_RMS_OFF = -----------------------------------------------65536 Note: © 2009 Microchip Technology Inc. Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations DS51884A-page 45 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design EQUATION 5-26: VR1 – VR2-⎞ ⎛ -----------------------------– VR 2 ⎝ VG • VG – 1⎠ PHA_V_RMS_OFF = ----------------------------------------------------65536 Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations For RMS LSB correction, the following equations apply: EQUATION 5-27: ILSB = Value from Table 5-3 based on IMAX value EQUATION 5-28: VLSB = Value from Table 5-5 based on VB value EQUATION 5-29: IB ⎞ ⎛ -----------⎝ ILSB⎠ PHA_I_RMS_GLSB = ------------------------------------------------------------------------ • 32768 IR 1 -------------- + PHA_I_RMS_OFF 65536 Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations EQUATION 5-30: VB ⎞ ⎛ ------------⎝ VLSB⎠ PHA_V_RMS_GLSB = -------------------------------------------------------------------------- • 32768 VR 1 -------------- + PHA_V_RMS_OFF 65536 Note: DS51884A-page 46 Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations © 2009 Microchip Technology Inc. Meter Calibration TABLE 5-3: CURRENT RESOLUTION TABLE Maximum Current Less than or Equal To (A) 8.1 81 810 8,100 TABLE 5-4: LSB Resolution (A) 0.001 0.01 0.1 1 POWER RESOLUTION TABLE Maximum Wattage Less than or Equal To (W - IMAX times VCAL) 125 1,250 12,500 125,000 1,250,000 12,500,000 TABLE 5-5: LSB Resolution (mW) 0.001 0.01 0.1 1 10 100 VOLTAGE RESOLUTION TABLE Maximum Voltage Less than or Equal To (V) ALL LSB Resolution (V) 0.1 Note that the decimal point location in the reading frame is updated whenever the VCAL, ICAL, or IMAX values are changed. © 2009 Microchip Technology Inc. DS51884A-page 47 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 48 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Appendix A. Schematic and Layouts A.1 INTRODUCTION This appendix contains the following schematics and layouts of the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design: • • • • • • • Board Schematic - Page 1 Board Schematic - Page 2 Board Schematic - Page 3 Board - Top Layer and Silk-screen Board - Top Copper Board - Bottom Layer and Silk-screen Board - Bottom Copper © 2009 Microchip Technology Inc. DS51884A-page 49 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design BOARD SCHEMATIC - PAGE 1 M A.2 DS51884A-page 50 © 2009 Microchip Technology Inc. Schematic and Layouts BOARD SCHEMATIC - PAGE 2 M A.3 © 2009 Microchip Technology Inc. DS51884A-page 51 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design BOARD SCHEMATIC - PAGE 3 M A.4 DS51884A-page 52 © 2009 Microchip Technology Inc. Schematic and Layouts A.5 BOARD - TOP LAYER AND SILK-SCREEN DANGER HIGH VOLTAGE MCP3909 / PIC18F85J90 SHUNT METER © 2009 Microchip Technology Inc. DS51884A-page 53 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design A.6 BOARD - TOP COPPER DS51884A-page 54 © 2009 Microchip Technology Inc. Schematic and Layouts A.7 BOARD - BOTTOM LAYER AND SILK-SCREEN DANGER HIGH VOLTAGE © 2009 Microchip Technology Inc. DS51884A-page 55 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design A.8 BOARD - BOTTOM COPPER DS51884A-page 56 © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Appendix B. Bill of Materials TABLE B-1: Qty BILL OF MATERIALS (BOM) Reference Description Manufacturer Part Number Murata Electronics® GRM188R71E104KA01D CAP 1.0UF 630V METAL POLYPRO EPCOS B32614A6105J008 CAP CER 10UF 6.3V X5R 0603 Murata Electronics GRM188R60J106ME47D C10 CAP 470UF 25V ELECT FC SMD Panasonic® - ECG EEE-FC1E471P 5 C11, C13, C14 C16, C17 CAP CER 47000PF 25V 10% X7R 0603 Murata Electronics GRM188R71E473KA01D 2 C15, C20 CAP CER 18PF 50V 5% C0G 0603 Murata Electronics GRM1885C1H180JA01D 4 C26, C28, C31, C35 CAP CER 6800PF 50V 5% C0G 1206 Murata Electronics GRM3195C1H682JA01D 1 D1 IRED 940NM TOP MNT SMD Sharp® Microelectronics GL100MN0MP 2 D2, D3 LED 1.6X0.8MM 625NM RED CLR SMD Kingbright Corporation APT1608EC 1 D4 DIODE ZENER 600W 15V 40A SMA ON Semiconductor® BZG03C15G 2 D5, D6 DIODE STD REC 1A 600V SMA ON Semiconductor MRA4005T3G 2 L1, L2 Chip Ferrite Beads / EMI Filters 150ohms 100MHz .3A Monolithic 1806 SMD Steward LI1806C151R-10 3 L3, L4, L5 Chip Ferrite Beads / EMI Filters 150ohms 100MHz .8A Monolithic 0805 SMD Steward LI0805H151R-10 1 LCD LCD Glass size 65.00 x 18.00 Xiamen Ocular Optics Co., Ltd. DP076P D09S24A4GV00LF 22 C1, C2, C3, C5, CAP CER .1UF 25V 10% X7R 0603 C6, C7, C9, C12, C18, C21, C22, C23, C24, C25, C27, C29, C30, C32, C33, C34, C36, C37 1 C4 2 C8, C19 1 1 J1 CONN DSUB RCPT 9POS STR PCB SLD FCI 1 J2 CONN POWERJACK MINI R/A T/H Switchcraft® RAPC722X 2 J3, J4 DO NOT INSTALL — — 1 MOV1 VARISTOR 275V RMS 20MM RADIAL EPCOS 1 P1 6 X 1 Header 2.54mm on center 6 mm/2.5mm Samtec 1 PCB RoHS Compliant Bare PCB, MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Microchip Technology Inc. 104-000130 10 R1-R10 RES 0.0 OHM 1/8W 5% 0805 SMD Rohm Co., Ltd MCR10EZHJ000 3 R11, R12, R13 RES 4.70K OHM 1/10W 1% 0603 SMD Rohm Co., Ltd MCR03EZPFX4701 3 R14, R15, R16 RES 1.00K OHM 1/10W 1% 0603 SMD Rohm Co., Ltd MCR03EZPFX1001 3 R17, R21, R36 RES 698 OHM 1/10W 1% 0603 SMD Rohm Co., Ltd MCR03EZPFX6980 1 R18 RES 470 OHM 1W 5% 2512 SMD Panasonic - ECG ERJ-1TYJ471U 2 R19, R20 RES 100 OHM 1/10W 1% 0603 SMD Rohm Co., Ltd MCR03EZPFX1000 1 R22 DO NOT INSTALL — — 1 R23 RES 10.0K OHM 1/10W 1% 0603 SMD Rohm Co., Ltd MCR03EZPFX1002 Note 1: S20K275E2 TSW-106-07-G-S The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. © 2009 Microchip Technology Inc. DS51884A-page 57 MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design TABLE B-1: Qty 2 BILL OF MATERIALS (BOM) (CONTINUED) Reference Manufacturer Part Number Vishay® 1206 Precision Thin Film Chip Resistors 1/4watt 332Kohms .1% 25ppm Intertechnology Inc. R37, R38 RES 1.00K OHM 1/8W 1% 0805 SMD Rohm Co., Ltd 2 R40, R43 RES 10.0 OHM 1/10W 1% 0603 SMD Rohm Co., Ltd MCR03EZPFX10R0 2 R41, R42 RES 1.0K OHM .1% 1/4W 0805 SMD Susumu Co Ltd RGH2012-2E-P-102-B 2 R24, R25 Description TNPW1206332KBETY MCR10EZHF1001 3 SW1, SW2, SW3 SWITCH TACT 6MM 230GF H=4.3MM Omron Electronics B3S-1002P 1 TP1 Wire Test Point 0.3" Length Component Corporation® PJ-202-30 1 U1 Sensors 3V 38 kHz Surface Mount Sharp Microelectronics GP1US301XP 1 U2 Energy Metering IC with SPI Interface and Active Power Pulse Microchip Technology Inc. MCP3909T-I/SS 1 U3 SPI Serial EEPROM Family Microchip Technology Inc. 25LC256-I/SN 2 U4, U7 PHOTOCOUPLER DARL OUT 4-SMD Sharp Microelectronics PC365NJ0000F 1 U5 n IC 3.3V 100MA LDO REG SOT-23-5 Texas Instruments Inc. TPS79133DBVR 1 U6 IC REG LDO 800MA 5.0V SOT-223 National Semiconductor LM1117MP-5.0/NOPB 1 U8 PIC18F Microcontroller with 32K bytes of Flash, 2048 bytes of RAM Microchip Technology inc. PIC18F85J90-I/PT 1 U9 MCP130 is a voltage supervisory device Microchip Technology Inc. MCP130T-270I/TT 1 U10 ±15kV ESD-Protected, RS-232 Transceivers Maxim MAX3323EEUE+ 1 X1 CRYSTAL 10.0000MHZ 10PF SMD Abracon™ Corporation ABM3B-10.000MHZ-10-1-U-T Note 1: The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. DS51884A-page 58 © 2009 Microchip Technology Inc. Bill of Materials NOTES: © 2009 Microchip Technology Inc. DS51884A-page 59 WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.com Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 India - Bangalore Tel: 91-80-3090-4444 Fax: 91-80-3090-4080 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Cleveland Independence, OH Tel: 216-447-0464 Fax: 216-447-0643 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara, CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 Taiwan - Hsin Chu Tel: 886-3-6578-300 Fax: 886-3-6578-370 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 03/26/09 DS51884A-page 60 © 2009 Microchip Technology Inc.