MCP6L2 and PIC18F66J93 Energy Meter Reference Design Users Guide

MCP6L2 and PIC18F66J93
Energy Meter
Reference Design
 2012-2013 Microchip Technology Inc.
DS52088B
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,
FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PIC32 logo, rfPIC, SST, SST Logo, SuperFlash
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,
MTP, SEEVAL and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of
Microchip Technology Inc. in other countries.
Analog-for-the-Digital Age, Application Maestro, BodyCom,
chipKIT, chipKIT logo, CodeGuard, dsPICDEM,
dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB
Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O,
Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA
and Z-Scale 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.
GestIC and ULPP are registered trademarks of Microchip
Technology Germany II GmbH & Co. & KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their
respective companies.
© 2012-2013, Microchip Technology Incorporated, Printed in
the U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-62076-090-4
QUALITY MANAGEMENT SYSTEM
CERTIFIED BY DNV
== ISO/TS 16949 ==
DS52088B-page 2
Microchip received ISO/TS-16949:2009 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.
 2012-2013 Microchip Technology Inc.
Object of Declaration: MCP6L2 and PIC18F66J93 Energy Meter Reference Design
 2012-2013 Microchip Technology Inc.
DS52088B-page 3
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
NOTES:
DS52088B-page 4
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Table of Contents
Preface ........................................................................................................................... 9
Introduction............................................................................................................ 9
Document Layout ................................................................................................ 10
Conventions Used in this Guide .......................................................................... 11
Recommended Reading...................................................................................... 12
The Microchip Web Site ...................................................................................... 12
Customer Support ............................................................................................... 12
Document Revision History ................................................................................. 12
Chapter 1. Product Overview
1.1 Introduction ................................................................................................... 13
1.2 What Does the MCP6L2 and PIC18F66J93 Energy Meter Kit Include? ...... 14
1.3 Getting Started ............................................................................................. 14
1.3.1 Step 1: Wiring Connections ....................................................................... 14
1.3.2 Step 2: Turn On Line/Load Power to the Meter (Power the Meter) ........... 14
Chapter 2. Hardware
2.1 Overview ...................................................................................................... 15
2.2 Input and Analog Front End ......................................................................... 18
2.3 Power Supply Circuit .................................................................................... 20
Chapter 3. Calculation Engine and Register Description
3.1 COHERENT SAMPLING ALGORITHM ....................................................... 21
3.1.1 The Advantages of the Coherent Sampling in this
Energy Metering Design ........................................................................ 21
3.1.2 Coherent Sampling Algorithm ................................................................... 22
3.2 Calculation Engine Signal Flow Summary ................................................... 23
3.3 Complete Register List ................................................................................. 24
3.4 METER_VERSION_ID ................................................................................ 25
3.5 METER_STATUS ........................................................................................ 25
3.6 CAL_CONTROL .......................................................................................... 26
3.7 RAW_I_RMS ................................................................................................ 26
3.8 I_RMS .......................................................................................................... 27
3.9 RAW_V_RMS ............................................................................................... 27
3.10 V_RMS ....................................................................................................... 27
3.11 FREQUENCY ............................................................................................. 27
3.12 POWER_ACT ............................................................................................. 27
3.13 POWER_REACT ........................................................................................ 28
3.14 POWER_APP ............................................................................................. 28
 2012-2013 Microchip Technology Inc.
DS52088B-page 5
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.15 POWER_FACTOR ..................................................................................... 28
3.16 PHASE_COMPENSATION ........................................................................ 28
3.17 GAIN_I_RMS .............................................................................................. 29
3.18 GAIN_POWER_ACT .................................................................................. 29
3.19 GAIN_POWER_REACT ............................................................................. 29
3.20 GAIN_NUMR_ENERGY_ACT ................................................................... 29
3.21 GAIN_DENR_ENERGY_ACT .................................................................... 30
3.22 GAIN_NUMR_ENERGY_REACT .............................................................. 30
3.23 GAIN_DENR_ENERGY_REACT ............................................................... 30
3.24 PHASE_COMPENSATION_LOW .............................................................. 30
3.25 PHASE_COMPENSATION_HIGH ............................................................. 31
3.26 GAIN_V_RMS ............................................................................................ 31
3.27 GAIN_I_RMS_LOW ................................................................................... 31
3.28 GAIN_I_RMS_HIGH ................................................................................... 31
3.29 GAIN_POWER_ACT_LOW ........................................................................ 31
3.30 GAIN_POWER_ACT_HIGH ....................................................................... 32
3.31 GAIN_NUMR_ENERGY_ACT_LOW ......................................................... 32
3.32 GAIN_NUMR_ENERGY_ACT_HIGH ........................................................ 32
3.33 GAIN_DENR_ENERGY_ACT_LOW .......................................................... 32
3.34 GAIN_DENR_ENERGY_ACT_HIGH ......................................................... 32
3.35 GAIN_POWER_REACT_LOW ................................................................... 32
3.36 GAIN_POWER_REACT_HIGH .................................................................. 33
3.37 GAIN_NUMR_ENERGY_REACT_LOW .................................................... 33
3.38 GAIN_NUMR_ENERGY_REACT_HIGH ................................................... 33
3.39 GAIN_DENR_ENERGY_REACT_LOW ..................................................... 33
3.40 GAIN_DENR_ENERGY_REACT_HIGH .................................................... 33
3.41 METER_CONSTANT ................................................................................. 34
3.42 PULSE_WIDTH .......................................................................................... 34
3.43 NO_LOAD_THRESHOLD_I_RMS ............................................................. 34
3.44 LINE_CYC .................................................................................................. 34
3.45 ENERGY_ACT ........................................................................................... 35
3.46 ENERGY_REACT ...................................................................................... 35
Chapter 4. Communication Protocol
4.1 Protocol ....................................................................................................... 37
4.1.1 Command Description ...............................................................................37
Chapter 5. Microchip Energy Meter Software
5.1 Overview ...................................................................................................... 41
5.2 The Main Screen .......................................................................................... 41
5.3 Debug Mode ................................................................................................. 43
5.3.1 Refreshing Registers Status ......................................................................43
5.3.2 Monitoring Individual Registers ..................................................................44
5.3.3 Writing to Individual Registers ...................................................................44
DS52088B-page 6
 2012-2013 Microchip Technology Inc.
Table of Contents
Chapter 6. Energy Meter Calibration
6.1 Introduction ................................................................................................... 45
6.2 Calibration Registers .................................................................................... 45
6.3 Closed Loop Calibration ............................................................................... 46
6.3.1 Closed Loop Calibration Principle ............................................................. 46
6.3.2 Closed Loop Calibration with Microchip Energy Meter Software ............... 47
6.4 Open Loop Calibration ................................................................................. 50
6.4.1 Open Loop Calibration Principle ................................................................ 50
6.4.2 Open Loop Calibration with Energy Meter GUI ......................................... 51
6.5 Auto-Calibration ............................................................................................ 54
6.5.1 Auto-Calibration Principle .......................................................................... 54
6.5.2 Auto-Calibration with Energy Meter GUI ................................................... 55
Appendix A. Schematic and Layouts
A.1 Introduction .................................................................................................. 57
A.2 Schematics and PCB Layout ....................................................................... 57
A.3 Board – Schematic – Analog-to-Digital Converter ...................................... 58
A.4 Board – Schematic – Microcontroller ......................................................... 59
A.5 Board – Schematic – LCD - USB ................................................................ 60
A.6 Board – Top Silk .......................................................................................... 61
A.7 Board – Top Copper .................................................................................... 62
A.8 Board – Top Silk and Copper ....................................................................... 63
A.9 Board – Bottom Silk .................................................................................... 64
A.10 Board – Bottom Copper ............................................................................. 65
A.11 Board – Bottom Silk and Copper ............................................................... 66
Appendix B. Bill of Materials (BOM)
Worldwide Sales and Service .................................................................................... 70
 2012-2013 Microchip Technology Inc.
DS52088B-page 7
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
NOTES:
DS52088B-page 8
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
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 online help.
Select the Help menu, and then Topics to open a list of available online help files.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
MCP6L2 and PIC18F66J93 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
 2012-2013 Microchip Technology Inc.
DS52088B-page 9
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
DOCUMENT LAYOUT
This document describes how to use the MCP6L2 and PIC18F66J93 Energy Meter 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 MCP6L2
and PIC18F66J93 Energy Meter including a Getting Started section that describes
wiring the line and load connections.
• Chapter 2. “Hardware” – Includes details about the function blocks of the meter
including the analog front-end and power supply design.
• Chapter 3. “Calculation Engine and Register Description” – This section
describes the digital signal flow for all power output quantities such as RMS
current, RMS voltage, active power, reactive power and apparent power. This
section also includes the registers’ detail.
• Chapter 4. “Communication Protocol”– The protocol used for accessing the
registers is described. It includes commands that are used to interface to the
meter.
• Chapter 5. “Microchip Energy Meter Software”– Describes the functionality of
the Graphical User Interface (GUI) that runs on the PC.
• Chapter 6. “Energy Meter Calibration”– Information on calibration of the energy
meter using the GUI.
• Appendix A. “Schematic and Layouts” – Shows the schematic and layout
diagrams
• Appendix B. “Bill of Materials (BOM)” – Lists the parts used to build the
MCP6L2 and PIC18F66J93 Energy Meter.
DS52088B-page 10
 2012-2013 Microchip Technology Inc.
Preface
CONVENTIONS USED IN THIS GUIDE
This manual uses the following documentation conventions:
DOCUMENTATION CONVENTIONS
Description
Arial font:
Italic characters
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
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
Represents code supplied by
user
 2012-2013 Microchip Technology Inc.
Examples
File>Save
Press <Enter>, <F1>
#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}
var_name [,
var_name...]
void main (void)
{ ...
}
DS52088B-page 11
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
RECOMMENDED READING
This user's guide describes how to use the MCP6L2 and PIC18F66J93 Energy Meter.
Other useful documents are listed below. The following Microchip documents are
available and recommended as supplemental reference resources.
• MCP6L2 Data Sheet – “2.8 MHz, 200 μA Op Amps” (DS22135)
This data sheet provides detailed information regarding the MCP6L2 device.
• PIC18F66J93 Data Sheet – “64/80-Pin, High-Performance Microcontrollers
with LCD Driver, 12-Bit A/D and nanoWatt Technology” (DS39948)
This data sheet provides detailed information regarding the PIC18F66J93 device.
• PIC18F87J72 Single-Phase Energy Meter Calibration User's Guide
(DS51964)
This User's Guide describes the calibration registers and Universal Asynchronous
Receiver/Transmitter (UART) communication protocol used on the PIC18F87J72
Single-Phase Energy Meter Reference Design. Only some of the information applies
to the MCP6L2 and PIC18F66J93 Energy Meter Reference Design. The chapters
recommended for reading will be specified later in this document.
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://www.microchip.com/support.
DOCUMENT REVISION HISTORY
Revision B (February 2013)
• Updated Figure 1-2.
Revision A (August 2012)
• Initial Release of this Document.
DS52088B-page 12
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Chapter 1. Product Overview
1.1
INTRODUCTION
The MCP6L2 and PIC18F66J93 Energy Meter is a fully functional single-phase meter
that uses the 12-bit successive approximation analog-to-digital converter (SAR ADC)
integrated in the microcontroller. This low-cost design has a shunt as the current
sensor. The signal from the shunt is amplified by two external operational amplifiers
and applied to the input of the ADC. The PIC18F66J93 directly drives the LCD and
communicates via UART with the MCP2200, offering an isolated USB connection for
meter calibration and access to the device power calculations. The system calculates
active and reactive energy; active, reactive and apparent power; power factor; RMS
current; RMS voltage, and line frequency.
The Microchip energy meter software is used to calibrate and monitor the system. The
calibration can be done in closed loop or open loop. When connected to a stable source
of voltage and current, the meter can do an auto-calibration by including the open loop
calibration routine and formulas in the firmware.
FIGURE 1-1:
 2012-2013 Microchip Technology Inc.
