Download Title page

Transcript
Appendix B. RTUBASIC for RTU Local Logic
Run-time Errors
The executor will monitor a variety of run-time errors such as divide by zero. If an error is
detected the RTUBASIC RuntimeError variable will be set. The causes of run-time errors
and corresponding values for the RuntimeError variable are given in Table B-5.
Table B-5. RuntimeError Values.
Runtime
Error Value Meaning
0
1
No errors.
Invalid opcode.
2
Address out of
bounds.
Divide by 0.
3
4
Invalid math
operation.
6
Value out of
range.
Cause
Corrupted code memory. Malfunction in
RTUBASIC executor.
Corrupted code memory. Malfunction in
RTUBASIC executor.
Real divide by 0 (/ operator).
Integer divide by 0 (\ operator).
Mod by 0 (e.g. x = y Mod 0).
Note: result of divide operation will be 0.
Exp() function result outside real range.
Ln() or Log() function argument <= 0.
Sqr() function argument < 0.
^ operator result outside of real or integer
range.
^ operator - 0 raised to 0 or a negative power.
^ operator - negative number raised to a Real.
Note: the result of the math operation will be 0.
ModuleConfigured(), ModulePresent(),
CounterClear(), RuntimeClear() or
AccumClear() functions parameter out of valid
range.
Restart
RTUBASIC
Program?
No
Yes
Yes
No
No
No
The RuntimeError variable is cleared to 0 whenever the Startup block is executed. It can
also be cleared by assigning a 0 in the RTUBASIC program. It is set to non-0 whenever one of
the conditions shown in Table B-5 occurs.
Execution Time Limit Error
Each time that the logic program is executed, the execution time will be measured. If this time
exceeds 300mS the RTUBASIC TimeLimitError variable will be set to TRUE. If the logic
does not complete within three seconds, the program will be stopped and restarted beginning
with the Startup block.
The TimeLimitError is set to FALSE whenever the Startup block is executed. It can also
be set to FALSE by a statement in the RTUBASIC program.
B-12