Energy Meter IC Family Software Instruction Manual

71M652X Software User’s Guide
Revision 1.7 TERIDIAN Proprietary 70 of 138
© Copyright 2005-2007 TERIDIAN Semiconductor Corporation
When compiled without the on-line help option (help.c), CLI.C takes about 14Kbytes of program
space. Adding the on-line help will use another 5Kbytes. When designing a real meter, CLI.C can
easily be removed without major changes to the software.
2. FLAG Basic FLAG AMR Protocol
flag0.c implements a basic FLAG AMR protocol for SER0
flag1.c implements a basic FLAG AMR protocol for SER1
flag.c code shared shared by flag0.c and flag1.c
3. IO: Input/Output
cal_ldr.c load routines for calibration factors
eep24C08.c routines supporting the 24C08 EEPROM
eeprom.c interrupt-driven serial EEPROM routines
eepromp.c high-speed polling EEPROM routines
eepromp3.c polling interface for µWire EEPROM
iiceep.c I2C bus interface using the chip’s I2C hardware
iolite.c IO subroutines for use by the calibration loader (cal_ldr.c)
lcd.c initialization, configuration, read and write routines for LCDs
lcd_VIM808.c routines for driving Varitronix VIM-808 LCS
rtc.c RTC read, write, reset, and trim routines
ser.c baud rate table shared by ser0.c and ser1.c
ser0.c initialization, configuration, interrupt, read and write routines for SER0
ser1.c initialization, configuration, interrupt, read and write routines for SER1
serial.c legacy code that implements a fully buffered interrupt-driven serial driver
tmr0.c initialization, configuration, interrupt, read and write routines for TMR0
tmr1.c initialization, configuration, interrupt, read and write routines for TMR1
uwrdio.c 3-wire interface using direct control of DIO4 and DIO5. It can be adapted to nonstandard
clock polarities and edges, 4-wire SPI EEPROMs, and TSC chips other than the 71M6521
(see comments in the source file)
uwreep.c a 3-wire interface using the high-speed 3-wire interface hardware of the 71M6521
4. Main: Main top-level tasks, 6521-specific
batmodes_20.c battery mode logic
defaults.c contains the table of start-up default values
main.c main() with startup sequence and main task switch
main.c initialization and main loop
5. Meter: Metering Functions
calphased.c auto-calibration
ce.c initialization, configuration, interrupt, read and write routines for the compute engine
ce652X.c data exchange between CE data RAM and XRAM
error.c error recording and logging
freq.c routines to calculate and display frequency
io652X.c control of analog front end, multiplexer, RTM, I/O pins
meter.c contains overall meter logic to calculate and display meter data
misc.c unused legacy code for managing interrupts and priorities
pcnt.c code for counting output pulses
peak_alerts.c detects out-of-range line values
phase_angle.c calculates and displays voltage-to-current phase angles
psoft.c generates two additional pulse outputs using DIO pins
pulse_src.c directs line measurements to any pulse output
pwrfct.c routines for calculating the power factor
rms.c calculates and displays Vrms and Irms
vah.c calculates VAh
varh.c calculates VARh
vphase.c calculates voltage-to-voltage phase angles for multiphase meters
wh.c calculates Wh
6. UnitTest: Test and Verification (not Shipped with standard Demo Code)
eepromtest.c basic test of the EEPROM driver