MCP6L2 and PIC18F66J93 Energy Meter Reference Design.
DS52088A-page 13
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
1.2
WHAT DOES THE MCP6L2 AND PIC18F66J93 ENERGY METER KIT
INCLUDE?
This MCP6L2 and PIC18F66J93 Energy Meter kit includes:
• MCP6L2 and PIC18F66J93 Energy Meter (ARD00370)
• Important Information Sheet
1.3
GETTING STARTED
To illustrate how to use the MCP6L2 and PIC18F66J93 Energy Meter, the following
example is shown using a two-wire 1-phase, 220 VAC line voltage and connections
using energy meter calibrator equipment, or other programmable load source. The
nominal current (IN) is 5A, and the maximum current (IMAX) is 60A. The energy meter
was designed for 50 Hz line systems.
All connections described in this section are dependent upon the choice of the current
sensing element. A secondary external transformer may be required in higher current
meter designs. To test a calibrated meter, the following connections apply for a two-wire
connection.
1.3.1
Step 1: Wiring Connections
Figure 1-2 is identifying the line and load connections of the MCP6L2 and
PIC18F66J93 Energy Meter.
1
2
3
4
Line
Line
Neutral
Neutral
MAIN
FIGURE 1-2:
LOAD
Example Connections using a Two-Wire System.
1.3.2
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 the total energy accumulated.
DS52088A-page 14
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER REFERENCE
Chapter 2. Hardware
2.1
OVERVIEW
Figures 2-1 and 2-2 show the MCP6L2 and PIC18F66J93 Energy Meter:
8
7
6
1
5
2
4
3
Legend:
1 = ICSP Programming header (non-isolated)
5
=
Push-button switches
2 = +9V DC input (non-isolated)
6
=
9-digit LCD Display with icons for kWh and
kVARh
3 = Connections to shunt current sensing
resistor
7
=
Pulse Output for active and reactive energy
(isolated)
4 = Connections to Line and Neutral
8
=
USB connection (isolated)
FIGURE 2-1:
Top View – Hardware Components.
 2012-2013 Microchip Technology Inc.
DS52088B-page 15
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
.
15
14
9
13
12
10
11
Legend:
9
=
Opto-isolators for pulse outputs
10
=
Power supply
11
=
MCP6L2 and associated signal conditioning circuitry
12
=
PIC18F66J93
13
=
EEPROM for storing calibration constants and energy counters
14
=
Isolation IC
15
=
MCP2200 for USB connection
FIGURE 2-2:
DS52088B-page 16
Bottom View – Hardware Components.
 2012-2013 Microchip Technology Inc.
Hardware
RC1
RC5
RG4
SWITCH 2
RG3
SWITCH 3
RC7/RX
RC6/TX
Active
energy
USB to UART
converter
Reactive
energy
Mini – USB
connector
MCP2200
RC3/SCL
SCL
RC4/SDA
SDA
RC0
WP
24FC256
I C™- EEPROM
2
FIGURE 2-3:
Digital Connections.
 2012-2013 Microchip Technology Inc.
DS52088B-page 17
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
2.2
INPUT AND ANALOG FRONT END
The MCP6L2 and PIC18F66J93 Energy Meter comes populated with components
designed for 220V line voltage. The high voltage line and neutral connections are at the
bottom of the main board. The 200 µ shunt sits on the high or line side of a two-wire
system, and the meter employs a hot or "live" ground.
The neutral side of the two-wire system goes into a resistor divider on the voltage
channel input, along with a DC offset added from VDD. Anti-aliasing low-pass filters are
included. The voltage channel uses three 100 k resistors and one 820 resistor to
achieve a divider ratio of 366:1. For a line voltage of 220 VRMS , the voltage channel
input signal size will be 601 mVRMS ,with a DC offset of 1.65V.
3.3V
Ferrite be a d
100 kΩ
51 kΩ
47 μF
100 kΩ
Neutral
100 kΩ
51 kΩ
820Ω
AGND
AGND
PIC18F66J93
3.4 kΩ
AN2
150 nF
33 nF
AGND
FIGURE 2-4:
DS52088B-page 18
AGND
Analog Front End -Voltage Measurement.
 2012-2013 Microchip Technology Inc.
Hardware
To amplify the signal from the shunt, this energy meter design uses the two operational
amplifiers from the MCP6L2 device to create two signal paths, with different gains: one
for the low-current’s range and one for the high-current’s range, as shown in
Figures 2-5 and 2-6:
681 kΩ
3.3V
Ferrite bead
49.9Ω
499Ω
49.9Ω
499Ω
2.2 μF
220 nF
AN1
AGND
681 kΩ
499Ω
681 kΩ
AGND
FIGURE 2-5:
680Ω
220 nF
AGND
3.3V
AGND AGND
Ferrite bead
+
220 nF
2.2 μF
Shunt
499Ω
PIC18F66J93
681 kΩ
AGND
AGND
Analog Input Circuitry for Current Measurement, LOW-Current’s Range.
681 k
Ferrite bead
3.3V
49.9
499
5.1 k
+
Shunt
AGND
AGND
3.3V
Ferrite bead
499
5.1 k
2.2 μF 220 nF
AGND
FIGURE 2-6:
AN0
220 nF
2.2 μF
49.9
270
AGND
220 nF
AGND
AGND
PIC18F66J93
681 k
681 k
681 k
AGND
Analog Input Circuitry for Current Measurement, HIGH-Current’s Range.
The low-current’s range circuit (Figure 2-5) has a gain of 325 V/V. The high-current’s
range circuit (Figure 2-6) has a gain of 60 V/V. The firmware switches between the two
gains with hysteresis between 4 and 5 ARMS.
Note that all of the circuitry associated with the analog front-end is connected to the
analog ground plane, AGND.
 2012-2013 Microchip Technology Inc.
DS52088B-page 19
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
2.3
POWER SUPPLY CIRCUIT
The capacitive power supply circuit for the MCP6L2 and PIC18F66J93 Energy Meter
uses a half-wave rectified signal and two +3.3V voltage regulators. One Low-dropout
(LDO) supplies the analog side, and the other supplies the digital circuitry of the meter.
There is an option to use only one LDO, by populating the R33 resistor and removing
the U2 LDO. This will result in a lower cost meter, at the price of a decrease in accuracy.
.
U2
MCP1754
IN OUT
GND
+9V DC
Power In
(Optional)
0.1 μF
Ferrite bead
470Ω 0.47 μF
GNDB
Neutral
MOV
10 nF
Ferrite bead
Line
470 μF
0.1 μF
GNDB GNDB
FIGURE 2-7:
DS52088B-page 20
R33
GNDB 0Ω
DNP
U3
MCP1703
IN OUT
GND
3.3A
10 μF
GNDB
GNDB
3.3D
10 μF
GNDB
0.1 μF
GNDB
0.1 μF
GNDB
Power Supply Circuit.
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Chapter 3. Calculation Engine and Register Description
3.1
COHERENT SAMPLING ALGORITHM
3.1.1
The Advantages of the Coherent Sampling in this Energy
Metering Design
The outputs of an energy meter, power and RMS values are obtained by multiplying
two AC signals, computing the average value and then multiplying it with a calibration
gain. Ideally, these signals are sinusoids, with the frequency equal to the line
frequency:
EQUATION 3-1:
S 1  t  = A 1 cos   t 
S 2  t  = A 2 cos   t +  
The two signals (S1 and S2) can be the voltage and/or the current waveforms. The
instantaneous power value is obtained by multiplication:
EQUATION 3-2:
A1  A2
A1  A2
P  t  = S 1  t   S 2  t  = ------------------  cos    + ------------------  cos  2  t +  
2
2
The resultant signal has a continuous component and a sinusoidal component with a
frequency equal to double the line frequency. Because the energy meter is computing
the average power, only the continuous component is of interest, with the other requiring attenuation. If it is not properly attenuated, the indication of the energy meter will
fluctuate in time. There are two methods to obtain efficient attenuation of the unwanted
component: low-pass filtering and coherent sampling.
The instantaneous power signal can be applied to a low-pass filter with the cutoff frequency much lower than the double of the line frequency. If the energy meter must
compute Active Power, Reactive Power, RMS Voltage, RMS Current (four instantaneous power computations, in total), it means that four low-pass filters must be applied.
In this particular energy meter design, with two current paths and gain switching
controlled by the firmware, the problem is more complex with the low-pass filtering
approach. This is because the low-pass filters have low-cutoff frequency, and
consequently, high settling time. This affects the response of the meter outputs when
the current gain is switched. In order to avoid this, the signals from the two current
paths must be processed simultaneously, and low-pass filters must be applied on the
instantaneous powers resulting from both paths. Therefore, three additional low-pass
filters are required (for the instantaneous Active Power, Reactive Power and RMS
Current on the other current channel). This means a total of seven low-pass filters are
required for this energy meter design. Considering that the low-pass filter routines must
be executed for each sample, the resulting processing time can be too long.
 2012-2013 Microchip Technology Inc.
