3-24
SAF-TE Source Code
gather_TWS_input
This function gathers status information of TWS peripherals. The status
of each peripheral is read and the
config
data structure is updated when
the global variable
TWS_timer
exceeds the threshold poll interval. The
TWS_timer
increments every two seconds and the poll interval specifies
the number of 2-second intervals between queries. The user-
configurable poll interval is set in response to the question “How many
2-second intervals would you like between 2-wire serial input passes”
which appears during execution of the
config.exe
program.
Note:
If a value of zero (0) is entered, the firmware will poll
continuously. The poll interval is the number of seconds
between device polling. However, a system contains many
devices, so the time (in seconds) between polls of Device
A = (poll interval) x (total number of devices).
execute_program_once()
This function is designed to read and execute the instructions stored in
the
config.program_memory
data structure member. These
instructions are user-configurable and are generated as a result of the
responses supplied to the
config.exe
program. Once a hardware reset
has occurred and been detected, the
execute_program_once
begins to
run. This function executes the set of instructions generated by the
config.exe
program. A hardware reset results in resetting the
hardware to its state at power-up (the user specifies this state while the
config.exe
program is running).
Note:
The program memory will not change while the firmware is
running. However, the contents of the data memory will
change during execution.
Each state in the state machine performs one or more operations and
either assigns a value to the accumulator (as with reads) or uses the
value in the accumulator to modify the contents of the
config
data
structure. The first instruction in the program memory is always a read
function (necessary to initialize the accumulator).