7 reconfiguring “glue logic, 8 dsp operations, 9 coping with various current sensors – Maxim Integrated 71M6534 Energy Meter IC Family Software User Manual
Page 79: 10 user interface, 11 operating without user interface, 12 communication with a computer, 13 support of automatic meter reading, Reconfiguring “glue logic, Dsp operations, Coping with various current sensors

71M653X Software User’s Guide
The classic C++ scheme uses a table of subroutine pointers for each class. It performs poorly on the 8051. The 8051
accesses tables of indirect addresses rather slowly.
5.14.1.7 Reconfiguring “Glue Logic”
Compilation switches enable cases. In many cases, code can include a different include (.h) file to customize for a
different device. If code is not enabled, it shouldn’t run or be in the code.
For released code, or other point releases, an “unifdef” utility will be used to remove unused conditional code. This
makes the code easier to read, but reduces flexibility.
5.14.1.8 DSP Operations
Teridian’s solution for providing a superios electricity metering IC has been to use a simplified 32-bit digital signal
processor, the CE, triggered by the ADC multiplexer. Since DSP Code is too hard to develop, prewritten DSP code is
provided for the CE. This code is suitable for most metering applications, with optimized performance going right to the
chip’s noise floor. It helps that metering is a standard application for most customers.
5.14.1.9 Coping with Various Current Sensors
The MPU code has Imax and Imax2. The calculations automatically convert data from phase B into the same units as
phase A, if the “dual Imax” compilation option is set. See meter\meter.c RescalePhaseB().
5.14.1.10 User Interface
The main user interface is an RS-232 command line interface with a help system. This consumes a surprisingly large
amount of code because it performs line editing.
There is code that controls an LCD. The meter chip has bits in its I/O area that turn each LCD segment on and off.
The segments form segments of numerals, etc. Software arranges to turn the right segments on and off in order to
show numbers and annunciators. The code for this looks up a bit mask for each character to decide which pieces of
numeral to turn on and off.
In this demo software, pressing the pushbutton changes the display items, or wakes the meter from its low power
mode. Most meters have at least one operating switch. The classic is a magnetic reed switch controlled by a magnet
outside the meter enclosure. Real meters (but not this demo software) use it to step through a menu system.
5.14.1.11 Operating without User Interface
The EEPROM can be initialized in a programmer with the calibration data. This saves the code and data needed by
the meter.
5.14.1.12 Communication with a Computer
This demo code implements both a CLI, and the CP. Code is available for FLAG.
The classic scheme, not provided by this demo code, is to use a serial port communicating via either an infra-red LED
and phototdiode, or a low-speed current-loop. The infrared interface is popular in areas where the meter-reader has
access to the meter. The current-loop is popular when the meters are inside a building. In this case, a connector is
avialable on the outside of the building to read all the meters within it.
5.14.1.13 Support of Automatic Meter Reading
The meter must keep running, but must also present a consistent set of data for the asynchronous meter-reading
system. The solution is to make a stable copy at a controlled time in the metering cycle, and then let the AMR system
read the stable data.
When the hand-held unit logs on, the serial protocol sets a flag (update_register) asking the meter to copy the
registers to stable storage. See Meter\meter.c, the call to Update_register() in meter_run(). When the stable
copy is available, the flag register_available is set to true.
If a read request occurs while the copy is going on (i.e. register_available is false), the protocol requests that the
message be resent (see Flag\Flag0.c orflag1.c, case “R” of the NoError case of do_cmd()). This negative
v1.1v1.1
TERIDIAN Proprietary
79 of 116
© Copyright 2005-2008 TERIDIAN Semiconductor Corporation