DS52088B-page 21
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
The coherent sampling approach solves this issue by eliminating the low-pass filters.
Coherent sampling refers to the situation when the sampling frequency is a fixed
integer multiple of the line frequency. The unwanted sinusoidal component from the
instantaneous power signal is attenuated under coherent sampling conditions, if the
averaging is computed over a number of samples corresponding to an integer number
of line cycles.
3.1.2
Coherent Sampling Algorithm
Coherent sampling implies a dependency between the sampling frequency and the line
frequency. Because the line frequency is not fixed, the sampling frequency needs to be
adjustable. In the MCP6L2 and PIC18F66J93 Energy Meter design, based on the
microcontroller's internal successive approximation ADC (SAR ADC), the sampling
period is controlled by a timer. At the beginning of the Interrupt Service Routine, the
new timer value is set, and then the ADC samples are acquired and processed. The
new timer value is computed based on the value of the line signal period.
In order to save hardware resources (timers), the line signal period is not measured
directly in this design. Based on the amplitude of the acquired signal samples, the
firmware detects the zero crossings on rising edges and tries to achieve a fixed integer
number of samples between successive crossings, by adjusting the sampling period.
The conditions for obtaining coherent sampling implemented in the firmware are:
• The number of samples between zero crossings must have a certain value
(64 samples per line cycle in this design)
• The difference between the first sample after zero crossing and the corresponding
sample from the previous line period, must be within certain limits (for more accurate locking on the line frequency).
A graphical representation of these conditions is shown in Figure 3-1.
1
3
1
2
Legend:
1
= Zero-crossing detection on rising edge
2
= The number of samples between zero crossings must have a certain value
3
= The difference must be within certain limits
FIGURE 3-1:
Firmware.
Conditions for Obtaining Coherent Sampling Implemented in the
These conditions are checked after every zero crossing on rising edge. If they are not
met, then the corrections are applied to the sampling period.
DS52088B-page 22
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
The zero-crossing detection is done on the voltage channel, because it has much lower
dynamic range than the current channel. To increase immunity to noise and distortions
(harmonics), the acquired voltage samples are passed through a low-pass filter with a
cutoff frequency lower than the line frequency, before being processed for
zero-crossing detection.
3.2
CALCULATION ENGINE SIGNAL FLOW SUMMARY
RMS voltage, RMS current, Active Power, Reactive Power, Apparent Power and
calibration output pulses are calculated through the process described in Figure 3-2.
The calibration registers for each calculation are shown as well as the output registers.
Interrupt Service Routine
ADC
CURRENT_LOW
RMS Current
X
2
Σ
ADC
CURRENT_HIGH
90
deg
12-bit Internal
SAR ADC
Reactive Power
Σ
X
Active Power
Σ
X
Φ
PHASE_COMPENSATION:8
ADC
VOLTAGE
RMS Voltage
FIGURE 3-2:
GAIN_I_RMS:16
GAIN_V_RMS:16
X
X
X
I_RMS:16
POWER_APP:32
V_RMS:16
X
POWER_ACT:32
GAIN_POWER_ACT:16
X
POWER_REACT:32
/
Digital to
Frequency
Converter
ENERGY_REACT:32
GAIN_NUMR_ENERGY_REACT:16
GAIN_DENR_ENERGY_REACT:8
Imp/KVArh
1/METER_CONSTANT
/
Digital to
Frequency
Converter
GAIN_POWER_REACT:16
Σ
2
ENERGY_ACT:32
Imp/KWh
1/METER_CONSTANT
GAIN_NUMR_ENERGY_ACT:16
GAIN_DENR_ENERGY_ACT:8
X
MCP6L2 and PIC18F66J93 Calculation Engine Signal Flow.
 2012-2013 Microchip Technology Inc.
DS52088B-page 23
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.3
COMPLETE REGISTER LIST
TABLE 3-1:
INTERNAL REGISTER SUMMARY
Address
Register Name
Bits
R/W
Description
0x000
METER_VERSION_ID
8
R
Hardware and firmware version identification
register
0x001
METER_STATUS
8
R
Contains information regarding the operational
status of the meter
0x002
CAL_CONTROL
8
0x003
RAW_I_RMS
16
R
Raw RMS value of the current channel
0x005
I_RMS
16
R
RMS value of the current channel,
post calibration
R/W Configuration register for calibration control
0x007
RAW_V_RMS
16
R
Raw RMS value of the voltage channel
0x009
V_RMS
16
R
RMS value of the voltage channel,
post calibration
0x00B
FREQUENCY
16
R
Line frequency indication
0x00D
POWER_ACT
32
R
Active Power indication
0x011
POWER_REACT
32
R
Reactive Power indication
0x015
POWER_APP
32
R
Apparent Power indication
0x019
POWER_FACTOR
16
R
Power factor indication
0x01B
PHASE_COMPENSATION
8
R
Phase delay between voltage and current
channels
0x01C
GAIN_I_RMS
16
R
Gain adjustment for current channel RMS
0x01E
GAIN_POWER_ACT
16
R
Active Power Gain adjust
0x020
GAIN_POWER_REACT
16
R
Reactive Power Gain adjust
0x022
GAIN_NUMR_ENERGY_ACT
16
R
Active Power Pulse Output correction factor
0x024
GAIN_DENR_ENERGY_ACT
8
R
Active Power Pulse Output correction factor
0x025
GAIN_NUMR_ENERGY_REACT
16
R
Reactive Power Pulse Output correction factor
0x027
GAIN_DENR_ENERGY_REACT
8
R
Reactive Power Pulse Output correction factor
0x028
PHASE_COMPENSATION_LOW
8
R/W Phase-delay between voltage and low region
current channels
0x029
PHASE_COMPENSATION_HIGH
8
R/W Phase-delay between voltage and high region
current channels
0x02A
GAIN_V_RMS
16
R/W Gain adjustment for voltage RMS
0x02C
GAIN_I_RMS_LOW
16
R/W Gain adjustment for low region current RMS
0x02E
GAIN_I_RMS_HIGH
16
R/W Gain adjustment for high region current RMS
0x030
GAIN_POWER_ACT_LOW
16
R/W Low-region Active Power gain adjust
0x032
GAIN_POWER_ACT_HIGH
16
R/W High-region Active Power gain adjust
0x034
GAIN_NUMR_ENERGY_ACT_LOW
16
R/W Low-region Active Power Pulse Output
correction factor
0x036
GAIN_NUMR_ENERGY_ACT_HIGH
16
R/W High-region Active Power Pulse Output
correction factor
0x038
GAIN_DENR_ENERGY_ACT_LOW
8
R/W Low-region Active Power Pulse Output
correction factor
0x039
GAIN_DENR_ENERGY_ACT_HIGH
8
R/W High-region Active Power Pulse Output
correction factor
0x03A
GAIN_POWER_REACT_LOW
16
R/W Low-region Reactive Power gain adjust
0x03C
GAIN_POWER_REACT_HIGH
16
R/W High-region Reactive Power gain adjust
0x03E
GAIN_NUMR_ENERGY_REACT_LOW
16
R/W Low-region Reactive Power Pulse Output
correction factor
DS52088B-page 24
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
TABLE 3-1:
INTERNAL REGISTER SUMMARY (CONTINUED)
Address
Register Name
Bits
0x040
GAIN_NUMR_ENERGY_REACT_HIGH
16
R/W High-region Reactive Power Pulse Output
correction factor
0x042
GAIN_DENR_ENERGY_REACT_LOW
8
R/W Low-region Reactive Power Pulse Output
correction factor
0x043
GAIN_DENR_ENERGY_REACT_HIGH
8
R/W High-region Reactive Power Pulse Output
correction factor
0x044
METER_CONSTANT
16
R/W Meter Constant in imp/kWh
0x046
PULSE_WIDTH
8
R/W Defines CF pulse width in milliseconds
0x047
NO_LOAD_THRESHOLD_I_RMS
8
R/W Bellow this Current RMS indication, energy
accumulation is disabled
0x048
LINE_CYC
8
R/W It is "n" from the formula:
Computation cycle = 2n number of line cycles
0x100
ENERGY_ACT
32
R/W Active Energy Counter
0x104
ENERGY_REACT
32
R/W Reactive Energy Counter
3.4
R/W
Description
METER_VERSION_ID
Name
METER_VERSION_ID
Bits
Address
Cof.
8
0x000
R
This register contains a constant that is hard-coded in the firmware, giving information
regarding the hardware and firmware version running on the energy meter.
3.5
METER_STATUS
Name
METER_STATUS
Bits
Address
Cof
8
0x001
R
The register contains information regarding the operational status of the energy meter.
REGISTER 3-1:
METER_STATUS REGISTER
U-0
U-0
U-0
U-0
U-0
U-0
U-0
R
—
—
—
—
—
—
—
CURRENT_
REGION
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
bit 7-1
Unimplemented: Read as ‘0’
bit 0
CURRENT_REGION: Indicates the selected current region
1 = High Current Region
0 = Low Current Region
 2012-2013 Microchip Technology Inc.
x = Bit is unknown
DS52088B-page 25
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.6
CAL_CONTROL
Name
CAL_CONTROL
Bits
Address
Cof
8
0x002
R/W
This register controls the calibration process.
REGISTER 3-2:
CAL_CONTROL REGISTER
U-0
U-0
U-0
—
—
—
R-0
R/W-0
R/W-0
AUTOCAL_FIRST CURRENT_REGION FORCE_CURRENT
_LINE_CYCLE
_SELECTED
_REGION
bit 7
U-0
R/W-0
—
CAL_MODE
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 7-5
Unimplemented: Read as ‘0’
bit 4
AUTOCAL_FIRST_LINE_CYCLE: Flag used in the auto-calibration routine.
1 = The actual line cycle is the first after the current region has been changed in the auto-calibration routine.
0 = The actual line cycle is not the first after the current region has been changed in the auto-calibration
routine.
bit 3
CURRENT_REGION_SELECTED: Current region set by the external device via UART, during the
calibration procedure
1 = Low Current Region
0 =High Current Region
bit 2
FORCE_CURRENT_REGION: This bit is set by the external device via UART, before the calibration
procedure.
1 =Automatic current region selection is bypassed. The current region is set by the "CURRENT_REGION
_SELECTED" bit.
0 =The current region is set automatically, based on current RMS indication.
bit 1
Unimplemented: Read as ‘0’
bit 0
CAL_MODE: Activates the auto-calibration procedure.
1 = Auto-calibration procedure has been activated.
0 = Auto-calibration procedure is not enabled.
3.7
RAW_I_RMS
Name
RAW2_I_RMS
Bits
Address
Cof
16
0x003
R
This register is the raw current RMS value, before the multiplication with the calibration
register GAIN_I_RMS.
DS52088B-page 26
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
3.8
I_RMS
Name
I_RMS
Bits
Address
Cof
16
0x005
R
This register is the current RMS indication, in amperes, after the multiplication with the
calibration register GAIN_I_RMS. The decimal point is placed after three digits, for lowcurrent region, or two digits, for high-current region. For example: if the meter is in the
low region and the read value is I_RMS = 5000 (in decimal), it means that the current
is 5.000A. But if the same value is read when the meter is in the high-current region, it
means that the current is 50.00A .
3.9
RAW_V_RMS
Name
RAW_V_RMS
Bits
Address
Cof
16
0x007
R
This register is the raw voltage RMS value, before the multiplication with the calibration
register GAIN_V_RMS.
3.10
V_RMS
Name
V_RMS
Bits
Address
Cof
16
0x009
R
This register is the voltage RMS indication, in volts, after the multiplication with the
calibration register GAIN_V_RMS. The decimal point is placed after the first digit. For
example: a read value of V_RMS = 2200 means 220.0V.
3.11
FREQUENCY
Name
FREQUENCY
Bits
Address
Cof
16
0x00B
R
This register is the line frequency indication, in hertz. The decimal point is placed after
three digits. For example: a read value of FREQUENCY = 50000 means 50.000 Hz.
3.12
POWER_ACT
Name
POWER_ACT
Bits
Address
Cof
32
0x00D
R
This register is the active power indication, in watts. The decimal point is placed after
five digits for low-current region or four digits for high-current region. For example: if the
meter is in the low region and the read value is POWER_ACT = 110000000 (in decimal), it means that the active power is 1100.00000W. If the same value is read when
the meter is in the high-current region, it means that the active power is 11000.0000W.
 2012-2013 Microchip Technology Inc.
