beautypg.com

7 ce/mpu interface, 8 boot loader, 9 source files – Maxim Integrated 71M6521BE Energy Meter IC Family Software User Manual

Page 69: Ce/mpu interface, Boot loader, Source files

background image

71M652X Software User’s Guide

Revision 1.7

TERIDIAN Proprietary

69 of 138

© Copyright 2005-2007 TERIDIAN Semiconductor Corporation

At the end of each accumulation interval, an MPU interrupt, the "xfer_interrupt" occurs (see ce.c, xfer_busy_isr())
occurs. This is the signal for the MPU to copy the above data to stable storage for further use.

At this time, the MPU performs creep detection (meter.c Apply_Creep() ). If the measured voltage, current and/or
power is below the minimum, no results for volts, current or watts are reported. If the voltage is below the threshold, no
frequency or edge counts are reported. If the current is below the minimum, no current, Wh, VARh or VAh are
reported.

The MPU's creep thresholds are configurable (VThrshld, IThrshld).

The MPU calculates human-readable values, and accumulates cumulative quantities (see meter.c, meter_run.ce.c,
ce_update() ). The MPU scales these values to the voltage and current sensors used on the PCB (see VMAX and
IMAX).

Wh and VARh quantities are signed, permitting the MPU to perform net metering by assigning negative values to
"export" and positive values to "import" (see meter.c. Wh.c, VAh.c and VARh.c.

Meters require more precision than standard C floating point provides. The Demo Code has reusable calculations for
meter math (mmath.c). These automatically convert CE counts into a major running count of Wh, and a minor
remainder of CE counts.

The MPU also places a scaled value into the CE RAM for each pulse output (meter.c, meter_run(), pulse_src.c,
selectpulses() ). This adjusts the pulse output frequency in such a way as to reflect that accumulation's contribution to
the total pulse interval. Pulse intervals are cumulative, and cumulatively accurate, even though the frequency is
updated only periodically.

Placing the pulse value selection logic into the MPU software means that any quantity from any phase or combination
of phases can control either pulse output (see PulseSrcFunc[] for a list of transfer functions).

The MPU also performs temperature adjustments of the real-time clock (rtc_10.c, RTC_Trim(), RTC_Adjust_Trim() ).
The Demo Code can adjust the clock speed to a resolution of 1 part per billion, roughly one second per thirty years.
The adjustments include offset (Y_CAL), temperature-linear (Y_CALC) and temperature-squared (Y_CALC2)
parameters.

Once a human-readable quantity is available, it can be translated into a set of segments (meter.c, lcd.c) to display on
the liquid crystal display, or read from a register in memory by means of the command-line interface (cli.c), or possibly
some other serial protocol such as Flag (see flag.c) or NEMA.

5.7 CE/MPU INTERFACE

The interface between the CE and the MPU is described completely in the 71M6521 Data Sheet.

5.8 BOOT LOADER

It is possible to implement code that functions as a boot loader. This feature is useful for field updates and various test
scenarios.

See the TERIDIAN Application Note number 031 for details.

5.9 SOURCE FILES

The functionality of the Demo Code is implemented in the following files and directories:

1. CLI:

Command Line Interface – General Commands

access.c

SFR, I/O RAM, MPU and CE memory access routines

access_x.c

extended memory access routines

c_serial.c

parser for command line interface

cli.c

command line interface routines

cmd_ce.c

sub-parser for CE commands

cmd_misc.c

sub-parser for RTC, EEPROM, trim and PS commands

help.c

display of help text

io.c

number conversion functions and auxiliary routines for CLI

load.c

upload and download

profile.c

data collection for support of profile command

ser0cli.c
ser1cli.c
sercli.c

buffer serial I/O for the CLI