The text of a manual · part 39 of 45
Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Appendix D - Instruction Set Quick Reference, pages 321 to 330
Pages 321 to 330 of 388, from Enhanced and Ethernet PLC-5 Programmable Controllers User Manual
The original document is the PDF (5.1 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 1785-L20B and Allen-Bradley 1785-L40B
Page 321
Instruction Set Quick Reference
Instruction
Description LIFO Load LFL
LFL LIFO LOAD Source LIFO Control Length Position
N70:1 #N70:3 R6:61 64 0
Status Bits: EN - Enable Load DN - Done Bit EM - Empty Bit LIFO Unload LFU
LFU LIFO UNLOAD LIFO Dest Control Length Position
D-21
#N70:3 Status Bits: N70:2 EU - Enable R6:61 Unload 64 DN - Done Bit 0
EM - Empty Bit
When the input conditions go from false-to-true, the controller loads N70:1 into the next available element in the LIFO file #N70:3, as pointed to by R6:61. Each time the rung goes from false-to-true, the controller loads another element. When the LIFO file (stack) is full (64 words have been loaded), the DN bit is set. See page F-8 for a description of prescan activities for this instruction. When the input conditions go from false-to-true, the controller unloads the last element from #N70:3 and puts it into N70:2. Each time the rung goes from false-to-true, the controller unloads another element. When the LIFO file is empty, the EM bit is set. See page F-8 for a description of prescan activities for this instruction.
Sequencer Instructions Instruction SQI SEQUENCER INPUT File #N7:11 Mask FFF0 Source I:031 Control R6:21 Length 4 Position 0 SQL SEQUENCER LOAD File #N7:20 Source I:002 Control R6:22 Length 5 Position 0
Description Sequencer Input SQI
The SQI instruction filters the Source (I:031) input image data through a Mask (FFF0) and compare the result to Reference data (#N7:11) to see if the two values are equal. The operation is controlled by the information in the control file R6:21. When the status of all unmasked bits of the word pointed to by control element R6:21 matches the corresponding reference bits, the rung condition remains true if preceded by a true rung condition.
Sequencer Load SQL
The SQL instruction loads data into the sequencer File (#N7:20) from the source word (I:002) by stepping through the number of elements specified by Length (5) of the Source (I:002), starting at the Position (0). The operation is controlled by the information in the control file R6:22. When the rung goes from false-to-true, the SQL instruction increments the next step in the sequencer file and loads the data into it for every scan that the rung remains true.
Status Bits: EN - Enable DN - Done Bit ER - Error Bit
See page F-8 for a description of prescan operation for this instruction.
Publication 1785-UM012D-EN-P - July 2005
Page 322
D-22
Instruction Set Quick Reference
Instruction
Description Sequencer Output SQO
SQO SEQUENCER OUTPUT File #N7:1 Mask 0F0F Dest O:014 Control R6:20 Length 4 Position 0
# Status Bits:
EN - Enable DN - Done Bit ER - Error Bit
When the rung goes from false-to-true, the SQO instruction increments to the next step in the sequencer File (#N7:1). The data in the sequencer file is transferred through a Mask (0F0F) to the Destination (O:014) for every scan that the rung remains true. See page F-8 for a description of prescan operation for this instruction.
Program Control Instructions Instruction
Description Master Control Reset If the input conditions are true, the program scans the rungs MCR between MCR instruction rungs and processes the outputs normally. If the input condition is false, rungs between the MCR-instruction rungs are executed as false.
( MCR )
10 ( JMP )
Jump JMP
If the input conditions are true, the controller skips rungs by jumping to the rung identified by the label (10).
10
Label LBL
When the controller reads a JMP instruction that corresponds to label 10, the controller jumps to the rung containing the label and starts executing.
LBL
Important: Must be the first instruction on a rung. FOR Loop FOR
FOR FOR Label Number Index Initial Value Terminal Value Step Size
0 N7:0 0 10 1
NXT NEXT Label Number
BRK
Publication 1785-UM012D-EN-P - July 2005
The controller executes the rungs between the FOR and the NXT instruction repeatedly in one program scan, until it reaches the terminal value (10) or until a BRK instruction aborts the operation. Step size is how the loop index is incremented. See page F-8 for a description of prescan operation for this instruction.
Next NXT
The NXT instruction returns the controller to the corresponding FOR instruction, identified by the label number specified in the FOR instruction. NXT must be programmed on an unconditional rung that is the last rung to be repeated in a For-Next loop.
Break BRK
When the input conditions go true, the BRK instruction aborts a For-Next loop.
0
Page 323
Instruction Set Quick Reference
Instruction
D-23
Description Jump to Subroutine JSR
If the input conditions are true, the controller starts running a subroutine Program File (90). The controller passes the Input Parameters (N16:23, N16:24, 231) to the subroutine and the RET instruction passes Return Parameters (N19:11, N19:12) back to the main program, where the controller encountered the JSR instruction.
Subroutine SBR
The SBR instruction is the first instruction in a subroutine file. This instruction identifies Input Parameters (N43:0, N43:1, N43:2) the controller receives from the corresponding JSR instruction. You do not need the SBR instruction if you do not pass input parameters to the subroutine.
Return RET
If the input conditions are true, the RET instruction ends the subroutine and stores the Return Parameters (N43:3, N43:4) to be returned to the JSR instruction in the main program.
AFI
Always False AFI
The AFI instruction disables the rung (i.e., the rung is always false).
( TND )
Temporary End TND
If the input conditions are true, the TND instruction stops the controller from scanning the rest of the program (i.e., this instruction temporarily ends the program).
One Shot ONS
If the input conditions preceding the ONS instructions on the same rung go from false-to-true, the ONS instruction conditions the rung so that the output is true for one scan. The rung is false on successive scans.
JSR JUMP TO SUBROUTINE Program File 90 Input par N16:23 Input par N16:24 Input par 231 Return par N19:11 Return par N19:12 SBR SUBROUTINE Input par Input par Input par
N43:0 N43:1 N43:2
RET RETURN ( ) Return par Return par
N43:3 N43:4
B3 ONS 110
See page F-8 for a description of prescan operation for this instruction. OSF ONE SHOT FALLING Storage Bit B3/0 Output Bit 15 Output Word N7:0
One Shot Falling OSF Status Bits: OB - Output Bit SB - Storage Bit
The OSF instruction triggers an event to occur one time. Use the OSF instruction whenever an event must start based on the change of state of a rung from true-to-false, not on the resulting rung status. The output bit (N7:0/15) is set (1) for one program scan when the rung goes from true-to-false. See page F-8 for a description of prescan operation for this instruction.
One Shot Rising OSR
OSR ONE SHOT RISING Storage Bit Output Bit Output Word
B3/0 15 N7:0
Status Bits: OB - Output Bit SB - Storage Bit
The OSR instruction triggers an event to occur one time. Use the OSR instruction whenever an event must start based on the change of state of a rung from false-to-true, not on the resulting rung status. The output bit (N7:0/15) is set (1) for one program scan when the rung goes from false-to-true. See page F-8 for a description of prescan operation for this instruction.
Publication 1785-UM012D-EN-P - July 2005
Page 324
D-24
Instruction Set Quick Reference
Instruction SFR SFC Reset Prog File Number Restart Step At
( EOT )
Description SFC Reset SFR
The SFR instruction resets the logic in a sequential function chart. When the SFR instruction goes true, the controller performs a lastscan/postscan on all active steps and actions in the selected file, and then resets the logic in the SFC on the next program scan. The chart remains in this reset state until the SFR instruction goes false.
End of Transition EOT
The EOT instruction should be the last instruction in a transition file. If you do not use an EOT instruction, the controller always evaluates the transition as true.
3
See page F-8 for a description of prescan operation for this instruction. ( UID )
User Interrupt Disable The UID instruction temporarily disables an interrupt-driven UID ladder program (such as an STI or PII) from interrupting the currently executing program.
( UIE )
User Interrupt Enable The UIE instruction re-enables the interrupt-driven ladder UIE program to interrupt the currently executing ladder program.
Publication 1785-UM012D-EN-P - July 2005
Page 325
Instruction Set Quick Reference
D-25
Process Control, Message Instructions Instruction
Description
PID PID Control Block Proc Variable Tieback Control Output
PD10:0 N15:13 N15:14 N20:21
Proportional, Integral, The control block (PD10:0) contains the instruction information and Derivative for the PID. The PID gets the process variable from N15:13 and PID sends the PID output to N20:21. The tieback stored in N15:14 handles the manual control station. Status Bits: EN - Enable If you use an N control block, the rung must transition from DN - Done Bit (for N false to true for execution. control blocks only) If you use PD control block, then there is no done bit. Also, the rung input conditions need to be true. See page F-8 for a description of prescan operation for this instruction. If the input conditions go from false to true, the data is transferred according to the instruction parameters you set when you entered the message instruction. The Control Block (MG7:10) contains status and instruction parameters.
MSG SEND/RECEIVE MESSAGE Control Block MG7:10
You can also use N control blocks.
Bit #Status Bits 15EN - Enable 14ST - Start Bit 13DN - Done Bit 12ER - Error Bit 11CO - Continuous 10EW - Enabled-Waiting 9NR - No Response
For continuous MSGs, condition the rung to be true for only one scan. See page F-8 for a description of prescan operation for this instruction.
Block Transfer Instructions Integer (N) control block Word Offset
Block Transfer (BT) control block
Description
Word Mnemonic
Description
0 status bits (see below)
.EN through .RW status bits
1 requested word count
.RLEN requested length
2 transmitted word count
.DLEN transmitted word length/error code
3 file number
.FILE file number
4 element number
.ELEM element number
.RGS rack/group/slot
Word 0 15
14
13
12
11
10
09
08
07
06
05
04
03
EN
ST
DN
ER
CO
EW
NR
TO
RW
** rack **
** group**
02
01
00 slot
Publication 1785-UM012D-EN-P - July 2005
Page 326
D-26
Instruction Set Quick Reference
Instruction
Description Block Transfer Read BTR
BTR BLOCK TRANSFER READ Rack 1 Group 0 Module 0 Control Block BT11:100 Data File N10:110 Length 40 Continuous Y
If the input conditions go from false to true, a block transfer read is initiated for the I/O module located at rack 1, group 0, module 0. The Control Block (BT11:100, 6-word file) contains status for the transfer. The Data File (N10:110) is where the data read from the module is stored. The BT Length (40) identifies the number of words in the transfer. A non-continuous block transfer is queued and run only once on a false-to-true rung transition; a continuous block transfer is repeatedly requeued. You can also use the N data type for the control blocks. See page F-8 for a description of prescan operation for this instruction.
PLC-5/30, -5/40, -5/40E, -5/40L -5/60, -5/60L, -5/80, -5/80E controllers
(1)
PLC-5/40, -5/40L, -5/60, -5/60L, -5/80, -5/40E, -5/80E controllers
PLC-5/60, -5/60L, -5/80, -5/80E controllers
S:7 bit #
BT queue full for rack
S:32 bit #
BT queue full for rack
S:34 bit #
BT queue full for rack
08(1)
0
08
10
08
20
091
1
09
11
09
21
101
2
10
12
10
22
111
3
11
13
11
23
12
4
12
14
12
24
13
5
13
15
13
25
14
6
14
16
14
26
15
7
15
17
15
27
PLC-5/11, -5/20, and 5/20E controllers also
Instruction BTW BLOCK TRANSFER WRITE Rack 1 Group 0 Module 0 Control Block BT11:0 Data File N10:10 Length 40 Continuous Y
Description Block Transfer Write BTW
If the input conditions go from false-to-true, the block transfer write is initiated for the I/O module located at rack 1, group 0, module 0. The Control Block (BT11:0, 6-word file) contains status for the transfer. The Data File contains the data to write to the module (N10:10). The BT Length (40) identifies the number of words in the transfer. A non-continuous block transfer is queued and run only once on a false-to-true rung transition; a continuous block transfer is repeatedly requeued. You can also use the N data type for the control block. See page f-8 for a description of prescan operation for this instruction.
Publication 1785-UM012D-EN-P - July 2005
Page 327
Instruction Set Quick Reference
D-27
ASCII Instructions Status Bits: EN - EnableEM - Empty Bit DN - Done BitEU - Queue ER - Error BitFD - Found Bit
Instruction ABL ASCII TEST FOR LINE Channel 0 Control R6:32 Characters
Description ASCII Test for Line ABL
If input conditions go from false-to-true, the controller reports the number of characters in the buffer, up to and including the end-of-line characters and puts this value into the position word of the control structure (R6:32.POS). The controller also displays this value in the characters field of the display. See page F-8 for a description of prescan operation for this instruction.
ACB ASCII CHARS IN BUFFER Channel 0 Control R6:32 Characters
ASCII Characters in Buffer ACB
If input conditions go from false-to-true, the controller reports the total number of characters in the buffer and puts this value into the position word (.POS) of the control structure. The controller also displays this value in the characters field of the display. See page F-8 for a description of prescan operation for this instruction.
ACI STRING TO INTEGER CONVERSION Source ST38:90 Dest N7:123 75
ACN STRING CONCATENATE ST38:90 Source A ST37:91 Source B Dest ST52:76
Convert ASCII String to Integer ACI
If input conditions are true, the controller converts the string in ST38:90 to an integer and stores the result in N7:123. Status Description Bit set if a carry was generated during the C conversion; otherwise resets
ASCII String Concatenate ACN
V set if source is > 32,767 or < -32,768, otherwise resets
Z set if source is zero; otherwise resets
S set if destination is negative; otherwise resets
If input conditions are true, the controller concatenates the string in ST38:90 with the string in ST37:91 and store the result in ST52:76.
Publication 1785-UM012D-EN-P - July 2005
Page 328
D-28
Instruction Set Quick Reference
Instruction AEX STRING EXTRACT Source ST38:40 Index 42 Number 10 Dest ST52:75 AIC INTEGER TO STRING CONVERSION Source 876 ST38:42 Dest AHL ASCII HANDSHAKE LINE Channel 0 AND Mask 0001 OR Mask 0003 Control R6:23 Channel Status
Description ASCII String Extract AEX
If input conditions are true, the controller extracts 10 characters starting at the 42nd character of ST38:40 and store the result in ST52:75.
Convert Integer to ASCII String AIC
If input conditions are true, the controller converts the value 876 to a string and store the result in ST38:42.
ASCII Handshake Lines AHL
If input conditions go from false-to-true, the controller uses the AND and OR masks to determine whether to set or reset the DTR (bit 0) and RTS (bit 1) lines, or leave them unchanged. Bit 0 and 1 of the AND mask cause the line(s) to reset if 1 and leave the line(s) unchanged if 0. BIt 0 and 1 of the OR mask cause the line(s) to set if 1 and leave the line(s) unchanged if 0.
Status Bits: EN-Enable DN-Done Bit ER-Error Bit
See page F-8 for a description of prescan operation for this instruction. ARD ASCII READ Channel 0 Dest ST52:76 Control R6:32 String Length 50 Characters Read
ARL ASCII READ LINE Channel 0 Dest ST50:72 Control R6:30 String Length 18 Characters Read
Publication 1785-UM012D-EN-P - July 2005
ASCII Read ARD Status Bits EN - Enable DN - Done Bit ER - Error Bit UL - Unload EM - Empty EU - Queue ASCII Read Line ARL Status Bits EN - Enable DN - Done Bit ER - Error Bit UL - Unload EM - Empty EU - Queue
If input conditions go from false-to-true, read 50 characters from the buffer and move them to ST52:76. The number of characters read is stored in R6:32.POS and displayed in the Characters Read Field of the instruction display. See page F-8 for a description of prescan operation for this instruction.
If input conditions go from false-to-true, read 18 characters (or until end-of-line) from the buffer and move them to ST50:72. The number of characters read is stored in R6:30.POS and displayed in the Characters Read Field of the instruction display. See page F-8 for a description of prescan operation for this instruction.
Page 329
Instruction Set Quick Reference
Instruction ASC STRING SEARCH Source ST38:40 Index 35 Search ST52:80 Result 42 ASR ASCII STRING COMPARE Source A ST37:42 ST38:90 Source B AWA ASCII WRITE APPEND Channel 0 Source ST52:76 Control R6:32 String Length 50 Characters Sent
AWT ASCII WRITE Channel 0 Source ST37:40 Control R6:23 String Length 40 Characters Sent
D-29
Description ASCII String Search ASC
If input conditions are true, search ST52:80 starting at the 35th character, for the string found in ST38:40. In this example, the string was found at index 42. If the string is not found, the ASCII instruction minor fault bit S:17/8 is set and the result is zero.
ASCII String Compare If the string in ST37:42 is identical to the string in ST38:90, ASR the instruction is true. Note that this is an input instruction. An invalid string length causes the ASCII instruction error minor fault bit S:17/8 to be set, and the instruction is false. ASCII Write Append AWA Status Bits EN - Enable DN - Done Bit ER - Error Bit UL - Unload EM - Empty EU - Queue ASCII Write AWT Status Bits EN - Enable DN - Done Bit ER - Error Bit UL - Unload EM - Empty EU - Queue
If input conditions go from false-to-true, read 50 characters from ST52:76 and write it to channel 0 and append the two character configuration in the channel configuration (default CR/LF). The number of characters sent is stored in R6:32.POS and displayed in the characters sent field of the instruction display. See page F-8 for a description of prescan operation for this instruction. If input conditions go from false-to-true, write 40 characters from ST37:40 to channel 0. The number of characters sent is stored in R6:23.POS and displayed in the characters sent field of the instruction display. See page F-8 for a description of prescan operation for this instruction.
Publication 1785-UM012D-EN-P - July 2005
Page 330
D-30
Instruction Set Quick Reference
Bit and Word Instructions Category
Relay
Code
Title
Execution Time (µs) Integer
Execution Time Words of (µs) Memory (1) Floating Point
True
False
True
False
XIC examine if closed
.32
.16
1(2)
XIO examine if open
.32
.16
12
OTL output latch
.48
.16
12
OTU output unlatch
.48
.16
12
OTE output energize
.48
.48
12 branch end
.16
.16
1
Branch
Timer and Counter TON
TOF
RTO next branch
1 branch start
1 timer on(0.01 base)
3.8
2.6
(1.0 base)
4.1
2.5 timer off(0.01 base)
2.6
3.2
(1.0 base)
2.6
3.2 retentive timer on (0.01 base) (1.0 base)
3.8
2.4
4.1
2.3
2-3
2-3
2-3
CTU count up
3.4
3.4
2-3
CTD count down
3.3
3.4
2-3
RES reset
2.2
1.0
2-3
(1)
Use the larger number for addresses beyond 2048 words in the controller’s data table.
(2)
For every bit address above the first 256 words of memory in the data table, add 0.16 µs and 1 word of memory.
Publication 1785-UM012D-EN-P - July 2005