DS52088B-page 27
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.13
POWER_REACT
Name
Bits
Address
Cof
POWER_REACT
32
0x011
R
This register is the reactive power indication, in VAR. The decimal point is placed after
five digits, for low-current region, or four digits, for high-current region. For example: if
the meter is in the low region and the read value is POWER_REACT = 110000000 (in
decimal), it means that the active power is 1100.00000 VAR. If the same value is read
when the meter is in the high-current region, it means that the active power is
11000.0000 VAR.
3.14
POWER_APP
Name
POWER_APP
Bits
Address
Cof
32
0x015
R
This register is the apparent power indication, in VA. The decimal point is placed after
five digits, for low-current region, or four digits, for high-current region. For example: if
the meter is in the low region and the read value is POWER_APP = 110000000 (in
decimal), it means that the active power is 1100.00000 VA. If the same value is read
when the meter is in the high-current region, it means that the active power is
11000.0000 VA.
3.15
POWER_FACTOR
Name
POWER_FACTOR
Bits
Address
Cof
16
0x019
R
This register is the power factor indication. The power factor value is obtained by
dividing the register value to 65535. For example: a read value of
POWER_FACTOR = 32767 means that the power factor is 0.5.
3.16
PHASE_COMPENSATION
Name
PHASE_COMPENSATION
Bits
Address
Cof
8
0x01B
R
This register contains the phase compensation value between the voltage and the
current channels, used by the metering engine at the moment of reading. It is a copy
of one of the calibration registers: PHASE_COMPENSATION_LOW or
PHASE_COMPENSATION_HIGH, depending on the actual current region.
For more information related to phase compensation implementation in firmware, refer
to Chapter 2.3.2.3 from “PIC18F87J72 Single-Phase Energy Meter Calibration User's
Guide” (DS51964).
DS52088B-page 28
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
3.17
GAIN_I_RMS
Name
GAIN_I_RMS
Bits
Address
Cof
16
0x01C
R
This register contains the gain value for the current RMS indication, used by the metering engine at the moment of reading. It is a copy of one of the calibration registers:
GAIN_I_RMS_LOW or GAIN_I_RMS_HIGH, depending on the actual current region.
3.18
GAIN_POWER_ACT
Name
GAIN_POWER_ACT
Bits
Address
Cof
16
0x01E
R
This register contains the gain value for the active power indication, used by the metering engine at the moment of reading. It is a copy of one of the calibration registers:
GAIN_POWER_ACT_LOW or GAIN_POWER_ACT_HIGH, depending on the actual
current region.
3.19
GAIN_POWER_REACT
Name
Bits
Address
Cof
GAIN_POWER_REACT
16
0x020
R
This register contains the gain value for the reactive power indication, used by the
metering engine at the moment of reading. It is a copy of one of the calibration registers: GAIN_POWER_REACT_LOW or GAIN_POWER_REACT_HIGH, depending on
the actual current region.
3.20
GAIN_NUMR_ENERGY_ACT
Name
GAIN_NUMR_ENERGY_ACT
Bits
Address
Cof
16
0x022
R
This register contains the active energy gain value necessary to produce the specified
number of impulses per kilowatt-hour (the meter constant), used by the metering
engine at the moment of reading. It is a copy of one of the calibration registers:
GAIN_NUMR_ENERGY_ACT_LOW or GAIN_NUMR_ENERGY_ACT_HIGH,
depending on the actual current region.
 2012-2013 Microchip Technology Inc.
DS52088B-page 29
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.21
GAIN_DENR_ENERGY_ACT
Name
GAIN_DENR_ENERGY_ACT
Bits
Address
Cof
8
0x024
R
This register contains the number of left bit shifts for the raw active power, used by the
metering engine at the moment of reading. It is a copy of one of the calibration registers: GAIN_DENR_ENERGY_ACT_LOW or GAIN_DENR_ENERGY_ACT_HIGH,
depending on the actual current region.
3.22
GAIN_NUMR_ENERGY_REACT
Name
Bits
Address
Cof
GAIN_NUMR_ENERGY_REACT
16
0x025
R
This register contains the reactive energy gain value necessary to produce the specified number of impulses per kVArh (the meter constant), used by the metering engine
at the moment of reading. It is a copy of one of the calibration registers:
GAIN_NUMR_ENERGY_REACT_LOW or GAIN_NUMR_ENERGY_REACT_HIGH,
depending on the actual current region.
3.23
GAIN_DENR_ENERGY_REACT
Name
GAIN_DENR_ENERGY_REACT
Bits
Address
Cof
8
0x027
R
This register contains the number of left bit shifts for the raw reactive power, used by
the metering engine at the moment of reading. It is a copy of one of the calibration registers: GAIN_DENR_ENERGY_REACT_LOW or
GAIN_DENR_ENERGY_REACT_HIGH, depending on the actual current region.
3.24
PHASE_COMPENSATION_LOW
Name
Bits
Address
Cof
PHASE_COMPENSATION_LOW
8
0x028
R/W
This calibration register contains the phase compensation value between the voltage
and the low-current region channel.
For more information related to phase compensation implementation in firmware
please refer to Chapter 2.3.2.3 from “PIC18F87J72 Single-Phase Energy Meter
Calibration User's Guide” (DS51964).
DS52088B-page 30
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
3.25
PHASE_COMPENSATION_HIGH
Name
Bits
Address
Cof
PHASE_COMPENSATION_HIGH
8
0x029
R/W
This calibration register contains the phase compensation value between the voltage
and the high-current region channel.
For more information related to phase compensation implementation in firmware
please refer to Chapter 2.3.2.3 from “PIC18F87J72 Single-Phase Energy Meter
Calibration User's Guide” (DS51964).
3.26
GAIN_V_RMS
Name
Bits
Address
Cof
GAIN_V_RMS
16
0x02A
R/W
This calibration register contains the gain value for the voltage RMS indication.
3.27
GAIN_I_RMS_LOW
Name
GAIN_I_RMS_LOW
Bits
Address
Cof
16
0x02C
R/W
This calibration register contains the gain value for the current RMS indication in the
low-current region.
3.28
GAIN_I_RMS_HIGH
Name
GAIN_I_RMS_HIGH
Bits
Address
Cof
16
0x02E
R/W
This calibration register contains the gain value for the current RMS indication in the
high-current region.
3.29
GAIN_POWER_ACT_LOW
Name
Bits
Address
Cof
GAIN_POWER_ACT_LOW
16
0x030
R/W
This calibration register contains the gain value for the active power indication in the
low-current region.
 2012-2013 Microchip Technology Inc.
DS52088B-page 31
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.30
GAIN_POWER_ACT_HIGH
Name
GAIN_POWER_ACT_HIGH
Bits
Address
Cof
16
0x032
R/W
This calibration register contains the gain value for the active power indication in the
high-current region.
3.31
GAIN_NUMR_ENERGY_ACT_LOW
Name
Bits
Address
Cof
GAIN_NUMR_ENERGY_ACT_LOW
16
0x034
R/W
This calibration register contains the active energy gain value necessary to produce the
specified number of impulses per kWh (the meter constant) in the low-current region.
3.32
GAIN_NUMR_ENERGY_ACT_HIGH
Name
Bits
Address
Cof
GAIN_NUMR_ENERGY_ACT_HIGH
16
0x036
R/W
This calibration register contains the active energy gain value necessary to produce the
specified number of impulses per kWh (the meter constant) in the high-current region.
3.33
GAIN_DENR_ENERGY_ACT_LOW
Name
Bits
Address
Cof
GAIN_DENR_ENERGY_ACT_LOW
8
0x038
R/W
This calibration register contains the number of left bit shifts for the raw active power in
the low-current region.
3.34
GAIN_DENR_ENERGY_ACT_HIGH
Name
Bits
Address
Cof
GAIN_DENR_ENERGY_ACT_HIGH
8
0x039
R/W
This calibration register contains the number of left bit shifts for the raw active power in
the high-current region.
3.35
GAIN_POWER_REACT_LOW
Name
GAIN_POWER_REACT_LOW
Bits
Address
Cof
16
0x03A
R/W
This calibration register contains the gain value for the reactive power indication in the
low-current region.
DS52088B-page 32
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
3.36
GAIN_POWER_REACT_HIGH
Name
Bits
Address
Cof
16
0x03C
R/W
GAIN_POWER_REACT_HIGH
This calibration register contains the gain value for the reactive power indication in the
high-current region.
3.37
GAIN_NUMR_ENERGY_REACT_LOW
Name
GAIN_NUMR_ENERGY_REACT_LOW
Bits
Address
Cof
16
0x03E
R/W
This calibration register contains the reactive energy gain value necessary to produce
the specified number of impulses per kVArh (the meter constant) in the low-current
region.
3.38
GAIN_NUMR_ENERGY_REACT_HIGH
Name
GAIN_NUMR_ENERGY_REACT_HIGH
Bits
Address
Cof
16
0x040
R/W
This calibration register contains the reactive energy gain value necessary to produce
the specified number of impulses per kVArh (the meter constant) in the high-current
region.
3.39
GAIN_DENR_ENERGY_REACT_LOW
Name
GAIN_DENR_ENERGY_REACT_LOW
Bits
Address
Cof
8
0x042
R/W
This calibration register contains the number of left bit shifts for the raw reactive power
in the low-current region.
3.40
GAIN_DENR_ENERGY_REACT_HIGH
Name
GAIN_DENR_ENERGY_REACT_HIGH
Bits
Address
Cof
8
0x043
R/W
This calibration register contains the number of left bit shifts for the raw reactive power
in the low-current region.
 2012-2013 Microchip Technology Inc.
DS52088B-page 33
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
3.41
METER_CONSTANT
Name
Bits
Address
Cof
METER_CONSTANT
16
0x044
R/W
This register contains the meter constant in imp/kWh. It must be a multiple of 100.
3.42
PULSE_WIDTH
Name
PULSE_WIDTH
Bits
Address
Cof
8
0x046
R/W
This register contains the width of the active/reactive energy pulse in milliseconds. The
maximum pulse width that can be set in the existing firmware release is
65 milliseconds. If higher values are required, then the corresponding code portion in
the firmware must be modified.
3.43
NO_LOAD_THRESHOLD_I_RMS
Name
NO_LOAD_THRESHOLD_I_RMS
Bits
Address
Cof
8
0x047
R/W
This register contains the current RMS indication ( I_RMS value) in the low-current
region bellow which the energy accumulation is disabled.
3.44
LINE_CYC
Name
LINE_CYC
Bits
Address
Cof
8
0x048
R/W
This register contains the value of "n" from the formula:
EQUATION 3-3:
n
Computation_cycle_duration = 2  line_cycle_duration
The computation cycle contains a number of 2n line cycles. The indication registers are
updated every computation cycle. The value of LINE_CYC register sets the update rate
of the indication registers.
In this software release LINE_CYC = 4. The energy meter was designed for 50 Hz systems, so a line cycle has a period of 20 milliseconds. It results in a computation cycle
of :
4
Computation_cycle_duration = 2  20 = 320 milliseconds
DS52088B-page 34
 2012-2013 Microchip Technology Inc.
