Power failure – Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual
Page 17
an A-B VBASIC Program
Chapter 2
Developing and Running
2–6
Circuitry within a workstation is capable of detecting and reporting to the
processor an imminent loss of power. When this occurs, all tasks are brought
to a logical conclusion and the following message:
POWERFAIL SHUTDOWN!
is sent to the LCD. Normally, this message will never be seen because a true
power failure will blank the display. Its viability for any perceptible length of
time is evidence of a power failure which was not quite long enough to
completely turn off the workstation, or a workstation overly sensitive to
power fluctuations.
The restoration of power results in this environment for the A-B VBASIC
program:
1. The program is restarted FROM THE BEGINNING.
2. All files (RAM FILES) in existence at power failure are intact, although
closed. Any write operation (a single PUT, etc.) to a file of a length under
4K bytes which was in progress when the power failure occurred, either
did or did not complete AS A UNIT. Stated differently, record fragments
are not present, only whole records.
3. All others program parameters are reset as for any other program
initiation: variables 0, etc.
Programs wishing to distinguish between initial (cold) start-up and powerfail
restart (warm), should open a file named, say, POWER. If the LOF function
on POWER returns 0, assume a cold start and PUT something into the file. A
non-zero file length implies a warm start.
Power Failure