The text of a manual · part 24 of 70
SLC 500 Instruction Set Reference Manual, pages 231 to 240
Pages 231 to 240 of 694
The original document is the PDF (7.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1747-L514
Page 231
ASCII Instructions
10-27
Table 10.9 ASCII Conversion Table (Continued) ASCII
Hex
Decimal
Enter as
Displayed as
E
45
69
E or \45
E
F
46
70
F or \46
F
G
47
71
G or \47
G
H
48
72
H or \48
H
I
49
73
I or \49
I
J
4A
74
J or \4A or \4a
J
K
4B
75
K or \4B or \4b
K
L
4C
76
L or \4C or \4c
L
M
4D
77
M or \4D or \4d
M
N
4E
78
N or \4E or \4e
N
O
4F
79
O or \4F or \4f
O
P
50
80
P or \50
P
Q
51
81
Q or \51
Q
R
52
82
R or \52
R
S
53
83
S or \53
S
T
54
84
T or \54
T
U
55
85
U or \55
U
V
56
86
V or \56
V
W
57
87
W or \57
W
X
58
88
X or \58
X
Y
59
89
Y or \59
Y
Z
5A
90
Z or \5A or \5a
Z
[
5B
91
[ or \5B or \5b
[
\
5C
92
\ or \5C or \5c
\
]
5D
93
] or \5D or \5d
]
^
5E
94
\^ or \5E or \5e
\^
_
5F
95
_ or \5F or \5f
_
‘
60
96
‘ or \60
‘ a
61
97 a or \61 a b
62
98 b or \62 b c
63
99 c or \63 c d
64
100 d or \64 d e
65
101 e or \65 e f
66
102 f or \66 f g
67
103 g or \67 g h
68
104 h or \68 h
Publication 1747-RM001G-EN-P - November 2008
Page 232
10-28
ASCII Instructions
Table 10.9 ASCII Conversion Table (Continued) ASCII
Hex
Decimal
Enter as
Displayed as i
69
105
I or \69 i j
6A
106 j or \6A or \6a j k
6B
107 k or \6B or \6b k l
6C
108 l or \6C or \6c l m
6D
109 m or \6D or \6d m n
6E
110 n or \6E or \6e n o
6F
111 o or \6F or \6f o p
70
112 p or \70 p q
71
113 q or \71 q r
72
114 r or \72 r s
73
115 s or \73 s t
74
116 t or \74 t u
75
117 u or \75 u v
76
118 v or \76 v w
77
119 w or \77 w x
78
120 x or \78 x y
79
121 y or \79 y z
7A
122 z or \7A or \7a z
{
7B
123
{ or \7B or \7b
{
|
7C
124
| or \7C or \7c
|
}
7D
125
} or \7D or \7d
}
~
7E
126
~ or \7E or \7e
~
DEL
7F
127
\7F or \7f
?
80 to FF
128 to 255
\80 to \FF
Publication 1747-RM001G-EN-P - November 2008
Page 233
Chapter
11
Understanding Interrupt Routines
This chapter contains general information about interrupt routines and explains how they function in your logic program. Each interrupt routine includes: • an overview. • programming procedure. • operational description. • associated bit description. In addition, each interrupt routine contains an application example that shows the interrupt routine in use.
Table 11.1 Interrupt Routine Instructions Instruction Mnemonic
1
Instruction Name
Purpose
Page
User Fault Routine
Provides the option of preventing a processor shutdown.
11-2
STI
Selectable Timed Interrupt
Allows you to interrupt the scan of the main program file automatically, on a periodic basis, to scan a specified subroutine file.
11-8
STD
Selectable Timed Disable
Disables STI’s from occurring.
11-16
STE
Selectable Timed Enable
Enables STI’s to occur.
11-16
STS
Selectable Timed Start
Sets or changes the file number or setpoint frequency of the STI routine.
11-17
DII
Discrete Input Interrupt
Allows the processor to execute a subroutine when the input bit pattern of a discrete I/O card matches a compare value that you programmed.
11-18
ISR
I/O Interrupt
Allows a specialty I/O module to interrupt the normal processor operating cycle in order to scan a specified subroutine file.
11-27
IID
I/O Interrupt Disable
Disables I/O interrupts from occurring.
11-32
IIE
I/O Interrupt Enable
Enables I/O interrupts to occur.
11-32
RPI
Reset Pending Interrupt
Aborts a pending I/O Interrupt.
11-34
INT
Interrupt Subroutine
Optional instruction to identify interrupt subroutines.
11-34
Publication 1747-RM001G-EN-P - November 2008
Page 234
11-2
Understanding Interrupt Routines
The user fault routine gives you the option of preventing a processor shutdown when a specific user fault occurs. The file is executed when any recoverable or non-recoverable user fault occurs. The file is not executed for non-user faults.
User Fault Routine Overview
Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •
•
•
•
A fault routine is programmed in a program file other than 2. The program file used is specified as the fault routine in word S:29 in the status file. More than one user fault routine can exist. The example on page 11-5 shows how this can be accomplished. Faults are classified as recoverable and non-recoverable user faults, and non-user faults. Table 11.2 Fault Classification Non-User Fault
Non-Recoverable User Fault
Recoverable User Fault
The Fault Routine does not execute.
The Fault Routine executes for 1 pass.
The Fault Routine may clear the fault by clearing bit S:1/13.
TIP
TIP
You may initiate a MSG instruction to another node to identify the fault condition of the processor.
For SLC 5/02 processors: You must save your program with test single step selected in order for S:20 and S:21 to be activated. For SLC 5/03 and higher processors: If your program contains four message instructions with the Continuous Operation (CO) bit set, the fault routine’s message instruction is not executed.
Publication 1747-RM001G-EN-P - November 2008
Page 235
Understanding Interrupt Routines
11-3
Status File Data Saved Data in the following words is saved on entry to the user fault subroutine and re-written upon exiting the subroutine. • S:0 Arithmetic flags • S:13 and S:14 Math register • S:24 Index register
Creating a User Fault Subroutine To use the user fault subroutine: 1. Create a subroutine file: valid range is 3-255. 2. Enter the file number in word S:29 of the status file. Project Tree - Controller Folder - Processor Status File - Errors Tab The occurrence of recoverable or non-recoverable user faults causes the processor to read S:29 and execute the subroutine number contained in S:29. If the fault is recoverable, the routine can be used to correct the problem and clear the fault bit S:1/13. The processor then continues in the REM Run mode. The routine does not execute for non-user faults. Words S:20 and S:21 can be examined in your fault routine to pinpoint the file and rung number where the fault occurred. If the fault occurred outside of the ladder scan, this value will contain the rung number where the TND, END, or REF instruction is located. Use words S:20 and S:21 with your power-up protection fault routine to determine the exact point that the previous power down occurred.
Publication 1747-RM001G-EN-P - November 2008
Page 236
11-4
Understanding Interrupt Routines
User Interrupt Routine Application Example Suppose you have a program in which you want to control major errors 0020h (MINOR ERROR AT END OF SCAN) and 0034h (NEGATIVE VALUE IN TIMER PRE OR ACC) under the following conditions. • 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 shown in the following examples. The user fault routine is designated as file 3. When a recoverable or non-recoverable user error occurs, the processor scans subroutine 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 0034h. For all other recoverable and non-recoverable errors, the processor exits the fault routine and halts operation in the fault mode.
Publication 1747-RM001G-EN-P - November 2008
Page 237
Understanding Interrupt Routines
11-5
Fault Routine - Subroutine File 3
Word S:6 is the fault code (in decimal). EQU EQUAL Source A S:6 Fault Code 0020 0 (Enter &H20. Decimal Source B 32 equivalent 32 appears.)
EQU EQUAL Source
A
S:6 0
Source
B
52
Fault Code 0034 (Enter &H34. Decimal equivalent 52 appears.)
JSR JUMP TO SUBROUTINE SBR file number 4
JSR JUMP TO SUBROUTINE SBR file number 5
END
Publication 1747-RM001G-EN-P - November 2008
Page 238
11-6
Understanding Interrupt Routines
Subroutine File 4 - Executed for Error 0020h
S:5 ] [ 0
SBR SUBROUTINE
CTU COUNT UP Counter Preset Accum
EQU EQUAL Source
A
C5:0.ACC 0
Source
B
5
C5:0 (U) S5:0 120 0
CU (CU) (DN)
RET RETURN
S:5 ] [ 0
S:5 (U) 0 S:1 (U) 13
RET RETURN END
If the overflow trap bit, S:5/0 is set, counter C5:0 increments. If the count of C5:0 is 4 or less, the overflow trap, S:5/0 is cleared, the major error halted bit S:1/13 is cleared, and the processor remains in the REM Run mode. If the count is equal to 5, the processor sets S:5/0 and S:1/13 and enters the Fault mode. Subroutine file 5 is executed if the control register error bit S:5/2 is set.
Publication 1747-RM001G-EN-P - November 2008
Page 239
Understanding Interrupt Routines
11-7
Subroutine File 5 - Executed for Error 0034h
The following rung toggles an output every time an error code of 0034h has occurred in the processor assuming the reason for the error was a negative value in timer T4:0.
0000
SBR Subroutine
Major Error Halted S:1 U 13
LES Less Than (A<B) Source A T4:0.ACC Source
B
0< 0 0<
CLR Clear Dest T4:0.ACC 0<
The following run returns program execution back to the main program. 0001
0002
O:2
O:2
0 1746-OW8
0 1746-OW8
RET Return
END
If the accumulator value of timer T4:0 is negative, the major error halted bit, S:1/13 is unlatched, preventing the processor from entering the Fault mode. At the same time, the accumulator value T4:0 ACC is cleared to zero and output O:2.0/0 is energized. Fault code 0034h is displayed in the status file. If the preset of timer T4:0 is negative, S:1/13 remains set and the processor enters the Fault mode (O:2.0/0 will be reset if previously set). Also, if either the preset or accumulator value of any other timer in the program is negative, S:1/13 is set and the processor enters the Fault mode. If previously set, O:2.0/0 is reset.
Publication 1747-RM001G-EN-P - November 2008
Page 240
11-8
Understanding Interrupt Routines
Selectable Timed Interrupt Overview
This function allows you to interrupt the scan of the processor automatically, on a periodic basis, to scan a specified subroutine file. Afterward, the processor resumes executing from the point where it was interrupted. This section describes:
Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •
•
•
•
• STI programming procedure. • STI operation and parameters. • STD and STE instructions. • STS instruction.
Basic Programming Procedure for the STI Function To use the STI function in your application file: 1. Create a subroutine file and enter the desired ladder rungs. This is your STI subroutine file. The valid range is 3 to 255. 2. Enter the STI subroutine file number in word S:31 of the status file (Project Tree - Controller Folder - Processor Status File - STI Tab). Refer to page B-45 in this manual for more information. A file number of zero disables the STI function. 3. Enter the setpoint (the time between successive interrupts) in word S:30 of the status file. Refer to page B-45 for more information. • For SLC 5/02: The range is 10 to 2550 ms (entered in 10 ms increments). A setpoint of zero disables the STI function. Refer to page B-16 in this manual for more information about the STI Resolution bit S:2/10. • For SLC 5/03: The range is 2 to 32,767 ms. A setpoint of zero disables the STI function. Refer to page B-16 in this manual for more information about the STI Resolution bit S:2/10. • For SLC 5/04 and higher processors: The range is from 1 to 32,767 ms (entered in 1 ms increments). A setpoint of zero disables the STI function.
TIP
Publication 1747-RM001G-EN-P - November 2008
The setpoint value must be a longer time than the execution time of the STI subrouting file plus the maximum interrupt latency, or a minor error bit is set. For all processors, the STI Pending bit and STI Overflow bit will be set. Additionally, for the SLC 5/03 and higher processors, the STI Lost bit may be set.