Calculation Engine and Register Description
3.45
ENERGY_ACT
Name
ENERGY_ACT
Bits
Address
Cof
32
0x100
R/W
This energy counter register contains the accumulated active energy in kWh. The
decimal point is after two digits. For example: an indication of ENERGY_ACT = 1234
means that the value of the accumulated active energy is 12.34 kWh.
3.46
ENERGY_REACT
Name
ENERGY_REACT
Bits
Address
Cof
32
0x104
R/W
This energy counter register contains the accumulated reactive energy in kVArh. The
decimal point is after two digits.
For example: an indication of ENERGY_REACT = 1234 means that the value of the
accumulated active energy is 12.34 kVArh.
 2012-2013 Microchip Technology Inc.
DS52088B-page 35
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
NOTES:
DS52088B-page 36
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Chapter 4. Communication Protocol
4.1
PROTOCOL
The UART of the PIC Microcontroller is used to communicate with the meter. In addition
to the reading and writing of the registers, there are also dedicated commands for
clearing, loading and storing calibration registers to Flash. The first byte UART 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, R, C or A.
• E – Request for Echo Response to which meter responds with “Q” as
acknowledgment
• L – Load Calibration Registers from Flash (LOAD)
• S – Store Calibration Registers (STORE)
• W – Write Bytes (WRITE)
• R – Read Bytes (READ)
• C – Load Default Calibration Values
• A – Run Auto-calibration Routine
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
the additional data in lieu of the number of bytes.
4.1.1.1
“E” ECHO: - TO DETECT THE METER CONNECTION
Example: ‘EX’.
Returns: ‘QX’
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). When the software executes an ‘SX’ command, it should verify
that the values were stored by issuing an ‘LX’ command and then reading the calibration values with an ‘R’ command.
4.1.1.3
“S” STORE: STORE CALIBRATION REGISTERS INTO FLASH
The Store command writes all the calibration values to the 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, not while it is in actual use.
Example: ‘SX’.
Returns: ‘SX’.
 2012-2013 Microchip Technology Inc.
DS52088B-page 37
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
4.1.1.4
“W” WRITE: WRITE STARTING AT SPECIFIED ADDRESS
Write specified bytes.
Example: ‘W030000102030405060708090A0B0C0D0E0FX’.
Returns: ‘W030000102030405060708090A0B0C0D0E0FX’.
Note:
If the 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 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
ASCII Data
“X” (ASCII)
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
TABLE 4-1:
WRITE COMMAND EXAMPLE
Description
WRITE 40000d to
GAIN_V_RMS Register
FIGURE 4-1:
Command ASCII
Command Hex
“W 02A 9C40 X”
57 30 32 41 39 43 34 30 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.
Command Byte
7 6 5 4 3 2 1 0
3 Address Bytes (ASCII)
7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0
# Bytes to Read (2 Bytes ASCII)
7 6 5 4 3 2 1 0
TABLE 4-2:
7 6 5 4 3 2 1 0
READ COMMAND EXAMPLE
READ on POWER_ACT Register
DS52088B-page 38
“X” (ASCII)
7 6 5 4 3 2 1 0
DESCRIPTION
FIGURE 4-2:
7 6 5 4 3 2 1 0
COMMAND ASCII
COMMAND HEX
“R 00D 04 X”
52 30 30 44 30 34 58
Read Command Protocol.
 2012-2013 Microchip Technology Inc.
Communication Protocol
4.1.1.6
"A" AUTOCALIBRATION: RUN AUTO-CALIBRATION ROUTINE
Example: "AX"
Returns: "DX" or "BX"
This command enables the auto-calibration routine only if it is present in the firmware
and returns "DX". If not, it returns "BX", indicating that the auto-calibration routine is
not present in the firmware (the statement "#define AUTOCALIBRATION_ENABLE"
is missing).
 2012-2013 Microchip Technology Inc.
DS52088B-page 39
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
NOTES:
DS52088B-page 40
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Chapter 5. Microchip Energy Meter Software
5.1
OVERVIEW
The Microchip Energy Meter Software is a Graphical User Interface (GUI) that runs on
a PC. It enables the meter to be monitored, debugged and calibrated during
development phase.
5.2
THE MAIN SCREEN
The main screen contains four tabs:
• Energy Meter: This tab contains the instantaneous meter output display and a
debug window, which enables access to all the internal registers of the meter.
• Closed Loop Calibration: This tab contains a calibration tool for closed loop
calibration.
• Open Loop Calibration: This tab contains a calibration tool for open loop
calibration.
• Auto Calibration: This tab contains an interface for auto calibration.
The calibration procedures are presented in detail in Chapter 6. “Energy Meter
Calibration”.
The COM port selection on the top of the window is used to select a serial port or a
serial port emulator (the energy meter must be connected to the PC via the USB
interface and powered up).
The status of the meter connection to the computer is displayed on the top of the
window (see Figure 5-1). If connected, this status displays the text “Meter Detected” in
green; when disconnected, it changes the status to “Meter Disconnected”, in red. The
status is present across all tabs.
FIGURE 5-1:
Energy Meter GUI – COM Port Selection.
 2012-2013 Microchip Technology Inc.
DS52088B-page 41
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
The tool has a feature to display the instantaneous parameters from the meter, updated
in real time (see Figure 5-2). The “Instantaneous Parameters” field contains the recent
meter output parameters: RMS Voltage, RMS Current, Line Frequency, Active Power,
Reactive Power, Apparent Power and Power Factor. The corresponding registers are
continuously collected and periodically refreshed on the PC side.
FIGURE 5-2:
DS52088B-page 42
Energy Meter GUI – Instantaneous Parameters Display.
 2012-2013 Microchip Technology Inc.
Microchip Energy Meter Software
5.3
DEBUG MODE
The Debug mode feature enables access to all the internal registers of the meter. From
the Energy Meter tab, click on the Enter Debug Mode button on the lower right corner
of the tool. The Debug mode screen appears ready for use.
Debug mode displays a complete list of the internal registers of the meter in detail:
address, name, attribute, register length and value.
Each register is available for read and write in real time, when the meter is computing.
5.3.1
Refreshing Registers Status
To update all the internal registers, click the Refresh Meter Registers button at the
bottom of the window, as shown in Figure 5-3. This will update the registers only once
per click.
FIGURE 5-3:
Energy Meter GUI – Debug Mode.
 2012-2013 Microchip Technology Inc.
DS52088B-page 43
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
5.3.2
Monitoring Individual Registers
The tool enables the selected registers to be monitored for their real-time updates.
Monitoring can be enabled by writing “1” to the column “Monitor” across a particular
register, as shown in Figure 5-4. By enabling the monitoring feature, once the Start
Refresh Instantaneous Data button is pressed, the GUI reads the register periodically,
showing the real-time status. Unless monitoring is enabled, the register status is not
updated after every instantaneous refresh.
FIGURE 5-4:
Energy Meter GUI – Monitoring Individual Registers in Debug Mode.
5.3.3
Writing to Individual Registers
For testing certain limiting conditions and manual tuning the calibration registers, the
software offers the option to write to individual registers. To write to a register, enter the
value in HEX format (as stored in the registers) in the “Value” column across that particular register and press <Enter> from the keyboard to initiate the write process.
DS52088B-page 44
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Chapter 6. Energy Meter Calibration
6.1
INTRODUCTION
This chapter describes the methods to calculate calibration parameters. It includes
various types of calibration suitable for different stages of meter design.
6.2
CALIBRATION REGISTERS
This registers that need to be calibrated include the following:
• Gain registers:
- GAIN_V_RMS
- GAIN_I_RMS_LOW
- GAIN_I_RMS_HIGH
- GAIN_POWER_ACT_LOW
- GAIN_POWER_ACT_HIGH
- GAIN_NUMR_ENERGY_ACT_LOW
- GAIN_NUMR_ENERGY_ACT_HIGH
- GAIN_DENR_ENERGY_ACT_LOW
- GAIN_DENR_ENERGY_ACT_HIGH
- GAIN_POWER_REACT_LOW
- GAIN_POWER_REACT_HIGH
- GAIN_NUMR_ENERGY_REACT_LOW
- GAIN_NUMR_ENERGY_REACT_HIGH
- GAIN_DENR_ENERGY_REACT_LOW
- GAIN_DENR_ENERGY_REACT_HIGH
• Phase compensation registers:
- PHASE_COMPENSATION_LOW
- PHASE_COMPENSATION_HIGH
All the calibration registers, except GAIN_V_RMS, have one set of values for the
low-current region and one for the high-current region. Each current region must be
calibrated separately. For this purpose, the mechanism that switches automatically
between the two current regions can be bypassed by setting the bit called
FORCE_CURRENT_REGION, in CAL_CONTROL register. In this mode, the current
region is set by the value of the CURRENT_REGION_SELECTED bit, in the same
register.
 2012-2013 Microchip Technology Inc.
DS52088B-page 45
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
6.3
CLOSED LOOP CALIBRATION
6.3.1
Closed Loop Calibration Principle
For this type of calibration, the energy meter must be connected to a calibration device,
consisting of a source with configurable RMS Voltage, RMS Current, Power Factor and
a Reference Meter. By reading the values indicated by the Reference Meter, and those
indicated by the meter to be calibrated, the calibration gain can be computed:
EQUATION 6-1:
Indication_from_Reference_Meter
New_gain = Existing_gain  ---------------------------------------------------------------------------------------------------------------Indication_from_Meter_to_be_calibrated
The indication can be Voltage RMS, Current RMS, Active/Reactive Power, or
Active/Reactive Energy Pulses.
Source
V, I, PF
Calibration
Equipm ent
Indication
Reference
M eter
FIGURE 6-1:
M eter to be
calibrated
Error [% ]
PC SW
Closed Loop Calibration Setup.
In the case of energy pulses, the calibration equipment can indicate the error between
the period of the pulses from its Reference Meter and the meter to be calibrated. In this
case, the previous formula is applied in this form:
EQUATION 6-2:
Existing _ gain
New_gain = ---------------------------------------Error  % 
-------------------------- + 1
100
The above formulas apply to gain calibration. They are computed for a power factor
of 1, except for the Reactive Energy and Power gains, which are computed at a different power factor (usually 0.5).
The information for phase compensation is extracted from the indication of the Active
Power at a power factor different than 1 (usually 0.5), after Active Power Gain has been
previously computed at the power factor of 1. For more information related to phase
compensation calibration, refer to Section 2.3.2.3 - Phase Compensation from the
“PIC18F87J72 Single-Phase Energy Meter Calibration User’s Guide (DS51964)”.
DS52088B-page 46
 2012-2013 Microchip Technology Inc.
