English
Language : 

AN939 Datasheet, PDF (12/18 Pages) Microchip Technology – Designing Energy Meters with the PIC16F873A
AN939
To calibrate the meter:
1. Connect the meter to a test stand or other
system, following the equipment manufacturer’s
directions.
2. Measure and record the signed error between
the meter and the test equipment on both cur-
rent channels (CT1 and CT2) for each of these
parameters:
• 1A supply at UPF
• 10A supply at UPF
• 10A supply at a power factor with 0.5 lag
(60 degree current lag)
3. Launch the Meter Calibration Software. At the
main screen, click on Calibration. The
Calibration window appears (Figure 8).
4. Enter the six error measurements in the places
indicated. Click on the Process button. The
software will automatically calculate and display
the proper calibration values. At this point, you
should also set the meter serial number and
date and time to be downloaded, as well as the
serial port to be used.
5. Disconnect the meter from the test stand.
Connect it to a power source and to the computer
using a standard DB9 serial cable.
Note:
While the meter’s serial data port is
isolated from the rest of the meter circuitry,
the meter ground is not. This poses a
potential risk to the computer and the user.
When performing any calibration, always
run the computer on a power source that
does not share a ground with the meter.
The best option is to run the computer
from a battery.
6. Place a jumper across JP1 to enable calibration.
7. Click on the Connect button. The software
automatically connects to the meter, which
downloads the calibration data and stores it in
data EEPROM. The progress of the data
connection and download is displayed in the
lower right-hand corner of the window. When
complete, the software displays “Calibration
Complete”.
8. Remove the calibration jumper. Disconnect the
serial cable.
RESOURCE USAGE
Although the energy meter design provides both basic
and additional special features, other features may be
required by a particular customer. This implementation
provides additional room, both in terms of memory and
hardware resources, to expand the application to the
customer’s needs. A summary of the resources used
for the basic PIC16F873A device-based design is
provided in Table 1.
TABLE 1:
RESOURCES USED BY
ENERGY METER FIRMWARE
(PIC16F873A VERSION)
Resource
Used by Application
Program Memory (words)
RAM (bytes)
Data EEPROM (bytes)
I/O Pins
Timer Resources
ADC Channels
3.5K
190
78
22
1 (Timer0)
2
CONCLUSION
Implementing a electronic watthour meter with a
microcontroller should be a straightforward exercise in
design. The PIC16F873A and PIC18F2320 micro-
controllers provide a cost-effective way to implement a
metering solution with a low part count. Simple current
and voltage sampling techniques yield a design that
meets Class 1 accuracy for residential metering
requirements, while delivering additional features, such
as peak demand tracking and tamper detection. All of
this can be achieved without sacrificing cost
competitiveness.
DS00939A-page 12
© 2005 Microchip Technology Inc.