Energy Meter IC Family Software Instruction Manual

71M652X Software User’s Guide
Revision 1.7 TERIDIAN Proprietary 72 of 138
© Copyright 2005-2007 TERIDIAN Semiconductor Corporation
5.11 INCLUDE/HEADER FILES
In line with common industry practice, each C file in the Demo Code source code has a corresponding header file that
ends in .H and that provides the interface to the C file’s code. A number of include files are special cases, and provide
global data or hardware definitions.
Main_6521B\options.h selects the features used by the code that is less than 8K
Main_6521D\options.h selects the features used by the code that is less than 16K
Main_6521_CLI\options.h selects the features used by the code that is less than 32K
main\option_gbl.h defines global configuration values used in all meter versions.
meter\meter.h defines the meter’s configuration and power registers.
meter\ce652x.h defines the CE memory used to communicate with the MPU.
meter\io652x.h defines the memory-mapped registers of the 652x chips.
util\reg652x.h defines the special function registers of the 652x chips.
util\stdint.h defines `a standard integer package for TSC meter chips using 8051s.
5.11.1 OPTIONS.H
The file OPTIONS.H is especially important because it controls entire features in a firmware build. When an option is
1, it means that the feature is to be compiled and linked into the build. The idea is that by adding or subtracting
features, a customer can quickly tune the Demo Code to approximate the desired meter configuration. If the comments
in OPTIONS.H are not clear, feel free to use grep, or another code-searching tool to locate where the flags occur in the
code. While TERIDIAN has made a good-faith effort to test representative combinations of compile flags, there are too
many combinations to test exhaustively.
When OPTIONS.H is changed, there are three usual results. Either the build complains that it needs some
subroutines, or it complains that it has too many subroutines, or it is good. When it needs subroutines, enable the
option flags for the needed subroutines. When it has too many subroutines, try to disable the option flags for the
unneeded subroutines.
If the resulting build is too big to fit the available program memory, then more features must be disabled.
Usually, the option flags are tested either right after options.h is included in a file, or around the subroutines.
5.11.2 Register Definitions
Register definitions can be found in the following files:
REG80515.H - Register definition for the 80515 MPU core
REG652X.H - Register definition of 652X SFRs and I/Os
IO652X.H and IO6512X.C - I/O RAM register definitions
CE652X.H and CE652X.C - CE data and structure declarations