Energy Meter Calibration
6.3.2
Closed Loop Calibration with Microchip Energy Meter Software
Select the Closed Loop Calibration tab. The screen from Figure 6-2 appears.
FIGURE 6-2:
Closed Loop Calibration Screen.
Before the actual calibration, the default values of the energy pulse parameters can be
modified. The software sets the corresponding registers:
• Pulse Width (ms) – PULSE_WIDTH
• Meter Constant (imp/kWh) – METER_CONSTANT
• No Load Threshold (mA) – NO_LOAD_THRESHOLD_I_RMS
After the modification, press the Save Parameters button to store the values to
EEPROM.
Enter the values indicated by the Reference Meter in the “Calibration Parameters”
fields. The recommended calibration values are 220V line voltage, 20A for the
high-current region and 3A for the low-current region.
 2012-2013 Microchip Technology Inc.
DS52088B-page 47
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
To start calibrating the high-current region, configure the source to provide the specified
high-region calibration current and select the “Enable High Current Region” check box.
The software will configure the corresponding register in the meter and force it to work
in the high-current region only. The screen will change, as shown in Figure 6-3.
FIGURE 6-3:
Closed Loop Calibration – High-Current Region.
The calibration of each current region consists of three stages that must be performed
in a specified order. In each stage, proceed with the following steps:
1. Configure the Power Factor from the source.
2. Obtain the indication of the energy pulse error in percentage format from the
Reference Meter .
3. Write the error value in the corresponding text box from the screen.
4. Press the corresponding Calibrate button.
When Calibrate is pressed, the software computes the new values of the following calibration registers, and saves them to EEPROM:
• High Region, Step 1: GAIN_V_RMS, GAIN_I_RMS_HIGH,
GAIN_POWER_ACT_HIGH, GAIN_NUMR_ENERGY_ACT_HIGH,
GAIN_DENR_ENERGY_ACT_HIGH
• High Region, Step 2: PHASE_COMPENSATION_HIGH
• High Region, Step 3: GAIN_POWER_REACT_HIGH,
GAIN_NUMR_ENERGY_REACT_HIGH, GAIN_DENR_ENERGY_REACT_HIGH
DS52088B-page 48
 2012-2013 Microchip Technology Inc.
Energy Meter Calibration
To calibrate the low-current region, configure the source to provide the specified
low-region calibration current and select the “Enable Low Current Region” check box.
The software will configure the corresponding register in the meter and force it to work
in the low-current region only. The screen will change, as shown in Figure 6-4.
FIGURE 6-4:
Closed Loop Calibration – Low-Current Region.
The user must perform the calibration in the same manner as for the high region. When
the Calibrate button is pressed, the software computes the new values of the following
calibration registers, and saves them to EEPROM:
• Low Region, Step 1: GAIN_I_RMS_LOW, GAIN_POWER_ACT_ LOW,
GAIN_NUMR_ENERGY_ACT_ LOW, GAIN_DENR_ENERGY_ACT_ LOW
• Low Region, Step 2: PHASE_COMPENSATION_ LOW
• Low Region, Step 3: GAIN_POWER_REACT_ LOW,
GAIN_NUMR_ENERGY_REACT_ LOW, GAIN_DENR_ENERGY_REACT_LOW.
After the last calibration step, the software will automatically deselect the “Enable Low
Current Region” check box, and the automatic current region selection mechanism
from the energy meter will be reactivated.
 2012-2013 Microchip Technology Inc.
DS52088B-page 49
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
6.4
OPEN LOOP CALIBRATION
6.4.1
Open Loop Calibration Principle
The meter to be calibrated is connected to a source delivering stable, known values of
RMS Voltage, RMS Current and Power Factor. This type of calibration does not require
a Reference Meter and feedback from the calibration device.
Source
Known V, I, PF
Meter to be
calibrated
PC SW
FIGURE 6-5:
Open Loop Calibration Setup.
The calibration software running on the PC computes the calibration coefficients based
on the values indicated by the meter and the known parameters of the source.
The calibration is done at a single power factor, different than 1 (to include the phase
compensation calibration). Usually, this power factor is 0.5.
The calibration parameters are computed differently, depending on the parameter type,
as follows:
• Voltage/Current RMS Gains: The software running on the PC reads the meter
output (RMS indication) and the existing calibration gain. It calculates the new
calibration gain with the following formula:
EQUATION 6-3:
Expected _ RMS _indication
New_RMS_gain = Existing_ RMS_ gain  ----------------------------------------------------------------------Read _ RMS _indication
• Active/Reactive Energy and Power Gains: The software running on the PC
computes these values directly, based on the assumption they are proportional to
the Voltage and Current RMS gains:
EQUATION 6-4:
Energy  Power  _gain = Voltage _ RMS_ gain  Current _RMS_gain  k
The proportionality factors, noted with “k” in the above formula, are hard-coded in the
software. They can be computed by knowing all the operations applied in the signal
processing chain (bit shifts, number of samples per line cycle, number of cycles per
computation cycle), or by the simpler way, computing them from the readings of the
RMS and energy/power gains on a calibrated meter.
• Phase Compensation: The software on the PC reads the indicated Active Power
from the energy meter. By knowing the expected Active Power (since the voltage,
current and the applied power factor are already known), it computes the phase
compensation. For more information related to phase compensation calibration,
refer to Section 2.3.2.3 - Phase Compensation in “PIC18F87J72 Single-Phase
Energy Meter Calibration User’s Guide (DS51964)”.
DS52088B-page 50
 2012-2013 Microchip Technology Inc.
Energy Meter Calibration
6.4.2
Open Loop Calibration with Energy Meter GUI
When the Open Loop Calibration tab is selected, the screen in Figure 6-6 will appear.
FIGURE 6-6:
Open Loop Calibration Screen.
The source must be configured with the parameters specified in the “Calibration
Parameters” box. The recommended calibration values are 220V line voltage, 20A for
the high-current region, and 3A for the low-current region. The user can modify these
values, but it is recommended to have the high-region calibration current higher than
5A, and the low-region calibration current lower than 5A.
 2012-2013 Microchip Technology Inc.
DS52088B-page 51
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
To start calibrating the high-current region, configure the source to provide the specified
high-region calibration current, at power factor of 0.5, and select the “Enable High
Current Region” check box. The software will configure the corresponding register in
the meter and force it to work in the high-current region only. The following window will
appear:
FIGURE 6-7:
Open Loop Calibration – High Current Region
Press Calibrate. The GUI sends a confirmation message when the calibration is
complete and the new registers are saved to EEPROM.
At this step, the GUI calibrates all the registers related to the high-current region and
the GAIN_V_RMS register. The energy gain registers are calibrated for a meter
constant of 3200 imp/kWh.
DS52088B-page 52
 2012-2013 Microchip Technology Inc.
Energy Meter Calibration
To calibrate the low-current region, configure the source to provide the specified
low-region calibration current, at power factor of 0.5, and select the “Enable Low
Current Region” check box. The software will configure the corresponding register in
the meter and force it to work in the low-current region only. The following window will
appear:
FIGURE 6-8:
Open Loop Calibration – Low- Current Region.
Press Calibrate. A confirmation message will be sent when the calibration is complete
and the new registers are saved to EEPROM.
At this step, the GUI calibrates all the registers related to the low-current region. The
energy gain registers are calibrated for a meter constant of 3200 imp/kWh.
 2012-2013 Microchip Technology Inc.
DS52088B-page 53
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
6.5
AUTO-CALIBRATION
6.5.1
Auto-Calibration Principle
Auto Calibration is considered to be the open loop calibration routine implemented into
the energy meter’s firmware. Communication with the PC is not required during this
procedure.
The Auto-Calibration routine can be triggered by external events, such as I/O pin state
change (from push-button, jumper or other MCU), or UART command (as in this
design).
When the trigger event is received, the meter enters into Auto-Calibration mode: it
acquires data, computes the calibration parameters and saves them to EEPROM.
Then it returns back to Normal mode.
Because the calibration routine occupies a significant size of the program memory, the
user has the option to remove it from the code by commenting the statement #define
AUTOCALIBRATION_ENABLE in the file Config_EnergyMeter.c. If the size of the
program memory becomes a limitation in the user’s custom design, the user may create two firmware versions: one for the calibration, with a reduced set of features, and
one with the auto-calibration routine removed and the complete set of features.
The auto-calibration method implemented in this design requires only one current level.
Both low- and high-current regions are calibrated at 5A. This value was selected to be
in the range of both regions.
The execution time of the auto calibration routine includes the following components:
• the duration of two line cycles (one for the high-current region and one for the
low-current region)
• calibration registers calculation time (it is much lower than the duration of a line
cycle so it can be neglected)
• the necessary time to store the calibration registers to EEPROM
DS52088B-page 54
 2012-2013 Microchip Technology Inc.
Energy Meter Calibration
6.5.2
Auto-Calibration with Energy Meter GUI
When the Auto Calibration tab is selected, the following screen appears:
FIGURE 6-9:
Auto-Calibration Screen.
The source must be configured with the parameters specified in the text above the
Calibrate button.
After Calibrate is pressed, three possible messages can appear:
• An error message indicating that the auto-calibration routine is not present in the
meter code, because the firmware was compiled with the statement #define
AUTOCALIBRATION_ENABLE commented or missing.
• “Auto Calibration Complete”
• “Communication error. Calibration not done.” — this means the GUI did not
receive feedback from the energy meter.
In the current firmware version, the energy gain registers are computed for a meter
constant of 3200 imp/kWh.
 2012-2013 Microchip Technology Inc.
DS52088B-page 55
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
NOTES:
DS52088B-page 56
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Appendix A. Schematic and Layouts
A.1
INTRODUCTION
This appendix contains the following schematics and layouts of the MCP6L2 and
PIC18F66J93 Energy Meter:
•
•
•
•
•
•
•
•
•
A.2
Board – Schematic – Analog-to-Digital Converter
Board – Schematic – Microcontroller
Board – Schematic – LCD - USB
Board – Top Silk
Board – Top Copper
Board – Top Silk and Copper
Board – Bottom Silk
Board – Bottom Copper
Board – Bottom Silk and Copper
SCHEMATICS AND PCB LAYOUT
The layer order is shown in Figure A-1.
Top Layer
Bottom Layer
FIGURE A-1:
 2012-2013 Microchip Technology Inc.
