next up previous contents
Next: 14.2 Interrupt-Driven Binary Programs Up: 14.1 The Binary Source Previous: 14.1.1 Declaring Variables in

14.1.2 Declaring an Initialization Program

The label subroutine_initialize_module is a special form used to indicate the entry point for code that should be run to initialize the binary programs. This code is run upon standard reset conditions: program download, hardware reset, or running of the main() function.

In the example shown, the initialization code stores the value 69 into the location reserved for the variable foo. This then overwrites the 55 which would otherwise be the default value for that variable.

Initialization of globals variables defined in an binary module is done differently than globals defined in C. In a binary module, the globals are initialized to the value declared by the FDB statement only when the code is downloaded to the 6811 board (not upon reset or running of main, like normal globals).

However, the initialization routine is run upon standard reset conditions, and can be used to initialize globals, as this example has illustrated.



Fred G. Martin
Fri Mar 29 17:44:15 EST 1996