3 program flow, 1 startup and initialization, Program flow – Maxim Integrated 71M6521BE Energy Meter IC Family Software User Manual
Page 46: Startup and initialization, 3 program flow 5.3.1 startup and initialization

71M652X Software User’s Guide
Revision 1.7
TERIDIAN Proprietary
46 of 138
© Copyright 2005-2007 TERIDIAN Semiconductor Corporation
Feature
Code
Size
8KB
16KB
32KB
Description
Error recording
and saving
0.4KB N/opt N/opt N/opt Errors are recorded in 16 bit words, one bit per error.
All error collection is reset when the magnetic tamper
DIO is asserted for 1 second. Error data is protected
by a checksum. The time stamp (hour, day and
month of assertion) and the bit number of the five
most recent errors are saved.
Microwire
EEPROM
0.2KB N/opt N/opt N/opt
I2C EEPROM
0.2KB
Y
Y
Y
Table 5-9: Calibration and Various Services
5.3 PROGRAM FLOW
5.3.1 Startup and Initialization
The top-level functionality of the Demo Board is controlled by the high-level functions. As with every C program, the
core of the function is in the main() program. The main() program is contained in the main.c source file. It performs the
following steps (see Figure 5-1, Figure 2-1, and Figure 5-2):
1. Reset watchdog timer
2. Process the pushbutton (PB) when in BROWNOUT mode.
3. Initialization for hardware, pointers, metering variables, UART buffers and pointers, CE, restoration of
calibration coefficients, initialization of LCD w/ “HELLO” message), enabling CE and pulse generators.
4. Execute the main_run() routine in an endless loop. In this loop, the background tasks, such as metering,
processing of timers, etc. are performed. Afterwards, if a command is pending, the command line interface
(CLI) is serviced.
Disable All
Interrupts
Disable 651x
Watchdog
Init IDATA
Init STACK
JUMP
to Init
RESET
Figure 5-1: STARTUP.A51
Figure 5-2: INIT.A51
J U M P
t o
M A I N
I N I T