Layer Order.
DS52088B-page 57
BOARD – SCHEMATIC – ANALOG-TO-DIGITAL CONVERTER
0603
R1
Line shunt
681k
1%
R2
0603
1%
681k
TP1
3.3A
L1
CP1
Via_2.5x1.5
Ferrite Bead 0805
R3
0603
49.9
1%
R5
0603
499
1%
499
1%
L2
-A
Ferrite Bead 0805
MCP6L2
1
OUTA
3
AGND
0603
R15
0603
49.9
1%
0603
499
1%
499
1%
1%
to ADC
AGND
0603
1%
681k
AGND
0603
681k
1%
R21
0603
681k
R24
R25
0603
R26
0603
49.9
1%
0603
499
1%
5.1k
1%
-B
C9
C10
2.2uF
0603
220nF
0603
49.9
1%
0603
R28
AGND
AGND
R29
0603
R31
0603
499
1%
5.1k
1%
U1B
MCP6L2
7
OUTB
R32
681k
0603
270
1%
3.3A
0603
1%
AGND
AGND
U2
VIN
VOUT
3.3A
! ! ! DANGER
2
C15
0.1uF
0603
MRA4005
MAY CAUSE EXTERNAL
EQUIPMENT DAMAGE
C17
0.1uF
0603
C16
10uF
1206
1
AND SHOCK HAZARD
 2012-2013 Microchip Technology Inc.
GNDB
Power Jack 2.5 mm
GNDB
GNDB
L3
R34
NEUTRAL
Ferrite Bead Axial
MOV1
S20K420
470
5%
AXIAL 25.4-18x7.5
C19
0.01uF
RAD_10x13x4
R33
0
0603
DNP
GNDB
GNDB
D2
C18
U3
0.47uF
RAD_15x18x11
MRA4005
3.3D
If using only one LDO
MCP1703-3.3V
C20
470uF
AL-F
D3
15V
L4
1
R35
47k 5%
0603
R36
10k 5%
0603
LINE
Ferrite Bead Axial
CP4
VIN
VOUT
3
GND
C21
0.1uF
0603
2
C22
10uF
1206
C23
0.1uF
0603
Via_2.5x1.5
GNDB
LINE_PWR_DET
NT1
Net Tie
GNDB
AGND
GNDB
GNDB
! ! !
CONNECTING TO J1, J3, TP1-TP3
GND
D1
+9V IN
VOLTAGE IN
Via_2.5x1.5
R22
51k 1%
0603
C14
0.1uF
0603
3
GNDB
GNDB
GNDB
R17
0603
3.4k
1%
C7
150nF
0603
AGND
MCP1754-3.3V
CP3
0603
0
47uF
TANT-A
R23
0
0603
to ADC
I_HIGH_L
Current Channel
1
3
2
TP3
AGND
+9V IN POWER
J1
R11
51k 1%
0603
C11
220nF
0603
AGND
AGND
R27
4
AGND
C13
220nF
0603
AGND
8
VDD
0603
1%
681k
R30
C12
2.2uF
0603
+B
3.3A
R16
VSS
5
3.3A
R9
100k
1%
2010
R20
820 1%
0603
TP2
6
R8
100k
1%
2010
1%
3.3A
AGND
R7
100k
1%
2010
VOLTAGE IN
C4
AGND
AGND
Voltage channel
C3
220nF
0603
4
R18
R19
C6
220nF
0603
0603
680
0603
1%
681k
R14
R6
I _LOW_L
VSS
+A
3.3A
R13
C5
2.2uF
0603
U1A
VDD
C2
220nF
0603
AGND
8
2
R12
CP2
Via_2.5x1.5
0603
C1
2.2uF
0603
R10
2.49 1%
0603
SHUNT
R4
V_CHANNEL
C8
33nF
0603
AGND
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
DS52088B-page 58
A.3
BOARD – SCHEMATIC – MICROCONTROLLER
24
MCLR
18
ENVREG
3.3D
64
LCDBI AS3
3.3D
C28
GNDB
1206
10
RA0/AN0
RA1/AN1/SEG18
VDDCORE/VCAP
RA5/AN4/SEG15
OSC2/CL KO/RA6
OSC1/CL KI /RA7
AVDD
RB0/I NT0/SEG30
I_HIGH_L
I_LOW_L
V_CHANNEL
23
22
21
28
RA2/AN2/VREFRA3/AN3/VREF+
RA4/T0CKI /SEG14
LINE_PWR_DET
27
40
X2
8MHz
OSC2
39
19
26
38
57
3.3D
3.3D
3.3D
3.3D
C32
0.1uF
0603
C31
0.1uF
0603
3.3D
C33
0.1uF
0603
3.3A
20
9
25
41
56
C35
0.1uF
0603
C34
0.1uF
0603
GNDB
GNDB
GNDB
AVSS
VSS
VSS
VSS
VSS
RB1/I NT1/SEG8
RB2/I NT2/SEG9
46
45
44
43
42
RB3/I NT3/SEG10
RB4/KBI 0/SEG11
RB5/KBI 1/SEG29
RB6/KBI 2/PGC
RB7/KBI 3/PGD
AGND
37
LCD_9B/9F/9E/NC
LCD_9A/0F/9E/9D
LCD_10B/10G/AOC/NC
LCD_10A/10F/10E/10D
LCD_V/K2/R/H2
LCD_V/K1/H1/A/W
WP
CF_ACTIVE
17
16
LCD_2A/2F/2E/2D
LCD_2B/2G/2C/2P
15
LCD_1A/1F/1E/1D
LCD_1B/1G/1C/1P
LCD_3B/3G/3C/3P
LCD_3A/3F/3E/3D
14
13
12
11
LCD_4B/4G/4C/4P
4
5
6
MPU_SW3
MPU_SW2
8
RF1/AN6/C2OUT/SEG19
RF2/AN7/C1OUT/SEG20
RF3/AN8/SEG21
RF4/AN9/SEG22
RF5/AN10/CVREF/SEG23
RF6/AN11/SEG24
RF7/AN5/SS/SEG25
RG1/TX2/CK2
RG2/RX2/DT2/VL CAP1
RG3/VL CAP2
RG4/SEG26
RD1/SEG1
RD2/SEG2
RD3/SEG3
RD4/SEG4
RD5/SEG5
RD6/SEG6
RD7/SEG7
RG0/L CDBI AS0
RE0/L CDBI AS1
RE1/L CDBI AS2
RE3/COM0
RE4/COM1
RE5/COM2
RE6/COM3
RE7/CCP2/SEG31
58
55
54
53
52
51
50
49
1
4
2
SCL
3
GNDB
SW1
SDA
SW Tact SMD
CF_REACTIVE
MPU_TX1
MPU_RX1
RC7/RX1/DT1/SEG28
RD0/SEG0
GNDB
MPU_PGD
36
31
32
RC5/SDO/SEG12
RC6/TX1/CK1/SEG27
GNDB
MPU_PGC
30
29
33
34
35
RC0/T1OSO/T13CKI
RC1/T1OSI /CCP2/SEG32
RC2/CCP1/SEG13
RC3/SCK/SCL /SEG17
RC4/SDI /SDA/SEG16
GNDB
AGND
GNDB
VDD
VDD
VDD
48
47
C30
22pF
0603
C29
22pF
0603
OSC1
10uF
3.3A
OSC2
U6
7
MPU_MCLR
OSC1
 2012-2013 Microchip Technology Inc.
A.4
R40
5%
1k
0603
3.3D
LCD_5B/5G/5C/NC
LCD_5A/5F/RE/5D
LCD_6B/6G/6C/NC
3
2
1
63
62
61
60
59
LCD_6A/6F/6E/6D
LCD_7B/7G/7C/NC
LCD_7A/7F/7E/7D
LCD_8B/8G/8C/NC
LCD_8A/8F/8E/8D
J3
10k
C36
0.1uF
0603
GNDB
6
5
4
0603
5% R43
R42
R41
5%
10k
0603
3
0603
5%
10k
LCD_COM1
R44
0603
10k
5%
2
1
3.3D
MPU_MCLR
3.3D
GNDB
MPU_PGD
MPU_PGC
HDR M 1x6 VERT
LCD_COM2
LCD_COM3
LCD_COM4
IN CIRCUIT DEBUG / PROGRAMMING HEADER
LCD_4A/4F/4E/4D
PIC18F66J93
3.3D
ACTIVE PWR
1
R48
5%
4.7k
0603
R51
3.3k
5%
0603
R50
1k 5%
0603
R49
0603
MPU_SW2
LD2
LED 5mm Red
1k
U8
4
1
2
2
3
2
2
1%
3
GNDB
R45
2.2k
5%
0603
SW2
C38
0.1uF
0603
J4
1
SW Tact SMD
U7
1
A0
2
A1
3
A2
GNDB
HDR M 1x2 VERT
PC365N
GNDB
3.3D
4
1
GNDB
WP
SCL
SDA
GNDB
8
3.3D
VCC
VSS
CF_REACTIVE
3.3D
R54
3.3k
5%
0603
R53
1k 5%
0603
REACTIVE PWR
1
LD3
LED 5mm Red
1
U9
4
2
DS52088B-page 59
2
PC365N
GNDB
R52
5%
4.7k
0603
3
2
C37
0.1uF
0603
J5
1
HDR M 1x2 VERT
R55
1k
1
4
GNDB
0603
MPU_SW3
2
1%
3
SW3
C39
0.1uF
0603
GNDB
GNDB
SW Tact SMD
GNDB
24FC256
R46
2.2k
5%
0603
7
WP
6
SCL
SDA
5
4
R47
2.2k
5%
0603
GNDB
Schematic and Layouts
CF_ACTIVE
VBUS
3
D+
ID
GND
5VUSB
 2012-2013 Microchip Technology Inc.
