Professional Documents
Culture Documents
PLC-5
Programmable
Controllers
Instruction
Set Reference
LGHQWLI\ D KD]DUG
$!$!%$"$#$#%$#G$%$%G
$'$'%$!@$#@hq$'@hrhqrhxsSpxryy6 hv
6yyr7hqyrvhhqrhxsSpxryy6 hvhprivrsSpxryyDrhvhy
8hv
See Page:
For this
Instruction:
See Page:
For this
Instruction:
For this
Instruction:
See Page:
See Page:
ABL
17-51
CMP
3-3
JSR
13-12
RES
2-25
ACB
17-71
COP
9-20
LBL
13-5
RET
13-12
ACI
17-91
COS
4-211
LEQ
3-9
RTO
2-13
ACN
17-101
CPT
4-5
LES
3-10
SBR
13-12
ACS
4-131
CTD
2-20
LFL
11-51
SDS
18-2
ADD
4-14
CTU
2-18
LFU
11-51
SFR
13-231
AEX
17-111
DDT
10-2
LIM
3-11
SIN
4-271
AFI
13-19
DEG
6-51
LN
4-231
SQI
12-2
SQL
12-2
AHL
17-12
DFA
18-3
LOG
4-241
AIC
17-141
DIV
4-22
MCR
13-3
SQO
12-2
AND
5-2
DTR
10-8
MEQ
3-13
SQR
4-28
ARD
17-151
EOT
13-24
MOV
7-4
SRT
4-291
ARL
17-181
EQU
3-6
MSG
16-2
STD
4-311
ASC
17-211
FAL
9-2
MUL
4-25
SUB
4-34
ASN
4-151
FBC
10-2
MVM
7-5
TAN
4-351
ASR
17-221
FFL
11-5
NEG
4-26
TND
13-19
ATN
4-161
FFU
11-5
NEQ
3-15
TOD
6-3
AVE
4-171
FLL
9-21
NOT
5-4
TOF
2-9
AWA
17-231
FOR
13-8
NXT
13-8
TON
2-5
AWT
17-261
FRD
6-4
ONS
13-20
UID
13-251
BRK
13-8
FSC
9-15
OR
5-6
UIE
13-261
BSL
11-2
GEQ
3-7
OSF
13-221
XIC
1-3
BSR
11-2
GRT
3-8
OSR
13-211
XIO
1-4
BTD
7-2
IDI
1-102
OTE
1-5
XOR
5-8
XPY
4-361
BTR
15-4
IDO
1-11
OTL
1-6
BTW
15-4
IIN
1-8
OTU
1-7
CIO
15-252
IOT
1-9
PID
NO TAG
CLR
4-20
JMP
13-5
RAD
6-61
bit level
multi-bit
element level
file instructions
convert
conversion instructions
time or delay
timer
count
counter
shift or track
bit shift
sequence
sequencer
PID
PID
message sending/receiving
message
diagnostics
Table B
Example Operations
If Your Application Calls for Operations such as:
Use:
bit level
element level
block transfer
timing
multi-element
counting
Summary of Changes
Summary of Changes
New Information Added to
this Manual
7KH OLVW EHORZ VXPPDUL]HV WKH FKDQJHV WKDW KDYH EHHQ PDGH WR WKLV
PDQXDO VLQFH WKH ODVW SULQWLQJ
For this Update Information:
See Chapter:
12
13
14
14
16
16
16
16
Summary of Changes
1RWHV
Preface
Preface
7KLV PDQXDO XVHV WKH IROORZLQJ FRQYHQWLRQV
Conventions
References to:
QrprqQG8$prhyrqrrQG8$rrpvTrrpvvhpivhvs
urQrprqQG8$prurshrhqhyvphvrrvr
filename
0HVVDJHV DQG SURPSWV WKDW WKH WHUPLQDO GLVSOD\V DUH VKRZQ DV
Press a function key
Preface
1RWHV
Table of Contents
Relay-Type Instructions
XIC, XIO, OTE, OTL, OTU, IIN, IOT,
IDI, IDO
Chapter 1
Using Relay-Type Instructions . . . . . . . . . . . . . . . . . . . . . . . . 1-1
I/O Image Files in Data Storage . . . . . . . . . . . . . . . . . . . . . 1-2
Rung Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Examine On (XIC). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Examine Off (XIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Energize (OTE). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Latch (OTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Unlatch (OTU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Immediate Input (IIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Immediate Output (IOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Immediate Data Input (IDI) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Immediate Data Output (IDO) . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Using IDI and IDO Instructions . . . . . . . . . . . . . . . . . . . . . . . . 1-9
Chapter 2
Using Timers and Counters . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Using Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Timer Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Timer On Delay (TON) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Timer Off Delay (TOF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Retentive Timer On (RTO) . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Using Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Count Up (CTU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Count Down (CTD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17
Timer and Counter Reset (RES). . . . . . . . . . . . . . . . . . . . . . 2-20
toc2
Table of Contents
Compare Instructions
CMP, EQU, GEQ, GRT, LEQ, LES, LIM,
MEQ, NEQ
Compute Instructions
CPT, ACS, ADD, ASN, ATN, AVE,
CLR, COS, DIV, LN, LOG, MUL, NEG,
SIN, SRT, SQR, STD, SUB, TAN, XPY
Chapter 3
Using Compare Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Using Arithmetic Status Flags . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Compare (CMP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Entering the CMP Expression. . . . . . . . . . . . . . . . . . . . . . . 3-2
Determining the Length of an Expression. . . . . . . . . . . . . . 3-3
Equal to (EQU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Greater than or Equal to (GEQ). . . . . . . . . . . . . . . . . . . . . . . . 3-5
Greater than (GRT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Less than or Equal to (LEQ) . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Less than (LES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Limit Test (LIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Mask Compare Equal to (MEQ) . . . . . . . . . . . . . . . . . . . . . . . 3-9
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Not Equal to (NEQ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Chapter 4
Using Compute Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Using Arithmetic Status Flags . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Data Types and the Compute Instruction . . . . . . . . . . . . . . . . 4-3
Using Floating Point Data Types . . . . . . . . . . . . . . . . . . . . . . 4-4
Compute (CPT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Entering the CPT Expression . . . . . . . . . . . . . . . . . . . . . . . 4-5
Determining the Length of an Expression. . . . . . . . . . . . . . 4-7
Determining the Order of Operation . . . . . . . . . . . . . . . . . . 4-8
Expression Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Entering the Destination . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Using CPT Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Arc Cosine (ACS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
Addition (ADD). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
Arc Sine (ASN). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Arc Tangent (ATN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Average File (AVE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16
Clear (CLR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17
Cosine (COS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
Divide (DIV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
Natural Log (LN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Log to the Base 10 (LOG). . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Multiply (MUL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22
Negate (NEG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
Sine (SIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
Square Root (SQR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
Table of Contents
toc3
Logical Instructions
AND, NOT, OR, XOR
Conversion Instructions
FRD and TOD, DEG and RAD
Chapter 5
Using Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
Using Arithmetic Status Flags . . . . . . . . . . . . . . . . . . . . . . 5-1
AND Operation (AND). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
NOT Operation (NOT). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
OR Operation (OR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Exclusive OR Operation (XOR) . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Chapter 6
Using the Conversion Instructions . . . . . . . . . . . . . . . . . . . . . 6-1
Using Arithmetic Status Flags . . . . . . . . . . . . . . . . . . . . . . 6-1
Convert to BCD (TOD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Convert from BCD (FRD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Degree (DEG)
(Enhanced PLC-5 Processors Only) . . . . . . . . . . . . . . . . . . . . 6-3
Radian (RAD)
(Enhanced PLC-5 Processors Only) . . . . . . . . . . . . . . . . . . . . 6-4
Chapter 7
Using Bit Modify and Move Instructions . . . . . . . . . . . . . . . . . 7-1
Bit Distribute (BTD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Move (MOV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Masked Move (MVM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Chapter 8
Concepts of File Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
Using the Control Structure . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Manipulating File Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Choosing Modes of Block Operation . . . . . . . . . . . . . . . . . . . 8-5
All Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Numerical Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Incremental Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
Special Case, Numerical Mode with Words Per Scan = 1. . 8-8
toc4
Table of Contents
File Instructions
FAL, FSC, COP, FLL
Diagnostic Instructions
FBC, DDT, DTR
Sequencer Instructions
SQO, SQI, SQL
Chapter 9
Using File Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
File Arithmetic and Logic (FAL) . . . . . . . . . . . . . . . . . . . . . . . 9-2
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4
FAL Copy Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
FAL Arithmetic Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
Upper and Lower Limits. . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
FAL Logic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12
FAL Convert Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
File Search and Compare (FSC) . . . . . . . . . . . . . . . . . . . . . . 9-14
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15
FSC Search and Compare Operations . . . . . . . . . . . . . . . . . 9-17
Data Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-17
File Search Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-17
File Copy (COP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
File Fill (FLL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20
Chapter 10
Using Diagnostic Instructions . . . . . . . . . . . . . . . . . . . . . . . 10-1
File Bit Comparison (FBC) and Diagnostic Detect (DDT) . . . . 10-2
Selecting the Search Mode . . . . . . . . . . . . . . . . . . . . . . . 10-2
One Mismatch at a Time . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
All Per Scan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5
Data Transitional (DTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8
Chapter 11
Applying Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1
Using Bit Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
Using FIFO and LIFO Instructions . . . . . . . . . . . . . . . . . . . . . 11-5
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6
Chapter 12
Applying Sequencers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1
Using Sequencer Instructions . . . . . . . . . . . . . . . . . . . . . . . 12-2
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
Resetting the Position of SQO . . . . . . . . . . . . . . . . . . . . . 12-6
Using SQI Without SQO . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7
Table of Contents
toc5
Chapter 13
Selecting Program Flow Instructions . . . . . . . . . . . . . . . . . . 13-1
Master Control Reset (MCR) . . . . . . . . . . . . . . . . . . . . . . . . 13-2
Jump (JMP) and Label (LBL) . . . . . . . . . . . . . . . . . . . . . . . . 13-3
Using JMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
Using LBL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
For Next Loop (FOR, NXT), Break (BRK) . . . . . . . . . . . . . . . . 13-5
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6
Using FOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6
Using BRK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7
Using NXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7
Jump to Subroutine (JSR), Subroutine (SBR),
and Return (RET) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8
Passing Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10
Nesting Subroutine Files . . . . . . . . . . . . . . . . . . . . . . . . 13-10
Using JSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11
Using SBR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11
Using RET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12
Temporary End (TND) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-13
Always False (AFI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-13
One Shot (ONS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14
One Shot Rising (OSR). . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15
One Shot Falling (OSF). . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-16
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-16
Sequential Function Chart Reset (SFR). . . . . . . . . . . . . . . . 13-17
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-17
End of Transition (EOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18
User Interrupt Disable (UID) . . . . . . . . . . . . . . . . . . . . . . . . 13-19
User Interrupt Enable (UIE). . . . . . . . . . . . . . . . . . . . . . . . . 13-20
Chapter 14
Using PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1
PID Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2
Using PID Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2
Conversion of Gain Constants . . . . . . . . . . . . . . . . . . . . . 14-3
Integral Term Implementation . . . . . . . . . . . . . . . . . . . . . 14-3
Derivative Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4
Setting Input/Output Ranges . . . . . . . . . . . . . . . . . . . . . . . . 14-5
Implementing Scaling to Engineering Units . . . . . . . . . . . . . 14-5
Setting the Dead Band . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6
Using Zero-Crossing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6
Using No Zero Crossing . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
Selecting the Derivative Term (Acts on PV or Error) . . . . . . . 14-7
toc6
Table of Contents
Table of Contents
Block-Transfer Instructions
BTR and BTW and ControlNet I/O
Transfer Instruction CIO
toc7
Chapter 15
Using Block Transfer and ControlNet I/O
Transfer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
Using Block Transfer Instructions . . . . . . . . . . . . . . . . . . . . 15-1
Block-Transfer Read (BTR) and Block-Transfer Write (BTW). 15-3
Block-Transfer Request Queue . . . . . . . . . . . . . . . . . . . . 15-3
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4
Using Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6
Using the Control Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-8
Requested Word Count (.RLEN) . . . . . . . . . . . . . . . . . . . . 15-8
Transmitted Word Count (.DLEN) . . . . . . . . . . . . . . . . . . . 15-8
File Number (.FILE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9
Element Number (.ELEM). . . . . . . . . . . . . . . . . . . . . . . . . 15-9
Selecting Continuous Operation. . . . . . . . . . . . . . . . . . . . . 15-10
Selecting Non-Continuous Operation . . . . . . . . . . . . . . . . . 15-12
Block Transfer Timing Classic PLC-5 Processors . . . . . . 15-13
Instruction Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13
Waiting Time in the Queue. . . . . . . . . . . . . . . . . . . . . . . 15-13
Transfer Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13
Block Transfer Timing Enhanced PLC-5 Processors . . . . 15-14
Instruction Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14
Waiting Time in the Holding Area . . . . . . . . . . . . . . . . . . 15-14
Transfer Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14
Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15
Example Bidirectional Alternating Block-Transfer. . . . . . 15-16
Example Bidirectional Alternating Repeating
Block-Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17
Example Bidirectional Continuous Block-Transfer . . . . . 15-18
Example Directional Non-Continuous Block-Transfer . . . 15-19
Example Directional Repeating Block Transfer . . . . . . . . 15-19
Example Directional Continuous Block-Transfer . . . . . . . 15-20
Example Buffering Block Transfer-Data . . . . . . . . . . . . . 15-21
ControlNet I/O Transfer (CIO) Instruction . . . . . . . . . . . . . . 15-22
Control Block Address . . . . . . . . . . . . . . . . . . . . . . . . . . 15-22
Using the CIO Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . 15-23
Using Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-24
Using the CT Control Block . . . . . . . . . . . . . . . . . . . . . . 15-25
toc8
Table of Contents
Chapter 16
Using the Message Instruction. . . . . . . . . . . . . . . . . . . . . . . 16-1
Message (MSG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2
Control Block Address . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2
MSG Data Entry Screen . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3
Using the Message Instruction for Ethernet
Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-5
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-5
Using the Message Instruction for PLC-5 Ethernet Interface
Module Communications. . . . . . . . . . . . . . . . . . . . . . . . . . . 16-7
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-7
Configuring an Ethernet Multihop MSG Instruction. . . . . . . . 16-9
Using the Message Instruction for ControlNet
Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-10
Control Block Address . . . . . . . . . . . . . . . . . . . . . . . . . . 16-10
Configuring a ControlNet Multihop MSG Instruction . . . . . . 16-11
Using Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-12
Using the Control Block . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-13
Error Code (.ERR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-13
Requested Length (.RLEN) . . . . . . . . . . . . . . . . . . . . . . . 16-13
Transmitted Length (.DLEN) . . . . . . . . . . . . . . . . . . . . . . 16-13
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-14
Communication Command . . . . . . . . . . . . . . . . . . . . . . 16-14
External Data Table Addresses. . . . . . . . . . . . . . . . . . . . 16-15
PLC-2 to PLC-5 Compatibility Files . . . . . . . . . . . . . . . . 16-15
Sending SLC Typed Logical Read and Typed Logical
Write Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-16
Monitoring a Message Instruction . . . . . . . . . . . . . . . . . . . 16-17
Selecting Continuous Operation. . . . . . . . . . . . . . . . . . . . . 16-18
Selecting Non-Continuous Operation . . . . . . . . . . . . . . . . . 16-19
MSG Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-20
Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-22
Table of Contents
ASCII Instructions
ABL, ACB, ACI, ACN, AEX, AIC, AHL,
ARD, ARL, ASC, ASR, AWA, AWT
toc9
Chapter 17
Using ASCII Instructions
Enhanced PLC-5 Processors Only . . . . . . . . . . . . . . . . . . . . 17-1
Using Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Using the Control Block . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
Length (.LEN). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
Position (.POS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
Using Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
Test Buffer for Line (ABL) . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4
Number of Characters in Buffer (ACB) . . . . . . . . . . . . . . . . . 17-5
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5
ASCII String to Integer (ACI) . . . . . . . . . . . . . . . . . . . . . . . . . 17-6
ASCII String Concatenate (ACN) . . . . . . . . . . . . . . . . . . . . . . 17-7
ASCII String Extract (AEX) . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7
ASCII Set or Reset Handshake Lines (AHL). . . . . . . . . . . . . . 17-8
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8
ASCII Integer to String (AIC) . . . . . . . . . . . . . . . . . . . . . . . . . 17-9
ASCII Read Characters (ARD). . . . . . . . . . . . . . . . . . . . . . . 17-10
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-10
ASCII Read Line (ARL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
ASCII String Search (ASC) . . . . . . . . . . . . . . . . . . . . . . . . . 17-14
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-14
ASCII String Compare (ASR). . . . . . . . . . . . . . . . . . . . . . . . 17-15
ASCII Write with Append (AWA) . . . . . . . . . . . . . . . . . . . . . 17-15
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-15
ASCII Write (AWT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-17
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-17
Chapter 18
Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-1
Smart Directed Sequencer (SDS) Overview . . . . . . . . . . . . . 18-2
Programming the SDS Instruction . . . . . . . . . . . . . . . . . . 18-2
Diagnostic Fault Annunciator (DFA) Overview . . . . . . . . . . . 18-3
Programming the DFA Instruction . . . . . . . . . . . . . . . . . . 18-3
toc10
Table of Contents
SFC Reference
Appendix A-1
Instruction Timing and Memory Requirements. . . . . . . . . . . . A-1
Timing for Enhanced PLC-5 Processors. . . . . . . . . . . . . . . . . A-2
Bit and Word Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . A-2
File Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-5
Timing for Classic PLC-5 Processors . . . . . . . . . . . . . . . . . . A-10
Bit and Word Instructions. . . . . . . . . . . . . . . . . . . . . . . . . A-10
File Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-13
Program Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-17
Direct and Indirect Elements: Enhanced PLC-5 Processors . A-17
Direct and Indirect Elements: Classic PLC-5 Processors . . . A-18
Indirect Bit or Elements Addresses: Classic
PLC-5 Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-19
Additional Timing Considerations: Classic
PLC-5 Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-20
Appendix B-1
Appendix Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1
SFC Status Information in the Processor Status File. . . . . . . . B-1
Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3
Dynamic Constraints Classic PLC-5 Processors Only . . . . . B-5
Scanning Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-7
Step and Transition Scanning . . . . . . . . . . . . . . . . . . . . . . B-7
Selected Branch Scanning. . . . . . . . . . . . . . . . . . . . . . . . . B-8
Simultaneous Branch Scanning . . . . . . . . . . . . . . . . . . . . . B-9
SFC Example and Scan Sequence . . . . . . . . . . . . . . . . . . B-11
Run Times Classic PLC-5 Processors . . . . . . . . . . . . . . . . B-12
Using Sequence Diagrams to Determine Run Time . . . . . B-13
Using Equations to Determine Run Time . . . . . . . . . . . . . B-14
Appendix C-1
Appendix Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
Instruction Operands and Valid Data Types . . . . . . . . . . . . . . C-1
Chapter
Found on Page:
XIC
1-3
XIO
1-3
OTE
1-4
OTL
1-4
OTU
1-5
IIN
1-6
IOT
1-7
IDI
1-8
IDO
1-8
:LWK WKHVH LQVWUXFWLRQV \RX FDQ DGGUHVV ELWV LQ DOO VHFWLRQV RI GDWD
VWRUDJH EXW WKH H[DPSOHV LQ WKLV FKDSWHU RQO\ VKRZ KRZ WR DGGUHVV
ELWV LQ WKH ,2 LPDJH ILOHV
)RU PRUH LQIRUPDWLRQ RQ WKH RSHUDQGV DQG YDOLG GDWD W\SHVYDOXHV RI
HDFK RSHUDQG XVHG E\ WKH LQVWUXFWLRQV GLVFXVVHG LQ WKLV FKDSWHU VHH
$SSHQGL[ &
,I \RX XVH UHOD\W\SH LQVWUXFWLRQ 27( 27/ RU 278 ZLWK LQGLUHFW
DGGUHVVHV WR VHW RU UHVHW D ELW LQ WKH FRQWURO ILOH RI D EORFNWUDQVIHU RU
PHVVDJH LQVWUXFWLRQ WKHUH PD\ EH FRQIOLFWLQJ UHVXOWV (YHQ WKRXJK
WKH ELW LQVWUXFWLRQ LV H[HFXWHG WR VHW RU UHVHW D ELW LWV UHVXOW PLJKW EH
RYHUZULWWHQ E\ WKH EORFNWUDQVIHU RU PHVVDJH RSHUDWLRQ WKDW VHWV RU
UHVHWV WKH VDPH ELW 7KHVH DUH DV\QFKURQRXV RSHUDWLRQV 7KH ODVW
RSHUDWLRQ WR VHW RU UHVHW WKH ELW LV WKH YDOXH WKDW LV VDYHG LQ WKH
GDWD WDEOH
1-2
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
closed (on)
on (1)
open (off)
off (0)
on (1)
energized (on)
off (0)
de-energized (off)
Rung Logic
$V HDFK FRQGLWLRQLQJ LQVWUXFWLRQ LV H[HFXWHG WKH DGGUHVVHG ELW LV
H[DPLQHG WR VHH LI LW PDWFKHV D FHUWDLQ FRQGLWLRQ RQ RU RII ,I D
FRPSOHWH SDWK RI WUXH FRQGLWLRQV H[DPLQHG IRU DUH IRXQG WKH UXQJ
LV VHW WR WUXH 7KH UXQJ PXVW FRQWDLQ D FRQWLQXRXV SDWK RI WUXH
LQVWUXFWLRQV IURP WKH VWDUW RI WKH UXQJ WR WKH RXWSXW IRU WKH RXWSXW
WR EH HQDEOHG
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
1-3
Examine On (XIC)
Description:
Example:
I:012
07
:KHQ D GHYLFH FORVHV LWV FLUFXLW WKH PRGXOH ZKRVH LQSXW WHUPLQDO LV
ZLUHG WR WKH GHYLFH GHWHFWV WKH FORVHG FLUFXLW 7KH SURFHVVRU UHIOHFWV
WKLV 21 VWDWH LQ WKH GDWD WDEOH :KHQ WKH SURFHVVRU ILQGV DQ ;,&
LQVWUXFWLRQ WKDW DGGUHVVHV WKH ELW WKDW FRUUHVSRQGV WR WKH LQSXW
WHUPLQDO WKH SURFHVVRU GHWHUPLQHV ZKHWKHU WKH GHYLFH LV 21 FORVHG
,I WKH SURFHVVRU ILQGV DQ 21 VWDWH LW VHWV WKH ORJLF IRU WKLV LQVWUXFWLRQ
WUXH LI WKH SURFHVVRU ILQGV DQ 2)) VWDWH LW VHWV WKH ORJLF IRU WKH
LQVWUXFWLRQ QRW WUXH
,I WKH ;,& LQVWUXFWLRQ LV WKH RQO\ FRQGLWLRQLQJ LQVWUXFWLRQ RQ WKH UXQJ
WKH SURFHVVRU HQDEOHV WKH RXWSXW LQVWUXFWLRQ ZKHQ WKH ;,& LQVWUXFWLRQ
LV WUXH LQSXW FORVHG 7KH SURFHVVRU GLVDEOHV DQ RXWSXW LQVWUXFWLRQ
ZKHQ WKH ;,& LQVWUXFWLRQ LV IDOVH LQSXW RSHQ
7KH H[DPLQHRQ LQVWUXFWLRQ LV WUXH RU IDOVH GHSHQGLQJ RQ ZKHWKHU WKH
SURFHVVRU ILQGV DQ 21 RU 2)) FRQGLWLRQ DW WKH DGGUHVVHG ELW
If the Bit Is:
on
true
off
false
Example:
I:012
07
:KHQ D GHYLFH RSHQV LWV FLUFXLW WKH PRGXOH ZKRVH LQSXW WHUPLQDO LV
ZLUHG WR WKH GHYLFH GHWHFWV DQ RSHQ FLUFXLW 7KH SURFHVVRU UHIOHFWV
WKLV 2)) VWDWH LQ WKH GDWD WDEOH :KHQ WKH SURFHVVRU ILQGV DQ ;,2
LQVWUXFWLRQ WKDW DGGUHVVHV WKH ELW WKDW FRUUHVSRQGV WR WKH LQSXW
WHUPLQDO WKH SURFHVVRU GHWHUPLQHV ZKHWKHU WKH GHYLFH LV 2))
RSHQ ,I WKH SURFHVVRU ILQGV DQ 2)) VWDWH LW VHWV WKH ORJLF IRU WKLV
LQVWUXFWLRQ WUXH ,I WKH SURFHVVRU ILQGV DQ 21 VWDWH LW VHWV WKH ;,2
LQVWUXFWLRQ WR IDOVH
,I WKH ;,2 LQVWUXFWLRQ LV WKH RQO\ FRQGLWLRQLQJ LQVWUXFWLRQ RQ WKH UXQJ
WKH SURFHVVRU HQDEOHV WKH RXWSXW LQVWUXFWLRQ ZKHQ WKH ;,2 LQVWUXFWLRQ
LV WUXH LQSXW RSHQ
7KH H[DPLQH RII LQVWUXFWLRQ LV WUXH RU IDOVH GHSHQGLQJ RQ ZKHWKHU WKH
SURFHVVRU ILQGV DQ 2)) RU 21 FRQGLWLRQ DW WKH DGGUHVVHG ELW
If the Bit Is:
off
true
on
false
1-4
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
Energize (OTE)
Description:
Example:
O:013
01
true
on
false
off
Latch (OTL)
Description:
L
Example:
O:013
L
01
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
1-5
:KHQ HQDEOHG WKH ODWFK LQVWUXFWLRQ WHOOV WKH SURFHVVRU WR WXUQ RQ WKH
DGGUHVVHG ELW 7KHUHDIWHU WKH ELW UHPDLQV RQ UHJDUGOHVV RI WKH UXQJ
FRQGLWLRQ XQWLO WKH ELW LV WXUQHG RII W\SLFDOO\ E\ DQ XQODWFK 278
LQVWUXFWLRQ LQ DQRWKHU UXQJ
If the Rung Is:
true
on
false
no change
:KHQ WKH SURFHVVRU FKDQJHV IURP 5XQ WR 3URJUDP PRGH RU ZKHQ WKH
SURFHVVRU ORVHV SRZHU DQG WKHUH LV EDWWHU\ EDFNXS WKH ODVW WUXH 27/
LQVWUXFWLRQ FRQWLQXHV WR FRQWURO WKH ELW LQ PHPRU\ 7KH ODWFKHG RXWSXW
GHYLFH LV HQHUJL]HG HYHQ WKRXJK WKH UXQJ FRQGLWLRQV WKDW FRQWURO WKH
LQVWUXFWLRQ PD\ KDYH JRQH IDOVH
,PSRUWDQW 7KH 27/ LQVWUXFWLRQ LV UHWHQWLYH :KHQ WKH SURFHVVRU
ORVHV SRZHU LV VZLWFKHG WR 3URJUDP PRGH RU 7HVW
PRGH RU GHWHFWV D PDMRU IDXOW RXWSXWV JR RII EXW WKH
VWDWHV RI UHWHQWLYH RXWSXWV DUH UHWDLQHG LQ PHPRU\
:KHQ WKH SURFHVVRU UHVXPHV RSHUDWLRQ LQ 5XQ PRGH
UHWHQWLYH RXWSXWV LPPHGLDWHO\ UHWXUQ WR WKHLU SUHYLRXV
VWDWHV 1RQUHWHQWLYH RXWSXWV VXFK DV 27( RXWSXWV DUH
UHVHW
Unlatch (OTU)
Description:
U
Example:
O:013
U
01
true
off
false
no change
1-6
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
Example:
RRG
IIN
Where:
RR = I/O rack number
00-03 PLC-5/10, -5/11, -5/12, -5/15, -5/20
00-07 PLC-5/25, -5/30
000-177 PLC-5/40, -5/40L
000-277 PLC-5/60, -5/60L, -5/80
G = I/O group number (0 - 7)
001
IIN
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
1-7
Example:
RRG
IOT
Where:
RR = I/O rack number
00-03 PLC-5/10, -5/11, -5/12, -5/15, -5/20
00-07 PLC-5/25, -5/30
000-177 PLC-5/40, -5/40L
000-277 PLC-5/60, -5/60L, -5/80
G = I/O group number (0 - 7)
001
IOT
1-8
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
232
10
:KHQ WKH UXQJ JRHV WUXH WKH ,', LQVWUXFWLRQ SHUIRUPV DQ LPPHGLDWH
XSGDWH RI WKH &RQWURO1HW GDWD LQSXW ILOH IURP WKH &RQWURO1HW PHPRU\
EXIIHUV EHIRUH WKH QH[W QRUPDO LQSXWLPDJH XSGDWH ZKLFK RFFXUV DW
WKH HQG RI WKH SURJUDP VFDQ
7R SURJUDP DQ ,', LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ LQIRUPDWLRQ WKDW LW VWRUHV LQ LWV FRQWURO EORFN
N10:232
'DWD ILOH RIIVHW VSHFLILHV WKH RIIVHW LQWR WKH 'DWD ,QSXW )LOH ',)
ZKHUH ZRUGV DUH UHDG FDQ EH DQ LPPHGLDWH YDOXH RU D
ORJLFDO DGGUHVV WKDW VSHFLILHV WKH GDWD LPDJH ILOH RIIVHW
232
Length
10
Source
N7:232
:KHQ WKH UXQJ JRHV WUXH WKH ,'2 LQVWUXFWLRQ SHUIRUPV DQ LPPHGLDWH
XSGDWH RI WKH &RQWURO1HW PHPRU\ EXIIHUV IURP WKH VRXUFH ILOH EHIRUH
WKH QH[W RXWSXWLPDJH XSGDWH VHQGLQJ WKH XSGDWHG GDWD RXWSXW ILOH
LQIRUPDWLRQ DFURVV WKH &RQWURO1HW QHWZRUN WR WKH DSSURSULDWH
&RQWURO1HW GHYLFH
7R SURJUDP DQ ,'2 LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ LQIRUPDWLRQ WKDW LW VWRUHV LQ LWV FRQWURO EORFN
'DWD ILOH RIIVHW VSHFLILHV WKH RIIVHW LQWR WKH 'DWD 2XWSXW )LOH
'2) ZKHUH ZRUGV DUH ZULWWHQ FDQ EH DQ LPPHGLDWH YDOXH
RU D ORJLFDO DGGUHVV WKDW VSHFLILHV WKH GDWD LPDJH
ILOH RIIVHW
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
1-9
<RX FDQ XVH WKH ,', DQG ,'2 LQVWUXFWLRQV IRU LPPHGLDWH GDWD LQSXW
DQG RXWSXW RQ &RQWURO1HW
)RU PRUH GHWDLOHG LQIRUPDWLRQ DERXW ZULWLQJ ODGGHU SURJUDPV VHH
\RXU SURJUDPPLQJ PDQXDO
,PSRUWDQW %H FDUHIXO ZKHQ XVLQJ 6HOHFWDEOH 7LPHG ,QWHUUXSWV
67,V ZLWK D SURJUDP RQ D &RQWURO1HW QHWZRUN
$ 6HOHFWDEOH 7LPHG ,QWHUUXSW 67, SHULRGLFDOO\ LQWHUUXSWV SULPDU\
SURJUDP H[HFXWLRQ LQ RUGHU WR UXQ D VXESURJUDP WR FRPSOHWLRQ ,I DQ
67, RFFXUV ZKLOH D QRUPDO &RQWURO1HW QRQGLVFUHWH ,2 WUDQVIHU RU D
&RQWURO1HW ,PPHGLDWH 'DWD ,2 LQVWUXFWLRQ ,', RU ,'2 LV LQ
SURJUHVV DQG WKH\ ERWK RSHUDWH RQ WKH VDPH VHW RI GDWD WKH LQWHJULW\ RI
WKDW EORFN RI GDWD LV MHRSDUGL]HG
7R HQVXUH GDWDEORFN LQWHJULW\ ZULWH \RXU 67, URXWLQH VR WKDW LW
RSHUDWHV RQ LWV RZQ FRS\ RI WKH GDWD EORFN WKDW LW QHHGV 8VH
&RQWURO1HW ,PPHGLDWH 'DWD ,2 LQVWUXFWLRQV ,', DQG ,'2 ZLWKLQ
\RXU 67, WR FRS\ WKH QHHGHG EORFN RI GDWD RXW WR DQG EDFN IURP D
WHPSRUDU\ ORFDWLRQ WKDW LV GLIIHUHQW IURP WKDW XVHG E\ WKH QRUPDO
GDWD WDEOH
)RU GHWDLOHG LQIRUPDWLRQ RQ 67,V VHH \RXU VRIWZDUH XVHU PDQXDO
1-10
1RWHV
Relay-Type Instructions XIC, XIO, OTE, OTL, OTU, IIN, IOT, IDI, IDO
Chapter
Found on Page:
TON
2-4
TOF
2-7
RTO
2-10
Count up
CTU
2-15
Count down
CTD
2-17
RE
2-20
Using Timers
%HIRUH \RX SURJUDP WLPHU LQVWUXFWLRQV \RX QHHG WR XQGHUVWDQG WKH
SDUDPHWHUV WKDW \RX HQWHU IRU WLPHU LQVWUXFWLRQV DQG KRZ WLPHU
DFFXUDF\ ZRUNV
2-2
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Entering Parameters
TON
TIMER ON DELAY
EN
Timer
Time base
DN
Preset
Accum
,PSRUWDQW <RX FDQ XVH DQ\ WLPHU ILOH QXPEHU IURP WR
KRZHYHU WKH GHIDXOW WLPHU ILOH QXPEHU LV ,I \RX ZDQW
WR VSHFLI\ D WLPHU ILOH QXPEHU DV DQ\ ILOH EHWZHHQ DQG
RWKHU WKDQ WKH GHIDXOW \RX PXVW ILUVW GHOHWH WKH
HQWLUH GHIDXOW ILOH IRU WKDW QXPEHU DQG WKHQ FUHDWH WKH
WLPHU ILOH )RU H[DPSOH LI \RX ZDQW D WLPHU ILOH QXPEHU
DV ILOH \RX PXVW ILUVW GHOHWH WKH HQWLUH GHIDXOW ELQDU\
ILOH DQG WKHQ FUHDWH WKH WLPHU ILOH DV ILOH
7R DFFHVV D WLPHU VWDWXV ELW SUHVHW RU DFFXPXODWHG YDOXH VWRUHG DW WKH
WLPHU FRQWURO DGGUHVV XVH WKH IROORZLQJ DGGUHVV IRUPDW
Status Bit
Preset
Accumulated Value
Tf:s.sb
Tf:s.PRE
Tf:s.ACC
EN TT
11 10 09 08 07 06 05 04 03 02 01 00
DN
Control word
for T4:0
EN TT DN
preset value (16 bits)
.
.
.
Control word
for T4:1
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-3
7LPH %DVH GHWHUPLQHV KRZ WKH WLPHU RSHUDWHV 7DEOH % OLVWV WKH
SRVVLEOH WLPH EDVHV
Table 1.B
Available Time Base Values
1 second
3UHVHW VSHFLILHV WKH YDOXH ZKLFK WKH WLPHU PXVW UHDFK EHIRUH WKH
SURFHVVRU VHWV WKH GRQH ELW '1 <RX PXVW HQWHU D SUHVHW YDOXH
IURP 7KH SURFHVVRU VWRUHV WKH SUHVHW YDOXH DV D ELW
LQWHJHU YDOXH
Timer Accuracy
7LPHU DFFXUDF\ UHIHUV WR WKH OHQJWK RI WLPH EHWZHHQ WKH PRPHQW WKH
SURFHVVRU HQDEOHV D WLPHU LQVWUXFWLRQ DQG WKH PRPHQW WKH SURFHVVRU
FRPSOHWHV WKH WLPHG LQWHUYDO 7LPHU DFFXUDF\ GHSHQGV RQ WKH
SURFHVVRU FORFN WROHUDQFH DQG WKH WLPH EDVH 7KH FORFN WROHUDQFH LV
7KLV PHDQV WKDW D WLPHU FRXOG WLPH RXW HDUO\ RU ODWH E\
VHFRQGV PV IRU D VHFRQG WLPH EDVH RU VHFRQG IRU D VHFRQG
WLPH EDVH
7KH VHFRQG WLPHU PDLQWDLQV DFFXUDF\ ZLWK D SURJUDP VFDQ RI XS
WR VHFRQGV WKH VHFRQG WLPHU PDLQWDLQV DFFXUDF\ ZLWK D SURJUDP
VFDQ RI XS WR VHFRQGV ,I \RXU SURJUDPV FDQ H[FHHG RU
VHFRQGV UHSHDW WKH WLPHU LQVWUXFWLRQ UXQJ VR WKDW WKH UXQJ LV VFDQQHG
ZLWKLQ WKHVH OLPLWV
7KH GLVSOD\HG DFFXPXODWHG YDOXH RI D WLPHU VKRZV DFWXDO WLPH EXW LV
GHSHQGHQW RQ &57 XSGDWH WLPH 7KH DFFXPXODWHG YDOXH PLJKW DSSHDU
WR EH OHVV WKDQ WKH SUHVHW ZKHQ WKH GRQH ELW LV VHW
2-4
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
EN
Timer
Time base
DN
Preset
Accum
8VH WKH 721 LQVWUXFWLRQ WR WXUQ DQ RXWSXW RQ RU RII DIWHU WKH WLPHU KDV
EHHQ RQ IRU D SUHVHW WLPH LQWHUYDO 7KH 721 LQVWUXFWLRQ VWDUWV
DFFXPXODWLQJ WLPH ZKHQ WKH UXQJ JRHV WUXH DQG FRQWLQXHV XQWLO RQH
RI WKH IROORZLQJ KDSSHQV
Is Set When:
Indicates:
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-5
,I \RX VHW WKH GRQH ELW '1 XVLQJ DQ 27( LQVWUXFWLRQ IRU H[DPSOH
\RX FDQ SDXVH WKH WLPHU 7KH (1 DQG 77 ELWV UHPDLQ VHW EXW WKH
DFFXPXODWHG YDOXH GRHV QRW LQFUHPHQW 7LPLQJ UHVXPHV ZKHQ \RX
FOHDU WKH '1 ELW ,I WKH UXQJ JRHV IDOVH ZKLOH WKH WLPHU LV SDXVHG WKH
WLPHU UHVHWV DV QRUPDO
,I \RX FKDQJH WR 3URJUDP PRGH RU WKH SURFHVVRU ORVHV SRZHU
EHIRUH WKH LQVWUXFWLRQ UHDFKHV WKH SUHVHW YDOXH WKH IROORZLQJ
RFFXUV
WLPHU HQDEOH (1 ELW UHPDLQV VHW
WLPHU WLPLQJ 77 ELW UHPDLQV VHW
DFFXPXODWHG $&& YDOXH UHPDLQV WKH VDPH
7KHQ ZKHQ \RX VZLWFK EDFN WR 5XQ PRGH RU 7HVW PRGH RU SRZHU
LV UHVWRUHG WKH IROORZLQJ KDSSHQV
Condition:
Result:
Figure 2.1
Example TON Ladder Diagram
TON
I:012
TIMER ON DELAY
10
T4:0
Timer
EN
T4:0
Time base
1.0
Preset
180
Accum
DN
O:013
TT
01
T4:0
O:013
DN
02
When bit I:012/10 is set, the processor starts T4:0. The accumulated value increments in 1-second intervals.
T4:0.TT is set and output bit O:013/01 is set (the associated output device is energized) while the timer is timing.
When the timer is finished (.ACC = .PRE) T4:0.TT is reset (so O:013/01 and the associated output device is
de-energized) and T4:0.DN is set (so O:013/02 is set and the associated output device is energized). When the
accumulated value reaches 180, the .DN bit is set. Or if the rung goes false, the timer is reset.
2-6
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Figure 2.2
Example TON Timing Diagram
ON
Rung Condition
OFF
ON
OFF
ON
OFF
ON
OFF
ON
OFF
3 minutes
ON
Delay
2 minutes
180
120
0
Timer Preset = 180
16649
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-7
EN
Timer
Time base
DN
Preset
Accum
8VH WKH 72) LQVWUXFWLRQ WR WXUQ DQ RXWSXW RQ RU RII DIWHU LWV UXQJ KDV
EHHQ RII IRU D SUHVHW WLPH LQWHUYDO 7KH 72) LQVWUXFWLRQ VWDUWV
DFFXPXODWLQJ WLPH ZKHQ WKH UXQJ JRHV IDOVH DQG FRQWLQXHV WLPLQJ
XQWLO RQH RI WKH IROORZLQJ FRQGLWLRQV RFFXU
7KH SURFHVVRU UHVHWV WKH DFFXPXODWHG YDOXH ZKHQ WKH UXQJ FRQGLWLRQV
JR WUXH UHJDUGOHVV RI ZKHWKHU WKH WLPHU WLPHG RXW RU QRW
Is Set When:
2-8
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
,I \RX VHW WKH GRQH ELW '1 XVLQJ DQ 27( LQVWUXFWLRQ IRU H[DPSOH
\RX FDQ SDXVH WKH WLPHU 7KH (1 DQG 77 ELWV UHPDLQ VHW EXW WKH
DFFXPXODWHG YDOXH GRHV QRW LQFUHPHQW 7LPLQJ UHVXPHV ZKHQ \RX
FOHDU WKH '1 ELW ,I WKH UXQJ JRHV IDOVH ZKLOH WKH WLPHU LV SDXVHG WKH
WLPHU UHVHWV DV QRUPDO
,I \RX FKDQJH WR 3URJUDP PRGH RU WKH SURFHVVRU ORVHV SRZHU RU
WKH SURFHVVRU IDXOW LQWHUUXSWV WKH 72) LQVWUXFWLRQ EHIRUH LW
UHDFKHV WKH SUHVHW YDOXH WKH IROORZLQJ RFFXUV
WLPHU HQDEOH (1 ELW UHPDLQV UHVHW
WLPHU WLPLQJ 77 ELW UHPDLQV VHW
WLPHU GRQH '1 ELW UHPDLQV VHW
DFFXPXODWHG $&& YDOXH UHPDLQV WKH VDPH
7KHQ LI \RX VZLWFK WR 5XQ PRGH RU 7HVW PRGH WKH IROORZLQJ
KDSSHQV
Condition:
Result:
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-9
Figure 2.3
Example TOF Ladder Diagram
TOF
I:012
T4:0
EN
Timer
T4:0
Time base
1.0
Preset
180
Accum
O:013
01
TT
T4:0
DN
O:013
DN
02
When bit I:012/10 is reset, the processor starts timer T4:0. The accumulated value increments by 1-second intervals as long as the
rung remains false. T4:0.TT is set and output bit O:013/01 is set (the associated output device is energized) while the timer is timing.
When the timer is finished (.ACC = .PRE), T4:0.TT is reset (so O:013/01 is reset and the associated output device is de-energized)
and T4:0.DN is reset (so O:013/02 is reset and the associated output device is de-energized). When the accumulated value reaches
180 or when the rung conditions go true, the timer stops.
Figure 2.4
Example TOF Timing Diagram
ON
Rung Condition
OFF
ON
OFF
ON
OFF
ON
OFF
Output Device
(Controlled by Done Bit)
ON
OFF
OFF Delay
3 minutes
2 minutes
180
Time
120
Timer Accumulated Value
(Accumulator)
0
Timer Preset = 180
16650
2-10
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
EN
Timer
Time base
DN
Preset
Accum
8VH WKH 572 LQVWUXFWLRQ WR WXUQ DQ RXWSXW RQ RU RII DIWHU LWV WLPHU KDV
EHHQ RQ IRU D SUHVHW WLPH LQWHUYDO 7KH 572 LQVWUXFWLRQ OHWV WKH WLPHU
VWRS DQG VWDUW ZLWKRXW UHVHWWLQJ WKH DFFXPXODWHG YDOXH
7KH 572 LQVWUXFWLRQ EHJLQV WLPLQJ ZKHQ LWV UXQJ JRHV WUXH $V ORQJ
DV WKH UXQJ UHPDLQV WUXH WKH WLPHU XSGDWHV WKH DFFXPXODWHG YDOXH
HDFK SURJUDP VFDQ XQWLO LW UHDFKHV WKH SUHVHW YDOXH 7KH 572
LQVWUXFWLRQ UHWDLQV LWV DFFXPXODWHG YDOXH HYHQ LI RQH RI WKH IROORZLQJ
RFFXUV
:KHQ WKH SURFHVVRU UHVXPHV RSHUDWLRQ RU WKH UXQJ JRHV WUXH WLPLQJ
FRQWLQXHV IURP WKH UHWDLQHG DFFXPXODWHG YDOXH %\ UHWDLQLQJ LWV
DFFXPXODWHG YDOXH UHWHQWLYH WLPHUV PHDVXUH WKH FXPXODWLYH SHULRG
GXULQJ ZKLFK LWV UXQJ LV WUXH
,PSRUWDQW 7R UHVHW WKH UHWHQWLYH WLPHUV DFFXPXODWHG YDOXH DQG
VWDWXV ELWV DIWHU WKH 572 UXQJ JRHV IDOVH \RX PXVW
SURJUDP D UHVHW LQVWUXFWLRQ 5(6 ZLWK WKH VDPH DGGUHVV
LQ DQRWKHU UXQJ
Is Set When:
Indicates:
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-11
,I \RX VHW WKH GRQH ELW '1 XVLQJ DQ 27( LQVWUXFWLRQ IRU H[DPSOH
\RX FDQ SDXVH WKH WLPHU 7KH (1 DQG 77 ELWV UHPDLQ VHW EXW WKH
DFFXPXODWHG YDOXH GRHV QRW LQFUHPHQW 7LPLQJ UHVXPHV ZKHQ \RX
FOHDU WKH '1 ELW ,I WKH UXQJ JRHV IDOVH ZKLOH WKH WLPHU LV SDXVHG WKH
WLPHU UHVHWV DV QRUPDO
,I \RX FKDQJH WR 3URJUDP PRGH RU WKH SURFHVVRU ORVHV SRZHU RU
D SURFHVVRU IDXOW LQWHUUXSWV WKH 572 LQVWUXFWLRQ WKH IROORZLQJ
RFFXUV
WLPHU HQDEOH (1 ELW UHPDLQV VHW
WLPHU WLPLQJ 77 ELW UHPDLQV VHW
DFFXPXODWHG $&& YDOXH UHPDLQV WKH VDPH
:KHQ \RX VZLWFK EDFN WR 5XQ PRGH RU 7HVW PRGH WKH IROORZLQJ
KDSSHQV
Condition:
Result:
Figure 2.5
Example RTO Ladder Diagram
RTO
I:012
RETENTIVE TIMER ON
10
I:017
Timer
Time base
Preset
Accum
EN
T4:10
1.0
180
0
DN
T4:10
RES
12
2-12
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Figure 2.6
Retentive Timer Timing Diagram
ON
Rung Condition
OFF
ON
OFF
Reset Pulse
ON
OFF
ON
OFF
ON
OFF
ON
Output Device
(Controlled by Done Bit)
OFF
180
120
100
40
Timer Preset = 180
16651
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Using Counters
CTU
COUNT UP
CU
Counter
Preset
Accum
2-13
DN
Entering Parameters
7R SURJUDP D FRXQWHU LQVWUXFWLRQ SURYLGH WKH SURFHVVRU ZLWK WKH IROORZLQJ
LQIRUPDWLRQ
s
counter structure number (0-999)
,PSRUWDQW <RX FDQ XVH DQ\ FRXQWHU ILOH QXPEHU IURP WR
KRZHYHU WKH GHIDXOW FRXQWHU ILOH QXPEHU LV ,I \RX
ZDQW WR VSHFLI\ D FRXQWHU ILOH QXPEHU DV DQ\ ILOH
EHWZHHQ DQG RWKHU WKDQ WKH GHIDXOW \RX PXVW
ILUVW GHOHWH WKH HQWLUH GHIDXOW ILOH IRU WKDW QXPEHU DQG
WKHQ FUHDWH WKH FRXQWHU ILOH )RU H[DPSOH LI \RX ZDQW D
FRXQWHU ILOH QXPEHU DV ILOH \RX PXVW ILUVW GHOHWH WKH
HQWLUH GHIDXOW ELQDU\ ILOH DQG WKHQ FUHDWH WKH FRXQWHU ILOH
DV ILOH
7R DFFHVV D FRXQWHU VWDWXV ELW SUHVHW YDOXH RU DFFXPXODWHG YDOXH XVH
WKH IROORZLQJ DGGUHVV IRUPDW
Status Bit
Preset
Accumulated Value
Cf:s.bb
Cf:s.PRE
Cf:s.ACC
CU
11 10 09 08 07 06 05 04 03 02 01 00
CD DN OV UN
Control word
for C5:0
CU
CD DN OV UN
Control word
for C5:1
2-14
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
3UHVHW VSHFLILHV WKH YDOXH ZKLFK WKH FRXQWHU PXVW UHDFK EHIRUH LW
VHWV WKH GRQH ELW '1 (QWHU D SUHVHW YDOXH IURP XS WR
7KH SUHVHW YDOXH LV VWRUHG DV D ELW LQWHJHU YDOXH
1HJDWLYH YDOXHV DUH VWRUHG LQ WZRV FRPSOHPHQW IRUP
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-15
Count Up (CTU)
Description:
CTU
COUNT UP
CU
Counter
Preset
DN
Accum
Is Set:
Count Up
Enable Bit .CU (bit 15)
Count Up
Done Bit .DN (bit 13)
Count Up
Overflow Bit .OV (bit 12)
2-16
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Figure 2.7
Example CTU Ladder Diagram
CTU
I:012
COUNT UP
Each time the input goes false to true,
the processor increments the counter
by 1.
10
C5:0
CU
Counter
C5:0
Preset
Accum
O:020
01
DN
C5:0
O:021
02
OV
Reset the counter
I:017
C5:0
RES
12
Figure 2.8
Example CTU Timing Diagram
Counter preset = 4 counts
Rung condition that
controls counter
ON
OFF
ON
OFF
Done Bit
ON
OFF
ON
OFF
ON
OFF
4
3
2
1
0
16636
DN
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-17
CD
Counter
Preset
DN
Accum
Is Set:
Count Down
Enable Bit .CD (bit 14)
Count Down
Done Bit .DN (bit 13)
Count Down
Underflow Bit (.UN) (Bit 11)
2-18
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Figure 2.9
Example CTD Ladder Diagram
CTD
I:012
CD
COUNT DOWN
10
C5:0
Counter
C5:0
Preset
Accum
O:020
01
DN
C5:0
O:021
02
UN
I:017
C5:0
RES
12
Figure 2.10
Example CTD Timing Diagram
ON
OFF
Done Bit
8
Counter Accumulated Value
3
0
16637
DN
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
2-19
Figure 2.11
Example CTU and CTD Logic Diagram
I:012
CTU
Count up pushbutton
COUNT UP
10
I:012
CU
Counter
Preset
Accum
C5:0
4
0
DN
CTD
COUNT DOWN
11
CD
Counter
Preset
Accum
C5:0
C5:0
4
0
DN
O:013
O:013
01
DN
C5:0
02
OV
C5:0
O:013
UN
I:017
C5:0
03
RES
12
Figure 2.12
Example CTU and CTD Timing Diagram
ON
Count Up Pushbutton
OFF
ON
Count Down Pushbutton
OFF
ON
Reset Pulse
OFF
ON
Done Bit
OFF
1
Counter Accumulated Value
Count Up Preset = 4
Count Down Preset = 4
16652
2-20
Timer Instructions TON, TOF, RTO Counter Instructions CTU, CTD Reset RES
Timer
(Do not use a RES instruction for a TOF.)
.ACC value
.EN bit
.TT bit
.DN bit
Counter
.ACC value
.EN bit
.OV or .UN bit
.DN bit
,I WKH FRXQWHU UXQJ LV HQDEOHG WKH &8 RU &' ELW ZLOO EH UHVHW DV ORQJ
DV WKH 5(6 LQVWUXFWLRQ LV HQDEOHG
,PSRUWDQW <RX FDQ XVH D QHJDWLYH SUHVHW YDOXH LQ D &78 RU &7'
LQVWUXFWLRQ LI \RX LQWHQG WR XVH WKH 5(6 LQVWUXFWLRQ
+RZHYHU QRWH WKDW WKH 5(6 LQVWUXFWLRQ VHWV WKH
DFFXPXODWHG YDOXH WR ]HUR ZKLFK PD\ VHW WKH '1 ELW
DQG SUHYHQW WKH &78 RU &7' LQVWUXFWLRQ IURP RSHUDWLQJ
WKH QH[W WLPH LW LV HQDEOHG
$77(17,21 %HFDXVH WKH 5(6 LQVWUXFWLRQ UHVHWV WKH
DFFXPXODWHG YDOXH '1 ELW DQG 77 ELW RI D WLPLQJ
LQVWUXFWLRQ GR QRW XVH WKH 5(6 LQVWUXFWLRQ WR UHVHW D 72)
LQVWUXFWLRQ XQSUHGLFWDEOH PDFKLQH RSHUDWLRQ RU LQMXU\
WR SHUVRQQHO PD\ RFFXU
Figure 2.13
Example RES Ladder Diagram
CTD
I:012
COUNT DOWN
10
C5:0
CD
C5:0
Preset
Accum
O:020
01
DN
I:017
Counter
C5:0
RES
12
DN
Chapter
Use the
Instruction:
On
Page:
CMP
3-2
EQU
3-5
GEQ
3-5
GRT
3-6
LEQ
3-6
LES
3-7
LIM
3-7
MEQ
3-9
NEQ
3-10
3-2
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
7KH DULWKPHWLF VWDWXV IODJV DUH LQ ZRUG ELWV LQ WKH SURFHVVRU
VWDWXV ILOH 6 0RQLWRU WKHVH ELWV LI \RX SHUIRUP DQ DULWKPHWLF
IXQFWLRQ ZLWKLQ WKH &03 LQVWUXFWLRQ 7DEOH % OLVWV WKH VWDWXV ELWV
Table 3.B
Arithmetic Status Bits
This Bit:
Description:
S:0/0
Carry (C)
S:0/1
Overflow (V)
S:0/2
Zero (Z)
S:0/3
Sign (S)
Compare (CMP)
Description:
CMP
COMPARE
Expression
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
3-3
Table 3.C
Valid Operations for Use in a CMP Expression
Type
Operator
Description
Example Operation
Comparison
equal to
if A = B, then ...
<>
not equal to
<
less than
<=
>
greater than
>=
add
subtract
12 5
multiply
| (vertical bar)
divide
24 | 6
negate
N7:0
SQR
square root
SQR N7:0
**
exponential
(x to the power of y)
10**3
(Enhanced PLC-5 processors only)
FRD
FRD N7:0
TOD
TOD N7:0
Arithmetic
Conversion
3-4
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
This Operation:
math binary
+, , *, |
OR, **
AND, XOR
(negate)
LN
=, <, >
math unary
comparative
Example:
CMP
O:013
COMPARE
01
Expression
(N7:0 + N7:1) > (N7:2 + N7:3)
The CMP instruction tells an Enhanced PLC-5 processor: if the sum of the values in N7:0 and N7:1 is greater than the sum of the
values in N7:2 and N7:3, set output bit O:013/01. (The total number of characters used in this expressions is 3.)
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
3-5
Equal to (EQU)
Description:
EQU
EQUAL
Source A
Source B
8VH WKH (48 LQVWUXFWLRQ WR WHVW ZKHWKHU WZR YDOXHV DUH HTXDO
6RXUFH $ DQG 6RXUFH % FDQ HLWKHU EH YDOXHV RU DGGUHVVHV WKDW FRQWDLQ
YDOXHV
Example:
EQU
O:013
EQUAL
Source A
Source B
N7:5
N7:10
01
If the value in N7:5 is equal to the value in N7:10, set output bit O:013/01.
Source A
Source B
Example:
GEQ
O:013
N7:5
Source B
N7:10
01
If the value in N7:5 is greater than or equal to the value in N7:10, set output bit O:013/01.
3-6
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
Source A
Source B
Example:
GRT
O:013
GREATER THAN
Source A
N7:5
Source B
N7:10
01
If the value in N7:5 is greater than the value in N7:10, set output bit O:013/01.
8VH WKH /(4 LQVWUXFWLRQ WR WHVW ZKHWKHU RQH YDOXH 6RXUFH $ LV OHVV
WKDQ RU HTXDO WR DQRWKHU YDOXH 6RXUFH % 6RXUFH $ DQG 6RXUFH % FDQ
HLWKHU EH YDOXHV RU DGGUHVVHV WKDW FRQWDLQ YDOXHV
Source A
Source B
Example:
LEQ
O:013
N7:5
Source B
N7:10
If the value in N7:5 is less than or equal to the value in N7:10, set output bit O:013/01.
01
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
3-7
8VH WKH /(6 LQVWUXFWLRQ WR WHVW ZKHWKHU RQH YDOXH 6RXUFH $ LV OHVV
WKDQ DQRWKHU YDOXH 6RXUFH % 6RXUFH $ DQG 6RXUFH % FDQ EH YDOXHV
RU DGGUHVVHV WKDW FRQWDLQ YDOXHV
Source A
Source B
Example:
LES
O:013
LESS THAN
Source A
N7:5
Source B
N7:10
01
If the value in N7:5 is less than the value in N7:10, set output bit O:013/01.
7KH /,0 LQVWUXFWLRQ LV DQ LQSXW LQVWUXFWLRQ WKDW WHVWV IRU YDOXHV LQVLGH
RI RU RXWVLGH RI D VSHFLILHG UDQJH 7KH LQVWUXFWLRQ LV IDOVH XQWLO LW
GHWHFWV WKDW WKH WHVW YDOXH LV ZLWKLQ FHUWDLQ OLPLWV 7KHQ WKH LQVWUXFWLRQ
JRHV WUXH :KHQ WKH LQVWUXFWLRQ GHWHFWV WKDW WKH WHVW YDOXH JRHV RXWVLGH
FHUWDLQ OLPLWV LW JRHV IDOVH
<RX FDQ XVH WKH /,0 LQVWUXFWLRQ WR WHVW LI DQ DQDORJ LQSXW YDOXH LV
ZLWKLQ VSHFLILHG OLPLWV
Entering Parameters
7R SURJUDP WKH /,0 LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Parameter:
Definition:
Low Limit
Test Value
High Limit
3-8
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
-------true-----A ................C
< value B >
> false
..........
to +32,767
------false------
> true
A . . . . . . . . . . . . to +32,767
< value B
O:013
N7:10
Test
N7:15
High lim
N7:20
01
If the value in N7:15 is greater than or equal to the value in N7:10 and less than or equal to the value in
N7:20, set output bit O:013/01.
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
3-9
Entering Parameters
7R SURJUDP WKH 0(4 LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU
ZLWK WKH IROORZLQJ
Example:
Parameter:
Definition:
Source
Mask
specifies which bits to pass or block. A mask passes data when the
mask bits are set (1); a mask blocks data when the mask bits are reset
(0). The mask must be the same element size (16-bits) as the source
and compare address. In order for bits to be compared, you must set (1)
mask bits; bits in the compare address that correspond to zeros (0) in
the mask are not compared. If you want the ladder program to change
the mask value, store the mask at a data address. Otherwise, enter a
hexadecimal value for a constant mask value. If you enter a hexadecimal
value that starts with a letter (such a F800), enter the value with a
leading zero. For example, type 0F800
Compare
specifies whether you want the ladder program to vary the compare
value, or a program constant for a fixed reference. Use 16-bit elements,
the same as the source.
Source
Mask
Compare
Result
01010101 01011111
11111111 11110000
01010101 0101xxxx
The instruction is true because
reference bits xxxx are not compared.
MEQ
O:013
MASKED EQUAL
Source
Mask
Compare
N7:5
N7:6
N7:10
01
The processor passes the value in N7:5 through the mask in N7:6. It then passes the value in N7:10 through the mask
in N7:6. If the two masked values are equal, set output bit O:013/01
3-10
Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ
Description:
NEQ
NOT EQUAL
Source A
Source B
Example:
NEQ
O:013
NOT EQUAL
Source A
N7:5
Source B
N7:10
If the value in N7:5 is not equal to the value in N7:10, set output bit O:013/01.
01
Chapter
Use this
Instruction:
Found on
Page:
Evaluate an expression
CPT
4-5
ACS*
4-11
ADD
4-12
ASN*
4-13
ATN*
4-14
AVE*
4-15
CLR
4-17
COS*
4-18
DIV
4-19
LN*
4-20
LOG*
4-21
(Continued)
4-2
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Use this
Instruction:
Found on
Page:
MUL
4-22
NEG
4-23
SIN*
4-24
SQR
4-25
SRT*
4-26
STD*
4-28
SUB
4-31
TAN*
4-32
XPY*
4-33
7KH DULWKPHWLF VWDWXV IODJV DUH LQ ZRUG ELWV LQ WKH SURFHVVRU
VWDWXV ILOH 6 7DEOH % OLVWV WKH VWDWXV ELWV
Table 4.B
Arithmetic Status Bits
This Bit:
Description:
S:0/0
Carry (C)
S:0/1
Overflow (V)
S:0/2
Zero (Z)
S:0/3
Sign (S)
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-3
<RX FDQ FRPSXWH YDOXHV RI GLIIHUHQW GDWD W\SHV VXFK DV IORDWLQJ SRLQW
DQG LQWHJHU ,I \RX XVH D IORDWLQJSRLQW DV WKH VRXUFH XVH D
IORDWLQJSRLQW DV WKH GHVWLQDWLRQ RWKHUZLVH WKH GHVWLQDWLRQ YDOXH ZLOO
EH URXQGHG
<RX VKRXOG XVH %&' DQG $6&,, YDOXHV IRU GLVSOD\ SXUSRVHV ,I \RX
HQWHU %&' RU $6&,, YDOXHV WKH SURFHVVRU WUHDWV WKRVH YDOXHV DV
LQWHJHUV
7KH SDUDPHWHUV \RX HQWHU DUH SURJUDP FRQVWDQWV RU ORJLFDO DGGUHVVHV
RI WKH YDOXHV \RX ZDQW
If You are Using this Processor:
Classic PLC-5
Enhanced PLC-5
4-4
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
I:012
]
]
10
ADD
Add the lower words of value1 and value2.
BITWISE AND
Capture the carry bit.
10
Source A
Source B
Dest
ADD
Add the high word of value1 to the carry bit.
10
S:0
1
N7:4
ADD
I:012
]
Source A
Source B
Dest
I:012
ADD
ADD
]
10
N7:1
N7:3
N7:5
ADD
AND
I:012
]
Source A
Source B
Dest
Source A
Source B
Dest
N7:0
N7:4
N7:4
N7:2
N7:4
N7:4
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-5
Compute (CPT)
Description:
CPT
COMPUTE
Destination
Expression
4-6
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Table 4.C
Valid Operations for Use in a CPT Expression
Type
Operator
Description
Example Operation
Copy
none
copy from A to B
Clear
none
Arithmetic
add
2+3
2+3+7
12 5
(12 5) 7
5*2
6 * (5 * 2)
24 | 6
(24 | 6) *2
| (vertical bar)
Trigonometric
Bitwise
Conversion
subtract
multiply
divide
negate
N7:0
SQR
square root
SQR N7:0
**
exponential *
(x to the power of y)
10**3
LN
natural log *
LN F8:20
LOG
LOG F8:3
ACS
arc cosine*
ACS F8:18
ASN
arc sine*
ASN F8:20
ATN
arc tangent *
ATN F8:22
COS
cosine*
COS F8:14
SIN
sine*
SIN F8:12
TAN
tangent*
TAN F8:16
AND
bitwise AND
OR
bitwise OR
D10:4 OR D10:5
XOR
bitwise exclusive OR
NOT
bitwise complement
NOT D9:3
FRD
FRD N7:0
TOD
TOD N7:0
DEG
convert radians
to degrees*
DEG F8:8
RAD
convert degrees
to radians*
RAD F8:10
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-7
This Operation:
Uses this
Number of
Characters:
math binary
+, , *, |
OR, **
AND, XOR
(negate)
LN *
=, <, >
math unary
comparative
4-8
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Operation
Description
**
exponential (XY)
Enhanced PLC-5 processors only
negate
NOT
bitwise complement
multiply
divide
add
subtract
AND
bitwise AND
XOR
bitwise exclusive OR
OR
bitwise OR
Expression Examples
6LQJOH 9DOXH 7KH H[SUHVVLRQ 645 1 ZLWK GHVWLQDWLRQ 1
WHOOV WKH SURFHVVRU WR WDNH WKH VTXDUH URRW RI WKH YDOXH VWRUHG DW 1
DQG VWRUH WKH UHVXOW DW 1
0XOWLSOH 9DOXHV :LWK (QKDQFHG 3/& SURFHVVRUV \RX FDQ DOVR XVH
IXQFWLRQV WR RSHUDWH RQ RQH RU PRUH YDOXHV LQ WKH H[SUHVVLRQ
FRPSOH[ H[SUHVVLRQV IRU FRPSXWH DQG FRPSDUH RSHUDWLRQV
&RPSOH[ H[SUHVVLRQV FDQ EH XS WR FKDUDFWHUV ORQJ VSDFHV DQG
SDUHQWKHVHV DUH FRQVLGHUHG FKDUDFWHUV )RU H[DPSOH \RX FRXOG HQWHU
DQ H[SUHVVLRQ VXFK DV
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-9
Example:
CPT
I:012
]
10
COMPUTE
Destination
N7:20
Expression
(N7:1 * 5) | (N7:2 | 7)
If the input word 12, bit 10 is set, multiply the value of N7:1 by 5. Divide this result by the quotient of N7:2 divided by 7.
If N7:1=5 and N7:2=9, the result is 25. (The result is rounded to the nearest whole number because the constants 5 and 7
were specified as whole numbers.)
Example:
I:012
CPT
COMPUTE
10
Destination
N7:20
Expression
(N7:1 * 5.0) | (N7:2 | 7.0)
If the input word 12, bit 10 is set, multiply the value of N7:1 by 5. Divide this result by the quotient of N7:2 divided by 7. If N7:1=5 and
N7:2=9, the result is 19. (The result is rounded differently because the constants 5.0 and 7.0 were specified to 1 decimal place.
PDQLSXODWH QXPEHUV
4-10
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Title
Description
RAD *
radians
DEG *
degrees
TOD
to BCD
FRD
from BCD
SQR
square root
LOG *
LN *
SIN *
COS *
TAN *
ASN *
ACS *
ATN *
<RX FDQ XVH WKH DERYH &37 DULWKPHWLF IXQFWLRQV ZLWKLQ H[SUHVVLRQV
RU DV VWDQGDORQH LQVWUXFWLRQV VHH WKH LQGLYLGXDO LQVWUXFWLRQV
GHVFULEHG LQ WKLV FKDSWHU
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-11
Description:
ACS
ARCCOSINE
Source
Destination
Table 4.G
Updating Arithmetic Status Flags for an ACS Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
always resets
Example:
I:012
]
]
10
ACS
ARCCOSINE
Source
Destination
F8:19
0.7853982
F8:20
0.6674572
If input word 12, bit 10 is set, take the arc cosine of the value in F8:19 and store the result in F8:20.
4-12
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Addition (ADD)
8VH WKH $'' LQVWUXFWLRQ WR DGG RQH YDOXH 6RXUFH $ WR DQRWKHU
YDOXH 6RXUFH % DQG SODFH WKH UHVXOW LQ WKH GHVWLQDWLRQ 6RXUFH $ DQG
6RXUFH % FDQ HLWKHU EH YDOXHV RU DGGUHVVHV WKDW FRQWDLQ YDOXHV 6HH
7DEOH + IRU VWDWXV IODJV IRU WKH $'' LQVWUXFWLRQ
Description:
ADD
ADD
Source A
Source B
Destination
Table 4.H
Updating Arithmetic Status Flags for an ADD Instruction
With this Bit:
The Processor:
Carry (C)
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
ADD
ADD
]
10
Source A
N7:3
Source B
N7:4
Destination
N7:20
If input word 12, bit 10 is set, add the value in N7:3 to the value in N7:4 and store the result in N7:20.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-13
Description:
ASN
ARCSINE
Source
Destination
Table 4.I
Updating Arithmetic Status Flags for an ASN Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
always resets
Example:
I:012
ASN
ARCSINE
Source
]
10
F8:17
0.7853982
Dest
F8:18
0.9033391
If input word 12, bit 10 is set, take the arc sine of the value in F8:17 and store the result in F8:18.
4-14
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Description:
ATN
ARCTANGENT
Source
Destination
Table 4.J
Updating Arithmetic Status Flags for an ATN Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
ATN
ARCTANGENT
Source
Destination
F8:21
0.7853982
F8:22
0.6657737
If input word 12, bit 10 is set, take the arc tangent of the value in F8:21 and store the result in F8:22.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-15
EN
DN
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
,I DQ RYHUIORZ RFFXUV WKH SURFHVVRU VWRSV WKH FDOFXODWLRQ VHWV WKH (5
ELW DQG WKH 'HVWLQDWLRQ UHPDLQV XQFKDQJHG 7KH SRVLWLRQ LGHQWLILHV
WKH HOHPHQW WKDW FDXVHG WKH RYHUIORZ :KHQ \RX FOHDU WKH (5 ELW WKH
SRVLWLRQ UHVHWV WR DQG WKH DYHUDJH LV UHFDOFXODWHG
,PSRUWDQW 8VH WKH 5(6 LQVWUXFWLRQ WR FOHDU WKH VWDWXV IODJV
Entering Parameters
7R SURJUDP WKH $9( LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU
ZLWK WKH IROORZLQJ
)LOH LV WKH DGGUHVV WKDW FRQWDLQV WKH ILUVW YDOXH WR EH DGGHG 7KLV
DGGUHVV FDQ EH IORDWLQJ SRLQW RU LQWHJHU
4-16
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Is Set:
Example:
AVE
I:012
]
]
10
File
Dest
R6:0
EN
AVERAGE FILE
#N7:1
N7:0
Control
R6:0
Length
Position
4
0
DN
O:010
]
EN
R6:0
O:010
]
DN
7
R6:0
RES
If input word 12, bit 10 is set, the AVE instruction is enabled. The values in N7:1, N7:2, N7:3, and N7:4 are
added together and divided by 4. The result is stored in N7:0. When the calculation is complete, output
word 10, bit 7 is set. Then the RES instruction resets the status bits of the control file R6:0.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-17
Clear (CLR)
Description:
CLR
CLEAR
Destination
8VH WKH &/5 LQVWUXFWLRQ WR VHW DOO WKH ELWV RI D ZRUG WR ]HUR 7KH
GHVWLQDWLRQ PXVW EH D ZRUG DGGUHVV 6HH 7DEOH / IRU VWDWXV IODJV IRU
&/5 LQVWUXFWLRQ
Table 4.L
Updating Arithmetic Status Flags for a CLR Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
always sets
Sign (S)
always resets
Example:
I:012
]
]
10
CLR
CLEAR
Destination
N7:3
If input word 12, bit 10 is set, clear all of the bits in N7:3 to zero.
4-18
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Cosine (COS)
(Enhanced PLC-5 Processors Only)
8VH WKH &26 LQVWUXFWLRQ WR WDNH WKH FRVLQH RI D QXPEHU 6RXUFH LQ
UDGLDQV DQG VWRUH WKH UHVXOW LQ WKH 'HVWLQDWLRQ 6HH 7DEOH 0 IRU
VWDWXV IODJV IRU &26 LQVWUXFWLRQ
Description:
COS
COSINE
7KH 6RXUFH PXVW EH JUHDWHU WKDQ RU HTXDO WR DQG OHVV WKDQ
RU HTXDO WR ,I LW LV QRW LQ WKLV UDQJH WKH SURFHVVRU UHWXUQV D
!INF! UHVXOW LQ WKH 'HVWLQDWLRQ 7KH UHVXOWLQJ YDOXH LQ WKH
'HVWLQDWLRQ LV DOZD\V JUHDWHU WKDQ RU HTXDO WR DQG OHVV WKDQ RU
HTXDO WR
Source
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
COS
COSINE
Source
F8:13
0.7853982
Destination
F8:14
0.7071068
If input word 12, bit 10 is set, take the cosine of the value in F8:13 and store the result in F8:14.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-19
Divide (DIV)
8VH WKH ',9 LQVWUXFWLRQ WR GLYLGH RQH YDOXH 6RXUFH $ E\ DQRWKHU
YDOXH 6RXUFH % DQG SODFH WKH UHVXOW LQ WKH 'HVWLQDWLRQ 6RXUFH $ DQG
6RXUFH % FDQ HLWKHU EH YDOXHV RU DGGUHVVHV WKDW FRQWDLQ YDOXHV 6HH
7DEOH 1 IRU VWDWXV IODJV IRU ',9 LQVWUXFWLRQ
Description:
DIV
DIVIDE
Source A
Source B
Destination
Table 4.N
Updating Arithmetic Status Flags for a DIV Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
DIV
DIVIDE
Source A
N7:3
Source B
N7:4
Destination
N7:20
If input word 12, bit 10 is set, divide the value in N7:3 by the value in N7:4 and store the result in N7:20.
4-20
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Description:
LN
NATURAL LOG
Source
Destination
Table 4.O
Updating Arithmetic Status Flags for an LN Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
LN
NATURAL LOG
Source
N7:0
5
Destination
F8:20
1.609438
If input word 12, bit 10 is set, take the natural log of the value in N7:0 and store the result in F8:20.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-21
Description:
LOG
LOG BASE 10
Source
Destination
Table 4.P
Updating Arithmetic Status Flags for an LOG Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
LOG
LOG BASE 10
Source
N7:2
5
Destination
F8:3
0.6989700
If input word 12, bit 10 is set, take the log base 10 of the value in N7:2 and store the result in F8:3.
4-22
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Multiply (MUL)
Description:
MUL
MULTIPLY
Source A
Source B
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
MUL
MULTIPLY
Source A
N7:3
Source B
N7:4
Destination
N7:20
If input word 12, bit 10 is set, multiply the value in N7:3 by the value in N7:4 and store the result in N7:20.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-23
Negate (NEG)
8VH WKH 1(* LQVWUXFWLRQ WR FKDQJH WKH VLJQ RI D YDOXH ,I \RX QHJDWH D
QHJDWLYH YDOXH WKH UHVXOW LV SRVLWLYH LI \RX QHJDWH D SRVLWLYH YDOXH
WKH UHVXOW LV QHJDWLYH 6HH 7DEOH 5 IRU VWDWXV IODJV IRU 1(*
LQVWUXFWLRQ
Description:
NEG
NEGATE
Source
Destination
Table 4.R
Updating Arithmetic Status Flags for a NEG Instruction
With this Bit:
The Processor:
Carry (C)
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
NEG
NEGATE
Source
Destination
N7:3
N7:20
If input word 12, bit 10 is set, take the opposite sign of the value in N7:3 and store the result in N7:20.
4-24
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Sine (SIN)
(Enhanced PLC-5 Processors Only)
8VH WKH 6,1 LQVWUXFWLRQ WR WDNH WKH VLQH RI D QXPEHU 6RXUFH LQ
UDGLDQV DQG VWRUH WKH UHVXOW LQ WKH 'HVWLQDWLRQ 6HH 7DEOH 6 IRU
VWDWXV IODJV IRU 6,1 LQVWUXFWLRQ
Description:
SIN
SINE
7KH 6RXUFH PXVW EH JUHDWHU WKDQ RU HTXDO WR DQG OHVV WKDQ
RU HTXDO WR ,I LW LV QRW LQ WKLV UDQJH WKH SURFHVVRU UHWXUQV D
!INF! UHVXOW LQ WKH 'HVWLQDWLRQ 7KH UHVXOWLQJ YDOXH LQ WKH
'HVWLQDWLRQ LV DOZD\V JUHDWHU WKDQ RU HTXDO WR DQG OHVV WKDQ RU
HTXDO WR
Source
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
SIN
SINE
Source
Destination
If input word 12, bit 10 is set, take the sine of F8:11 and store the result in F8:12.
F8:11
0.7853982
F8:12
0.7071068
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-25
Description:
SQR
SQUARE ROOT
Source
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
always resets
Example:
I:012
]
]
10
SQR
SQUARE ROOT
Source
Destination
N7:3
N7:20
If input word 12, bit 10 is set, take the square root of the value in N7:3 and store the result in N7:20.
4-26
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
EN
DN
7KH 657 LQVWUXFWLRQ VRUWV D VHW RI YDOXHV LQWR DVFHQGLQJ RUGHU 7KLV
LQVWUXFWLRQ LV H[HFXWHG RQ D IDOVHWRWUXH WUDQVLWLRQ
,PSRUWDQW 0DNH VXUH WKH ILOH OHQJWK YDOXH \RX VSHFLI\ LQ WKH
LQVWUXFWLRQ GRHV QRW FDXVH WKH LQGH[HG DGGUHVV WR H[FHHG
WKH ILOH ERXQGV 7KH SURFHVVRU GRHV QRW FKHFN WKLV
XQOHVV \RX H[FHHG WKH GDWD ILOH DUHD RI PHPRU\
,I WKH LQGH[HG DGGUHVV H[FHHGV WKH GDWD ILOH DUHD WKH
SURFHVVRU LQLWLDWHV D UXQWLPH HUURU DQG VHWV D PDMRU
IDXOW 7KH SURFHVVRU GRHV QRW FKHFN WR VHH ZKHWKHU WKH
LQGH[HG DGGUHVV FURVVHV ILOH W\SHV VXFK DV 1 WR )
Entering Parameters
7R SURJUDP WKH 657 LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Parameter:
Definition:
file
the address that contains the first value to be sorted. This address can be
floating point or integer.
control
the address of the control structure in the control area (R) of processor
memory. The processor stores information such as the length, position
and status, and uses this information to execute the instruction.
length
position
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-27
Is Set:
after the instruction finishes operating. After the rung goes false,
the processor resets the .DN bit on the next false-to-true rung
transition.
when the length value is less than or equal to zero or when the
position value is less than zero.
Example:
I:012
]
]
10
SRT
SORT FILE
File
Control
Length
Position
EN
#N7:1
R6:0
4
0
DN
R6:0
]
EN
O:010
R6:0
]
DN
O:010
]
5
]
7
If input word 12, bit 10 is set, the SRT instruction is enabled. The elements N7:1, N7:2, N7:3, and N7:4 are sorted into ascending
order. When the sort operation is complete, output word 10, bit 7 is set.
4-28
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
EN
DN
:KHUH
AVE(xi))
SUM((xi
(N 1)
,PSRUWDQW 0DNH VXUH WKH ILOH OHQJWK YDOXH \RX VSHFLI\ LQ WKH
LQVWUXFWLRQ GRHV QRW FDXVH WKH LQGH[HG DGGUHVV WR H[FHHG
WKH ILOH ERXQGV 7KH SURFHVVRU GRHV QRW FKHFN WKLV
XQOHVV \RX XVH DQ LQGH[HG LQGLUHFW DGGUHVV RU H[FHHG WKH
GDWD ILOH DUHD RI PHPRU\ ,I WKH LQGH[HG DGGUHVV H[FHHGV
WKH GDWD ILOH DUHD WKH SURFHVVRU LQLWLDWHV D UXQWLPH HUURU
DQG VHWV D PDMRU IDXOW 7KH SURFHVVRU GRHV QRW FKHFN WR
VHH ZKHWKHU WKH LQGH[HG DGGUHVV FURVVHV ILOH W\SHV VXFK
DV 1 WR )
Table 4.U
Updating Arithmetic Status Flags for an STD Instruction
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
always resets
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-29
r"'
r"'
,I DQ RYHUIORZ RFFXUV WKH SURFHVVRU VWRSV WKH FDOFXODWLRQ VHWV WKH (5
ELW DQG OHDYHV WKH GHVWLQDWLRQ XQFKDQJHG 7KH SRVLWLRQ LGHQWLILHV WKH
HOHPHQW WKDW FDXVHG WKH RYHUIORZ :KHQ \RX FOHDU WKH (5 ELW WKH
SRVLWLRQ UHVHWV WR DQG WKH VWDQGDUG GHYLDWLRQ LV UHFDOFXODWHG
,PSRUWDQW 8VH WKH 5(6 LQVWUXFWLRQ WR FOHDU WKH VWDWXV ELWV
Entering Parameters
7R SURJUDP WKH 67' LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Parameter:
Defines:
file
the address that contains the first value to be calculated. This address
can be floating point or integer.
destination
the address where the result of the instruction is stored. This address
can be floating point or integer.
control
the address of the control structure in the control area (R) of processor
memory. The processor stores information such as the length, position
and status, and uses this information to execute the instruction.
length
position
Is Set:
4-30
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Example:
I:012
]
]
10
STD
STANDARD DEVIATION
File
Destination
Control
Length
Position
EN
#N7:1
N7:0
R6:0
4
DN
R6:0
]
EN
O:010
R6:0
]
DN
O:010
]
5
]
7
R6:0
RES
If input word 12, bit 10 is set, the STD instruction is enabled. The elements N7:1, N7:2, N7:3, and N7:4 are used to calculate the
standard deviation. When the calculation is complete, output word 10, bit 7 is set. Then the RES instruction resets the status bits of
the control file R6:0.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-31
Subtract (SUB)
8VH WKH 68% LQVWUXFWLRQ WR VXEWUDFW RQH YDOXH 6RXUFH % IURP
DQRWKHU YDOXH 6RXUFH $ DQG SODFH WKH UHVXOW LQ WKH GHVWLQDWLRQ
6RXUFH $ DQG 6RXUFH % FDQ EH YDOXHV RU DGGUHVVHV WKDW FRQWDLQ
YDOXHV 6HH 7DEOH 9 IRU VWDWXV IODJV IRU 68% LQVWUXFWLRQ
Description:
SUB
SUBTRACT
Source A
Source B
Destination
Table 4.V
Updating Arithmetic Status Flags for a SUB Instruction
With this Bit:
The Processor:
Carry (C)
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
SUB
SUBTRACT
Source A
N7:3
Source B
N7:4
Destination
N7:20
If input word 12, bit 10 is set, subtract the value in N7:4 from the value in N7:3 and store the result in N7:20.
4-32
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
Tangent (TAN)
(Enhanced PLC-5 Processors Only)
8VH WKH 7$1 LQVWUXFWLRQ WR WDNH WKH WDQJHQW RI D QXPEHU 6RXUFH LQ
UDGLDQV DQG VWRUH WKH UHVXOW LQ WKH 'HVWLQDWLRQ 6HH 7DEOH : IRU
VWDWXV IODJV IRU 7$1 LQVWUXFWLRQ
Description:
TAN
TANGENT
Source
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
TAN
TANGENT
Source
F8:15
0.7853982
Destination
F8:16
1.000000
If input word 12, bit 10 is set, take the tangent of the value in F8:15 and store the result in F8:16.
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
4-33
< ORJ ;
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
XPY
X TO POWER OF Y
Source A
Source B
Destination
N7:4
5
N7:5
2
N7:6
25
If input word 12, bit 10 is set, take the value in N7:4, raise it to the power of the value in N7:5, and stores
the result in N7:6.
4-34
Compute Instructions CPT, ACS, ADD, ASN, ATN, AVE, CLR, COS, DIV, LN, LOG, MUL, NEG, SIN, SRT, SQR, STD, SUB, TAN, XPY
1RWHV
Chapter
Found on Page:
AND
5-2
NOT
5-3
Perform an OR operation
OR
5-4
XOR
5-5
Description:
S:0/0
Carry (C)
S:0/1
Overflow (V)
S:0/2
Zero (Z)
S:0/3
Sign (S)
5-2
Description:
AND
Table 5.C
Truth Table for an AND Operation
BITWISE AND
Source A
Source B
Destination
Source A
Source B
Result
Table 5.D
Updating Arithmetic Status Flags for an AND Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
Sign (S)
Example:
I:012
AND
AND
[
10
Source A
Source B
Destination
Source A
N9:3
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Source B
N10:4
0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Destination
N12:3
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
N9:3
N10:4
N12:3
5-3
Description:
NOT
NOT
Source
Destination
Table 5.E
Truth Table for a NOT Operation
Source
Result
Table 5.F
Updating Arithmetic Status Flags for a NOT Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
Sign (S)
Example:
NOT
I:012
NOT
[
10
Source
Destination
N9:3
N10:4
Source
N9:3
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Destination
N10:4
1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1
5-4
OR Operation (OR)
8VH WKH 25 LQVWUXFWLRQ WR SHUIRUP DQ 25 RSHUDWLRQ XVLQJ WKH ELWV LQ
WKH WZR VRXUFHV FRQVWDQWV RU DGGUHVVHV
Description:
OR
Table 5.G
Truth Table for an OR Operation
BITWISE INCLUSIVE OR
Source A
Source B
Destination
Source A
Source B
Result
Table 5.H
Updating Arithmetic Status Flags for an OR Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
Sign (S)
Example:
OR
I:012
INCLUSIVE OR
10
Source A
Source B
Destination
Source A
N9:3
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Source B
N10:4
0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Destination
0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
N12:3
N9:3
N10:4
N12:3
5-5
Description:
XOR
Table 5.I
Truth Table for an XOR Operation
BITWISE EXCLUSIVE OR
Source A
Source B
Destination
Source A
Source B
Result
Table 5.J
Updating Arithmetic Status Bits for an XOR Instruction
With this Bit:
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
Sign (S)
Example:
XOR
I:012
EXCLUSIVE OR
[
10
Source A
Source B
N9:3
N10:4
Destination
N12:3
Source A
N9:3
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
Source B
N10:4
0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1
Destination
N12:3
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
5-6
1RWHV
Chapter
Found on Page:
TOD
6-2
FRD
6-2
DEG*
6-3
RAD*
6-4
Description:
S:0/0
Carry (C)
S:0/1
Overflow (V)
S:0/2
Zero (Z)
S:0/3
Sign (S)
6-2
Description:
TOD
TO BCD
Source
Table 6.C
Updating Arithmetic Status Flags for a TOD Instruction
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
always resets
Example:
TOD
I:012
]
TO BCD
10
Source
N7:3
Destination
D9:3
If input word 12, bit 10 is set, convert the value in N7:3 to a BCD value and store the result in D9:3.
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
Sign (S)
always resets
6-3
Example:
FRD
I:012
]
FROM BCD
10
Source
D9:3
Destination
N7:3
If input word 12, bit 10 is set, convert the value in D9:3 to an integer value and store the result in N7:3.
Degree (DEG)
(Enhanced PLC-5 Processors Only)
8VH WKH '(* LQVWUXFWLRQ WR FRQYHUW UDGLDQV 6RXUFH WR GHJUHHV DQG
VWRUH WKH UHVXOW LQ WKH 'HVWLQDWLRQ 6RXUFH WLPHV
Description:
DEG
Table 6.E
Updating Arithmetic Status Flags for an DEG Instruction
RADIANS TO DEGREE
Source
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
DEG
RADIANS TO DEGREE
Source
F8:7
0.7853982
Destination
F8:8
45
If input word 12, bit 10 is set, convert the value in F8:7 to degrees and store the result on F8:8.
6-4
Radian (RAD)
(Enhanced PLC-5 Processors Only)
8VH WKH 5$' LQVWUXFWLRQ WR FRQYHUW GHJUHHV 6RXUFH WR UDGLDQV DQG
VWRUH WKH UHVXOW LQ WKH 'HVWLQDWLRQ 6RXUFH WLPHV
Description:
RAD
DEGREES TO RADIANS
Table 6.F
Updating Arithmetic Status Flags for an RAD Instruction
Source
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
Example:
I:012
]
]
10
RAD
DEGREES TO RADIANS
Source
N7:9
45
Destination
F8:10
0.7853982
If input word 12, bit 10 is set, convert the value in N7:9 to radians and store the result on F8:10.
Chapter
7KH ELW PRGLI\ DQG PRYH LQVWUXFWLRQV OHW \RX PRGLI\ DQG PRYH ELWV
7DEOH $ OLVWV WKH DYDLODEOH PRYH LQVWUXFWLRQV
Table 7.A
Available Bit Modify and Move Instructions
If You Want to:
Found on Page:
BTD
7-2
MOV
7-3
MVM
7-4
7-2
Entering Parameters
7R SURJUDP WKH %7' LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Parameter:
Definition:
Source
Source bit
the number of the bit (lowest bit number) in the source word from
which to start the move.
Destination
Destination bit
the number of the bit (lowest bit number) in the destination word
where the processor starts copying the bits from the source word.
Length
Example:
Moving Bits Within a Word
BTD
Destination Bit
N70:22/10
N70:22
3
N70:22
10
6
15
1 0 1 1 0 1
Source Bit
N70:22/3
08 07
1 0 1 1 0 1
00
N70:22
13384
7-3
Example:
Moving Bits Between Words
Source Bit
N7:020/3
BTD
BIT FIELD DISTRIB
Source
Source bit
Destination
Destination bit
Length
15
08 07
N7:20
3
N7:22
5
10
00
N7:20
0 1 1 1 0 1 1 1 0 1
Destination Bit
N7:022/5
15
08 07
00
N7:22
0 1 1 1 0 1 1 1 0 1
13384
,PSRUWDQW %LWV DUH ORVW LI WKH\ H[WHQG EH\RQG WKH HQG RI WKH
GHVWLQDWLRQ ZRUG WKH ELWV DUH QRW ZUDSSHG WR WKH QH[W
KLJKHU ZRUG
Move (MOV)
Description:
MOV
MOVE
Source
Destination
Table 7.B
Updating Arithmetic Status Flags for a MOV Instruction
Example:
MOV
The Processor:
Carry (C)
always resets
Overflow (V)
Zero (Z)
Sign (S)
7R SURJUDP WKLV LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK WKH
IROORZLQJ
MOVE
Source
Destination
N7:0
N7:2
Parameter:
Definition:
source
destination
7-4
Source
Mask
Destination
The Processor:
Carry (C)
always resets
Overflow (V)
always resets
Zero (Z)
Sign (S)
Entering Parameters
7R SURJUDP WKLV LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Example:
Parameter:
Definition:
Source
Mask
Destination
the data address to which the instruction writes the result of the
operation. The instruction writes over any data stored at the destination.
7-5
Destination
N7:2
Before Move
MVM
MASKED MOVE
Source
Mask
Destination
N7:0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1111000011110000
N7:2
Mask
F0F0
Source
N7:0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Destination
N7:2
After Move
0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1
13360
7-6
1RWHV
Chapter
Entering Parameters
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Destination
Expression
EN
DN
ER
Parameter:
Definition:
Control
the address of the control structure in a control type (R) file. The
processor uses this information to run the instruction. See Using the
Control Structure on page 8-2.
Length
the number of words in the data block on which the file instruction
operates. Enter any decimal number 1-1000.
Position
the current word within the data block that the processor is accessing.
You generally enter a zero to start at the beginning of a block.
Mode
the number of file words operated on each time the rung is scanned in
the program. The mode lets you distribute operation on the complete
block of words. Specify one of the following:
for All mode, type an A
for Numerical mode, type a decimal number (1-1000)
for Incremental mode, type an I
For more information about the different modes, see Choosing Modes of
Block Operation on page 8-5.
Destination
the address where the processor stores the result of the operation. The
instruction converts to the data type specified by the destination address.
Expression
8-2
7KH FRQWURO VWUXFWXUH ILOH W\SH 5 FRQWUROV WKH RSHUDWLRQ RI WKH ILOH
LQVWUXFWLRQ 6LPLODU WR D FRXQWHU LW FRQWUROV WKH ILOH E\ OHQJWK SRVLWLRQ
DQG VWDWXV DQG FRQWURO ELWV )LJXUH <RX HQWHU WKH FRQWURO
VWUXFWXUH DGGUHVV IRU H[DPSOH 5 LQ WKH &RQWURO ILHOG ZKHQ \RX
SURJUDP D )$/ RU )6& LQVWUXFWLRQ
Figure 8.1
Example Control File R6:0
Memory
Status
Length
R6:0
Position
Status
Length
R6:1
Position
Status
Length
R6:2
Position
13370
8-3
EN
R6:5
4
0
ALL
#N28:0
N27:3
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Dest
Expression
ER
EN
R6:5
4
0
ALL
N28:0
#N27:3
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Dest
Expression
DN
DN
ER
EN
R6:5
4
0
ALL
#N28:0
#N27:3
DN
ER
8-4
Word to Block
Block to Block
Block to Word
Operating on Data
E
Block
= Result
Word
E
Word
Word
Word
Block
Block
= Result
Block
= Result
D
Block
Block
= Result
Word
= Result
D
Word
= Result
16617a
Block
Block
= Result
8-5
7KH EORFN PRGH WHOOV WKH SURFHVVRU KRZ WR GLVWULEXWH WKH EORFN
RSHUDWLRQ RYHU RQH RU PRUH SURJUDP VFDQV 6HOHFW RQH RI WKH
IROORZLQJ PRGHV
All Mode
,Q WKH $OO PRGH WKH HQWLUH ILOH LV RSHUDWHG RQ EHIRUH FRQWLQXLQJ RQ WR
WKH QH[W UXQJ RI WKH SURJUDP 7\SH DQ $ IRU WKH PRGH SDUDPHWHU
ZKHQ \RX HQWHU WKH LQVWUXFWLRQ
Word
Data File
512
One Scan
14 Word File
525
16639
2SHUDWLRQ EHJLQV ZKHQ WKH UXQJ JRHV IURP QRW WUXH WR WUXH 7KH
SRVLWLRQ 326 YDOXH LQ WKH FRQWURO VWUXFWXUH SRLQWV WR WKH ZRUG LQ WKH
GDWD EORFN WKDW WKH LQVWUXFWLRQ LV FXUUHQWO\ XVLQJ 2SHUDWLRQ VWRSV
ZKHQ WKH IXQFWLRQ FRPSOHWHV RU ZKHQ WKH SURFHVVRU GHWHFWV DQ HUURU
7KH IROORZLQJ WLPLQJ GLDJUDP VKRZV WKH UHODWLRQVKLS EHWZHHQ VWDWXV
ELWV DQG LQVWUXFWLRQ RSHUDWLRQ :KHQ WKH LQVWUXFWLRQ H[HFXWLRQ LV
FRPSOHWH WKH GRQH ELW LV WXUQHG RQ 7KH GRQH DQG HQDEOH ELWV DUH QRW
WXUQHG RII DQG WKH SRVLWLRQ YDOXH LV QRW ]HURHG XQWLO WKH UXQJ
FRQGLWLRQV DUH QR ORQJHU WUXH 2QO\ WKHQ FDQ DQRWKHU RSHUDWLRQ EH
WULJJHUHG E\ D QRWWUXHWRWUXH WUDQVLWLRQ RI WKH UXQJ FRQGLWLRQV
One
program
scan
Condition of rung that
controls file/block instruction
Enable (bit 15)
Done (bit 13)
16640
8-6
Numerical Mode
1XPHULFDO PRGH GLVWULEXWHV WKH ILOH RSHUDWLRQ RYHU D QXPEHU RI
SURJUDP VFDQV 7R VHOHFW WKH QXPHULFDO PRGH HQWHU WKH QXPEHU RI
ZRUGV SHU VFDQ IRU WKH PRGH SDUDPHWHU ZKHQ \RX HQWHU WKH
ILOH LQVWUXFWLRQ 7KH QXPEHU RI ZRUGV \RX HQWHU PXVW EH OHVV WKDQ RU
HTXDO WR WKH ILOH OHQJWK
([HFXWLRQ LV WULJJHUHG ZKHQ WKH UXQJ FRQGLWLRQV JR IURP QRW WUXH
WR WUXH 2QFH WULJJHUHG WKH LQVWUXFWLRQ LV H[HFXWHG FRQWLQXDOO\ HDFK
WLPH WKH UXQJ LV VFDQQHG LQ WKH SURJUDP IRU WKH QXPEHU RI VFDQV
QHFHVVDU\ WR FRPSOHWH RSHUDWLRQ RQ WKH HQWLUH ILOH 2QFH WULJJHUHG
UXQJ ORJLF FDQ FKDQJH UHSHDWHGO\ ZLWKRXW LQWHUUXSWLQJ H[HFXWLRQ RI
WKH LQVWUXFWLRQ
(DFK WLPH WKH UXQJ LV VFDQQHG WKH LQVWUXFWLRQ RSHUDWHV RQ WKH QXPEHU
RI ZRUGV HTXDO WR WKH UDWH \RX HQWHUHG IRU WKH PRGH YDOXH XQWLO LW KDV
RSHUDWHG RQ WKH QXPEHU RI ZRUGV \RX VSHFLILHG E\ WKH OHQJWK YDOXH ,Q
WKH ODVW VFDQ RI WKH UXQJ WKH SURFHVVRU PD\ RSHUDWH RQ OHVV WKDQ WKH
QXPEHU RI ZRUGV \RX HQWHUHG
File
Word
Scan #1
512
5 words
Scan #1
516
517
Scan #2
521
522
Scan #3
5 words
14-Word Block
Scan #2
Scan #3
Remaining
4 words
525
16641
Multiple program
scans
Multiple program
scans
Operation complete
The processor
turns off done
bit and zeroes
position value.
16642
8-7
:KHQ WKH LQVWUXFWLRQ H[HFXWLRQ LV FRPSOHWH WKH GRQH ELW LV WXUQHG RQ
,I WKH UXQJ LV WUXH DW FRPSOHWLRQ WKH HQDEOH ELW DQG GRQH ELW DUH QRW
WXUQHG RII XQWLO WKH UXQJ LV QR ORQJHU WUXH :KHQ WKH UXQJ LV QR ORQJHU
WUXH WKHVH ELWV DUH WXUQHG RII DQG WKH SRVLWLRQ YDOXH LV ]HURHG
,I WKH UXQJ LV QRW WUXH DW FRPSOHWLRQ WKH HQDEOH ELW LV WXUQHG RII
LPPHGLDWHO\ DQG RQH VFDQ DIWHU WKH HQDEOH ELW LV WXUQHG RII WKH GRQH
ELW LV WXUQHG RII DQG WKH SRVLWLRQ YDOXH LV ]HURHG
2QO\ DIWHU WKH HQDEOH DQG GRQH ELWV DUH WXUQHG RII FDQ DQRWKHU
RSHUDWLRQ EH WULJJHUHG E\ D QRWWUXHWRWUXH WUDQVLWLRQ RI WKH
UXQJ FRQGLWLRQV
Incremental Mode
,QFUHPHQWDO PRGH PDQLSXODWHV RQH ZRUG RI WKH ILOH HDFK WLPH WKH
UXQJ JRHV IURP QRW WUXH WR WUXH 7\SH DQ , IRU WKH PRGH SDUDPHWHU
ZKHQ \RX HQWHU WKH LQVWUXFWLRQ
1-Word Operation
1-Word Operation
1-Word Operation
File Word
File
Word
Word #0
512
Word #1
513
Word #2
514
Word #3
515
Word #12
524
525
Word File
1-Word Operation
16
Execution of instruction
The processor
turns off enable bit.
Operation complete
8-8
([HFXWLRQ RFFXUV RQO\ LQ D SURJUDP VFDQ LQ ZKLFK WKH UXQJ JRHV IURP
QRW WUXH WR WUXH (DFK WLPH WKLV GRHV RFFXU RQO\ RQH ZRUG RI WKH ILOH LV
RSHUDWHG RQ 7KH HQDEOH ELW LV RQ ZKHQ UXQJ ORJLF LV WUXH 7KH GRQH ELW
LV WXUQHG RQ ZKHQ WKH ODVW ZRUG LQ WKH ILOH KDV EHHQ RSHUDWHG RQ :KHQ
WKH ODVW ZRUG LQ WKH ILOH KDV EHHQ RSHUDWHG RQ DQG WKH UXQJ JRHV IURP
WUXH WR QRW WUXH WKH HQDEOH DQG GRQH ELWV DUH WXUQHG RII DQG WKH
SRVLWLRQ YDOXH LV ]HURHG ,I WKH UXQJ UHPDLQV WUXH IRU PRUH WKDQ RQH
SURJUDP VFDQ WKH ILOH LQVWUXFWLRQ LV QRW H[HFXWHG LQ VXEVHTXHQW VFDQV
DIWHU WKH WUDQVLWLRQ
,PSRUWDQW ,I \RX DUH RSHUDWLQJ RQ DQ HQWLUH ILOH DYRLG XVLQJ WKH
UHVXOWV RI D ILOHEORFN LQVWUXFWLRQ XVLQJ LQFUHPHQWDO
PRGH XQWLO WKH GRQH ELW LV RQ WKH GDWD ZLOO
EH LQFRPSOHWH
1XPHULFDO PRGH ZLWK DQ\ QXPEHU RI ZRUGV SHU VFDQ RQO\ RQH
QRWWUXHWRWUXH UXQJ WUDQVLWLRQ LV UHTXLUHG IRU FRQWLQXDO H[HFXWLRQ
RI WKH LQVWUXFWLRQ XQWLO RSHUDWLRQ LV FRPSOHWH RQ WKH HQWLUH ILOH
Chapter
7KH ILOH LQVWUXFWLRQV SHUIRUP RSHUDWLRQV RQ ILOH GDWD DQG FRPSDUH ILOH
GDWD 7DEOH $ OLVWV WKH DYDLODEOH ILOH LQVWUXFWLRQV
Table 9.A
Available File Instructions
Found on
Page:
FAL
9-2
FSC
9-14
COP
9-19
FLL
9-20
,I \RX KDYH QRW DOUHDG\ GRQH VR UHYLHZ WKH EDVLF FRQFHSWV RI ILOH
RSHUDWLRQ LQ WKH SUHYLRXV FKDSWHU )RU PRUH LQIRUPDWLRQ RQ XVLQJ
LQGH[HG DGGUHVVHV VHH \RXU VRIWZDUH XVHU PDQXDO
)RU PRUH LQIRUPDWLRQ RQ WKH RSHUDQGV DQG YDOLG GDWD W\SHVYDOXHV RI
HDFK RSHUDQG XVHG E\ WKH LQVWUXFWLRQV GLVFXVVHG LQ WKLV FKDSWHU VHH
$SSHQGL[ &
9-2
Description:
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Destination
Expression
EN
DN
ER
]HUR D ILOH
9-3
Table 9.B
FAL Operations
Type
Operator
Description
Example Operation
Copy
none
copy from A to B
Clear
none
Arithmetic
add
2+3
2+3+7
12 5
(12 5) 1
5*2
6 * (5 * 2)
24 | 6
(24 | 6) * 2
Bitwise
Conversion
subtract
multiply
divide
negate
N7:0
SQR
square root
SQR N7:0
**
exponential
(x to the power of y)
10**3
(Enhanced PLC-5 processors only)
AND
bitwise AND
OR
bitwise OR
D9:4 OR D9:5
XOR
bitwise exclusive OR
NOT
bitwise complement
NOT D9:4
FRD
FRD D14:0
TOD
TOD N7:0
9-4
Is Set:
9-5
EHWZHHQ ILOHV
7R FRS\ GDWD ZLWK WKH )$/ FRS\ RSHUDWLRQ HQWHU WKH VRXUFH DGGUHVV
RU SURJUDP FRQVWDQW LQ WKH H[SUHVVLRQ DQG WKH GHVWLQDWLRQ DGGUHVV LQ
WKH GHVWLQDWLRQ
EN
R6:5
4
0
ALL
#N28:0
#N27:3
Element 3
DN
4
ER
File #N27
File #N28
9732
9732
0 Element
1015
1015
2000
2000
19000
19000
5
6
2
3
13366
This Parameter:
Control (R6:5)
Length (4)
Position (0)
Mode (ALL)
Destination (#N28:0)
Expression (#N27:3)
:KHQ WKH UXQJ JRHV WUXH WKH SURFHVVRU UHDGV IRXU HOHPHQWV RI LQWHJHU
ILOH 1 ZRUG E\ ZRUG VWDUWLQJ DW HOHPHQW DQG ZULWHV WKH LPDJH WR
LQWHJHU ILOH 1 VWDUWLQJ DW HOHPHQW ,W ZULWHV RYHU DQ\ GDWD LQ WKH
GHVWLQDWLRQ ILOH
9-6
FAL
FILE ARITH/LOGICAL
EN
Control
Length
Position
Mode
Destination
R6:6
5
0
INC
N29:5
Expression
#N29:0
Word 29:5
2nd move
File # N29:0
Word 0
Word
DN
1
ER
2
5th move
4th move
4
3rd move
13372
This Parameter:
Control (R6:6)
Length (5)
Position (0)
Mode (incremental)
Destination (N29:5)
Expression (#N29:0)
9-7
Meaning:
Operator:
Meaning:
add
divide
subtract
negate
multiply
clear
bit
integer
32,768 to +32,767
timer
0 to +32,767
counter
32,768 to +32,767
control
0 to +32,767
floating point
1.1754944e38 to 3.4028237e+38
9-8
:KHQ WKH UXQJ JRHV WUXH WKH SURFHVVRU DGGV YDOXHV LQ ILOH 1
WR WKH FRUUHVSRQGLQJ YDOXHV LQ ILOH 1 XVLQJ WKH QXPHULFDO PRGH
RI ZRUGV SHU VFDQ 7KH RSHUDWLRQ LV SHUIRUPHG LQ VFDQV DQG WKH
LQVWUXFWLRQ VHTXHQWLDOO\ DGGV WKH YDOXHV LQ WKH H[SUHVVLRQ VWRULQJ WKH
UHVXOW LQ ILOH 1
Addition Example:
FAL
FILE ARITH/LOGICAL
R6:0
Control
100
Length
0
Position
10
Mode
Dest
#N13:0
Expression
#N11:0 + #N12:0
EN
DN
ER
File # N11:0
File # N13:0
10
338
32
182
11
147
179
99
99
45
572
617
1579
300
1879
620
42
662
800
19
819
1243
1000
2243
328
150
10
32
First Scan
Second Scan
next 10 words
Third Scan
next 10 words
Fourth Scan
next 10 words
//
99
//
last 10 elements
//
//
//
//
Tenth Scan
File # N12:0
99
99
13386
This Parameter:
Control (R6:0)
Length (100)
Position (0)
Mode (10)
Destination (#N13:0)
Expression
(#N11:0 + #N12:0)
9-9
Subtraction Example:
File #N14
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Dest
Expression
EN
R6:1
8
0
ALL
#N15:10
-256 =
File #N14
328
72
10
DN
150
-106
11
ER
10
-246
12
32
-224
13
-256
14
45
-211
15
1579
1323
16
620
364
17
One
Scan
Required
#N14:0 - 256
16655a
This Parameter:
Control (R6:1)
Length (8)
Position (0)
Mode (ALL)
Destination (#N15:10)
Expression
(#N14:0 256)
:KHQ WKH UXQJ JRHV WUXH WKH SURFHVVRU UHDGV HLJKW HOHPHQWV RI
LQWHJHU ILOH 1 ZRUG E\ ZRUG VWDUWLQJ DW HOHPHQW VXEWUDFWV D
SURJUDP FRQVWDQW IURP HDFK DQG ZULWHV WKH UHVXOW LQWR
GHVWLQDWLRQ ILOH 1 VWDUWLQJ DW HOHPHQW DOO LQ RQH VFDQ
9-10
Multiplication Example:
FAL
FILE ARITH/LOGICAL
EN
R6:2
16
0
INC
#F8:16
Control
Length
Position
Mode
Dest
Expression
DN
ER
#F8:0 * #N17:0
File #F8:0
File #N17:0
File #F8:16
0.01
314
3.14
16
0.1
315
31.5
17
Third Transition
1.0
316
316
18
Fourth Transition
10.0
317
3170
19
First Transition
Second Transition
20
21
22
23
24
25
//
//
//
//
//
//
15
15
31
15290
This Parameter:
Control (R6:2)
Length (16)
Position (0)
Mode (incremental)
Destination (#F8:16)
Expression
(#F8:0 * #N17:0)
:KHQ WKH UXQJ JRHV WUXH WKH SURFHVVRU PXOWLSOLHV YDOXHV LQ ILOH
) E\ WKH FRUUHVSRQGLQJ YDOXHV LQ ILOH 1 XVLQJ LQFUHPHQWDO
PRGH 2QH PXOWLSOLFDWLRQ LV SHUIRUPHG IRU HDFK IDOVH WR WUXH
WUDQVLWLRQ 7KH RSHUDWLRQ UHTXLUHV WUDQVLWLRQV VWRULQJ WKH UHVXOW LQ
ILOH )
9-11
Division Example:
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Destination
Expression
EN
R6:2
16
0
INC
#N13:0
DN
ER
#N11:0 | #N12:0
File N11:0
First Transition
60
File N12:0
Word
0
File N13:0
Word
0
12
Word
0
Second Transition
175
35
Third Transition
1128
141
45
Fourth Transition
15
//
//
//
//
//
//
15
15
17955
This Parameter:
Control (R6:2)
Length (16)
Position (0)
Mode (incremental)
Destination (#N13:0)
Expression
(#N11:0 | #N12:0)
:KHQ WKH UXQJ JRHV WUXH WKH SURFHVVRU VWDUWV WR GLYLGH YDOXHV
VWDUWLQJ DW 1 E\ WKH FRUUHVSRQGLQJ YDOXHV LQ ILOH 1 XVLQJ
LQFUHPHQWDO PRGH 2QH GLYLVLRQ LV SHUIRUPHG IRU HDFK WUDQVLWLRQ WR
WUXH 7KH RSHUDWLRQ UHTXLUHV WUDQVLWLRQV VWRULQJ WKH UHVXOW LQ D
ZRUG ILOH VWDUWLQJ DW 1
9-12
EN
DN
ER
Control (R6:4)
Length (64)
Position (0)
Mode (4)
Destination (#N23:4)
$IWHU UXQJ JRHV WUXH WKH VTXDUH URRW RI WKH ILUVW ZRUGV LQ WKH ILOH
EHJLQQLQJ DW 1 LV FDOFXODWHG DQG WKH UHVXOW LV ZULWWHQ LQ WKH
GHVWLQDWLRQ ILOH EHJLQQLQJ DW 1 (YHU\ WLPH WKH UXQJ LV VFDQQHG
WKHUHDIWHU WKH QH[W IRXU ZRUGV DUH FDOFXODWHG DQG WKH UHVXOW ZULWWHQ
WR WKH GHVWLQDWLRQ ILOH 7KH SURFHVVRU UHTXLUHV D WRWDO RI VFDQV
OHQJWK PRGH WR FRPSOHWH WKH LQVWUXFWLRQ
$1'
25
;25
127
9-13
Logical OR Example:
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Destination
Expression
#I:000 OR #B3:6
EN
R6:4
6
0
2
#B5:24
DN
ER
Word
File I:000
First Scan
Second Scan
or
File B3
Word
Word
File B5
0000000000000000
1010101010101010
1010101010101010
24
1111111111111111
1111111100000000
1111111111111111
25
1111000011110000
0000000000000000
1111000011110000
26
1010101010101010
1100110011001100
1110111011101110
27
Third Scan
10
11
28
29
16618a
This Parameter:
Control (R6:4)
Length (6)
To OR 6 words
Position (0)
Mode (2)
Destination (#B5:24)
Expression
(#I:000 OR #B3:6)
9-14
R6:2
12
0
ALL
#N14:0
EN
DN
ER
Description:
FSC
FILE SEARCH/COMPAR
Control
Length
Position
Mode
Expression
EN
DN
ER
VHW KLJK DQG ORZ SURFHVV DODUPV IRU PXOWLSOH DQDORJ LQSXWV
9-15
Is Set:
9-16
Only
1 Scan
Rung Condition
Enable Bit (.EN)
Done Bit (.DN)
Instruction Execution
Inhibit (.IN) and Found (.FD) Bit
Comparison Found
Ladder Program
Resets Inhibit (.IN) Bit
16656
)RU PRUH LQIRUPDWLRQ DERXW KRZ WKH )6& LQVWUXFWLRQ UHVSRQGV ZKHQ
LW ILQGV QR WUXH FRPSDULVRQV VHH WKH WLPLQJ GLDJUDPV LQ FKDSWHU
9-17
Example Expression:
Search Equal
#N50:0 = #N51:0
Data Conversion
7KH SURFHVVRU FRPSDUHV ILOHV RI GLIIHUHQW GDWD W\SHV E\ LQWHUQDOO\
FRQYHUWLQJ GDWD LQWR LWV ELQDU\ HTXLYDOHQW EHIRUH SHUIRUPLQJ WKH
FRPSDULVRQ 7KH SURFHVVRU WUHDWV WKH IROORZLQJ GDWD W\SHV DV LQWHJHU
WLPHU VWDWXV ELW FRXQWHU LQSXW $6&,, FRQWURO RXWSXW %&'
,PSRUWDQW :KHQ \RX FRPSDUH IORDWLQJ SRLQW DQG LQWHJHU YDOXHV LQ
WKH )6& LQVWUXFWLRQ OLPLW WKH FRPSDULVRQV WR OHVV WKDQ
RU HTXDO DQG JUHDWHU WKDQ RU HTXDO
,PSRUWDQW 8VH $6&,, DQG %&' IRU GLVSOD\ RQO\ DQG QRW DV YDOXHV
6LQFH WKH SURFHVVRU LQWHUSUHWV WKHP DV LQWHJHU WKH\ PD\
ORVH WKHLU PHDQLQJ LI \RX HQWHU WKHP DV YDOXHV
)RU WKH RUGHU LQ ZKLFK WKH LQVWUXFWLRQ SHUIRUPV ORJLFDO RSHUDWLRQV VHH
WKH VHFWLRQ 'HWHUPLQLQJ WKH 2UGHU RI 2SHUDWLRQ LQ FKDSWHU
9-18
EN
R6:0
90
0
10
DN
ER
Word
File B4
First scan
File B5
0 0 0 00 0 0 1 0 0 0 0 0 0 0 0 (1 0 0 )
0000000000000001(1)
0000000000000001(1)
0000000000000010(2)
0000000000000010(2)
0000000000000110(6)
0 0 00 0 0 0 0 0 0 0 0 0 1 1 0 (6 )
0 0 00 0 0 0 0 0 0 0 0 0 1 1 0 (6 )
0000000000000111(7)
10
10
Second scan
Ninth scan
Word
0000000100000000(100)
Next 10 words
Next 10 words
Last 10 words
Next 10 words
Next 10 words
89
Last 10 words
89
This Parameter:
Control (R6:0)
Length (90)
Position (0)
Mode (10)
Expression
(#B4:0 <> #B5:0)
16620a
9-19
Entering Parameters
7R SURJUDP WKH &23 LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Parameter:
Definition:
Source
the starting address of the source file. The source remains unchanged.
Destination
address of the destination file. The instruction writes over any data
already stored at the destination.
Length
9-20
Example:
COP
I:012
[
COPY FILE
10
Source
Destination
Length
#N7:0
#N12:0
5
Entering Parameters
7R SURJUDP WKH )// LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ
Parameter:
Definition:
Source
Destination
the starting address of the destination file. The instruction writes over
any data already stored at the destination.
Length
9-21
Example:
FLL
I:012
[
FILL FILE
10
Source
Destination
Length
N7:0
#N12:0
5
:RUGV DUH FRSLHG IURP WKH VSHFLILHG VRXUFH ILOH LQWR WKH VSHFLILHG
GHVWLQDWLRQ ILOH HYHU\ VFDQ WKDW WKH UXQJ LV WUXH 7KH\ DUH FRSLHG LQ
DVFHQGLQJ RUGHU ZLWK QR WUDQVIRUPDWLRQ RI GDWD XS WR WKH VSHFLILHG
QXPEHU RU XQWLO WKH ODVW ZRUG RI WKH GHVWLQDWLRQ ILOH LV UHDFKHG
ZKLFKHYHU RFFXUV ILUVW
$FFXUDWHO\ VSHFLI\ WKH VWDUWLQJ DGGUHVV DQG OHQJWK RI WKH GDWD EORFN
\RX DUH ILOOLQJ 7KH LQVWUXFWLRQ ZLOO QRW ZULWH RYHU D ILOH ERXQGDU\
VXFK DV EHWZHHQ ILOHV 1 DQG 1 DW WKH GHVWLQDWLRQ 7KH RYHUIORZ
ZRXOG EH ORVW
9-22
1RWHV
Chapter
10
7KH GLDJQRVWLF LQVWUXFWLRQV OHW \RX GHWHFW SUREOHPV ZLWK GDWD LQ \RXU
SURJUDPV 7DEOH $ OLVWV WKH DYDLODEOH GLDJQRVWLF LQVWUXFWLRQV
Table 10.A
Available Diagnostic Instructions
If You Want to:
Found on Page:
FBC
10-2
DDT
10-2
DTR
10-8
10-2
Table 10.B
Available Diagnostic Instructions
Description:
FBC
FILE BIT COMPARE
EN
Source
Reference
Result
Compare Control
Length
Position
Result control
Length
Position
DN
FD
IN
ER
FBC
Change-of-state diagnostics
DDT
%RWK WKH )%& DQG ''7 LQVWUXFWLRQV FRPSDUH ELWV LQ D ILOH RI UHDOWLPH
PDFKLQH RU SURFHVV YDOXHV LQSXW ILOH ZLWK ELWV LQ D UHIHUHQFH ILOH
GHWHFW GHYLDWLRQV DQG UHFRUG PLVPDWFKHG ELW QXPEHUV 7KHVH
LQVWUXFWLRQV UHFRUG WKH SRVLWLRQ RI HDFK PLVPDWFK IRXQG DQG SODFH WKLV
LQIRUPDWLRQ LQ WKH UHVXOW ILOH ,I QR PLVPDWFKHV DUH IRXQG WKH '1 ELW
LV VHW EXW WKH UHVXOW ILOH UHPDLQV XQFKDQJHG
7KH GLIIHUHQFH EHWZHHQ WKH ''7 DQG )%& LQVWUXFWLRQ LV WKDW HDFK
WLPH WKH ''7 LQVWUXFWLRQ ILQGV D PLVPDWFK WKH SURFHVVRU FKDQJHV WKH
UHIHUHQFH ELW WR PDWFK WKH VRXUFH ELW 7KH )%& LQVWUXFWLRQ GRHV QRW
FKDQJH WKH UHIHUHQFH ELW 8VH WKH ''7 LQVWUXFWLRQ WR XSGDWH \RXU
UHIHUHQFH ILOH WR UHIOHFW FKDQJLQJ PDFKLQH RU SURFHVV FRQGLWLRQV
10-3
:KHQ WKH LQVWUXFWLRQ UHDFKHV WKH HQG RI WKH ILOH WKH GRQH ELW ELW
'1 RI WKH FRPSDUH FRQWURO HOHPHQW LV VHW 7KHQ ZKHQ WKH UXQJ JRHV
IDOVH WKH LQVWUXFWLRQ UHVHWV
HQDEOH ELW
HLWKHU E\
HQDEOH ELW
E\
10-4
Entering Parameters
7R SURJUDP WKHVH LQVWUXFWLRQV \RX QHHG WR SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ LQIRUPDWLRQ
Parameter:
Description:
Source
Reference
the indexed address of the file that contains the data with which you
compare your input file.
Result
the indexed address of the file where the instruction stores the position
(bit) number of each detected mismatch.
Cmp Control
the address of the comparison control structure (R) that stores status
bits, the length of the source and reference files (both should be the
same), and the current position during operation. Use the compare
control address with mnemonic when you address these parameters:
Length (.LEN) is the decimal number of bits to be compared in the
source and reference files. Remember that bits in I/O files are
numbered in octal 00-17, but that bits in all other files are numbered in
decimal 0-15.
Position (.POS) is the current position of the bit to which the instruction
points. Enter a value only if you want the instruction to start at an
offset concurrent with a control file offset for one scan.
Result Control
the address of the result control structure (R) that stores the bit
position number each time the instruction finds a mismatch between
source and reference files.
8VH WKH UHVXOW FRQWURO DGGUHVV ZLWK PQHPRQLF ZKHQ \RX DGGUHVV
WKHVH SDUDPHWHUV
10-5
Result
Control Bits
Function:
Enable .EN (bit 15)
is set when the processor reaches the end of the source and reference files
is set each time the processor records a mismatch bit number in the result file
(one-at-a-time operation) or after recording all mismatches (all per scan).
$IWHU WKH )%& RU ''7 LQVWUXFWLRQ VHWV WKH FRPSDUH '1 ELW WKH
LQVWUXFWLRQ LV UHVHW ZKHQ WKH UXQJV LQSXW FRQGLWLRQV JR IDOVH 7KH
LQVWUXFWLRQ UHVHWV LWV VWDWXV ELWV DQG ERWK FRQWURO HOHPHQWV
10-6
Example:
DDT
DIAGNOSTIC DETECT
#I:030
Source
#B3:0
Reference
#N10:0
Result
R6:0
Compare control
Length
48
Position
0
Result control
R6:1
Length
10
Position
0
EN
DN
FD
IN
ER
Input
File
#I:030
17
bit 31
10
7KH ''7 LQVWUXFWLRQ DERYH FRPSDUHV WKH ELWV LQ WKH VRXUFH ILOH
, ZLWK WKH ELWV LQ WKH UHIHUHQFH ILOH % UHFRUGLQJ WKH
PLVPDWFKHG ELW SRVLWLRQV LQ WKH UHVXOW ILOH 1
07
Result File 2
(mismatched bit #s)
#N10
Reference
File 1
#B3
bit 3
00
15
08
07
00
1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
bit 40
bit32
31
32
40
The FBC and DDT instructions detect mismatches and record their locations by bit number in a result file.
1
The DDT instruction changes the status of the corresponding bit in the reference file to match the input file
when it detects a mismatch.
2
The length of the result file is the length that you enter for RESULT CONTROL.
16657a
This Parameter:
Source (#I:030)
Reference (#B3:0)
Result (#N10:0)
Length (48)
Position (0)
Length (10)
Position (0)
10-7
S:24
FBC
EN
or
Source
Reference
Result
Compare Control
Length
Position
Result Control
Length
Position
#I0:30
#B3:0
#N10:0
R6:0
48
0
R6:1
10
0
DN
FD
IN
ER
DDT
EN
Source
Reference
Result
Compare Control
Length
Position
Result Control
Length
Position
#I0:30
#B3:0
#N10:0
R6:0
48
0
R6:1
10
0
DN
FD
IN
ER
10-8
Description:
DTR
DATA TRANSITION
Source
Mask
Reference
Entering Parameters
7R SURJUDP WKH '75 LQVWUXFWLRQ \RX QHHG WR SURYLGH WKH SURFHVVRU
ZLWK WKH IROORZLQJ LQIRUPDWLRQ
Example:
DTR
DATA TRANSITION
Source
Mask
Reference
I:002
0FFF
N63:11
Parameter:
Definition:
Source
Mask
Reference
7KH '75 LQVWUXFWLRQ DERYH SDVVHV WKH VRXUFH , WKURXJK D PDVN
RI OFFF DQG FRPSDUHV WKH UHVXOW WR WKH UHIHUHQFH ZRUG 1 7KH
VRXUFH ZRUG LV WKHQ ZULWWHQ LQWR WKH UHIHUHQFH DGGUHVV IRU WKH QH[W
FRPSDULVRQ WKH VRXUFH UHPDLQV XQFKDQJHG
15
10-9
08 07
15
00
08 07
00
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
15
Source Word
I:002
08 07
Previous
Scan
08 07
15
Mask Value
0FFF
Reference Word
N63:11
00
08 07
00
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
15
00
Current
Scan
15
08 07
00
Current
Scan
Previous
Scan
13385
10-10
1RWHV
Chapter
11
System diagnostics
Found on Page:
Load bits into, shift bits through, and unload bits from a bit array one bit at
a time, such as for tracking bottles through a bottling line where each bit
represents a bottle
BSL, BSR
11-2
Load and unload values in the same order, such as for tracking parts
through an assembly line where parts are represented by values that have
a part number and assembly code
FFL, FFU
11-5
LFL, LFU *
11-8
11-2
EN
%LW VKLIW LQVWUXFWLRQV VKLIW DOO ELWV ZLWKLQ WKH VSHFLILHG DGGUHVV
RQH ELW SRVLWLRQ ZLWK HDFK IDOVHWRWUXH UXQJ WUDQVLWLRQ 7KHVH
LQVWUXFWLRQV DUH
DN
Description:
BSL
BIT SHIFT LEFT
File
Control
Bit address
Length
Entering Parameters
7R SURJUDP D ELW VKLIW LQVWUXFWLRQ \RX QHHG WR SURYLGH WKH SURFHVVRU
ZLWK WKH IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
File
the address of the bit array you want to manipulate. You must start the
array at a 16-bit word boundary. For example, use bit 0 of word number
1, 2, 3, etc. You can end the array at any bit number up to 15,999.
However, you cannot use the remaining bits in that particular element
because the instruction invalidates them.
Control
The address of the control structure (48 bits three 16-bit words) in the
control area (R) of memory that stores the instructions status bits, the
size of the array (number of bits), and the bit pointer.
Position
the current position of the bit to which the instruction points. Enter a
value only if you want the instruction to start at an offset concurrent with
a control file offset for one scan. Use the control address with mnemonic
when you address this parameter.
Bit Address
the address of the source bit. The instruction inserts the status of this bit
in either the first (lowest) bit position (for the BSL instruction) or the last
(highest) bit position (for the BSR instruction) in the array.
Length
the decimal number of bits to be shifted. Remember that bits in I/O files
are numbered in octal 00-17, but that bits in all other files are numbered
in decimal 0-15. Use the control address with mnemonic when you
address this parameter.
11-3
Definition:
is set to indicate that the bit array shifted one bit position
,PSRUWDQW :KHQ HQDEOHG WKH ELW SRLQWHU LV VHW WR WKH YDOXH RI WKH
OHQJWK WKH ELW DUUD\ LV VKLIWHG $IWHU DOO RI WKH ELWV DUH
VKLIWHG WKH LQVWUXFWLRQ UHVHWV WKH (1 (5 DQG '1 ELWV
DQG WKH ELW SRLQWHU ZKHQ LQSXW FRQGLWLRQV JR IDOVH
15 14 13 12 11 10
Source
I:022/12
EN
#B3:1
R6:53
I:022/12
58
31
16
L
DN
47
32
L
48
63
58-Bit
#B3/16
(B3:1)
L
invalid
Unload Bit
64
73
L
95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
16658
This Parameter:
File (#B3:1)
Control (R6:53)
Length (58)
11-4
:KHQ D UXQJ FRQWDLQLQJ WKH %6/ LQVWUXFWLRQ JRHV IURP IDOVH WR WUXH
WKH SURFHVVRU VHWV WKH (1 ELW 7KHQ WKH SURFHVVRU VKLIWV ELWV LQ ELW
ILOH % VWDUWLQJ ZLWK ELW WR WKH OHIW KLJKHU ELW QXPEHU RQH ELW
SRVLWLRQ 7KH ODVW ELW VKLIWV RXW DW ELW SRVLWLRQ LQWR WKH 8/ ELW 7KH
VSHFLILHG VRXUFH ELW ELW RI LQSXW ZRUG VKLIWV LQWR WKH ILUVW ELW
SRVLWLRQ ELW RI ELW ILOH %
$IWHU WKH SURFHVVRU FRPSOHWHV WKH VKLIW RSHUDWLRQ LQ RQH SURJUDP
VFDQ ZKHQ WKH UXQJ JRHV IDOVH WKH LQVWUXFWLRQ UHVHWV WKH (1 (5 LI
VHW DQG '1 ELWV DQG UHVHWV WKH SRLQWHU
)RU ZUDSDURXQG RSHUDWLRQ PDNH WKH VRXUFH DGGUHVV WKH VDPH DV WKH
KLJKHVW RXWJRLQJ ELW DGGUHVV <RX FDQ RPLW XVLQJ WKH 8/ ELW LQ
ZUDSDURXQG RSHUDWLRQ
#B3:2
R6:54
I:023/06
38
EN
15 14 13 12 11 10
DN
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Unload Bit
47
32
R
48
Bit
Address
I:023/06
R
invalid
69
38-Bit
Array
#B3/32
(#B3:2)
64
R
95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
16659
This Parameter:
File (#B3:2)
Control (R6:54)
Length (38)
:KHQ D UXQJ FRQWDLQLQJ WKH %65 LQVWUXFWLRQ JRHV IURP IDOVH WR WUXH
WKH SURFHVVRU VHWV WKH (1 ELW 7KHQ WKH SURFHVVRU VKLIWV ELWV LQ ELW
ILOH % WR WKH ULJKW WR D ORZHU ELW QXPEHU RQH ELW SRVLWLRQ VWDUWLQJ
ZLWK WKH KLJKHVW ELW SRVLWLRQ 7KH ORZHVW ELW ELW VKLIWV RXW RI
WKH ELW DUUD\ LQWR WKH 8/ ELW 7KH VSHFLILHG VRXUFH ELW RI LQSXW
ZRUG VKLIWV LQWR WKH KLJKHVW ELW SRVLWLRQ
$IWHU WKH SURFHVVRU FRPSOHWHV WKH VKLIW RSHUDWLRQ LQ RQH SURJUDP
VFDQ ZKHQ WKH UXQJ JRHV IDOVH WKH LQVWUXFWLRQ UHVHWV WKH (1 (5
LI VHW DQG '1 ELWV DQG UHVHWV WKH SRLQWHU
)RU ZUDSDURXQG RSHUDWLRQ PDNH WKH VRXUFH DGGUHVV WKH VDPH DV WKH
ORZHVW RXWJRLQJ ELW DGGUHVV <RX FDQ RPLW XVLQJ WKH 8/ ELW LQ
ZUDSDURXQG RSHUDWLRQ
1785-6.1 November 1998
11-5
EN
8VH ),)2 LQVWUXFWLRQV )LUVW ,Q )LUVW 2XW ))/ DQG ))8 DQG /,)2
LQVWUXFWLRQV /DVW ,Q )LUVW 2XW /)/ DQG /)8 LQ SDLUV WR VWRUH DQG
UHWULHYH GDWD LQ D SUHVFULEHG RUGHU
DN
EM
FFU
FIFO UNLOAD
These Instructions:
Retrieve Data:
EU
FIFO
Destination
Control
Length
Position
DN
EM
Entering Parameters
:KHQ \RX SURJUDP D ),)2 RU /,)2 VWDFN XVH WKH VDPH ILOH DQG
FRQWURO DGGUHVVHV OHQJWK DQG SRVLWLRQ YDOXHV IRU ERWK LQVWUXFWLRQV LQ
WKH SDLU <RX QHHG WR SURYLGH WKH SURFHVVRU ZLWK WKH IROORZLQJ
LQIRUPDWLRQ
'HVWLQDWLRQ LV WKH DGGUHVV WKDW VWRUHV WKH YDOXH WKDW H[LWV IURP
WKH VWDFN
This Instruction:
FIFOs FFU
Word zero
LIFOs LFU
11-6
This Bit:
Is Set:
11-7
FFL
FIFO LOAD
Source
FIFO
Control
Length
Position
EN
N60:1
#N60:3
R6:51
64
0
DN
File #N60:3
N60:2
FIFO Unload removes data from stack
EM
FFU
FIFO UNLOAD
FIFO
Destination
Control
Length
Position
SOURCE
EU
N60:1
#N60:3
N60:2
R6:51
64
0
Word
3
4
5
6
7
8
9
10
11
DN
64 words
allocated
for FIFO
stack at
#N60:3
EM
66
16660a
This Parameter:
Source (N60:1)
FIFO (#N60:3)
Destination (N60:2)
Control (R6:51)
Length (64)
Position (0)
:KHQ WKH UXQJ WKDW FRQWDLQV WKH ))/ LQVWUXFWLRQ JRHV IURP IDOVH WR
WUXH WKH SURFHVVRU VHWV WKH (1 ELW DQG ORDGV WKH VRXUFH HOHPHQW
1 LQWR WKH QH[W DYDLODEOH HOHPHQW LQ WKH VWDFN DV SRLQWHG WR E\
WKH FRQWURO VWUXFWXUHV SRVLWLRQ 7KH SURFHVVRU ORDGV DQ HOHPHQW HDFK
WLPH WKH UXQJ JRHV IURP IDOVH WR WUXH XQWLO LW ILOOV WKH VWDFN :KHQ WKH
VWDFN EHFRPHV IXOO WKH SURFHVVRU VHWV WKH '1 ELW 7KH ODGGHU
SURJUDP VKRXOG GHWHFW WKDW WKH VWDFN LV IXOO DQG LQKLELW IXUWKHU ORDGLQJ
RI GDWD IURP WKH VRXUFH
<RX PD\ ZDQW WR ORDG WKH VWDFN LQ DGYDQFH RU HQDEOH WKH ORDG
LQVWUXFWLRQ ZKLOH LQKLELWLQJ WKH XQORDG LQVWUXFWLRQ XQWLO WKH VWDFN
FRQWDLQV WKH GHVLUHG GDWD
:KHQ WKH UXQJ WKDW FRQWDLQV WKH ))8 LQVWUXFWLRQ JRHV IURP IDOVH WR
WUXH WKH SURFHVVRU VHWV WKH (8 ELW DQG XQORDGV GDWD IURP WKH ILUVW
HOHPHQW VWRUHG LQ WKH ),)2 VWDFN LQWR WKH GHVWLQDWLRQ ZRUG 1 $W
WKH VDPH WLPH WKH SURFHVVRU VKLIWV DOO GDWD LQ WKH VWDFN RQH SRVLWLRQ
WRZDUG WKH ILUVW ZRUG 7KH SURFHVVRU XQORDGV RQH ZRUG HDFK WLPH WKH
UXQJ JRHV IURP IDOVH WR WUXH XQWLO LW HPSWLHV WKH ),)2 VWDFN
11-8
:KHQ WKH VWDFN EHFRPHV HPSW\ WKH SURFHVVRU VHWV WKH (0 ELW
7KHUHDIWHU WKH SURFHVVRU WUDQVIHUV D ]HUR YDOXH IRU HDFK IDOVHWRWUXH
UXQJ WUDQVLWLRQ XQWLO WKH ))/ LQVWUXFWLRQ ORDGV QHZ YDOXHV <RXU
ODGGHU SURJUDP VKRXOG GHWHFW WKDW WKH VWDFN LV HPSW\ DQG LQKLELW RWKHU
LQVWUXFWLRQV IURP XVLQJ ]HUR YDOXHV VWRUHG DW WKH GHVWLQDWLRQ
:LWK D ))8 LQVWUXFWLRQ \RX FDQ XQORDG GDWD IURP D ZRUG RWKHU WKDQ
WKH ILUVW ZRUG RI WKH VWDFN E\ FKDQJLQJ WKH ),)2 DGGUHVV WR WKH
DGGUHVV RI WKH GHVLUHG ZRUG DQG FKDQJLQJ WKH OHQJWK DFFRUGLQJO\
LFL
LIFO LOAD
Source
LIFO
Control
Length
Position
EN
N70:1
#N70:3
R6:61
64
0
DN
EM
LFU
LIFO UNLOAD
LIFO
Destination
Control
Length
Position
EU
#N70:3
N70:2
R6:61
64
0
DN
SOURCE N70:1
Word
3
4
5
6
7
8
9
10
11
EM
63
This Parameter:
Source (N70:1)
LIFO (#N70:3)
Destination (N70:2)
Control (R6:61)
Length (64)
Position (0)
11-9
:KHQ WKH UXQJ WKDW FRQWDLQV WKH /)/ LQVWUXFWLRQ JRHV IURP IDOVH WR
WUXH WKH SURFHVVRU VHWV WKH (1 ELW DQG ORDGV WKH VRXUFH ZRUG 1
LQWR WKH QH[W DYDLODEOH ZRUG LQ WKH VWDFN DV SRLQWHG WR E\ WKH FRQWURO
VWUXFWXUHV SRVLWLRQ 7KH SURFHVVRU ORDGV DQ HOHPHQW HDFK WLPH WKH
UXQJ JRHV IURP IDOVH WR WUXH XQWLO LW ILOOV WKH VWDFN :KHQ WKH VWDFN
EHFRPHV IXOO WKH SURFHVVRU VHWV WKH '1 ELW 7KH ODGGHU SURJUDP
VKRXOG GHWHFW WKDW WKH VWDFN LV IXOO DQG LQKLELW IXUWKHU ORDGLQJ RI GDWD
IURP WKH VRXUFH
<RX PD\ ZDQW WR ORDG WKH VWDFN LQ DGYDQFH RU HQDEOH WKH ORDG
LQVWUXFWLRQ ZKLOH LQKLELWLQJ WKH XQORDG LQVWUXFWLRQ XQWLO WKH VWDFN
FRQWDLQV WKH GHVLUHG GDWD
:KHQ WKH UXQJ WKDW FRQWDLQV WKH /)8 LQVWUXFWLRQ JRHV IURP IDOVH WR
WUXH WKH SURFHVVRU VHWV WKH (8 ELW DQG XQORDGV GDWD VWDUWLQJ ZLWK WKH
ODVW ZRUG VWRUHG LQ WKH /,)2 VWDFN LQWR WKH GHVWLQDWLRQ ZRUG 1
7KH SURFHVVRU XQORDGV RQH ZRUG HDFK WLPH WKH UXQJ JRHV IURP IDOVH WR
WUXH XQWLO LW HPSWLHV WKH /,)2 VWDFN
:KHQ WKH VWDFN EHFRPHV HPSW\ WKH SURFHVVRU VHWV WKH (0 ELW
7KHUHDIWHU WKH SURFHVVRU WUDQVIHUV D ]HUR YDOXH IRU HDFK IDOVHWRWUXH
UXQJ WUDQVLWLRQ XQWLO WKH ORDG LQVWUXFWLRQ ORDGV QHZ YDOXHV <RXU
ODGGHU SURJUDP VKRXOG GHWHFW WKDW WKH VWDFN LV HPSW\ DQG LQKLELW RWKHU
LQVWUXFWLRQV IURP XVLQJ ]HUR YDOXHV VWRUHG DW WKH GHVWLQDWLRQ
:LWK D /,)2 XQORDG LQVWUXFWLRQ \RX FDQ XQORDG GDWD IURP D ZRUG
RWKHU WKDQ WKH ILUVW ZRUG RI WKH VWDFN E\ FKDQJLQJ WKH /,)2 DGGUHVV WR
WKH DGGUHVV RI WKH GHVLUHG ZRUG DQG FKDQJLQJ WKH OHQJWK DFFRUGLQJO\
11-10
1RWHV
Chapter
12
Found on Page:
SQO
12-5
SQI
12-7
SQL
12-8
12-2
SQI
SQO
SEQUENCER INPUT
SEQUENCER OUTPUT
File
Mask
Source
Control
Length
Position
File
Mask
Destination
Control
Length
Position
EN
SQL
SEQUENCER LOAD
DN
File
Source
Control
Length
Position
EN
DN
Entering Parameters
:KHQ SURJUDPPLQJ 64, DQG 642 LQVWUXFWLRQV LQ SDLUV XVH WKH VDPH
FRQWURO DGGUHVV OHQJWK YDOXH DQG SRVLWLRQ YDOXH LQ HDFK LQVWUXFWLRQ
7KH VDPH DSSOLHV ZKHQ XVLQJ PXOWLSOH LQVWUXFWLRQV LQ WKH VDPH UXQJ
WR GRXEOH WULSOH RU IXUWKHU LQFUHDVH WKH QXPEHU RI ELWV
7R SURJUDP VHTXHQFHU LQVWUXFWLRQV \RX QHHG WR SURYLGH WKH SURFHVVRU
ZLWK WKH IROORZLQJ LQIRUPDWLRQ
SQO
Controlling outputs
SQI
SQL
12-3
6RXUFH IRU 64, DQG 64/ LV WKH DGGUHVV RI WKH LQSXW HOHPHQW RU
ILOH IURP ZKLFK WKH LQVWUXFWLRQ REWDLQV GDWD IRU LWV VHTXHQFHU ILOH
SQI
12-4
This Bit:
Is Set:
when the length value is less than or equal to zero or when the
position value is less than zero
12-5
SQO
SEQUENCER OUTPUT
File
Mask
Destination
Control
EN
#N7:1
0F0F
O:014
R6:20
Length
Position
DN
N7:1
17
N7:2
10 10 00 10 11 11 01 01
0
1
N7:3
11 11 01 01 01 00 10 10
01 01 01 01 01 01 0 0 0 1
3 Current Step
00 10 01 00 10 01 00 10
N7:4
N7:5
17
10
10
07
07
00
00
00 00 11 11 00 00 11 11
17
Destination O:014
10
07
Sequencer
Output File
Mask
Value
0F0F
00
00 00 01 01 00 00 10 10
Rack 1
I/O group 4
= No Change
= Off
= On
0
1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
SQO instruction moves the data of the current step through a mask to an output word for controlling
multiple outputs.
16645a
12-6
This Parameter:
File (#N7:1)
Mask (0F0F)
Destination (O:014)
Control (R6:20)
Length (4)
Position (2)
7KH 642 LQVWUXFWLRQ VWHSV WKURXJK WKH VHTXHQFHU ILOH RI ELW RXWSXW
ZRUGV ZKRVH ELWV KDYH EHHQ VHW WR FRQWURO YDULRXV RXWSXW GHYLFHV
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH LQVWUXFWLRQ LQFUHPHQWV WR
WKH QH[W VWHS ZRUG LQ WKH VHTXHQFHU ILOH 1 7KH GDWD LQ WKH
VHTXHQFHU ILOH LV WUDQVIHUUHG WKURXJK D IL[HG PDVN )) WR WKH
GHVWLQDWLRQ DGGUHVV 2 &XUUHQW GDWD LV ZULWWHQ WR WKH GHVWLQDWLRQ
HOHPHQW HYHU\ VFDQ WKDW WKH UXQJ UHPDLQV WUXH
$W VWDUWXS ZKHQ \RX VZLWFK WKH SURFHVVRU IURP 3URJUDP PRGH WR
5XQ PRGH LQVWUXFWLRQ RSHUDWLRQ GHSHQGV RQ ZKHWKHU WKH UXQJ LV WUXH
RU IDOVH RQ WKH ILUVW VFDQ
,I UXQJ LV IDOVH WKH LQVWUXFWLRQ ZDLWV IRU WKH ILUVW IDOVHWRWUXH UXQJ
WUDQVLWLRQ DQG WUDQVIHUV GDWD LQ VWHS
$IWHU WUDQVIHUULQJ WKH ODVW ZRUG RI WKH VHTXHQFHU ILOH WKH SURFHVVRU
VHWV WKH '1 ELW 2Q WKH QH[W IDOVHWRWUXH UXQJ WUDQVLWLRQ WKH
SURFHVVRU UHVHWV WKH '1 ELW DQG VHWV WKH SRVLWLRQ WR VWHS
MOV
MOVE
15
The bit S:1/15 is the "first pass" bit. This bit is set when the processor
first scans a program. When this rung goes true, the processor moves
the value of 0 to the position word of the SQO instruction. After the
position is set to 0, the next false to true transition will cause the
processor to run step 1.
Source
Dest
0
R6:20.POS
12-7
#N7:11
FFF0
I:031
R6:21
4
2
Word
15
08
N 7 :11
15
00
11 11 11 11 11 11 00 00
00 Step
0
12
13 0 0 1 0 0 1 0 0 1 0 0 1 1 0 1 0
14
15
07
16646a
These bits are not compared. Therefore, the instruction is true in this example.
This Parameter:
File (#N7:11)
Mask (FFF0)
Source (#I:031)
Control (R6:21)
Length (4)
Position (2)
12-8
Rung 0
ADD
SEQUENCER INPUT
ADD
#N7:0
F0FF
I:005
R6:0
20
0
File
Mask
Source
Control
Length
Position
Rung 1
Source A
Source B
Destination
GTR
MOV
GREATER THAN
MOVE
Source A
Source B
R6:0.POS
R6:0.LEN
R6:0.POS
1
R6:0.POS
0
Source
Destination
0
R6:0.POS
0
EN
File
Source
Control
Length
#N7:20
I:002
R6:22
5
Position
DN
17
00
00 00 10 10 11 00 11 01
Source I:002
15
08
07
00
0
1 Sequencer
Destination
2 File #N7:20
21
22
23
00 00 10 10 11 00 11 01
24
25
3
4
Current Step
16661a
12-9
This Parameter:
File (#N7:20)
Source (I:002)
Control (R6:22)
Length (5)
Position (3)
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH 64/ LQVWUXFWLRQ
LQFUHPHQWV WR WKH QH[W VWHS LQ WKH VHTXHQFHU ILOH DQG ORDGV GDWD LQWR LW
RQH VWHS IRU HDFK UXQJ WUDQVLWLRQ 7KH 64/ LQVWUXFWLRQ ORDGV FXUUHQW
GDWD HDFK VFDQ WKDW WKH UXQJ UHPDLQV WUXH $ PDVN LV QRW XVHG
$W VWDUWXS ZKHQ \RX VZLWFK WKH SURFHVVRU IURP 3URJUDP WR 5XQ
PRGH WKH LQVWUXFWLRQ RSHUDWLRQ GHSHQGV RQ ZKHWKHU WKH UXQJ LV WUXH RU
IDOVH RQ WKH ILUVW VFDQ
,I WKH UXQJ LV IDOVH WKH LQVWUXFWLRQ ZDLWV IRU WKH ILUVW IDOVHWRWUXH
UXQJ WUDQVLWLRQ DQG ORDGV GDWD LQWR VWHS
$IWHU ORDGLQJ WKH ODVW VWHS WKH SURFHVVRU VHWV WKH '1 ELW 2Q WKH QH[W
IDOVHWRWUXH WUDQVLWLRQ WKH SURFHVVRU UHVHWV LWV '1 ELW UHVHWV WKH
SRVLWLRQ WR VWHS DQG ORDGV GDWD LQWR WKDW ZRUG
12-10
1RWHV
Chapter
13
Found on
Page:
MCR
13-2
JMP, LBL
13-3
13-5
13-8
TND
13-13
Disable a rung
AFI
13-13
13-14 (ONS),
13-15 (OSR),
13-16 (OSF)
SFR*
13-17
EOT
13-18
UIE,* UID*
13-19 (UID),
13-20 (UIE)
13-2
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
8VH 0&5 LQVWUXFWLRQV LQ SDLUV WR FUHDWH SURJUDP ]RQHV WKDW WXUQ RII
DOO WKH QRQUHWHQWLYH RXWSXWV LQ WKH ]RQH 5XQJV ZLWKLQ WKH 0&5 ]RQH
DUH VWLOO VFDQQHG EXW VFDQ WLPH LV UHGXFHG GXH WR WKH IDOVH VWDWH RI
QRQUHWHQWLYH RXWSXWV 1RQUHWHQWLYH RXWSXWV DUH UHVHW ZKHQ WKHLU UXQJ
JRHV IDOVH
If the MCR Rung
that Starts the
Zone Is:
True
False
0&5 ]RQHV OHW \RX HQDEOH RU LQKLELW VHJPHQWV RI \RXU SURJUDP VXFK
DV IRU UHFLSH DSSOLFDWLRQV
:KHQ \RX SURJUDP 0&5 LQVWUXFWLRQV QRWH WKDW
'R QRW MXPS LQWR DQ 0&5 ]RQH ,I WKH ]RQH LV IDOVH MXPSLQJ LQWR
LW DFWLYDWHV WKH ]RQH
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
:KHQ WKH UXQJ FRQWDLQLQJ WKH ILUVW 0&5 LQVWUXFWLRQ LV WUXH WKH
SURFHVVRU H[HFXWHV WKH UXQJV LQ WKH 0&5 ]RQH EDVHG RQ WKH UXQJ
LQSXW FRQGLWLRQV 2WKHUZLVH WKH SURFHVVRU UHVHWV WKH QRQUHWHQWLYH
RXWSXW LQVWUXFWLRQV ZLWKLQ WKH 0&5 ]RQH
Example:
I:012
I:012
I:012
MCR
01
02
13-3
Beginning of zone
03
I:012
O:013
04
01
I:012
I:012
O:013
11
12
02
I:012
03
I:012
I:012
O:013
13
10
03
MCR
End of zone
8VH -03 DQG /%/ LQVWUXFWLRQV LQ SDLUV WR VNLS SRUWLRQV RI WKH ODGGHU
SURJUDP
If the Jump Rung Is:
True
Skips from the JMP rung to the LBL rung and continues
executing the program. You can jump forward or backward.
False
13-4
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
Using JMP
7KH -03 LQVWUXFWLRQ OHWV WKH SURFHVVRU VNLS UXQJV <RX FDQ MXPS WR
WKH VDPH ODEHO IURP RQH RU PRUH -03 LQVWUXFWLRQV
$77(17,21 -XPSHG WLPHUV DQG FRXQWHUV DUH QRW
VFDQQHG 5HSURJUDP FULWLFDO RSHUDWLRQV RXWVLGH WKH
MXPSHG ]RQH
Using LBL
7KH /%/ LQVWUXFWLRQ LV WKH WDUJHW RI WKH -03 LQVWUXFWLRQ WKDW KDV WKH
VDPH ODEHO QXPEHU 3ODFH WKH /%/ LQVWUXFWLRQ ILUVW RQ WKH UXQJ WR
ZKHUH \RX ZDQW WKH SURFHVVRU WR MXPS
,PSRUWDQW 0DNH VXUH WKDW WKH /%/ LQVWUXFWLRQ LV WKH ILUVW
LQVWUXFWLRQ RQ WKH UXQJ 7KH VRIWZDUH FXUUHQWO\ OHWV \RX
WR FUHDWH D EUDQFK DURXQG DQ /%/ LQVWUXFWLRQ WKLV ZLOO
FDXVH WKH SURFHVVRU WR RSHUDWH LQFRUUHFWO\
If You Have this Processor:
Enhanced PLC-5
000-255
256
Classic PLC-5
0-31
32
,I \RX PRGLI\ DQG DFFHSW D UXQJ FRQWDLQLQJ D ODEHO ZKLOH RQ OLQH ZLWK
WKH SURFHVVRU LQ 5XQ PRGH WKH VRIWZDUH FUHDWHV DQ ,5 SDLU ,I \RX
PRGLI\ WKH , UXQJ EHIRUH DVVHPEOLQJ WKH HGLWV WKH SURFHVVRU ZLOO IDXOW
ZLWK D GXSOLFDWH ODEHO HUURU
7KHUH DUH IRXU ZD\V WR DYRLG WKLV SUREOHP
/HW WKH IDXOW RFFXU WKHQ FOHDU WKH IDXOW DIWHU DVVHPEOLQJ WKH HGLWV
$VVHPEOH WKH ILUVW HGLW WKHQ PRGLI\ WKH UXQJ DJDLQ WR PDNH WKH
VHFRQG FKDQJH ,I \RX DUH HGLWLQJ RQ OLQH WKH SURFHVVRU PD\
H[HFXWH WKH UXQJ ZLWK WKH ILUVW HGLW DQG PD\ FDXVH WKH SURFHVVRU WR
IDXOW RU UXQ LPSURSHUO\
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-5
:KHQ WKH UXQJ FRQWDLQLQJ WKH -03 LQVWUXFWLRQ JRHV WUXH WKH
SURFHVVRU MXPSV RYHU VXFFHVVLYH UXQJV XQWLO LW UHDFKHV WKH UXQJ WKDW
FRQWDLQV WKH /%/ LQVWUXFWLRQ ZLWK WKH VDPH QXPEHU 7KH SURFHVVRU
UHVXPHV H[HFXWLQJ DW WKH /%/ UXQJ
I:012
I:012
O:013
10
11
01
I:012
20
JMP
13
T4:0
TIMER ON DELAY
DN
Timer
Time base
Preset
Accum
EN
T4:0
1.0
100
0
I:012
O:013
10
13
20
I:012
O:013
17
02
DN
LBL
13-6
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
Entering Parameters
7R SURJUDP WKH )25 LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Label number
the unique label number that marks the location of the FOR instruction. Enter a unique
number. Classic PLC-5 processors support label numbers 0-31; Enhanced PLC-5
processors support label numbers 0-255.
Index
the logical address where the instruction stores the index value it computes. The index
value is the sum of the initial value plus the accumulating step values. The FOR
instruction uses the index value to determine the number of times the loop is executed.
When you enable the FOR instruction, the processor sets the index value equal to the
initial value. Then, if the index values is less than or equal to the terminal value, the
processor loops through the following instructions. If the index is greater than the
terminal value, the processor jumps to the NXT instruction.
When the processor encounters a NXT instruction, it returns to the corresponding FOR
instruction, then it compares the index with the terminal value. If the index is less than
or equal to the terminal value, the processor jumps back to the FOR instruction.
Otherwise it steps to the following instruction. If the processor encounters a BRK on a
true rung, the processor skips to the instruction following the NXT.
Initial value
(index value) is an integer value or integer address that represents the starting value for
the loop.
Terminal value
(reference value) is an integer value or integer address that represents the ending value
for the loop.
Step size
(constant) is an integer value that specifies the amount to increment the index value.
You can change the step value from the ladder program.
Using FOR
:KHQ WKH UXQJ LV WUXH WKH )25 LQVWUXFWLRQ H[HFXWHV WKH UXQJV
EHWZHHQ WKH )25 DQG 1;7 UHSHDWHGO\ LQ RQH SURJUDP VFDQ XQWLO LW
UHDFKHV WKH SUHVHW QXPEHU RI ORRSV RU D %5. LQVWUXFWLRQ DERUWV WKH
RSHUDWLRQ 7KH )25 LQVWUXFWLRQ UHSHDWV WKLV RSHUDWLRQ HDFK VFDQ LWV
UXQJ LV WUXH 7KH )25 LQVWUXFWLRQ GRHV QRW UHTXLUH D UXQJ WUDQVLWLRQ WR
EHJLQ RSHUDWLRQ
:KHQ WKH UXQJ LV IDOVH WKH SURFHVVRU MXPSV WR WKH UXQJ IROORZLQJ WKH
1;7 LQVWUXFWLRQ
,PSRUWDQW %H FDUHIXO QRW WR ORRS WRR PDQ\ WLPHV LQ WKH VLQJOH
SURJUDP VFDQ $Q H[FHVVLYH QXPEHU RI FDOOV FDXVHV WKH
ZDWFKGRJ WLPHU WR WLPH RXW ZKLFK IDXOWV WKH SURFHVVRU
<RX FDQ FKDQJH WKH LQLWLDO DQG WHUPLQDO YDOXHV IURP WKH PDLQ
SURJUDP EHIRUH H[HFXWLQJ WKH )25 LQVWUXFWLRQ <RX VKRXOG QRW
FKDQJH WKH LQGH[ YDOXH
$77(17,21 &KDQJLQJ WKH LQGH[ YDOXH FRXOG FDXVH
WKH LQVWUXFWLRQ WR H[HFXWH WKH ORRS DQ XQH[SHFWHG QXPEHU
RI WLPHV ZLWK SRVVLEOH GDPDJH WR HTXLSPHQW DQGRU
LQMXU\ WR SHUVRQQHO
1785-6.1 November 1998
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-7
Using BRK
7KH %5. LQVWUXFWLRQ VWRSV WKH )25 LQVWUXFWLRQV RSHUDWLRQ 3ODFH WKH
%5. UXQJ DQ\ZKHUH EHWZHHQ WKH )25 DQG 1;7 UXQJV :KHQ WKH
UXQJ JRHV WUXH LW UHWXUQV WKH SURFHVVRU WR WKH QH[W KLJKHVW ORRS LI \RX
DUH XVLQJ QHVWHG ORRSV RU WR WKH IROORZLQJ LQVWUXFWLRQ DIWHU WKH
FRUUHVSRQGLQJ 1;7 LQVWUXFWLRQ LQ WKH PDLQ SURJUDP
8VH %5. WR H[LW WKH ORRS ZKHQHYHU WKH SURFHVVRU GHWHFWV DQ HUURU RU
WR DYRLG SURORQJHG ORRSV WKDW FRXOG FDXVH WKH ZDWFKGRJ WLPHU WR WLPH
RXW ZKLFK ZRXOG IDXOW WKH SURFHVVRU
Using NXT
7KH 1;7 LQVWUXFWLRQ PXVW EH SURJUDPPHG RQ DQ XQFRQGLWLRQDO UXQJ
WKDW LV WKH ODVW UXQJ WR EH UHSHDWHG E\ WKH )RU1H[W ORRS 7KH 1;7
LQVWUXFWLRQ UHWXUQV WKH SURFHVVRU WR WKH FRUUHVSRQGLQJ )25
LQVWUXFWLRQ LGHQWLILHG E\ WKH ODEHO QXPEHU VSHFLILHG LQ WKH
1;7 LQVWUXFWLRQ
N7:10
5
rung
rung
rung
FOR
FOR
Label number
Index
Initial value
Terminal value
Step size
0
N7:0
0
10
1
N7:10
/
BRK
5
rung
rung
rung
rung
rung
rung
13-8
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
Passing Parameters
3DVV VHOHFWHG YDOXHV WR D VXEURXWLQH EHIRUH H[HFXWLRQ VR WKH
VXEURXWLQH FDQ SHUIRUP PDWKHPDWLFDO RU ORJLFDO RSHUDWLRQV RQ WKH
GDWD DQG UHWXUQ WKH UHVXOWV WR WKH PDLQ SURJUDP
)RU H[DPSOH \RX FDQ ZULWH D JHQHULF VXEURXWLQH IRU PXOWLSOH UHFLSH
RSHUDWLRQV 7KHQ SDVV SUHVHW YDOXHV IRU HDFK UHFLSH WR WKH VXEURXWLQH
LQ DGYDQFH RU KDYH WKH PDLQ SURJUDP VSHFLI\ DQG SDVV SUHVHWV
DFFRUGLQJ WR DSSOLFDWLRQ UHTXLUHPHQWV
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-9
Example:
256
23.467
N7:0
C5:0.ACC
,I \RX SDVV IORDWLQJ SRLQW GDWD WR DQ LQWHJHU DGGUHVV WKH IUDFWLRQDO SDUW
RI WKH YDOXH LV WUXQFDWHG ORVW
,PSRUWDQW 'R QRW PL[ IORDWLQJ SRLQW DQG LQWHJHU GDWD DQG DGGUHVVHV
ZKHQ SDVVLQJ GDWD RU \RX ZLOO ORVH DFFXUDF\
JSR
JUMP TO SUBROUTINE
Values are
returned
90
N16:23
N16:24
231
N19:11
N19:12
Execution resumes
Input parameter
Input parameter
Input parameter
N43:0
N43:1
N10:3
RET
Values stored at logical
addresses are returned to the
addresses that you specified in
the JSR instruction when
execution returns to the main
ladder program.
RETURN ( )
Return parameter
Return parameter
N43:5
N43:4
13-10
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
Entering Parameters
7R SURJUDP WKHVH LQVWUXFWLRQV SURYLGH WKH SURFHVVRU ZLWK WKH
IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-11
SBR
Level 2
Subroutine File 91
SBR
Level 3
Subroutine File 92
SBR
JS R
91
92
JS R
JS R
RET
RET
RET
15294
Using JSR
7KH -65 LQVWUXFWLRQ GLUHFWV WKH SURFHVVRU WR WKH VSHFLILHG VXEURXWLQH
ILOH DQG LI UHTXLUHG GHILQHV WKH SDUDPHWHUV SDVVHG WR DQG UHFHLYHG
IURP WKH VXEURXWLQH
:KHQ SURJUDPPLQJ WKH -65 NHHS WKH IROORZLQJ LQ PLQG
<RX FDQQRW MXPS LQWR DQ\ SDUW RI WKH VXEURXWLQH ILOH H[FHSW IRU
WKH ILUVW 6%5 LQVWUXFWLRQ LQ WKDW ILOH
Using SBR
7KH RSWLRQDO 6%5 LQVWUXFWLRQ LV WKH KHDGHU LQVWUXFWLRQ WKDW VWRUHV
LQFRPLQJ SDUDPHWHUV 8VH 6%5 RQO\ LI \RX ZDQW WR SDVV SDUDPHWHUV
:KHQ \RX SDVV SDUDPHWHUV WKH 6%5 LQVWUXFWLRQ PXVW EH WKH ILUVW
LQVWUXFWLRQ LQ WKH ILUVW UXQJ RI WKH VXEURXWLQH 7KLV UXQJ PXVW DOVR
KDYH DQ RXWSXW LQVWUXFWLRQ 7KH 6%5 LQVWUXFWLRQ VWRUHV WKH SURJUDP
FRQVWDQWV DQG GDWD WDEOH YDOXHV SDVVHG IURP WKH -65 LQVWUXFWLRQ
,PSRUWDQW ,I \RX XVH WKH 6%5 LQVWUXFWLRQ WKH 6%5 LQVWUXFWLRQ
PXVW EH WKH ILUVW LQVWUXFWLRQ RQ WKH ILUVW UXQJ LQ WKH
SURJUDP ILOH WKDW FRQWDLQV WKH VXEURXWLQH
13-12
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
Using RET
7KH 5(7 LQVWUXFWLRQ HQGV WKH VXEURXWLQH DQG LI UHTXLUHG VWRUHV
SDUDPHWHUV WR EH UHWXUQHG WR WKH -65 LQVWUXFWLRQ LQ WKH PDLQ SURJUDP
7KH 5(7 LQVWUXFWLRQ FRQFOXGHV VXEURXWLQH H[HFXWLRQ 7KH 5(7
LQVWUXFWLRQ GLUHFWV WKH SURFHVVRU EDFN WR WKH LQVWUXFWLRQ IROORZLQJ WKH
FRUUHVSRQGLQJ -65 LQVWUXFWLRQ 7KH 5(7 LQVWUXFWLRQ DOVR UHWXUQV GDWD
WR WKH SUHYLRXV VXEURXWLQH RU PDLQ SURJUDP
(YHU\ VXEURXWLQH PXVW FRQWDLQ DQ H[HFXWDEOH 5(7 LQVWUXFWLRQ LI \RX
ZDQW WR UHWXUQ YDOXHV IURP WKH VXEURXWLQH 7KH UXQJ WKDW FRQWDLQV WKH
5(7 LQVWUXFWLRQ FDQ EH FRQGLWLRQDO ,I \RX XVH WKLV PHWKRG \RX FDQ
SURJUDP WKH SURFHVVRU WR H[HFXWH RQO\ D SDUW RI WKH VXEURXWLQH LI
FHUWDLQ FRQGLWLRQV DUH WUXH +RZHYHU EH VXUH WR SURJUDP DQRWKHU 5(7
LQVWUXFWLRQ LQ DQ XQFRQGLWLRQDO UXQJ DW WKH HQG RI WKH VXEURXWLQH WR
JXDUDQWHH D YDOLG UHWXUQ IURP WKH VXEURXWLQH ZKHQ WKH FRQGLWLRQV RQ
WKH ILUVW 5(7 LQVWUXFWLRQ DUH IDOVH
,PSRUWDQW 7R DYRLG D SURFHVVRU IDXOW RQO\ XVH WKH 5(7 LQVWUXFWLRQ
LQ \RXU SURJUDP ZKHQ \RX DUH UHWXUQLQJ SDUDPHWHUV ,I
\RX DUH QRW UHWXUQLQJ SDUDPHWHUV OHW WKH HQG VWDWHPHQW
LQ WKH VXEURXWLQH GR WKH UHWXUQ WR WKH PDLQ SURJUDP
:KHQ WKH UXQJ WKDW FRQWDLQV WKH -65 LQVWUXFWLRQ JRHV WUXH WKH
SURFHVVRU MXPSV WR WKH VXEURXWLQH ILOH VSHFLILHG E\ WKH -65
LQVWUXFWLRQ 7KH SURFHVVRU DOVR SDVVHV WKUHH YDOXHV WR WKH VXEURXWLQH
YDOXH VWRUHG DW 1 YDOXH VWRUHG DW 1 DQG FRQVWDQW
7KHQ WKH SURFHVVRU UXQV WKH VXEURXWLQH ORJLF
:KHQ WKH SURFHVVRU UXQV WKH 5(7 LQVWUXFWLRQ LQ WKH VXEURXWLQH WKH
SURFHVVRU UHWXUQV WR WKH LQVWUXFWLRQ IROORZLQJ WKH SUHYLRXV -65
LQVWUXFWLRQ LQ WKH PDLQ SURJUDP 7KH VXEURXWLQH UHWXUQV WZR YDOXHV WR
WKH PDLQ SURJUDP WKH YDOXH VWRUHG DW 1 LV WUDQVIHUUHG WR 1
WKH YDOXH VWRUHG DW 1 LV WUDQVIHUUHG WR 1
JSR
JUMP TO SUBROUTINE
Prog file number
Input par
Input par
Input par
Return par
Return par
90
N16:23
N16:24
231
N19:11
N19:12
SBR
SUBROUTINE
Input par
Input par
Input par
N43:0
N43:1
N43:2
(Enter your own logic operation)
RET
RETURN ( )
Return par
Return par
N43:3
N43:4
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-13
I:012
04
05
TND
7KH $), LQVWUXFWLRQ LV DQ LQSXW LQVWUXFWLRQ WKDW PDNHV WKH UXQJ IDOVH
ZKHQ LQVHUWHG LQ WKH FRQGLWLRQ VLGH RI WKH UXQJ <RX FDQ XVH WKH $),
LQVWUXFWLRQ WR WHPSRUDULO\ GLVDEOH D UXQJ ZKHQ \RX GHEXJ D SURJUDP
AFI
13-14
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
7KH 216 LQVWUXFWLRQ LV DQ LQSXW LQVWUXFWLRQ WKDW PDNHV WKH UXQJ WUXH
IRU RQH SURJUDP VFDQ XSRQ D IDOVHWRWUXH WUDQVLWLRQV RI WKH FRQGLWLRQV
SUHFHGLQJ WKH 216 LQVWUXFWLRQ RQ WKH UXQJ
8VH WKH 216 LQVWUXFWLRQ WR VWDUW HYHQWV WKDW DUH WULJJHUHG E\ D
SXVKEXWWRQ VXFK DV SXOOLQJ YDOXHV IURP WKXPEZKHHO VZLWFKHV RU
IUHH]LQJ UDSLGO\ GLVSOD\HG /(' YDOXHV <RX PXVW HQWHU D ELW DGGUHVV
IRU WKH ELW 8VH HLWKHU D ELQDU\ ILOH RU LQWHJHU ILOH DGGUHVV $ XQLTXH ELW
PXVW EH GHGLFDWHG WR HDFK 216 <RX FDQ SURJUDP DQ RXWSXW DGGUHVV
IRU WKH 216 EXW EH DZDUH RI WKH IROORZLQJ
$77(17,21 2QOLQH SURJUDPPLQJ ZLWK WKLV
LQVWUXFWLRQ FDQ EH GDQJHURXV EHFDXVH WKH RXWSXW PD\
WXUQ RQ LPPHGLDWHO\ ZKHQ WKH UXQJ LV VFDQQHG 6HW WKH
ELW DGGUHVV YDOXH WR EHIRUH HQWHULQJ WKH LQVWUXFWLRQ
WKHQ WKH UXQJ PXVW JR IURP IDOVH WR WUXH EHIRUH
HQHUJL]LQJ LWV RXWSXW
,PSRUWDQW 'XULQJ SUHVFDQ WKH ELW DGGUHVV LV VHW WR LQKLELW IDOVH
WULJJHULQJ ZKHQ WKH SURJUDP VFDQ EHJLQV
Example:
I:011
N7:10
B3
ONS
04
10
When the input condition goes from false to true, the ONS conditions the rung so that
the output turns on for one scan. The output turns off for successive scans until the
input goes from false to true again.
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-15
OB
Storage BIt
Output Bit
Output Word
SB
Output .OB
Is set for one program scan when the rung goes from false to true
Note: During prescan, this bit is cleared to inhibit false triggering
when the program scan begins.
Storage .SB
8VH WKH 265 LQVWUXFWLRQ ZKHQHYHU DQ HYHQW PXVW VWDUW EDVHG RQ WKH
FKDQJH RI VWDWH RI WKH UXQJ IURP IDOVH WR WUXH QRW FRQWLQXRXVO\ ZKHQ
WKH UXQJ LV WUXH <RX PXVW HQWHU D ELW DGGUHVV IRU WKH RXWSXW ELW DQG
VWRUDJH ELW 8VH HLWKHU D ELQDU\ ILOH RU LQWHJHU ILOH DGGUHVV
Entering Parameters
7R SURJUDP WKHVH LQVWUXFWLRQV \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Storage bit
the address where you want the storage bit status stored. For
example, B3/17
Output bit
the bit position in the output word where you want the output
bit status stored. For example 5
Output word
the word address where you want the output bit status
stored. For example, N7:0
13-16
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
OB
Storage BIt
Output Bit
Output Word
SB
Output .OB
Is set for one program scan when the rung goes from true to false
Storage .SB
8VH WKH 26) LQVWUXFWLRQ ZKHQHYHU DQ HYHQW PXVW VWDUW EDVHG RQ WKH
FKDQJH RI VWDWH RI WKH UXQJ IURP WUXH WR IDOVH QRW RQ WKH UHVXOWLQJ UXQJ
VWDWXV <RX PXVW HQWHU D ELW DGGUHVV IRU WKH RXWSXW ELW DQG VWRUDJH ELW
8VH HLWKHU D ELQDU\ ILOH RU LQWHJHU ILOH DGGUHVV
Entering Parameters
7R SURJUDP WKHVH LQVWUXFWLRQV \RX PXVW SURYLGH WKH SURFHVVRU ZLWK
WKH IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Storage bit
the address where you want the storage bit status stored. For
example, B3/17
Output bit
the bit position of the output word where you want the output
bit status stored. For example 5
Output word
the word address where you want the output bit status
stored. For example, N7:0
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-17
Entering Parameters
7R SURJUDP WKLV LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU ZLWK WKH
IROORZLQJ LQIRUPDWLRQ
Example:
SFR
SFC Reset
Prog file number
Restart step at
2
N7:5
Parameter:
Definition:
Restart Step at
13-18
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
13-19
UID
13-20
Program Control Instructions MCR, JMP, LBL, FOR, NXT, BRK, JSR, SBR, RET, TND, AFI, ONS, OSR, OSF, SFR, EOT, UIE, UID
UIE
Example:
I:012
I:012
I:012
O:013
Program can be interrupted
01
02
03
02
UID
I:012
I:012
O:013
01
04
02
I:012
I:012
O:013
04
02
03
Program cannot
be interrupted
I:012
03
UIE
Chapter
14
Flow
Rate
Error
R
PID Equation
Process
Variable
Control
Output
Level
Detector
14271
14-2
PID Features
7KH 3,' LQVWUXFWLRQ OHWV WKH SURFHVV PRQLWRU DQG FRQWURO SURFHVV
ORRSV IRU VXFK TXDQWLWLHV DV SUHVVXUH WHPSHUDWXUH IORZ UDWH DQG IOXLG
OHYHO )HDWXUHV RI WKH 3,' LQVWUXFWLRQ LQFOXGH
RXWSXW DODUPV
7KH 3,' LQVWUXFWLRQ KDV WZR VSHFLILF IRUPDWV LQWHJHU FRQWURO EORFN
W\SH DQG 3' FRQWURO EORFN W\SH %RWK IRUPDWV XVH WKH VDPH
FRPSXWDWLRQDO PHFKDQLFV IRU WKH EDVH HTXDWLRQ EXW GLIIHU LQ
RSWLRQV DQG W\SH RI PDWK SHUIRUPHG VSHFLILFDOO\ LQWHJHU DQG
IORDWLQJ SRLQW PDWK
7KH EDVH 3,' HTXDWLRQ XVHG LQ ERWK FDVHV LV WKH VWDQGDUG SDUDOOHO
SRVLWLRQ 3,' $OJRULWKP ZLWK RSWLRQ IRU HQWHULQJ JDLQV DV
LQGHSHQGHQW RU GHSHQGHQW 7KH ODWWHU RSWLRQ LV UHFRJQL]HG DV
,6$ VWDQGDUG IRUPDW
7KH SURFHVVRU JLYHV \RX VL[ FKRLFHV RI 3,' DOJRULWKPV DV IROORZV
6WDQGDUG HTXDWLRQ ZLWK GHSHQGHQW JDLQV ,6$ VWDQGDUG
'HULYDWLYH RI (UURU
1 t
d(E)
CV = K c ( E ) + ( E ) dt + T d + Bias
Ti 0
dt
'HULYDWLYH RI 39
1 t
d(PV)
CV = K c ( E ) + ( E ) dt + T d + Bias ( E = SP PV )
0
Ti
dt
1 t
d(PV)
CV = K c ( E ) + ( E ) dt + T d + Bias ( E = PV SP )
Ti 0
dt
14-3
'HULYDWLYH RI 39
t
d(PV)
CV = K P ( E ) + K i ( E ) dt K d + Bias ( E = SP PV )
0
dt
t
d(PV)
CV = K P ( E ) + K i ( E ) dt + K d + Bias ( E = PV SP )
0
dt
:KHUH
Kp
SP
= Set Point
Ki
PV
= Process Variable
Kd
Error
1
T1
Bias
Td
Kp = Kc unitless
Kc
Ki = inverse seconds
60Ti
Kd = Kc(Td)60 seconds
Integral Term Implementation
3HUIRUP LQWHJUDWLRQ E\ PDLQWDLQLQJ DQ DFFXPXODWHG VXP 6N
.L(NW 6N
1
Ti
14-4
d(E
= CVManual Bias K p ( E ) K d
dt
:KHQ \RX VZLWFK EDFN WR DXWR PRGH WKH 3,' FRPSXWDWLRQ \LHOGV WKLV
0DQXDO 2XWSXW YDOXH DQG QR MXPS LQ RXWSXW RFFXUV DV D UHVXOW RI WKH
PRGH FKDQJH
Derivative Term
7KH IROORZLQJ DSSUR[LPDWLRQ LV XVHG WR FDOFXODWH WKH GHULYDWLYH WHUP
d
( Q ) Q k Qk 1
=
dt
t
Qk Qk 1
D k = ( 1 ) K d + D k 1
t
Where:
Kd
Dk
Dk1
Qk
=
1
t
16 + 1
Kd
14-5
Implementing Scaling to
Engineering Units
Integer File Type
<RX FDQ VFDOH WKH VHWSRLQW DQG ]HURFURVVLQJ GHDG EDQG YDOXHV WR
HQJLQHHULQJ XQLWV IRU LQWHJHU ILOH W\SHV <RX FDQ DOVR GLVSOD\ WKH
SURFHVV YDULDEOH DQG HUURU YDOXHV LQ WKHVH VDPH HQJLQHHULQJ XQLWV
:KHQ \RX VHOHFW VFDOLQJ WKH 3,' LQVWUXFWLRQ VFDOHV WKH VHWSRLQW GHDG
EDQG SURFHVV YDULDEOH DQG HUURU YDOXHV <RX DOVR KDYH
DQG 6
LQ WKH
(QWHU WKH PD[LPXP DQG PLQLPXP YDOXHV 6
3,' FRQWURO EORFN ZRUGV DQG 7KH 6 YDOXH FRUUHVSRQGV WR
DQ DQDORJ YDOXH RI ]HUR IRU WKH ORZHVW UHDGLQJ RI WKH SURFHVV
YDULDEOH WKH 6
YDOXH FRUUHVSRQGV WR DQ DQDORJ YDOXH RI
IRU WKH KLJKHVW UHDGLQJ RI WKH SURFHVV YDULDEOH 7KHVH YDOXHV
UHSUHVHQW SURFHVV OLPLWV 6HW 6
DQG 6
WR LI \RX GR QRW
ZDQW VFDOLQJ
h
14-6
(QWHU WKH VHWSRLQW ZRUG DQG GHDG EDQG ZRUG LQWHJHU ILOH
W\SH RQO\ YDOXHV LQ WKH VDPH VFDOHG HQJLQHHULQJ XQLWV 7KH
FRQWURO RXWSXW ZRUG GLVSOD\V DV D SHUFHQWDJH RI WKH
UDQJH 7KH RXWSXW WKH SURFHVVRU WUDQVIHUV WR WKH RXWSXW PRGXOH LV
DOZD\V XQVFDOHG
$77(17,21 'R QRW FKDQJH VFDOLQJ ZKHQ WKH
SURFHVVRU LV LQ 5XQ PRGH 7KH SURFHVVRU
FRXOG IDXOW DQG FDXVH DQ XQGHVLUDEOH SURFHVV UHVSRQVH
SRVVLEOH HTXLSPHQW GDPDJH DQG
SHUVRQDO LQMXU\
7KH DGMXVWDEOH GHDG EDQG OHWV \RX VHOHFW DQ HUURU UDQJH DERYH DQG
EHORZ WKH VHWSRLQW ZKHUH RXWSXW GRHV QRW FKDQJH DV ORQJ DV WKH HUURU
UHPDLQV ZLWKLQ WKLV UDQJH
7KLV GHDG EDQG OHWV \RX FRQWURO KRZ FORVHO\ WKH SURFHVV YDULDEOH
PDWFKHV WKH VHWSRLQW ZLWKRXW FKDQJLQJ WKH RXWSXW
high alarm
+DB
process
variable
error within
dead band range
SP
-DB
low alarm
time
Using Zero-Crossing
=HURFURVVLQJ LV GHDG EDQG FRQWURO WKDW OHWV WKH LQVWUXFWLRQ XVH WKH
HUURU IRU FRPSXWDWLRQDO SXUSRVHV DV WKH SURFHVV YDULDEOH FURVVHV LQWR
WKH GHDG EDQG XQWLO WKH SURFHVV YDULDEOH FURVVHV WKH VHWSRLQW 2QFH WKH
SURFHVV YDULDEOH FURVVHV WKH VHWSRLQW HUURU FURVVHV ]HUR DQG FKDQJHV
VLJQ DQG DV ORQJ DV WKH SURFHVV YDULDEOH UHPDLQV LQ WKH GHDG EDQG WKH
LQVWUXFWLRQ FRQVLGHUV WKH HUURU YDOXH ]HUR
(QWHU \RXU GHDG EDQG YDOXH LQ ZRUG RI WKH FRQWURO EORFN '% ZRUG
RI D 3' GDWD ILOH W\SH 7KH GHDG EDQG H[WHQGV DERYH DQG EHORZ WKH
VHWSRLQW E\ WKH YDOXH \RX VSHFLI\ (QWHU WR LQKLELW WKH GHDG EDQG ,I
VFDOHG WKH GHDG EDQG KDV WKH VDPH VFDOHG XQLWV DV WKH VHWSRLQW
14-7
<RX FDQ VHW DQ RXWSXW OLPLW SHUFHQW RI RXWSXW RQ WKH FRQWURO RXWSXW
:KHQ WKH LQVWUXFWLRQ GHWHFWV WKDW WKH RXWSXW KDV UHDFKHG D OLPLW LW VHWV
DQ DODUP ELW ELW 2// IRU WKH ORZHU OLPLW ELW 2/+ IRU WKH XSSHU
OLPLW LQ ZRUG RI WKH FRQWURO EORFN DQG SUHYHQWV WKH RXWSXW IURP
H[FHHGLQJ HLWKHU YDOXH 7KH LQVWUXFWLRQ OLPLWV WKH RXWSXW WR DQG
LI \RX GR QRW VSHFLI\ D OLPLW
7R XVH RXWSXW OLPLWV VHW WKH OLPLW HQDEOH ELW ELW RI ZRUG DQG
HQWHU WKH XSSHU OLPLW LQ ZRUG DQG WKH ORZHU OLPLW LQ ZRUG /LPLW
YDOXHV DUH D SHUFHQWDJH RI WKH RXWSXW
,PSRUWDQW ,I \RX DUH XVLQJ WKH 3' GDWD ILOH W\SH IRU WKH FRQWURO
EORFN WKH SURFHVVRU SHUIRUPV WKLV IXQFWLRQ ZLWKRXW \RX
KDYLQJ WR VHW ELWV
14-8
Anti-Reset Windup
$QWLUHVHW ZLQGXS LV D IHDWXUH WKDW SUHYHQWV WKH LQWHJUDO WHUP IURP
EHFRPLQJ H[FHVVLYH ZKHQ RXWSXWV UHDFK D OLPLW :KHQ WKH VXP RI
WKH 3,' DQG ELDV WHUPV LQ WKH RXWSXW UHDFKHV D OLPLW WKH LQVWUXFWLRQ
VWRSV FDOFXODWLQJ WKH LQWHJUDO RXWSXW WHUP XQWLO WKH RXWSXW FRPHV EDFN
LQWR UDQJH
PV
Input
1st channel
(word 1)
Block Transfer
0
0
0
N7:0
N7:109
6
N
EN
DN
ER
2nd channel
(word 2)
Output
Module located in rack 0,
I/O group 0, module slot 0
PID
PID
Control block
Process Variable
Tieback
Control variable
N7:20
N7:109
N7:110
N7:120
15297
Set Output
<RX FDQ UHSODFH D PDQXDO FRQWURO VWDWLRQ ZLWK D WKXPEZKHHO DQG
SXVKEXWWRQ VZLWFKHV DQG VLPXODWH WKH 3,' IXQFWLRQ ZLWK ODGGHU ORJLF
8VH WKH 6HW 2XWSXW PRGH WR HQWHU D YDOXH UHSUHVHQWLQJ D SHUFHQWDJH RI
WKH &RQWURO 9DULDEOH RXWSXW 7\SLFDOO\ LW LV GHVLUHG WR HQWHU D YDOXH
IURP DQ RSHUDWRU LQWHUIDFH 7KH WDEOH EHORZ LOOXVWUDWHV WKH SURFHGXUH
WR IROORZ ZKHQ 6HW 2XWSXW PRGH LV GHVLUHG
1785-6.1 November 1998
14-9
Table 14.A
Set Output Mode Procedure
Integer Control Block (N7:0)
Mode:0 (0:auto/1:manual)
(bit N7:0/1 = 0)
SET OUTPUT %
(word PD10:0.SO = % value)
,I WKH VHW RXWSXW YDOXH LV JUHDWHU WKDQ WKH XSSHU &9 OLPLW RU ORZHU WKDQ
WKH ORZHU &9 OLPLW DQG RXWSXW OLPLWLQJ LV HQDEOHG DQG WKH 3,'
LQVWUXFWLRQ LV LQ 6HW 2XWSXW PRGH WKH SURFHVVRU XVHV WKH DFWXDO RXWSXW
QRW WKH VHW RXWSXW YDOXH WR FDOFXODWH WKH LQWHJUDO DFFXPXODWRU WHUP
IRU FDOFXODWLQJ EXPSOHVV WUDQVIHU
:LWK WKH UHVXPHODVWVWDWH IXQFWLRQ \RX FDQ PDNH IXOO XVH RI WKH
DQDORJ RXWSXW PRGXOHV KROGODVWVWDWH IXQFWLRQ 7KH
UHVXPHODVWVWDWH IXQFWLRQ OHWV WKH 3,' LQVWUXFWLRQ UHVXPH FDOFXODWLQJ
WKH LQWHJUDO WHUP RI WKH 3,' DOJRULWKP IURP LWV ODVW RXWSXW YDOXH
LQVWHDG RI ]HUR ZKHQ UHWXUQLQJ WR 5XQ PRGH
,I \RX DUH XVLQJ DQ LQWHJHU GDWD ILOH IRU WKH FRQWURO EORFN VHW WKH ELWV
DFFRUGLQJ WR WKH JXLGHOLQHV EHORZ ,I \RX DUH XVLQJ D 3' GDWD ILOH W\SH
IRU WKH FRQWURO EORFN WKH SURFHVVRU VDYHV WKH LQWHJUDO DFFXPXODWRU DQG
XVHV LW ZKHQ JRLQJ IURP 3URJUDP WR 5XQ PRGH
14-10
PID Instruction
Description:
PID
PID
Control Block
Process variable
Tieback
Control variable
14-11
1RUPDOO\ WKH SURFHVVRU UHDGV WKH ELDV WHUP YDOXH \RX VSHFLI\ LQ WKH
3,' FRQILJXUDWLRQ EORFN +RZHYHU XQGHU RQH FRQGLWLRQ WKH
SURFHVVRU ZLOO ZULWH D YDOXH WR WKH ELDV WHUP 7KLV RFFXUV ZKHQ WKH
LQWHJUDO JDLQ HTXDOV ]HUR DQG WKH PRGH RI WKH ORRS LV FKDQJHG IURP
PDQXDO WR DXWR 7KH SURFHVVRU EDFN FDOFXODWHV WKH LQWHJUDO
DFFXPXODWRU LQ DQ DWWHPSW WR SURYLGH D EXPSOHVV WUDQVIHU ZKHQ JRLQJ
IURP PDQXDO WR DXWR
7KH EXPSOHVV WUDQVIHU IXQFWLRQ LV DYDLODEOH ZLWK WKH IROORZLQJ RU
JUHDWHU SURFHVVRU UHYLVLRQ OHYHOV
True
False
True
.EN
.DN
False
Actual Execution of
the PID Instruction
True
False
14-12
PD Block
7KH 3' %ORFN 3,' LQVWUXFWLRQ KDV RQO\ DQ HQDEOH ELW (1 WR LQGLFDWH
RSHUDWLRQDO VWDWXV 7KLV ELW LQGLFDWHV WKDW LWV TXDOLI\LQJ UXQJ
FRQGLWLRQV DUH WUXH LQ ZKLFK FDVH WKH HQDEOH ELW LV WUXH D IDOVHWRWUXH
WUDQVLWLRQ LV QRW QHHGHG 7KH RQO\ ZD\ WKH HQDEOH ELW EHFRPHV IDOVH
DJDLQ LV LI WKHVH VDPH TXDOLI\LQJ FRQGLWLRQV EHFRPH IDOVH 7KH 3'
EORFN GRHV QRW XVH D GRQH ELW
Rung
State
True
False
True
.EN
False
Actual Execution of
the PID Instruction
,PSRUWDQW 8QOLNH WKH ,QWHJHU %ORFN YHUVLRQ WKH 3' %ORFN 3,'
H[HFXWHV DJDLQ LI WKH SURJUDP VFDQ HQFRXQWHUV WKLV UXQJ
DJDLQ ZKLOH WKH UXQJ VWDWH LV VWLOO WUXH
Entering Parameters
:KHQ \RX HQWHU WKH LQVWUXFWLRQ \RX PXVW VSHFLI\ IRXU DGGUHVVHV WKDW
DUH IXQGDPHQWDO WR WKH RSHUDWLRQ RI WKH LQVWUXFWLRQ $IWHU \RX HQWHU
WKHVH DGGUHVVHV WKH SURJUDPPLQJ VRIWZDUH GLVSOD\V D VFUHHQ IURP
ZKLFK \RX HQWHU WKH RSHUDWLQJ SDUDPHWHUV RI WKH LQVWUXFWLRQ
7KH XVH RI LQWHJHU FRQWURO EORFNV YHUVXV 3' FRQWURO EORFNV GHSHQGV
RQ \RXU SURFHVVRU ,I \RX DUH XVLQJ D &ODVVLF 3/& SURFHVVRU WKH 3'
FRQWURO EORFN LV QRW DYDLODEOH ,Q WKH (QKDQFHG 3/& SURFHVVRUV
ERWK WKH 1 DQG 3' FRQWURO EORFNV DUH DYDLODEOH 7KH 3' FRQWURO EORFN
JLYHV \RX PRUH IOH[LELOLW\ LH IORDWLQJ SRLQW YDULDEOHV KLJKHU
UHVROXWLRQ ELW YHUVXV ELW
14-13
Definition:
Control Block
a file that stores PID status and control bits, constants, variables,
and internally used parameters.
Based on the data type you use, a different configuration screen
appears for you to enter PID information (see the next sections for
more information).
If you have an Enhanced PLC-5 processor, you can use an integer
control block or a PD control block. Using a PD file, words 0, 1 are
the status words; words 2-80 store the PID values.
If you use an Integer control block, the PID calculations are
performed using integer values. If you use a PD control block, the
PID calculations are performed using floating point values.
If you have a Classic PLC-5 processor, you must use an integer file
(N) for your control block. Using an integer file, word 0 is the status
word; words 1-22 store the PID values.
Process Variable
Tieback
Control Variable
a word address to which the PID instruction sends its calculated PID
output value.
Note: If a value greater than 4095 is written to the control variable
location of the Integer Type PID instruction, the output of the PID
instruction obtains a permanent offset which can only be removed
by writing to the control variable with a value between 0 and
4095. This happens whether you write to this location via rung logic
or directly to the data table location.
Note: The file PD type PID instruction does not exhibit this behavior.
14-14
:KHQ XVLQJ DQ LQWHJHU GDWD ILOH W\SH IRU WKH FRQWURO EORFN WKH GDWD
PRQLWRU VFUHHQ IRU WKH 3,' LQVWUXFWLRQ VKRZV WKH IROORZLQJ
LQIRUPDWLRQ VRPH RI ZKLFK LV GLVSOD\ RQO\ VRPH RI ZKLFK \RX
VSHFLI\ WKH YDOXHV 7DEOH %
Table 14.B
PID Parameter Descriptions (Integer Control Block)
Parameter:
Description:
Equation
Enter whether you want to use independent (0) or dependent (1) gains. Displays one of
the following:
INDEPENDENT (0) for independent gains
DEPENDENT (1) for dependent gains (ISA)
Use dependent gains when you want to use standard loop tuning methods. Use
independent gains when you want the three gain constants (P, I, and D) to
operate independently.
Mode
Error
Output Limiting
Displays whether or not the instruction clamps the output at the high and low limiting
values. Displays one of the following:
NO (0) output not clamped
YES (1) output clamped
The PID algorithm has an anti-reset windup feature that prevents the integral term from
becoming too large when the output reaches the high or low alarm limits. If the limits
are reached, the algorithm stops calculating the integral term until the output comes
back into range.
Setpoint scaling
Derivative input
14-15
Parameter:
Description:
Deadband status
Displays whether or not the setpoint is out of the range of engineering units you
selected on the PID Configuration screen. Displays one of the following:
NO (0) SP within range
YES (1) SP out of range
Note: A major processor fault occurs if the SP is out of range when the instruction is
first enabled.
PID done
Displays whether the PID instruction has completed (1 = done; 0 = not done).
PID enabled
Feed forward
Enter a value between 4095 and 4095 for the amount of feed forward.
The ladder program can enter a feedforward value to bump the output in anticipation of
a disturbance. This value is often used to control a process with transportation lag.
Enter the integer number (32,768 - 32,767) that is the maximum value available from
the analog module. For example, use 4095 for a module whose range is 0-4095.
Enter the number that is the minimum value available from the analog module. For
example, use 0 for a module whose range is 0 to 4095.
Dead band
For an unscaled deadband, enter a value in the engineering units you selected on
the PID Configuration screen. Valid range is 0 to 4095 unscaled, 32,768 to
+32,767 scaled.
Note: The deadband is zero crossing.
Enter a percent (0-100%) to use as the CV Output when set output mode is selected.
Upper CV limit %
Enter a percent (0-100) above which the algorithm clamps the output.
Lower CV limit %
Enter a percent (0-100) below which the algorithm clamps the output.
Scaled PV value
Displays data from the analog input module that the instruction scales to the same
engineering units that you selected for the setpoint.
Scaled error
Current CV %
Setpoint
Proportional gain
(Kc)
Enter an integer. Valid entry range for Ti is 0-32,767 (minutes times 100). The
processor automatically divides the entry value by 100 for calculations.
Valid entry range for Ki is 0-32,767 (inverse seconds times 1000). The processor
automatically divides the entry by 1000 for calculations.
(Continued)
14-16
Parameter:
Description:
Enter an integer. Valid entry range is 0-32,767 or KD 0-32,767. The processor divides
the entry value by 100 for calculations.
Enter an update time (greater than or equal to 0.01 seconds) at 1/5 to 1/10 times the
natural period of the load (load time constant). Valid entry range is 1-32,767 seconds.
The processor divides the entry value by 100 for calculations. The load time constant
should be greater than:
1ms(algorithm) + block transfer time (ms)
Periodically enable the PID instruction at a constant interval equal to the update time.
For update times of less than 100 msec, use an STI. When update times are greater
than 100 msec, use a timer or a real-time sampling.
Note: If you omit an update time or enter a negative update time, a major fault occurs
the first time the processor runs the PID instruction.
Contains:
Bit 15
Enabled (EN)
Bit 13
Done (DN)
Bit 11
Set point out of range
Bit 10
Output alarm, lower limit
Bit 9
Output alarm, upper limit
Bit 8
DB, set when error is in deadband
Bit 7
Resume last state (0=yes; 1=hold last state)
Bit 6
Derivative action (0=PV, 1=error)
Bit 5
Setpoint descaling (0=no, 1=yes)
Bit 4
Set output (0=no, 1=yes)
Bit 3
Output limiting (0=no, 1=yes)
Bit 2
Control (0=reverse, 1=direct)
Bit 1
Mode (0=automatic, 1=manual)
Bit 0
Equation (0=independent, 1=ISA)
Note: During prescan, bits 8, 9, 10, in addition to the Integral
Accumulator and Derivative Error values, are cleared and the
error register value of previous scans is set to 32,767.
reserved
Setpoint
Term:
Entry Range:
SP
0-4095 (unscaled)
SminSmax (scaled)
Note: Terms marked with an asterisk (*) are entered as Yy 100. The term itself is Yy. The term marked with a double
asterisk (**) is entered as Yy 1000. The term itself is Yy.
(Continued)
14-17
Word:
Contains:
Independent:
Term:
Entry Range:
Kp *
0-32,767
ISA:
Kc*
0-32,767
Independent:
Ki**
0-32,767
ISA:
Ti*
0-32,767
Independent:
Kd*
0-32,767
ISA:
Td*
0-32,767
Feedforward or bias
FF/Bias
4095-+4095
Maximum scaling
Smax
32,768-+32,767
Minimum scaling
Smin
32,768-+32,767
Dead band
DB
0-4095 (unscaled)
SminSmax (scaled)
10
Set output
SETOUT
0-100%
11
Lmax
0-100%
12
Lmin
0-100%
13
dt
0-32,767
14
SminSmax
15
SminSmax
16
Output (% of 4095)
17-22
CV
0-100%
Note: Terms marked with an asterisk (*) are entered as Yy 100. The term itself is Yy. The term marked with a double
asterisk (**) is entered as Yy 1000. The term itself is Yy.
14-18
:KHQ XVLQJ D 3' ILOH W\SH IRU WKH FRQWURO EORFN WKH GDWD PRQLWRU
VFUHHQ IRU WKH 3,' LQVWUXFWLRQ VKRZV WKH IROORZLQJ LQIRUPDWLRQ VRPH
RI ZKLFK LV GLVSOD\ RQO\ VRPH RI ZKLFK \RX VSHFLI\ WKH YDOXHV
7DEOH '
Table 14.D
PID Parameter Descriptions (PD Control Block)
Parameter
Address
Mnemonic:
Description:
Setpoint
.SP
Enter a floating-point number in the same engineering units that are on the
PID Configuration screen. Valid range is 3.4 E+38 to +3.4 E+38.
Process Variable
.PV
Displays data from the analog input module that the instruction scales to
the same engineering units that you selected for the setpoint.
Error
.ERR
Output %
.OUT
Mode
.MO
.MO=0
.MO=1
.SWM=1
PV Alarm
.PVHA=1
.PVLA=1
Deviation Alarm
.DVPA=1
.DVNA=1
Output Limiting
.OLH=1
.OLL=1
Displays whether the PV is within or exceeds the high or low alarm limits
you selected on the PID Configuration screen. Displays one of the following:
NONE PV within alarm limits
HIGH PV exceeds high alarm limit (used with deadband)
LOW PV exceeds low alarm limit (used with deadband)
Displays whether the error is within or exceeds the high or low deviation
alarms you selected on the PID Configuration screen. Displays one of the
following:
NONE error within deviation alarm limits
POSITIVE error exceeds high alarm (used with deadband)
NEGATIVE error exceeds low alarm (used with deadband)
Displays whether or not the instruction clamps the output at the high and
low limiting values (.MAXO and .MINO) you selected on the PID Configuration
screen. Displays one of the following:
NONE output not clamped
HIGH output clamped at the high end (.MAXO)
LOW output clamped at the low end (.MINO)
The PID algorithm has a anti-reset-windup feature that prevents the integral
term from becoming too large when the output reaches the high or low
alarm limits. If the limits are reached, the algorithm stops calculating the
integral term until the output comes back into range.
(Continued)
14-19
Parameter
Address
Mnemonic:
Description:
SP Out of Range
.SPOR=0
.SPOR=1
Displays whether or not the setpoint is out of the range of engineering units
you selected on the PID Configuration screen. Displays one of the following:
NO SP within range
YES SP out of range
Note: A major processor fault occurs if the SP is out of range when the
instruction is first enabled.
Error Within DB
.EWD=0
.EWD=1
PID Initialized
.INI=0
.INI=1
Each time you change a value in the control block, the PID instruction takes
over twice as long to execute (until initialized) on the first scan. Displays one
of the following:
NO PID instruction not initialized after you changed control block values
YES PID instruction remains initialized because you did not change any
control block values
Attention: Do not change the range of input or engineering units when
running. If you must do this, then you must reset this bit to re-initialize.
Otherwise, the instruction will malfunction with possible damage to
equipment and injury to personnel.
.MO=0
.MO=1
Enter whether you want automatic (0) or manual (1) PID control. Displays
one of the following:
AUTO (0) automatic PID control
MANUAL (1) manual PID control
Manual control specified that an output from a manual control station
overrides the calculated output of the PID algorithm.
Note: Manual overrides Set Output Mode.
.SWM=0
.SWM=1
Enter whether you want automatic PID (0) control or Set Output Mode (1), for
software-simulated control. Displays one of the following:
AUTO (0) automatic PID control
SW MANUAL (1) software-simulated PID control
You can simulate a manual control station with the data monitor when you
program a single loop. To do this, set .SWM to SW MANUAL and enter a
Set Output Percent value.
You can simulate a manual control station with ladder logic, pushwheels,
and pushbutton switches when you program several loops. To do this, set
.SWM to SW MANUAL and move a value into the set output element .SO.
(Continued)
14-20
Parameter
Address
Mnemonic:
Description:
Status Enable
.EN=0
.EN=1
Enter whether to use (1) or inhibit (0) this bit which displays the rung
condition so you can see whether the PID instruction is operating. Displays
one of the following:
0 instruction not executing
1 instruction executing
Proportional Gain
.KP
Integral Gain
.KI
Derivative Gain
.KD
Output Bias %
.BIAS
Enter a value (100 to +100) to represent the percentage of output you want
to feed forward or use as a bias to the output. The bias value can
compensate for steady-loss of energy from the system.
The ladder program can enter a feedforward value to bump the output in
anticipation of a disturbance. This value is often used to control a process
with transportation lag.
Tieback %
.TIE
Set Output %
.SO
14-21
:KHQ XVLQJ D 3' ILOH W\SH IRU WKH FRQWURO EORFN WKH GDWD PRQLWRU
VFUHHQ IRU WKH 3,' LQVWUXFWLRQ SURYLGHV DFFHVV WR D 3,' FRQILJXUDWLRQ
VFUHHQ )URP WKH 3,' FRQILJXUDWLRQ VFUHHQ \RX FDQ GHILQH WKH
IROORZLQJ FKDUDFWHULVWLFV RI WKH 3,' LQVWUXFWLRQ 7DEOH (
Table 14.E
PID Configuration Descriptions (PD Control Block)
Parameter:
Address
Mnemonic:
Description:
PID Equation
.PE=0
.PE=1
Enter whether you want to use independent (0) or dependent (1) gains. Displays one of
the following:
INDEPENDENT (0) for independent gains
DEPENDENT (1) for dependent gains
Use dependent gains when you want to use standard loop tuning methods. Use
independent gains when you want the three gain constants (P, I, and D) to
operate independently.
Derivative of
.DO=0
.DO=1
Enter whether you want the derivative of the PV (0) or the error (1). Displays one of
the following:
PV (0) for PV derivative
ERROR (1) for error derivative
Select the PV derivative for more stable control when you do not change the setpoint often.
Select the error derivative for fast responses to setpoint changes when the algorithm can
tolerate overshoots.
Control Action
.CA=0
.CA=1
Enter whether you want reverse (0) or direct acting (1). Displays one of the following:
REVERSE (0) for reverse acting (E = SP-PV)
DIRECT (1) for direct acting (E = PV-SP)
PV Tracking
.PVT=0
.PVT=1
Enter whether you do not (0) or do (1) want PV tracking. Displays one of the following:
NO (0) for no tracking
YES (1) for PV tracking
Select no tracking if the algorithm can tolerate a bump when switching from manual to
automatic control. Select PV tracking if you want the setpoint to track the PV in manual
control for bumpless transfer to automatic control.
Update Time
.UPD
Enter an update time (greater than or equal to .01 seconds) at 1/5 to 1/10 the natural
period of the load (load time constant). The load time constant should be greater than:
3ms(algorithm) + block transfer time (ms)
Periodically enable the PID instruction at a constant interval equal to the update time.
When the program scan time is close to the required update time, use an STI to ensure a
constant update interval. When the program scan is several times faster than the required
update time, use a timer.
Attention: If you omit an update time or enter a negative update time, a major fault occurs
the first time the processor runs the PID instruction.
(Continued)
14-22
Parameter:
Address
Mnemonic:
Description:
Cascade Loop
.CL=0
.CL=1
Enter whether this loop is not (0) or is (1) used in a cascade of loops. Displays one of the
following:
NO (0) not used in a cascade
YES (1) used in a cascade
Cascade Type
.CT=0
.CT=1
If this loop is part of a cascade of loops, enter whether this loop is the master (1) or a slave
(0). Displays one of the following:
SLAVE (0) for a slave loop
MASTER (1) for a master loop
Master to
this Slave
.ADDR
If this loop is a slave loop in a cascade, enter the control block address of the master.
Tieback is ignored in the master loop of a cascade. When you change cascaded loops to
manual control, the slave forces the master into manual control. When PV tracking is
enabled, the order of events is:
Slave.SP > Master.TIE > Master.OUT > Slave.SP
When you return to automatic control, change the slave first, then the master.
Engineering
Unit Max
.MAXS
Enter the floating-point value in engineering units that corresponds to the analog modules
full scale output. Valid range is 3.4 E+38 to +3.4 E+38.
Attention: Do not change this value during operation because a processor fault
might occur.
Engineering Unit
Min
.MINS
Enter the floating-point value in engineering units that corresponds to the analog modules
zero output. Valid range is 3.4 E+38 to +3.4 E+38 (post-scaled number).
Attention: Do not change the maximum scaled value during operation because a
processor fault might occur.
Input
Range Max
.MAXI
Enter the floating-point number (3.4 E+38 to +3.4 E+38) that is the unscaled maximum
value available from the analog module. For example, use 4095 for a module whose range
is 0-4095.
Input
Range Min
.MINI
Enter the floating-point number (3.4 E+38 to +3.4 E+38) that is the minimum unscaled
value available from the analog module. For example, use 0 for a module whose range is
0-4095.
Output Limit
High %
.MAXO
Enter a percent (0-100) above which the algorithm clamps the output.
Output Limit
Low %
.MINO
Enter a percent (0-100) below which the algorithm clamps the output.
PV Alarm High
.PVH
Enter a floating-point number (3.4 E+38 to +3.4 E+38) that represents the highest
PV value that the system can tolerate.
PV Alarm Low
.PVL
Enter a floating-point number (3.4 E+38 to +3.4 E+388) that represents the lowest
PV value that the system can tolerate.
PV Alarm
Deadband
.PVDB
Enter a floating-point number (0-3.4 E+38) that is sufficient to minimize nuisance alarms.
This is a one-sided deadband. The alarm bit (.PVH or .PVL) is not set until the PV crosses
the deadband and reaches the alarm limit (DB zero point). The alarm bit remains set until
the PV passes back through and exits from the deadband.
(Continued)
14-23
Parameter:
Address
Mnemonic:
Description:
Deviation Alarm
(+)
.DVP
Enter a floating-point number (0-3.4 E+38) that specifies the greatest error deviation above
the setpoint that the system can tolerate.
Deviation Alarm
()
.DVN
Enter a floating-point number (3.4 E+38-0) that specifies the greatest error deviation
below the setpoint that the system can tolerate.
Deviation Alarm
Deadband
.DVDB
Enter a floating-point number (0-3.4 E+38) that is sufficient to minimize nuisance alarms.
This is a one-sided deadband. The alarm bit (.DVP or .DVN) is not set until the error crosses
the deadband and reaches the alarm limit (DB zero point). The alarm bit remains set until
the error passes back through and exits from the deadband.
No Zero Crossing
.NOZC=0
.NOZC=1
Enter whether to use (1) or inhibit (0) the no zero crossing feature:
0 no zero crossing disabled
1 no zero crossing enabled
No Back
Calculation
.NOBC=0
.NOBC=1
Enter whether to use (1) or inhibit (0) the no back calculation feature:
0 no back calculation disabled
1 no back calculation enabled
No Derivative
Filter
.NDF=0
.NDF=1
Enter whether to use (1) or inhibit (0) the filter in the derivative calculation.
0 no filter used in derivative calculation
1 filter used in derivative calculation
Contains:
Control/Status Bits
Bit 15
Enabled (EN)
Bit 11
No back calculation (0=disabled, 1=enabled)
Bit 10
No zero crossing (0=disabled, 1=enabled)
Bit 9
Cascade selection (master, slave)
Bit 8
Cascade loop (0=no, 1=yes)
Bit 7
Process variable tracking (0=no, 1=yes)
Bit 6
Derivative action (0=PV, 1=error)
Bit 5
No derivative filter (0=disabled, 1=enabled)
Bit 4
Set output (0=no, 1=yes)
Bit 2
Control action (0=SP-PV, 1=PV-SP)
Bit 1
Mode (0=automatic, 1=manual)
Bit 0
Equation (0=independent, 1=ISA)
Range:
(Continued)
14-24
Word:
Contains:
Status Bits
Bit 12
PID initialized (0=no, 1=yes)
Bit 11
Set point out of range
Bit 10
Output alarm, lower limit
Bit 9
Output alarm, upper limit
Bit 8
DB, set when error is in DB
Bit 3
Error is alarmed low
Bit 2
Error is alarmed high
Bit 1
Process variable (PV) is alarmed low
Bit 0
Process variable (PV) is alarmed high
Note: During prescan, bit 12 is cleared.
2, 3
Setpoint
4, 5
Independent:
0 to +3.4 E+38
ISA:
0 to +3.4 E+38
Independent:
0 to +3.4 E+38
ISA:
0 to +3.4 E+38
Independent:
0 to +3.4 E+38
ISA:
0 to +3.4 E+38
6, 7
8, 9
Range:
10, 11
Feedforward or bias
100 to +100%
12, 13
Maximum scaling
14, 15
Minimum scaling
16, 17
Dead band
0 to +3.4 E+38
18, 19
Set output
0-100%
20, 21
0-100%
22, 23
0-100%
24, 25
26, 27
28, 29
30, 31
Output (% of 4095)
0-100%
32, 33
34, 35
36, 37
0 to +3.4 E+38
38, 39
3.4 E+38 to 0
40, 41
0 to +3.4 E+38
42, 43
0 to +3.4 E+38
(Continued)
Programming Considerations
14-25
Word:
Contains:
Range:
44, 45
46, 47
48, 49
0-100%
51
52
54-80
DQG 6
EHFDXVH D FKDQJH FRXOG SODFH WKH
VFDOLQJ YDOXHV 6
VHWSRLQW RXW RI UDQJH DQG FRXOG FKDQJH WKH GHDGEDQG UDQJH
14-26
1RW DOO $OOHQ%UDGOH\ DQDORJ LQSXW PRGXOHV HQWHU GDWD LQ WKH VDPH
IRUPDW <RX PXVW GHWHUPLQH ZKHUH WR VWRUH FKDQQHO GDWD )RU
H[DPSOH WHPSHUDWXUH VHQVLQJ PRGXOHV VXFK DV WKH ,5 DQG
,;( SODFH VWDWXV ZRUGV LQ IURQW RI WKH ZRUGV WKDW FRQWDLQ
FKDQQHO GDWD )RU LQIRUPDWLRQ DERXW ZKHUH DQ DQDORJ PRGXOH VWRUHV
FKDQQHO GDWD VHH WKH GRFXPHQWDWLRQ IRU WKH PRGXOH
Loop Considerations
7KH QXPEHU RI 3,' ORRSV ORRS XSGDWH WLPH DQG ORFDWLRQ RI ELW
DQDORJ LQSXW PRGXOHV DUH LPSRUWDQW FRQVLGHUDWLRQV IRU XVLQJ WKH
3,' LQVWUXFWLRQ
Descaling Inputs
14-27
7KH 3,' LQVWUXFWLRQ PXVW XVH XQVFDOHG GDWD IURP DQDORJ
LQSXW PRGXOHV 7KH DQDORJ LQSXW PRGXOHV \RX FDQ XVH PD\ KDYH
HLWKHU VFDOHG RU XQVFDOHG UDQJHV :KHQ SRVVLEOH VHOHFW WKH XQVFDOHG
UDQJH RI
+RZHYHU VRPH PRGXOHV VXFK DV WKH ,5 DQG ,;(
WHPSHUDWXUH VHQVLQJ PRGXOHV FDQQRW JHQHUDWH GDWD LQ DQ XQVFDOHG
UDQJH )RU WKHVH PRGXOHV \RX PXVW SURJUDP DULWKPHWLF ORJLF WR
FRQYHUW WKH VFDOHG RXWSXW WR WKH XQVFDOHG UDQJH IRU WKH 3,'
LQVWUXFWLRQ ,I \RX DUH XVLQJ D 3' GDWD ILOH IRU WKH FRQWURO EORFN WKH
SURFHVVRU SHUIRUPV WKLV GHVFDOLQJ LQWHUQDOO\ VHH WKH GHVFULSWLRQV RI
0$;, DQG 0,1, LQ WKH 3,' FRQILJXUDWLRQ FKDUDFWHULVWLFV
SDJH
8VH WKLV HTXDWLRQ WR FRQYHUW VFDOHG RXWSXWV
4095
M 2 = ( M 1 S min1 )
( S max1 S min1 )
Variable
Description
M2
calculated output
M1
Smax1
Smin1
Smax1 Smin1
)RU H[DPSOH WKH UHDGLQJ IURP D ,;( PRGXOH IRU W\SH WKHUPRFRXSOH LV 7R FRQYHUW WKLV WR DQ XQVFDOHG YDOXH XVH
WKHVH YDOXHV
4095
M 2 = [ 170 ( 200 ) ]
[ 1200 ( 200 ) ]
M 2 = 1082
unscaled
14-28
,I \RX DUH VXUH WKDW WKH WHPSHUDWXUH RI \RXU SURFHVV ZLOO DOZD\V
UHPDLQ ZLWKLQ D VSHFLILF UDQJH \RX FDQ VHW WKH OLPLWV IRU 6
DQG
6
LQVWHDG RI WKH PLQLPXP DQG PD[LPXP YDOXHV IRU WKH
WKHUPRFRXSOH PRGXOH 7KLV WHFKQLTXH LPSURYHV WKH UHVROXWLRQ RI
WKH SURFHVV YDULDEOH
v
R6:2
6
0
ALL
#N19:0
EN
DN
ER
Expression
#N17:0 - #N18:0
FAL
FILE ARITHMETIC/LOGIC
Control
Length
Position
Mode
Destination
Expression
#N19:0 * #N20:0
R6:5
6
0
ALL
#N21:0
EN
DN
ER
14-29
Table 14.G
Variables for the Descaling PID Values Example
Variable
Description
Smax
Smin
4095
K =
S max S min
#N17:0
#N18:0
#N19:0
#N20:0
#N21:0
PID Examples
14-30
Figure 14.4
Example PID Programming Conditioned by a Timer in the Main Program
TON
TIMER ON DELAY
Timer
Time base
Preset
Accum
T10:0
DN
T10:0
0.01
10
0
BTR
BLOCK TRANSFER READ
0
Rack
1
Group
0
Module
Control Block
BT9:0
Data file
N7:104
Length
5
Continuous
N
T10:0
DN
BT9:0
EN
DN
EN
DN
ER
B3
0
DN
PID
PID
Control Block
Process variable
Tieback
Control variable
B3
0
N7:20
N7:104
0
N7:200
BTW
BLOCK TRANSFER WRITE
0
Rack
0
Group
0
Module
Control Block
BT9:1
Data file
N7:200
Length
13
Continuous
N
N7:20
13
EN
DN
ER
14-31
BT9:0
EN
DN
ER
U
EN
PID
N7:20
PID
Control block
Process Variable
Tieback
Control variable
N7:20
N7:104
0
N7:200
U
15
BTW
BT9:1
EN
DN
ER
U
EN
14-32
EN
DN
ER
PID
BT9:0
DN
PID
Control Block
Process variable
Tieback
Control variable
N7:20
N7:104
0
N7:200
BTW
N7:20
13
EN
DN
ER
PD Block Examples
14-33
14-34
Figure 14.7
Example PID Programming Conditioned by a Timer in the Main Program
TON
T11:0
TIMER ON DELAY
Timer
Time base
Preset
Accum
DN
EN
T11:0
0.01
10
0
DN
BTR
T11:0
DN
BT9:0
EN
DN
ER
B3
DN
0
PID
B3
B3
PID
Control Block
Process variable
Tieback
Control variable
ONS
0
PD10:0
N7:104
0
N7:200
BTW
BLOCK TRANSFER WRITE
Rack
0
Group
0
Module
0
Control Block
BT9:1
Data file
N7:200
Length
13
Continuous
N
B3
0
EN
DN
ER
14-35
BT9:0
EN
DN
ER
U
EN
PID
PID
Control block
Process Variable
Tieback
Control variable
PD10:0
N7:104
0
N7:200
BTW
BT9:1
EN
DN
ER
U
EN
14-36
EN
BT9:0
EN
DN
ER
B3
0
DN
PID
B3
B3
ONS
PID
Control Block
Process variable
Tieback
Control variable
PD10:0
N7:104
0
N7:200
BTW
B3
EN
DN
ER
14-37
N7:20
L
00
I:001
N7:20
U
01
MOV
N7:20
I:001
002
MOVE
Source
Destination
I:011
N7:30
MOV
N7:20
MOVE
Source
Destination
N7:36
N7:30
7KH ODVW UXQJ LQ WKH DERYH H[DPSOH LV IRU RXWSXW WUDFNLQJ IRU
EXPSOHVV WUDQVIHU IURP DXWRPDWLF WR PDQXDO PRGH
Address:
Description:
I:001/00
I:001/01
I:001/02
I:011
N7:20/4
N7:30
N7:36
14-38
Cascading Loops
<RX FDQ FDVFDGH WZR ORRSV E\ DVVLJQLQJ WKH FRQWURO RXWSXW RI WKH
RXWHU ORRS WR WKH VHWSRLQW RI WKH LQQHU ORRS 7KH VHWSRLQW RI WKH LQQHU
ORRS LV WKH WKLUG ZRUG ZRUG RI WKH LQWHJHU FRQWURO EORFN ,I WKH
FRQWURO EORFN RI WKH LQQHU ORRS LV 1 DGGUHVV WKH RXWHU ORRS
FRQWURO RXWSXW DW 1 5HSODFH WKH 3,' UXQJV LQ )LJXUH RU
)LJXUH ZLWK WKRVH LQ )LJXUH
<RX PXVW QRW VFDOH WKH VHWSRLQW RI WKH LQQHU ORRS 6HW WKH VFDOLQJ ELW
ZRUG ELW WR WR LQKLELW VHWSRLQW VFDOLQJ
Figure 14.11
Cascaded Loops
PID
PID
Control Block
Process variable
Tieback
Control variable
N7:20
N7:105
N7:106
N7:52
PID
PID
Control Block
Process variable
Tieback
Control variable
N7:50
N7:107
N7:108
N7:121
Ratio Control
<RX FDQ PDLQWDLQ WZR YDOXHV LQ D UDWLR E\ XVLQJ D 08/ LQVWUXFWLRQ
7KUHH SDUDPHWHUV DUH LQYROYHG
(QWHU WKH DGGUHVV RI WKH FRQWUROOHG YDOXH DV WKH 'HVWLQDWLRQ (QWHU WKH
DGGUHVV RI WKH ZLOG RU XQFRQWUROOHG YDOXH DV 6RXUFH $ (QWHU HLWKHU
WKH DGGUHVV RI WKH UDWLR YDOXH RU D SURJUDP FRQVWDQW IRU WKH UDWLR DV
6RXUFH % )RU H[DPSOH DGG WKH UXQJV LQ )LJXUH WR WKH 3,'
SURJUDP LQ )LJXUH RU )LJXUH
14-39
Figure 14.12
Ratio Control with a PID Instruction
PID
PID
Control block
Process Variable
Tieback
Control variable
MUL
MUL
Source A
Source B
Destination
PID
PID
Control block
Process Variable
Tieback
Control variable
N7:20
N7:105
N7:106
N7:120
N7:105
0.350000
N7:52
N7:50
N7:107
N7:108
N7:121
N7:20
N7:105
N7:106
N7:120
N7:34
N7:22
14-40
)LJXUH DQG )LJXUH VKRZ WKH 3/& 3,' ,QWHJHU DQG 3'
%ORFN SURFHVV IORZ )LJXUH DQG )LJXUH VKRZ WKH 3'
%ORFN PDVWHUVODYH UHODWLRQVKLS
PID Theory
Figure 14.14
PLC-5 PID (Integer Block)
Error
Displayed
as EUs
Convert
Binary % to EU
Smax - Smin
4095
Error x
SetPoint
Scaling
No
12 Bit
Truncation
Error
FeedForward
Set
Output
Mode
Off
Mode
Output
Limiting
Auto
No
SP-PV
SP
+
Yes
Convert Eng. Units
To Binary
(Error)
-
PID
Calculation
-1
(Out)
PV-SP
SP-Smin
x 4095
Smax-Smin
On
Set
Output %
Yes
Manual
CV
Output
Limiting
Tieback
Convert
Binary to EU
SP
Displayed as
user entry
12 Bit
Truncation
Yes
No
PV
Convert
Binary to % Binary
Smax - Smin
+ Smin
PV x
4095
CV x
SetPoint
Scaling
100
4095
Output (CV)
displayed as
% Binary
PV
Displayed
as EUs
Smin - Minimum Scaled Input
Smax - Maximum Scaled Input
Figure 14.15
PLC-5 PID (PD Block)
Error
Displayed
as EUs
SP
Displayed
as EUs
Software A/M
-orA/M Station Mode
Auto
SP-PV
+
SP
(Error)
-
Man
Output
Bias %
Control
Action
-1
PV-SP
Convert Eng.
Units To %
Error x 100
maxs-mins
Software
A/M Mode
PID
Calculation
(Out%)
Auto
Auto
PVT
Output
Limiting
Manual
Set
Output %
No
PV
Displayed
as EUs
Yes
Manual
Tieback %
Convert Binary
To Eng. Units
(PV-mini)(maxs-mins)
+ mins
maxi-mini
PV
Set
Output %
A/M
Station
Mode
PVT
mini
maxi
mins
maxs
Output (CV)
Displayed as
% of EU Scale
Convert %
To Binary
Out% x 40.95
CV
14-41
Figure 14.16
PLC-5 PID (PD Block) as Master/Slave Loops
Master
Loop
Software A/M
-orA/M Station Mode
Auto
SP-PV
(Error)
+
SP
Output
Bias %
Control
Action
Convert Eng.
Units To %
Error x 100
maxs-mins
-1
Man
PV-SP
PVT
No
Software
A/M Mode
PID
Calculation
(Out%)
Auto
Set
Output %
Convert Binary
To Eng. Units
(PV-mini)(maxs-mins)
maxi-mini
SP
+ mins
PV
No
Yes
(Master.Out)
Output
Limiting
Manual
Manual
Software
A/M Mode
PVT
Yes
Set
Output %
A/M
Station
Mode
Auto
Convert Eng.
Units To %
x 100
maxs-mins
Auto
Items referenced in this box
are parameters, units, and
modes as they pertain to the
designated Slave loop.
Manual
Manual
Auto
A/M
Station Mode
PV
(Master.Out)
Output
Bias %
Control
Action
Slave
Loop
Convert %
(SP)
To Eng. Units
+
x (maxs-mins)
+ mins
100
SP-PV
-1
PV-SP
Convert Eng.
Units To %
Error x 100
maxs-mins
Software
A/M Mode
PID
Calculation
Auto
Auto
Output
Limiting
Manual
Set
Output %
Convert Binary
To Eng. Units
(PV-mini)(maxs-mins)
maxi-mini
+ mins
Set
Output %
A/M
Station
Mode
Convert %
To Binary
Out% x 40.95
CV
Manual
Tieback %
PV
14-42
Figure 14.17
PD Block Master/Slave Interlocking State Transitions
Slave Loop Transitions
Auto
Auto
Auto
Auto
S-M
an
S-Man
S-Auto
Auto
Man
Man
Man
SWM
SWM
S-Auto
SWM
Man
(on
SWM
S-Auto
M-
f)
(of
)
(on
Auto
S-
M-
SW
M-
SW
SWM
Man
( SWM
)
(of
f)
SW
)
(on
MM
(of
n
Ma
f)
SW
SWM
Man
( SWM
)
M
S
Man
Auto
SWM
S-Auto
S-Man
Man
Note: ( SWM ) indicates that this loop
Man
( SWM
)
SWM
n
Ma
S-
Man
SWM
Man
( SWM
)
S-SWM (off)
Man
SWM
S-SWM (off)
(on
Man
S-SWM (on)
M-
SW
Man
( SWM
)
Man
( SWM
)
S-
S-Man
Man
S-Auto
Auto
to
Man
( SWM
)
M-Au
Man
SWM
M-Ma
Man
SWM
Auto
(on
S-SWM (on)
Man
S-SWM (off)
M
M
SW
Ma
n
SW
Au
to
MM-
M-
SW
Man
( SWM
)
Man
S-
Auto
(on
SWM
WM
S-S
Auto
Man
S-SWM (on)
Ma
n
to
Au
M-
Man
)
(on
M-
M-
Au
to
SW
M-
Chapter
15
Use this
Instruction:
Found on Page:
BTW
15-3
BTR
15-3
CIO
15-22
15-2
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Table 15.B
Block Transfer Instructions for Local or Remote Racks in Scanner Mode
If You Want to Transfer Data:
Use:
Figure 15.1
Block Transfer Operation in Scanner Mode
One of Several Remote I/O Chassis
w/ 1771-ASB Adapter (processor)
PLC-5 (supervisor)
BTD
File
B
T
1
7
7
1
A
S
B
BTW
BTR
M
o
d
u
l
e
7DEOH & GHVFULEHV KRZ WR EORFN WUDQVIHU GDWD ZKHQ WKH SURFHVVRU
LV FRQILJXUHG IRU DGDSWHU PRGH )LJXUH LOOXVWUDWHV KRZ WKH
WUDQVIHU RFFXUV
Table 15.C
Block Transfer Instructions for Adapter Mode
If You Want to Transfer Data:
Use:
Figure 15.2
Block Transfer Operation in Adapter Mode
Adapter
PLC-5
Supervisor
Processor
Scanner
BTW
BTR
BTR
BTW
BTD
File
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-3
EN
:KHQ WKH UXQJ JRHV WUXH WKH %7: LQVWUXFWLRQ WHOOV WKH SURFHVVRU WR
ZULWH GDWD VWRUHG LQ WKH GDWD ILOH WR WKH VSHFLILHG UDFNJURXSPRGXOH
DGGUHVV WKH %75 LQVWUXFWLRQ WHOOV WKH SURFHVVRU WR UHDG GDWD IURP WKH
UDFNJURXSPRGXOH DGGUHVV DQG VWRUH LW LQ WKH GDWD ILOH
DN
ER
Classic PLC-5
15-4
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Table 15.D
Queue-Full Bits for Block Transfer Requests (Word 7)
Classic PLC-5 Processors
Bit
Description
S:7/8
S:7/9
S:7/10
S:7/11
S:7/12
S:7/13
S:7/14
S:7/15
Entering Parameters
7R SURJUDP D %7: RU %75 LQVWUXFWLRQ \RX PXVW SURYLGH WKH
SURFHVVRU ZLWK WKH IROORZLQJ LQIRUPDWLRQ WKDW LW VWRUHV LQ LWV
FRQWURO EORFN
5DFN LV WKH ,2 UDFN QXPEHU RFWDO RI WKH ,2 FKDVVLV LQ
ZKLFK \RX SODFHG WKH WDUJHW ,2 PRGXOH 7DEOH ( OLVWV WKH YDOLG
UDQJHV IRU UDFN QXPEHUV
Table 15.E
Valid Ranges for Rack Number in Block Transfer Instructions
Processor
00-03
PLC-5/25, -5/30
00-07
PLC-5/40, -5/40L
16
00-17
24
00-27
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-5
*URXS LV WKH ,2 JURXS QXPEHU ZKLFK VSHFLILHV WKH SRVLWLRQ
RI WKH WDUJHW ,2 PRGXOH LQ WKH ,2 FKDVVLV
0RGXOH LV WKH VORW QXPEHU ZLWKLQ WKH JURXS :KHQ XVLQJ
VORW DGGUHVVLQJ WKH VORW LV WKH ORZ VORW WKH VORW LV WKH KLJK
VORW <RX VKRXOG XVH IRU WKH PRGXOH ZKHQ XVLQJ RU VORW
DGGUHVVLQJ
,PSRUWDQW <RX FDQ XVH LQGLUHFW DGGUHVVHV IRU WKH FRQWURO EORFN
DGGUHVV LQ D %75 RU %7: LQVWUXFWLRQ
,PSRUWDQW ,Q D 3/& RU SURFHVVRU WKH EORFN
WUDQVIHU GDWD W\SH %7 PXVW EH XVHG IRU UDFN DGGUHVVHV
JUHDWHU WKDQ
7KH ILYHZRUG LQWHJHU 1 FRQWURO ILOH KDV WKH IROORZLQJ VWUXFWXUH
15 14 13 12
word 0 EN
ST DN ER
11 10 09 08 07 06 05 04 03 02 01 00
CO EW NR TO RW
rack
word 1
word 2
word 3
file-type number
word 4
element number
group
slot
)RU LQIRUPDWLRQ RQ WKH VWDWXV ELWV LQ ZRUG VHH SDJH IRU
LQIRUPDWLRQ RQ ZRUGV WKURXJK VHH SDJH
,PSRUWDQW <RX FDQQRW XVH LQGLUHFW DGGUHVVHV IRU WKH GDWD ILOH
DGGUHVV LQ D %75 RU %7: LQVWUXFWLRQ
The Processor:
1 to 64
15-6
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Yes
No
This Bit:
Is Set:
when the rung goes true. This bit shows that the instruction
is enabled (that the block transfer is in progress).
In non-continuous mode, the .EN bit remains set until the
block transfer finishes or fails and the rung goes false.
In continuous mode, once the .EN bit is set, it remains set
regardless of the rung condition.
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-7
This Bit:
Is Set:
Enable-waiting .EW
(bit 10)
if you reset the time out bit through ladder logic or data
monitor, the processor repeatedly tries to send a block
transfer request to an unresponsive module for four
seconds before setting the .ER bit.
If you set the .TO bit through ladder logic or data monitor,
the processor disables the four-second timer and requests
a block transfer one more time before setting the .ER bit.
15-8
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
BT Control Block
Description
Status bits
.RLEN
.DLEN
.FILE
.ELEM
Element number
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-9
Table 15.G
Enhanced PLC-5 Processor Block Transfer Error Codes
Error
Number:
Description:
not used
not used
The size of the block transfer plus the size of the index in the block transfer
data table was greater than the size of the block transfer data table file.
There was an invalid transfer of block transfer write data between the
adapter and the block transfer module.
The block transfer module requested a different length than the associated
block transfer instruction. This could happen if a 64-word block transfer
instruction was executed and the block transfer modules default length
was not 64 words.
Block transfer data was lost due to a bad communication channel. Possible
reasons are noise, bad connections, and loose wires. Check resistors.
The block transfer timeout, set in the instruction, timed out before
completion.
10
11
12
13
15-10
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-11
Figure 15.3
Timing Diagram for Status Bits in Continuous BTR and BTW Instructions
stage 3
EN
EW
ST
stage 2
stage 1
CO
DN
ER
Rung true
Request
enters the
queue
Instruction
begins
execution
Instruction
finishes
Rung false
Rung true
15-12
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Selecting Non-Continuous
Operation
EN
EW
ST
CO
DN
ER
Rung true
Request
enters the
queue
Instruction
begins
execution
Instruction
finishes
Rung false
Rung true
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-13
WUDQVIHU WLPH
Read:
250 + 11.2Q
Where:
Represents:
Transfer Time
7KH WUDQVIHU WLPH LQ PLOOLVHFRQGV EHWZHHQ WKH DFWLYH EXIIHU DQG WKH
PRGXOH VWDUWV ZKHQ WKH SURFHVVRU VHWV WKH VWDUW ELW DQG HQGV ZKHQ
WKH SURFHVVRU VHWV WKH GRQH ELW 7KH WUDQVIHU WLPH LV GHILQHG E\
WKHVH IRUPXODV
Write:
local
Read:
local
0.9 + 0.1W
13 + 30C + 0.3W
0.9 + 0.1W
Where:
Represents:
9 + 21.3C + 0.3W
15-14
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
WUDQVIHU WLPH
Transfer Time
7KH WUDQVIHU WLPH LQ PLOOLVHFRQGV EHWZHHQ WKH DFWLYH EXIIHU DQG WKH
PRGXOH VWDUWV ZKHQ WKH SURFHVVRU VHWV WKH VWDUW ELW DQG HQGV ZKHQ WKH
SURFHVVRU VHWV WKH GRQH ELW 7KH WUDQVIHU WLPH LV GHILQHG E\ WKLV
IRUPXOD VDPH IRU D UHDG RU ZULWH
local
4 + 8C + 0.3W
4 + 4.6C + 0.15W
4 + 3.2C + 0.075W
Where this:
Represents:
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Programming Examples
15-15
3URJUDP \RXU SURFHVVRU IRU EORFN WUDQVIHU XVLQJ RQH RI WKH IROORZLQJ
PHWKRGV EDVHG RQ \RXU DSSOLFDWLRQ UHTXLUHPHQWV 7DEOH +
Table 15.H
Block Transfer Programming Methods
If You Want to:
Bidirectional alternating
Bidirectional continuous*
Directional non-continuous
Directional repeating
Directional continuous*
* Only use continuous mode when you want a block transfer to continue executing even when
the logic which controls it is not being scanned.
15-16
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
BT10:0
EN
BTR
enable bit
BTW
enable bit
Precondition
BT10:1
EN
BT10:1
EN
BTW
enable bit
BTR
enable bit
BT10:0
EN
EN
3
2
0
BT10:0
N11:0
10
N0
DN
ER
BTW
BLOCK TRANSFER WRITE
Rack
Group
Module
Control Block
Data file
Length
Continuous
EN
3
2
0
BT10:1
N11:10
11
NO
DN
ER
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-17
BTW
enable bit
BT10:1
EN
BT10:1
EN
BTW
enable bit
BTR
enable bit
BT10:0
EN
EN
3
2
0
BT10:0
N11:0
10
N0
DN
ER
BTW
BLOCK TRANSFER WRITE
Rack
Group
Module
Control Block
Data file
Length
Continuous
EN
3
2
0
BT10:1
N11:10
11
NO
DN
ER
15-18
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Preconditions
Preconditions
Scan the rung once to start continuous block transfers. The continuous
operation starts on a false-to-true rung transition and continues,
whether or not the rungs are scanned again. To stop continuous
operation, use the Data Monitor to reset the continuous bit (.CO or
bit 11), or change the Continuous field in the instruction to NO.
BTR
BLOCK TRANSFER READ
Rack
Group
Module
Control Block
Data file
Length
Continuous
3
6
1
BT10:0
N7:100
0
YES
BTW
BLOCK TRANSFER WRITE
Rack
Group
Module
Control Block
Data file
Length
Continuous
3
6
1
BT10:1
N7:200
0
YES
BT10:0
BT10:1
BT10:1
U
EN
ER
These rungs will reset block transfers and should be placed in logic where rungs are
being scanned for error recovery. Your logic must rescan the block transfers with
preconditions true in order to restart continuous block transfers.
DN
ER
EN
BT10:0
U
EN
ER
EN
DN
ER
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-19
EN
2
5
1
BT10:0
N7:500
0
NO
DN
ER
EN
2
5
1
BT10:0
N7:500
0
NO
DN
ER
15-20
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Precondition
Use the same method for a BTW. Scan the rung once
to start continuous block transfers. The continuous
operation starts on a false-to-true rung transition and
continues, whether or not the rungs are scanned
again. To stop continuous operation, use the Data
Monitor to reset the continuous bit (.CO or bit 11), or
change the Continuous field in the instruction to NO.
BTR
error bit
BT10:0
BTR
BLOCK TRANSFER READ
Rack
Group
Module
Control Block
Data file
Length
Continuous
2
5
1
BT10:0
N7:500
0
YES
DN
ER
BTR
BT10:0 enable bit
U
ER
This rung will reset block transfers and should be placed in logic where rungs are being
scanned for error recovery. Your logic must rescan the block transfers with preconditions
true in order to restart continuous block transfers.
EN
EN
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-21
BT10:0
DN
BTR
done bit
BTR
BLOCK TRANSFER READ
Rack
Group
Module
Control Block
Data File
Length
Continuous
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Destination
Expression
EN
2
2
1
BT10:0
N7:400
4
NO
DN
ER
EN
R6:4
4
0
ALL
#N7:500
#N7:400
DN
ER
15-22
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
EN
DN
ER
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-23
15-24
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
$IWHU HQWHULQJ DQG DFFHSWLQJ WKH UXQJ FRQWDLQLQJ WKH &,2 LQVWUXFWLRQ
WKH GDWD PRQLWRU VFUHHQ IRU WKH &,2 LQVWUXFWLRQ OHWV \RX GLVSOD\ WKH
SDUDPHWHUV IRU WKH FRQWURO EORFN RI WKH FXUUHQW &,2 LQVWUXFWLRQ )URP
WKH GDWD PRQLWRU VFUHHQ \RX FDQ GHILQH WKH IROORZLQJ SDUDPHWHUV
7DEOH -
Table 15.J
CIO Instruction Control Block Parameters
If You Want to:
Toggle the control bit that the cursor is on. You can toggle
among the TO, EW, CO, ER, DN, ST, and EN bits.
Is Set:
when the rung goes true. The .EN bit is reset when the .DN bit or .ER bit is set.
This bit shows that the instruction is enabled.
when the processor begins executing the CIO instruction. The .ST bit is reset when the
.DN bit or .ER bit is set.
when the last word of the CIO instruction transferred. The .DN bit is reset the next time
the associated rung goes from false to true.
The .DN bit is only active in non-continuous mode.
when the processor detects that the message transfer failed. The .ER bit is reset the next
time the associated rung goes from false to true.
manually for repeated operation of the CIO instruction after the first scan, independent of
whether the processor continues to scan the rung.
when the processor detects that a message request entered the queue. The processor
resets the .EW bit when the .ST bit is set.
through ladder logic to stop processing the message. The processor sets the .ER bit.
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
15-25
CT Control Block:
Description:
Status bits
See Using Status Bits above.
.ERR
Error code
This is where the processor stores the error code if a problem occurs during
message transmission.
.RLEN
Requested length
This is the requested number of elements you wish to transfer with the
message instruction.
.DLEN
Done length
This is the number of elements the module actually transferred after the instruction
completes execution. This number should match the requested length (unless the
requested length is 0).
.FILE
File number
This number identifies the file number of the file from which the data is written or to
which the data is read. For example, the file number of N12:1 is 12.
.ELEM
Element number
This number identifies the starting word in the data file address. For example, in
N12:1, the word number is 1.
15-26
1RWHV
Block-Transfer Instructions BTR and BTW ControlNet I/O Transfer Instruction CIO
Chapter
16
Message (MSG)
Description:
MSG
SEND/RECEIVE MESSAGE
EN
Control Block
DN
ER
16-2
Entering Parameters
Processor
Series/Revision:
Processors:
Series A / revision M
Series A / revision J
PLC-5/30
Series A / revision H
PLC-5/11, -5/20
Series B / revision J
Series C / revision G
Series C / revision H
ControlNet PLC-5
Series D / revision A
6SHFLI\ D FRQWURO EORFN DGGUHVV ZKHQ \RX ILUVW HQWHU WKH 06*
LQVWUXFWLRQ 7KH FRQWURO EORFN LV ZKHUH DOO RI WKH LQIRUPDWLRQ UHODWLQJ
WR WKH PHVVDJH ZLOO EH VWRUHG $IWHU HQWHULQJ WKH FRQWURO EORFN WKH
SURJUDPPLQJ WHUPLQDO DXWRPDWLFDOO\ GLVSOD\V D GDWD HQWU\ VFUHHQ
IURP ZKLFK \RX HQWHU LQVWUXFWLRQ SDUDPHWHUV WKDW DUH VWRUHG DW WKH
FRQWURO EORFN DGGUHVV <RX FDQ DOVR XVH WKH GDWD PRQLWRU VFUHHQ IRU
WKH 06* LQVWUXFWLRQ WR HGLW VHOHFWHG SDUDPHWHUV
Classic PLC-5
16-3
<RX FDQQRW XVH LQGLUHFW DGGUHVVHV IRU WKH FRQWURO EORFN DGGUHVV LQ DQ
06* LQVWUXFWLRQ ,I \RX KDYH DQ 06* LQVWUXFWLRQ FUHDWHG ZLWK
YHUVLRQ RU HDUOLHU WKDW XVHV D FRQWURO EORFN ZLWK DQ LQGLUHFW
DGGUHVV \RX PXVW GHOHWH WKH LQVWUXFWLRQ DQG UHHQWHU LW ZLWKRXW DQ
LQGLUHFW DGGUHVV
)RU WKH 90( 3/& SURFHVVRUV WR GR WUDQVIHUV WR WKH 90(EXV WKH
06* LQVWUXFWLRQ PXVW EH SURJUDPPHG ZLWK DQ 0* FRQWURO EORFN
)RU &RQWURO1HW 3/& SURFHVVRUV WR SHUIRUP WUDQVIHUV RQ WKH
&RQWURO1HW QHWZRUN WKH 06* LQVWUXFWLRQ PXVW EH SURJUDPPHG ZLWK
DQ 0* GDWD W\SH LQ WKH FRQWURO EORFN
7KH FRQWURO EORFN VL]H YDULHV DFFRUGLQJ WR WKH OHQJWK RI WKH PHVVDJH
LI \RX FRPPXQLFDWH ZLWK D 3/& SURFHVVRU WKH FRQWURO ILOH ZLOO EH
DSSUR[LPDWHO\ RU ZRUGV ,I \RX FRPPXQLFDWH ZLWK D 3/&
3/& RU 3/& SURFHVVRU WKH FRQWURO ILOH ZLOO EH DSSUR[LPDWHO\
WR ZRUGV 7KLV VL]H LV GLVSOD\HG RQ WKH VFUHHQ LQ WKH BLOCK
SIZE ILHOG
Whether the MSG instruction performs a read or write operation and to what type of
processor the message is going to.
The data file address of the processor containing the message instruction. If the
MSG operation is write, this address is the starting word of the source file. If the
MSG operation is read, this address is the starting word of the destination file.
16-4
[F4] Local/Remote
[F6] Link ID
The remote link where the processor you want to communicate with resides. The
default is 0.
Toggles through DH, DH II, and other choices for what connects the remote link to
the local DH+.
The starting address of the source or destination file in the target processor.
The channel for message communications. Valid options are: 0, 1A (default), 1B, 2A,
2B, and 3A for the ASCII command.
,I \RX VHOHFW WKH $6&,, RSWLRQ XVLQJ WKH [F1] Command Type NH\
IRU XVH ZLWK 3/&9 GRLQJ UHDGZULWHV WR WKH 90(EXV WKH
VRIWZDUH GLVSOD\V D QHZ VFUHHQ IRU \RX WR HQWHU WKH WH[W IRU \RXU
$6&,, FRPPXQLFDWLRQV 5HIHU WR WKH 3/&90( 90(EXV
3URJUDPPDEOH &RQWUROOHUV 8VHU 0DQXDO IRU WKH V\QWD[ RI FRPPDQG
WH[W WR GR 90(EXV WUDQVIHUV
)RU &RQWURO &RSURFHVVRU GDWD WUDQVIHUV XVLQJ WKH 06* LQVWUXFWLRQ
XVH WKH IROORZLQJ FKRLFHV
3RUW QXPEHU $
16-5
Entering Parameters
7KH FRQWURO EORFN LV ZKHUH DOO RI WKH LQIRUPDWLRQ UHODWLQJ WR WKH
PHVVDJH LV VWRUHG (WKHUQHW PHVVDJH LQVWUXFWLRQV XVH WZR FRQVHFXWLYH
06* HOHPHQWVWKH ILUVW RQH FRQWDLQV WKH PHVVDJH LQIRUPDWLRQ WKH
VHFRQG RQH FRQWDLQV WKH GHVWLQDWLRQ DGGUHVV
,PSRUWDQW 6LQFH WKH (WKHUQHW PHVVDJHV QHHG WZR FRQVHFXWLYH
FRQWURO EORFNV WKH PHVVDJH FRQWURO EORFN WKDW \RX
VSHFLI\ PXVW VWDUW RQ DQ HYHQ QXPEHU
$77(17,21 :KLOH FRQILJXULQJ 06* LQVWUXFWLRQV
IRU WKH '+ DQG VHULDO OLQNV NHHS LQ PLQG WKH ILOHV XVHG
IRU (WKHUQHW 06* FRQWURO EORFNV
,I \RX FKRRVH D ILOH EHLQJ XVHG DV DQ (WKHUQHW FRQWURO
EORFN WKH SURJUDPPLQJ VRIWZDUH SURPSWV \RX WR
FKRRVH ZKHWKHU \RX ZDQW WR RYHUZULWH WKH ILOH ,I \RX
FKRRVH WR RYHUZULWH WKH ILOH XQSUHGLFWDEOH PDFKLQH
RSHUDWLRQ FRXOG RFFXU
$IWHU HQWHULQJ WKH FRQWURO EORFN WKH SURJUDPPLQJ WHUPLQDO
DXWRPDWLFDOO\ GLVSOD\V D GDWD HQWU\ VFUHHQ IURP ZKLFK \RX HQWHU
LQVWUXFWLRQ SDUDPHWHUV WKDW DUH VWRUHG DW WKH FRQWURO EORFN DGGUHVV
<RX PXVW HQWHU D SRUW QXPEHU RI WR HQDEOH D VSHFLDO VFUHHQ IRU
(WKHUQHW WUDQVIHUV
16-6
This Field:
Command Type
Whether the MSG instruction performs a read or write operation. The software
toggles between:
PLC-5 Typed Read
PLC-5 Typed Write
PLC-5 Typed Write to SLC
PLC-5 Typed Read from SLC
SLC Typed Logical Read
SLC Typed Logical Write
PLC-2 Unprotected Read
PLC-2 Unprotected Write
PLC-3 Word Range Read
PLC-3 Word Range Write
ASCII
PLC-5 Address
The data file address of the processor containing the message instruction. If the
MSG operation is write, this address is the starting word of the source file. If the
MSG operation is read, this address is the starting word of the destination file.
Size in Elements
IP Address
Destination Address
The starting address of the source or destination file in the target processor.
Port Number
Multihop
Select yes if you want to send the MSG instruction to a ControlLogix device. Then use
the Multihop tab to specify the path of the MSG instruction. For more information, see
Configuring an Ethernet Multihop MSG Instruction on page 16-9.
16-7
Entering Parameters
7KH FRQWURO EORFN LV ZKHUH DOO RI WKH LQIRUPDWLRQ UHODWLQJ WR WKH
PHVVDJH LV VWRUHG (WKHUQHW PHVVDJH LQVWUXFWLRQV XVH WZR FRQVHFXWLYH
06* HOHPHQWVWKH ILUVW RQH FRQWDLQV WKH PHVVDJH LQIRUPDWLRQ WKH
VHFRQG RQH FRQWDLQV WKH GHVWLQDWLRQ DGGUHVV
,PSRUWDQW 6LQFH WKH (WKHUQHW PHVVDJHV QHHG WZR FRQVHFXWLYH
FRQWURO EORFNV WKH PHVVDJH FRQWURO EORFN WKDW \RX
VSHFLI\ PXVW VWDUW RQ DQ HYHQ QXPEHU
$IWHU HQWHULQJ WKH FRQWURO EORFN WKH 3/& SURJUDPPLQJ VRIWZDUH
DXWRPDWLFDOO\ GLVSOD\V D GDWD HQWU\ VFUHHQ IURP ZKLFK \RX HQWHU
LQVWUXFWLRQ SDUDPHWHUV WKDW DUH VWRUHG DW WKH FRQWURO EORFN DGGUHVV
16-8
Command Type
Whether the MSG instruction performs a read or write operation. The software
toggles between:
PLC-5 Typed Read
PLC-5 Typed Write
PLC-5 Typed Write to SLC
PLC-5 Typed Read from SLC
SLC Typed Logical Read
SLC Typed Logical Write
PLC-2 Unprotected Read
PLC-2 Unprotected Write
PLC-3 Word Range Read
PLC-3 Word Range Write
ASCII
PLC-5 Address
The data file address of the processor containing the message instruction. If the MSG
operation is write, this address is the starting word of the source file. If the MSG
operation is read, this address is the starting word of the destination file.
Size in Elements
Host/IP Address
Destination Address
The starting address of the source or destination file in the target processor.
Port Number
The channel for message communications. The PLC-5 Ethernet Interface Module
communications use channel 3A.
5HPRYDO RI WKH 3/& (WKHUQHW ,QWHUIDFH 0RGXOH ZLOO QRW FKDQJH WKH
IRUPDW RI WKH 06* LQVWUXFWLRQV GHILQHG IRU WKH PRGXOH
16-9
7KH VHULHV ( UHYLVLRQ ' DQG ODWHU 3/& SURFHVVRUV FDQ FRPPXQLFDWH
RYHU (WKHUQHW ZLWK &RQWURO/RJL[ GHYLFHV RU WKURXJK D &RQWURO/RJL[
(WKHUQHW (1(7 PRGXOH WR RWKHU 3/& SURFHVVRUV <RX QHHG
HLWKHU DQ (WKHUQHW 3/& SURFHVVRU RU DQ\ 3/& SURFHVVRU ZLWK D
VHULHV $ UHYLVLRQ ( (1(7 VLGHFDU PRGXOH 7KH IROORZLQJ
GLDJUDP VKRZV DQ (WKHUQHW 3/& SURFHVVRU DQG WKH RWKHU 3/& DQG
6/& SURFHVVRUV LW FDQ FRPPXQLFDWH ZLWK XVLQJ D PXOWLKRS
06* LQVWUXFWLRQ
Ethernet PLC-5 processor
or PLC-5 processor with 1785-ENET sidecar
Ethernet
ControlLogix chassis
SLC 5/05 Processor
PLC-5 processor with
DH+
ControlNet
1785-ENET sidecar
16-10
This Field:
Command Type
PLC-5 Address
The PLC-5 data table address of the ControlNet processor. If the MSG operation is
write, this address is the starting word of the source file. If the MSG operation is read,
this address is the starting word of the destination file.
Size in Elements
Local Node
Destination Address
The starting address of the source or destination file in the target processor.
Port Number
The channel for message communications. The port number must be 2 for ControlNet.
Multihop
Select yes if you want to send the MSG instruction to a ControlLogix device. Then use
the Multihop tab to specify the path of the MSG instruction. For more information, see
Configuring an ControlNet Multihop MSG Instruction on page 16-11.
16-11
ControlNet
ControlLogix chassis
SLC 5/05 Processor
ControlNet PLC-5 processor
DH+
ControlNet
16-12
Is Set:
when the rung goes true. This bit shows that the instruction is enabled (that the
instruction is being executed). In non-continuous mode, .EN bit remains set until the
message is completed and the rung goes false. In continuous mode, once .EN bit is set, it
remains set regardless of the rung condition.
when the processor begins executing the MSG instruction. The .ST bit is reset when the
.DN bit or .ER bit is set.
when the last packet of the MSG instruction transferred. The .DN bit is reset the next
time the associated rung goes from false to true. The .DN bit is only active in
non-continuous mode.
when the processor detects that the message transfer failed. The .ER bit is reset the next
time the associated rung goes from false to true.
manually for repeated operation of the MSG instruction after the first scan, independent
of whether the processor continues to scan the rung. Reset the .CO bit if you want the
rung condition to initiate messages (return to non-continuous mode).
when the processor detects that a message request entered the queue. The processor
resets the .EW bit when the .ST bit is set.
if the target processor does not respond to the first MSG request. The .NR bit is reset
when the associated rung goes from false to true.
if you set the .TO bit through ladder logic, the processor stops processing the message
and sets the .ER bit (timeout error 55). A DH+ message time out in 30-60 seconds. A
ControlNet message will time out in 4 seconds
No Cache .NC
(ControlNet processors only)
if you set the .NC bit, the open connection is closed when the MSG is done. If this bit
remains reset, the connection remains open even when the MSG is complete.
16-13
Description
Control bits
0 - low byte
.ERR
Error code
2 - high byte
.RLEN
Requested length
2 - low byte
.DLEN
Done length
Internal data
16-14
Entering Parameters
Communication Command
7KH IROORZLQJ WDEOH GHVFULEHV WKH FRPPXQLFDWLRQ FRPPDQGV
Read data identified by a type code. This command reads data structures without you specifying the
actual word length. For example, if you choose a typed read of the PLC-5 timer data section with a
requested data size of 5 elements, the MSG instruction reads 15 words (5 timer structures of 3
words each).
Write data identified by a type code. This command writes data structures without you specifying the
actual word length.
Read 16-bit words from any area of the PLC-2 data table or PLC-2 compatibility file.
Write 16-bit words to any area of the PLC-2 data table or PLC-2 compatibility file.
Read data identified by a type code. This command reads data structures without specifying the actual
word length. This command provides additional data verification for communications between a PLC-5
and SLC 500 processor.1
Write data identified by a type code. This command writes data structures without specifying the actual
word length. This command provides additional data verification for communications between a PLC-5
and SLC 500 processor.1
Read a range of words, starting at the address specified for the external address in the MSG control file
and reading sequentially the number of words specified for the requested size field in the MSG control
file. The data that is read is stored, starting at the address specified fro the internal address in the MSG
control file. This is used for communicating between a PLC-5 and SLC 500 processor.1
Write a range of words, starting at the address specified for the internal address in the MSG control file
and writing sequentially the number of words specified for the requested size field in the MSG control file.
The data from the internal address is written, starting at the address specified for the external address in
the MSG control file. This is used for communicating between a PLC-5 and SLC 500 processor.1
Read a range of words, starting at the address specified for the external address in the MSG control file
and reading sequentially the number of words specified for the requested size field in the MSG control
file. The data that is read is stored, starting at the address specified for the internal address in the MSG
control file.
Write a range of words, starting at the address specified for the internal address in the MSG control file
and writing sequentially the number of words specified for the requested size field in the MSG control file.
The data from the internal address is written, starting at the address specified for the external address in
the MSG control file.
1The PLC-5 is limited to a maximum message of 103 words (206 bytes). The maximum message size for SLC 5/03 and SLC 5/04 processors is 103 words
(206 bytes). The maximum message size capability of all other SLC 500 processors is 41 words (82 bytes).
2
These commands are valid only with any SLC 5/04 and SLC 5/03 series C and later processors.
3
These commands are only valid with processors listed in the table on page 16-2.
<RX FDQ XVH WKH 7\SHG 5HDG DQG 7\SHG :ULWH FRPPDQGV WR WUDQVIHU
GDWD WDEOH VHFWLRQV ZLWKRXW FRXQWLQJ WKH DFWXDO ZRUGV SHU GDWD WDEOH
HOHPHQW <RX RQO\ KDYH WR VSHFLI\ WKH QXPEHU RI HOHPHQWV \RX ZDQW
WR WUDQVIHU )RU H[DPSOH LQ WKH GDWD WDEOH WLPHU VHFWLRQ RQH HOHPHQW
FRQWDLQV ZRUGV EXW LQ WKH ELQDU\ GDWD WDEOH VHFWLRQ RQH HOHPHQW
FRQWDLQV RQH ZRUG
16-15
To this Device:
Example Address:
PLC-5/250
1N0:0
PLC-5
the address
N7:0
1775-S5
$N7:0
1775-SR5
PLC-2 Unprotected Read
PLC-2 Unprotected Write
PLC-2
PLC-2
compatibles
025
PLC-5/250
1N7:0
PLC-5
$N7:0
1775-S5
1775-SR5
$N7:0
N7:0
1771-DMC
Control
Coprocessors
01
SLC 500
processors
the address
N7:0
the address
N7:0
16-16
<RX PXVW XVH WKH 0* GDWD W\SH IRU WKH 06* FRQWURO EORFN
Binary (B)
Bit
Integer (N)
Integer
Output (O)
Integer
Input (I)
Integer
Status (S)
Integer
ASCII (A)
ASCII
BCD (D)
Integer
Integer
String (ST)
String
BT control (BT)
Integer
Integer
Timer (T)
Timer
Counter (C)
Counter
Control (R)
Control
Float (F)
Float
Integer
Integer
16-17
See:
integer (N)
Table 16.B
message (MG)
Table 16.C
,I \RX DUH XVLQJ DQ LQWHJHU 1 ILOH W\SH \RX FDQ GR WKH IROORZLQJ
IURP WKH GDWD PRQLWRU VFUHHQ 7DEOH %
Table 16.B
Data Monitor Screen for the MSG Instruction N File Type
If You Want to:
,I \RX DUH XVLQJ DQ PHVVDJH 0* ILOH W\SH \RX FDQ GR WKH IROORZLQJ
IURP WKH GDWD PRQLWRU VFUHHQ 7DEOH &
Table 16.C
Data Monitor Screen for the MSG Instruction MG File Type
If You Want to:
16-18
16-19
Figure 16.1
Timing Diagram for Status Bits in Continuous MSG Instructions
EN
EW
A
ST
CO
DN
ER
Rung true
Data sent by
instruction
and received
in the queue
MSG begins
transmission
on network
MSG
transmission
completes
Rung false
Rung true
When the MSG transmission completes, the cycle starts over here without rung transitions
Selecting Non-Continuous
Operation
16-20
Rung true
Data sent by
instruction
and received
in the queue
MSG begins
transmission
on network
MSG
transmission
completes
Rung false
Rung true
MSG Timing
7LPLQJ VWDUWV ZLWK VHWWLQJ WKH HQDEOH ELW DQG HQGV ZLWK VHWWLQJ WKH
GRQH ELW LQ WKH ODGGHU SURJUDP RI WKH VWDWLRQ LQLWLDWLQJ WKH PHVVDJH
7KH RUGHU RI RSHUDWLRQ LV VKRZQ LQ 7DEOH '
16-21
Table 16.D
Message Instruction Operation
Receiving MSG
(Station A reading/receiving from Station B)
Sending MSG
(Station A writing/sending to Station B)
Formula:
Classic PLC-5
Enhanced PLC-5
ZKHUH
TP =
TT
OH
P
WRNHQ SDVV
PV
16-22
Error Codes
Table 16.E
Errors Detected By the Processor
Code:
Enhanced PLC-51
MG data type
Classic PLC-52
N data type
Ethernet Only
0037
55
0037
0083
131
0083
processor is disconnected
0089
137
0089
0092
146
0092
00D3
211
00D3
00D5
213
00D5
0200
0300
0400
0500
0600
0700
0800
hardware fault
1000
129
1000
2000
130
2000
3000
131
4000
132
4000
5000
133
5000
6000
134
6000
7000
135
7000
1
2
16-23
Code:
Enhanced PLC-51
MG data type
Classic PLC-52
N data type
Ethernet Only
8000
136
8000
9000
137
9000
B000
139
B000
F001
231
F001
F002
232
F002
incomplete address
F003
233
F003
incorrect address
F006
236
F006
F007
237
F007
F00A
240
F00A
F00B
241
F00B
F00C
242
F00C
F00D
243
F00D
request is redundant
F011
247
F011
F012
248
F012
00103
0010
00113
0011
00123
0012
0013
no such host
00143
0014
00153
0015
00163
0016
0017
00183
0018
00193
0019
001A3
001A
F01A
F01B
0013
0017
1Hexadecimal
16-24
Table 16.F
Errors Detected By the VME Processor
PLC-5/40V (hexadecimal
word 1 of the control block)
0000
success
0001
0002
0003
0004
0005
0006
0007
0008
0009
000A
000B
000C
000D
000E
Chapter
17
On Page:
ABL
17-4
ACB
17-5
ACI
17-6
ACN
17-7
AEX
17-7
AHL
17-8
AIC
17-9
ARD
17-10
ARL
17-12
ASC
17-14
ASR
17-15
AWA
17-15
Write a string
AWT
17-17
17-2
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
Description:
ASCII string
Description:
Found.FD (08)
Reserved
Unload.UL (10)
Error.ER (11)
The bit is set on the first scan of the instruction after it is completed.
Queue.EU (14)
Enable.EN (15)
The bit is set when the rung goes true and is reset after completion
of the instruction and the rung goes false.
Note: If this bit is set and the .DN and .ER bits are cleared, the
control word is cleared during prescan.
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-3
Description
Status Bits
.LEN
Word Length
.POS
Character Position
Length (.LEN)
7KLV LV WKH QXPEHU RI FKDUDFWHUV WKH RSHUDWLRQ LV WR EH SHUIRUPHG RQ
Position (.POS)
7KLV LV WKH FXUUHQW FKDUDFWHU QXPEHU ZKLFK WKH RSHUDWLRQ
KDV H[HFXWHG
Using Strings
<RX FDQ DGGUHVV VWULQJ OHQJWKV E\ DGGLQJ D /(1 WR DQ\ VWULQJ DGGUHVV
IRU H[DPSOH 67/(1
6WULQJ OHQJWKV PXVW EH EHWZHHQ DQG E\WHV ,Q JHQHUDO OHQJWKV
WKDW DUH RXWVLGH RI WKLV UDQJH FDXVH WKH SURFHVVRU WR VHW D PLQRU IDXOW
6 DQG WKH LQVWUXFWLRQ LV QRW H[HFXWHG
,PSRUWDQW <RX FRQILJXUH DSSHQG RU HQGRIOLQH FKDUDFWHUV RQ WKH
&KDQQHO &RQILJXUDWLRQ VFUHHQ 7KH GHIDXOW DSSHQG
FKDUDFWHUV DUH FDUULDJH UHWXUQ DQG OLQH IHHG WKH GHIDXOW
HQGRIOLQH WHUPLQDWLRQ FKDUDFWHU LV FDUULDJH UHWXUQ
)RU PRUH LQIRUPDWLRQ VHH \RXU VRIWZDUH XVHU PDQXDO
17-4
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
Description:
ABL
ASCII TEST FOR LINE
Channel
Control
Characters
EN
DN
ER
Entering Parameters
7R XVH WKH $%/ LQVWUXFWLRQ \RX PXVW VXSSO\ WKLV LQIRUPDWLRQ
Parameter:
Definition:
Channel
the number of the RS-232 port. (The only valid value is 0).
Control
Characters
Example:
ABL
I:012
[
EN
10
If input word 12, bit 10 is set, the processor
performs an ABL operation for channel 0.
Channel
Control
Characters
0
R6:32
DN
ER
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH FRQWURO HOHPHQW HQDEOH ELW
(1 LV VHW 7KH LQVWUXFWLRQ LV SXW LQ WKH $6&,, LQVWUXFWLRQ TXHXH WKH
(8 ELW LV VHW DQG SURJUDP VFDQ FRQWLQXHV 7KH LQVWUXFWLRQ LV WKHQ
H[HFXWHG SDUDOOHO WR SURJUDP VFDQ
7KH SURFHVVRU GHWHUPLQHV WKH QXPEHU RI FKDUDFWHUV XS WR DQG
LQFOXGLQJ WKH HQGRIOLQHWHUPLQDWLRQ FKDUDFWHUV DQG SXWV WKLV YDOXH
LQ WKH SRVLWLRQ ILHOG 7KH GRQH ELW LV WKHQ VHW ,I D ]HUR DSSHDUV LQ WKH
SRVLWLRQ ILHOG QR HQGRIOLQHWHUPLQDWLRQ FKDUDFWHUV ZHUH IRXQG 7KH
)' ELW LV VHW LI WKH SRVLWLRQ ILHOG ZDV VHW WR D QRQ]HUR YDOXH
:KHQ WKH SURJUDP VFDQV WKH LQVWUXFWLRQ DQG ILQGV WKH '1 ELW VHW WKH
SURFHVVRU WKHQ VHWV WKH (0 ELW 7KH (0 ELW DFWV DV D VHFRQGDU\ GRQH
ELW FRUUHVSRQGLQJ WR WKH SURJUDP VFDQ
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-5
Entering Parameters
7R XVH WKH $&% LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU WKH
IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Channel
the number of the RS-232 port (The only valid value in this field is 0).
Control
the address of a control file element used for control status bits.
Characters
the number of the characters in the buffer that the processor finds
(0-256). This field is display only.
Example:
ACB
I:012
[
ACB
ASCII CHARS IN BUFFER
Channel
Control
Characters
8VH WKH $&% LQVWUXFWLRQ WR VHH KRZ PDQ\ WRWDO FKDUDFWHUV DUH LQ WKH
EXIIHU 2Q D IDOVHWRWUXH WUDQVLWLRQ WKH V\VWHP GHWHUPLQHV WKH WRWDO
QXPEHU RI FKDUDFWHUV DQG UHSRUWV LW LQ WKH &KDUDFWHUV ILHOG 7KH VHULDO
SRUW PXVW EH LQ 8VHU PRGH
EN
10
If input word 12, bit 10 is set, the processor
performs an ACB operation for channel 0.
Channel
Control
Characters
0
R6:32
DN
ER
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH FRQWURO HOHPHQW HQDEOH ELW
(1 LV VHW :KHQ WKH LQVWUXFWLRQ LV SXW LQ WKH $6&,, LQVWUXFWLRQ
TXHXH WKH (8 ELW LV VHW DQG SURJUDP VFDQ FRQWLQXHV 7KH LQVWUXFWLRQ
LV WKHQ H[HFXWHG SDUDOOHO WR SURJUDP VFDQ
7KH SURFHVVRU GHWHUPLQHV WKH QXPEHU RI FKDUDFWHUV LQ WKH EXIIHU DQG
SXWV WKLV YDOXH LQ WKH SRVLWLRQ ILHOG 7KH GRQH ELW LV WKHQ VHW ,I D ]HUR
DSSHDUV LQ WKH SRVLWLRQ ILHOG QR FKDUDFWHUV ZHUH IRXQG 7KH )' ELW LV
VHW LI WKH SRVLWLRQ ILHOG ZDV VHW WR D QRQ]HUR YDOXH
:KHQ WKH SURJUDP VFDQV WKH LQVWUXFWLRQ DQG ILQGV WKH '1 ELW VHW WKH
SURFHVVRU WKHQ VHWV WKH (0 ELW 7KH (0 ELW DFWV DV D VHFRQGDU\ GRQH
ELW FRUUHVSRQGLQJ WR WKH SURJUDP VFDQ
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI
17-6
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
Description:
ACI
7KH SURFHVVRU VHDUFKHV WKH VRXUFH ILOH W\SH 67 IRU WKH ILUVW FKDUDFWHU
WKDW LV EHWZHHQ DQG $OO QXPHULF FKDUDFWHUV DUH H[WUDFWHG XQWLO D
QRQQXPHULF FKDUDFWHU RU WKH HQG RI WKH VWULQJ LV UHDFKHG &RPPDV
DQG VLJQV DUH DOORZHG LQ WKH VWULQJ
Source
Destination
Description:
Indicating:
S:0/0
Carry (C)
S:0/1
Overflow (V)
S:0/2
Zero (Z)
S:0/3
Sign (S)
Example:
ACI
I:012
[
[
10
STRING TO INTEGER
Source
Destination
ST38:90
N7:123
75
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-7
Description:
ACN
,I WKH UHVXOW LV ORQJHU WKDQ FKDUDFWHUV RQO\ WKH ILUVW DUH ZULWWHQ
WR WKH GHVWLQDWLRQ ILOH DQG WKH HUURU ELW 6 LV VHW $OVR LI WKH
OHQJWK RI HLWKHU VWULQJ LV LQYDOLG OHVV WKDQ ]HUR RU JUHDWHU WKDQ WKH
IDXOW ELW LV VHW DQG WKH VWULQJ DW WKH GHVWLQDWLRQ DGGUHVV LV QRW FKDQJHG
STRING CONCATENATE
Source A
Source B
Destination
Example:
I:012
ACN
STRING CONCATENATE
[
10
If input word 12, bit 10 is set, concatenate the string
in ST37:42 with the string in ST38:91 and store the
result in ST52:76
Source A
Source B
ST37:42
ST38:91
Destination
ST52:76
Description:
AEX
STRING EXTRACT
Entering Parameters
Source
Index
Number
Destination
7R XVH WKH $(; LQVWUXFWLRQ \RX PXVW SURYLGH WKH SURFHVVRU WKH
IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Source
Index
the starting position (from 1 to 82) of the portion of the string you want to
extract. (An index of 1 indicates the left-most character of the string.)
Number
Destination
the string element (ST) where you want the extracted string stored.
Example:
I:012
[
[
10
AEX
STRING EXTRACT
Source
Index
Number
Destination
ST38:40
42
10
ST52:75
17-8
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
7KH GHVWLQDWLRQ VWULQJ ZLOO QRW FKDQJH LQ DQ\ RI WKH DERYH LQVWDQFHV
EN
DN
ER
8VH WKH $+/ LQVWUXFWLRQ WR VHW RU UHVHW WKH 56 '75 DQG 576
KDQGVKDNH FRQWURO OLQHV IRU \RXU PRGHP 2Q D IDOVHWRWUXH WUDQVLWLRQ
WKH V\VWHP XVHV WKH WZR PDVNV WR GHWHUPLQH ZKHWKHU WR VHW RU UHVHW WKH
'75 DQG 576 OLQHV RU OHDYH WKHP XQFKDQJHG
,PSRUWDQW %HIRUH \RX XVH WKLV LQVWUXFWLRQ PDNH VXUH WKDW \RX GR
QRW FRQIOLFW ZLWK WKH DXWRPDWLF FRQWURO OLQHV RQ
\RXU PRGHP
Entering Parameters
7R XVH WKH $+/ LQVWUXFWLRQ \RX PXVW SURYLGH WKLV LQIRUPDWLRQ
Parameter:
Definition:
Channel
the number of the RS-232 port that you want to use. Currently, only
channel 0 can be set or reset.
AND Mask
the mask to reset the DTR and RTS control lines. Bit 0 corresponds
to the DTR line and bit 1 corresponds to the RTS line. A 1 at the
mask bit causes the line to be reset; a 0 leaves the line unchanged.
OR Mask
the mask to set the DTR and RTS control lines. Bit 0 corresponds to
the DTR line and bit 1 corresponds to the RTS line. A 1 at the mask
bit causes the line to be set; a 0 leaves the line unchanged.
Control
Channel Status
Bit
Line
RTS
DTR
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-9
I:012
[
[
10
If input word 12, bit 10 is set, bit 0 and bit 1 of the AND
mask is set to RESET (OFF) the DTR and RTS lines.
Channel status will display a 000D.
EN
0
0003
0000
R6:23
DN
ER
I:012
[
[
11
EN
0
0000
0003
R6:22
DN
ER
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI WKH
LQVWUXFWLRQ LV DERUWHG GXH WR SURFHVVRU PRGH FKDQJH
Description:
AIC
INTEGER TO STRING
Source
Destination
Example:
I:012
[
[
10
AIC
INTEGER TO STRING
Source
Destination
867
ST38:42
17-10
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
EN
DN
ER
8VH WKH $5' LQVWUXFWLRQ WR UHDG FKDUDFWHUV IURP WKH EXIIHU DQG VWRUH
WKHP LQ D VWULQJ 7R UHSHDW WKH RSHUDWLRQ WKH UXQJ PXVW JR IURP IDOVH
WR WUXH 7KH VHULDO SRUW PXVW EH LQ 8VHU PRGH
Entering Parameters
7R XVH WKH $5' LQVWUXFWLRQ SURYLGH WKH IROORZLQJ LQIRUPDWLRQ
Parameter:
Definition:
Channel
the number of the RS-232 port. (The only valid value is 0).
Control
the control file element used for the control status bits.
Destination
String Length
the number of characters you want to read from the buffer. The
maximum is 82 characters. If you specify a length larger than 82,
only 82 characters will be read. (If you specify 0, the string length
defaults to 82.)
Characters Read
the number of characters that the processor moved from the buffer
to the string (0 to 82). This field is display only.
Example:
ARD
ASCII READ
I:012
[
10
If input word 12, bit 10 is set, read 50 characters
from the buffer and move them to ST52:76.
Channel
Destination
Control
String Length
Characters Read
EN
0
ST52:76
R6:23
50
DN
ER
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH FRQWURO HOHPHQW HQDEOH ELW
(1 LV VHW 7KH LQVWUXFWLRQ LV SXW LQ WKH $6&,, LQVWUXFWLRQ TXHXH WKH
(8 ELW LV VHW DQG SURJUDP VFDQ FRQWLQXHV 7KH LQVWUXFWLRQ LV WKHQ
H[HFXWHG SDUDOOHO WR SURJUDP VFDQ
2QFH WKH UHTXHVWHG QXPEHU RI FKDUDFWHUV DUH LQ WKH EXIIHU WKH
FKDUDFWHUV DUH PRYHG WR WKH GHVWLQDWLRQ VWULQJ 7KH QXPEHU RI
FKDUDFWHUV PRYHG LV SXW LQ WKH SRVLWLRQ ZRUG RI WKH FRQWURO HOHPHQW
DQG WKH GRQH ELW LV VHW
:KHQ WKH SURJUDP VFDQV WKH LQVWUXFWLRQ DQG ILQGV WKH '1 ELW VHW WKH
SURFHVVRU WKHQ VHWV WKH (0 ELW 7KH (0 ELW DFWV DV D VHFRQGDU\ GRQH
ELW FRUUHVSRQGLQJ WR WKH SURJUDP VFDQ
<RX FDQ XVH WKH 8/ ELW WR WHUPLQDWH DQ $5' LQVWUXFWLRQ EHIRUH LW
FRPSOHWHV IRU H[DPSOH \RX PD\ ZDQW WR WHUPLQDWH WKH LQVWUXFWLRQ LI
\RX NQRZ WKDW WKH $6&,, GHYLFH FRQQHFWHG WR WKH SRUW LV QRW VHQGLQJ
GDWD RU LI WKH FRQQHFWLRQ EUHDNV DIWHU WKH LQVWUXFWLRQ VWDUWV H[HFXWLQJ
6HW WKH 8/ ELW LQ WKH FRQWURO VWUXFWXUH WKH (5 ELW LV WKHQ VHW
1785-6.1 November 1998
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-11
,PSRUWDQW :KHQ \RX VHW WKH 8/ ELW WKH LQVWUXFWLRQ GRHV QRW
WHUPLQDWH LPPHGLDWHO\ LW PD\ WDNH VHYHUDO VHFRQGV
,I DQ $5' LQVWUXFWLRQ VWDUWV H[HFXWLQJ ZLWK WKH 8/ ELW DOUHDG\ VHW DQG
WKHUH DUH QR FKDUDFWHUV LQ WKH EXIIHU WKH LQVWUXFWLRQ WHUPLQDWHV ,I DQ
$5' LQVWUXFWLRQ VWDUWV H[HFXWLQJ ZLWK WKH 8/ ELW DOUHDG\ VHW DQG
WKHUH DUH FKDUDFWHUV LQ WKH EXIIHU WKH LQVWUXFWLRQ SURFHHGV WR
QRUPDO FRPSOHWLRQ
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI
Figure 17.1
Example ARD Timing Diagram
Rung Condition
ON
OFF
ON
OFF
ON
OFF
Done Bit
Error Bit
(.DN or. ER)
ON
OFF
ON
OFF
1 2
3 4
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
17-12
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
EN
DN
ER
8VH WKH $5/ LQVWUXFWLRQ WR UHDG FKDUDFWHUV IURP WKH EXIIHU XS WR DQG
LQFOXGLQJ WKH HQGRIOLQH WHUPLQDWLRQ FKDUDFWHUV DQG VWRUH WKHP LQ D
VWULQJ 7KH HQGRIOLQH FKDUDFWHUV DUH VSHFLILHG RQ WKH &KDQQHO
&RQILJXUDWLRQ VFUHHQ WKH GHIDXOW LV D FDUULDJH UHWXUQ )RU PRUH
LQIRUPDWLRQ RQ FKDQQHO FRQILJXUDWLRQ VHH \RXU VRIWZDUH XVHU PDQXDO
7KH VHULDO SRUW PXVW EH LQ 8VHU PRGH
Entering Parameters
7R XVH WKH $5/ LQVWUXFWLRQ \RX PXVW SURYLGH WKLV LQIRUPDWLRQ
Parameter:
Definition:
Channel
the number of the RS-232 port. (The only valid value is 0).
Control
the address of the control file element used for the control status bits.
Destination
String Length
the number of characters (maximum 82) you want to read from the
buffer. If the processor finds the end-of-line characters before
reading the number of characters you specified, only those
characters read and the end-of-line are moved to the destination.
Characters
Read
the number of characters that the processor moved from the buffer
to the string (0 to 82). This field is display only.
Example:
I:012
[
10
If input word 12, bit 10 is set, read 18 characters
(or until end-of-line) from the buffer and move
them to ST52:72.
ARL
ASCII READ LINE
Channel
Destination
Control
String Length
Characters Read
EN
0
ST52:72
R6:23
18
DN
ER
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH FRQWURO HOHPHQW HQDEOH ELW
(1 LV VHW 7KH LQVWUXFWLRQ LV SXW LQ WKH $6&,, LQVWUXFWLRQ TXHXH WKH
(8 ELW LV VHW DQG SURJUDP VFDQ FRQWLQXHV 7KH LQVWUXFWLRQ LV WKHQ
H[HFXWHG SDUDOOHO WR SURJUDP VFDQ
2QFH WKH UHTXHVWHG QXPEHU RI FKDUDFWHUV RU WKH HQGRIOLQH
FKDUDFWHUV DUH LQ WKH EXIIHU DOO FKDUDFWHUV LQFOXGLQJ WKH HQGRIOLQH
FKDUDFWHUV DUH PRYHG WR WKH GHVWLQDWLRQ VWULQJ 7KH QXPEHU RI
FKDUDFWHUV PRYHG LV VWRUHG LQ WKH SRVLWLRQ ZRUG RI WKH FRQWURO HOHPHQW
DQG WKH GRQH ELW LV VHW
:KHQ WKH SURJUDP VFDQV WKH LQVWUXFWLRQ DQG ILQGV WKH '1 ELW VHW WKH
SURFHVVRU WKHQ VHWV WKH (0 ELW 7KH (0 ELW DFWV DV D VHFRQGDU\ GRQH
ELW FRUUHVSRQGLQJ WR WKH SURJUDP VFDQ
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-13
<RX FDQ XVH WKH 8/ ELW WR WHUPLQDWH DQ $5/ LQVWUXFWLRQ EHIRUH LW
FRPSOHWHV IRU H[DPSOH \RX PD\ ZDQW WR WHUPLQDWH WKH LQVWUXFWLRQ LI
\RX NQRZ WKDW WKH $6&,, GHYLFH FRQQHFWHG WR WKH SRUW LV QRW VHQGLQJ
GDWD RU LI WKH FRQQHFWLRQ EUHDNV DIWHU WKH LQVWUXFWLRQ VWDUWV H[HFXWLQJ
6HW WKH 8/ ELW LQ WKH FRQWURO VWUXFWXUH WKH (5 ELW LV WKHQ VHW
,PSRUWDQW :KHQ \RX VHW WKH 8/ ELW WKH LQVWUXFWLRQ GRHV QRW
WHUPLQDWH LPPHGLDWHO\ LW PD\ WDNH VHYHUDO VHFRQGV
,I DQ $5/ LQVWUXFWLRQ VWDUWV H[HFXWLQJ ZLWK WKH 8/ ELW DOUHDG\ VHW DQG
WKHUH DUH QR FKDUDFWHUV LQ WKH EXIIHU WKH LQVWUXFWLRQ WHUPLQDWHV ,I DQ
$5/ LQVWUXFWLRQ VWDUWV H[HFXWLQJ ZLWK WKH 8/ ELW DOUHDG\ VHW DQG
WKHUH DUH FKDUDFWHUV LQ WKH EXIIHU WKH LQVWUXFWLRQ SURFHHGV WR
QRUPDO FRPSOHWLRQ
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI WKH
FKDQQHO LV LQ V\VWHP PRGH RU VZLWFKHV WR V\VWHP PRGH WKH
SURFHVVRU VZLWFKHV WR SURJUDPWHVW PRGH RU LI WKH PRGHP LV ORVW
ZKHQ XVLQJ PRGHP FRQWURO
Figure 17.2
Example ARL Timing Diagram
Rung Condition
ON
OFF
ON
OFF
ON
OFF
Done Bit
Error Bit
(.DN or. ER)
ON
OFF
ON
OFF
1 2
3 4 5
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
17-14
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
STRING SEARCH
Entering Parameters
Source
Index
Search
Result
Definition:
Search
Source
the string you want to find when examining the search string.
Index
the starting position (from 1 to 82) of the portion of the search string you
want to search. An index of 1 indicates the left-most character.
Result
an integer address where the processor stores the position of the search
string where the source string begins. If no match is found, 0 is stored in
the result.
Example:
ASC
I:012
[
STRING SEARCH
[
10
Source
Index
Search
Result
ST38:40
35
ST52:80
N10:0
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-15
8VH WKH $65 LQVWUXFWLRQ WR FRPSDUH WZR $6&,, VWULQJV 7KH V\VWHP
ORRNV IRU D PDWFK LQ OHQJWK DQG XSSHUORZHU FDVH ,I WKH WZR VWULQJV
DUH LGHQWLFDO WKH UXQJ LV WUXH LI WKHUH DUH DQ\ GLIIHUHQFHV WKH UXQJ
LV IDOVH
Example:
ASR
O:013
01
ST37:42
ST38:90
If the string in ST37:42 is identical to the
string in ST38:90, set output bit O:013/01.
$Q LQYDOLG VWULQJ OHQJWK FDXVHV WKH SURFHVVRU WR VHW WKH IDXOW ELW
6 DQG WKH UXQJ LV IDOVH
EN
DN
ER
Entering Parameters
7R XVH WKH $:$ LQVWUXFWLRQ \RX PXVW SURYLGH WKLV LQIRUPDWLRQ
Parameter:
Definition:
Channel
the number of the RS-232 port. (The only valid value is 0).
Source
Control
the address of the control file element used for the control status bits.
String Length
Characters Sent
the number of characters that the processor sent to the display area
(0 to 82). Only after the entire string is sent is this field updated
(no running total for each character sent is stored). This field is
display only.
17-16
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
Example:
AWA
ASCII WRITE APPEND
I:012
[
[
10
Channel
Source
Control
String Length
Characters Sent
EN
0
ST37:42
R6:23
25
DN
ER
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH FRQWURO HOHPHQW HQDEOH ELW
(1 LV VHW 7KH LQVWUXFWLRQ LV SXW LQ WKH $6&,, LQVWUXFWLRQ TXHXH WKH
(8 ELW LV VHW DQG SURJUDP VFDQ FRQWLQXHV 7KH LQVWUXFWLRQ LV WKHQ
H[HFXWHG SDUDOOHO WR SURJUDP VFDQ
7ZHQW\ILYH FKDUDFWHUV IURP WKH VWDUW RI VWULQJ 67 DUH VHQW WR WKH
GLVSOD\ GHYLFH DQG WKHQ XVHUFRQILJXUHG DSSHQG FKDUDFWHUV DUH VHQW
7KH GRQH ELW LV VHW DQG D YDOXH RI LV VHQW WR WKH SRVLWLRQ ZRUG
:KHQ WKH SURJUDP VFDQV WKH LQVWUXFWLRQ DQG ILQGV WKH '1 ELW VHW WKH
SURFHVVRU WKHQ VHWV WKH (0 ELW WR DFW DV D VHFRQGDU\ GRQH ELW
FRUUHVSRQGLQJ WR WKH SURJUDP VFDQ
<RX FDQ XVH WKH 8/ ELW WR WHUPLQDWH DQ $:$ LQVWUXFWLRQ EHIRUH LW
FRPSOHWHV IRU H[DPSOH \RX PD\ ZDQW WR WHUPLQDWH WKH LQVWUXFWLRQ LI
\RX NQRZ WKDW WKH $6&,, GHYLFH FRQQHFWHG WR WKH SRUW FDQQRW DFFHSW
GDWD RU LI WKH FRQQHFWLRQ EUHDNV DIWHU WKH LQVWUXFWLRQ VWDUWV H[HFXWLQJ
6HW WKH 8/ ELW LQ WKH FRQWURO VWUXFWXUH WKH (5 ELW LV WKHQ VHW
,PSRUWDQW :KHQ \RX VHW WKH 8/ ELW WKH LQVWUXFWLRQ GRHV QRW
WHUPLQDWH LPPHGLDWHO\ LW PD\ WDNH VHYHUDO VHFRQGV
,I DQ $:$ LQVWUXFWLRQ VWDUWV H[HFXWLQJ ZLWK WKH 8/ ELW DOUHDG\ VHW
WKH LQVWUXFWLRQ DERUWV LPPHGLDWHO\
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI WKH
LQVWUXFWLRQ LV DERUWHG GXH WR SURFHVVRU PRGH FKDQJH RU LI WKH PRGHP
EHFRPHV ORVW ZKHQ XVLQJ PRGHP FRQWURO ,I WKH PRGHP ZDV DOUHDG\
ORVW WKH LQVWUXFWLRQ VWLOO H[HFXWHV
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-17
Figure 17.3
Example AWA Timing Diagram
Rung Condition
ON
OFF
ON
OFF
ON
OFF
Done Bit
Error Bit
(.DN or. ER)
ON
OFF
ON
OFF
1 2
3 4 5
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
EN
DN
ER
Entering Parameters
7R XVH WKH $:7 LQVWUXFWLRQ \RX PXVW SURYLGH WKLV LQIRUPDWLRQ
Parameters:
Definition:
Channel
the number of the RS-232 port. (The only valid value is 0).
Source
Control
the address of the control file element used for the control status file.
String Length
Characters Sent
the number of characters that the processor sent to the display area
(0 to 82). Only after the entire string is sent is this field updated
(no running total for each character sent is stored). This field is
display only.
17-18
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
Example:
AWT
I:012
[
[
10
ASCII WRITE
Channel
Source
Control
String Length
Characters Sent
EN
0
ST37:20
R6:23
40
DN
ER
:KHQ WKH UXQJ JRHV IURP IDOVH WR WUXH WKH FRQWURO HOHPHQW HQDEOH ELW
(1 LV VHW 7KH LQVWUXFWLRQ LV SXW LQ WKH $6&,, LQVWUXFWLRQ TXHXH WKH
(8 ELW LV VHW DQG SURJUDP VFDQ FRQWLQXHV 7KH LQVWUXFWLRQ LV WKHQ
H[HFXWHG SDUDOOHO WR SURJUDP VFDQ
)RUW\ FKDUDFWHUV IURP VWULQJ 67 DUH VHQW WKURXJK FKDQQHO 7KH
GRQH ELW LV VHW DQG D YDOXH RI LV VHQW WR WKH SRVLWLRQ ZRUG
:KHQ WKH SURJUDP VFDQV WKH LQVWUXFWLRQ DQG ILQGV WKH '1 ELW VHW WKH
SURFHVVRU WKHQ VHWV WKH (0 ELW 7KH (0 ELW DFWV DV D VHFRQGDU\ GRQH
ELW FRUUHVSRQGLQJ WR WKH SURJUDP VFDQ
<RX FDQ XVH WKH 8/ ELW WR WHUPLQDWH DQ $:7 LQVWUXFWLRQ EHIRUH LW
FRPSOHWHV IRU H[DPSOH \RX PD\ ZDQW WR WHUPLQDWH WKH LQVWUXFWLRQ LI
\RX NQRZ WKDW WKH $6&,, GHYLFH FRQQHFWHG WR WKH SRUW FDQQRW DFFHSW
GDWD RU LI WKH FRQQHFWLRQ EUHDNV DIWHU WKH LQVWUXFWLRQ VWDUWV H[HFXWLQJ
6HW WKH 8/ ELW LQ WKH FRQWURO VWUXFWXUH WKH (5 ELW LV WKHQ VHW
,PSRUWDQW :KHQ \RX VHW WKH 8/ ELW WKH LQVWUXFWLRQ GRHV QRW
WHUPLQDWH LPPHGLDWHO\ LW PD\ WDNH VHYHUDO VHFRQGV
,I DQ $:7 LQVWUXFWLRQ VWDUWV H[HFXWLQJ ZLWK WKH 8/ ELW DOUHDG\ VHW
WKH LQVWUXFWLRQ DERUWV LPPHGLDWHO\
7KH HUURU ELW (5 LV VHW GXULQJ WKH H[HFXWLRQ RI WKH LQVWUXFWLRQ LI WKH
SURFHVVRU VZLWFKHV WR SURJUDP RU WHVW PRGH RU LI WKH PRGHP EHFRPHV
ORVW ZKHQ XVLQJ PRGHP FRQWURO ,I WKH PRGHP ZDV DOUHDG\ ORVW WKH
LQVWUXFWLRQ VWLOO H[HFXWHV
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
17-19
Figure 17.4
Example AWT Timing Diagram
Rung Condition
ON
OFF
ON
OFF
ON
OFF
Done Bit
Error Bit
(.DN or. ER)
ON
OFF
ON
OFF
1 2
3 4 5
1 - rung goes true
2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
17-20
1RWHV
ASCII Instructions ABL, ACB, ACI, ACN, AEX, AIC, AHL, ARD, ARL, ASC, ASR, AWA, AWT
Chapter
18
See:
AGA3
AGA7
NX19
API
18-2
EN
ST
ER
WUDQVLWLRQDO
ES
FRPELQDWRULDO
This Type of
Logic Equation:
Does this:
Transitional
Combinatorial
,PSRUWDQW <RX FDQQRW XVH WKH %7 3' 0* 67 RU 6& GDWD W\SHV
ZLWKLQ WKH ,2 OLVW RI WKH 6'6 LQVWUXFWLRQ
,PSRUWDQW :KHQ \RX HQWHU WKH Control File DQG Step Desc.
File RSHUDQGV PDNH FHUWDLQ WKH ILOH QXPEHUV LH
DUH QRW WKH VDPH
)RU PRUH LQIRUPDWLRQ RQ WKH 6'6 LQVWUXFWLRQ VHH WKH 'LVWULEXWHG
'LDJQRVWLF DQG 0DFKLQH &RQWURO 8VHU 0DQXDO
ER
18-3
DODUPV
<RX FDQ XVH WKH ')$ LQVWUXFWLRQ WR JHQHUDWH PHVVDJHV ZKHQ D IDXOW
RFFXUV ,Q DGGLWLRQ \RX FDQ FUHDWH RWKHU W\SHV RI RSHUDWLRQDO DQG
GLDJQRVWLF PHVVDJHV ZLWK WKH ')$ LQVWUXFWLRQ VXFK DV WRRO FKDQJH
PHVVDJHV DQG RSHUDWLQJ LQVWUXFWLRQV
18-4
1RWHV
Appendix
GLUHFW DGGUHVVLQJ
QR GDWDW\SH FRQYHUVLRQV
DGGUHVVHV ZLWKLQ ILUVW ZRUGV RI WKH GDWD WDEOH IRU &ODVVLF
3/& SURFHVVRUV DGGUHVVHV ZLWKLQ ILUVW ZRUGV IRU
(QKDQFHG 3/& SURFHVVRUV
See Page:
A-2
A-5
A-10
A-13
A-2
Category
Relay
Code
True
False
True
Words of
Memory1
False
XIC
examine if closed
.32
.16
12
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
next branch
.16
.16
branch start
.16
.16
TON
3.8
4.1
2.6
2.5
2-3
TOF
2.6
2.6
3.2
3.2
2-3
RTO
retentive timer on
(0.01 base)
(1.0 base)
3.8
4.1
2.4
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
Branch
Title
Execution Time
(s) integer
2-3
(Continued)
Use the larger number for addresses beyond 2048 words in the processors data table.
)or every bit address above the first 256 words of memory in the data table, add 0.16 ms and 1 word of memory.
Category
Arithmetic
Code
Title
A-3
True
False
True
False
Words of
Memory1
ADD
add
6.1
1.4
14.9
1.4
4-7
SUB
subtract
6.2
1.4
15.6
1.4
4-7
MUL
multiply
9.9
1.4
18.2
1.4
4-7
DIV
divides
12.2
1.4
23.4
1.4
4-7
SQR
square root
9.9
1.3
35.6
1.3
3-5
NEG
negate
4.8
1.3
6.0
1.3
3-5
CLR
clear
3.4
1.1
3.9
1.1
2-3
AVE
average file
152+E25.8
30
162+E22.9
36
4-7
STD
standard deviation
321+E84.3
34
329+E77.5
34
4-7
TOD
convert to BCD
7.8
1.3
3-5
FRD
8.1
1.3
3-5
RAD
radian
57.4
1.4
50.1
1.4
3-5
DEG
degree
55.9
1.4
50.7
1.4
3-5
SIN
sine
414
1.4
3-5
COS
cosine
404
1.4
3-5
TAN
tangent
504
1.4
3-5
ASN
inverse sine
426
1.4
3-5
ACS
inverse cosine
436
1.4
3-5
ATN
inverse tangent
375
1.4
3-5
LN
natural log
409
1.4
403
1.4
3-5
LOG
log
411
1.4
403
1.4
3-5
XPY
X to the power of Y
897
1.5
897
1.5
4-7
SRT
sort file
(5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
3-5
278 + 16[E**1.35] 227
230 + 33[E**1.35] 189
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processors data table.
E = number of elements acted on per scan
SRT true is only an approximation. Actual time depends on the randomness of the numbers.
A-4
Category
Logic
Code
Title
True
False
True
Words of
Memory1
False
AND
and
5.9
1.4
4-7
OR
or
5.9
1.4
4-7
XOR
exclusive or
5.9
1.4
4-7
NOT
not
4.6
1.3
3-5
MOV
move
4.5
1.3
MVM
masked move
6.2
1.4
4-7
BTD
bit distributor
10.0
1.7
6-9
EQU
equal
3.8
1.0
4.6
1.0
3-5
NEQ
not equal
3.8
1.0
4.5
1.0
3-5
LES
less than
4.0
1.0
5.1
1.0
3-5
LEQ
4.0
1.0
5.1
1.0
3-5
GRT
greater than
4.0
1.0
5.1
1.0
3-5
GEQ
greater than or
equal
4.0
1.0
5.1
1.0
3-5
LIM
limit test
6.1
1.1
8.4
1.1
4-7
MEQ
mask compare
if equal
5.1
1.1
Compare
CMP
all
2+Wi
Compute
CPT
all
2+Wi
Move
Comparison
5.6
1.3
4-7
1.Use the larger number for addresses beyond 2048 words in the processors data table.
i = execution time of each instruction (operation, e.g. ADD, SUB, etc.) used within the CMP or the CPT expression
Wi = number of words of memory used by the instruction (operation, e.g. ADD, SUB, etc) within the CMP or CPT expression
CMP or CPT instructions are calculated with short direct addressing
3-5
A-5
File Instructions
5HIHU WR 7DEOH $% IRU WKH LQVWUXFWLRQ WLPLQJ IRU ILOH LQVWUXFWLRQV
Table A.B
Timing and Memory Requirements for File, Program Control, and ASCII
Instructions (Enhanced PLC-5 Processors)
Category
Code
Title
Time (s)
integer
True
False
Time (s)
floating point
True
Words of
Memory1
False
File
Arithmetic
and Logic
FAL
all
11 + ([2.3 + i])E
6.16 + Wi[0.16]
11 + ([2.3 + i])E
6.16 + Wi[0.16]
3-5 +Wi
File Search
and
Compare
FSC
all
11 + ([2.3 + i])E
6.16 + Wi[0.16]
11 + ([2.3 + i])E
6.16 + Wi[0.16]
3-5 +Wi
File
COP
copy
16.2+E[0.72]
1.4
17.8+E[1.44]
1.4
4-6
15.7+E[2.16]
1.4
fill
15.7+E[0.64]
1.5
18.1+E[0.80]
1.5
4-6
15.1+E[1.60]
1.5
BSL
10.6+B[0.025]
5.2
4-7
BSR
11.1 + B[0.025]
5.2
4-7
FFL
FIFO load
8.9
3.8
4-7
FFU
FIFO unload
10.0+E[0.43]
3.8
4-7
LFL
LIFO load
9.1
3.7
4-7
LFU
LIFO unload
10.6
3.8
4-7
FBC
0 mismatch
15.4 + B[0.055]
2.9
6-11
1 mismatch
22.4 + B[0.055]
2.9
2 mismatches
29.9+ B[0.055]
2.9
0 mismatch
15.4 + B[0.055]
2.9
1 mismatch
24.5 + B[0.055]
2.9
2 mismatches
34.2 + B[0.055]
2.9
data transitional
5.3
5.3
FLL
Shift
Register
Diagnostic
DDT
DTR
6-11
4-7
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processors data table.
i = execution time of each instruction (operation, e.g. ADD, SUB, etc.) used within the FAL or the FSC expression
E = number of elements acted on per scan
B = number of bits acted on per scan
Wi = number of words of memory used by the instruction (operation, e.g. ADD, SUB, etc.) within the FAL or FSC expression
FAL or FSC instructions are calculated with short direct addressing
A-6
Category
Sequencer
Immediate
I/O2
Code
Title
Time (s)
integer
True
False
Time (s)
floating point
True
False
Words of
Memory1
SQI
sequencer input
7.9
1.3
5-9
SQL
sequencer load
7.9
3.5
4-7
SQO
sequencer output
9.7
3.7
5-9
IIN
immediate input
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
1.1
357
307
immediate output
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
1.1
361
301
1.1
4-7
1.1
4-7
IOT
IDI
IDO
Zone
Control
MCR
master control
0.16
0.16
Program
Control
JMP
jump
LBL
label
0.32
0.32
2+position
in label table
JSR3/
RET
jump to subroutine/
return
PLC-5/11, -5/20,
-5/30, -5/40, -5/40L,
-5/60, -5/60L, -5/20E,
-5/40E
0 parameters
1 parameter
increase/parameter
PLC-5/80
0 parameters
1 parameter
increase/parameter
3+
parameters/
JSR
1+
parameters/
RET
12.3
16.1
3.8
1.0
1.0
n/a
n/a
17.3
5.0
n/a
1.0
n/a
315
340
31
1.0
1.0
n/a
349
33
1.0
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processors data table.
2.Timing for immediate I/O instructions is the time for the instruction to queue-up for processing
3.Calculate execution times as follows: (time) + (quantity of additional parameters)(time/parameter). For example, if you are passing 3 integer parameters in a JSR
within a PLC-5/11 processor, the execution time =16.1 + (2)(3.8)=23.7s.
B = number of bits acted on per scan
Category
Program
Control
Code
SBR
Title
A-7
Time (s)
integer
True
False
Time (s)
floating point
True
False
Words of
Memory1
0 parameters
12.3
1.0
1 parameter
16.1
1.0
increase/
parameter
3.8
END
end
negligible
TND
temporary end
EOT
end of transition
AFI
always false
0.16
0.16
ONS
one shot
3.0
3.0
2-3
OSR
6.2
6.0
4-6
OSF
6.2
5.8
4-6
FOR/
NXT
8.1+ L[15.9]
(151+L[277])
5.3 + N[0.75]
(152+N[6.1])
FOR 5-9
NXT 2
BRK
break
11.3 + N[0.75]
0.9
UID
1.0
175
119
1.0
170
100
UIE
1+
parameters
17.3
1.0
5.0
1
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processors data table.
L = number of FOR/NXT loops
N = number of words in memory between FOR/NXT or BRK/NXT
A-8
Category
Process
Control
Code
PID
Gains
Time (s)
integer
True
Cascade
ABL2
ACB 2
ACI
False
Time (s)
floating point
True
False
882
ISA
(-5/11, -5/20, -5/20E, 560
-5/20C)
(-5/30, -5/40, -5/40E, 895
-5/40C, -5/40L, -5/60,
-5/60C, -5/60L, -5/80,
-5/80E, -5/80C)
1142
Manual
(-5/11, -5/20, -5/20E, 372
-5/20C)
(-5/30, -5/40, -5/40E, 420
-5/40C, -5/40L, -5/60,
-5/60C, -5/60L, -5/80,
-5/80E, -5/80C)
900
Set Output
(-5/11, -5/20, -5/20E, 380
-5/20C)
(-5/30, -5/40, -5/40E, 440
-5/40C, -5/40L, -5/60,
-5/60C, -5/60L, -5/80,
-5/80E, -5/80C)
882
Slave
1286
Master
840
Words of
Memory1
5-9
Independent
(-5/11, -5/20, -5/20E, 462
-5/20C)
(-5/30, -5/40, -5/40E, 655
-5/40C, -5/40L, -5/60,
-5/60C, -5/60L, -5/80,
-5/80E, -5/80C)
Modes
ASCII2
Title
58
3-5
316
388
214
150
3-5
316
389
214
150
1.4
3-5
220 + C[11]
140 + C[21.4]
(Continued)
1.Use the larger number for addresses beyond 2048 words in the processors data table.
2.Timing for ASCII instructions is the time for the instruction to queue-up for processing in channel 0.
Category
ASCII2
Code
ACN
AEX
AHL2
AIC
ARD2
ARL2
ASC
ASR
AWA2
AWT2
Title
A-9
Time (s)
integer
True
False
Time (s)
floating point
True
False
Words of
Memory1
1.9
4-7
1.9
5-9
string concatenate
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
237 + C[2.6]
179 + C[5.5]
string extract
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
226 + C[1.1]
159 + C[2.2]
318
526
integer to string
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
260
270
read characters
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
315
380
214
149
read line
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
316
388
214
151
string search
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
222 + C[1.7]
151 + C[3.0]
string compare
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
234 + C[1.3]
169 + C[2.4]
202
119
319
345
215
154
write
(-5/11, -5/20)
(-5/30, -5/40, -5/60,
-5/80)
318
344
215
151
5-9
213
157
1.4
3-5
4-7
4-7
1.9
5-9
3-5
4-7
4-7
1.Use the larger number for addresses beyond 2048 words in the processors data table.
2.Timing for ASCII instructions is the time for the instruction to queue-up for processing in channel 0.
C = number of ASCII characters
A-10
Category
Relay
Code
1
2
True
False
True
Words of Memory1
False
XIC
examine if closed
1.3
0.8
12
XIO
examine if open
1.3
0.8
12
OTL
output latch
1.6
0.8
12
OTU
output unlatch
1.6
0.8
11
OTE
output energize
1.6
1.6
12
branch end
0.8
0.8
next branch
0.8
0.8
branch start
0.8
0.8
TON
timer on
(0.01 base)
(1.0 base)
39
44
27
28
2-3
TOF
timer off
(0.01 base)
(1.0 base)
30
30
43
51
2-3
RTO
retentive timer on
(0.01 base)
(1.0 base)
39
44
24
24
CTU
count up
32
34
2-3
CTD
count down
34
34
2-3
RES
reset
30
14
2-3
Branch
Title
2-3
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
For every bit address above the first 256 words of memory in the data table, add 0.8 s to the execution time and 1 word of memory to the requirements.
(Continued)
Category
Arithmetic
Logic
Move
Comparison
Code
Title
A-11
True
False
True
False
Words of Memory1
ADD
add
36
14
92
14
4-7
SUB
subtract
36
14
92
14
4-7
MUL
multiply
41
14
98
14
4-7
DIV
divide
49
14
172
14
4-7
SQR
square root
82
14
212
14
3-5
NEG
negate
28
14
36
14
3-5
CLE
clear
18
14
23
14
2-3
TOD
convert to BCD
52
14
3-5
FRD
44
14
3-5
AND
and
36
14
4-7
OR
or
36
14
4-7
XOR
exclusive or
36
14
4-7
NOT
not
27
14
3-5
MOV
move
26
14
MVM
masked move
55
14
EQU
equal
32
14
42
14
3-5
NEQ
not equal
32
14
42
14
3-5
LES
less than
32
14
42
14
3-5
LEQ
32
14
42
14
3-5
GRT
greater than
32
14
42
14
3-5
GEQ
32
14
42
14
3-5
LIM
limit test
42
14
60
14
4-7
MEQ
41
14
35
14
3-5
6-9
4-7
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
(Continued)
A-12
Category
Compute
Compare
Code
CPT
CMP
True
False
True
False
add
67
34
124
34
6-9
subtract
67
34
124
34
6-9
multiply
73
34
130
34
6-9
divide
80
34
204
34
6-9
square root
113
33
244
34
5-7
negate
59
33
68
34
5-7
clear
49
30
55
34
4-5
move
58
33
5-7
convert to BCD
84
33
5-7
75
33
5-7
AND
68
34
6-9
OR
68
34
6-9
XOR
68
34
6-9
NOT
59
34
5-7
equal
63
34
73
34
5-7
not equal
63
34
73
34
5-7
less than
63
34
73
34
5-7
63
34
73
34
5-7
greater than
63
34
73
34
5-7
63
34
73
34
5-7
Title
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
Words of Memory1
A-13
File Instructions
7KH LQVWUXFWLRQ WLPLQJ IRU ILOH LQVWUXFWLRQV GHSHQGV RQ WKH GDWD W\SH
QXPEHU RI ILOHV DFWHG RQ SHU VFDQ QXPEHU RI HOHPHQWV DFWHG RQ SHU
VFDQ DQG ZKHWKHU WKH LQVWUXFWLRQ FRQYHUWV GDWD EHWZHHQ LQWHJHU DQG
IORDWLQJ SRLQW IRUPDWV
Table A.D
Timing and Memory Requirements for File Instructions
(Classic PLC-5 Processors)
Category
Code
FAL
Time (s)
integer
Time (s)
floating point
Time (s)
integer or
floating point
True
True
False
add
98 + W[36.7 + N]
98 + W[95.1 + N]
54
7-12
subtract
98 + W[36.7 + N]
98 + W[95.1 + N]
54
7-12
multiply
98 + W[42.5 + N]
98 + W[101.2 + N]
54
7-12
divide
98 + W[51.1 + N]
98 + W[180.3 + N]
54
7-12
square root
98 + W[84.7 + N]
98 + W[220.5 + N]
54
6-10
negate
98 + W[29.2 + N]
98 + W[37.2 + N]
54
6-10
clear
98 + W[18.4 + N]
98 + W[24.0 + N]
54
5-8
move
98 + W[27.3 + N]
98 + W[36.2 + N]
54
6-10
convert to BCD
98 + W[54.3 + N]
54
6-10
98 + W[45.4 + N]
54
6-10
Title
Words of
Memory1
1
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
W = number of elements acted on per scan
N = 2 (number of integer file addresses) + 8 (number of floating-point file addresses) + 6 (number of timer, counter, or control file addresses) + (
number of
conversions between integer and floating point formats)
(Continued)
A-14
Category
Code
Title
Time (s)
integer
Time (s)
floating point
Time (s)
integer or
floating point
True
True
False
Words of
Memory1
AND
98 + W[37.2 + N]
54
7-12
OR
98 + W[37.2 + N]
54
7-12
XOR
98 + W[37.2 + N]
54
7-12
NOT
98 + W[28.2 + N]
54
6-10
FSC
all comparisons
93 + W[32.7 +N]
93 + W[43.3 +N]
54
6-10
File
COP
copy
88 + 2.7W
104 + 3.8W
20
4-7
98 + 5.8W
fill
81 + 2/.1 W
100 + 3.1W
15
4-7
97 + 4.4W
BSL
74 + 3.4W
57
4-7
BSR
78 + 3.0W
57
4-7
FFL
FIFO load
54
44
4-7
FFU
FIFO unload
68 + 3.2W
46
4-7
FBC
FLL
Shift Register
Diagnostic
DDT
6-11
0 mismatch
75 + 6W
31
1 mismatch
130 + 6W
31
2 mismatches
151 + 6W
31
diagnostic detect
6-11
0 mismatch
71 + 6W
31
1 mismatch
150 + 6W
31
2 mismatches
161 + 6W
1
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
W = number of elements acted on per scan
N = 2 (number of integer file addresses) + 8 (number of floating-point file addresses) + 6 (number of timer, counter, or control file addresses) + (
number of
conversions between integer and floating point formats)
(Continued)
Category
Code
Title
Zone Control
MCR
master control
Immediate I/O
IIN
immediate input
IOT
Sequencer
Time (s)
integer
Time (s)
floating point
Time (s)
integer or
floating point
True
True
False
12
18
Words of
Memory1
1
2-3
local
196
16
remote
204
16
immediate output
2-3
local
202
16
remote
166
16
SQI
sequencer input
57
14
5-9
SQL
sequencer load
55
42
4-7
SQO
sequencer output
77
42
5-9
JMP
jump
45
15
2-3
JSR
jump to subroutine
SBR
0 parameters
56
15
2-3
1 parameter
91
15
3-5
21
RET
LBL
1
A-15
48
13
1 parameter
70
13
2-3
21
label
12
12
Use the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
(Continued)
A-16
Category
Code
Miscellaneous
1Use
Title
Time (s)
integer
Time (s)
floating point
Time (s)
integer or
floating point
True
True
False
END
end
negligible
negligible
TND
temporary end
negligible
15
AFI
always false
15
13
ONS
one shot
28
30
2-3
DTR
data transitional
41
41
4-7
BTD
bit distributor
77
14
6-11
PID
608
34
5-9
BTR
BTW
MSG
message
See chapter 15
See chapter 16
the smaller number if all addresses are below word 4096; use the larger number if all addresses are above 4096.
Words of
Memory1
A-17
Program Constants
Addressing Mode
Data Type
Modifier in sec
(add for each
operand)
Direct
Integer
Float
0
0
Index
Integer
Float
Counter-Timer-Control
1.1
1.8
2.4
Immediate
Integer
Float
0.24
1.0
Indirect
6.6 + W[0.09]
Float-to-integer
5.6
Integer-to-float
8.4
A-18
Destination
(floating point to integer)
0-2K
2-4K
4K+
0-2K
2-4K
4K+
integer
floating point
data conversion
10
33
34
35
Data Type
V
V
V
V
V
V
,I WKH ILOH DGGUHVV FRQWDLQV WZR LQGLUHFW DGGUHVVHV DGG RQO\ RQH YDOXH
WKH ODUJHVW )RU H[DPSOH IRU )>1@>1@ DGG V LQGLUHFW
IORDWLQJ SRLQW ILOH DGGUHVV
A-19
0XOWLSO\ WKH DGGLWLRQDO WLPH E\ WKH QXPEHU RI HOHPHQWV LQ WKH ILOH IRU
DQ\ W\SH RI ILOH RU ILOH DGGUHVV )RU H[DPSOH
([SUHVVLRQ 1>1@
)
DGG IRU FRQYHUWLQJ WR IORDWLQJ SRLQW
DGG IRU LQGLUHFW DGGUHVV
'HVWLQDWLRQ 1
DGG IRU FRQYHUWLQJ WR LQWHJHU
)$/ PXOWLSO\ :> 1 LQGLUHFW DGGUHVVLQJ@
1
:
([HFXWLRQ WLPH LQ $// PRGH
> @
V
Data Type
57
60
60
63
64
66
Integer (N)
42
42
43
44
61
64
71
77
85
81
A-20
Time (milliseconds)
Housekeeping
4.5 max
Appendix
SFC Reference
Appendix Objectives
8VH WKLV DSSHQGL[ WR PDNH VXUH \RXU 6)& PHHWV \RXU SURFHVVRUV
UHTXLUHPHQWV DQG WR PDNH VXUH \RXU 6)& UXQV WKH ZD\ \RX H[SHFW
7KLV DSSHQGL[ GLVFXVVHV
PHPRU\ DOORFDWLRQ
G\QDPLF FRQVWUDLQWV
VFDQQLQJ VHTXHQFHV
UXQ WLPHV
7DEOH %$ OLVWV WKH ZRUGV DQG ELWV LQ WKH SURFHVVRU VWDWXV ILOH 6 WKDW
FRQWDLQ 6)& LQIRUPDWLRQ
Table B.A
SFC Status Words
Word:
Title:
Description:
S:1/15
First pass
Set:
Reset:
S:8
Current program
scan time
S:9
Maximum program
scan time
S:11/3
SFC fault
Set:
Reset:
S:11/5
Start up fault
Set:
Reset:
B-2
SFC Reference
Word:
Title:
Description:
S:12
Fault codes
74
75
77
78
79
S:13
Faulted File
Number
S:14
Faulted Rung
Number
S:26/0 *
Restart/continue
Set:
Reset:
S:26/1 *
Start-up protection
after power loss
Set:
Reset:
S:28 *
Program
watchdog setpoint
S:79 *
(except
for scan
time)
S:127
SFC Reference
B-3
7KH PHPRU\ UHTXLUHPHQWV IRU \RXU 6)& GHSHQG RQ WKH VWUXFWXUHV \RX
XVH 7DEOH %% VKRZV HVWLPDWHG ZRUG XVDJH IRU 6)& VWUXFWXUHV
Memory Allocation
Table B.B
SFC Memory Usage
Uses this Amount of Memory:
This Structure:
Classic PLC-5 Processor
2 words
19 words
8 words
16 + 6a words
a = number of actions in step
6 words
each action
5n + 5 words
n = number of
branches
11 + 6a + 7n
a = number of actions in step
n = number of paths
each simultaneous
branch, diverging
n + 1 word
n = number of
branches
3n + 1
each simultaneous
branch, converging
n2 + 6n + 3 words
n = number of
branches
5 + 11n + 6a
a = number of actions in all
converging
steps for that simultaneous
branch
n = number of paths
each label or
GOTO statement
1 word
1 word
3 words
3 words
n = number of paths
B-4
SFC Reference
Figure B.1
Sample SFC and Memory Requirements
step/transition pair
8 words
one action/step
a=1
16 + 6a=22 words
simultaneous diverge
n=2
n +1 = 3 words
simultaneous diverge
n=2
3n +1 = 7 words
selection branch
n=3
5n + 5 = 20
selection branch
n=3 a=1
11 + 6a + 7n = 38 words
3 step/transition pairs
3 x 8 = 24 words
3 step/transition pairs a =1
3 (16 + 6a) = 66 words
simultaneous converge
n=2
n2 + 6n + 3 = 19 words
simultaneous converge
n=2 a=2
5 + 11n + 6a = 39 words
step/transition
8 words
one action/step a = 1
16 + 6a = 22 words
SFC Reference
B-5
,I \RX DUH XVLQJ D &ODVVLF 3/& SURFHVVRU DQG \RXU 6)& KDV PRUH
WKDQ SDUDOOHO SDWKV \RX QHHG WR GHWHUPLQH WKH QXPEHU RI SDUDOOHO
SDWKV WKDW FRXOG EH DFWLYH DW RQH WLPH 7KH G\QDPLF OLPLW LV SDUDOOHO
SDWKV DFWLYH DW WKH VDPH WLPH IRU D &ODVVLF 3/& SURFHVVRU
:KHQ D WUDQVLWLRQ JRHV WUXH PRPHQWDULO\ ERWK WKH SUHYLRXVO\ DFWLYH
VWHSV QRZ ZDLWLQJ IRU SRVWVFDQ DQG WKH QHZO\ DFWLYH VWHSV DUH RQ
WKH H[HFXWLRQ TXHXH WRJHWKHU <RX FDQ KDYH XS WR SDUDOOHO DFWLYH
VWHSV DV ORQJ DV \RX FDQ JXDUDQWHH WKDW QR PRUH WKDQ RQH WUDQVLWLRQ
JRHV WUXH DW RQH WLPH
'HWHUPLQH WKH QXPEHU RI DFWLYH VWHSV E\ FRXQWLQJ WKH VWHSV RQ HDFK
VLGH RI WKH WUDQVLWLRQV WKDW FRQWURO WKH ZLGHVW DUHD RI WKH 6)& )RU
H[DPSOH WUDQVLWLRQV WKDW DUH WUXH DW WKH VDPH WLPH DFFRXQW IRU DW
OHDVW VLPXOWDQHRXV DFWLYH VWHSV ,I DQ\ QHZ VLPXOWDQHRXV
GLYHUJHQFHV IROORZ RQH RI WKHVH WUDQVLWLRQV WKH PD[LPXP RI
DFWLYH SDWKV LV H[FHHGHG
,I WKH IXQFWLRQ FKDUW LQ )LJXUH % LV DW WKH SRLQW ZKHUH DOO VKDGHG
VWHSV DUH DFWLYH DQG DOO RI WKH WUDQVLWLRQV IROORZLQJ WKRVH VWHSV
EHFRPH WUXH DW WKH VDPH WLPH WKH V\VWHP DWWHPSWV WR KDYH DFWLYH
VWHSV IRU SRVWVFDQ IRU ILUVW VFDQ DQG WKH SURFHVVRU ZLOO IDXOW
B-6
SFC Reference
Figure B.2
Dynamic Limit of Active Steps Could Be Exceeded
(Classic PLC-5 Processors)
SFC Reference
Scanning Sequences
B-7
7KH SURFHVVRU VFDQV WKH 6)& IURP WRS WR ERWWRP OHIW WR ULJKW :KHQ
WKH VFDQ HQFRXQWHUV DFWLYH SDUDOOHO VWHSV WKH SURFHVVRU UXQV WKH ODGGHU
ORJLF LQ WKH OHIWPRVW VWHS ILUVW WKHQ PRYHV WR WKH ODGGHU ORJLF LQ WKH
QH[W SDUDOOHO VWHS XQWLO DOO DFWLYH VWHSV DUH UXQ 7KH SURFHVVRU
UHFRJQL]HV SDUDOOHO VWHSV E\ WKHLU SRVLWLRQ ZLWK UHVSHFW WR WKHLU
FRPPRQ GLYHUJHQFH QRW QHFHVVDULO\ E\ WKHLU SRVLWLRQ RQ WKH VFUHHQ
pA postcan of step A
X0
Xn transition scan
F false
T true
X1
F
A
I/O
hk
X0
T
scan of step A
hk
pA
I/O
hk
hk
X1
pB
15556
B-8
SFC Reference
//
X0
X1
X2
X7
%HFDXVH RQO\ RQH SDWK LV DFWLYH WKH VFDQ VHTXHQFH IRU WKH
FRQYHUJHQFH LV WKH VDPH DV IRU D VWHS DQG WUDQVLWLRQ )LJXUH %
VKRZV WKH VFDQ VHTXHQFH IRU WKH GLYHUJHQFH DQG FRQYHUJHQFH RI D
VHOHFWHG EUDQFK
SFC Reference
B-9
Figure B.5
Scan Sequence for a Selected Branch - Divergence and Convergence
A
scan of step A
pA postcan of step A
X0
X1
oh overhead
X2
Xn transition scan
F false
T true
n transition number
X3
F
F
hk
oh X1
hk
I/O
pA
I/O
hk
hk
X3
pC
X0
hk
pA
I/O
hk
hk
X2
pB
15557
//
B
2Q VXEVHTXHQW VFDQV WKH SURFHVVRU VFDQV LQ WKH RUGHU RI VWHS ,2 DQG
WUDQVLWLRQ IRU HDFK SDWK VWDUWLQJ IURP WKH OHIW
B-10
SFC Reference
//
7KH FRPPRQ WUDQVLWLRQ FDQQRW JR WUXH XQWLO WKH SURFHVVRU VFDQV DOO WKH
VWHSV LQ WKH VLPXOWDQHRXV EUDQFK DW OHDVW RQFH 2QFH WKH WUDQVLWLRQ
JRHV WUXH WKH SURFHVVRU GRHV QRW VFDQ WKH UHPDLQLQJ SDWKV LQ WKH
EUDQFK WKH SURFHVVRU SRVWVFDQV HDFK VWHS LQ WKH EUDQFK )LJXUH %
VKRZV WKH VFDQ VHTXHQFH IRU WKH GLYHUJHQFH DQG FRQYHUJHQFH RI D
VHOHFWHG EUDQFK
Figure B.8
Scan Sequence for a Simultaneous Branch Divergence and
Convergence
A
A
X0
scan of step A
pA postcan of step A
I/O I/O scan
hk housekeeping**
Xn transition scan
F false
T true
X1
Classic Processors: maximum of 7 selections
oc convergence overhead
od divergence overhead
hk
X1
F
F
I/O
hk
T hk
pB
oc
pC
X1
A I/O
X0
T
hk
pA
od
I/O
hk
I/O
T
X1
T
hk
pB
oc
hk
pB
oc
pC
pC
15558
SFC Reference
B-11
X1
X0
B
C
X3
X2
D
X4
X5
F
E
X6
H
J
X7
X9
I
X8
K
X10
end
B-12
SFC Reference
Figure B.10
Scan Sequence Example for the Example SFC
F hk
F oh
X2
F hk
T h k p A D I /O
F hk
X5
T h k p D J I /O
F oh
X1
X9
T hk pJ
F hk
T hk p A C I/O
F hk
X4
T hk p C
A I /O
K I/O
X 10
T hk pK
X0
F hk
F hk
T h k p A B I/O
X3
T hk pB E
F G I /O
F
F o d G I /O h k E I /O F I /O
od F
X6
T
F h k E I/O
*
X6
A =
pA =
I/O =
XN =
oh
oc
od
hk
step scan (A - K)
post scan (A - K)
I/O scan
transition (1 - 10)
T=true
F=false
= overhead
= convergence overhead
= divergence overhead
= housekeeping
T o d G I /O h k E I /O p F H I /O G I /O
H I /O
X7
X7
T
X7
T
X7
F
T hk pE oc pH oc pG
I I /O
hk
X8
T hk pI
15303
SFC Reference
B-13
This Event:
pA
XN
0.6 ms
hk (housekeeping)
oh (overhead)
0.02 ms
od (divergence overhead)
0.3 ms
oc (convergence overhead)
0.2 ms
B-14
SFC Reference
Figure B.11
Minimum Scan Time for a Step and Transition Pair
A
X0
B
X1
1.6 ms
F
A
I/O
1.6 ms
hk
X0
F
hk
pA
I/O
X1
T
1.9 ms
hk
hk
pB
1.9 ms
14271
Is:
Tmilliseconds
Tscan
total time to scan logic in all active steps and associated false transitions
'LYHUJHQW 6FDQ 7LPH VWDUWV ZKHQ WKH SURFHVVRU WHVWV D WUDQVLWLRQ DQG
HQGV ZKHQ WKH SURFHVVRU VFDQV WKH QH[W VWHSV ,2 'LYHUJHQW VFDQ
WLPH LQFOXGHV WUDQVLWLRQ VFDQ WLPH SRVWVFDQ WLPH RI WKH SUHYLRXV VWHS
VFDQ WLPH RI WKH QHZ VWHS RYHUKHDG DQG VFDQ WLPH RI HDFK SDUDOOHO
DFWLYH VWHS RXWVLGH RI WKH GLYHUJHQFH
SFC Reference
B-15
X1
B
X2
C
Xn
D
Is:
Tmilliseconds
TX
pA
TS
T0
sum of scan times of logic in all other active steps and transitions
parallel to the divergence, but outside of the divergence
B-16
SFC Reference
Is:
Tmilliseconds
TX0
pA
TS
T0
sum of scan times of logic in all other active steps and transitions
parallel to the divergence, but outside of the divergence
)RU WKH ZRUVW FDVH DVVXPH WKDW D WUDQVLWLRQ JRHV WUXH MXVW DIWHU WKH ,2
VFDQ RU MXVW DIWHU D WUDQVLWLRQ LV VFDQQHG 7KLV DVVXPSWLRQ UHTXLUHV DQ
H[WUD VFDQ VHTXHQFH EHIRUH WKH WUDQVLWLRQ JRHV WUXH
SFC Reference
B-17
N
//
X1
Z
Is:
Tmilliseconds
TX1
Tp
TZ
T0
sum of scan times of logic in all other active steps and transitions
parallel to the convergence, but outside of the convergence
)RU WKH ZRUVW FDVH DVVXPH WKDW D WUDQVLWLRQ JRHV WUXH MXVW DIWHU WKH ,2
VFDQ RU MXVW DIWHU D WUDQVLWLRQ LV VFDQQHG 7KLV DVVXPSWLRQ UHTXLUHV DQ
H[WUD VFDQ VHTXHQFH EHIRUH WKH WUDQVLWLRQ JRHV WUXH
B-18
1RWHV
SFC Reference
Appendix
7KLV DSSHQGL[ OLVWV DOO RI WKH DYDLODEOH LQVWUXFWLRQV DQG WKHLU RSHUDQGV
DQG WKH GDWD W\SHVYDOXHV WKDW DUH YDOLG IRU HDFK RSHUDQG
7KH IROORZLQJ WDEOH H[SODLQV HDFK YDOLG GDWD W\SHYDOXH
This Data
Type/Value:
Accepts:
immediate
(program constant)
integer
any integer data type: integer, timer, counter, status, bit, input,
output, ASCII, BCD, control (e.g., N7:0, C4:0, etc.)
float
any floating point data type with 7-digit precision (valid range is
1.1754944e38 to 3.4028237e+38).
block transfer
ControlNet transfer
message
PID
string
SFC status
7DEOH &$ VKRZV WKH SURJUDPPLQJ LQVWUXFWLRQV \RX FDQ XVH DQG WKH
RSHUDQGV IRU WKRVH LQVWUXFWLRQV <RX FDQ DOVR XVH WKLV WDEOH WR IRUPDW
LQVWUXFWLRQV LQ $6&,, IRU LPSRUWLQJ )RU PRUH LQIRUPDWLRQ RQ
LPSRUWLQJ VHH \RXU SURJUDPPLQJ PDQXDO
,QVWUXFWLRQV PDUNHG ZLWK DQ DVWHULVN
DUH RQO\ VXSSRUWHG E\
(QKDQFHG 3/& SURFHVVRUV
7R HQWHU WKH LPSRUW V\QWD[ IRU DQ\ RI WKH LQVWUXFWLRQV OLVWHG LQ
7DEOH &$
C-2
Table C.A
Programming Instructions and Operands
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
ABL *
channel
yes
control
control
channel
immediate, integer
control
control
source
string
destination
integer
source A
string
source B
string
destination
string
source
destination
action number
immediate
file number
0 - 999
destination
string
source A
source B
destination
integer, float
source
string
index
number
destination
string
ACB *
ACI *
ACN *
ACS *
ACT *
ADD
AEX *
Arc Cosine
SFC action
(only for ASCII import/export)
ADD
String Extract
yes
no
no
no
N/A
no
no
AFI
Always False
none
AHL *
ASCII Set/Reset
Handshake Lines
channel
yes
yes
handshake OR mask
control
control
source
immediate, integer
destination
string
AIC *
no
no
C-3
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
AND
Logical AND
source A
integer
no
source B
integer
destination
integer
channel
destination
string
control
control
string length
0 - 82
channel
destination
string
control
control
string length
0 - 82
source
string
index
search
string
result
integer
source
destination
source A
string
source B
string
source
destination
file
integer, float
destination
integer, float
control
control
length
1 - 1000
position
0 - 999
channel
source
string
control
control
string length
0 - 82
ARD *
ARL *
ASC *
ASN *
ASR *
ATN *
AVE *
AWA *
Arc Sine
Arc Tangent
Average File
yes
yes
no
no
no
no
yes
yes
C-4
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
AWT *
ASCII Write
channel
immediate, integer
yes
source
string
control
control
length
0 - 82
BRK
Break
none
BSL
file
binary
control
control
bit address
bit
length
file
binary
control
control
bit address
bit
length
source
immediate, integer
source bit
destination
integer
destination bit
immediate (0 - 15)
length
immediate (1 - 16)
BSR
BTD
Bit Distribute
yes
no
yes
yes
no
C-5
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
BTR1
rack
00-277 octal
yes
group
0-7
module
0-1
control block
block, integer
data file
integer
length
0, 1-64
continuous
YES, NO
rack
00-277 octal
group
0-7
module
0-1
control block
block, integer
data file
integer
length
0, 1-64
continuous
YES, NO
BTW
yes
CIO
control block
yes
CIR
N/A
integer, float
Clear
destination
integer, float
no
CMP
Compare
expression, relative
expression, expression
no
EXE mnemonic
(end of expression)
EXE
File Copy
source
array
destination
array
length
immediate (1 - 1000)
no
1 In non-continuous mode, BTR and BTW ladder functions requires a false-to-true transition to execute. In continuous mode, once the rung goes
true, BTR and BTW functions continue to execute regardless of rung condition. See page 15-8 for more information.
C-6
Instruction
Description
Operand
Valid Value
COR
integer, float
Require
False-to-True
Transition
no
COS *
Cosine
source
no
CPT
Compute
math expression
no
EXE mnemonic
only for ASCII import
EXE
relative expression
destination
integer, float
counter
counter
PRE
32,768 - +32,767
ACC
32,768 - +32,767
counter
counter
PRE
32,768 - +32,767
ACC
32,768 - +32.767
yes
source array
binary
yes
reference array
binary
result array
integer
compare control
control
length
position
0 - 15999
result control
control
length
1 - 1000
position
0 - 999
source
destination
CTD
CTU
DDT
DEG *
Count Down
Count Up
Diagnostic Detect
yes
yes
no
C-7
Instruction
Description
Operand
Valid Value
DFA
control file
integer
number of I/O
immediate (3-999)
source A
source B
destination
integer, float
source
immediate, integer
mask
immediate, integer
reference
integer
DIV
DTR
Divide
Data Transitional
Require
False-to-True
Transition
no
no
EOC
N/A
EOR
end of rung
N/A
EOT
end of transition
none
no
ESE
N/A
EQU
Equal
source A
source B
no
EOP
N/A
ERI
only in ASCII
export files
N/A
ERO
only in ASCII
export files
N/A
ESI
N/A
FAL
File Arithmetic/Logical
control
control
length
1 - 1000
position
0 - 999
mode
destination
integer, float
math expression
yes
C-8
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
FBC
source array
binary
yes
reference array
binary
result array
integer
compare control
control
length
position
0 - 15999
result control
control
length
1 - 1000
position
0 - 999
source operand
FIFO array
indexed, integer
FIFO control
control
length
1 - 1000
position
0 - 999
FIFO array
indexed, integer
destination
indexed, integer
FIFO control
control
length
1 - 1000
position
0 - 999
source operand
no
destination array
array
no
length
immediate (1 - 1000)
LBL number
integer
index
integer
initial value
immediate, integer
terminal value
immediate, integer
step size
immediate, integer
source
immediate, integer
destination
integer
FFL
FFU
FLL
FOR
FRD
FIFO Load
FIFO Unload
Fill File
For Loop
From BCD
yes
yes
no
no
C-9
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
FSC
control
control
yes
length
1 - 1000
position
0 - 999
mode
math expression
source A
source B
source A
source B
length
destination
integer
length
source
integer
GEQ
GRT
IDI
IDO
Greater Than
no
no
yes
yes
IIN
Immediate Input
I (input) word
immediate, integer
PLC-5/10, 11, 12 15, 20, 25,
30: 000-077
PLC-5/40, 40L: 000-157
PLC-5/60, 60L, 80, :000-237
no
IOT
Immediate Output
O (output) word
immediate, integer
PLC-5/10, 11, 12, 15, 20, 25,
30: 000-077
PLC-5/40, 40L: 000-157
PLC-5/60, 60L, 80: 000-237
no
JMP
Jump
label number
immediate
Classic PLC-5 processors:
0-31
Enhanced PLC-5 processors:
0-255
no
JSR
Jump to Subroutine
ladder program
number
immediate (2 - 999)
no
integer float
no
file number
immediate
Classic PLC-5 processors:
0-31
Enhanced PLC-5 processors:
0-255
N/A
LAB
C-10
Require
False-to-True
Transition
Instruction
Description
Operand
Valid Value
LBL
label number
immediate
Classic PLC-5 processors:
0-31
Enhanced PLC-5 processors:
0-255
no
LEQ
source A
no
source B
source A
source B
source operand
LIFO array
indexed, integer
LIFO control
control
length
1 - 1000
position
0 - 999
LIFO array
indexed, integer
destination
indexed, integer
LIFO control
control
length
1 - 1000
position
0 - 999
low limit
test
high limit
source
destination
float
source
no
destination
float
no
LES
LFL *
LFU *
LIM
LN *
LOG *
Less Than
LIFO Load
LIFO Unload
Limit
Natural Log
MCR
MEQ
MOV
MSG
Move
Message
no
yes
yes
no
no
no
source operand
immediate, integer
source mask
immediate, integer
compare operand
immediate, integer
source
destination
integer, float
control block
message, integer
no
no
yes
C-11
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
MUL
Multiply
source A
no
source B
destination
integer, float
source operand
immediate, integer
source mask
destination
integer
source
destination
integer, float
source A
source B
source
immediate, integer
destination
integer
MVM
NEG
NEQ
NOT
Masked Move
Negate
Not Equal To
Logical NOT
no
no
no
no
NSE
N/A
NSI
N/A
NXT
immediate
Classic PLC-5 processors:
0-31
Enhanced PLC-5 processors:
0-255
no
OR
Logical OR
source A
yes
source B
destination
integer
storage bit
bit
output bit
immediate (0 - 15)
output word
integer
OSF *
yes; requires a
true-to-false
transition to
execute
ONS
One Shot
source bit
bit
yes
OSR *
storage bit
bit
yes
output bit
immediate (0 - 15)
output word
integer
OTE
Output Energize
destination bit
bit
no
OTL
Output Latch
destination bit
bit
no
OTU
Output Unlatch
destination bit
bit
no
C-12
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
PID
PID
control block
PD
no
control block
integer
yes
pv value
integer
tieback value
immediate, integer
cv value
integer
source
destination
label number
immediate (0 - 255)
N/A
no
RAD *
no
REF
RES
Timer/Counter Reset
RET
Return
no
RTO2
Retentive Timer On
timer
timer
yes
time base
PRE
0 - 32767
ACC
0 - 32767
SBR
Subroutine
integer, float
no
SDS
control file
integer
no
number of I/O
immediate (3-999)
SDZ
only in ASCII
export files
N/A
SEL
N/A
SFR*
SFC reset
immediate (1 - 999)
restart at step
immediate, integer
SIM
no
N/A
This instruction requires periodic scans to be updated. See page 2-13 in this manual or your Structured Text User Manual for more information.
C-13
Instruction
Description
Operand
Valid Value
Require
False-to-True
Transition
SIN *
Sine
source
no
destination
SIZ
only in ASCII
export files
N/A
SOC
start of compression
N/A
SOP
N/A
SOR
start of rung
N/A
SQI
Sequencer Input
file
integer, indexed
mask
source
control
control
length
1 - 1000
position
0 - 999
file
integer, indexed
source
control
control
length
1 - 1000
position
0 - 999
file
integer, indexed
destination mask
destination
indexed, integer
control
control
length
1 - 1000
position
0 - 999
source
destination
integer, float
sort file
integer, float
file control
control
length
1 - 1000
position
0 - 999
SQL
SQO
SQR
SRT *
Sequencer Load
Sequencer Output
Square Root
Sort
no
yes
yes
no
yes
C-14
Description
Operand
SRZ
STP
file number
2 - 999
N/A
STP *
SFC step
(Enhanced PLC-5 Processors)
(ASCII import/export only)
2 - 9999
N/A
time base
qualifier
action number
(from ACT)
immediate
timer
time base
integer, float
destination
integer, float
file control
control
length
1 - 1000
position
0 - 999
source A
source B
destination
integer, float
source
destination
token ID number
(must be unique per
SFC file)
immediate
STD *
SUB
TAN *
Standard Deviation
Subtract
Tangent
TID *
Token ID
(ASCII import/export only)
TND
Temporary End
TOD
To BCD
Valid Value
Require
False-to-True
Transition
Instruction
N/A
yes
no
no
N/A
no
source
immediate, integer
destination
integer
no
C-15
Require
False-to-True
Transition
Instruction
Description
Operand
Valid Value
TOF 2
timer
timer
yes: requires
true-to-false
transition to
execute
TOF 2
time base
PRE
0 - 32767
yes: requires
true-to-false
transition to
execute
ACC
0 - 32767
timer
timer
time base
PRE
0 - 32767
ACC
0 - 32767
file number
TON 3
Timer On Delay
yes
TRC
SFC transition
(ASCII import/export only)
UID *
no
UIE *
no
XIC
Examine On
source bit
bit
no
XIO
Examine Off
source bit
bit
no
XOR
Exclusive Or
source A
no
source B
destination
integer
source A
immediate, integer
source B
immediate, integer
destination
integer
XPY *
X to the Power of Y
N/A
no
2
This instruction requires periodic scans to be updated. See page 2-9 in this manual or page 2-10 in the Structured Text User Manual for more
information.
3
This instruction requires periodic scans to be updated. See page 1-14 in this manual or your Structured Text User Manual for more information.
C-16
1RWHV
Index
A
ABL instruction 17-4
ACB instruction 17-5
ACI instruction 17-6
ACN instruction 17-7
ACS instruction 4-11
ADD instruction 4-12
Addition instruction
ADD 4-12
AEX instruction 17-7
AFI instruction 13-13
AHL instruction 17-8
AIC instruction 17-9
Always False instruction 13-13
AND instruction 5-2
AND Operation instruction
AND 5-2
ASCII
ABL 17-4
ACB 17-5
ACI 17-6
ACN 17-7
AEX 17-7
AHL 17-8
AIC 17-9
ARD 17-10
ARL 17-12
ASC 17-14
ASR 17-15
AWA 17-15
AWT 17-17
ASCII instructions, strings 17-3
ASCII Integer to String instruction 17-9
ASCII Read Characters instruction 17-10
ASCII Read Line instruction 17-12
ASCII Set Handshake Lines instruction 17-8
I2
Index
Attention
32- to 16-bit conversion 4-10
AVE indexed address 4-16
change index value 13-6
control structure addressing 10-4
DTR online programming 10-8
entering input addresses 1-6
entering output addresses 1-7
FAL indexed address 9-2
FOR and NXT with output branches 13-5
FOR and NXT within branches 13-5
indexed addressing 8-2
jumped timers and counters 13-4
MCR zones
overlapping or nesting 13-2
timers and counters 13-2
modify status bits of BTR/BTW 15-6
MSG
status bits .ST and .EW 15-24
online programming with ONS 13-14
pairing stack instructions 11-6
PID
change engineering unit max 14-22
change engineering unit min 14-22
change inputs or units 14-19
changing scaling 14-6
resume last state 14-10
setting temperature limits 14-28
update time 14-21
placement of critical counters 2-15, 2-17
resetting TON and TOF 2-8, 2-20
SRT indexed address 4-27
status of BTR/BTW bits 15-7
STD indexed address 4-30
use of control address 12-3
using control addresses 8-2
using control addresses for instructions 11-2
B
Bit Distribute instruction
BTD 7-2
Bit Shift Left (BSL) instruction 11-2
Bit Shift Right (BSR) instruction 11-2
block transfer
BTR instruction 15-3
BTW instruction 15-3
direct communication mode 15-2
I/O scan mode 15-1
instructions 15-1
programming examples 15-15
timing 15-13, 15-14
Block Transfer Read instruction
BTR 15-3
Block Transfer Write instruction
BTW 15-3
Break (BRK) instruction 13-5
BRK instruction 13-5
BSL instruction 11-2
BSR instruction 11-2
BTD instruction 7-2
BTR instruction 15-3
BTW instruction 15-3
C
CAR utility 18-1
CIO instruction 15-22
monitoring 15-24
status bits 15-24
using 15-23
Classic PLC5 processors 1
Clear instruction
CLR 4-17
CMP
instruction 3-2
Index
I3
compare
EQU 3-5
expression 3-2
GEQ 3-5, 3-6
instructions 3-2
length of expressions 3-3
LEQ 3-6
LES 3-7
NEQ 3-10
compute
ACS 4-11
ADD 4-12
ASN 4-13
ATN 4-14
AVE 4-15
CLR 4-17
COS 4-18
CPT 4-5
DEG 6-3
DIV 4-19
EOT 13-18
expression 4-5
FSC 9-14
functions 4-9
IOT 1-7
length of expressions 4-7
LN 4-20
LOG 4-21
MUL 4-22
NEG 4-23
ONS 13-14
order of operation 4-8
RAD 6-4
SIN 4-24
SQR 4-25
SRT 4-26
STD 4-28
SUB 4-31
TAN 4-32
XPY 4-33
Compute instruction
CPT 4-5
connecting to Ethernet PLC5 processors using
hostnames 16-6
control file
example 8-2
ControlNet I/O transfer
instruction 15-22
ControlNet PLC5 processors 1
convergent
scan time B-14
conversion
BCD 6-2
FRD 6-2
Convert from BCD instruction
FRD 6-2
Convert to BCD instruction
TOD 6-2
COP instruction 9-19
COS instruction 4-18
Cosine instruction
COS 4-18
Count Down instruction 2-17
Count Up instruction 2-15
counter
CTD 2-17
CTU 2-15
RES 2-20
counters
instructions 2-13
CPT instruction 4-5
CTD instruction 2-17
CTU instruction 2-15
custom application routine 18-1
D
data files
manipulating 8-3
range of values C-1
data storage
I/O image files 1-2
Data Transitional instruction
DTR 10-8
1785-6.1 November 1998
I4
Index
Degree instruction
DEG 6-3
expression
determining the length of 3-3, 4-7
F
FAL logical instruction 9-12
FBC instruction 10-2
FFL instruction 11-5
FFU instruction 11-5
file
direct communication
block transfer 15-2
divergent
scan time B-14
Divide instruction
DIV 4-19
DTR instruction 10-8
E
element manipulation
LIM 3-7
MEQ 3-9
MOV 7-3
MVM 7-4
End of Transmission instruction
EOT 13-18
engineering units
scaling 14-5
Enhanced PLC5 processors 1
EOT instruction 13-18
EQU instruction 3-5
file concepts
control structure 8-2
manipulating data 8-3
modes of operation 8-5
File Copy instruction
COP 9-19
File Fill instruction
FLL 9-20
file instructions
logical 9-12
File Search and Compare instruction
FSC 9-14
Index
I5
files
arithmetic operations 9-7
copy operations 9-5
functions 9-14
instruction
COP 9-19
FLL 9-20
logical operations 9-12
operation modes 8-5
FLL instruction 9-20
floating point
valid value range C-1
For (FOR) instruction 13-5
FOR instruction 13-5
FRD instruction 6-2
FSC instruction 9-14
G
gain constants 14-3
instruction
ControlNet I/O transfer 15-22
immediate data input 1-8
immediate data output 1-8
instructions
ASCII 17-1
block transfer 15-1
CIO
monitoring 15-24
compare 3-2
diagnostic 10-1
memory requirements A-1
message 16-1
operands C-1
program flow 13-1
relay-type 1-1, 2-1
sequencer 12-1
shift register 11-1
timer 2-1
timing A-1
INVALID OPERAND
error message 4-4
L
Label (LBL) instruction 13-5
Label instruction 13-3
LBL instruction 13-3, 13-5
I6
Index
Multiply instruction
MUL 4-22
LN instruction 4-20
LOG
instruction 4-21
Log to the base 10 instruction
LOG 4-21
logical
AND 5-2
NOT 5-3
OR 5-4
XOR 5-5
M
manipulating
file data 8-3
Masked Comparison for Equal instruction 3-9
Masked Move instruction 7-4
Master Control Reset instruction 13-2
MCR instruction 13-2
memory
instruction requirements A-1
SFC requirements B-3
N
Natural Log instruction
LN 4-20
NEG instruction 4-23
Negate instruction
NEG 4-23
NEQ instruction 3-10
Next (NXT) instruction 13-5
Not Equal To instruction 3-10
NOT instruction 5-3
NOT Operation instruction
NOT 5-3
Number of Char in Buffer instruction 17-5
NXT instruction 13-5
O
One Shot Falling (OSF) instruction 13-16
One Shot instruction
ONS 13-14
message
instruction 16-1
modes
file operation 8-5
operands
instructions C-1
OR instruction 5-4
monitoring
CIO instructions 15-24
OR Operation instruction
OR 5-4
Move instruction
MOV 7-3
MSG
instruction entry 16-10
Index
I7
program flow
AFI 13-13
JMP and LBL 13-3
JSR, SBR, and RET 13-8
MCR 13-2
UID 13-19
UIE 13-20
1785-6.1 November 1998
I8
Index
S
SBR instruction 13-8
scaling
to engineering units 14-5
scan sequence
SFC B-7
scan time
convergent B-14
divergent B-14
steadystate B-14
scanner mode
configuring 15-13, 15-14
SDS instruction 18-1
selection branch
scanning sequence B-8
sequencer
applying 12-1
instructions 12-1
SQI 12-2
SQL 12-2
SQO 12-2
Sequencer Input instruction 12-2
Sequencer Load instruction 12-2
Sequencer Output instruction 12-2
Sequential Function Chart Reset
instruction 13-17
SFC
constraints B-5
example
scanning sequence B-11
memory requirements B-3
scanning sequence
example B-11
selection branch B-8
simultaneous branch B-9
scanning sequences
step/transition B-7
status information B-1
SFR instruction 13-17
Index
I9
T
TAN instruction 4-32
Tangent instruction
TAN 4-32
Temporary End
instruction 13-13
Temporary End instruction 13-20
Test Buffer For Line instruction 17-4
timer
accuracy 2-3
instruction parameters 2-2, 2-13
RES 2-20
RTO 2-10
TOF 2-7
TON instruction 2-4
U
units, engineering
scaling 14-5
User Interrupt Disable
UID 13-19
User Interrupt Enable
UIE 13-20
using
CIO instruction 15-23
IDI instruction 1-9
IDO instruction 1-9
MSG instruction 16-10
X
timers 2-1
timing
block transfer 15-13, 15-14
instructions A-1
tip
I10
1RWHV
Index
Allen-Bradley
Publication Problem Report
If you find a problem with our documentation, please complete and return this form
Pub. Name
Pub. No.
1785-6.1
Pub. Date
November 1998
Part No.
Describe Problem(s):
955133-83
Technical Accuracy
text
Completeness
procedure/step
illustration
definition
info in manual
example
guideline
feature
(accessibility)
explanation
other
illustration
info not in
manual
Clarity
What is unclear?
Sequence
What is not in the right order?
Other Comments
Use back for more comments.
Your Name
Location/Phone
Return to: Marketing Communications, Allen-Bradley Co., 1 Allen-Bradley Drive, Mayfield Hts., OH 44124-6118Phone: (440)646-3166
FAX:
(440)646-4320
PN 955107-82
Other Comments
@
W
P
H
@
S
IPQPTU6 B@
I@8@TT6S`
DAH6DG@9
DIUC@
VIDU@9TU6U@T
@
T
6
@
G
Q
Customer Support
,I \RX QHHG DGGLWLRQDO DVVLVWDQFH LQ XVLQJ \RXU VRIWZDUH
$OOHQ%UDGOH\ RIIHUV WHOHSKRQH DQG RQVLWH SURGXFW VXSSRUW DW
&XVWRPHU 6XSSRUW &HQWHUV ZRUOGZLGH
)RU WHFKQLFDO DVVLVWDQFH RQ WKH WHOHSKRQH ILUVW FRQWDFW \RXU ORFDO VDOHV
RIILFH GLVWULEXWRU RU V\VWHP LQWHJUDWRU ,I DGGLWLRQDO DVVLVWDQFH LV
QHHGHG WKHQ FRQWDFW \RXU ORFDO &XVWRPHU 6XSSRUW &HQWHU RU FRQWDFW
6\VWHP 6XSSRUW 6HUYLFHV
519-623-1810
52-5-259-0040
44-908 838800
France (Paris)
(33-1) 3067-7200
Germany (Gruiten)
Italy (Milan)
(39-2) 939-721
(852) 887-4788
Spain (Barcelona)
(34-3) 331-7004
)RU DVVLVWDQFH WKDW UHTXLUHV RQVLWH VXSSRUW FRQWDFW \RXU ORFDO RIILFH
GLVWULEXWRU RU V\VWHP LQWHJUDWRU 'XULQJ QRQRIILFH KRXUV FRQWDFW
\RXU ORFDO &XVWRPHU 6XSSRUW &HQWHU
PN 955133-83
1998 Rockwell International Corporation. Printed in USA