Program flow, Startup and initialization, Program flow 5.2.1. startup and initialization – Maxim Integrated 71M6513H Power Meter IC Family Software User Manual
Page 45

71M651x Software User’s Guide
5.2.PROGRAM FLOW
5.2.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 demo.c source file. It performs
the following steps (see Figure 5-1, Figure 5-2, and Figure 5-3):
1.
Reset watchdog timer
2.
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.
3.
Assign program state (idle state or command mode state) to be entered next.
4.
In an endless loop, jump to idle state and command mode state in turns. During the idle state, background
tasks are performed, such as process timers, CE updates, CE display. During the command state, the
command line interface (CLI) is serviced (Figure 5-4).
Disable All
Interrupts
Disable 651x
Watchdog
Init IDATA
Init STACK
JUMP
to Init
RESET
JUMP
to
MAIN
INIT
Watchdog Timer
reset
INIT
MAIN
IDLE
(Background)
Command
Figure 5-1: STARTUP.A51
Figure 5-2: INIT.A51
Figure 5-3: DEMO.C
Revision 2.4
TERIDIAN Proprietary
45 of 137
© Copyright 2005-2006 TERIDIAN Semiconductor Corporation