2
RED
3
red
4
green
R39
0603
390
5%
4
USB_D+
5
USB-B-Mini TH
GND_I SO
1
1
X1
12MHz
LD1
GREEN
LED RD/GN SMD
R38
0603
390
5%
2
GND_I SO
5VUSB
5VUSB
C27
1uF
0603
390
20
VDD
VSS
19
OSC1
D+
18
OSC2
D17
RST
VUSB
16
GP7/TxL ED
GP0
15
GP6/RxL ED
GP1
14
GP5
GP2
13
GP4
CTS
12
GP3
RX
11
TX
RTS
9A/9F/93/9D
USB_D-
GND_ISO
4B/4G/4C/4P
3A/3F/3E/3D
3B/3G/3C/3P
6B/6G/6C/NC
5A/5F/5E/5D
5B/5G/5C/NC
4A/4F/4E/4D
7A/7F/7E/7D
7B/7G/7C/NC
6A/6F/6E/6D
9B/9G/9C/NC
8A/8F/8E/8D
8B/8G/8C/NC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
LCD_3A/3F/3E/3D
LCD_3B/3G/3C/3P
LCD_4A/4F/4E/4D
LCD_4B/4G/4C/4P
LCD_6B/6G/6C/NC
LCD_5A/5F/RE/5D
LCD_5B/5G/5C/NC
LCD_7B/7G/7C/NC
LCD_6A/6F/6E/6D
LCD_8A/8F/8E/8D
LCD_8B/8G/8C/NC
LCD_7A/7F/7E/7D
LCD_9A/0F/9E/9D
LCD_9B/9F/9E/NC
LCD_10B/10G/AOC/NC
LCD_10A/10F/10E/10D
LCD_V/K1/H1/A/W
LCD_V/K2/R/H2
BOARD – SCHEMATIC – LCD - USB
C25
1uF
0603
GND_ISO
LCD1
India
USB_D-
kvARh
kWh
5VUSB
3
5VUSB
Isolation
Barrier
U4
5VUSB
GND_I SO
MCP2200_RX
MCP2200_TX
1
2
3
4
MCP2200
VDD1
OUT1
IN2
GND1
VDD2
IN1
OUT2
GND2
3.3D
GND_I SO
USB_D+
C26
0.1uF
0603
C24
0.1uF
0603
U5
8
7
6
5
3.3D
GNDB
MPU_TX1
MPU_RX1
IL721-3E
GND_I SO
GNDB
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
GND_I SO
R37
1
2
3
0603 4
5% 5
6
7
8
9
10
LCD_1A/1F/1E/1D
LCD_2B/2G/2C/2P
LCD_2A/2F/2E/2D
5VUSB
24
1B/1G/1C/1P
23
1A/1F/1E/1D
22
2B/2G/2C/2P
21
2A/2F/2E/2D
1
K1/h1/A/W
v/k2/R/h2
11A/11F/11E/11D
11B/11G/11C/NC
10A/10F/10E/10D
10B/10G/10C/NC
J2
LCD_1B/1G/1C/1P
2
28
COM4
27
COM3
26
COM2
25
COM1
D-
LCD_COM3
LCD_COM2
LCD_COM1
LCD_COM4
DS52088B-page 60
A.5
Schematic and Layouts
A.6
BOARD – TOP SILK
 2012-2013 Microchip Technology Inc.
DS52088B-page 61
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
A.7
BOARD – TOP COPPER
DS52088B-page 62
 2012-2013 Microchip Technology Inc.
Schematic and Layouts
A.8
BOARD – TOP SILK AND COPPER
 2012-2013 Microchip Technology Inc.
DS52088B-page 63
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
A.9
BOARD – BOTTOM SILK
DS52088B-page 64
 2012-2013 Microchip Technology Inc.
Schematic and Layouts
A.10 BOARD – BOTTOM COPPER
 2012-2013 Microchip Technology Inc.
DS52088B-page 65
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
A.11 BOARD – BOTTOM SILK AND COPPER
DS52088B-page 66
 2012-2013 Microchip Technology Inc.
MCP6L2 AND PIC18F66J93
ENERGY METER
REFERENCE DESIGN
Appendix B. Bill of Materials (BOM)
TABLE B-1:
Qty.
BILL OF MATERIALS (BOM)
Reference
Description
Manufacturer
Part Number
4
C1, C5,
C9, C12
Cap. ceramic 2.2 uF 6.3V 10% X7R 0603
TDK®
6
C2, C3,
C6, C10,
C11, C13
Cap. ceramic 0.22 uF 10V 10% X7R 0603
TDK Corporation
C1608X7R1A224K
1
C4
Cap. tant. 47 uF 4V 10% size A
AVX Corporation
TAJA476K004RNJ
1
C7
Cap. ceramic 0.15 uF 16V 10% X7R 0603
TDK Corporation
C1608X7R1C154K
Corporation
C1608X7R0J225K
1
C8
Cap. ceramic 33 nF 50V 10% X7R 0603
TDK Corporation
C1608X7R1H333K
16
C14, C15,
C17, C21,
C23, C24,
C26, C31,
C32, C33,
C34, C35,
C36, C37,
C38, C39
Cap. ceramic 0.1 uF 16V 10% X7R 0603
TDK Corporation
C1608X7R1C104K
3
C16, C22,
C28
Cap. ceramic 10 uF 10V X7R 20% 1206
TDK Corporation
C3216X7R1A106M
1
C18
Cap. film 0.47 uF 305V AC power supply
EPCOS AG
B32932A3474M
1
C19
Cap. film .01 uF 330V AC suppress
EPCOS AG
B32911A3103M
1
C20
Cap. elect. 470 uF 16V 20% VS size F
Panasonic®- ECG
EEE-1CA471UP
2
C25, C27
Cap. ceramic 1 uF 10V X7R 20% 0603
TDK Corporation
C1608X7R1A105M
2
C29, C30
Cap. ceramic 22 pF 50V 5% C0G. 0603
TDK Corporation
C1608C0G1H220J
®
MRA4005T3G
2
D1, D2
Diode STD REC 1A 600V SMA.
ON Semiconductor
1
D3
Diode Zener 15V 1W DO-41
Fairchild
Semiconductor®
1N4744A
1
J1
Conn. power jack male 2.5 mm clsd.
CUI Inc
PJ-002B
Conn. recept. USB TH. vert. 5 pos.
Molex®
500075-1517
1
J2
1
J3
Conn. hdr. male .100 1 x 6 pos. vert.
TE Connectivity, Ltd.
HDR M 1x6 Vertical
2
J4, J5
Conn. hdr. male .100 1 x 2 pos. vert.
TE Connectivity, Ltd.
HDR M 1x2 Vertical
2
L1, L2
Ferrite 800 MA 150 mOhm 0805 SMD.
Laird Technologies®
LI0805H151R-10
2
L3, L4
Bead core single 3.8 X 5.3 mm axial
Panasonic - ECG
EXC-ELSA35
1
LD1
LED 2 X 1.2mm rd/gn wtr. clr. SMD.
Kingbright
Corporation
APHBM2012SURKCGKC
2
LD2, LD3
LED 5mm RED 640 nm 20 mcd 2 mA
Kingbright
Corporation
WP7113LSRD
1
MOV1
Varistor 420 V RMS 20 mm radial
EPCOS AG
S20K420
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.
 2012-2013 Microchip Technology Inc.
DS52088B-page 67
MCP6L2 and PIC18F66J93 Energy Meter Reference Design
TABLE B-1:
Qty.
BILL OF MATERIALS (BOM) (CONTINUED)
Reference
Description
Manufacturer
Part Number
1
PCB
Printed Circuit Board – MCP6L2 and
PIC18F66J93 Energy Meter Reference
Design
—
104-00370
8
R1, R2,
R12, R18,
R19, R21,
R28, R32
Res. 681 kOhm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF6813V
4
R3, R13,
R24, R29
Res. 49.9 Ohm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF49R9V
6
R4, R5,
R14, R15,
R25, R30
Res. 499 Ohm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF4990V
1
R6
Res. 680 Ohm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF6800V
3
R7, R8, R9 Res. 100 kOhm 3/4W 1% 2010 SMD.
Panasonic - ECG
ERJ-12SF1003U
®
1
R10
Res. 2.49 Ohm 1/10W 1% 0603 SMD.
Vishay
Intertechnology, Inc.
CRCW06032R49FKEA
2
R11, R22
Res. 51 kOhm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF5102V
ERJ-3GEY0R00V
2
R16, R23
Res. 0 Ohm 1/10W 0603 SMD.
Panasonic - ECG
1
R17
Res. 3.4 kOhm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF3401V
1
R20
Res. 820 Ohm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF8200V
2
R49, R55
Res. 1 kOhm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF1001V
2
R26, R31
Res. 5.1 kOhm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF5101V
1
R27
Res. 270 Ohm 1/10W 1% 0603 SMD.
Panasonic - ECG
ERJ-3EKF2700V
1
R34
Res. 470 Ohm 3W 5% axial
Panasonic - ECG
RSMF3JT470R
1
R33
Res. 0 Ohm 1/10W 0603 SMD. DO NOT POPULATE
Panasonic - ECG
ERJ-3GEY0R00V
1
R35
Res. 47 kOhm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ473V
5
R36, R41,
R42, R43,
R44
Res. 10 kOhm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ103V
3
R37, R38,
R39
Res. 390 Ohm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ391V
3
R40, R50,
R53
Res. 1 kOhm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ102V
3
R45, R46,
R47
Res. 2.2 kOhm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ222V
2
R48, R52
Res. 4.7 kOhm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ472V
2
R51, R54
Res. 3.3 kOhm 1/10W 5% 0603 SMD.
Panasonic - ECG
ERJ-3GEYJ332V
3
SW1, SW2, Switch tact. 6 mm 160 GFH = 4.3 mm
SW3
Omron Electronics
B3S-1000P
1
U5
Isolator HS dual digital SOIC-8
NVE Corporation
IL721-3E
2
U8, U9
Photocoupler Darl. Out 4-SMD.
Sharp Corporation
PC365NJ0000F
Electronics®
1
X1
Ceramic Resonator 12.0 MHz SMD.
Murata
1
X2
Crystal 8 MHz 18 pF SMD.
Abracon®
Corporation
Note 1:
CSTCE12M0G55-R0
ABLS-8.000MHZ-B4-T
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.
DS52088B-page 68
 2012-2013 Microchip Technology Inc.
Bill of Materials (BOM)
TABLE B-2:
Qty
BILL OF MATERIALS – MICROCHIP CONSIGNED PARTS
Reference
Description
Manufacturer
Part Number
1
LCD1
LCD 7 digits 28 pins
Xiamen Ocular Optics DP076P
Co., Ltd.
1
U1
IC op amp 2.8MHZ 2.7V SOIC-8
Microchip
Technology Inc.
MCP6L2T-E/SN
1
U2
IC reg. LDO 150mA 3.3V SOT-23A-3
Microchip
Technology Inc.
MCP1754ST-3302E/CB
1
U3
IC reg. LDO 250mA 3.3V SOT-223-3
Microchip
Technology Inc.
MCP1703-3302E/DB
1
U4
IC USB to UART SSOP-20
Microchip
Technology Inc.
MCP2200-I/SS
1
U6
IC PIC MCU Flash 64K X 4 TQFP-64
Microchip
Technology Inc.
PIC18F66J93-I/PT
1
U7
IC EEPROM 256 KBIT 1 MHZ SOIC-8
Microchip
Technology Inc.
24FC256-I/SN
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.
 2012-2013 Microchip Technology Inc.
DS52088B-page 69
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://www.microchip.com/
support
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-4123
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 - Osaka
Tel: 81-6-6152-7160
Fax: 81-6-6152-9310
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
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
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-8569-7000
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
China - Hangzhou
Tel: 86-571-2819-3187
Fax: 86-571-2819-3189
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Hong Kong SAR
Tel: 852-2943-5100
Fax: 852-2401-3431
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
Taiwan - Hsin Chu
Tel: 886-3-5778-366
Fax: 886-3-5770-955
China - Shenzhen
Tel: 86-755-8864-2200
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-213-7828
Fax: 886-7-330-9305
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Taiwan - Taipei
Tel: 886-2-2508-8600
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
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
DS52088B-page 70
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Japan - Tokyo
Tel: 81-3-6880- 3770
Fax: 81-3-6880-3771
11/29/12
 2012-2013 Microchip Technology Inc.