5/02 Processor Only
Chapter 29
Understanding the User Fault Routine
29–5
To utilize the user fault routine, create a subroutine file (3–255), then enter
this file number in word S:29 of the status file. In the status file display
below, subroutine file 3 is designated as “Err File,” the user fault routine:
Word S:29
F1
F2
F3
F4
F5
Status File
S2:5 Minor Fault 0000 0000 0000 0000
S2:6 Fault Code 0000H
Desc: No Error
S2:29 Err File: 3 Indx Cross File: No
S2:24 Index Reg: 0 Single Step: No
S2:5/0 = 0 PRG
ADDRESS NEXT FL PREV FL NEXT PG PREV PG
Suppose you have a program in which you want to control major errors 0020
(MINOR ERROR AT END OF SCAN)
and 0034
(NEGATIVE VALUE IN
TIMER PRE OR ACC)
in the following manner:
•
Prevent a processor shutdown if the overflow trap bit S:5/0 is set. Permit
a processor shutdown when S:5/0 is set more than five times.
•
Prevent a processor shutdown if the accumulator value of timer T4:0
becomes negative. Reset the negative accumulator value to zero.
Energize an output to indicate that the accumulator has gone negative one
or more times.
•
Allow a processor shutdown for all other user faults.
A possible method of accomplishing this is indicated in the following
figures. Subroutines 3, 4, and 5 are created. The user fault routine is
designated as subroutine file 3.
When a recoverable or non-recoverable user error occurs, the processor scans
file 3. The processor jumps to file 4 if the error code is 0020 and it jumps to
file 5 if the error code is 0034. For all other recoverable and non-recoverable
errors, the processor exits the user fault routine and halts operation in the
fault mode.
Creating a User Fault
Subroutine
Application Example