Ladblock PDF
Ladblock PDF
Modicon
Logic Block Library
840 USE 101 00
User Guide
Version 2.0
June, 1996
Preface
The data and illustrations found in this book are not binding. We
reserve the right to modify our products in line with our policy of
continuous product development. The information in this document is
subject to change without notice and should not be construed as a
commitment by AEG Schneider Automation, Inc.
AEG Schneider Automation assumes no responsibility for any errors
that may appear in this document. If you have any suggestions for
improvements or amendments or have found errors in this publication,
please notify us by using the form on the last page of this publication.
No part of this document may be reproduced in any form or by any
means, electronic or mechanical, including photocopying, without
express written permission of the Publisher, AEG Schneider
Automation, Inc.
Caution:
All pertinent state, regional, and local safety
regulations
must be observed when installing and using this
product.
For reasons of safety and to assure compliance
with
documented
system data, repairs to components
should be
performed
only by the manufacturer .
DIGITALandDECareregisteredtrademarksofDigitalEquipment
Corporation.
IBM and IBM AT are registered trademarks of International
Business Machines Corporation.
Microsoft and MS DOS are registered trademarks of Microsoft
Corporation.
Copyright 1996, AEG Schneider Automation, Inc.
Printed in U.S.A.
Preface
iii
Contents
Chapter
1.1
1.2
1.3
Chapter
2.1
2.2
2.3
2.4
2.5
1 Ladder
...........................
2
2
3
4
5
7
2 Memory
Logic Overview
Allocation
in a PLC . . . . . . . . . . . . . . . . . . . . . . .
11
User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.1
User Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.2
User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.3
System Overhead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.4
Memory Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
State RAM Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.1
A Referencing System for Inputs and Outputs . . . . . . . . .
2.2.2
Storing Discrete and Register Data in State RAM . . . . . .
State RAM Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3.1
Minimum Required State RAM Values . . . . . . . . . . . . . . . .
2.3.2
History and Disable Bits for Discrete References . . . . . . .
The Configuration Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.1
Assigning a Battery Coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.2
Assigning a Timer Register . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.3
The Time of Day Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.4
Configuration Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The I/O Map Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5.1
Determining the Size of the I/O Map Table . . . . . . . . . . . . .
2.5.2
Writing Data to the I/O Map Table . . . . . . . . . . . . . . . . . . . .
12
12
12
13
13
14
14
15
16
17
17
18
18
18
19
20
22
22
22
Contents
Chapter
3.1
3.2
3.3
Chapter
...........................
23
24
24
26
26
27
28
28
29
29
31
Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.1
Normally Open Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.2
Normally Closed Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.3
Positive Transitional Contacts . . . . . . . . . . . . . . . . . . . . . . . .
4.1.4
Negative Transitional Contacts . . . . . . . . . . . . . . . . . . . . . . .
4.2 Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.1
Normal Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2
Latched or Memory-retentive Coils . . . . . . . . . . . . . . . . . . .
4.2.3
A Simple Contact-Coil logic Example . . . . . . . . . . . . . . . . . .
4.2.4
Coil Usage in a Logic Network . . . . . . . . . . . . . . . . . . . . . . . .
4.2.5
General Coil Usage Guidelines . . . . . . . . . . . . . . . . . . . . . . .
4.3 Shorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.1
Horizontal Shorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.2
Vertical Shorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Using Logic Elements to Create Control Circuits . . . . . . . . . . . . . . . . . .
4.4.1
A Logical AND Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.2
A Logical OR Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.3
A Logical XOR Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.4
Building a Seal Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 Storing Contacts and Coils in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 NOBT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7 NCBT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8 NBIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9 SBIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.10 RBIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
32
33
33
34
36
36
36
37
37
38
39
39
39
40
40
40
41
41
43
45
47
49
51
53
Contents
4 Ladder
Logic Opcodes
...........................
4.1
vi
3 Ladder
Logic Elements
5.2
5.3
5.4
5.5
5.6
Chapter
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9
6.10
6.11
6.12
6.13
Chapter
7.1
840 USE 101 00
5 Counters
.............................
59
UCTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.2
Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . .
5.1.3
Up-Counter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DCTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
T1.0 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.2
Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . .
5.3.3
A One-second Timer Example . . . . . . . . . . . . . . . . . . . . . . . .
T0.1 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
T.01 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
T1MS Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6.2
Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . .
5.6.3
A Millisecond Timer Example . . . . . . . . . . . . . . . . . . . . . . . .
60
60
60
61
62
64
64
64
66
67
69
71
71
71
72
6 Integer
and Timers
55
...............
75
ADD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MUL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DIV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AD16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SU16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TEST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MU16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DV16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ITOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
FTOI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A Fahrenheit-to-Centigrade Conversion Example . . . . . . . . . . . . . . . . . .
76
78
80
82
84
86
88
90
93
96
98
100
102
7 Enhanced
Math Capabilities
. . . . . . . . . . . . . . . . . . . . . . 103
104
vii
7.2
7.3
7.4
viii
Contents
107
107
108
109
110
111
111
112
114
115
116
116
116
117
118
118
119
119
120
120
121
122
123
123
124
124
125
126
126
127
128
129
130
130
131
132
133
134
7.5
7.6
Chapter
8.1
8.2
8.3
8.4
8.5
8.6
8.7
Chapter
9.1
Networks
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
134
135
136
137
138
139
139
139
140
141
142
143
143
143
144
145
146
150
154
154
155
157
157
158
159
161
161
162
163
166
167
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
DX Move Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.1
DX Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
170
170
ix
9.1.2
Specifying Discrete References in a DX Table . . . . . . . . . .
9.1.3
Pointers in a DX Instruction Node . . . . . . . . . . . . . . . . . . . .
RT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.3
An RT Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
170
170
171
171
171
172
TR Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.3
A TR Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4 TT Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4.3
A TT Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.5 FIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.6 FOUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.7 SRCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.7.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.7.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.7.3
A SRCH Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.8 BLKM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.8.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.8.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.8.3
A Recipe Storage Example . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.9 BLKT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.9.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.9.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.9.3
A BLKT Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.10 TBLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.10.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.10.2 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.10.3 A TBLK Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.11 IBKR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.11.1
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.11.2
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.11.3
An IBKR Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.12 IBKW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.12.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
174
174
174
175
177
177
177
179
181
184
187
187
187
188
189
189
189
190
192
192
192
194
195
195
195
197
198
198
198
199
201
201
9.2
9.3
Contents
9.12.2
9.12.3
Chapter
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
An IBKW Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10 DX Matrix Instructions
. . . . . . . . . . . . . . . . . . . . . . . . . . . 205
11 Monitoring
Remote
I/O System
Status
206
207
207
208
209
210
210
210
212
213
213
214
215
216
216
216
217
218
218
218
220
221
221
221
222
224
226
228
229
. . . . . . . . . . . . 231
11.1 STAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2 The S901 Status Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
840 USE 101 00
201
202
Contents
232
234
xi
11.3
11.4
11.5
11.6
Chapter
11.2.1
S901 Controller Status Words . . . . . . . . . . . . . . . . . . . . . . . .
11.2.2
S901 I/O Module Health Status Words . . . . . . . . . . . . . . . .
11.2.3
S901 RIO Communication Status Words . . . . . . . . . . . . . . .
The S908 Status Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3.1
S908 PLC Status Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3.2
S908 I/O Module Health Status Words . . . . . . . . . . . . . . . .
11.3.3
S908 I/O Communication Status Words . . . . . . . . . . . . . . . .
The Compact PLC Status Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.1
Compact PLC Status Words . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4.2
Compact I/O Module Health Status Words . . . . . . . . . . . . .
11.4.3
Compact I/O Communication Status Words . . . . . . . . . . . .
Micro PLC Status Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.5.1
Micro PLC Status Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.5.2
Micro I/O Expansion Health . . . . . . . . . . . . . . . . . . . . . . . . . .
11.5.3
Start-up Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.5.4
Micro PLC Global Communications Status . . . . . . . . . . . . .
HLTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.6.1
Learn Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.6.2
Monitor Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.6.3
Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.6.4
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.6.5
HLTH Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12 Monitoring
Distributed
I/O System
Status
. . . . . . . . . 275
13 Bypassing
Networks
14 Extended
Memory
Capabilities
Contents
282
282
282
283
284
. . . . . . . . . . . . . . . . . . . 287
276
278
13.1 SKP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.1.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.1.2 Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . .
13.1.3 A Simple SKP Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2 Off-line Instructions for Skipping Steps in Modsoft SFC . . . . . . . . . . . .
Chapter
235
238
239
240
241
244
245
250
251
253
253
255
256
258
260
261
264
264
264
265
265
272
288
15 ASCII Communication
Instructions
. . . . . . . . . . . . . . . 295
15.1 READ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2 WRIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3 Formatting Messages for ASCII READ/WRIT Operations . . . . . . . . . .
15.3.1 Format Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.4 COMM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.4.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.4.2 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.4.3 Message Formats for the COMM Instruction . . . . . . . . . . .
15.4.4 Set-up Considerations for Control/Monitor Signals . . . . .
15.5 ASCII Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter
16 Sequential
Control
Instructions
17 The Checksum
Instruction
18 The Modbus
Plus Master
Instruction
330
. . . . . . . . . . . . . 333
316
316
317
318
321
321
321
323
324
327
. . . . . . . . . . . . . . . . . . . . . . . 329
17.1 CKSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter
296
300
303
303
306
306
306
308
311
312
. . . . . . . . . . . . . . . . . . 315
289
290
292
Contents
334
339
339
340
xiii
18.3
18.4
18.5
18.6
18.7
18.8
18.9
18.10
18.11
18.12
18.13
xiv
Contents
342
344
345
345
345
347
347
347
349
349
349
351
351
351
352
352
352
353
353
353
355
355
355
357
357
357
357
360
360
360
361
361
361
362
363
363
363
364
19 Ladder
Logic Subroutines
. . . . . . . . . . . . . . . . . . . . . . . 371
20 Ladder
Logic Interrupt
Handling
for Quantum
PLCs
20.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.1.1 Interrupt-related Performance . . . . . . . . . . . . . . . . . . . . . . .
20.1.2 Instructions Not Used in an Interrupt Handler . . . . . . . . .
20.2 Interval Timer Interrupt (ITMR) Instruction . . . . . . . . . . . . . . . . . . . . . .
20.3 Interrupt Mask/Unmask Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.1 ID Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.2 IE Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.3.3 BMDI Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.4 Immediate I/O (IMIO) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter
21 Closed
Loop Control
Instructions
372
372
372
373
375
377
378
380
384
385
386
386
386
388
391
392
393
394
396
. . . . . . . . . . . . . . . . 399
365
370
Contents
400
400
401
403
404
409
413
413
414
415
xv
Contents
417
417
418
420
422
422
424
426
427
429
430
431
432
433
434
436
437
439
440
442
442
444
446
448
450
453
455
456
460
460
460
462
462
462
464
466
466
467
22.3.3 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.4 CALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5 ESI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.1 ESI-Driven Command Sequences . . . . . . . . . . . . . . . . . . . . .
22.5.2 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.3 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.4 Error Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.5 The Read ASCII Message Command . . . . . . . . . . . . . . . . . .
22.5.6 Write ASCII Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.7 Get Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.8 Put Data (Subfunction 4) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.9 Abort (Middle Input ON) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.10 Module Status Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.6 MBUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.6.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.6.2 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.6.3 The MBUS Get Statistics Function . . . . . . . . . . . . . . . . . . . .
22.7 PEER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8 Custom Loadables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.1 Programming Environment . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.2 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.3 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.9 The EARS Loadable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.9.1 PLC Functions in an Event/Alarm Recording System . . .
22.9.2 HostePLC Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.9.3 The EARS Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10 EUCA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.2 Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.3 A EUCA Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.4 Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.5 Example 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix
Index
Optimizing
Performance
Scheduler
468
471
474
474
475
475
477
478
481
482
483
487
487
489
489
490
491
494
496
496
497
497
499
499
499
500
503
503
504
505
507
509
51 1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Contents
xvii
Chapter 1
Ladder Logic Overview
Ladder
Logic Overview
1.1
Segments
and Networks
in Ladder
Logic
A Ladder
Logic Network
10
11
( )
( )
( )
( )
( )
( )
( )
NOTE Only coils can be shown
in column
11
Ladder
Logic Overview
1.1.2
Coil Placement
in a Network
( )
30101
10032
10033 00101
10034
00102
( )
40101
SUB
40102
Coils Displayed
( )
00103
in Logic-solve
Positions
( )
30101
10032
00101
10033
( )
40101
SUB
00102
10034
( )
40102
Coils Displayed
00103
in Expanded
Positions
Although the coil expansion display shows the coils in the 11th column,
they are solved in their real logic-solve position. Coil 00103 is solved
immediately after contact 10034 and coil 00102 is solved immediately
after contact 10033 in both examples above. Coil 00101 is always the
last coil solved in the network.
Ladder
Logic Overview
1.1.3
Ladder
Logic Segments
Ladder
Logic Overview
1.2
Ladder
Logic
The PLC scans the ladder logic program sequentially in the following
order:
V
1
1
Segment
Network
1
2
Start
Segment Boundary
Segment
Network
2
3
Ladder
Logic Overview
The PLC begins solving logic in the network at the top of the leftmost
column and proceeds down, then moves to the top of the next column
and proceeds down, as shown in the illustration. Each node is solved in
the order it is encountered in the logic scan. Power flow within the
network is down each column from left to right, never from bottom to
top and never from right to left.
Ladder
Logic Overview
1.3
Ladder
Logic Elements
and Instructions
There is a core set of ladder logic elements (contacts, coils, vertical and
horizontal shorts) and instructions built into all PLC firmware
packages. Additional instructions are available for specific PLC types
as either built-in or loadable instructions. This section provides a brief
list of the available instructions and their functions; a detailed
description of all instruction, including the PLC models they are
available on, is provided in later chapters of this book.
Standard
Ladder
Symbol
(M)
Standard
A normal coil
A horizontal short
A vertical short
Logic Instructions
Meaning
UCTR
DCTR
T1.0
T0.1
T.01
Integer
Ladder
Instruction
Counter
Nodes
Consumed
Meaning
( )
(L )
Logic Elements
Math Instructions
ADD
SUB
MUL
DIV
Ladder
Logic Overview
DX Move Instructions
RT
TR
TT
BLKM
FIN
FOUT
SRCH
STAT
DX Matrix Instructions
AND
OR
XOR
COMP
CMPR
MBIT
SENS
BROT
Skip-Node
Instruction
SKP
Some ladder logic instructions are standard (built in) to some PLCs but
unavailable in others. For example, PLCs with the Modbus Plus
communication capability built in it are shipped with an MSTR
instruction in the firmware while PLCs that cannot operate on Modbus
Plus do not support this instruction. Here is a list of these select
built-in instructions:
Built-in
Ladder
Instruction
Bit Manipulation
NOBT
NCBT
NBIT
SBIT
RBIT
Ladder
Logic Overview
Logic Instructions
Meaning
Nodes
Cons umed
Instructions
2
2
2
2
2
Other Math
AD16
SU16
TEST
MU16
DV16
ITOF
FTOI
EMTH
BCD
Equation
Network
Interrupt
ITMR
ID
IE
BMDI
IMIO
Instructions
WRIT
COMM
Ladder
JSR
LAB
RET
CTIF
Other
CKSM
MSTR
PID2
PCFL
TBLK
BLKT
SCIF
T1MS
840 USE 101 00
3
3
3
3
3
3
77
Instructions
ASCII Messaging
READ
3
3
3
1
1
3
2
Instructions
Reads data entered at an ASCII device into the PLC via its
RIO link
Sends a message from the PLC to an ASCII device via its RIO
link
Combines both ASCII READ and WRITE capabilities for
simple (canned) messages in the Micro PLCs
Logic Subroutine
3
3
Instructions
2
1
1
3
Instructions
Ladder
3
3
3
3
3
3
3
3
Logic Overview
IBKR
IBKW
3
3
Instruction
Meaning
HSBY
CHS
CALL
MBUS
PEER
ESI
FNxx
DRUM
ICMP
MATH
DMTH
EARS
EUCA
HLTH
10
Ladder
Logic Overview
Nodes
Consumed
3
3
3
3
3
3
3
3
3
3
3
Chapter
Memory
2
Allocation
User Memory
Memory
in a PLC
Allocation
in a PLC
11
2.1
User Memory
User memory is the space provided in the PLC for the logic program
and for system overhead. User memory sizes vary from 1K ... 64K
words, depending on PLC type and model. Each word in user memory
is stored on page 0 in the PLCs memory structure; words may be either
16 or 24 bits long, depending on the CPU size.
page 0
CKSM Diagnostics
Configuration Table
Loadables
I/O Map
Segment Scheduler
(129 words)
STAT Block Tables
(up to 277 words)
System Diagnostics
Configuration Extension
Table (optional)
ASCII Message area
(optional)
Overhead
User
Logic
Approximately
888 Words
2.1.1
User Logic
The amount of space available for application logic is calculated by
subtracting the amount of space consumed by system overhead from
the total amount of user logic. System overhead in a relatively
conservative system configuration can be expected to consume around
1000 words; system configurations with moderate or large I/O maps
will require more overhead.
2.1.2
User Memory
Ladder logic requires one word of either 16-bit or 24-bit memory to
uniquely identify each node in an application program. Contacts and
coils each occupy one node, and therefore one word. Instructions, which
usually comprise two or three nodes, require two or three words,
respectively. Other elements that control program scanningstart of a
network (SON), beginning of a column (BOC), and horizontal
shortsuse one word of user logic memory as well.
12
Memory
Allocation
in a PLC
SON BOC
BOC
BOC
SON = 1
( )
BOC = 3
=3
( )
=1
8 words
Note:
2.1.3
System
Overhead
Memory
Backup
User memory is stored in CMOS RAM. In the event that power is lost,
CMOS RAM is backed up by a long-life (typically 12-month) battery. In
many PLC models, the battery is a standard part of the hardware
package; in smaller-scale PLCse.g., the Micro PLCsa battery is
available as an option.
In the case of the Micro PLCs, where the battery is an option, an area
in its Flash memory is available for backing up user logic. (Flash is a
standard feature on the Micros.)
Memory
Allocation
in a PLC
13
2.2
2.2.1
A Referencing
System
for Inputs
and Outputs
14
Memory
Reference
Type
Meaning
0x
1x
discrete input
3x
input register
4x
output holding
register
6x
extended memory
register
Allocation
in a PLC
2.2.2
Storing
Discrete
and Register
0000
State RAM
ENABLE/DISABLE Tables
Discrete History Tables
4x History Table
EOL Pointers*
Crash Codes*
Executive ID*
Executive Rev #*
*Not available in the
984A/B/X PLCs
16 bits
Memory
Allocation
in a PLC
15
2.3
Word 0001
1x
..
.
1x + n
3x
..
.
3x + n
4x
...
4x + n
Coil History
..
.
Up/Downcounter History
..
.
Discrete DISABLE
Word 2048
16
Memory
Allocation
in a PLC
2.3.1
Minimum
Required
Type
Minimum
W ords
for Modsoft
2.3.2
Minimum
for P190
Bits (Discretes)
for Modsoft
for P190
48
16
Discrete in (1x )
16
16
Register in (3x )
History
and Disable
References
For each word allocated to discrete references, two additional words are
allocated in the history/disable tables. These tables follow the state
RAM table on page F in system memory. They are generated from the
bottom up in the following manner:
Word 0001
..
.
Output History Bits
..
.
Input History Bits
...
Output DISABLE Bits
..
.
Input DISABLE Bits
Word 2048
Memory
Allocation
in a PLC
17
2.4
The Configuration
Table
Assigning
a Battery
Coil
Assigning
a Timer Register
Memory
Allocation
in a PLC
2.4.3
4x
Meaning
10 11 12 13 14 15 16
1 = error
1 = all clock values have been set
1 = clock values are being read
1 = clock values are being set
4x + 1
4x + 2
4x + 3
4x + 4
4x + 5
4x + 6
4x + 7
Meaning
400500
0110000000000000
400501
3 (decimal)
400502
7 (decimal)
400503
16 (decimal)
400504
91 (decimal)
400505
9 (decimal)
400506
25 (decimal)
400507
30 (decimal)
Memory
Allocation
in a PLC
19
2.4.4
Configuration
Data Type
Configuration
Format
Setting
Size
Even multiple of 16
16
# of discrete inputs
Even multiple of 16
16
# of register outputs
01
# of register inputs
01
# of I/O drops
Up to 32, depending on
PLC type
01
# of I/O modules
Up to 1024, depending
on PLC type
00
# of logic segments
Generally equal to # of
drops
00
# of I/O channels
02
Memory size
Memory
Default
# of coils
Modbus
20
Overview
(RS-232)
PLC-dependent
PLC-dependent
Port Parameters
Communication mode
ASCII or RTU
RTU
Baud rate
9600
Parity
ON/OFF; EVEN/ODD
ON/EVEN
Stop bit(s)
1 or 2
Device address
001
01 ... 20 (representing
10 ... 200 ms)
01 (10 ms)
Allocation
in a PLC
ASCII Message
Table
# of messages
Up to 9999
00
00
# of ASCII ports
00
Baud
1200
Parity
ON/EVEN
# of stop bits
01
08
Presence of a keyboard
NONE
Simple
ASCII input
A 4x value representing
the first of 32 registers
for simple ASCII input
NONE
Simple
ASCII output
A 4x value representing
the first of 32 registers
for simple ASCII output
NONE
Special
Functions
NO
Timer register
NONE
TOD clock
NONE
Battery coil
00000
Loadable
Instructions
Install loadable
PROCEED or CANCEL
Delete loadable(s
W riting Configurator
Data to System
Memory
NONE
Memory
Allocation
in a PLC
21
2.5
2.5.1
Determining
The I/O map directs data flow between the input/output signals and the
user logic program; it tells the PLC how to implement inputs in user
logic and provides a pathway down which to send signals to the output
modules. The I/O map table, which is stored on page 0 in system
memory, consumes a large but not predetermined amount of system
overhead.
Its length is a function of the number of discrete and register I/O points
your system has implemented and is defined by the type of I/O modules
you specify in the configuration table.
The minimum allowable size of the I/O map table is nine words.
2.5.2
22
Memory
The number, type, and slot location of the I/O modules in the drop
Allocation
in a PLC
Chapter 3
Ladder Logic Opcodes
Ladder
Logic Opcodes
23
3.1
in the
The five most significant bits in a 16-bit node and the eight most
significant bits in a 24-bit nodethe x bitsare reserved for opcodes .
An opcode defines the type of functional element associated with the
nodefor example, the code 01000 specifies that the node is a normally
open contact, and the code 11010 specifies that the node is the third of
three nodes in a multiplication function block.
3.1.1
Translating
Logic Elements
and Non-DX
Functions
24
Ladder
Logic Opcodes
00
01
02
03
04
Start of a network
05
I/O exchange/End-of-Logic
06
Null Element
07
Horizontal short
08
N.O. contact
09
N.C. contact
0A
P.T. contact
0B
N.T. contact
0C
Normal coil
0D
0E
0F
10
11
Register reference
12
13
DCTR instruction
14
UCTR instruction
15
T1.0 instruction
16
T0.1 instruction
17
T.01 instruction
18
ADD instruction
19
SUB instruction
1A
MULT instruction
1B
DIV instruction
31
AD16 instruction
32
SU16 instruction
33
MU16 instruction
34
DV16 instruction
35
TEST instruction
36
ITOF instruction
37
FTOI instruction
5E
PID2 instruction
7F
EMTH instruction
9F
BLKT instruction
BE
LAB instruction
BF
DE
DF
TBLK instruction
FE
RET instruction
Ladder
Logic Opcodes
25
3.2
3.2.1
Translating DX Instructions
Memory Database
in the System
26
Ladder
Logic Opcodes
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
= RT
= TR
= TT
= BLKM
= FIN
= FOUT
= SRCH
= STAT
= AND
= OR
= CMPR
= SENS
= MBIT
= COMP
= XOR
= BROT
= READ
= WRIT
3.2.2
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
=
=
=
=
=
=
=
=
RT
TR
TT
BLKM
FIN
FOUT
SRCH
STAT
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
=
=
=
=
=
=
=
=
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
AND
OR
CMPR
SENS
MBIT
COMP
XOR
BROT
1
= READ
= WRIT
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
The z bits, which simply echo the three most significant x bits, may be
ignored in the 24-bit nodes.
Ladder
Logic Opcodes
27
3.2.3
Opcodes
for Standard
1C
RT instruction
3C
TR instruction
5C
TT instruction
7C
BLKM instruction
9C
FIN instruction
BC
FOUT instruction
DC
SRCH instruction
FC
STAT instruction
20
DIOH instruction
1D
AND instruction
3D
OR instruction
5D
CMPR instruction
7D
SENS instruction
9D
MBIT instruction
BD
COMP instruction
DD
XOR instruction
FD
BROT instruction
1E
READ instruction
3E
WRIT instruction
7E
XMWT instruction
9E
XMRD instruction
51
IBKR
52
IBKW
DX Instructions
Note:
3.2.4
for DX Functions
28
Ladder
Logic Opcodes
3.3
Opcode
Defaults
for Loadables
3.3.1
FF
HSBY instruction
5F
1F
MBUS instruction
3F
PEER instruction
DE
DMTH instruction
BE
FE
DRUM instruction
7F
ICMP instruction
How to Handle
Note:
PLC.
Opcode
Conflicts
The easiest way to stay out of trouble is to never employ two loadables
with conflicting opcodes in your user logic. If you are using MODSOFT
panel software, it allows you to change the opcodes for loadable
instructions. The lodutil utility in the Modicon Custom Loadable
Software package (SW-AP98-GDA) also allows you to change loadable
opcodes.
W arning!
If you modify any loadables
so that their opcodes
are different from the ones shown in this chapter , you must
use caution when porting user logic to or from your controller
The opcode conflicts that can result may hang up the target
controller
or cause the wrong function blocks to be executed
in ladder logic.
Ladder
Logic Opcodes
29
Chapter 4
Ladder Logic Elements
Contacts
Coils
Shorts
NCBT
NOBT
NBIT
SBIT
RBIT
Ladder
Logic Elements
31
4.1
Contacts
Contacts are used to pass or inhibit power flow in a ladder logic
program. They are discretei.e., each consumes one I/O point in ladder
logic. A single contact can be tied to a 0x or 1x reference number in the
PLCs state RAM, in which case each contact consumes one node in a
ladder network.
Four kinds of contacts are available:
4.1.1
Normally
Open Contacts
Size
Function
ON
OFF
OFF
ON
Power Flow
OFF
OFF
PLC Compatibility
08 hex
32
Ladder
Logic Elements
4.1.2
Normally
Closed
Contacts
Size
Function
ON
OFF
OFF
Power Flow
ON
ON
OFF
PLC Compatibility
09 hex
4.1.3
Positive
Transitional
Contacts
Size
Ladder
Logic Elements
33
Function
Passes power for only one scan as the contact or coil transitions from
OFF to ON:
ON
P. T. Contact
OFF
ON
Power Flow
OFF
OFF
One Scan
PLC Compatibility
0A hex
4.1.4
Negative
Transitional
Contacts
Size
Function
Passes power for only one scan as the contact or coil transitions from
ON to OFF:
ON
N. T. Contact
OFF
ON
Power Flow
OFF
OFF
One Scan
PLC Compatibility
0B hex
34
Ladder
Logic Elements
Ladder
Logic Elements
35
4.2
Coils
A coil is a discrete output that is turned ON and OFF by power flow in
the logic program. A single coil is tied to a 0x reference in the PLCs
state RAM. Because output values are updated in state RAM by the
PLC, a coil may be used internally in the logic program or externally
via the I/O map to a discrete output unit in the control system. When a
coil is ON, it either passes power to a discrete output circuit or changes
the state of an internal relay contact in state RAM.
There are two types of coils:
4.2.1
A normal coil
Normal
Coils
Size
( )
Function
When power is removed from a PLC, a normal coil will be turned OFF.
Once power is restored , the coil will always be in the OFF state on the
first logic scan.
PLC Compatibility
0C hex
4.2.2
Latched
or Memory-retentive
Coils
Size
36
Ladder
Logic Elements
Symbol
( M)
or
(L )
Function
0D hex
4.2.3
A Simple
Contact-Coil
logic Example
PLC Ladder
Input
Module
10001
10001
Logic
Physical Output
(a lamp)
( )
Output
Module
00001
Engaging the
pushbutton ...
4.2.4
Coil Usage
00001
... turns ON
the lamp
in a Logic Network
Ladder
Logic Elements
37
4.2.5
General
Coil Usage
Guidelines
Capabilities
for Discrete
Values
Via panel software, you may disable a logic coil or a discrete input in
your logic program. A disable condition will cause the input field device
to have no control over its assigned 1x logic and the logic to have no
control over the disabled 0x value.
Memory protection in the PLC must be OFF before you disable (or
enable) a coil or a discrete input.
Caution:
There is an important
exception
you need to be
aware of when disabling coils: data transfer functions that
allow coils in their destination
nodes recognize
the current
ON/OFF state of all coils, whether they are disabled or not,
and cause the logic to respond accordingly . If you are
expecting
a disabled coil to remain disabled in the DX
function, your application
may experience
unexpected
and
undesirable
effects.
Forcing
Discretes
ON and OFF
38
Ladder
Logic Elements
4.3
Shorts
Shorts are simply straight-line connections between contacts and/or
instructions in a ladder logic network. Shorts may be inserted
horizontally or vertically in a network.
4.3.1
Horizontal
Shorts
Size
Function
07 hex
4.3.2
Vertical
Shorts
Size
Unique among logic elements in that it does not use any nodes in a
logic network
Function
Ladder
Logic Elements
39
4.4
to Create
Control
A Logical
AND Circuit
( )
10001
4.4.2
10002
A Logical
10003
00001
OR Circuit
( )
10001 10002
00001
10003
40
Ladder
Logic Elements
4.4.3
A Logical
XOR Circuit
( )
10001
10002
10001
10002
00001
Coil 00001 can be enabled only when one but not both of the following
conditions is true:
4.4.4
The field device sensed by contact 10001 is ON and the field device sensed by contact 10002 is OFF
The field device sensed by contact 10001 is OFF and the field device sensed by contact 10002 is ON
Building
a Seal Circuit
Stop P/B
10002
10001
( )
Motor
Starter
00001
00001
( )
Running
Lamp (Red)
00001 00002
( )
Stopped
Lamp (Green)
00001 00003
Ladder
Logic Elements
41
The Stop pushbutton is sensed by N.C. contact 10001 and makes sure
that no power is being passed through the circuit while it is ON. The
Start pushbutton is sensed by N.O. contact 10002. This contact passes
power only when input 10001 is OFF, causing N.C. contact 10001 to
pass power.
Contact 00001, which is placed in parallel with the Start pushbutton
contact, is pulled ON when the Motor Starter coil (00001) is turned ON.
It latches the Start condition open once contact 10002 has been opened.
Once coil 00001 has been enabled, latched contact 00001 keeps it ON
even after the Start pushbutton has been disengaged; the only way to
turn OFF the coil is by engaging the Stop pushbuttoni.e., turning ON
N.C. contact 10001.
The logic on the bottom two rungs of the network turns ON one of two
colored lamps that indicate the current state of the motor starter. When
the Motor Starter coil is ON, it pulls both of the contacts in the bottom
rungs ON. When these two contacts are ON, N.O. contact 00001
enables coil 00002, which turns ON a red Motor Starter Running lamp,
and N.C. contact 00001 disables coil 00003, which turns OFF a green
Motor Starter Stopped lamp.
When these two contacts are OFF, N.O. contact 00001 disables coil
00002, which turns OFF the Motor Starter Running lamp, and N.C.
contact 00001 enables coil 00003, which turns ON the Motor Starter
Stopped lamp.
42
Ladder
Logic Elements
4.5
Storing
Contacts
RBIT, for resetting a specified bit that has been set in a 4x register
These instructions handle each bit in the register like a discrete point
as follows:
01
02
03
04 05
06 07
08
09 10 11 12
13 14
15 16
point
point
point
point
point
point
point
point
point
point
point
point
point
point
point
point
16
15
14
13
12
11
10
Ladder
Logic Elements
43
Advantages
44
Ladder
Logic Elements
4.6
NOBT
The normally open bit (NOBT) instruction lets you sense the logic state
of a bit in a register by specifying its associated bit number in the
bottom node. The bit is representative of an N.O contact.
4.6.1
Characteristics
Size
Opcode
40 hex
4.6.2
Representation
in Ladder
Logic
Block Structure
ON enables the bit sensing
register
bit
NOBT
bit #
(1 ... 16)
Input
NOBT has one control input to the top node, which enables the
operation when it is ON.
Output
NOBT produces one output from the top node. It passes power when
the top input is ON and when the specified bit is ONi.e., its logic
state is 1.
Ladder
Logic Elements
45
contacts.
is being sensed.
46
Ladder
Logic Elements
4.7
NCBT
The normally closed bit (NCBT) instruction lets you sense the logic
state of a bit in a register by specifying its associated bit number in the
bottom node. The bit is representative of an N.C contact. It passes
power from the top output when the specified bit is OFF and the top
input is ON.
4.7.1
Characteristics
Size
Opcode
41 hex
4.7.2
Representation
in Ladder
Logic
Block Structure
ON enables the bit sensing
register
bit
NCBT
bit #
(1 ... 16)
Input
NCBT has one control input to the top node, which enables the
operation when it is ON.
Output
NCBT produces one output from the top node. It passes power when
the top input is ON and when the specified bit is OFFi.e., its logic
state is zero.
Ladder
Logic Elements
47
contacts.
is being sensed.
48
Ladder
Logic Elements
4.8
NBIT
The normal bit (NBIT) instruction lets you control the state of a bit
from a register by specifying its associated bit number in the bottom
node. The bits being controlled are similar to coilswhen a bit is
turned ON, it stays ON until a control signal turns it OFF.
The NBIT instruction does not follow the same rules of
network placement as 0x -referenced coils do. An NBIT instruction
cannot be placed in column 11 of a network and it can be placed to the
left of other logic nodes on the same rungs of the ladder.
Note:
4.8.1
Characteristics
Size
Opcode
42 hex
4.8.2
Representation
in Ladder
Logic
Block Structure
ON sets the bit to 1
OFF clears the bit to 0
register
NBIT
bit #
(1 ... 16)
Input
NBIT has one control input to the top node, which sets the specified bit
to 1 when it is ON and clears the specified bit to 0 when it is OFF.
Output
NBIT produces one output from the top node. It echos the state of the
top input, thereby indicating the OFF/ON state of the specified bit.
840 USE 101 00
Ladder
Logic Elements
49
Node Contents
The bit # entered in the bottom node indicates which one of the 16 bits
is being controlled.
50
Ladder
Logic Elements
4.9
SBIT
The set bit (SBIT) instruction lets you set the state of the specified bit
to ON (1) by powering the top input.
The SBIT instruction does not follow the same rules of
network placement as 0x -referenced coils do. An SBIT instruction
cannot be placed in column 11 of a network and it can be placed to the
left of other logic nodes on the same rungs of the ladder.
Note:
4.9.1
Characteristics
Size
Opcode
43 hex
4.9.2
Representation
in Ladder
Logic
Block Structure
ON sets the bit to 1
register
SBIT
bit #
(1 ... 16)
Input
SBIT has one control input to the top node, which sets the specified bit
to 1 when it is ON. The bit remains set after power is removed from the
input.
Output
SBIT produces one output from the top node, which echoes the state of
the top input.
Ladder
Logic Elements
51
Node Content
The bit # entered in the bottom node indicates which one of the 16 bits
is being set.
52
Ladder
Logic Elements
4.10
RBIT
The reset bit (RBIT) instruction lets you clear a latched-ON bit by
powering the top input. The bit remains cleared after power is removed
from the input. This instruction is designed to clear a bit set by the
SBIT instruction.
The RBIT instruction does not follow the same rules of
network placement as 0x -referenced coils do. An RBIT instruction
cannot be placed in column 11 of a network and it can be placed to the
left of other logic nodes on the same rungs of the ladder.
Note:
4.10.1
Characteristics
Size
Opcode
44 hex
4.10.2
Representation
in Ladder
Logic
Block Structure
ON clears the bit to 0
register
RBIT
bit #
(1 ... 16)
Input
RBIT has one control input to the top node, which clears the specified
bit to 0 when it is ON.
Output
RBIT produces one output from its top node, which echoes the state of
the top input.
840 USE 101 00
Ladder
Logic Elements
53
Node Content
The bit # entered in the bottom node indicates which one of the 16 bits
is being cleared.
54
Ladder
Logic Elements
4.1 1
Example:
Circuit
Implementing
a Motor Starter
Below are three ladder logic schemes, each designed to control the same
simple motor starter circuit. The first example is a conventional
contact/coil relay logic implementation. The second example is an
imitation of the first example, this time using bits within a register
instead of discretes to control the circuit. The third example shows how
the register implementation can be optimized in ladder logic.
The motor (M1) is is turned ON with a START button mapped to input
1 and turned OFF via a STOP button mapped to input 2. An auxiliary
contact (M1 AUX) is mapped to input 3. This contact will trigger a
timer if for some reason it stays open for a preprogrammed amount of
time after the START button is engaged. The contact will turn M1 OFF
if it has not been closed by the time the timer expires. The only way to
restart M1 after it has been shut OFF by the timer is via a RESET
button, which is mapped to input 4.
A Discrete
Implementation
START
STOP
100001
( )
100001
100002
000003
000001
000001
M1 AUX
M1
000002
100002
100003
RESET
Discrete
Output Module
000001
400100
000003
( )
000002
100003
T0.1
100004
400101
000008
100003
( )
100016
000002
100004
000003
000003
Ladder
Logic Elements
55
The top two rows of logic implement the START and STOP buttons,
passing power to coil 000001 when contact 100001 is made and
removing power when contact 100002 is disengaged.
The middle two rows of logic implement the auxiliary contact (M1
AUX), starting a timer if contact 100001 is made but contact 100003
remains open. If contact 100003 is not made by the time the timer
preset is reached (see page 67), coil 000001 will be turned OFF.
The bottom two rows of logic control the RESET button (100004). If
M1 AUX has turned OFF coil 000001, the only way to restart M1 is by
pushing the RESET button then the START button. If the M1 AUX
contact (100003) still remains open after M1 has been restarted, the
timer will be restarted and M1 AUX will again turn OFF M1 when the
timer preset is reached.
56
Ladder
Logic Elements
A Register
Implementation
Here is another ladder logic scheme that performs the same control
functions. This time, the discrete input module is I/O mapped to bits in
a 3x register and the discrete output module is I/O mapped to bits in a
4x register.
STOP
START
Register
300001
Network
RESET
M1 AUX
9 10 11 12 13 14 15 16
400002
400001
300001
300001
NOBT
NOBT
NCBT
NBIT
001
002
000001
001
400100
400002
400001
NOBT
001
Network
400001
NOBT
SBIT
T0.1
001
000001
400101
300001
NCBT
003
400002
300001
RBIT
NOBT
000001
004
Register
400001
9 10 11 12 13 14 15 16
M1
Ladder
Logic Elements
57
An Optimized
Register
Implementation
300001
NOBT
SBIT
001
Network
400001
000001
400001
NOBT
001
400100
T0.1
400101
400001
RBIT
000001
300001
NCBT
003
300001
NCBT
002
58
Ladder
Logic Elements
Chapter 5
Counters and T imers
UCTR
DCTR
T1.0 Timer
T0.1 Timer
T.01 Timer
T1MS Timer
Counters
and T imers
59
5.1
UCTR
The UCTR instruction counts control input transitions from OFF to ON
up from zero to a counter preset value.
5.1.1
Characteristics
Size
14 hex
5.1.2
Representation
in Ladder
Logic
Block Structure
OFFON initiates up-count
counter
preset
accumulated
count = counter
accumulated
count
preset
UCTR
accumulated
count
Inputs
UCTR has two input controls. The input to the top node initiates the
counter operation. The input to the bottom node is ON while the
counter is accumulating. If it goes OFF, the accumulated count is reset
to zero.
Outputs
UCTR can produce one of two possible outputs. The output from the top
node passes power when the accumulated count reaches the specified
counter preset . The output from the bottom node passes power if the
accumulated
count value falls below the counter preset value.
60
Counters
and T imers
Allowable
1 ... 999
Integer
1 ... 9,999
Range
5.1.3
Up-Counter
00100
10027
UCTR
40007
00077
of
Example
( )
00077
( )
00055
Counters
and T imers
61
5.2
DCTR
The DCTR instruction counts control input transitions from OFF to ON
down from a counter preset value to zero.
5.2.1
Characteristics
Size
13 hex
5.2.2
Representation
in Ladder
Logic
Block Structure
OFFON initiates
down-count
counter
preset
accumulated
count
=0
accumulated
count
>0
DCTR
accumulated
count
Inputs
DCTR has two input controls. The input to the top node initiates the
counter operation. The input to the bottom node is ON while the
counter is accumulating. If it goes OFF, the accumulated count is reset
to the counter preset value.
Outputs
DCTR can produce one of two possible outputs. The output from the top
node passes power when the accumulated count decrements to zero.
The output from the bottom node passes power if the accumulated
count value is greater than the zero.
62
Counters
and T imers
Allowable
1 ... 999
Integer
1 ... 9,999
Range
Counters
and T imers
of
63
5.3
T1.0 T imer
The T1.0 timer instruction measures time in one-second increments. It
can be used for timing an event or creating a delay.
5.3.1
Characteristics
Size
15 hex
5.3.2
Representation
in Ladder
Logic
Block Structure
Time accumulates in seconds
when top and bottom inputs
are ON
timer
preset
accumulated
accumulated
time
T1.0
accumulated
time
Inputs
T1.0 has two input controls. The input to the top node initiates the
timer operation. The input to the bottom node is ON while the timer is
accumulating. If it goes OFF, the accumulated time is reset to zero.
Outputs
T1.0 can produce one of two possible outputs. The output from the top
node passes power when the accumulated time reaches the specified
timer preset value. The output from the bottom node passes power if the
accumulated
time value drops below the timer preset value.
64
Counters
and T imers
Allowable
1 ... 999
Integer
1 ... 9,999
Range
time
Caution:
If you cascade T1.0 timers with presets of 1, the
timers will time-out together; to avoid this problem, change
the presets to 10 and substitute
a T0.1 timer .
Counters
and T imers
65
5.3.3
A One-second
00005
( )
00107
10001
T1.0
40040
10002
Timer Example
( )
00108
The example above assumes that 10002 is closed (timer enabled) and
that the value contained in register 40040 is 0. Because 40040 does not
equal the timer preset (5), coil 00107 is OFF and coil 00108 is ON.
When 10001 is closed, 40040 begins to accumulate counts at 1 s
intervals until it reaches 5. At that point, 00107 is ON and 00108 is
OFF.
When 10002 is opened, 40040 resets to 0, coil 00107 goes OFF, and
00108 goes ON.
Note:
If the accumulated time value is less than the timer preset
value, the bottom output will pass power even though no inputs to the
block are present.
66
Counters
and T imers
5.4
T0.1 T imer
A T0.1 instruction measures time in in tenth-of-a-second increments. It
can be used for timing an event or creating a delay. T0.1 has two
control inputs and can produce one of two possible outputs. An output
passing power indicates a timer error.
5.4.1
Characteristics
Size
16 hex
5.4.2
Representation
in Ladder
Logic
Block Structure
Time accumulates in tenths
of a second when this and
the bottom input are ON
timer
preset
accumulated
accumulated
time
T0.1
accumulated
time
Inputs
T0.1 has two input controls. The input to the top node initiates the
timer operation. The input to the bottom node is ON while the timer is
accumulating. If it goes OFF, the accumulated time is reset to zero.
Outputs
T0.1 can produce one of two possible outputs. The output from the top
node passes power when the accumulated time reaches the specified
timer preset value. The output from the bottom node passes power if the
accumulated
time value drops below the timer preset value.
Counters
and T imers
67
Allowable
1 ... 999
1 ... 9,999
Integer
Range
time
Caution:
If you cascade T0.1 timers with presets of 1, the
timers will time-out together; to avoid this problem, change
the presets to 10 and substitute
a T.01 timer .
68
Counters
and T imers
5.5
T.01 T imer
The T.01 instruction measures time in hundredth-of-a-second intervals.
It can be used for timing an event or creating a delay. T.01 has two
control inputs and can produce one of two possible outputs. An output
passing power indicates a timer error.
5.5.1
Characteristics
Size
17 hex
5.5.2
Representation
in Ladder
Logic
Block Structure
Time accumulates in hundredths
of a second when this and the
bottom input are ON
timer
preset
accumulated
accumulated
time
T.01
accumulated
time
Inputs
T.01 has two input controls. The input to the top node initiates the
timer operation. The input to the bottom node is ON while the timer is
accumulating. If it goes OFF, the accumulated time is reset to zero.
Outputs
T.01 can produce one of two possible outputs. The output from the top
node passes power when the accumulated time reaches the specified
timer preset value. The output from the bottom node passes power if the
accumulated
time value drops below the timer preset value.
Counters
and T imers
69
Allowable
1 ... 999
1 ... 9,999
Integer
Range
70
Counters
and T imers
time
5.6
T1MS T imer
The T1MS instruction measures time in ms intervals. It can be used
for timing an event or creating a delay. T1MS has two control inputs (to
the top and middle nodes) and can produce one of two possible outputs.
An output passing power from the top or middle node indicates a timer
error.
5.6.1
Characteristics
Size
Opcode
1E hex
5.6.2
Representation
in Ladder
Logic
Block Structure
Time accumulates in ms
when this and the middle
input are ON
OFF = accumulator reset to 0
ON = timer accumulating
timer
preset
accumulated
time
accumulated
accumulated
time
T1MS
#1
Inputs
T1MS has two input controls. The input to the top node initiates the
timer operation. The input to the middle node is ON while the timer is
accumulating. If it goes OFF, the accumulated time is reset to zero.
Counters
and T imers
71
Outputs
T1MS can produce one of two possible outputs. The output from the top
node passes power when the accumulated time reaches the specified
timer preset value. The output from the middle node passes power if the
accumulated
time value drops below the timer preset value.
Top Node Content
The timer preset stored
in ms increments.
Bottom
time
Node Content
A Millisecond
Timer Example
Here is the ladder logic for a real-time clock with millisecond accuracy.
This example can be programmed only for a Micro PLC:
100
( )
00001
40055
10
00001
( )
00002
T1MS
UCTR
40054
60
( )
00003
UCTR
00002
40053
60
( )
00004
UCTR
00003
40052
24
( )
00005
00004
UCTR
40051
00005
72
Counters
and T imers
Unit of T ime
Valid Range
40055
thousandths-of-a-second
0 ... 100
40054
tenths-of-a-second
0 ... 10
40053
seconds
0 ... 60
40052
minutes
0 ... 60
40051
hours
0 ... 24
Counters
and T imers
73
Chapter 6
Integer and 16-bit Math
Instructions
Math Instructions
75
6.1
ADD
The ADD instruction adds unsigned value 1 (its top node) to unsigned
(its middle node) and stores the sum in a holding register in the
bottom node.
value 2
6.1.1
Characteristics
Size
18 hex
6.1.2
Representation
in Ladder
Logic
Block Structure
ON = add value 1
and value 2
value 1
overflow
(sum > 999 in 16-bit CPU,
sum > 9,999 in a 24-bit CPU)
value 2
ADD
sum
Input
ADD has one control input (to the top node), which initiates the
operation when it is ON.
Output
ADD can produce one possible output. The output passing power from
the top node indicates an overflow in the value of the sum .
76
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
operation.
Math Instructions
77
6.2
SUB
The SUB instruction performs an absolute subtraction of
value 2 (top node middle node) and stores the difference
holding register in the bottom node.
value 1
6.2.1
in a
Characteristics
Size
19 hex
6.2.2
Representation
in Ladder
Logic
Block Structure
ON enables
value 1
value 1
value 2
value 1 = value 2
value 2
SUB
difference
Input
SUB has one control input (to the top node), which initiates the
operation when it is ON.
Outputs
SUB produces one of three possible outputs. The state of the outputs
indicates the result of a magnitude comparison between value 1 and
value 2 . SUB is often used as a comparator where the state of the
outputs identifies whether value 1 is greater than, equal to, or less than
value 2 .
78
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
Math Instructions
79
6.3
MUL
The MUL instruction multiplies unsigned value 1 (its top node) by
unsigned value 2 (its middle node) and stores the product in two
contiguous holding registers in the bottom node.
6.3.1
Characteristics
Size
1A hex
6.3.2
Representation
in Ladder
Logic
Block Structure
ON = value 1
multiplied by value 2
value 1
value 2
MUL
result
Input
MUL has one control input (to the top node), which initiates the
operation when it is ON.
Output
MUL produces an output from the top node, which echoes the state of
the top input.
80
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
Math Instructions
81
6.4
DIV
The DIV instruction divides unsigned value 1 (its top node) by unsigned
(its middle node) and posts the quotient and remainder in two
contiguous holding registers in the bottom node.
value 2
6.4.1
Characteristics
Size
1B hex
6.4.2
Representation
in Ladder
Logic
Block Structure
ON = value 1
divided by value 2
ON = decimal remainder
OFF = fraction remainder
value 1
division successful
value 2
DIV
result /
remainder
value 2
=0
Inputs
DIV has two control inputs (to the top and middle nodes). The top input
initiates the operation when it is ON.
The state of the input to the middle node indicates whether the
will be expressed as a decimal or as a fraction. For example,
= 8 and value 2 = 3, the decimal remainder (middle input ON)
is 6666; the fractional remainder (middle input OFF) is 2.
remainder
if value 1
82
Math Instructions
Outputs
DIV can produce one of three possible outputs. Power passed at the top
output indicates the successful completion of a DIV operation. Power
passed from the middle or bottom output indicates an error in the
operation.
Top Node Content
Bottom
Node Content
The 4x register entered in the bottom node is the first of two contiguous
holding registers. The result of the division is posted in the displayed
register. The remainder is posted in the implied register as either a
decimal or a fraction (depending on the state of the middle input).
Math Instructions
83
6.5
AD16
The AD16 instruction performs signed or unsigned 16-bit addition on
value 1 (its top node) and value 2 (its middle node), then posts the sum
in a 4x holding register in the bottom node.
6.5.1
Characteristics
Size
Opcode
31 hex
6.5.2
Representation
in Ladder
Logic
Block Structure
ON enables value 1 + value 2
value 1
value 2
ON = signed operation
OFF = unsigned operation
AD16
sum
sum
Inputs
AD16 has two control inputs (to the top and bottom nodes). The top
input initiates the operation when it is ON. The state of the bottom
input indicates whether the addition will be a signed or unsigned
operation.
Outputs
AD16 can produce one of two possible outputs. Power passed at the top
output indicates the successful completion of a AD16 operation. Power
passed from the bottom output indicates an overflow in the sum .
84
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
addition.
Math Instructions
85
6.6
SU16
The SU16 instruction performs a signed or unsigned 16-bit subtraction
(value 1 value 2 ) on the top and middle node values, then posts the
signed or unsigned difference in a 4x holding register in the bottom
node.
6.6.1
Characteristics
Size
Opcode
32 hex
6.6.2
Representation
in Ladder
Logic
Block Structure
ON enables value 1
value 2
ON = signed operation
OFF = unsigned operation
value 1
value 1
> value 2
value 2
value 1
= value 2
value 1
< value 2
SU16
difference
Inputs
SU16 has two control inputs (to the top and bottom nodes). The top
input initiates the operation when it is ON. The state of the bottom
input indicates whether the addition will be a signed or unsigned
operation.
Outputs
SU16 produces one of three possible outputs. The state of the outputs
indicates the relationship between value 1 and value 2 .
86
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
the signed or
Math Instructions
87
6.7
TEST
The TEST instruction compares the signed or unsigned size of the
16-bit values in the top and middle nodes and describes the
relationship via the states of the block outputs.
6.7.1
Characteristics
Size
Opcode
35 hex
6.7.2
Representation
in Ladder
Logic
Block Structure
ON compares value 1 and value 2
ON = signed operation
OFF = unsigned operation
value 1
value 1
> value 2
value 2
value 1
= value 2
value 1
< value 2
TEST
Inputs
TEST has two control inputs (to the top and bottom nodes). The top
input initiates the operation when it is ON. The state of the bottom
input indicates whether the comparison will be a signed or unsigned
operation.
Outputs
TEST produces one of three possible outputs. The state of the outputs
indicates the relationship between value 1 and value 2 .
88
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
Bottom
Node Content
Math Instructions
89
6.8
MU16
The MU16 instruction performs signed or unsigned multiplication on
the 16-bit values in the top and middle nodes, then posts the product in
two contiguous holding registers in the bottom node.
6.8.1
Characteristics
Size
Opcode
33 hex
6.8.2
Representation
in Ladder
Logic
Block Structure
Enables value 1 x value 2
value 1
value 2
ON = signed operation
OFF = unsigned operation
MU16
product
Inputs
MU16 has two control inputs (to the top and bottom nodes). The top
input initiates the operation when it is ON. The state of the bottom
input indicates whether the multiplication will be a signed or unsigned
operation.
Output
MU16 produces one output from the top node, which echoes the state of
the top input.
90
Math Instructions
The top and middle nodes contain value 1 and value 2 , respectively. The
value in each node may be:
V
Bottom
Node Content
Math Instructions
91
Note:
For E984-685 PLCs, Executive firmware revisions 2.10 and
lower use the displayed register in the bottom node to store the
high-order half of the product and the implied register to store the
low-order half. Firmware revisions 2.11 and later store the low-order
half of the product in the displayed register and the high-order half in
the implied register.
For E984-785 PLCs, Executive firmware revisions 1.10 and lower use
the displayed register in the bottom node to store the high-order half
of the product and the implied register to store the low-order half.
Firmware revisions 1.11 and later store the low-order half of the
product in the displayed register and the high-order half in the
implied register.
92
Math Instructions
6.9
DV16
The DV16 instruction performs a signed or unsigned division on the
16-bit values in the top and middle nodes (value 1 / value 2 ), then posts
the quotient and remainder in two contiguous 4x holding registers in
the bottom node.
6.9.1
Characteristics
Size
Opcode
34 hex
6.9.2
Representation
in Ladder
Logic
Block Structure
Enables value 1 / value 2
value 1
ON = decimal remainder
OFF = fraction remainder
value 2
ON = signed operation
OFF = unsigned operation
DV16
quotient
quotient
value 2
=0
Inputs
DV16 has three control inputs. The top input initiates the operation
when it is ON. The state of the input to the middle node indicates
whether the remainder will be expressed as a decimal or as a fraction.
For example, if value 1 = 8 and value 2 = 3, the decimal remainder
(middle input ON) is 6666; the fractional remainder (middle input OFF)
is 2.
The state of the bottom input indicates whether the addition will be a
signed or unsigned operation.
840 USE 101 00
Math Instructions
93
Outputs
DV16 can produce one of three possible outputs. Power passed at the
top output indicates the successful completion of a DIV operation;
power passed from at the middle or bottom output indicates an error in
the operation.
Top Node Content
When the values in the top and middle nodes are displayed via
registers, they can have unsigned values in the range
1 ... 4,294,967,295. If a value > 65,535, it can be displayed only in long
decimal format. If you are using panel software that does not support
long decimal format, the value of the product will not be seen. (Modsoft
does support long decimal format.)
In some versions of the E984-685 and E984-785 System Executives, the
high-order half of value 1 is stored in the displayed register in the top
node; in other Exec versions, the low-order half of value 1 is stored in
the displayed register. This new format makes the instruction work
together with the host interface, MSL, PCFL, and custom loadable
functions without conversion; the new format follows Intel double-word
conventions.
Caution:
Before you upgrade your PLC Executive
in Flash,
you need to know what revision level of the Executive
was
used to create your ladder logic program. If you have created
the program with one of the early versions of the Executive
described
above and then load a later version, the logic scan
will read the value 1 registers in a different order , and,
depending
on the way the logic is used, it may misinterpret
the dividend to be used in the divide operation.
94
Math Instructions
Note:
For E984-685 PLCs, Executive firmware revisions 2.10 and
lower store the high-order half of value 1 in the displayed register in
the top node and the low-order half of value 1 in the implied register.
Firmware revisions 2.11 and later store the low-order half of value 1
in the displayed register and the high-order half of in the implied
register.
Note:
Math Instructions
95
6.10
IT OF
The ITOF instruction performs the conversion of a signed or unsigned
integer value (its top node) to a floating point (FP) value, and stores the
FP value in two contiguous 4x registers in the middle node.
6.10.1
Characteristics
Size
Opcode
36 hex
6.10.2
Representation
in Ladder
Logic
Block Structure
ON enables conversion
integer
converted
FP
ON = signed operation
OFF = unsigned operation
IT OF
Inputs
ITOF has two control inputs (to its top and bottom nodes). The top
input initiates the operation when it is ON. The state of the bottom
input indicates whether the conversion will be a signed or unsigned
operation.
Output
ITOF produces one output from the top node upon successful
completion of the conversion.
96
Math Instructions
Note:
The 4x register entered in the middle node is the first of two contiguous
holding registers where the converted FP value is stored.
Bottom
Node Content
Math Instructions
97
6.1 1
FT OI
The FTOI instruction performs the conversion of a floating value to a
signed or unsigned integer (stored in two contiguous registers in the
top node), then stores the converted integer value in a 4x register in the
middle node.
6.1 1.1
Characteristics
Size
Opcode
37 hex
6.1 1.2
Representation
in Ladder
Logic
Block Structure
Enables conversion
FP
converted
integer
ON = signed operation
OFF = unsigned operation
FT OI
Inputs
FTOI has two control inputs (to its top and bottom nodes). The top
input initiates the operation when it is ON. The state of the bottom
input indicates whether the conversion will be a signed or unsigned
operation.
Outputs
FTOI produces two possible outputs. The output from the top node goes
ON upon successful completion of the conversion. If the output from the
98
Math Instructions
bottom node passes power, the value of the converted integer value is
out of range.
Top Node Content
The 4x register entered
Node Content
Math Instructions
99
6.12
BCD
The BCD instruction can be used to convert a binary value to a binary
coded decimal (BCD) value or a BCD value to a binary value. The type
of conversion to be performed is controlled by the state of the bottom
input.
6.12.1
Characteristics
Size
Opcode
53 hex
6.12.2
Representation
in Ladder
Logic
Block Structure
Enables conversion
source
register
destination
register
ON = BCDbinary conversion
OFF = binaryBCD conversion
BCD
error
Inputs
BCD has two control inputs (to its top and bottom nodes). The top input
initiates the operation when it is ON. The state of the bottom input
indicates the type of conversion to be performedwhen ON, a
BCD-to-binary format conversion is performed, and when OFF, a
binary-to-BCD format conversion is performed.
Outputs
FTOI produces two possible outputs. The output from the top node
echoes the state of the top input. The output from the bottom node will
pass power if an error has been detected in the conversion operation.
100
Math Instructions
Bottom
register
Node Content
Math Instructions
101
6.13
A Fahrenheit-to-Centigrade
Example
30001
41201
41202
00032
00005
00009
SUB
MUL
41201
41202
Conversion
DIV
40001
( )
00011
C = ( F
32) x 5/9
When the top input of the SUB instruction receives power, the number
32 is subtracted from the value in register 30001, which represents
some number of degrees Fahrenheit. The result is placed in register
41201.
The top input to the MUL instruction then receives power, whether the
SUB result is positive, negative, or 0. If the SUB result is negative, coil
00011 is energized to indicate a negative value.
The value in register 41201 is then multiplied by 5, and the result is
placed in registers 41202 and 41203. The top input of the DIV
instruction is then energized, and the value in registers 41202 and
41203 is divided by 9. The result , which is the temperature conversion
in degrees Centigrade, is placed in register 40001.
102
Math Instructions
Chapter 7
Enhanced Math Capabilities
Enhanced
Math Capabilities
103
7.1
Capabilities
Characteristics
Size
Standard in all PLC models except the 984A, 984B, or 984X Chassis Mount PLCs and the 110CPU311 and 110CPU411 Micro PLCs
Opcode
7F hex
7.1.2
Representation
Generic
in Ladder
Logic
Block Structure
Top In
Middle In
top
node
Top Out
middle
node
Middle Out
EMTH
Bottom
In
indicator
Bottom
Out
104
Enhanced
Math Capabilities
The middle node requires either two, four, or six consecutive registers,
depending on the function you are implementing. Use 4x holding
registers.
Bottom
Node Content
Indicator
Active Inputs
Active Outputs
Addition
ADDDP
Top only
Top, Middle
Subtraction
SUBDP
Top only
Multiplication
MULDP
Top only
Top, Middle
Division
DIVDP
Top, Middle
Square root
SQRT
Top only
Top, Middle
SQRTP
Top only
Top, Middle
Logarithm
LOG
Top only
Top, Middle
Antilogarithm
ANLOG
Top only
Top, Middle
Integer-to-FP conversion
CNVIF
Top only
Top only
Integer + FP
ADDIF
Top only
Top only
Integer
Double
Precision
Integer
Math
Floating
Math
Point Math
FP
SUBIF
Top only
Top only
Integer x FP
MULIF
Top only
Top only
Integer : FP
DIVIF
Top only
Top only
FP
SUBFI
Top only
Top only
FP : Integer
Integer
DIVFI
Top only
Top only
Integer-FP comparison
CMPIF
Top only
Top only
FP-to-Integer conversion
CNVFI
Top only
Top, Bottom
Addition
ADDFP
Top only
Top only
Subtraction
SUBFP
Top only
Top only
Multiplication
MULFP
Top only
Top only
Division
DIVFP
Top only
Top only
Comparison
CMPFP
Top only
Square root
SQRFP
Top only
Top only
Change sign
CHSIN
Top only
Top only
Load Value of p
PI
Top only
Top only
Sine in radians
SINE
Top only
Top only
Enhanced
Math Capabilities
105
106
Enhanced
Cosine in radians
COS
Top only
Top only
Tangent in radians
TAN
Top only
Top only
Arcsine in radians
ARSIN
Top only
Top only
Arccosine in radians
ARCOS
Top only
Top only
Arctangent in radians
ARTAN
Top only
Top only
Radians to degrees
CNVRD
Top only
Top only
Degrees to radians
CNVDR
Top only
Top only
FP to an integer power
POW
Top only
Top only
Exponential function
EXP
Top only
Top only
Natural log
LNFP
Top only
Top only
Common log
LOGFP
Top only
Top only
Report errors
ERLOG
Top only
Top, Middle
Math Capabilities
7.2
7.2.1
Double
Double
Precision
Precision
EMTH Functions
Addition
Block Structure
ON adds operands and
posts sum in designated
registers
operand
operand 2
and sum
ON = operation successful
ON = operand out of range or invalid
EMTH
ADDDP
The first of two contiguous 4x registers is entered in the top node. The
second 4x register is implied. Operand 1 is stored here.
Each register holds a value in the range 0000 ... 9999, for a combined
double precision value in the range 0 ... 99,999,999. The high-order half
of operand 1 is stored in the displayed register, and the low-order half
is stored in the implied register.
Middle Node Content
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The third and fourth implied registers store the high-order and
low-order halves of the double precision sum, respectively
The fifth implied register is not used in the calculation but must
exist in state RAM
Enhanced
Math Capabilities
107
7.2.2
Double
Precision
Subtraction
Block Structure
ON subtracts operand 2 from
operand 1 and posts difference
in designated registers
operand
operand 2 /
difference
ON = operand 1 = operand 2
EMTH
SUBDP
The first of two contiguous 4x registers is entered in the top node. The
second 4x register is implied. Operand 1 is stored here.
Each register holds a value in the range 0000 ... 9999, for a combined
double precision value in the range 0 ... 99,999,999. The low-order half
of operand 1 is stored in the displayed register, and the high-order half
is stored in the implied register.
Middle Node Content
108
Enhanced
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The second and third implied registers store the high-order and
low-order halves, respectively, of the absolute difference in double
precision format
The fifth implied register is not used in this calculation but must
exist in state RAM
Math Capabilities
7.2.3
Double
Precision
Multiplication
Block Structure
ON = operand 1 x operand 2
and product posted in designated
registers
operand
operand 2 /
product
ON = operation successful
EMTH
MULDP
The first of two contiguous 4x registers is entered in the top node. The
second 4x register is implied. Operand 1 is stored here.
The second 4x register is implied. Each register holds a value in the
range 0000 ... 9999, for a combined double precision value in the range
0 ... 99,999,999. The high-order half of operand 1 is stored in the
displayed register, and the low-order half is stored in the implied
register.
Middle Node Content
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The last four implied registers store the double precision product
in the range 0 ... 9,999,999,999,999,999
Enhanced
Math Capabilities
109
7.2.4
Double
Precision
Division
Block Structure
ON = operand 1 divided by
operand 2 and result posted
in designated registers
ON = decimal remainder
OFF = fractional remainder
operand
operand 2
quotient
remainder
EMTH
ON = operation successful
DIVDP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. Operand 1 is stored here.
Each register holds a value in the range 0000 ... 9999, for a combined
double precision value in the range 0 ... 99,999,999. The high-order half
of operand 1 is stored in the displayed register, and the low-order half
is stored in the implied register.
Middle Node Content
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
110
Enhanced
The fourth and fifth implied registers store the remainder if the
remainder is expressed as a fraction, it is eight digits long and
both registers are used; if the remainder is expressed as a decimal, it is four digits long and only the fourth implied register is
used
Math Capabilities
7.3
7.3.1
Integer
Square
EMTH Functions
Root
Block Structure
ON initiates a standard
operation
source
ON = operation successful
result
EMTH
SQRT
Enter the first of two contiguous 4x registers in the middle node. The
second register is implied. The result of the standard square root
operation is stored here.
The result is stored in the fixed-decimal format: 1234.5600. where the
displayed register stores the four-digit value to the left of the first
decimal point and the implied register stores the four-digit value to the
right of the first decimal point. Numbers after the second decimal point
are truncated; no round-off calculations are performed.
Enhanced
Math Capabilities
111
7.3.2
Process
Square
Root
The process square root function tailors the standard square root
function for closed loop analog control applications. It takes the result
of the standard square root result, multiplies it by 63.9922the square
root of 4095and stores that linearized result in the middle-node
registers.
Block Structure
ON initiates process operation
source
linearized
result
ON = operation successful
ON = source value out of range
EMTH
SQRTP
7.3.2.1
Middle
Node Content
112
Enhanced
Math Capabilities
Square
Root Function
W orks
Look at the instruction example below for a quick overview of how the
process square root is calculated.
30030
40030
EMTH
SQRTP
= 0044.72
Enhanced
Math Capabilities
113
7.3.3
Base 10 Logarithm
Block Structure
ON enables log(x) operation
source
ON = operation successful
result
EMTH
LOG
The middle node contains a single 4x holding register where the result
of the base 10 log calculation is posted. The result is expressed in the
fixed decimal format 1.234 , and is truncated after the third decimal
position.
The largest result that can be calculated is 7.999, which would be
posted in the middle register as 7999.
114
Enhanced
Math Capabilities
7.3.4
Base 10 Antilogarithm
Block Structure
ON enables antilog(x) operation
source
ON = operation successful
result
EMTH
ANLOG
Enhanced
Math Capabilities
115
7.4
Floating
To make use of the floating point (FP) capability, the four-digit integer
values used in standard math instructions (see Chapter 6) must be
converted to the IEEE floating point format. All calculations are then
performed in FP format, and the results must be converted back to
integer format.
7.4.1
Point Standard
Dealing
with Negative
Floating
Point Numbers
116
Enhanced
Math Capabilities
7.4.3
Integer-to-Floating
Point Conversion
Block Structure
ON initiates integer- to-FP conversion
integer
ON = operation successful
result
EMTH
CNVIF
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The double precision integer value to be
converted to 32-bit FP format is stored here.
If an invalid integer value ( > 9999) is entered in either of the
two top-node registers, the FP conversion will be performed but an
error will be reported and logged in the EMTH ERLOG function (see
page 138). The result of the conversion may not be correct.
Note:
Enhanced
Math Capabilities
117
7.4.4
Integer
+ Floating
Point Addition
Block Structure
ON initiates integer + FP operation
integer
ON = operation successful
FP and
sum
EMTH
ADDIF
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The double precision integer value to be
added to the FP value is stored here.
Middle Node Content
Integer
Floating
Point Subtraction
Block Structure
ON initiates integer
FP operation
integer
ON = operation successful
FP and
difference
EMTH
SUBIF
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The double precision integer value from
which the FP value is subtracted is stored here.
Middle Node Content
Enhanced
Math Capabilities
the first implied register store the FP value to be subtracted from the
value, and the difference is posted in the second and third
implied registers. The difference is posted in FP format.
integer
7.4.6
Integer
x Floating
Point Multiplication
Block Structure
ON initiates integer x FP operation
ON = operation successful
integer
FP and
product
EMTH
MULIF
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The double precision integer value to be
multiplied by the FP value is stored here.
Middle Node Content
Integer
Divided
by Floating
Point
Block Structure
ON initiates integer / FP
integer
ON = operation successful
FP and
quotient
EMTH
DIVIF
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The double precision integer value to be
divided by the FP value is stored here.
840 USE 101 00
Enhanced
Math Capabilities
119
Floating
Point
Integer
Subtraction
Block Structure
ON initiates FP
integer
operation
FP
ON = operation successful
integer and
difference
EMTH
SUBFI
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The FP value from which the integer value is
subtracted is stored here.
Middle Node Content
Floating
Point Divided
by Integer
Block Structure
ON initiates FP / integer operation
FP
ON = operation successful
integer and
quotient
EMTH
DIVFI
120
Enhanced
Math Capabilities
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The FP value to be divided by the integer
value is stored here.
Middle Node Content
Integer-Floating
Point Comparison
Output
Bottom
Output
Relationship
ON
OFF
integer
> FP
OFF
ON
integer
< FP
ON
ON
integer
= FP
Block Structure
ON initiates comparison
integer
ON = operation successful
FP
EMTH
CMPIF
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The double precision integer value to be
compared is stored here.
Middle Node Content
Enhanced
Math Capabilities
121
7.4.1 1
Floating
Point-to-Integer
Conversion
Block Structure
ON initiates FP -to-integer conversion
FP
ON = operation successful
integer
EMTH
CNVFI
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The FP value to be converted is stored here.
Middle Node Content
The displayed register and the first implied register in the middle node
are not used in the conversion but their allocation in state RAM is
required.
T ip:
To preserve registers, you can make the 4x reference numbers
assigned to the displayed register and the first implied register in the
middle node equal to the register references in the top node, since the
first two middle-node registers are not used.
122
Enhanced
Math Capabilities
7.4.12
Floating
Point Addition
Block Structure
ON enables FP addition
ON = operation successful
value 1
value 2
and sum
EMTH
ADDFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. FP value 1 in the addition is stored here.
Middle Node Content
Floating
Point Subtraction
Block Structure
ON initiates FP value 1
subtraction
value 2
value 1
ON = operation successful
value 2 and
difference
EMTH
SUBFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. FP value 1 the value from which value 2
will be subtractedis stored here.
Middle Node Content
Enhanced
Math Capabilities
123
Floating
Point Multiplication
Block Structure
ON initiates FP multiplication
value 1
ON = operation successful
value 2 and
product
EMTH
MULFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. FP value 1 in the multiplication operation is
stored here.
Middle Node Content
Floating
Point Division
Block Structure
ON initiates value 1 / value 2 operation
value 1
ON = operation successful
value 2 and
quotient
EMTH
DIVFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. FP value 1 , which will be divided by the
value 2 , is stored here.
124
Enhanced
Math Capabilities
Floating
Point Comparison
Output
Bottom
ON
Output
Relationship
OFF
value 1
> value 2
OFF
ON
value 1
< value 2
ON
ON
value 1
= value 2
Block Structure
ON initiates comparison
value 1
ON = operation successful
value 2
EMTH
CMPFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The first FP value (value 1 ) to be compared
is stored here.
Middle Node Content
Enhanced
Math Capabilities
125
7.4.17
Floating
Point Square
Root
Block Structure
ON initiates on FP value
ON = operation successful
value
result
EMTH
SQRFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The FP value on which the square root
operation is performed is stored here.
Middle Node Content
7.4.18
Changing
Point Number
Block Structure
ON changes the sign of FP value
value
ON = operation successful
(value )
EMTH
CHSIN
126
Enhanced
Math Capabilities
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The FP value whose sign will be changed is
stored here.
Middle Node Content
7.4.19
Point Value of
Block Structure
ON loads FP value of p
to middle-node registers
not used
ON = operation successful
FP value
of
EMTH
PI
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. These registers are not used but their
allocation in state RAM is required.
Middle Node Content
Enhanced
Math Capabilities
127
T ip:
To preserve registers, you can make the 4x reference numbers
assigned to the displayed register and the first implied register in the
middle node equal to the register references in the top node, since the
first two middle-node registers are not used.
7.4.20
Floating
Block Structure
ON calculates the sine
of the value
value
ON = operation successful
sine of
value
EMTH
SINE
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. An FP value indicating the value of an angle
in radians is stored here. The magnitude of this value must be <
65536.0; if not:
V
128
Enhanced
Math Capabilities
7.4.21
Floating
Point Cosine
Block Structure
ON calculates the cosine
of the FP value
value
ON = operation successful
cosine of
value
EMTH
COS
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. An FP value indicating the value of an angle
in radians is stored here. The magnitude of this value must be <
65536.0; if not:
V
Enhanced
Math Capabilities
129
7.4.22
Floating
Point Tangent
Block Structure
ON calculates the tangent
of FP value
value
ON = operation successful
tangent of
value
EMTH
TAN
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. A value in FP format indicating the value of
an angle in radians is stored here. The magnitude of this value must be
< 65536.0; if not:
Middle Node Content
7.4.23
Floating
Point Arcsine
Block Structure
ON calculates the arcsine
of the FP value
value
ON = operation successful
arcsine of
value
EMTH
ARSIN
130
Enhanced
Math Capabilities
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. An FP value indicating the sine of an angle
between p/2 ... p/2 radians is stored here. This value the sine of an
anglemust be in the range of 1.0 ... +1.0; if not:
V
7.4.24
Floating
Block Structure
ON calculates arc cosine
of the FP value
value
ON = operation successful
arc cosine
of value
EMTH
ARCOS
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. An FP value indicating the cosine of an
angle between 0 ... p radians is stored here. This value must be in the
range of 1.0 ... +1.0; if not:
Enhanced
Math Capabilities
131
7.4.25
Floating
Block Structure
ON calculates the arc tangent
of the FP value
value
ON = operation successful
arc tangent
of value
EMTH
ARTAN
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. An FP value indicating the tangent of an
angle between p/2 ... p/2 radians is stored here. Any valid FP value is
allowed.
Middle Node Content
Enhanced
Math Capabilities
first implied register are not used but their allocation in state RAM is
required.
T ip:
To preserve registers, you can make the 4x reference numbers
assigned to the displayed register and the first implied register in the
middle node equal to the register references in the top node, since the
first two middle-node registers are not used.
7.4.26
Floating
Point Conversion
of Radians
to Degrees
Block Structure
ON initiates conversion
of value 1 to value 2
value
ON = operation successful
result
EMTH
CNVRD
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The value in FP format of an angle in
radians is stored here.
Middle Node Content
Enhanced
Math Capabilities
133
7.4.27
Floating
Point Conversion
of Degrees
to Radians
Block Structure
ON initiates conversion of
value 1 to value 2
ON = operation successful
value
result
EMTH
CNVDR
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The value in FP format of an angle in
degrees is stored here.
Middle Node Content
7.4.28
Raising
a Floating
Point Number
to an Integer
Power
Block Structure
ON calculates FP value raised
to the power of int value
FP value
ON = operation successful
integer
and result
EMTH
POW
134
Enhanced
Math Capabilities
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. The FP value to be raised to the integer
power is stored here.
Middle Node Content
Floating
Point Exponential
Function
Block Structure
ON calculates exponential
of the value
value
ON = operation successful
result
EMTH
EXP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. A value in FP format in the range 87.34 ...
+88.72 is stored here.
If the value is out of range, the result will either be 0 or the maximum
value. No error will be flagged.
Middle Node Content
Enhanced
Math Capabilities
135
T ip:
To preserve registers, you can make the 4x reference numbers
assigned to the displayed register and the first implied register in the
middle node equal to the register references in the top node, since the
first two middle-node registers are not used.
7.4.30
Floating
Point Natural
Logarithm
Block Structure
ON calculates the natural log
of the value
value
ON = operation successful
result
EMTH
LNFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. A value > 0 is stored here in FP format.
If the value < 0, an invalid result will be returned in the middle node
and an error will be logged in the EMTH ERLOG function (see page
138).
Middle Node Content
136
Enhanced
Math Capabilities
7.4.31
Floating
Point Common
Logarithm
Block Structure
ON calculates the common log of the value
value
ON = operation successful
result
EMTH
LOGFP
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. A value > 0 is stored here in FP format.
If the value < 0, an invalid result will be returned in the middle node
and an error will be logged in the EMTH ERLOG function (see page
138).
Middle Node Content
Enhanced
Math Capabilities
137
7.4.32
Floating
Log
Block Structure
not
used
ON = retrieval successful
error
data
EMTH
ERLOG
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. These two registers are not used in the
operation but their allocation in state RAM is required.
Middle Node Content
Function Code of
Last Error Logged
10
11
12
13
14
15
16
Not Used
Integer/FP Conversion Error
Exponential Function Power too Large
Invalid FP Value or Operation
FP Overflow
FP Underflow
The third implied register has all its bits cleared to zero. The displayed
register and the first implied register are not used but their allocation
in state RAM is required.
T ip:
To preserve registers, you can make the 4x reference numbers
assigned to the displayed register and the first implied register in the
middle node equal to the register references in the top node, since
these registers must be allocated but none are used.
138
Enhanced
Math Capabilities
7.5
MA TH
The MATH instruction performs any one of four integer math
operations, which is called by entering a function code in the range 1 ...
4 in the bottom node:
Code
7.5.1
MA TH Function
Characteristics
Size
Opcode
BE hex (default)
7.5.2
Decimal
Square
Root
Block Structure
ON initiates a standard
operation
source
ON = operation successful
result
MA TH
Enhanced
Math Capabilities
139
Enter the first of two contiguous 4x registers in the middle node. The
second register is implied. The result of the standard square root
operation is stored here.
The result is stored in the fixed-decimal format: 1234.5600. where the
displayed register stores the four-digit value to the left of the first
decimal point and the implied register stores the four-digit value to the
right of the first decimal point. Numbers after the second decimal point
are truncated; no round-off calculations are performed.
7.5.3
Process
Square
Root
The process square root function tailors the standard square root
function for closed loop analog control applications. It takes the result
of the standard square root result, multiplies it by 63.9922the square
root of 4095and stores that linearized result in the middle-node
registers.
Block Structure
ON initiates process operation
source
linearized
result
ON = operation successful
MA TH
Enhanced
Math Capabilities
Base 10 Logarithm
Block Structure
ON enables log(x) operation
source
ON = operation successful
result
MA TH
The middle node contains a single 4x holding register where the result
of the base 10 log calculation is posted. The result is expressed in the
fixed decimal format 1.234 , and is truncated after the third decimal
position.
Enhanced
Math Capabilities
141
Base 10 Antilogarithm
Block Structure
ON enables antilog(x) operation
source
ON = operation successful
result
MA TH
142
Enhanced
Math Capabilities
7.6
DMTH
The DMTH function performs any one of four possible double precision
math operations, which is called by entering a function code in the
range 1 ... 4 in the bottom node:
Code
7.6.1
DMTH Function
Characteristics
Size
Opcode
DE hex (default)
7.6.2
Double
Precision
Addition
Block Structure
ON adds operands and
posts sum in designated
registers
operand
operand 2
and sum
ON = operation successful
ON = operand out of range or invalid
DMTH
Enhanced
Math Capabilities
143
The first of two contiguous 4x registers is entered in the top node. The
second 4x register is implied. Operand 1 is stored here.
Each register holds a value in the range 0000 ... 9999, for a combined
double precision value in the range 0 ... 99,999,999. The high-order half
of operand 1 is stored in the displayed register, and the low-order half
is stored in the implied register.
Middle Node Content
7.6.3
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The third and fourth implied registers store the high-order and
low-order halves of the double precision sum, respectively
the fifth implied register is not used in the calculation but must
exist in state RAM
Double
Precision
Subtraction
Block Structure
ON subtracts operand 2 from
operand 1 and posts difference
in designated registers
operand
operand 2 /
difference
ON = operand 1 = operand 2
DMTH
The first of two contiguous 4x registers is entered in the top node. The
second 4x register is implied. Operand 1 is stored here.
Each register holds a value in the range 0000 ... 9999, for a combined
double precision value in the range 0 ... 99,999,999. The high-order half
of operand 1 is stored in the displayed register, and the low-order half
is stored in the implied register.
144
Enhanced
Math Capabilities
7.6.4
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The second and third implied registers store the high-order and
low-order halves, respectively, of the absolute difference in double
precision format
The fifth implied register is not used in this calculation but must
exist in state RAM
Double
Precision
Multiplication
Block Structure
ON = operand 1 x operand 2
and product posted in designated
registers
operand
operand 2 /
product
ON = operation successful
DMTH
The first of two contiguous 4x registers is entered in the top node. The
second 4x register is implied. Operand 1 is stored here.
The second 4x register is implied. Each register holds a value in the
range 0000 ... 9999, for a combined double precision value in the range
0 ... 99,999,999. The high-order half of operand 1 is stored in the
displayed register, and the low-order half is stored in the implied
register.
Enhanced
Math Capabilities
145
7.6.5
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The last four implied registers store the double precision product
in the range 0 ... 9,999,999,999,999,999
Double
Precision
Division
Block Structure
ON = operand 1 divided by
operand 2 and result posted
in designated registers
ON = decimal remainder
OFF = fractional remainder
operand
operand 2
quotient
remainder
DMTH
ON = operation successful
ON = operand 2 is 0
The first of two contiguous 4x registers is entered in the top node. The
second register is implied. Operand 1 is stored here.
Each register holds a value in the range 0000 ... 9999, for a combined
double precision value in the range 0 ... 99,999,999. The high-order half
of operand 1 is stored in the displayed register, and the low-order half
is stored in the implied register.
146
Enhanced
Math Capabilities
The displayed register and the first implied register store the
high-order and low-order halves of operand 2 , respectively, for a
combined double precision value in the range 0 ... 99,999,999
The fourth and fifth implied registers store the remainder if the
remainder is expressed as a fraction, it is eight digits long and
both registers are used; if the remainder is expressed as a decimal, it is four digits long and only the fourth implied register is
used
Enhanced
Math Capabilities
147
Chapter 8
Equation Networks
Equation
Networks
149
8.1
Equation
Network
Structure
Characteristics
Size
Representation
in Ladder
Logic
Block Structure
Enables
Equation Net
Done
Result < 0
Result = 0
Result > 0
Error
Input
Equation Network has one control input (to the top row), which is used
to enable/disable the equation. The input may be a normally open
150
Equation
Networks
Outputs
Equation Network can produce five possible outputs from the top five
rows of the network to describe the result of the equation. You choose
the outputs you want to use by assigning 0x reference numbers to
them.
The outputs are displayed as coils in the last column of the Equation
Network. The row in which the output coils are placed determines their
meanings:
V
When the equation passes power to the output from the top row,
the equation has completed successfully without an error
When the equation passes power to the output from the second
row, the equation has completed successfully and the result is less
than zero
When the equation passes power to the output from the third row,
the equation has completed successfully and the result is equal to
zero
When the equation passes power to the output from the fourth
row, the equation has completed successfully and the result is
greater than zero
When the equation passes power to the output from the fifth row,
the data in the equation has caused a calculation error
If the fifth output goes ON, it indicates an error condition. One of the
following messages will appear at the bottom of the Equation Network
screen:
Equation
Networks
151
Error Message
Meaning
Invalid Op.
Overflow
Underflow
Divide by 0
Equation
Content
:= algebraic
expression
where
V
Network
152
Equation
Each 16-bit register and/or discrete reference in the Equation Network consumes one word
Networks
Equation
Networks
153
8.2
Data Types
Six data types are allowed in an Equation Network. Each variable and
constant used in the Equation Network is of one of these data types.
Data types can be mixed in an Equation Network.
A data type is specified by appending a suffix to a variable or constant.
Data type suffixes are:
8.2.1
Data Type
Suffix
Applies
Boolean (binary)
Constants, 1x , or 0x
Constants, 3x , or 4x
Constants, 3x , or 4x
Constants, 3x , or 4x
UL
Constants, 3x , or 4x
Constants, 3x , or 4x
Variable
to
Data
Variable
Type
W ords Consumed
Registers
sumed
Boolean
0x or 1x
One
N/A
3x or 4x
One
One
3x or 4x
One
One
3x or 4x
One
Two
3x or 4x
One
Two
3x or 4x
One
Two
Con-
Note:
When contiguous 3x or 4x registers are used for 32-bit long
integers, the value still consumes only one word in the Equation
Network.
Note:
When 3x or 4x registers are used for a floating point number,
the value requires one word for complete definition.
154
Equation
Networks
Entering
Network
8.2.2
If you enter a register without a suffix appended to it, it is assumed to represent a signed 16-bit integer variable and you do
not need append the suffix S to the reference; thus the entries
400023 and 40023S are equivalent
If you enter a register with the suffix L appended to it, you indicate that two contiguous registers containing a signed 32-bit long
integer variable are usede.g., 400012L implies that register
400013 is also used
If you enter a register with the suffix UL appended to it, you indicate that two contiguous registers containing an unsigned 32-bit
long integer variable are usede.g., 300006UL implies that register 300007 is also used
If you enter a register with the suffix F appended to it, you indicate that two contiguous registers containing a floating point variable are usede.g., 400101F implies that register 400102 is also
used
Constant
Data
Equation
Networks
155
Data Type
words Consumed
Boolean
One
0, 1
One
One
Two
Two
0 ... 4,294,967,295
Two
Entering
Constant
Data in an Equation
Network
156
Equation
Networks
8.3
Algebraic
Operators
Groupings
Operator
Symbol
Unary
Description
Negation
~
Ones complement
Exponentiation
**
Exponent
Multiply
Multiplication
Division
Add
Addition
Logical bitwise
&
AND
OR
<<
Left shift
>>
Right shift
XOR
<
Less than
<=
Equal
< >
Not equal
>=
>
Greater than
Conditional
? x : y
Assignment
:=
Placed between the result and the exin an Equation Network; indicates that the value of the expression is
copied into the result variable
Subtraction
Relational
pression
8.3.1
How an Equation
Network
Resolves
an Equation
Equation
Networks
157
method
#5) * #7
Operator
Precedence
(1)
158
Equation
Networks
(2)
Using Parentheses
in an Equation
Network
Expression
and
(3b)
Equation
Networks
159
where the sum of the values in registers 300001 and 300003 is ANDed
with the logical OR of the values in registers 300002 and 300004.
On the other hand, expression (3b) is evaluated by ORing the values in
registers 300002 and 300004, then ANDing the result with the value in
register 300001, and finally adding the value in register 300003.
Nested
Parentheses
Parentheses
in an Equation
Network
Equation Network will echo back to you the expression as you enter it.
It does not prevent you from entering additional levels of parentheses
even when they may not be necessary to make the expression
syntactically correct. For example, in the expression:
( ( ( ( 300004U + 300005U ) ) ) ) / 300006U
Each pair of open and closed parentheses consumes two words in the
Equation Network.
160
Equation
Networks
8.4
Functions
The following functions are recognized in an Equation Network:
Function
Name
Meaning
ABS
Absolute value
ARCCOS
Arc cosine
ARCSIN
Arc sine
ARCTAN
Arc tangent
COS
Cosine
COSD
Cosine of degrees
EXP
FIX
FLOAT
LN
LOG
SIN
Sine of radians
SIND
Sine of degrees
SQRT
Square root
TAN
Tangent of radians
TAND
Tangent of degrees
Entering
Functions
in an Equation
Network
name
( argument
where the function name is one of those listed in the table above and
the argument is entered in parentheses immediately after the function
name . The argument may be entered as:
Networks
161
For example. if you want to calculate the absolute value of the sine of
the number in FP register 400025 and place the result in FP register
400015, enter the following in the Equation Network:
400015F := ABS (SIN (400025F))
Limits
on the Argument
to a Function
162
Equation
Range
Function
Argument
ABS
FP value
ARCCOS
FP value
ARCSIN
FP value
ARCTAN
FP value
COS
FP value
COSD
FP value
EXP
FP value
FIX
FP value
FLOAT
FP value
LN
FP value
LOG
FP value
SIN
FP value
SIND
FP value
SQRT
FP value
TAN
FP value
TAND
FP value
Networks
p/
8.5
Data Conversions
in an Equation
Network
All 16 bit signed and unsigned numbers are automatically promoted to 32 bits before an operation.
In an operation between signed and unsigned numbers, the unsigned number is assumed to be signed without checking for overflow.
An operation between floating point numbers and signed or unsigned numbers automatically promotes the long integer to floating point and assumes assigned number without checking for
overflow.
A bitwise logical AND, OR, or XOR operation with a Boolean argument results in a 0 (false) or a 0x FFFFFFFF (true).
Networks
163
164
Equation
The unary negation of an unsigned number produces that numbers twos complement.
An absolute value operation does not change the data type of the
result.
A Boolean
Boolean * Boolean, Boolean / Boolean, and Boolean ** Boolean operations are AND operations.
A floating point number assignment (=) to a long/short signed/unsigned number will be truncated.
Networks
A floating point number assignment (=) to a short unsigned number produces a result in the range 0 ... 65,535. Overflow is set if
the result is > 65,535.
A floating point number assignment (=) to a long unsigned number produces a result in the range 0 ... 4,294,967,295. Overflow is
set if the result is >4,294,967,295.
Equation
Networks
165
8.6
Roundoff Differences
Math Coprocessor
in PLCs without
166
Equation
Networks
8.7
Benchmark
Performance
E / SINE F)
Note:
The graph below shows the scan times for the three PLCs. Notice that
EMTH performance on the CPU113 and CPU213 is identical; this is
because EMTH does not utilize the math coprocessor available on the
CPU213. Equation Network performance, which does use a math
coprocessor when it is available, improves by 15% in the CPU213 over
the CPU113.
6
Equation Network
4
3
2
1
0
CPU1130x
CPU21304
CPU42402
Note:
The Equation Network approach provides a more accurate
result than the interpolated math implemented in EMTH operations.
Equation
Networks
167
Chapter 9
DX Move Instructions
DX Move Operations
RT
TR
TT
FIN
FOUT
SRCH
BLKM
BLKT
TBLK
IBKW
IBKR
DX Move Instructions
169
9.1
DX Move Operations
DX MOVE instructions copy registers or 16-bit words of data from one
memory area in the PLC to another. The copied data can then be
operated on, and the original data remain intact.
9.1.1
DX Tables
A group of contiguous 16-bit registers is called a table . The minimum
table length is 1i.e., one register. The maximum table length depends
on the instruction and on the kind of CPU (16- or 24-bit) the PLC is
using.
9.1.2
Specifying
Discrete
References
in a DX Table
Pointers
in a DX Instruction
Node
170
DX Move Instructions
9.2
R T
The RT instruction copies the bit pattern of a register or of a string of
contiguous discretes stored in a word into a specific register located in a
table. It can accommodate the transfer of one register/word per scan.
9.2.1
Characteristics
Size
1C hex
9.2.2
Representation
Block Structure
ON copies source data and
increments the pointer value
source
pointer
R T
table length
Inputs
RT has three control inputs. The input to the top node initiates the
DX move operation. When the input to the middle node goes ON, the
current value stored in the destination pointer register is frozen while
the DX operation continues. This causes new data being copied to the
destination to overwrite the data copied on the previous scan.
When the input to the bottom node goes ON, the value in the
pointer register is reset to zero. This causes the next DX
move operation to copy source data into the first register in the
destination table.
destination
DX Move Instructions
171
Outputs
RT can produce two possible outputs, from the top and middle nodes.
The state of the output from the top node echoes the state of the top
input. The output from the middle node goes ON when the value in the
destination pointer register equals the specified table length . At this
point, the instruction cannot increment any further.
Top Node Content
The source data to
The value posted in the pointer register indicates the register in the
destination table where the source data will be copied. A value of zero
indicates that the source data will be copied to the first register in the
destination table; a value of 1 indicates that the source data be copied
to the second register in the destination table; etc.
Bottom
Node Content
An R T Example
In the ladder logic example below, suppose initially that contact 10001
(the control input to the top node) is passing power on each scan while
172
DX Move Instructions
contacts 10002 and 10003 (the control inputs to the middle and bottom
nodes) are de-energized.
pointer
10001
40340
10002
( )
00135
R T
00005
10003
40340
30001
source
30001
destination
40341
40342
40343
40344
40345
At the beginning of the first scan, the value in the pointer register
(40340) is zero, indicating that the bit pattern in the source register will
be copied to the first register in the destination table. On the first scan
with contact 10001 energized, the bit pattern in source register 30001 is
copied to register 40341 and the value in the pointer register is
incremented to 1. On the second scan with 10001 energized, the
contents of source register 30001 are copied to register 40342 (the
second register in the destination table) and the value in the pointer
register is incremented to 2.
This DX operation continues through five scans of the energized
contact. At the fifth scan, which copies the contents of 30001 to register
40345 and increments the pointer value to the table length , the middle
output passes power, energizing coil 00135.
No further RT operations are possible while the two values
are equal, and the middle output continues to pass power regardless
of the state of the input.
Note:
Now lets consider what happens when the control input to the middle
or bottom node passes power. If, after the second scan, contact 10002
were to be energized, the pointer value would be frozen at 2. In this
case, all subsequent scans of 10001 would cause the contents of source
register 30001 to be copied to destination register 40343.
If contact 10003 were to be energized at any time, the value in the
register would be reset to zero and the contents of source
register 30001 would be copied to destination register 40341 in the
subsequent scan with contact 10001 energized.
pointer
DX Move Instructions
173
9.3
T R Move
The TR instruction copies the bit pattern of a register or 16
contiguous discretes in a table to a specific holding register. It can
accommodate the transfer of one register per scan. It has three control
inputs and produces two possible outputs.
9.3.1
Characteristics
Size
3C hex
9.3.2
Representation
Block Structure
ON copies data and increments
the pointer value
source
table
pointer
pointer
T R
table
length
Inputs
TR has three control inputs. The input to the top node initiates the
DX move operation.
When the input to the middle node goes ON, the current value stored in
the pointer register is frozen while the DX operation continues. This
causes the same table data to be written to the destination register on
each scan.
When the input to the bottom node goes ON, the value in the pointer is
reset to zero. This causes the next DX move operation to copy the first
destination register in the table.
174
DX Move Instructions
Outputs
TR can produce two possible outputs, from the top and middle nodes.
The state of the output from the top node echoes the state of the top
input. The output from the middle node goes ON when the value in the
pointer register equals the specified table length . At this point, the
instruction cannot increment any further.
Top Node Content
The top node references the first register or discrete reference in the
. A register or string of contiguous discretes from this table
will be copied in a scan in a table-to-register operation. The displayed
reference in this node can be:
source table
The value stored in the pointer register indicates which register in the
will be copied to the destination register in the current
scan. A value of 0 in the pointer indicates that the bit pattern in the
first register of the source table will be copied to the destination; a
value of 1 in the pointer register indicates that the bit pattern in the
second register of the source table will be copied to the destination
register; etc.
source table
Bottom
Node Content
The integer value entered in the bottom node specifies the length of the
source table i.e., the number of registers that may be copied. It is in
the range 1 ... 255 in 16-bit CPUs and 1 ... 999 in 24-bit CPUs.
9.3.3
A T R Example
In the ladder logic example below, suppose initially that contact 10001
(the control input to the top node) is passing power on each scan while
DX Move Instructions
175
contacts 10002 and 10003 (the control inputs to the middle and bottom
nodes) are de-energized.
10001
40376
10002
T R
00005
10003
pointer
40371
40376
( )
00136
destination
40377
source
40371
40372
40373
40374
40375
At the beginning of the first scan, the value in the pointer register
(40376) is zero, indicating that the bit pattern in the source table will
be copied to the destination register. The first transition of P.T. contact
10001 copies the contents of source register 40371 to destination
register 40377 and increments the value in the pointer to 1. The second
transition of contact 10001 copies the contents of source register 40372
to destination register 40377 and increments the value in the pointer
register to 2. This continues for five scans.
When the fifth transition of contact 10001 copies the contents of
register 40375 to destination register 40377, the pointer value to
increments to 5. Because the pointer value now equals the table length ,
the middle output passes power, energizing coil 00136.
No further TR operations are possible while the two values
are equal, and the middle output continues to pass power regardless
of the state of the input.
Note:
Now lets consider what happens when the control input to the middle
or bottom node passes power. If, after the second transition of contact
10001, contact 10002 were to be energized, the pointer value would be
frozen at 2. In this case, all subsequent transitions of 10001 would
cause the contents of source register 40373 to be copied to destination
register 40377.
If contact 10003 were to be energized at any time, the value in the
would be reset to zero, and the next transition of contact 10001
would copy the contents of source register 40371 to destination register
40377.
pointer
176
DX Move Instructions
9.4
T T Move
The TT instruction copies the bit pattern of a register or of 16
discretes from a position within one table to an equivalent position in
another table of registers. It can accommodate the transfer of one
register per scan. It has three control inputs and produces two possible
outputs.
9.4.1
Characteristics
Size
5C hex
9.4.2
Representation
Block Structure
ON copies data and increments
the pointer value
source
table
pointer
pointer
T T
table
length
Inputs
TT has three control inputs. The input to the top node initiates the
DX move operation.
When the input to the middle node goes ON, the current value stored in
the pointer register is frozen while the DX operation continues. This
causes new data being copied to the destination to overwrite the data
copied on the previous scan.
DX Move Instructions
177
When the input to the bottom node goes ON, the value in the pointer
register is reset to zero. This causes the next DX move operation to
copy source data into the first register in the destination table.
Outputs
TT can produce two possible outputs, from the top and middle nodes.
The state of the output from the top node echoes the state of the top
input. The output from the middle node goes ON when the value in the
pointer register equals the specified table length . At this point, the
instruction cannot increment any further.
Top Node Content
The top node references the first register or discrete reference in the
source table . A register or string of contiguous discretes from this table
will be copied in a scan in a table-to-register operation. The displayed
reference in this node can be:
V
The value stored in the pointer register indicates which register in the
be copied to which register in the destination table.
of the two tables is equal and TT copy is to the
equivalent register in the destination table, the current value in the
pointer register also indicates which register in the destination table
the source data will be copied to.
source table will
Since the length
A value of 0 in the pointer register indicates that the bit pattern in the
first register of the source table will be copied to the first register of the
destination table; a value of 1 in the pointer register indicates that the
bit pattern in the second register of the source table will be copied to
the second register of the destination register; etc.
178
DX Move Instructions
Bottom
Node Content
The integer value in the bottom node specifies the table length of both
the source and destination tables, since the two tables must be equal in
length. Table length may range from 1 ... 255 in 16-bit CPUs and
1 ... 999 in 24-bit CPUs.
9.4.3
A T T Example
In the ladder logic example below, suppose initially that contact 10001
(the control input to the top node) is passing power on each scan while
contacts 10002 and 10003 (the control inputs to the middle and bottom
nodes) are de-energized.
pointer
30001
40380
10001
40380
( )
00137
10002
T T
00003
source
30001
30002
30003
destination
40381
40382
40383
10003
At the beginning of the first scan, the value in the pointer register
(40380) is zero, indicating that the bit pattern in the first register in
the source table will be copied to the first register in the destination
table. The first transition of P.T. contact 10001 copies the bit pattern in
source register 30001 to destination register 40381, then increments
the value in the pointer register to 1. The second transition of 10001
copies the contents of source register 30002 to destination register
40382 and increments the value in the pointer register to 2. The third
transition of contact 10001 copies the contents of 30003 to register
40383 and increments the pointer value to 3 (the table length ). At this
point, the middle output passes power and energizes coil 00137.
No further TT operations are possible while the two values
are equal, and the middle output continues to pass power regardless
of the state of the input.
Note:
Now lets consider what happens when the control input to the middle
or bottom node passes power. If, after the second transition of contact
10001, contact 10002 were to be energized, the value in the pointer
register would be frozen at 2, and all subsequent transitions of contact
10001 would cause the value in source register 30003 to be copied to
destination register 40383.
840 USE 101 00
DX Move Instructions
179
pointer
180
DX Move Instructions
9.5
FIN
The FIN instruction is used to produce a first-in queue. It copies the
from the top node to the first register in a queue of holding
registers. The source data is always copied to the register at the top of
the queue. When a queue has been filled, no further source data can be
copied to it.
source data
1111
Source
FIN
1111
2222
Source
FIN
Queue
2222
1111
Queue
3333
Source
FIN
3333
2222
1111
Queue
Characteristics
Size
9C hex
DX Move Instructions
181
9.5.2
Representation
Block Structure
ON copies source bit
pattern into queue
source
data
queue
pointer
Queue full
FIN
queue
length
Queue empty
Input
FIN has one control input, to the top node. When this input passes
power, it initiates the FIN operation.
Outputs
FIN can produce three possible outputs. The output from the top node
echoes the state of the top input.
The output from the middle node goes ON when the queue is full. No
more source data can be copied to the queue when this output is ON.
The output from the bottom node is ON whenever the queue is
emptyi.e., the value posted in the queue pointer register is zero.
Top Node Content
The source data indicated
A 3x input register
A 4x holding register
DX Move Instructions
The value posted in the queue pointer equals the number of registers in
the queue that are currently filled with source data . The value of the
pointer cannot exceed the integer maximum queue length value
specified in the bottom node.
If the value in the queue pointer equals the integer specified in the
bottom node, the middle output passes power and no further source
data can be written to the queue until an FOUT instruction clears the
register at the bottom of the queue.
Bottom
Node Content
The integer value entered in the bottom node specifies the queue
length i.e., the number of 4x registers in the destination queue. The
length can range from 1 ... 100.
DX Move Instructions
183
9.6
FOUT
The FOUT instruction works together with the FIN instruction to
produce a first in-first out (FIFO) queue. It moves the bit pattern of the
holding register at the bottom of a full queue to a destination register
or to word that stores 16 discrete outputs.
3333
Source
FIN
3333
2222
1111
Queue
3333
2222 FOUT
1111
1111
Queue
Destination
4444
Source
FIN
4444
3333
2222
Queue
An FOUT instruction has one control input and can produce three
possible outputs.
W arning!
FOUT will override any disabled coils within a
destination
register without enabling them. This can cause
injury if a coil has been disabled for repair or maintenance
because the coil s state can change as a result of the FOUT
operation.
9.6.1
Characteristics
Size
BC hex
184
DX Move Instructions
9.6.2
Representation
Block Structure
ON clears source bit
pattern from the queue
source
pointer
dest inat ion
register
FOUT
queue
length
Queue full
Queue empty
Input
FOUT has one control input, to the top node. When this input passes
power, it initiates the FOUT operation.
Outputs
FOUT can produce three possible outputs. The output from the top
node echoes the state of the top input. The output from the middle node
goes ON when the queue is full; no more source data can be copied to
the queue when this output is ON. The output from the bottom node is
ON when the queue is emptyi.e., when the value in the queue pointer
register is zero.
Top Node Content
In the FOUT instruction, the source data comes from the 4x register at
the bottom of a full queue. The next contiguous 4x register following
the source pointer register in the top node is the first register in the the
queue. For example, if the top node displays pointer register 40100,
then the first register in the queue is 40101.
The value posted in the source pointer equals the number of registers in
the queue that are currently filled. The value of the pointer cannot
exceed the integer maximum queue length value specified in the bottom
node. If the value in the source pointer equals the integer specified in
the bottom node, the middle output passes power and no further FIN
data can be written to the queue until the FOUT instruction clears the
register at the bottom of the queue to the destination register .
DX Move Instructions
185
Node Content
The integer in the bottom node specifies the queue length i.e., the
number of 4x registers in the queue. The length can range from 1 ...
100.
186
DX Move Instructions
9.7
SRCH
The SRCH instruction searches the registers in a source table for a
specific bit pattern. The function will search the entire source table in a
single scan until either a match is found or the end-of-table is reached.
9.7.1
Characteristics
Size
DC hex
9.7.2
Representation
Block Structure
ON initiates search
source
table
pointer
Match found
SRCH
table
length
Inputs
SRCH has two control inputs (to the top and middle nodes). The input
to the top node initiates the SRCH operation. The state of the input to
the middle node indicates where the SRCH operation will originate.
Outputs
SRCH can produce up to two outputs. The state of the output from the
top node echoes the state of the top input. Power passed from the
middle node indicates that the bit pattern being searched for has been
found in the source table .
Top Node Content
The top node specifies the source table to be searched. The node may
reference:
840 USE 101 00
DX Move Instructions
187
the value stored in the next contiguous register after the pointere.g,
if the pointer register is 40015, then register 40016 contains a value
that the SRCH instruction will attempt to match in source table .
Bottom
Node Content
The integer value entered in the bottom node specifies the table
length i.e., the number of registers in the source table. The length can
range from 1 ... 100.
9.7.3
A SRCH Example
In the following example, we search a source table that contains five
registers (40421 ... 40425) for a specific bit pattern. The pointer register
(40430) indicates that the desired bit pattern is stored in register 40431
and we see that that register contains a bit value of 3333.
40421
40430
10001
40430
10002
40500
SRCH
BLKM
00005
0001
( )
source table
40421
40422
40423
40424
40425
register
content
= 1111
= 2222
= 3333
= 4444
= 5555
pointer
40430
register
content
40431 = 3333
00142
In each scan where P.T. contact 10001 transitions from OFF to ON, the
source table is searched for a bit pattern equivalent to the value 3333.
When the match is found, the middle output passes power to coil 00142.
If N.O. contact 10002 is OFF when the match is found at register
40423, the SRCH instruction energizes coil 00142 for one scan, then
starts the search again in the next scan at the top of the source table
(register 40421). If contact 10002 is ON, the SRCH instruction
energizes coil 00142 for one scan, then starts the search in register
40424.
188
DX Move Instructions
Because the top input is a P.T. contact, on any scan where power is not
applied to the top input the pointer value is cleared. We use a BLKM
instruction here to save the pointer value to register 40500.
DX Move Instructions
189
9.8
BLKM
The BLKM (block move) instruction copies the entire contents of a
source table to a destination table in one scan.
W arning!
BLKM will override any disabled coils within a
destination
table without enabling them. This can cause injury
if a coil has been disabled for repair or maintenance
because
the coil s state can change as a result of the BLKM instruction.
9.8.1
Characteristics
Size
7C hex
9.8.2
Representation
Block Structure
ON initiates block move
source
table
Input
BLKM has one control input (to the top node). This input initiates the
DX move operation.
Output
BLKM produces one output (from the top node), which echoes the state
of the top input.
190
DX Move Instructions
The top node specifies the source table that will have its contents copied
in the block move. The node may reference:
V
The middle node specifies the destination table where the contents of
the source table will be copied in the block move. The node may
reference:
V
Bottom
Node Content
The integer value entered in the bottom node specifies the table
size i.e., the number of registers or 16-bit wordsfor both the source
and destination tables; they are of equal length. The table length can
range from 1 ... 100.
9.8.3
A Recipe
Storage
Example
You can use ladder logic to write specific process programs (or recipes),
store each in a unique table, then write a general process program and
store it in another working table. The recipe tables must be structured
with similar information in corresponding registersif a heating
temperature is in the third register in one recipe table, it should be in
the third register in all recipe tables. Recipes can be pulled into the
generic process program with BLKM instructions:
DX Move Instructions
191
40101
10101 10102 10103
40201
BLKM
00008
40109
10102 10101 10103
40201
BLKM
00008
40117
10103 10101 10102
40201
BLKM
00008
192
DX Move Instructions
9.9
BLKT
The BLKT (block-to-table) instruction combines the functions of RT
and BLKM in a single instruction. In one scan, it can copy data from a
source block to a destination block in a table. The source block is of a
fixed length . The block within the table is of the same length , but the
overall length of the table is limited only by the number of registers in
your system configuration.
9.9.1
Characteristics
Size
Opcode
9F hex
9.9.2
Representation
Block Structure
ON initiates move
Hold pointer
Reset pointer
source
block
Operation successful
pointer
BLKT
block
length
Inputs
BLKT has three control inputs. The input to the top node initiates the
DX move operation. The inputs to the middle and bottom node can be
840 USE 101 00
DX Move Instructions
193
used to control the pointer so that source data is not copied into
registers that are needed for other purposes in the logic program.
W arning!
BLKT is a powerful instruction
that can corrupt all
the 4 x registers in your PLC with data copied from the source
block .. You should use external logic in conjunction
with the
middle or bottom input to confine the value in the pointer to a
safe range.
When the input to the middle node is ON, the value in the pointer
register is frozen while the BLKT operation continues. This causes new
data being copied to the destination to overwrite the block data copied
on the previous scan.
When the input to the bottom node is ON, the value in the pointer
register is reset to zero. This causes the BLKT operation to copy source
data into the first block of registers in the destination table.
Outputs
BLKT can produce one of two possible outputs. When the move is
successful, power is passed to the output from the top node. If an error
occurs in the operation, power is passed to the output from the middle
node.
Top Node Content
The 4x register entered in the top node is the first holding register in
the source block i.e, the block of contiguous registers whose content
will be copied to a block of registers in the destination table.
Middle Node Content
The 4x register entered in the middle node is the pointer to the
destination table. The first register in the destination table is the next
contiguous register after the pointer e.g., if the pointer register is
40107, then the first register in the destination table is 40108.
Note:
DX Move Instructions
Bottom
Node Content
A BLKT Example
Below is an example of a BLKT operation. The source block is five
registers long (40010 ... 40014). The destination table starts at register
40021 and is segmented into a string of five-register blocks
(40021 ... 40025, 40026 ... 40030, etc.).
In the illustration below, we see the what happens on the second
transition of P.T. contact 10001. The value inside the pointer (register
40020) increments to 1, and the data contained in the source block
registers is copied into the second block in the destination table
(registers 40026 ... 40030). Coil 00001 goes ON when the BLKT move is
complete.
40010
00001
10001
40020
40020
BLKT
5
SUB
40100
( )
source
block
40010
40011
40012
40013
40014
pointer
40020 = 1
destination
table
40021 Block 1
40022
40023
40024
40025
40026 Block 2
40027
40028
40029
40030
40031 Block 3
40032
40033
40034
40035
The SUB instruction in the ladder logic is used to control the use of
registers in the destination table. Here we restrict the table to 25
registers by clearing the value in the pointer register to zero after five
BLKT transfers.
840 USE 101 00
DX Move Instructions
195
9.10
TBLK
The TBLK (table-to-block) instruction combines the functions of TR
and the BLKM in a single instruction. In one scan, it can copy up to
100 contiguous 4x registers from a table to a destination block. The
destination block is of a fixed length . The block of registers being copied
from the source table is of the same length , but the overall length of the
source table is limited only by the number of registers in your system
configuration.
9.10.1
Characteristics
Size
Standard in 110CPU512 and 110CPU612 Micro PLCs, all Quantum Automation Series PLCs, and all Slot Mount and Compact
PLC models
Opcode
DF hex
9.10.2
Representation
Block Structure
ON initiates move
Hold pointer
Reset pointer
196
DX Move Instructions
source
table
Operation successful
pointer
TBLK
block
length
Inputs
TBLK has three control inputs. The input to the top node initiates the
DX move operation. The inputs to the middle and bottom node can be
used to control the value in the pointer so that size of the source table
can be controlled.
W arning!
You should use external logic in conjunction
the middle or bottom input to confine the value in the
destination
pointer to a safe range.
with
When the input to the middle node is ON, the value in the pointer
register is frozen while the TBLK operation continues. This causes the
same source data block to be copied to the destination table on each
scan.
When the input to the bottom node is ON, the pointer value is reset to
zero. This causes the TBLK operation to copy data from the first block
of registers in the source table.
Outputs
TBLK can produce one of two possible outputs. When the move is
successful, power is passed to the output from the top node. If an error
occurs in the operation, power is passed to the output from the middle
node.
Top Node Content
The 4x register entered
the source table.
DX Move Instructions
197
Bottom
Node Content
A TBLK Example
Below is an example of a TBLK operation. The destination block is five
registers long (40011 ... 40015). The source table starts at register
40020 and is segmented into a series of five-register source blocks
(40020 ... 40024, 40025 ... 40029, etc.).
In the illustration below, we see the what happens on the second
transition of P.T. contact 10001. The value inside the pointer register
increments to 1, and the data contained in the second source block
(registers 40025 ... 40029) is copied into the five-register destination
block (40011 ... 40015). Coil 00001 goes ON when the TBLK move is
complete.
40020
00001
10001
40020
40010
TBLK
5
SUB
40100
( )
pointer
40010 = 1
source
table
Block 1 40020
40021
40022
40023
40024
40011
40012
40013
40014
40015
Block 2 40025
40026
40027
40028
40029
Block 3 40030
40031
40032
40033
40034
The SUB instruction in the ladder logic is used to control the use of
registers in the source table . Here we restrict the table to 25 registers
by clearing the value in the pointer register to zero after five TBLK
transfers.
198
DX Move Instructions
9.1 1
IBKR
The IBKR (indirect block read) instruction lets you access
non-contiguous registers dispersed throughout your application and
copy the contents into a destination block of contiguous registers. This
instruction can be used with subroutines or for streamlining data
access by host computers or other PLCs.
9.1 1.1
Characteristics
Size
Opcode
51 hex
9.1 1.2
Representation
Block Structure
ON initiates indirect
read operation
source
table
Error
(1 ... 255)
Input
IBKR has one control input (to the top node), which initiates the
operation.
Outputs
IBKR produces two possible outputs (from the top and bottom nodes).
The output from the top node echoes the state of the top input. Power is
passed to the output from the bottom node if there is an error in the
source table e.g., if the source register does not exist.
840 USE 101 00
DX Move Instructions
199
Node Content
The integer value entered in the bottom node indicates the length i.e.,
the number of registersin the source table (and the destination block ).
9.1 1.3
An IBKR Example
Say you want to collect the data stored in the following five registers
dispersed throughout the logic program and read the data into a
contiguous block where it can be read by a host computer in a single
instruction:
Register
Content
400014
= 200
400199
= 600
400337
= 400
400841
= 1000
401061
= 800
You can create a source table with five holding registers by specifying
the first register (400100) in the top node and specifying a length of 5 in
the bottom node:
400100
( )
000001
10001
400001
IBKR
200
DX Move Instructions
( )
000002
Enter a value in each register in the table that points to the registers
above:
Source
Register
Content
(pointer)
400100
= 14
400101
= 199
400102
= 337
400103
= 841
400104
= 1061
The register entered in the middle node (400001) is the first register in
the destination block . The IBKR instruction loads the destination block
as follows:
Destination
Register
Content
400001
= 200
400002
= 600
400003
= 400
400004
= 1000
400005
= 800
DX Move Instructions
201
9.12
IBKW
The IBKW (indirect block write) instruction lets you copy the data from
a table of contiguous registers into several non-contiguous registers
dispersed throughout your application.
9.12.1
Characteristics
Size
Opcode
52 hex
9.12.2
Representation
Block Structure
ON initiates indirect
write operation
source
block
Error
(1 ... 255)
Input
IBKW has one control input (to the top node), which initiates the
operation.
Outputs
IBKW produces two possible outputs (from the top and bottom nodes).
The output from the top node echoes the state of the top input. Power is
passed to the output from the bottom node if there is an error in the
destination table .
202
DX Move Instructions
Node Content
The integer value entered in the bottom node indicates the length i.e.,
the number of registersin the source block (and the destination
pointer block).
9.12.3
An IBKW Example
Say you have a block of five contiguous registers (400001 ... 400005)
that contain source data:
Destination
Register
Content
400001
= 200
400002
= 400
400003
= 600
400004
= 800
400005
= 1000
( )
00001
10001
400100
IBKW
DX Move Instructions
203
Destination
Register
400100
= 400014
400101
= 400037
400102
= 400019
400103
= 400061
400104
= 400041
destination
Source
Register
Content
(pointer)
400100
= 14
400101
= 37
400102
= 19
400103
= 61
400104
= 41
204
as follows:
Content
400014
= 200
400037
= 400
400019
= 600
400061
= 800
400041
= 1,000
DX Move Instructions
pointers
Chapter 10
DX Matrix Instructions
DX Matrix Operations
AND
OR
XOR
COMP
CMPR
DX Matrix Instructions
205
10.1
DX Matrix
Operations
206
DX Matrix Instructions
10.2
AND
The AND instruction performs a Boolean AND operation on the bit
patterns in the source and destination matrices . The ANDed bit pattern
is then posted in the destination matrix , overwriting its previous
contents:
source
bits
destination
bits
W arning!
AND will override any disabled coils within the
destination
matrix without enabling them. This can cause
personal injury if a coil has disabled an operation
for
maintenance
or repair because the coil s state can be changed
by the AND operation.
10.2.1
Characteristics
Size
1D hex
DX Matrix Instructions
207
10.2.2
Representation
Block Structure
ON initiates AND
source
matrix
Input
AND has one control input (to its top node), which initiates the logical
operation.
Output
AND produces one output (from its top node), which echoes the state of
the top input.
Top Node Content
The entry in the top node is the first reference in the source matrix . It
may be:
V
The entry in the middle node is the first reference in the destination
. It may be:
matrix
208
DX Matrix Instructions
Bottom
Node Content
An AND Example
source matrix
40600
10001
40604
AND
00002
40600 = 1111111100000000
40601 = 1111111100000000
When contact 10001 passes power, the source matrix formed by the bit
pattern in registers 40600 and 40601 is ANDed with the destination
matrix formed by the bit pattern in registers 40604 and 40605. The
ANDed bits are then copied into registers 40604 and 40605,
overwriting the previous bit pattern in the destination matrix .
If you want to retain the original destination bit pattern of
registers 40604 and 40605, copy the information into another table
using a BLKM before performing the AND operation.
T ip:
DX Matrix Instructions
209
10.3
OR
The OR instruction performs a Boolean OR operation on the bit
patterns in the source and destination matrices . The ORed bit pattern
is then posted in the destination matrix , overwriting its previous
contents:
source
bits
destination
bits
W arning!
OR will override any disabled coils within the
destination
matrix without enabling them. This can cause
personal injury if a coil has disabled an operation
for
maintenance
or repair because the coil s state can be changed
by the OR operation.
10.3.1
Characteristics
Size
3D hex
210
DX Matrix Instructions
10.3.2
Representation
Block Structure
ON initiates OR
source
matrix
Input
OR has one control input (to its top node), which initiates the logical
operation.
Output
OR produces one output (from its top node), which echoes the state of
the top input.
Top Node Content
The entry in the top node is the first reference in the source matrix . It
may be:
V
The entry in the middle node is the first reference in the destination
. It may be:
matrix
Bottom
Node Content
DX Matrix Instructions
21 1
matrixes. The matrix length can be in the range 1 ... 100. A length of 2
indicates that 32 bits in each matrix will be ORed.
212
DX Matrix Instructions
10.3.3
An OR Example
source matrix
40600 = 1111111100000000
10001
40601 = 1111111100000000
40600
40606
OR
00002
Whenever contact 10001 passes power, the source matrix formed by the
bit pattern in registers 40600 and 40601 is ORed with the destination
matrix formed by the bit pattern in registers 40606 and 40607. The
ORed bit pattern is then copied into registers 40606 and 40607,
overwriting the original destination bit pattern.
Caution:
Outputs
OR instruction.
be turned
T ip:
If you want to retain the original destination bit pattern of
registers 40606 and 40607, copy the information into another table
using a BLKM before performing the OR operation.
DX Matrix Instructions
213
10.4
XOR
The XOR instruction performs a Boolean Exclusive OR operation on
the bit patterns in the source and destination matrices . The XORed bit
pattern is then posted in the destination matrix , overwriting its
previous contents:
source
bits
destination
bits
W arning!
XOR will override any disabled coils within the
destination
matrix without enabling them. This can cause
personal injury if a coil has disabled an operation
for
maintenance
or repair because the coil s state can be changed
by the XOR operation.
10.4.1
Characteristics
Size
DD hex
214
DX Matrix Instructions
10.4.2
Representation
Block Structure
ON initiates XOR
source
matrix
Input
XOR has one control input (to its top node), which initiates the logical
operation.
Output
XOR produces one output (from its top node), which echoes the state of
the top input.
Top Node Content
The entry in the top node is the first reference in the source matrix . It
may be:
V
The entry in the middle node is the first reference in the destination
. It may be:
matrix
DX Matrix Instructions
215
Bottom
Node Content
An XOR Example
source matrix
40600
10001
40608
XOR
00002
40600 = 1111111100000000
40601 = 1111111100000000
When contact 10001 passes power, the source matrix formed by the bit
pattern in registers 40600 and 40601 is XORed with the destination
matrix formed by the bit pattern in registers 40608 and 40609. The
XORed bit pattern is then copied into registers 40608 and 40609,
overwriting the original destination bit pattern.
If you want to retain the original destination bit pattern of
registers 40608 and 40609, copy the information into another table
using a BLKM before performing the XOR operation.
T ip:
216
DX Matrix Instructions
10.5
COMP
The COMP instruction complements the bit patterni.e., changes all
0s to 1s and all 1s to 0sof a source matrix , then copies the
complemented bit pattern into a destination matrix . The entire COMP
operation is accomplished in one scan.
W arning!
COMP will override any disabled coils in the
destination
matrix without enabling them. This can cause
injury if a coil has been disabled for repair or maintenance
because the coil s state can be changed by the COMP
operation.
10.5.1
Characteristics
Size
BD hex
10.5.2
Representation
Block Structure
ON initiates the complement
operation
source
destination
COMP
length
Input
COMP has one control input (to its top node), which initiates the
complementing operation.
Output
COMP produces one output (from its top node), which echoes the state
of the top input.
840 USE 101 00
DX Matrix Instructions
217
The entry in the top node is the first reference in the source matrix ,
which contains the original bit pattern before the complement
operation. The entry may be:
V
The entry in the middle node is the first reference in the destination
where the complemented bit pattern will be posted. It may be:
matrix
Bottom
Node Content
A COMP
Example
source matrix
40600
40600 = 1111111100000000
40601 = 1111111100000000
10001
40602
COMP
00002
When contact 10001 passes power, the bit pattern in the source matrix
(registers 40600 and 40601) is complemented, then the complemented
bit pattern is posted in the destination matrix (registers 40602 and
40603). The original bit pattern is maintained in the source matrix .
218
DX Matrix Instructions
10.6
CMPR
The CMPR instruction compares the bit pattern in matrix a against the
bit pattern matrix b for miscompares. In a single scan, the two matrices
are compared bit position by bit position until a miscompare is found or
the end of the matrices is reached (without miscompares).
10.6.1
Characteristics
Size
5D hex
10.6.2
Representation
Block Structure
matrix a
pointer
register
Miscompare detected
CMPR
length
Inputs
CMPR has two control inputs (to the top and middle nodes). The input
to the top node initiates the comparison. The state of the input to the
middle node determines the location in the logic program where the
next comparison will start.
Outputs
CMPR produces three possible outputs. The output from the top node
echoes the state of the top input. Power is passed to the output from the
middle node when a miscompare is found. The state of the output from
the bottom node indicates whether the miscompared bit in matrix a is a
1 or a 0.
DX Matrix Instructions
219
The entry in the top node is the first reference in matrix a , one of the
two matrices to be compared. The entry may be:
V
The value stored inside the pointer register increments with each bit
position in the two matrices that is being compared. As bit position 1 in
matrix a and matrix b is compared, the pointer register contains a value
of 1; as bit position 2 in the matrices are compared, the pointer value
increments to 2; etc.
When the outputs signal a miscompare, you can check the accumulated
count in the pointer register to determine the bit position in the
matrices of the miscompare.
Bottom
Node Content
The integer value entered in the bottom node specifies a length of the
two matricesi.e., the number of registers or 16-bit words in each
matrix. (Matrix a and matrix b have the same length.) The matrix
length can range from 1 ... 100 i.e., a length of 2 indicates that matrix
a and matrix b contain 32 bits.
220
DX Matrix Instructions
10.6.3
A CMPR Example
40620
matrix
40620 = 1111000011110000
10001
40622
10002
CMPR
00002
( )
00043
40621 = 1000000000000000
matrix b
40623 = 1111000011110000
40624 = 0000000000000000
( )
00044
DX Matrix Instructions
221
10.7
SENS
The SENS instruction examines and reports the sense1 or 0of a
specific bit location in a data matrix . One bit location is sensed per
scan.
10.7.1
Characteristics
Size
7D hex
10.7.2
Representation
Block Structure
ON senses the bit loc
bit
location
data
matrix
SENS
length
ON = bit sense is 1
OFF = bit sense is 0
Inputs
SENS has three possible control inputs. The input to the top node
initiates the bit sense operation. An input to the middle node causes
the bit location specified in the top node to increment by one on the
next scan. An input to the bottom node causes the bit location to be
reset to 1.
Outputs
SENS can produce three possible outputs. The state of the output from
the top node echoes the state of the top input. The state of the output
from the middle node indicates the sense of the current bit location .
Power is passed to the output from the bottom node if an invalid bit
location is entered in the top node.
222
DX Matrix Instructions
The entry top node is the specific bit location that you want to sense in
the data matrix . It may be:
V
Note
If the bit location is entered as an integer or in a 3x register, the
instruction will ignore the state of the middle and bottom inputs.
The middle node is the first word or register in the data matrix . It may
be:
V
Bottom
Node Content
A SENS Example:
Reporting
Status
Information
DX Matrix Instructions
223
40201
178
ST AT
40201
0012
SENS
( )
00003
0012
The top input to the STAT block, which passes power on every scan,
posts current status information from the first 12 words in the status
table in registers 40201 ... 40212.
Suppose we want to check the health of the I/O module in slot 2 of drop
1, rack 1 in the I/O network. The status bit of interest happens to be
the second bit in the 12th register (40212) in the status table, which
will have a value of 1 if the module is healthy.
Since each bits state represents a different piece of status information,
you can use a SENS block to report the sense of the desired incoming
bit. The SENS instruction views the 12 registers as a 12-by-16 matrix
of bit values. In this case, the bit location of interest in the data matrix
is 178 (bit 2 in register 40212).
By connecting the top output from the STAT instruction to the top
input to the SENS instruction, you check the sense of bit 178 on every
scan. If the SENS block passes power to coil 00003, it indicates a bit
value of 1 and therefore a healthy module in slot 2 of the drop. If coil
00003 stays OFF, it indicates that the module in that slot is unhealthy.
224
DX Matrix Instructions
10.8
MBIT
The MBIT instruction modifies bit locations within a data matrix i.e.,
it sets the bit(s) to 1 or clears the bit(s) to 0. One bit location may be
modified per scan.
W arning!
MBIT will override any disabled coils within a
destination
group without enabling them. This can cause
injury if a coil has been disabled for repair or maintenance
because the coil s state can change as a result of the MBIT
instruction.
10.8.1
Characteristics
Size
9D hex
10.8.2
Representation
Block Structure
ON implements bit modification
OFF = clear bit locs to 0
ON = set bit locs to 1
Increment bit loc after modification
bit
location
data
matrix
MBIT
length
Inputs
MBIT has three possible control inputs. The input to the top node
initiates the bit modification. The state of the input to the middle node
indicates whether MBIT will be used to set or to clear the bit locations
in the matrix . An input to the bottom node causes the bit location
specified in the top node to increment by one on the next scan.
DX Matrix Instructions
225
Outputs
MBIT can produce three possible outputs. The state of the output from
the top node echoes the state of the top input, and the state of the
output from the middle node echoes the state of the middle input.
Power passing to the output from the bottom node indicates an error
condition.
Top Node Content
The entry in the top node is the specific bit location that you want to
set or clear in the data matrix . It may be:
V
Note
If the bit location is entered as an integer or in a 3x register, the
instruction will ignore the state of the bottom input.
The middle node is the first word or register in the data matrix . It may
be:
V
Bottom
Node Content
226
DX Matrix Instructions
10.9
BROT
The BROT (bit rotate) instruction shifts the bit pattern in a source
, then posts the shifted bit pattern in a destination matrix . The
bit pattern shifts left or right by one position per scan.
matrix
W arning!
BROT will override any disabled coils within a
destination
matrix without enabling them. This can cause
injury if a coil has been disabled for repair or maintenance
BROT unexpectedly
changes the coil s state.
10.9.1
if
Characteristics
Size
FD hex
10.9.2
Representation
Block Structure
ON shifts bit pattern in
source matrix by one
OFF = shift right
ON = shift left
OFF = exit bit falls out of the
destination
matrix
source
matrix
destination
matrix
BROT
length
Inputs
BROT has three control inputs. The inputs determine the way the bits
will be shifted.
Outputs
BROT can produce two possible outputs (from the top and middle
nodes). The output from the top node echoes the state of the top input.
840 USE 101 00
DX Matrix Instructions
227
The output from the middle node indicates the sense of the bit that
exits the source matrix (the leftmost or rightmost bit) as a result of the
shift.
Top Node Content
The entry in the top node is the first reference in the source
i.e., in the matrix that will have its bit pattern shifted. The
entry may be:
matrix
The entry in the middle node is the first reference in the destination
i.e., in the matrix that shows the shifted bit pattern. The entry
may be:
matrix
Bottom
Node Content
The integer value entered in the bottom node specifies the matrix
length i.e., the number of registers or 16-bit words in each of the two
matrices. (The source matrix and destination matrix have the same
length .) The matrix length can range from 1 ... 100e.g., a matrix
length of 100 indicates 1600 bit locations .
228
DX Matrix Instructions
10.10
A Simple
10006
Table A veraging
40101
40202
40201
40203
40204
00001
T R
ADD
ADD
00084
40202
40201
40201
40201
40203
40201
( )
Example
AVERAGE = 40301
. 40302
00003
DIV
40301
XOR
00003
DX Matrix Instructions
229
10.1 1
Steps in
10.1 1.1
TC sets the step flag, allowing the SFC program to pass through
the transition to the next step; it would appear on-line as an
MBIT instruction
RStF monitors the state of the current step and uses an output to
signal whether it is active or not; it would appear on-line as a
SENS instruction
Characteristics
Size
Off-line
Representations
TC
Sets step flag
TC
DX Matrix Instructions
RStF
Sets step flag
RStF
ON = step activated
The RStF block is usually placed in a step. The middle output passes
power as long as the step is active. Because SFC allows one extra scan
of an inactive step, the middle output can be used to shut down
outputs. When a step becomes inactive, its associated network logic is
skipped, leaving the outputs (ON or OFF) from the last scan.
To invoke this instruction off-line, push <Alt> F and type SENS.
DX Matrix Instructions
231
Chapter 11
Monitoring Remote
System Status
STAT
HLTH
Remote
I/O
I/O System
Status
233
11.1
ST AT
The STAT instruction accesses a specified number of words in a status
table in the PLCs system memory. Here vital diagnostic information
regarding the health of the PLC and its remote I/O drops is posted.
This information includes:
V
PLC status
The full lengthi.e., number of wordsin the status table will vary
depending on the type of PLC you are using and on the I/O
communications protocol. With the STAT instruction, you can copy
some or all of the status words into a block of registers or a block of
contiguous discrete references.
Caution:
W e recommend
that you do not use discretes in the
ST AT destination
node because of the excessive
number
required to contain status information.
The copy to the STAT block always begins with the first word in the
table up to the last word of interest to you. For example, if the status
table is 277 words long and you are interested only in the statistics
provided in word 11, you need to copy only words 1 ... 11 by specifying a
length of 11 in the STAT instruction.
11.1.1
Characteristics
Size
Standard in all PLC types (but maximum status table length varies
according to PLC type and I/O communications protocol in use)
Opcode
FC hex
234
Remote
I/O System
Status
11.1.2
Representation
Block Structure
ON copies specified number of
words from the status table
destination
ON = operation successful
ST AT
length
The reference number entered in the top node is the first position in the
blocki.e., the block where the current words of interest
from the status table will be copied. The reference may be
destination
block
Node Content
The integer value entered in the bottom node specifies the number of
registers or 16-bit words in the destination block where the current
status information will be written. The maximum allowable length will
differ according to the type of PLC in use and the type of I/O
communications protocol employed:
For a 984A, 984B, or 984X Chassis Mount PLC using the S901
RIO protocol, the available range of the system status table is 1 ...
75 words
For PLCs with 16-bit CPUs using the S908 RIO protocole.g. the
38x , 48x , and 68x Slot Mount PLCsthe available range of the
system status table is 1 ... 255
For PLCs with 24-bit CPUs using the S908 RIO protocole.g.,
the 78x Slot Mount PLCs, the Quantum PLCsthe available
range of the system status table is 1 ... 277
For Modicon Micro PLCs, the available range of the system status
table is 1 ... 56
Remote
I/O System
Status
235
11.2
Table
The 75 words in the S901 status table are divided into three
sectionsthe first 11 words for controller status information, the next
32 words for I/O module health information, and the last 32 words for
I/O communications information:
Decimal
W ord
W ord Content
Hex W ord
Controller Status
01
02
Controller Status
03
S901 Status
04
05
06
07
08
09
10
0A
11
0A
High Byte
12
Channel 1 Input
Channel 2 Input
0C
13
Channel 3 Input
Channel 4 Input
0D
...
...
...
Channel 31 Input
Channel 32 Input
1C
29
Channel 1 Output
Channel 2 Output
1D
30
Channel 3 Output
Channel 4 Output
1E
...
43
...
Channel 31 Output
Channel 32 Output
...
2B
44
2C
45
2D
46
2E
47
2F
...
Remote
...
28
...
236
Low Byte
... ...
...
70
46
71
47
72
48
73
49
74
4A
75
4B
I/O System
Status
11.2.1
S901 Controller
Status
W ords
10
11
12 13 14
15
16
Battery Failed
Memory Protect OFF
Run Light OFF
AC Power ON
1 = 16 Bit User Logic
0 = 24 Bit User Logic
Enable Single Sweep Delay
Enable Constant Sweep
10
11
12 13 14
15
16
Single Sweeps
10
11
12 13 14
15
16
Remote
I/O System
Status
237
10
11
12 13 14
15
16
Bad Config
Coil Disabled in RUN Mode
Logic checksum
Invalid Node
Invalid Traffic Cop
CPU Failed
Real Time Clock Error
Watchdog Timer Expired
No End-Of-Logic
State RAM Test Failed
Start of Node Did Not Start Segment
Segment Scheduler Invalid
Illegal Peripheral Intervention
Controller in DIM AWARENESS
Extended Memory Parity Error
Peripheral Port Stop
10
11
12 13 14
15
16
15
16
10
11
12 13 14
EOL Pointer
238
Remote
I/O System
Status
10
11
12 13 14
15
16
10
11
12 13 14
15
16
Word 10 uses its two most significant bits to display the RUN load
debug status:
If the bit is set to 1, then the condition is TRUE.
1
10
11
12 13 14
15
16
0 0 = Debug
0 1 = Run
1 0 = Load
10
11
12 13 14
15
16
Remote
I/O System
Status
239
11.2.2
Health
Status
W ords
Words 12 ... 43 use the high and low bytes to display the health of the
I/O modules in the odd and even channels. Each of these 32 status
words is organized as follows:
Odd Channels
1
Even Channels
6
10
11
12 13 14
15
16
Slot 8
Slot 7
Slot 6
Slot 5
Slot 4
Slot 3
Slot 2
Slot 1
Slot 8
Slot 7
Slot 6
Slot 5
Slot 4
Slot 3
Slot 2
Slot 1
If a specified slot is inhibited in the traffic cop, the bit is 0. If the slot
contains an input module or an input/output module, the bit is 1. If the
slot contains an output module and the modules COMM ACTIVE LED
is ON, the bit is 0; if slot contains an output module and the modules
COMM ACTIVE LED is OFF, the bit is 1.
Note:
240
Remote
I/O System
These indicators are valid only when scan time > 30 ms.
Status
11.2.3
Status
W ords
10
11
12 13 14
15
16
Busy 1
Send Sequence
Cable B
Receive Sequence
Busy 0
Current Message Not Supported
Byte Count Underrun
Sequence Number Invalid
Function Scheduled:
0 0 0 = Normal I/O
0 0 1 = Restart (Comm Reset)
0 1 0 = Restart (Application Reset)
1 0 0 = Inhibit
10
11
12 13 14
15
16
Retry Counter
Command Not Supported by Drop
Invalid Sequence Number
Drop Just Powered Up
Addressed Drop Did Not Respond
CRC Error From Addressed Drop
Character Overrun From the Addressed Drop
Remote
I/O System
Status
241
11.3
Table
The 277 words in the S908 status table are organized in three
sections controller status, I/O module health, and I/O communication
health:
Decimal
W ord
W ord Content
Controller Status
01
02
Controller Status
03
RIO Status
04
05
06
07
08
09
RUN/LOAD/DEBUG Status
0A
..10
11
0B
12
Drop 1, Rack 1
0C
..13
Drop 1, Rack 2
0D
...
... ...
Remote
...
16
Drop 1, Rack 5
0F
17
Drop 2, Rack 1
10
18
Drop 2, Rack 2
11
...
242
Hex W ord
... ...
...
171
AB
172
AC
173
Cable A Errors
AD
174
Cable A Errors
AE
175
Cable A Errors
AF
176
Cable B Errors
B0
177
Cable B Errors
B1
178
Cable B Errors
B2
179
B3
180
B4
181
B5
182
B6
183
B7
184
B8
I/O System
Status
185
...
11.3.1
... ...
B9
...
275
113
276
114
277
115
W ords
10 11 12 13 14 15 16
Battery Failed
Memory Protect OFF
Run Light OFF
AC Power ON
1 = 16 Bit User Logic
0 = 24 Bit User Logic
Enable Single Sweep Delay
Enable Constant Sweep
10 11
12 13
14 15 16
Single Sweeps
Remote
I/O System
Status
243
10
11
12 13 14
15
16
IOP Failure
controllers
lers )
Invalid Node
10
11
Logic checksum
Coil Disabled in
RUN Mode
Bad Config
12 13 14
15
16
10 11
12 13
14
15
16
244
Remote
I/O System
Status
10 11
12 13
14
15
16
10 11
12 13
14
15
16
Word 9 uses its four least significant bits to display ASCII message
status:
If the bit is set to 1, then the condition is TRUE.
1
10
11
12 13 14
15
16
10
11
12 13 14
15
Debug = 0
Run = 0
Load = 1
16
0
1
0
Remote
I/O System
Status
245
11.3.2
Health
Status
W ords
10
11
12 13 14
15
16
Slot 16
Slot 15
Slot 14
Slot 13
Slot 12
Slot 11
Slot 10
Slot 9
Slot 8
Slot 7
Slot 6
Slot 5
Slot 4
Slot 3
Slot 2
Slot 1
Four conditions must be met before an I/O module can indicate good
health:
246
Remote
I/O System
Status
Converting
12
Word #
= Quotient + Remainder
where
Drop #
Rack #
= Quotient + 1
= Remainder + 1
Converting
W ord #
= (Drop # x 5) + Rack # + 6
Panels
11.3.3
Status
W ords
Status words 172 ... 277 contain the I/O system communication status.
Words 172 ... 181 are global status words. Among the remaining 96
words, three words are dedicated to each of up to 32 drops, depending
on the type of PLC.
Word 172 stores the S908 Startup Error Code . This word is always 0
when the system is running. If an error occurs, the controller does not
startit generates a stop state code of 10 (word 5):
Remote
I/O System
Status
247
S908 Start-up
Code
Error Codes
Error
Meaning
(Where
01
BADTCLEN
02
BADLNKNUM
03
BADNUMDPS
04
BADTCSUM
10
BADDDLEN
11
BADDRPNUM
12
BADHUPTIM
13
BADASCNUM
14
BADNUMODS
15
PRECONDRP
16
PRECONPRT
17
TOOMNYOUT
18
TOOMNYINS
20
BADSLTNUM
21
BADRCKNUM
22
BADOUTBC
23
BADINBC
25
BADRF1MAP
26
BADRF2MAP
27
NOBYTES
28
BADDISMAP
30
BADODDOUT
31
BADODDIN
32
BADODDREF
33
BAD3X1XRF
34
BADDMYMOD
35
NOT3XDMY
36
NOT4XDMY
40
DMYREAL1X
41
REALDMY1X
42
DMYREAL3X
43
REALDMY3X
248
Remote
I/O System
Status
10
11
12 13 14
15
16
W ord 174
12 13
14
15
16
W ord 175
10 11
1 = No End-Of-Frame
1 = Short Frame
10
11
12 13 14
15
16
15
16
1 = CRC Error
1 = Alignment Error
1 = Overrun Error
10 11
12 13
14
W ord 177
14
15
16
1 = No End-Of-Frame
1 = Short Frame
12 13
W ord 178
10 11
10 11
12 13
14
15
16
1 = CRC Error
1 = Alignment Error
1 = Overrun Error
Remote
I/O System
Status
249
10
11
12 13 14
15
16
10
11
12 13 14
15
16
Counts No Responses
10 11
12 13
14
15
16
Counts No Responses
Words 182 ... 277 are used to describe remote I/O drop status; three
status words are used for each drop.
The first word in each group of three displays communication status for
the appropriate drop:
If the bit is set to 1, then the condition is TRUE.
1
10 11
12 13
14
15
16
250
Remote
I/O System
Status
The second word in each group of three is the drop cumulative error
counter on Cable A for the appropriate drop:
1
10
11
12 13 14
15
16
Counts No Responses
The third word in each group of three is the drop cumulative error
counter on Cable B for the appropriate drop:
1
10 11
12 13
14
15
16
Counts No Responses
Note:
For PLCs where drop 1 is reserved for local I/O, status words
182 ... 184 are used as follows:
Always 0
All Modules Healthy
10 11
12 13
14
15
16
182
word #
3
quotient +
remainder
Converting
1 = drop #
+ 1 = word
Remote
I/O System
Status
251
11.4
The Compact
PLC Status
Table
W ord
W ord Content
Controller Status
2
Controller Status
03
04
05
06
07
Memory Sizing Word for Panel (in the 984-145 Compact Controller)
08
09
10
RUN/LOAD/DEBUG Status
11
0A
0B
12
Rack 1
0C
13
Rack 2
0D
14
Rack 3
0E
15
Rack 4
0F
16
10
...
Remote
01
02
252
Hex W ord
... ...
...
182
B9
183
BA
184
BB
I/O System
Status
11.4.1
Compact
PLC Status
W ords
10 11
12 13 14 15 16
Battery Failed
Memory Protect OFF
Run Light OFF
AC Power ON
16-bit User Logic
Enable Single Sweep Delay
Enable Constant Sweep
10 11
12 13 14 15 16
10 11
12 13
14
15
16
Remote
I/O System
Status
253
10
11
12 13 14
15
16
10 11
12 13
14
15
16
10 11
12 13
14
15
Debug = 0
Run = 0
Load = 1
16
0
1
0
254
Remote
I/O System
Status
11.4.2
Compact
I/O Module
Health
Status
W ords
Status words 12 ... 15 are used to display the health status of the A120
I/O modules in each of the four racks. The most significant bit in each
of these four words represents the I/O module in slot 1 of its associated
rack:
1
10 11
12 13
14
15
16
Three conditions must be met before an I/O module can indicate good
health:
V
Compact
I/O Communication
Status
W ords
The last three words in the Compact PLC status table describe the
health of the communications on the installed A120 I/O modules.
Word 182 describes systemwide I/O health status. Bits 9 ... 16
form a counter that increments each time an unhealthy module is
found. The counter rolls over when the count surpasses 255:
10 11
12
13
14
15
16
Remote
I/O System
Status
255
10 11
12
13
14
15
16
Word 184 keeps a count of the retries on the PAB bus. Bits 1 ... 16
accumulate a count that increments once each time a comm retry
occurs. If after one try and four retries a bus error is still detected, the PLC stops and displays error code 10 on the programming panel. Normally, all bits in this word should be 0s.
10
11
12
13
14
15
16
256
Remote
I/O System
Status
11.5
Table
W ord
W ord Content
Hex W ord
Controller Status
01
02
Controller Status
03
04
05
06
07
08
09
10
RUN/LOAD/DEBUG Status
0A
11
0B
12
Drop 1, Rack 1
0C
13
Drop 1, Rack 2
0D
14
Drop 1, Rack 3
0E
15
Drop 1, Rack 4
0F
16
Drop 1, Rack 5
10
17
Drop 2, Rack 1
11
...
... ...
...
31
Drop 5, Rack 4
1F
32
20
33
21
...
... ...
...
36
24
37
25
38
26
39
27
40
41
...
56
28
Communication health on an I/O expansion network
(parent PLC only)
... ...
29
...
Remote
I/O System
38
Status
257
11.5.1
W ords
10
11 12 13 14 15 16
Battery Failed
Run Light OFF
ON = 16-bit User Logic
OFF = 24-bit User Logic
Enable Single Sweep Delay
Enable Constant Sweep
10
11
12
13
14
=
=
=
=
=
0
0
0
1
1
15
0
1
1
0
0
16
01
02
03
04
05
1
0
1
0
1
10 11
12
13 14 15 16
Single Sweeps
10
11
12
13
258
Remote
I/O System
Status
14
15
16
1 0 0
10 11
12 13
14
15
16
10
11
12 13 14
15
16
10
11
12 13 14
15
16
Word 8 is reserved.
Word 9 is reserved.
Remote
I/O System
Status
259
10
11
12 13 14
15
Debug = 0
Run = 0
Load = 1
16
0
1
0
Word 11 is reserved.
11.5.2
Health
10
11
12
13
14
15
16
Location 5
Location 4
Location 3
Location 2
Location 1
260
Remote
I/O System
Status
12
= quotient + remainder
where
quotient
remainder
+ 1 = drop #
+ 1 = rack #
Remote
I/O System
Status
261
11.5.3
Start-up
Error Codes
262
Remote
I/O System
11
12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
1
0
1
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
1
1
1
0
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
1
1
0
0
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
Status
10
13
14
15
16
11.5.4
Communications
Status
Words 33 and 34 in the Micro status table use their bit values
differently depending on whether they are in a parent or a child PLC
on the I/O expansion net:
W ord 33
for a parent-
or single-mode
PLC:
0 = unsuccessful communication to
a child
for a child-mode
10
11
12
13
14
15
16
PLC:
10
11
12
13
14
15
16
W ord 34
for a parent-mode
PLC:
10
Number of no responses on
the system
for a child-mode
11
12
13
14
15
16
PLC:
10
11
12
13
14
15
16
Words 35 and 36 are used only when the PLC is a parent on the I/O
expansion net:
W ord 35
10
11
12
13
14
15
16
Remote
I/O System
Status
263
W ord 36
10
11
12
13
14
15
16
Words 37 ... 39 are used for Micro PLCs that implement A120
expansion. Word 37 displays the healthy of communications in rack 1 of
the I/O expansion network:
If the bit is set to 1, the condition is TRUE
1
10
11
12
13
14
15
16
10
11
12
13
14
15
16
Number of times an error has been detected while communicating with I/O
10
11
12
13
14
15
16
264
Remote
I/O System
Status
Words 41, 45, 49, and 53 have the following common format:
1
0 = unsuccessful communication
from parent to a specific child
10
11
12
13
14
15
16
Number of nonrecoverable
communication losses at the
specific child
1 = successful communication
at a specific child
Words 42, 46, 50, and 54 have the following common format:
1
10
11
12
13
14
15
16
Number of no responses
from a specific child
Words 43, 47, 51, and 55 have the following common format:
1
10
11
12
13
14
15
16
Words 44, 48, 52, and 56 have the following common format:
1
10
11
12
13
14
15
16
Remote
I/O System
Status
265
11.6
HL TH
The HLTH instruction creates history and status matrices from
internal memory registers that may be used in ladder logic to detect
changes in PLC status and communication capabilities with the I/O. It
can also be used to alert the user to changes in a PLC System. HLTH
has two modes of operation, learn and monitor .
11.6.1
Learn Mode
HLTH can be initialized to learn the configuration in which it is
implemented and save the information as a point- in-time reference
called history matrix. This matrix contains:
11.6.2
S911 Health
Monitor
Mode
266
Remote
I/O System
Status
The HLTH instruction block has three control inputs and can produce
three possible outputs. The combined states of the inputs to the middle
and bottom nodes control the operating mode:
Middle
11.6.3
Input
Bottom
Input
Operation
ON
OFF
ON
ON
OFF
ON
Monitor Mode
OFF
OFF
Characteristics
Size
Opcode
Representation
Block Structure
history
status
length
HL TH
ON = Error
Remote
I/O System
Status
267
History
Matrix
Word 1: Enter drop number (range 0 ... 32) to be monitored for retries
10
11
12
13
14
15
16
10
11
12
13
14
15
16
268
Remote
I/O System
Status
Words 7 ... 10: Four words that define the learned condition of
drop 1
Words 11 ... 14: Four words that define the learned condition of
drop 2
1
10
11
12
13
14
15
16
ON = cable A monitored
ON = cable B monitored
1 = at least one disabled output has been found
Words 132 ... 135: Four words that define the learned condition of
drop 32
The structure of the four words allocated to each drop are as follows:
First W ord
10
11
12
13
14
15
16
Note:
Drop delay bits are used by the software to delay the
monitoring of the drop for four scans after reestablishing
communications with a drop. The delay value is for internal use only
and needs no user intervention.
Remote
I/O System
Status
269
Second
W ord
10
11
12
13
14
15
16
Third W ord
10
11
12
13
14
15
16
270
Remote
I/O System
Status
Fourth
W ord
10
11
12
13
14
15
16
Status Matrix
10
11
12
13
14
15
16
Word 2 is the cumulative retry counter for the drop being monitored
(the drop number is indicated in the high byte of word 1):
1
10
11
12
13
14
15
16
Remote
I/O System
Status
271
10
11
12
13
14
15
16
Words 4 ... 7 indicate drop 1 status; words 8 ... 11 indicate drop 2 status;
etc., through words 129 ... 132, which indicate drop 32 status. The
structure of the four words allocated to each drop is as follows:
First W ord
10
11
12
13
14
15
16
272
Remote
I/O System
Status
Second
W ord
10
11
12
13
14
15
16
Third W ord
10
11
12
13
14
15
16
Remote
I/O System
Status
273
Fourth
W ord
Cable B fault
Cable A fault
1
10
11
12
13
14
15
16
Bottom
Node Content
= (# of I/O drops x 4) + 3
This value gives you the number of registers in the status matrix. You
only need to enter this one value as the length because the length of the
history matrix is automatically increased by 3 registersi.e., the size of
the history matrix is length + 3.
11.6.5
HL TH Example
Suppose the HLTH instruction is going to be programmed to monitor
the status of two remote I/O drops on a PLC network. The logic to learn
the traffic cop is programmed for the first logic scan, then to monitor
status in the subsequent scan. In this example, the RIO network is a
single-cable system.
The length of the status matrix is determined by the formula:
length
or
(2 x 4) + 3 = 11
The software will automatically add 3 to the length to establish a
history matrix with 14 registers.
274
Remote
I/O System
Status
The two holding registers entered in the top and middle nodes of the
instruction become the first registers in each matrix:
40101
40121
01408
First Scan
Detector
History
Matrix
Status
Matrix
40101
40121
HL TH
11
40131
40114
( )
01408
On the first scan, coil 1408 is OFF, and power is applied to all three
inputs. Thus, the instruction executes a learn of the present
configuration and sets the appropriate bits in the history matrix. The
learn is for only a single-cable system.
On subsequent scans coil 1408 is ON and power is removed from the
second and third inputs. This causes the instruction to monitor the
status of the PLC and its two remote I/O drops. The appropriate health
bits are set in the status matrix.
The third word of the status matrix is for the PLC. Words 4 ... 7
represent the status of drop 1, and words 8 .. 11 represent the status of
drop 2. These status bits are updated each scan.
If all the I/O modules that have been mapped in the Traffic Cop are
communicating, all the bits in the status matrix related to module
health are OFF. If a module stops communicating, its assigned bit will
turn ON.
To see the cumulative retries for drop one, enter the value 5 in register
40101 (the first register in the history matrix). Do this in monitor mode.
The HLTH instruction moves the cumulative retries for the drop into
the second register of the status matrix (40122) The value can range
from 0 ... 255; it rolls over to zero after reaching 255.
Remote
I/O System
Status
275
Chapter 12
Monitoring Distributed
System Status
DIOH
Distributed
I/O System
I/O
Status
277
12.1
Status
Table
The distributed I/O (DIO) health tables allocates one 16-bit word for
each configured drop in a DIO system. Up to 189 distributed drops are
configurable on three networks, up to 63 drops per network. The
Modbus Plus port on the PLC is used as the head processor for network
1, and two additional DIO option modules may be used in the local rack
to support networks 2 and 3.
Note:
The assignment of network 2 or network 3 to a particular DIO
processor is handled automatically by the PLC. If two processors are
installed when the system is powered up, the PLC selects the leftmost
of the two as the processor for network 2 and the rightmost as the
processor for network 3. If only one DIO processor is installed in the
rack when the system is powered up, the PLC always selects it as the
processor for network 2. If a second DIO processor is added to the
rack after power-up, the PLC selects it as the processor for network 3
regardless of its position in the rack relative to the other processor.
The DIO table is divided into three sections, with 64 words reserved for
each of the three possible networks:
W ord
DIO drop 2
...
65
66
DIO drop 66
...
128
129
130
...
.192
Distributed
...
64
...
278
Content
I/O System
...
DIO drop 192 (last drop on network 3)
Status
Each drop can support one rack of I/O, with as many as 16 slots
available (depending on the type of rack used at the drop. A bit in each
word indicates the health of the module in the associated slot. The
format of registers 1 ... 192 is:
Slot 16
Slot 15
Slot 14
Slot 13
Slot 12
If the bit is set to 1, then the condition is healthy
1
10
11
12 13 14
15
16
Slot 11
Slot 10
Slot 9
Slot 8
Slot 7
Slot 6
Slot 5
Slot 4
Slot 3
Slot 2
Slot 1
Four conditions must be met before a module can indicate good health:
V
Valid communications must exist between the I/O module and the
DIO interface at the drop
Distributed
I/O System
Status
279
12.2
DIOH
The DIOH instruction lets you retrieve health data from a specified
group of drops on the distributed I/O network. It accesses the DIO
health status table, where health data for modules in up to 189
distributed drops is stored.
12.2.1
Characteristics
Size
Opcode
20 hex
12.2.2
Representation
Block Structure
ON copies specified number of
words from the status table
source
destination
DIOH
length
(1
... 192)
Input
The DIOH instruction has one control input to the top node, initiates
the retrieval of the specified status words from the DIO health table
into the destination table.
Outputs
DIOH produces two possible outputs. The output from the top node
echoes the state of the top input. The output from the bottom node goes
ON if an invalid source constant is entered in the top node.
280
Distributed
I/O System
Status
xx
yy
Bottom
Node Content
The integer value entered in the bottom node specifies the length i.e.,
the number of 4x registersin the destination table. The length is in
the range 1 ... 64.
If you specify a length that exceeds the number of registers
available, the instruction will return status information only for the
registers available. For example, if you specify the 63rd word in the
DIOH health status table in the middle node register and then
request a length of 5, the instruction will give you only two registers
(the 63rd and 64th status words) in the destination table.
Note:
Distributed
I/O System
Status
281
Chapter 13
Bypassing Networks
SKP
with
Bypassing
Networks
with SKP
283
13.1
SKP
When a SKP instruction is implemented, skipped networks in the
ladder logic program are not solved. SKP instructions can be used to
reduce scan time and, in effect, establish subroutines within the
scheduled logic.
A SKP operation cannot pass the boundary of a segment. No matter
how many extra networks you specify to be skipped, the instruction will
stop if it reaches the end of a segment.
A SKP instruction can be activated only if you specify in the
configurator editor that skips are allowed.
Note:
13.1.1
Characteristics
Size
13.1.2
Representation
in Ladder
Logic
Block Structure
SKP
# of networks
skipped
Input
SKP has one control input that initiates a skip network operation when
it passes power. A SKP operation is performed on every scan while the
input is ON.
284
Bypassing
Networks
with SKP
Node Content
The node value includes the network that contains the SKP instruction.
The nodal regions in the network where the SKP resides that have not
already been scanned will be skipped; this counts as one of the
networks specified to be skipped. The CPU continues to skip networks
until the total number of networks skipped equals the value specified.
13.1.3
A Simple
SKP Example
( )
00193
10003
SKP
00002
10001
( )
10002
00116
When N.O. contact 10001 is closed, the remainder of the top network
and all of the bottom network are skipped. The power flow display for
these two networks becomes invalid, and your system displays an
information message to that effect.
Coil 00193 is still controlled by contact 10003 because the solution of
coil 00193 occurs before the SKP instruction. Coil 00116 will remain in
whatever state it was in when the bottom network was skipped.
Bypassing
Networks
with SKP
285
13.2
Off-line Instructions
Modsoft SFC
for Skipping
Steps in
SKPC (skip constant), which lets you reduce scan time in an SFC
or macro application by explicitly specifying a number of networks
to be skipped
SKPR (skip register), which lets you reduce scan time in an SFC
or macro application using a value stored in a 3x or 4x register to
specify the number of networks to be skipped
13.2.1
Characteristics
Size
286
Bypassing
Networks
with SKP
13.2.2
Off-line
Representations
SKIP
SKIP
constant
(1 ... 998)
SKPC
constant
(0 ... 998)
SKPR
register
(3x or 4x )
On-line
Representation
SKP
constant
register
or
Bypassing
Networks
with SKP
287
Chapter 14
Extended Memory
Capabilities
XMWT
XMRD
Extended
Memory
Capabilities
289
14.1
Extended
Memory
File Structure
Extended memory provides up to ten files, and each file can contain as
many as 10,000 registers ranging from 60000 ... 69999:
File 1
File 2
File 10
60000
60001
60002
60000
60001
60002
60000
60001
60002
69999
69999
69999
Optional sizes of extended memory are available for the various PLC
models that support it:
984B
E984-785
L984-785
Quantum
32K words
24K words
0K words
0K words
64K words
96K words
24K words
80K words
96K words
Series
72K words
96K words
The total memory available may be up to 128K words, with either 32K
words or 64K words allocated for user logic memory so that:
290
Extended
A 984B with 64K words of memory may use all 64K for user logic
or 32K of user logic and 32K words of extended memory
A 984B with 96K words of memory may use 32K for user logic
and 64K for extended memory or 64K for user logic and 32K for
extended memory
A 984B with 128K words of memory may use 32K for user logic
and 96K for extended memory or 64K for user logic and 64K for
extended memory
Memory
Capabilities
14.2
How Extended
Memory
Memory
Is Stored
in User
page F
16 bits
page 3
Extended Memory
page 2
Executive PROM
IOP Address Space
Extended Memory
page 1
State RAM
page 0
User Logic
ASCII Message Table
Loadable Instructions
Traffic Cop Table
Segment Scheduler
Status Tables
Other Diagnostics
Executive Scratchpad
16 bits
Configuration Table
Data Exchange Code
24 bits
Note:
Pages 2 and 3 of Extended Memory contain 16 bit words, as
do all pages except pages 0 and 1 in a 24 bit machine.
Pages 0 and 1 each contain 32K 24 bit words. If you choose 32K for
extended memory, only page 0 is used, and page 1 is available for
optional user logic.
Extended
Memory
Capabilities
291
14.3
XMWT
The XMWT instruction is used to write data from a block of input
registers or holding registers in state RAM to a block of 6x registers in
an extended memory file.
14.3.1
Characteristics
Size
Opcode
7E hex
14.3.2
Representation
Block Structure
ON activates write operation
source
control
block
XMWT
ON = operation complete
292
Extended
Memory
Capabilities
Reference
Register
Displayed
status word
Name
Description
10 11
12 13 14 15 16
registers
parameter error
file number
Specifies which of the extended memory files is currently in use (range: 1 ... 10)
Second implied
start address
Third implied
count
Specifies the number of registers to be read or written in a scan when the appropriate function block is
powered; range: 0 ... 9999, not to exceed number
specified in max registers (fifth implied)
Fifth implied
max registers
If you are in multi-scan mode, these six registers should be reserved for
use only by this instruction.
Bottom
Node Content
Extended
Memory
Capabilities
293
14.4
XMRD
The XMRD instruction is used to copy a table of 6x extended memory
registers to a table of 4x holding registers in state RAM.
14.4.1
Characteristics
Size
Opcode
9E hex
14.4.2
Representation
Block Structure
control
block
destination
XMRD
ON = operation complete
294
Extended
Memory
Capabilities
Reference
Register
Displayed
status word
Name
Description
9 10 11
12 13
14 15 16
registers
parameter error
file number
Specifies which of the extended memory files is currently in use (range: 1 ... 10)
Second implied
start address
Third implied
count
Specifies the number of registers to be read or written in a scan when the appropriate function block is
powered; range: 0 ... 9999, not to exceed number
specified in max registers (fifth implied)
Fifth implied
max registers
Node Content
Extended
Memory
Capabilities
295
Chapter 15
ASCII Communication
Instructions
ASCII Communication
Instructions
297
15.1
READ
The READ instruction provides the ability to read data from an ASCII
input device (keyboard, bar code reader, etc.) into the PLCs memory via
its RIO network. The connection to the ASCII device is made at an RIO
interface.
In the process of handling the messaging operation, READ performs
the following functions:
V
Characteristics
Size
Standard in all PLC types that support S901 or S908 remote I/O
communications
Opcode
1E hex
298
ASCII Communication
Instructions
15.1.2
Representation
Block Structure
ON initiates a READ
control
block
destination
READ
table
length
Inputs
READ has three control inputs that can start, pause, and abort the
READ operation.
Outputs
READ can produce three possible outputs. The output from the middle
node goes ON to if an error has been detected in the communication or
if the operation has timed out. The output from the bottom node goes
ON when the READ operation is completed.
Top Node Content
The 4x register entered in the top node
holding register in the control block .
ASCII Communication
Instructions
299
Register
Definition
Displayed
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1111
1
9 10 11
12 13 14 15 16
Comm port #
(1 ... 32)
Message number
Second implied
Third implied
Fourth implied
Fifth implied
Sixth implied
300
ASCII Communication
Instructions
Node Content
The integer value entered in the bottom node specifies the length of the
destination tablei.e., the number of registers where the message data
will be stored. The length can range from 1 ... 255 in a 16-bit CPU and
from 1 ... 999 in a 24-bit CPU.
ASCII Communication
Instructions
301
15.2
WRIT
The WRIT instruction sends a message from the PLC over the RIO
communications link to an ASCII display (screen, printer, etc.).
In the process of sending the messaging operation, WRIT performs the
following functions:
V
Characteristics
Size
Standard in all PLC types that support S901 or S908 remote I/O
communications
Opcode
3E hex
302
ASCII Communication
Instructions
15.2.2
Representation
Block Structure
ON initiates a WRIT
source
control
block
WRIT
table
length
Inputs
WRIT has three control inputs that can start, pause, and abort the
WRIT operation.
Outputs
WRIT can produce three possible outputs. The output from the middle
node goes ON to if an error has been detected in the communication or
if the operation has timed out. The output from the bottom node goes
ON when the WRIT operation is completed.
Top Node Content
The top node contains the first 3x or 4x register in a source table whose
length is specified in the bottom node. This table contains the data
required to fill the variable field in a message. Consider the following
WRIT message
vessel #1 temperature is: III
The 3-character ASCII field III is the variable data field; variable data
are loaded, typically via DX moves, into a table of variable field data.
Middle Node Content
The 4x register entered
ASCII Communication
Instructions
303
Register
Definition
Displayed
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1111
1
9 10 11 12 13 14 15 16
Comm port #
(1 ... 32)
Message number
Second implied
Third implied
Fourth implied
Fifth implied
Sixth implied
Bottom
Node Content
The integer value entered in the bottom node specifies the length of the
source tablei.e., the number of registers where the message data will
be stored. The length can range from 1 ... 255 in a 16-bit CPU and from
1 ... 999 in a 24-bit CPU.
304
ASCII Communication
Instructions
15.3
Formatting
READ/WRIT
The ASCII messages used in the READ and WRIT instructions can be
created via your panel software using the format specifiers described
below. Format specifiers are character symbols that indicate:
15.3.1
Format
/
Specifiers
Meaning
Field width
None (defaults to 1)
Prefix
None (defaults to 1)
Input format
Output format
Outputs CR, LF
Meaning
Field width
Prefix
None
Input format
Output format
Meaning
Field width
Prefix
None (defaults to 1)
Input format
Output format
Outputs number of upper and/or lower case printable characters specified by the field width
ASCII Communication
Instructions
305
( )
306
ASCII Communication
Meaning
Field width
Prefix
None (defaults to 1)
Input format
Output format
Meaning
2 (4X,
Field width
None
Prefix
1 ... 255
Input format
Repeat format specifiers in parentheses the number of times specified by the prefix
Output format
Repeat format specifiers in parentheses the number of times specified by the prefix
Meaning
Field width
1 ... 8 characters
Prefix
1 ... 99
Input format
Output format
Meaning
Field width
1 ... 8 characters
Prefix
1 ... 99
Input format
Output format
Meaning
Field width
1 ... 99
Prefix
None (defaults to 1)
Input format
Accepts any 8-bit character except reserved delimiters such as CR, LF, ESC, BKSPC, DEL.
Output format
Instructions
Meaning
Field width
1 ... 6 characters
Prefix
1 ... 99
Input format
Output format
Meaning
Field width
1 ... 16 characters
Prefix
1 ... 99
Input format
Output format
Meaning
Field width
1 ... 4 characters
Prefix
1 ... 99
Input format
Output format
ASCII Communication
Instructions
307
15.4
COMM
The COMM instruction gives you the ability to read and write canned
messages to/from ASCII character input/output devices via one of the
built-in communication ports on a Micro PLC or, if the PLC is a parent,
via a comm port on one of the child PLCs on the expansion link.
15.4.1
Characteristics
Size
hex
15.4.2
Representation
Block Structure
control
block
data
block
ON = error detected
(for one scan)
COMM
length
(3 ... 255)
ON = operation complete
(for one scan)
308
ASCII Communication
Instructions
Register
Content
Displayed
9 10 11 12
13 14
15 16
No error 0 0 0 0
Unconfigured child selected in fifth implied register 0 0 0 1
COMM instruction active longer than the time specified in
ninth implied register
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 1
Second implied
Third implied
Fourth implied
Fifth implied
Port number (1 for a port on the local PLC, 2 ... 5 if local PLC is a
parent using a port on a child)
Sixth implied
Seventh implied
Eighth implied
Ninth implied
The middle node contains the first 4x register of the data block a table
where variable message data is placed. In a read operation, the data
block is a destination table; in a write operation, it is a source table.
Bottom
Node Content
The integer value entered in the bottom node specifies the length i.e.,
the number of registersin the data block . The length can range from
3 ... 255.
ASCII Communication
Instructions
309
15.4.3
Message
Formats
Instruction
Message
Format
Decimal
Format
1001
1001
Control/Monitor signals*
1002
1010
1110
1020
1120
Indicator
310
For a write operation with CR/LF, the COMM instruction automatically sends a carriage return/linefeed after the selected number of items is sent. For a write operation with no CR/LF, the
COMM instruction does not automatically send any carriage returns or linefeeds.
For a read operation with CR/LF, the format is satisfied when either the selected number of items is inputi.e., taken out of the
output bufferor when you input a carriage return or linefeed; in
the second case, the CR/LF is not put into any register. For a read
operation with no CR/LF, inputting the selected number of items
is the only way to satisfy the format
ASCII Communication
Instructions
ASCII Character
Format
Format numbers
General usage
Usage in a write
operation
No auto CR/LF
Auto CR/LF
Usage in a read
operation
No auto CR/LF
Auto CR/LF
Integer
mat
(1 ... 4) For-
Format numbers
General usage
Usage in a write
operation
No auto CR/LF
Auto CR/LF
Usage in a read
operation
No auto CR/LF
Auto CR/LF
ASCII Communication
Instructions
31 1
Format numbers
General usage
Usage in a write
operation
No auto CR/LF
Auto CR/LF
No auto CR/LF
Auto CR/LF
Usage in a read
operation
312
ASCII Communication
Instructions
Format numbers
1000
General usage
Usage in a read
operation
General usage
Usage in a read
operation
15.4.4
Special
Signals
Set-up Considerations
Format
for Control/Monitor
The first three registers in the data block (the displayed register and
the first and second implied registers in the middle node) have
predetermined content:
Register
Content
Displayed
10 11 12 13 14 15 16
1 = control RTS
0 = do not control RTS
10 11 12 13 14 15 16
1 = take port
0 = return port
Second implied
1
1 = activate RTS
0 = deactivate RTS
10 11
12 13 14 15 16
These three data block registers are required for this format, and
therefore the allowable range for the length value (specified in the
bottom node) is 3 ... 255.
ASCII Communication
Instructions
313
15.5
ASCII Character
ASCII
Character
Decimal
Value
Hex
Value
ASCII
Character
Decimal
Value
Hex
Value
Bell
07
<
60
3C
Linefeed
10
0A
61
3D
Formfeed
12
0C
>
62
3E
Carriage return
13
0D
63
3F
26
1A
64
40
27
1B
65
41
32
20
66
42
33
21
67
43
34
22
68
44
35
23
69
45
36
24
70
46
37
25
71
47
&
38
26
72
48
39
27
73
49
40
28
74
4A
41
29
75
4B
42
2A
76
4C
43
2B
77
4D
44
2C
78
4E
45
2D
79
4F
46
2E
80
50
47
2F
81
51
48
30
82
52
49
31
83
53
50
32
84
54
51
33
85
55
52
34
86
56
53
35
87
57
54
36
88
58
55
37
89
59
56
38
90
5A
57
39
91
5B
58
3A
93
5D
59
3B
94
5E
Space
314
Set
ASCII Communication
Instructions
ASCII
Character
Decimal
Value
Hex
Value
ASCII
Character
Decimal
Value
Hex
Value
95
5F
119
77
97
61
120
78
98
62
121
79
99
63
122
7A
100
64
123
7B
101
65
124
7C
102
66
125
7D
103
67
129
81
104
68
132
84
105
69
148
94
106
6A
155
9B
107
6B
156
9C
108
6C
164
A4
109
6D
219
DB
110
6E
224
E0
111
6F
225
E1
112
70
228
E4
113
71
229
E5
114
72
230
E6
115
73
234
EA
116
74
236
EC
117
75
238
EE
118
76
246
F6
ASCII Communication
Instructions
315
Chapter 16
Sequential Control
Instructions
Sequential
Control
Instructions
317
16.1
16.1.1
A Mechanical
Tenor Drum
A Mechanical
Tenor Drum
Using the instructions described in this chapter, you can set up a step
data table with a 16-bit register to represent each step in the process
being controlled. The logic scans the table from top to bottom, treating
each 1 value in a register like a cam and each 0 like a flat surface in a
row on the mechanical tenor drum:
318
Sequential
Control
Instructions
Register
Register
Content
displayed
first implied
second implied
third implied
fourth implied
fifth implied
sixth implied
1 1 1 0
0 1 1 0 0 1 1 1 0 0
step 1
seventh implied
0 1 1 1
0 0 1 1 0 0 0 0 1 1
step 2
eighth implied
0 0 1 1
0 1 1 0 0 0 0 1 0 0
step 3
last
1 0 1 1
0 0 0 0 1 0 0 0 1 1
last step
Sequential
Control
Instructions
319
16.2
DRUM
The DRUM instruction operates on a table of 4x registers containing
data representing each step in a sequence. The number of registers
associated with this step data table depends on the number of steps
required in the sequence. You can pre-allocate registers to store data for
each step in the sequence, thereby allowing you to add future
sequencer steps without having to modify application logic.
DRUM incorporates an output mask that allows you to selectively
mask bits in the register data before writing it to coils. This is
particularly useful when all physical sequencer outputs are not
contiguous on the output module. Masked bits are not altered by the
DRUM instruction, and may be used by logic unrelated to the
sequencer.
16.2.1
Characteristics
Size
Available as a loadable for all PLC types except the Micro and
Quantum Automation Series PLCs
Opcode
FE hex (default)
16.2.2
Representation
Block Structure
Initiates DRUM sequencer
step
pointer
step data
table
DRUM
length
Last step
Error
Inputs
DRUM has three control inputs. When the input to the top node is ON,
the drum operation is initiated. When the input to the middle node is
320
Sequential
Control
Instructions
ON, the step pointer increments to the next step. When the input to the
bottom node is ON, the step pointer is reset to 0.
Outputs
DRUM can produce three possible outputs. The output from the top
node echos the state of top input. The output from the middle node goes
ON for the last stepi.e., when the step pointer value = length . The
output from the bottom node goes ON if an error is detected.
Top Node Content
The 4x register entered
The 4x register entered in the middle node is the first register in a table
of step data information. The first six registers in the step data table
hold constant and variable data required to solve the block:
Register
Register
Name
Displayed
masked
First implied
current
Second implied
output mask
Third implied
machine
Fourth implied
profile ID number
output data
step data
ID number
Description
Fifth implied
steps used
Sequential
Control
Instructions
321
The remaining registers contain data for each step in the sequence.
Bottom
Node Content
The integer value entered in the bottom node is the length i.e., the
number of application-specific registersused in the step data table .
The length can range from 1 ... 255 in a 16-bit CPU and from 1 .. 999 in
a 24-bit CPU.
The total number of registers required in the step data table is the
length + 6. The length must be the value placed in the steps used
register in the middle node.
322
Sequential
Control
Instructions
16.3
ICMP
The ICMP (input compare) instruction provides logic for verifying the
correct operation of each step processed by a DRUM instruction. Errors
detected by ICMP may be used to trigger additional error-correction
logic or to shut down the system.
ICMP and DRUM are synchronized through the use of a common step
register. As the pointer increments, ICMP moves through its
data table in lock step with DRUM. As ICMP moves through each new
step, it comparesbit for bitthe live input data to the expected status
of each point in its data table.
pointer
16.3.1
Characteristics
Size
Available as a loadable for all PLC types except the Micro and
Quantum Automation Series PLCs
Opcode
7F hex (default)
16.3.2
Representation
Block Structure
Initiates the input comparison
A cascading input, telling the
block that previous ICMP
comparisons were all good
step
pointer
step data
table
ICMP
length
Inputs
ICMP has two control inputs (to the top and middle nodes). When the
input to the top node is ON, the ICMP operation is initiated. When the
input to the middle node is ON, the instruction passes the compare
status to the middle output.
840 USE 101 00
Sequential
Control
Instructions
323
Outputs
ICMP can produce three possible outputs. The output from the top node
echos the state of top input. The output from the middle node goes ON
to indicate a valid input comparison. The output from the bottom node
goes ON if an error is detected.
Top Node Content
The 4x register entered
table
Register
Name
Displayed
First implied
current
step data
Description
table
Second implied
input mask
Third implied
masked
input data
Fourth implied
compare
status
Fifth implied
machine
ID number
Identifies DRUM/ICMP blocks belonging to a specific machine configuration; value range: 0 ... 9999
(0 = block not configured); all blocks belonging to
same machine configuration have the same machine ID number
324
Sequential
Control
Instructions
Sixth implied
profile ID number
Identifies profile data currently loaded to the sequencer; value range: 0 ... 9999 (0 = block not
configured); all blocks with the same machine ID
number must have the same profile ID number
Loaded by user before using the block, DRUM will
not alter steps used contents during logic solve;
contains between 1 ... 255 for 16 bit CPUs and 1
... 999 for 24 bit CPUs, specifying the actual number of steps to be solved; the number must be
< the table length in the bottom node of the ICMP
block
The remaining registers contain data for each step in the sequence.
Bottom
Node Content
The integer value entered in the bottom node is the length i.e., the
number of application-specific registersused in the step data table .
The length can range from 1 ... 255 in a 16-bit CPU and from 1 .. 999 in
a 24-bit CPU.
The total number of registers required in the step data table is the
length + 8. The length must be > the value placed in the steps used
register in the middle node.
16.3.3
Cascaded
DRUM/ICMP
Blocks
Sequential
Control
Instructions
325
16.4
SCIF
SCIF performs either a drum sequencing operation or an input
comparison (ICMP) using the data defined in the step data table . The
choice of operation is made by defining the value in the first register of
the step data table :
16.4.1
0 = drum mode (the instruction controls outputs in the drum sequencing application)
Characteristics
Size
Opcode
3F hex
16.4.2
Representation
Block Structure
Initiates specified sequence
control operation
Operation-specific
Reset step pointer to 0
step
pointer
step data
table
SCIF
length
(1 ... 255)
Inputs
SCIF has three control inputs. When the input to the top node is ON,
the drum or ICMP operation is initiated.
326
Sequential
Control
Instructions
When the input to the middle node is ON in drum mode, the step
increments to the next step. When this input is ON in ICMP
mode, the instruction passes the compare status to the middle output..
pointer
When the input to the bottom node is ON in drum mode, the step
is reset to 0. The bottom input is not used in ICMP mode.
pointer
Outputs
SCIF can produce three possible outputs. The output from the top node
echos the state of top input.
In drum mode, the output from the middle node goes ON for the last
stepi.e., when the step pointer = length . In ICMP mode, this output
goes ON to indicate a valid input comparison.
The output from the bottom node goes ON if an error is detected.
Top Node Content
The 4x register entered
The 4x register entered in the middle node is the first register in the
step data table . The first seven registers in the table hold constant and
variable data required to solve the instruction:
Register
Register
Name
Displayed
subfunction
First implied
masked
type
output data
Second implied
current
Third implied
output mask
input mask
Description
Sequential
Control
Instructions
327
Fourth implied
masked
input data
compare
status
* This and the rest of the registers represent application-specific step data in the process
being controlled.
Bottom
Node Content
The integer value entered in the bottom node is the length i.e., the
number of application-specific registersused in the step data table .
The length can range from 1 ... 255.
The total number of registers required in the step data table is the
length + 7. The length must be > the value placed in the steps used
register in the middle node.
328
Sequential
Control
Instructions
16.5
A Sequence Control
SCIF Instruction
Example
Using the
T ip:
Caution:
example
Use this
Network 1 controls the starting and stopping of the drum example. Coil
00128Cyclestart SCIF_CONTR indicates that the SCIF cycle has
started. Coil 00129Seq_start SCIF_CONTRindicates that the SCIF
sequence has started or restarted.
Network
10001
EMERG_STOP
SCIF_CONTR
10002
Stop_cycle
SCIF_CONTR
10003
Startcycle
SCIF_CONTR
00128
CycleStart
00128
CycleStart
SCIF_CONTR
0001 #000
00128
Cyclestart
SCIF_CONTR
00130
Last_step
SCIF_CONTR
0003 #000
10001
EMERG_STOP
SCIF_CONTR
00129
Seq_start
00129
Seq_start
SCIF_CONTR
0001 #000
Sequential
Control
Instructions
329
Network 2 controls the dwell time used at each step of the drum. Coil
00131 Next_step SCIF_CONTRincrements the SCIF pointer to the
next step:
Network
40150
Steppointr
SCIF_CONTR
40200
Dwelltable
SCIF_DWELL
SCIF
#0016
40201
Dwelltime
SCIF_DWELL
00129
Seq_start
SCIF_CONTR
00131
Next_Step
T.01
00131
Next_Step
SCIF_CONTR
0002 #000
00129
Seq_start
SCIF_CONTR
0001 #000
40400
Junk_reg
SCIF_DWELL
Network 3 holds the ICMP and drum functions that compare system
inputs to a predetermined value and to fire the outputs of the drum.
The BLKM moves the feedback inputs that the ICMP-mode SCIF next
to it will monitor in its middle-node register. This SCIF then compares
the status of the feedback inputs to the expected result. Coil 00132
indicates that the SCIF ICMP inputs equal the desired preset.
Network
00129
Seq_start
SCIF_CONTR
0001 #000
10017
Input_1
SCIF_ICMP
40150
Steppointr
SCIF_CONTR
40101
ICMP_raw
SCIF_ICMP
40100
ICMP_mode
SCIF_ICMP
BLKM
#0001
00129
Seq_start
SCIF_CONTR
0001 #000
00131
Next_step
SCIF_CONTR
0002 #000
00132
Compare_OK
SCIF_CONTR
0003 #000
SCIF
#0016
40150
Steppointr
SCIF_CONTR
40301
DRUMmasked
SCIF_DRUM
40300
DRUM_mode
SCIF_DRUM
00001
Output_1
SCIF
#0016
00130
Last_step
SCIF_CONTR
0003 #000
330
Sequential
Control
Instructions
00132
Compare_OK
BLKM
#0001
00130
Last_step
Chapter 17
The Checksum
Instruction
Several PLCs that do not support Modbus Plus come with a standard
checksum (CKSM) instruction. CKSM has the same opcode as the
MSTR instruction and is not provided in executive firmwares for PLCs
that support Modbus Plus.
The Checksum
Instruction
331
17.1
CKSM
The CKSM (checksum) instruction provides you with the ability to
program four types checksum calculations in ladder logic:
V
Straight check
The checksum algorithms handle both 8-bit and 16-bit data. If 8 bits
are used, the high-order byte in the register must be 0.
17.1.1
Characteristics
Size
Standard in most PLCs that do not support Modbus PlusExceptions: the 984A, 984B, and 984X Chassis Mount PLCs
Opcode
BF hex
332
The Checksum
Instruction
17.1.2
Representation
Block Structure
Initiates checksum calculation
of source table
Calculation successful
source
cksm select 1
result /
count
cksm select 2
CKSM
length
implied
implied
register
register
count
count
> length or
=0
Inputs
CKSM has three control inputs. The states of the inputs indicate the
type of checksum calculation to be performed:
CKSM Calculation
Top Input
Middle
Input
Bottom
Straight Check
ON
OFF
ON
ON
ON
ON
CRC-16
ON
ON
OFF
LRC
ON
OFF
OFF
Input
Ouputs
CKSM can produce one of two possible outputs. The output from the
top node goes ON when the checksum calculation is completed. The
output from the bottom node goes ON if the an illegal implied register
count is detected.
Top Node Content
The 4x register entered in the top node is the
the source table. The checksum calculation is
Instruction
333
Bottom
Node Content
The integer value entered in the bottom node specifies the length i.e.,
the number of 4x registersin the source table. The length is in the
range 1 ... 255.
334
The Checksum
Instruction
Chapter 18
The Modbus
Instruction
Plus Master
MSTR Overview
Read
W rite Global
Data
MSTR Operation
Read Global
Data
MSTR Operation
Get Remote
Clear Remote
Reset Option
Read CTE
W rite CTE
MSTR Operation
Statistics
Statistics
Module
MSTR Operation
MSTR Operation
The Modbus
Plus Master
Instruction
335
18.1
MSTR Overview
PLCs that support networking communications capabilities over
Modbus Plus and Ethernet have a special MSTR (master) instruction
with which nodes on the network can initiate message transactions.
The MSTR instruction allows you to initiate one of 12 possible network
communications operations over the network. Each operation is
designated by a code. Certain MSTR operations are supported on some
networks and not on others:
MSTR Operation
Code
Modbus
Plus
TCP/IP
Net
Ether-
SY/MAX
Ethernet
Write data
Read data
not supported
not supported
not supported
not supported
not supported
not supported
not supported
not supported
not supported
x
x
not supported
10
not supported
11
not supported
12
not supported
Characteristics
Size
336
The Modbus
Plus Master
Instruction
Opcode
BF hex
18.1.2
Representation
Block Structure
Enables selected
MSTR operation
control
block
Operation is active
Terminates active
MSTR operation
data
area
Operation terminated
unsuccessfully
MSTR
length
Operation successful
Inputs
MSTR has two control inputs. The input to the top node enables the
instruction when it is ON. The input to the middle node terminates the
active operation when it is ON
Outputs
MSTR can produce three possible outputs. The output from the top
node echoes the state of the top inputi.e., it goes ON while the
instruction is active. The output from the middle node echoes the state
of the middle inputi.e., it goes ON if the the MSTR operation is
terminated prior to completion. The output from the bottom node goes
ON when an MSTR operation has been completed successfully.
Top Node Content
The 4x register entered
Plus
Register
Content
Displayed
First implied
Second implied
Third implied
The Modbus
Plus Master
Instruction
337
Fourth implied
destination
address
1 ... 64
indicating
destination
a second
MBP port
address
x
1 ... 64
For two S985-000 cards in a 984 PLC with built-in Modbus Plus,
a value of 2 in the high byte indicates that the MSTR instruction
is destined for the second S985 cards assigned buffer space:
high byte
indicating
destination
a second
MBP port
Quantum
address
x
Automation
1 ... 64
Series PLCs
high byte
0
indicating
338
The Modbus
Plus Master
0
physical
Instruction
destination
1
location
address
x
1 ... 64
Fifth implied
Sixth implied
Seventh implied
Eighth implied
Ninth implied
not applicable
Tenth implied
not applicable
Eleventh implied
not applicable
Control
EtherNet
Register
Content
Displayed
First implied
Second implied
Third implied
Fourth implied
Fifth implied
Sixth implied
Seventh implied
Eighth implied
Control
EtherNet
Register
Content
Displayed
First implied
Second implied
Third implied
Fourth implied
Fifth implied
Sixth implied
The Modbus
Plus Master
Instruction
339
Node Content
The integer value entered in the bottom node specifies the length i.e.,
the maximum number of registersin the data area . The length must
be in the range 1 ... 100.
340
The Modbus
Plus Master
Instruction
18.2
MSTR Function
Error Codes
Modbus
EtherNet
Error Codes
The form of the function error code for Modbus Plus and SY/MAX
EtherNet transactions is Mmss , where
V
ss
represents a subcode
Meaning
1001
2001
2002
One or more control block parameter has been changed while the MSTR
element is active (applies only to operations that take multiple scans to
complete) Control block parameters may be changed only when the
MSTR element is not active
2003
2004
2005
Invalid values in the length and offset fields of the control block
2006
2007
2008
2009
200A
30ss*
4001
5001
6mss**
Routing failure
Meaning
01
02
03
04
The Modbus
Plus Master
Instruction
341
05
06
07
08 ... 255
** The m subfield in error code 6mss is an index into the routing information indicating where an
error has been detecteda value of 0 indicates the local node, a 2 the second device on the
route, etc. The ss subfield in error code 6mss is:
ss Hex Value
Meaning
01
No response received
02
03
04
05
06
07
08
10
20
40
80
F001
18.2.2
SY/MAX specific
Error Codes
342
The Modbus
Meaning
7101
7103
7109
710F
7110
7111
Plus Master
Instruction
7113
711D
7149
714B
7201
7203
7209
720F
7210
7211
7213
721D
7249
724B
7301
7303
7309
731D
734B
The Modbus
Plus Master
Instruction
343
18.2.3
TCP/IP
EtherNet
Error Codes
Meaning
1001
2001
2002
One or more control block parameter has been changed while the MSTR
element is active (applies only to operations that take multiple scans to
complete) Control block parameters may be changed only when the
MSTR element is not active
2003
2004
2005
Invalid values in the length and offset fields of the control block
2006
3000
30ss*
4001
Meaning
01
02
03
04
05
06
07
An error on the TCP/IP EtherNet network itself may produce one of the
following errors in the MSTR control block :
344
The Modbus
Meaning
5004
5005
I/O error
5006
No such address
5009
500C
500D
Permission denied
5011
Entry exists
5016
An argument is invalid
5017
5020
5023
5024
Plus Master
Instruction
5025
The socket is nonblocking and a previous connection attempt has not yet
completed
5026
5027
5028
5029
502A
502B
502C
502D
502E
502F
5030
5031
5032
Network is down
5033
Network is unreachable
5034
5035
5036
5037
5038
5039
503A
503B
503C
503D
5040
Host is down
5041
5042
5046
NI_INIT returned 1
5047
5048
5049
504A
504B
The Modbus
Plus Master
Instruction
345
18.2.4
for SY/MAX
and TCP/IP
EtherNet
The following error codes are returned if there is a problem with the
EtherNet configuration extension table (CTE) in your program
configuration.
346
The Modbus
Meaning
7001
7002
7003
7004
7005
Plus Master
Instruction
18.3
18.3.1
Network
Implementation
18.3.2
Control
Block Utilization
Plus
Register
Function
Content
Displayed
Operation type
1 = Write; 2 = Read
First implied
Error status
Second implied
Length
Third implied
Slave device
data area
Routing 1 ... 5
Designates the first ... fifth routing path addresses, respectively; the last nonzero byte in
the routing path is the destination device
The Modbus
Plus Master
Instruction
347
Control
EtherNet
Register
Function
Content
Displayed
Operation
type
1 = Write; 2 = Read
First implied
Error status
Exception
code + 3000
4001
Read/Write
Second implied
Length
Third implied
Slave device
data area
Fourth implied
Low byte
Destination
Control
EtherNet
Register
Function
Content
Displayed
Operation type
1 = Write; 2 = Read
First implied
Error status
Second implied
Length
Third implied
Slave device
data area
Fourth implied
Slot ID
Terminator
348
The Modbus
Plus Master
Instruction
FF hex
18.4
MSTR Operation
Network
Implementation
18.4.2
See page 367 for the listing of available Modbus Plus network
statistics
See page 18.15 for the listing of TCP/IP EtherNet network statistics
Control
Block Utilization
Control
Plus
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Length
Third implied
Offset
Fourth implied
Routing 1
Note:
The Modbus
Plus Master
Instruction
349
Control
350
The Modbus
EtherNet
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Length
Third implied
Offset
Fourth implied
Slot ID
Not applicable
Plus Master
Instruction
18.5
MSTR Operation
The Clear local statistics operation clears statistics relative to the local
nodewhere the MSTR has been programmed. This operation takes
one scan to complete and does not require a data master transaction
path.
18.5.1
Network
Implementation
18.5.2
See page 367 for the listing of available Modbus Plus network
statistics
Control
Block Utilization
Plus
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Not applicable
Third implied
Fourth implied
Routing 1
Note:
The Modbus
Plus Master
Instruction
351
Control
EtherNet
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Not applicable
Third implied
352
The Modbus
Fourth implied
Slot ID
Not applicable
Plus Master
Instruction
18.6
W rite Global
Network
Implementation
The Write global data operation (type 5 in the displayed register of the
top node) can be implemented only for Modbus Plus networks.
18.6.2
Control
Block Utilization
The registers in the MSTR control block (the top node) are used in a
Write global data operation:
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Length
Third implied
Not applicable
Fourth implied
Routing 1
The Modbus
Plus Master
Instruction
353
18.7
Read Global
The Read global data operation gets data from the communications
processor in any node on the local network link that is providing global
data. This operation may require multiple scans to complete if global
data is not currently available from the requested node. If global data
is available, the operation completes in a single scan. No master
transaction path is required.
18.7.1
Network
Implementation
The Read global data operation (type 6 in the displayed register of the
top node) can be implemented only for Modbus Plus networks.
18.7.2
Control
Block Utilization
The registers in the MSTR control block (the top node) are used in a
Read global data operation:
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Length
Third implied
Available words
Fourth implied
Routing 1
354
The Modbus
Plus Master
Instruction
18.8
Get Remote
Statistics
MSTR Operation
Network
Implementation
18.8.2
Control
Block Utilization
Plus
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Length
Third implied
Offset
Routing 1 ... 5
Designates the first ... fifth routing path addresses, respectively; the last nonzero byte
in the routing path is the destination device
The remote comm processor always returns its complete statistics table
when a request is made, even if the request is for less than the full
840 USE 101 00
The Modbus
Plus Master
Instruction
355
table. The MSTR instruction then copies only the amount of words you
have requested to the designated 4x registers.
Control
356
The Modbus
EtherNet
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Length
Third implied
Offset
Fourth implied
Low byte
Destination
Plus Master
Instruction
18.9
Clear Remote
Statistics
MSTR Operation
Network
Implementation
Control
Block Utilization
Plus
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Not applicable
Third implied
Fourth ... eighth implied
Routing 1 ... 5
Designates the first ... fifth routing path addresses, respectively; the last nonzero byte in
the routing path is the destination device
Note:
You need to understand Modbus Plus routing path procedures
before programming an MSTR block. A full discussion of routing path
structures is given in Modbus Plus Network Planning and Installation
Guide .
The Modbus
Plus Master
Instruction
357
Control
EtherNet
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Not applicable
Third implied
Fifth ... Eighth implied
358
The Modbus
Plus Master
Destination
Instruction
18.10
MSTR Operation
The peer cop health operation reads selected data from the peer cop
communications health table and loads that data to specified 4x
registers in state RAM. The peer cop communications health table is 12
words long, and the words are indexed via this MSTR operation as
words 0 ... 11.
18.10.1
Network
Implementation
Control
Block Utilization
The registers in the MSTR control block (the top node) contain the
following information in a Peer cop health operation:
Register
Function
Content
Displayed
Operation type
First implied
Error status
Second implied
Data Size
Third implied
Index
Fourth implied
Routing 1
18.10.3
Health
Status
Information
The Modbus
Plus Master
Instruction
359
The bits in words 0 ... 3 represent the health of the global input
communication expected from nodes 1 ... 64. The bits in words 4 ... 7
represent the health of the output from a specific node. The bits in
words 8 ... 11 represent the health of the input to a specific node:
Type of
Status
Global
Input
W ord
Index
16 15
32
48 47 46 45 44 43
64
14 13 12 11 10
31 30 29 28
63 62
27 26 25 24 23
42 41
61 60 59 58
22 21
20 19 18 17
40 39 38 37 36 35 34
33
57 56 55 54 53 52 51 50 49
16 15
32 31 30 29 28 27 26 25 24
23 22 21 20 19 18 17
48 47 46 45 44 43 42
39
7
Specific
Input
Node Relationship
3
Specific
Output
Bit-to-Network
14 13 12 11 10
41 40
64 63 62 61 60 59 58 57 56
38 37 36 35 34
55 54 53 52 51 50
33
49
16 15
32 31 30 29 28
27 26 25 24 23 22 21 20 19 18 17
10
48 47
43 42 41 40 39
11
64
14 13 12 11 10
46 45 44
63 62 61 60 59 58
38 37 36 35 34 33
57 56 55 54 53 52 51 50
49
The state of a peer cop health bit reflects the current communication
status of its associated node. A health bit is set when its associated
node accepts inputs for its peer copped input data group or hears that
another node has accepted specific output data from the its peer copped
output data group. A health bit is cleared when no communication has
occurred for its associated data group within the configured peer cop
health time-out period.
360
The Modbus
Plus Master
Instruction
All health bits are cleared when the Put Peer Cop interface command is
executed at PLC start-up time. Table values are not valid until at least
one full token rotation cycle has been completed after execution of the
Put Peer Cop interface command. The health bit for a given node is
always zero when its associated peer cop entry is null.
The Modbus
Plus Master
Instruction
361
18.1 1
Reset Option
Module
MSTR Operation
Network
Implementation
Control
Block Utilization
EtherNet
Register
Function
Content
Displayed
Operation type
10
First implied
Error status
Second implied
Not applicable
Third implied
Fourth implied
Slot ID
Not applicable
Control
EtherNet
Register
Function
Content
Displayed
Operation type
10
First implied
Error status
Second implied
Not applicable
Third implied
362
The Modbus
Fourth implied
Slot ID
Not applicable
Plus Master
Instruction
18.12
Extension
Table) MSTR
The Read CTE operation reads a given number of bytes from the
Ethernet configuration extension table to the indicated buffer in PLC
memory. The bytes to be read begin at a byte offset from the beginning
of the CTE. The content of the EtherNet CTE table is displayed in the
middle node of the MSTR block.
18.12.1
Network
Implementation
The Read CTE operation (type 11 in the displayed register of the top
node) can be implemented for TCP/IP and SY/MAX Ethernet networks,
accessed via the appropriate network adapter. Modbus Plus networks
do not use this operation.
18.12.2
Control
Block Utilization
In a Read CTE operation, the registers in the MSTR control block (the
top node) differ according to the network in use:
Control
EtherNet
Register
Function
Content
Displayed
Operation type
11
First implied
Error status
Second implied
Not applicable
Third implied
Fourth implied
Map index
Slot ID
Not applicable
The Modbus
Plus Master
Instruction
363
Control
Function
Content
Displayed
Operation type
11
First implied
Error status
Second implied
Data Size
Third implied
Base Address
Fourth implied
High byte
Low byte
18.12.3
EtherNet
Register
CTE Display
Not applicable
Implementation
Register
Content
Frame type
Displayed
1 = 802.3
IP address
First implied
Second implied
Third implied
2 = EtherNet
364
The Modbus
Fourth implied
Subnetwork
mask
Fifth implied
Hi word
Sixth implied
Low word
Gateway
Seventh implied
Eighth implied
Ninth implied
Tenth implied
Plus Master
Instruction
18.13
Extension
Table) MSTR
The Write CTE operation reads an indicated number of bytes from PLC
memory, starting at a specified byte address, to an indicated Ethernet
configuration extension table at a specified offset. The content of the
EtherNet CTE table is displayed in the middle node of the MSTR block.
18.13.1
Network
Implementation
The Write CTE operation (type 12 in the displayed register of the top
node) can be implemented for TCP/IP and SY/MAX Ethernet networks,
via the appropriate network adapter. Modbus Plus networks do not use
this operation.
18.13.2
Control
Block Utilization
In a Read CTE operation, the registers in the MSTR control block (the
top node) differ according to the network in use:
Control
EtherNet
Register
Function
Content
Displayed
Operation type
12
First implied
Error status
Second implied
Not applicable
Third implied
Fourth implied
Map index
Slot ID
Not applicable
The Modbus
Plus Master
Instruction
365
Control
18.13.3
EtherNet
Register
Function
Content
Displayed
Operation type
12
First implied
Error status
Second implied
Data Size
Third implied
Base Address
Fourth implied
High byte
Low byte
Fifth implied
Terminator
FF hex
Not applicable
CTE Display
Implementation
Register
Content
Frame type
Displayed
1 = 802.3
2 = EtherNet
IP address
366
The Modbus
First implied
Second implied
Third implied
Fourth implied
Subnetwork
mask
Fifth implied
Hi word
Sixth implied
Low word
Gateway
Seventh implied
Eighth implied
Ninth implied
Tenth implied
Plus Master
Instruction
18.14
Modbus
Plus Network
Statistics
The following table shows the statistics available on the Modbus Plus
network. You may acquire this information by using the appropriate
MSTR operation or by using Modbus function code 8.
When you issue the Clear local or Clear remote statistics
operations, only words 13 ... 22 are cleared.
Note:
W ord
Bits
00
01
Meaning
Node type ID
0
PLC node
0 ... 11
12 ... 14
Reserved
15
The Modbus
Plus Master
Instruction
367
03
Power up state
Idle state
10
04
Peer status (LED code); provides status of this unit relative to the
network:
0
32
64
96
Sole station
128
05
Token pass counter; increments each time this station gets the
token
06
07
08
09
HI
LO
HI
LO
HI
HI
11
LO
HI
LO
HI
LO
HI
LO
HI
13
14
The Modbus
LO
10
12
368
Duplicate station
Plus Master
Instruction
15
HI
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
The Modbus
Plus Master
Instruction
369
31
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
42
LO
HI
43
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
32
33
34
35
36
37
38
39
40
41
44
45
46
47
48
370
The Modbus
Plus Master
Instruction
49
50
51
52
53
LO
HI
LO
HI
LO
HI
LO
HI
LO
HI
The Modbus
Plus Master
Instruction
371
18.15
TCP/IP
Ethernet
Statistics
372
The Modbus
W ord
Meaning
00 ... 02
MAC address
03
Board Status
04 and 05
06 and 07
08 and 09
10 and 11
12 and 13
Missed packets
14 and 15
Memory error
16 and 17
18 and 19
20 and 21
22 and 23
24 and 25
26 and 27
28 and 29
Late collision
30 and 31
Lost carrier
32 and 33
Number of retries
34 and 35
IP address
Plus Master
Instruction
Chapter 19
Ladder Logic Subroutines
Subroutine Overview
JSR
LAB
RET
A Subroutine Example
CTIF
Ladder
Logic Subroutines
373
19.1
Subroutine
Overview
In the Quantum PLCs and in several 984 PLCs, the JSR instruction
(section 19.2) can be used to issue a call from the scheduled flow of
ladder logic to a subroutine in the last (unscheduled) logic segment.
Two additional instructions within the subroutine segment itself are
used to mark the beginning and end of each subroutine. The LAB
function (section 19.3) labels the starting point of the subroutine. The
RET instruction (section 19.4) returns you from the subroutine network
to the position in scheduled logic where the JSR call was issued.
19.1.1
19.1.2
Where
to Store Subroutines
in Ladder
Logic
All ladder logic subroutines must be built in the last segment of user
logic. This segment must be removed from the segment schedulerit is
not part of the regular order-of-solve table and is reserved for
subroutine and interrupt handling (Chapter 20) logic.
This means that you must specify at least one more segment
than is required for regular user logic in the configuration table.
Note:
374
Ladder
Logic Subroutines
19.2
JSR
When the logic scan encounters an enabled JSR instruction, it stops the
normal logic scan and jumps to the specified source subroutine in the
last (unscheduled) segment of ladder logic.
You can use a JSR instruction anywhere in user logic, even within the
subroutine segment. The process of calling one subroutine from another
subroutine is called nesting . The system allows you to nest up to 100
subroutines however, we recommend that you use no more than three
nesting levels. You may also perform a recursive form of nesting called
looping , whereby a JSR call within the subroutine recalls the same
subroutine.
19.2.1
Characteristics
Size
Opcode
DE
19.2.2
Representation
in Ladder
Logic
Block Structure
Enables the source subroutine
source
JSR
????
Input
The input to the top node enables the source subroutine specified by the
number in the top node.
Ladder
Logic Subroutines
375
Output
JSR has two outputs. The output from the top node echoes the state of
the top input. The output from the bottom node goes ON to indicate an
error in the subroutine jump.
Top Node Content
The top node contains the source pointer, the indicator of the
subroutine to which the logic scan will jump. The source may be:
specified as:
V
Bottom
Node Content
376
Ladder
Logic Subroutines
19.3
LAB
The LAB instruction is used to label the starting point of a subroutine
or an interrupt handler. This instruction must be programmed in row 1,
column 1 of a network in the subroutine segment (the last, unscheduled
segment of ladder logic). LAB is a one-node function block.
LAB also serves as a default return from the subroutine or interrupt
handler in the preceding networks. If the PLC is executing a series of
subroutine or interrupt handler networks and it reaches a network that
begins with LAB instruction, it assumes that the previous subroutine
or interrupt handler is finished, and it returns the logic scan to the
scheduled logic.
19.3.1
Characteristics
Size
Opcode
BE hex
19.3.2
Representation
in Ladder
Logic
Block Structure
Initiates the specified subroutine
LAB
subroutine
number
Error
Input
The input to the top node initiates the subroutine or interrupt handler
specified by the number in the bottom node.
Ladder
Logic Subroutines
377
Outputs
The output from the top node goes ON to indicate an error in the
initiation of the specified subroutine or interrupt handler.
Node Content
The integer value entered in the node identifies the subroutine (or
interrupt handler) number you are about to execute. The value can
range from 1 ... 255 for a PLC with a 16-bit CPU or 1 ... 1023 for a PLC
with a 24-bit CPU.
If more than one network begins with a LAB instruction with the same
value, the lowest-numbered network is used as the starting
point for the subroutine.
subroutine
378
Ladder
Logic Subroutines
19.4
RET
The RET instruction may be used to conditionally return to scheduled
logic at the node immediately following the most recently executed JSR
block or at the point where the interrupt occurred. This instruction can
be implemented only from within the subroutine segmentthe
(unscheduled) last segment in the user logic program.
Note:
If a subroutine does not contain a RET block, either a LAB
block or the end-of-logic (whichever comes first) serves as the default
return from the subroutine or interrupt handler.
19.4.1
Characteristics
Size
Opcode
FE hex
19.4.2
Representation
in Ladder
Logic
Block Structure
Return to previous logic
RET
00001
Error
Input
When the input to the node is ON, RET returns the logic scan to the
node immediately following the most recently executed JSR instruction
or to the point where the interrupt occurred in the logic scan.
Output
The output from the top node goes ON to indicate an error in the
specified subroutine or interrupt handler.
Node Content
Ladder
Logic Subroutines
379
19.5
A Subroutine
Example
The example below shows a series of three user logic networks, the last
of which is used for an up-counting subroutine. Segment 3 has been
removed from the order-of-solve table in the segment scheduler:
Scheduled
Segment
Logic Flow
001
Network 00001
Subroutine
Segment
Segment
003
Network 00001
LAB
Network 00002
00001
10001
JSR
00001
00001
40256
40256
00001
40256
ADD
40256
RET
00001
SUB
40256
40256
00010
SUB
40999
Segment
00001
JSR
00001
002
Network 00001
380
Ladder
Logic Subroutines
The subroutine will internally loop on itself ten times, counted by the
ADD block. The first nine loops end with the JSR block in the
subroutine (network 1 of segment 3) sending the scan back to the LAB
block. Upon completion of the tenth loop, the RET block sends the logic
scan back to the scheduled logic at the JSR node in network 2 of
segment 1.
Ladder
Logic Subroutines
381
19.6
CTIF
The CTIF instruction is used with the Micro PLCs to set up the inputs
for hard-wired interrupt and/or hard-wired counter/timer operations.
This instruction always starts and finishes in the same scan.
The CTIF instruction is a configuration/operation tool for Modicon
Micro PLCs that contain hardware interrupts (all models except the
110CPU311 Models). The actual counter/timer and interrupts are
located in the PLC hardware, and the CTIF instruction is what is used
to set up this hardware.
The illustrations below show how the configuration
with the interrupt functions.
Pre-assigned
Subroutine
INT 1 enable
Hardwire INT 1
interact
switches
LAB 2
Hardwire INT 2
(DC models only)
LAB 3
INT 3 enable
User-selectable
Hardwire Interrupt
LAB 4
OR
TMR/CNTR enable
Timer / counter
TMR /
CTR
LAB 1
(see Note 2)
382
Ladder
Note 1.
Note 2.
Logic Subroutines
19.6.1
Input Type
CPU A vailability
User-selectable timer/
counter interrupt
Subroutine
Subroutine #1
Hardwire interrupt 1
10082updated once/
scan;
10085updated at the
start of each subroutine
Subroutine #2
Hardwire interrupt 2
10083updated once/
scan;
10086updated at the
start of each subroutine
Subroutine #3
User-selectable interrupt 3
10081updated once/
scan;
10084updated at the
start of each subroutine
Subroutine #4
Characteristics
Size
Opcode
1F hex
19.6.2
Representation
in Ladder
Logic
Block Structure
parameter
block
CTIF
drop
number
Ladder
Logic Subroutines
383
Register
Content
Displayed
Error/Operation Type:
Set Mode 0 0
Get Mode 0 1
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
First implied
10
11
12
13 14
15
16
No error detected
Unsupported operation type specified
Interrupt 2 not supported in this model
Interrupt 3 not supported while counter is selected
Counter value of 0 specified
Counter value too big ( > 16,383 )
Operation type supported only on local drop
Specified drop not in I/O Map
No subroutine for enabled interrupt
Remote drop is unhealthy
Function not supported remotely
Control set-up for Set Mode operation:
Counter Mode = 0 1
Timer Mode = 1 0
Terminal-count loading:
0 Disable
Stop counter/timer operation = 0 1
1 Enable
Start counter/timer operation = 1 0
1
9 10 11 12 13 14 15 16
0 1 = Disable auto-restart operation
1 0 = Enable auto-restart operation
0 1 = Disable interrupt service for timer/counter input
1 0 = Enable interrupt service for timer/counter input
0 1 = Disable interrupt service for Int 1
1 0 = Enable interrupt service for Int 1
384
Ladder
Logic Subroutines
Second implied
10
11
12
13
14
15
16
0 = Int 2 disabled
1 = Int 2 enabled
0 = Int 3 disabled
1 = Int 3 enabled
No subroutine for timer/counter interrupt
No subroutine for Int1 interrupt
No subroutine for Int2 interrupt
No subroutine for Int3 interrupt
Third implied
Bottom
Current count value of the timer/counter input (set by the instruction block as the current count in Get Mode; set by the user to
the counter/timer preset in Set Mode)
Node Content
The integer value entered in the bottom node indicates the drop
number where the operation will be performed. The drop number is in
the range 1 ... 5.
Ladder
Logic Subroutines
385
19.7
Some Cautionary
Subroutines
Notes About
Caution:
W e strongly recommend
that you do not control
real-world
outputs from within a ladder logic subroutine.
Control of such coils would be possible only when the
subroutine
was executed.
386
Ladder
Logic Subroutines
Chapter 20
Ladder Logic Interrupt
Handling for Quantum
Overview
Ladder
Logic Interrupt
PLCs
Handling
387
20.1
Overview
The following instructions are designed for a variety of functions known
generally as fast I/O updating. They fall into four categories:
V
Note:
20.1.1
Interrupt-related
Performance
Latency
T imes
ITMR overhead
No work to do
60 ms/ms
Response time
Minimum
98 ms
400 ms
155 ms
Instructions
that Cannot
Be Used in an Interrupt
Handler
Ladder
Logic Interrupt
Handling
MSTR
READ/WRIT
PCFL/EMTH
Equation Networks
T1.0/T0.1/T.01 timers (will not set error bit 2, timer results invalid)
Ladder
Logic Interrupt
Handling
389
20.2
Interval
T imer Interrupt
(ITMR)
Instruction
Characteristics
Size
Opcode
4516
390
Ladder
Logic Interrupt
Handling
20.2.2
Representation
in Ladder
Logic
Block Structure
Enable
control
block
ITRM
timer
number
Error
Input
Outputs
ITRM has two outputs. The output from the top node echoes the state
of the top input.
The output from the bottom node goes ON when an error occurs. The
source of the error may be in the programmed parameters or a runtime
execution error.
Top Node Content
The top node contains the the first of three contiguous 4x registers in
the ITRM control block . These registers are used to specify the
parameters required to program each ITRM instruction.
Ladder
Logic Interrupt
Handling
391
The lower eight bits of the first (displayed) register in the control block
allow you to specify function control parameters, and the upper eight
bits are used to display function status:
Function Status
Function Control
10
11
12
13 14
15
16
0 = instruction disabled
1 = instruction enabled
0 = Enable OFF resets counter
1 = Enable OFF holds counter
Note:
Bottom
Node Content
In the bottom node, specify a value in the range 1 ... 16, indicating the
timer number assigned to this ITMR instruction. The number entered
here must be unique with respect to all other ITMR instructions in the
application.
392
Ladder
Logic Interrupt
Handling
20.3
Interrupt
Mask/Unmask
Instructions
Ladder
Logic Interrupt
Handling
393
20.3.1
ID Characteristics
Size
Opcode
4716
Block Structure
Enable
ID
Type
Input
Enter a constant integer in the range 1 ... 3 in the node. The value
represents the type of interrupt to be masked by the ID instruction,
where:
Integer
394
Ladder
Value
Interrupt
Type
Logic Interrupt
Handling
20.3.2
IE Characteristics
Size
Opcode
4816
Block Structure
Enable
IE
Type
Input
Enter a constant integer in the range 1 ... 3 in the node. The value
represents the type of interrupt to be unmasked by the IE instruction,
where:
Integer
Value
Interrupt
Type
Ladder
Logic Interrupt
Handling
395
20.3.3
BMDI Characteristics
Size
Opcode
4916
Block Structure
ON masks interrupt and
initiates a block move
source
table
Input
BMDI has one control input (to the top node). This input masks the
interrupt, initiates a block move (BLKM) operation, then unmasks the
interrupts.
Output
BMDI produces one output (from the top node), which echoes the state
of the top input.
Top Node Content
The top node specifies the source table that will have its contents copied
in the block move. The node may reference:
396
Ladder
Logic Interrupt
Handling
The middle node specifies the destination table where the contents of
the source table will be copied in the block move. The node may
reference:
V
Bottom
Node Content
The integer value entered in the bottom node specifies the table
size i.e., the number of registersin the source and destination tables;
they are of equal length. The table length is in the range 1 ... 100.
Ladder
Logic Interrupt
Handling
397
20.4
Immediate
Characteristics
Size
Opcode
BB16
Block Structure
Enable immediate access
control
block
IMIO
type
Error
Input
IMIO has one control input (to the top node) that enables the
immediate I/O access when it is ON.
Output
IMIO produces two outputs. The output from the top node echoes the
state of the top input. The output from the bottom node goes ON when
the instruction reports an error. The nature of the error is indicated by
a code in the error status register in the IMIO control block , which is
described below.
398
Ladder
Logic Interrupt
Handling
in
The high byte of the displayed register in the control block allows you
to specify which rack the I/O module to be accessed resides in, and the
low byte allow you to specify slot number within the specified rack
where the I/O module resides.
Rack Number
Slot Number
10
11
0 0 1 = rack 1
0 1 0 = rack 2*
0 1 1 = rack 3*
1 0 0 = rack 4*
* Only rack 1 is currently supported
12
13 14
15
16
0 0 0 0 1 = slot 1
0 0 0 1 0 = slot 2
0 0 0 1 1 = slot 3
0 0 1 0 0 = slot 4
0 0 1 0 1 = slot 5
0 0 1 1 0 = slot 6
0 0 1 1 1 = slot 7
0 1 0 0 0 = slot 8
0 1 0 0 1 = slot 9
0 1 0 1 0 = slot 10
0 1 0 1 1 = slot 11
0 1 1 0 0 = slot 12
0 1 1 0 1 = slot 13
0 1 1 1 0 = slot 14
0 1 1 1 1 = slot 15
1 0 0 0 0 = slot 16
The implied register in the control block will contain an error code
when the instruction detects an error. This register is maintained by
the IMIO instruction.
Error Code
Meaning
2001
2002
2003
F001
Ladder
Logic Interrupt
Handling
399
20.4.1.1
Bottom
Node Content
Enter a constant integer in the range 1 ... 3 in the bottom node. The
value represents the type of operation to be performed by the IMIO
instruction, where:
Integer
400
Ladder
Value
Type of Immediate
Access
Logic Interrupt
Handling
Chapter 21
Closed Loop Control
Instructions
Closed
Loop Control
Instructions
401
21.1
A Closed
Loop Control
System
An analog closed loop control system is one in which the deviation from
an ideal process condition is measured, analyzed, and adjusted in an
attempt to obtain (and maintain) zero error in the process condition.
Provided with the Enhanced Instruction Set is a
proportional-integral-derivative function block called PID2, which
allows you to establish closed loop (or negative feedback ) control in
ladder logic.
21.1.1
Variable
The desired (zero error) control point, which you will define in the PID2
block, is called the set point (SP). The conditional measurement taken
against SP is called the process variable (PV). The difference between
the SP and the PV is the deviation or error (E). E is fed into a control
calculation that produces a manipulated variable (Mv) used to adjust
the process so that PV = SP (and, therefore, E = 0).
Control
End Device
PV
Process
Process
Transmitter
Mv
(Output)
402
Closed
Loop Control
Instructions
Control
Calculation
PV (Input)
E
SP
21.2
PID2
The PID2 instruction implements an algorithm that performs
proportional-integral-derivative operations. The algorithm tunes the
closed loop operation in a manner similar to traditional pneumatic and
analog electronic loop controllers. It uses a rate gain limiting (RGL)
filter on the PV as it is used for the derivative term only, thereby
filtering out higher-frequency PV noise sources (random and process
generated).
xn 1
(4y + 6) 8
PV
DPv
RGL
xn
+
Dx
4x 13
SP
Derivative
Contribution
(4y + 6) 8
60(RGL 1)K3
RGL Ts
+
(4x 1
(4x 11
Zn
4x 2)
4x 12)
x 4095
xn
Proportional
Contribution
100
PB
GE
+
+
Bias
4x 8
Integral
Feedback
Mn 1 F
loc
4x16
M
Tloc
4x 20
+
Preload
Mode
Qn
Integral
Clamp
Wn
+
Integral
Contribution
In
4x 17
4x 18
Mn
4x 2
DI
K2 Ts
600000
In 1
In 1
Output
Clamp
In
In
4y + 3, + 4, + 5
where:
E = error, expressed in raw analog units
SP = set point, in the range 0 ... 4095
PV = process variable, in the range 0 ... 4095
x = filtered PV
840 USE 101 00
Closed
Loop Control
Instructions
403
of a
minute
RGL = rate gain limiting filter constant, in the range 2 ... 30
Ts = solution time, expressed in hundredths of a second
PB = proportional band, in the range 5 ... 500%
bias = loop output bias factor, in the range 0 ... 4095
M = loop output
GE = gross error, the proportional-derivative contribution to the loop
output
Z = derivative mode contribution to GE
Q n = unbiased loop output
F = feedback value, in the range 0 ... 4095
I = integral mode contribution to the loop output
Ilo w = anti-reset-windup low SP, in the range 0 ... 4095
Ih ig h = anti-reset-windup high SP, in the range 0 ... 4095
= 100
K1
PB
Note:
The integral mode contribution calculation actually integrates
the difference of the output and the integral sumthis is effectively
the same as integrating the error.
Proportional
Control
404
Closed
Loop Control
Instructions
Proportional-Integral
Control
Mv = K1(E + K2
EDt)
Control
Mv = K1(E + K2
EDt + K3
DPV
)
Dt
Characteristics
Size
Standard in all PLC types except the 984A/B/X Chassis Mounts, where
it is available as a loadable
Opcode
5E hex
Closed
Loop Control
Instructions
405
21.2.2
Representation
Block Structure
0 = Manual mode
1 = Auto mode
0 = Integral preload OFF
1 = Integral preload ON
0 = Output increases as E increases
1 = Output decreases as E increases
source
destination
PID2
solution
interval
Inputs
PID2 has three control inputs. The state of the input to the top node
determines whether the operation will be initiated automatically or
manually. The state of the input to the middle node indicates whether
or not an integral preload is used. The state of the input to the bottom
node indicates whether the output from the operation will increase or
decrease as the error increases.
Outputs
Fifth Implied
Sixth Implied
ON
PI
ON
ON
PID
ON
ON
Seventh
Implied
Eighth
Implied
ON
ON
Name
Content
Displayed
Scaled PV
406
Closed
Loop Control
Instructions
4x 13
4095
x (4x 11
4x 12) + 4x 12
First implied
SP
Second implied
Mv
Third implied
Fourth implied
Fifth implied
Proportional Band
Sixth implied
Reset Time
Constant
Load this register to add integral action to the calculation; enter a value between 0000 ... 9999 to
represent a range of 00.00 ... 99.99 repeats/min;
the larger the number, the larger the integral contribution; a value > 9999 stops the PID2 calculation
Seventh implied
Rate Time
Constant
Eighth implied
Bias
Ninth implied
High Integral Wind- Load this register with the upper limit of the output
up Limit
value (between 0 ... 4095) where the anti-reset
windup takes effect; the updating of the integral
sum is stopped if it goes above this valuethis is
normally 4095
10th implied
11th implied
High Engineering
Range
12th implied
Low Engineering
Range
Closed
Loop Control
Instructions
407
13th implied
14th implied
Pointer to Loop
Counter Register
The value you load in this register points to the register that counts the number of loops solved in each
scan; the entry is determined by discarding the
most significant digit in the register where the controller will count the loops solved/scane.g., if the
PLC does the count in register 41236, load 1236
into the 14th implied register; the same value must
be loaded into the 14th implied register in every
PID2 block in the logic program
15th implied
Maximum Number
of Loops
Solved In a Scan: If the 14th implied register contains a non-zero value, you may load a value in this
register to limit the number of loops to be solved in
one scan
16th implied
Pointer To Reset
Feedback Input:
17th implied
Output Clamp
High
18th implied
Output Clamp
Low
19th implied
20th implied
Pointer to Integral
Preload
The value entered in this register points to the holding register containing the track input (T) value;
drop the 4 from the tracking register and enter the
remaining four digits in this register; the value in the
T register is connected to the input of the integral
lag whenever the auto bit and integral preload bit
are both true
408
Closed
Register
Name
Content
Displayed
Twelve of the 16 bits in this register are used to define loop status:
Loop Control
Instructions
10
11
12
13
14
15
16
Rev B or higher
Sign of E in 4y + 7:
(0 = + and 1 = )
4x 14 Register Referenced by 4x 15 is Valid
Loop in AUTO mode but not being solved
Wind-down Mode (for Rev. B or higher)
Loop in AUTO mode and time since last solution solution interval
Bottom Output Status (Low Alarm)
Middle Output Status (High Alarm)
Top Output Status (Node Lockout or Parameter Error)
Note:
Bit 16 is set after initial startup or installation of the loop. If
you clear the bit, the following actions take place in one scan:
The current value in the real-time clock is stored in the first implied register
Register
Name
Content
First implied
Error (E) Status Bits This register displays PID2 error codes:
Code
Explanation
0000
None
0001
First implied
0002
Third implied
0003
Fourth implied
Closed
Loop Control
Instructions
409
0004
Fifth implied
0005
Fifth implied
0006
Sixth implied
0007
Seventh implied
0008
Eighth implied
0009
Ninth implied
0010
10th implied
0011
11th implied
0012
12th implied
0013
0014
0015
0016*
15th implied
0017
16th implied
0018
17th implied
0019
18th implied
0020
0021
RGL below 2
19th implied
0022
RGL above 30
19th implied
0023**
0024**
0025*
None
If lockout occurs often and the parameters are all valid, increase the
maximum number of loops/scan. Lockout may also occur if the counting registers in use are not cleared as required.
NOTE:
0026*
0027
**
410
Closed
Loop Control
Instructions
Register
Name
Content
Second implied
Third implied
Fourth implied
Integralfraction 1 (1/3,000)
Fifth implied
Integralfraction 2 (1/600,000)
Sixth implied
Pv x 8 (Filtered)
Seventh implied
Absolute Value of
E
This register, which is updated after each loop solution, contains the absolute value of (SP PV); bit 8
in register 4y + 1 indicates the sign of E
Eighth implied
Bottom
Node Content
The bottom node indicates that this is a PID2 function and contains a
number ranging from 1 ... 255, indicating how often the function should
be performed. The number represents a time value in tenths of a
secondfor example, the number 17 indicates that the PID function
should be performed every 1.7 s.
21.2.3
Example
Closed
Loop Control
Instructions
41 1
Vent
Blowdown
Inlet Vent
Plant
Inlet
FCV
Inlet Block
LT
1
LSH
1
LC
1
Gas
PV 1
LSL
1
LV
I/P
1
FC
Condensate
The liquid is dumped from the tank to maintain a constant level. The
control objective is to maintain a constant level in the separator. The
phases must be separated before processing; separation is the role of
the inlet separator, PV 1. If the level controller, LC 1, fails to perform
its job, the inlet separator could fill, causing liquids to get into the gas
stream; this could severely damage devices such as gas compressors.
The level is controlled by device LC 1, a 984 controller connected to an
analog input module; I/P 1 is connected to an analog output module.
We can implement the control loop with the following 984 ladder logic:
412
Closed
Loop Control
Instructions
40102
30001
0
0
SUB
SUB
40500
40113
40100
00101
( )
40200
00102
( )
PID2
00030
00103
The first SUB block is used to move the analog input from LT 1 to the
PID2 analog input register, 40113. The second SUB block is used to
move the PID2 output Mv to the traffic copped output I/P 1. Coil 00101
is used to change the loop from AUTO to MANUAL mode, if desired.
For AUTO mode, it should be ON.
Specify the set point in mm for input scaling (E.U.). The full input
range will be 0 ... 4000 mm (for 0 ... 4095 raw analog). Specify the
register content of the top node in the PID2 block as follows:
Register
Content
Numeric
40100
Comments
Meaning
Scaled PV (mm)
40101
2000
Scaled SP (mm)
40102
0000
40103
3500
40104
1000
40105
0100
PB (%)
40106
0500
40107
0000
40108
0000
40109
4095
40110
0000
Closed
Loop Control
Instructions
413
Register
Content
Comments
Numeric
Meaning
40111
4000
40112
0000
40113
40114
0000
40115
0000
40116
0102
40117
4095
40118
0000
40119
0015
Normally set to about 15. The actual value depends on how noisy the
input signal is. Since we are not using derivative mode, this has no effect on PID2
40120
0000
The values in the registers in the 40200 destination block are all set by
the PID2 block.
414
Closed
Loop Control
Instructions
21.3
PCFL
The PCFL instruction gives you access to a library of process control
functions utilizing analog values. PCFL operations fall into three major
categories:
V
Advanced calculations
Signal processing
Regulatory control
Characteristics
Size
Opcode
7B hex
Closed
Loop Control
Instructions
415
21.3.2
Representation
Block Structure
Enables specified process
control function
function
Operation successful
parameter
block
PCFL
length
Error
Input
PCFL has one control input (to the top node), which enables the
specifies process control operation when it is ON.
Outputs
PCFL produces one of two possible outputs (from the top or bottom
node). Power is passed to the output from the top node if the process
control operation completes successfully. Power is passed to the output
from the bottom node if an error is encountered in the process control
operation.
Top Node Content
Signal
416
Closed
Loop Control
Calcula-
Processing
Instructions
Indicator
Description
PLCs Supported
AVER
CALC
EQN
ALARM
AIN
AOUT
DELAY
LKUP
Look-up table
INTEG
Regulatory
Control
LLAG
LIMIT
LIMV
MODE
RAMP
RMPLN
RATE
SEL
High/low/average input
selection
KPID
ONOFF
PID
PID algorithms*
PI
ISA non-interacting PI
(with halt/manual/auto operation features)*
RATIO
TOTAL
Time-dependent operations.
Node Content
The integer value entered in the bottom node specifies the length i.e.,
the number of registersof the PCFL parameter block . The maximum
allowable length will vary depending on the function you specify.
21.3.3
Flags
Within the parameter block of each PCFL function are two registers
used for input and output status.
840 USE 101 00
Closed
Loop Control
Instructions
417
Output
Flags
In all PCFL functions, bits 12 ... 16 of the output status register define
the following standard output flags:
1
10
11
12
13 14
15
16
10
11
12
13
14
15 16
1 = Initialization working
1 = Illegal solution interval
Input Flags
In all PCFL functions, bits 1 and 3 of the input status register define
the following standard input flags:
1
10
11
12
13 14
15
16
1 = Timer override
1 = Function initialization complete or in progress
0 = Initialize the function
418
Closed
Loop Control
Instructions
21.4
PCFL Advanced
Calculations
AVER
The AVER function calculates the average of up to four weighted
inputs, via the following formula:
result
(k + (w 1 x In 1 ) + (w 2 x In 2 ) + (w 3 x In 3 ) + (w 4 x In 4 ))
1 + w1 + w2 + w3 + w4
where
w 1 ... w 4 are the weights
In 1 ... In 4 are the inputs
k is a constant
Block Structure
Enables specified process
control function
AVER
Operation successful
parameter
block
PCFL
Error
24
Parameter
Block Assignment
block
Closed
is 24 registers:
Loop Control
Instructions
419
Register
Content
reserved
Second implied
Output status:
Standard outputs
9 10 11 12 13 14
15
16
1 = no inputs activated
0 = result positive
1 = result negative
Input status:
Third implied
Standard inputs
1
9 10 11 12 13 14 15 16
1 = k is active
1 = In 1 and w 1 are used
Value of In 1
Value of In 2
Value of In 3
Value of In 4
Value of k
Value of w 1
Value of w 2
Value of w 3
Value of w 4
Value of result
CALC
The CALC function calculates a preset formula with up to four inputs,
each characterized in a separate register of the parameter block .
420
Closed
Loop Control
Instructions
Block Structure
Enables specified process
control function
CALC
Operation successful
parameter
block
PCFL
Error
14
block
following assignments:
Register
Content
reserved
Second implied
Output status:
Standard outputs
9 10
11 12
13 14
15
16
15
16
Third implied
Standard inputs
1
10
11
12
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
1 = (A * B ) + (C * D )
0 = (A * B ) (C * D )
1 = (A * B ) / (C *D )
0 = A / (B * C * D )
1 = (A * B * C ) / D
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0=A
1=A
0=A
1=A
0=A
1=A
Value of input A
Value of input B
Value of input C
Value of input D
Closed
14
*B *C *D
+B +C +D
* B (C
D)
[ (B / C ) D ]
* LN(B / C )
B ) (C
D ) / LN[ (A
1 1 0 0 = (A / B ) C / D
1 1 0 1 = (A
B ) / (C
13
Loop Control
B)
/ (C
D)
D)
Instructions
421
21.4.3
EQN
The EQN function is a formatted equation calculator. You must define
the equation in the parameter block with various codes that specify
operators, input selection, and inputs.
EQN is used for equations that have four or fewer variables but do not
fit into the CALC format. It complements the CALC function by letting
you input an equation with floating point and integer inputs as well as
operators.
Block Structure
Enables specified process
control function
EQN
Operation successful
parameter
block
PCFL
Error
15 ... 64
block
Register
Content
reserved
Second implied
Output status:
Code of last error logged
Standard outputs
8
9 10
11 12
13 14
15 16
Stack error
1 = bad operator selection code
1 = EQN not fully programmed
1 = bad input code chosen
Third implied
Input status:
Equation size
for display in Modsoft
Standard inputs
1
10 11 12 13
14 15 16
422
Closed
Variable A
Variable B
Variable C
Variable D
Loop Control
Instructions
Output
14th implied
15th implied
...
...
63rd implied
6
0
0
0
1
1
1
1
7
0
0
0
0
0
0
0
0
0
1
0
0
1
1
8
0
1
1
0
1
0
1
=
=
=
=
=
=
=
10
11
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
12
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
13
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
14
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
15 16
Closed
A
B
C
D
Loop Control
Instructions
423
21.5
PCFL Signal
Processing
Functions
ALARM
The ALARM function gives you a central block for alarm handling
where you can set high (H), low (L), high high (HH), and low low (LL)
limits on a process variable. ALARM lets you specify:
V
Normal
Operating
Mode
Operating
Mode
Closed
Loop Control
Instructions
Block Structure
Enables specified process
control function
ALARM
Operation successful
parameter
block
Error
PCFL
16
Parameter
Block Assignment
Content
Input registers
Second implied
Output status:
block
is 16 registers:
9 10 11 12
13 14 15
16
Input status:
2
Standard input
bits
10 11
12
13 14 15
16
HH limit value
H limit value
L limit value
LL limit value
last input
Closed
Loop Control
Instructions
425
21.5.2
AIN
The AIN function scales the raw input produced by analog input
modules to engineering values that can be used in the subsequent
calculations. Three scaling options are available:
V
Type
Resolution
Valid
4096 Normal
0 ... 4,096
Elevated
8192 Normal
0 ... 8,192
Offset
0 ... 6,000
0x C000
0x 8000
Unipolar
0 ... 7,500
0x C000
0x 8000
Bipolar
0 ... 15,000
0x C000
0x 8000
Scaled decimal
0 ... 10,000
0x C000
0x 8000
Quantum
10 V
767
64,769
Engineering
5 V
16,767
48,769
Ranges
0 ... 10 V
0 ... 64,000
0 ... 5 V
0 ... 32,000
1 ... 5 V
984 PLCs
426
Closed
Quantum
TC degrees
Thermocouple
TC 0.1 degrees
4,096
4,096
8,192
8,192
64,001
32,001
6,399
32,001
Quantum
10 V
10,000 ...
+10,000
Voltmeter
5 V
0 ... 10 V
0 ... 10,000
0 ... 5 V
0 ... 5,000
1 ... 5 V
Instructions
Over
TC Raw Units
Loop Control
Under
10,001
+10,001
5,001
+5,001
10,001
5,001
999
5,001
Block Structure
Enables specified process
control function
AIN
Operation successful
parameter
block
Error
PCFL
14
block
is 14 registers:
Register
Content
Displayed
First implied
Second implied
Output status:
Standard output bits
10 11
12 13 14 15 16
Closed
Loop Control
Instructions
427
Third implied
Input status:
984
Ranges
Quantum
Ranges
Quantum
10 11
12
13 14 15 16
0 0 0 0 0 = 1 ... 4,096
0 0 0 0 1 = 4,096 ... 8,192
0 0 0 1 0 = 1 ... 8,191
0 0 0 1 1 = 1 ... 5,999
0 0 1 0 0 = 1 ... 7,499
0 0 1 0 1 = 1 ... 9,999
0 0 1 1 0 = 1 ... 14,999
0 1 0 0 0 = 10 V
0 1 0 0 1 = 5 V
0 1 0 1 0 = 0 ... 10 V
0 1 0 1 1 = 0 ... 5 V
0 1 1 0 0 = 1 ... 5 V
Engineering
0 1 1 0 1 = TC degrees
0 1 1 1 0 = TC 0.1 degrees
0 1 1 1 1 = TC raw units
Thermocouple
Quantum
Voltmeter
1 0 0 0 0 = 10 V
1 0 0 1 0 = 5 V
1 0 1 0 0 = 0 ... 10 V
1 0 1 1 0 = 0 ... 5 V
1 1 0 0 0 = 1 ... 5 V
Manual input
Auto input
Output
21.5.3
AOUT
The AOUT function is an interface for calculated signals for output
modules. It converts the signal to a value in the range 0 ... 4,096, using
the formula:
output =
428
Closed
Loop Control
scale
x (input
(high engineering
Instructions
low engineering
unit
unit
low engineering
)
unit
)
840 USE 101 00
Block Structure
Enables specified process
control function
AOUT
Operation successful
parameter
block
Error
PCFL
Parameter
Block Assignment
block
is nine registers:
Register
Content
Second implied
Output status:
Standard output bits
9 10 11 12 13
14
15 16
Input status:
1
9 10
11 12 13 14
15 16
21.5.4
Eighth implied
Output
DELA Y
The DELAY function can be used to build a series of readings for
time-delay compensation in the logic. Up to 10 sampling instances can
be used to delay an input.
All values are carried along in registers, where register x [0] contains
the current sampled input. The 10th delay period does not need to be
stored. When the 10th instance in the sequence takes place, the value
in register x [9] can be moved directly to the output.
Closed
Loop Control
Instructions
429
DELAY
Operation successful
parameter
block
Error
PCFL
32
Parameter
Block Assignment
block
is 32 registers:
Register
Content
Input at time n
Second implied
Output status:
Standard output bits
10 11 12 13 14 15 16
Input status:
1
9 10 11 12 13 14 15 16
Time delay 10
Standard input bits
Fourth implied
Time register
Fifth implied
Sixth and seventh implied
x [0]
delay
x [1]
delay
x [2]
delay
...
430
Closed
...
x [9]
Output registers
Loop Control
Instructions
delay
21.5.5
LKUP
The LKUP function establishes a look-up table using a linear algorithm
to interpolate between points. LKUP can handle variable point
intervals and variable numbers of points.
If the input (x ) is outside the specified range of points, the output (y ) is
clamped to the corresponding output y 0 or yn . If the specified
parameter block length is too small or if the number of points is out of
range, the function does not check the xn because the information from
that pointer is invalid.
Points to be interpolated are determined by a binary search algorithm
starting near the center of x data. The search is valid for x 1 < x < xn .
The variable x may occur multiple times with the same valuethe
value chosen from the look-up table is the first instance found. For
example, if the table is:
x
10.0
1.0
20.0
2.0
30.0
3.0
30.0
3.5
40.0
4.0
then an input of 30.0 finds the first instance of 30.0 and assigns 3.0 as
the output. An input of 31.0 would assign the value 3.55 as the output.
No sorting is done on the contents of the look-up table. Independent
variable table values should be entered in ascending order to prevent
unreachable gaps in the table.
The function returns a DXDONE message when the operation is
complete.
Block Structure
Enables specified process
control function
LKUP
Operation successful
parameter
block
Error
PCFL
39
Closed
Loop Control
Instructions
431
is 39 registers:
block
Register
Content
Input
Second implied
Output status:
Standard output bits
10 11
12
13 14 15 16
Input status:
1
1
0
11 12 13 14 15 16
Point x 1
Point y 1
Point x 2
Point y 2
...
21.5.6
...
Point x 8
Point y 8
Output
INTEG
The INTEG function is used to integrate over a specified time interval.
No protection against integral wind-up is provided in this function.
INTEG is time-dependente.g., if you are integrating at an input
value of 1/sec, it matters whether it operates over one second (in which
case the result is 1) or over one minute (in which case the result is 60).
You can set flags to either initialize or restart the function after an
undetermined down-time, and you can reset the integral sum if you
wish. If you set the initialize flag, you must specify a reset value (zero
or the last output in case of power failure), and calculations will be
skipped for one sample.
The function returns a DXDONE message when the operation is
complete.
432
Closed
Loop Control
Instructions
Block Structure
Enables specified process
control function
INTEG
Operation successful
parameter
block
Error
PCFL
16
is 16 registers:
block
Register
Content
Current input
Second implied
Output status:
Standard output bits
Third implied
1
10 11 12 13 14 15 16
Input status:
2
9 10
11 12 13 14 15 16
Reset sum
Standard input bits
Fourth implied
Time register
Fifth implied
21.5.7
Last input
Reset value
Result
LLAG
The LLAG function provides dynamic compensation for a known
disturbance. It usually appears in a feed-forward algorithm or as a
dynamic filter. LLAG passes the input through a filter comprising a
lead term (a numerator) and a lag term (a denominator) in the
frequency domain, then multiplies it by a gain. Lead, lag, gain, and
solution interval must be user-specified.
For best results, use lead and lag terms that are 4 *nt. This will
ensure sufficient granularity in the output response.
Closed
Loop Control
Instructions
433
LLAG
Operation successful
parameter
block
Error
PCFL
20
Parameter
Block Assignment
block
is 20 registers:
Register
Content
Current input
Second implied
Output status:
Standard output bits
Third implied
1
9 10 11
12
13 14 15
16
Input status:
2
10 11 12 13 14 15 16
Time register
Fifth implied
21.5.8
Last input
Lead term
Lag term
Filter gain
Result
LIMIT
The LIMIT function limits the input to a range between a specified
high and low value. If the high or low limit is reached, the function
sets an H or L flag and clamps the output.
LIMIT returns a DXDONE message when the operation is complete.
434
Closed
Loop Control
Instructions
Block Structure
Enables specified process
control function
LIMIT
Operation successful
parameter
block
Error
PCFL
block
is nine registers:
Register
Content
Input register
Second implied
Output status:
Standard output bits
10 11 12 13 14 15 16
Input status:
1
10 11 12
13 14 15
16
21.5.9
Low limit
High limit
Output register
LIMV
The LIMV function limits the velocity of change in the input variable
between a specified high and low value. If the high or low limit is
reached, the function sets an H or L flag and clamps the output.
LIMV returns a DXDONE message when the operation is complete.
Closed
Loop Control
Instructions
435
Block Structure
Enables specified process
control function
LIMV
Operation successful
parameter
block
PCFL
Error
14
block
is 14 registers:
Register
Content
Input register
Second implied
Output status:
Standard output bits
9 10 11 12 13
14 15 16
Input status:
1
10 11 12 13 14 15 16
Time register
Fifth implied
21.5.10
Result
MODE
The MODE function sets up a manual or automatic station for enabling
and disabling data transfers to the next block. The function acts like a
BLKM instruction (see page 192), moving a value to the output
register.
In auto mode, the input is copied to the output. In manual mode, the
output is overwritten by a user entry.
436
Closed
Loop Control
Instructions
MODE
Operation successful
parameter
block
Error
PCFL
block
is eight registers:
Register
Content
Input
Second implied
Output status:
Standard output bits
10 11 12 13 14 15 16
Echo mode
1 = manual mode
0 = auto mode
Third implied
1
Input status:
2
10 11
12 13 14
15 16
1 = manual mode
0 = auto mode
Standard input bits
Manual input
Output register
Closed
Loop Control
Instructions
437
21.5.1 1
RAMP
The RAMP function allows you to ramp up linearly to a target set point
at a specified approach rate. You need to specify:
V
The target set point, in the same units as the contents of the input register are specified
A positive rate toward the target set pointnegative rates are illegal
RAMP
Operation successful
parameter
block
PCFL
14
438
Closed
Error
block
is 14 registers:
Register
Content
Second implied
Output status:
Loop Control
Instructions
9 10 11 12 13 14 15 16
1 = ramping up
1 = ramping down
1 = ramp complete
0 = ramp in progress
1 = ramp rate is negative
Input status:
Third implied
1
10
11 12 13 14 15
16
Fourth implied
Fifth implied
21.5.12
Output
RMPLN
The RMPLN function allows you to ramp up logarithmically to a target
set point at a specified approach rate. At each successive call, it
calculates the output until it is within a specified deadband (DB). DB is
necessary because the incremental distance the ramp crosses decreases
with each solve.
You need to specify:
V
The target set point, in the same units as the contents of the input register are specified
The time constant used for the logarithmic ramp, which is the
time it takes to reach 63.2% of the new set point
For best results, use a that is 4 *nt. This will ensure sufficient
granularity in the output response.
You may use a flag to initialize after an undetermined down-time. The
function will store a new sample, then wait for one cycle to collect the
840 USE 101 00
Closed
Loop Control
Instructions
439
second sample. Calculations will be skipped for one cycle and the
output will be left as is, after which the ramp will resume.
RMPLN terminates when the input reaches the target set point + the
specified DB and returns a DXDONE message.
Block Structure
Enables specified process
control function
RMPLN
Operation successful
parameter
block
Error
PCFL
16
block
Register
Content
Second implied
Output status:
is 16 registers:
10 11 12 13 14
15
16
1 = ramping up
1 = ramping down
1 = ramp complete
0 = ramp in progress
1 = DB or t set to negative number
Third implied
Input status:
10 11 12 13 14
15 16
Time register
Fifth implied
440
Closed
Output
Loop Control
Instructions
21.5.13
RA TE
The RATE function calculates the rate of change over the last two input
values. If you set an initialization flag, the function records a sample
and sets the appropriate flags.
If a divide-by-zero operation is attempted, the function returns a
DXERROR message.
It returns a DXDONE message when the operation completes
successfully.
Block Structure
Enables specified process
control function
RATE
Operation successful
parameter
block
Error
PCFL
14
is 14 registers:
block
Register
Content
Current input
Second implied
Output status:
Standard output bits
Third implied
10 11
12
13 14 15
16
Input status:
1
9 10
11 12 13 14 15 16
Time register
Fifth implied
Last input
Result
Closed
Loop Control
Instructions
441
21.5.14
SEL
The SEL function compares up to four inputs and makes a selection
based upon either the highest, lowest, or average value. You choose the
inputs to be compared and the comparison criterion. The output is a
copy of the selected input.
SEL returns a DXDONE message when the operation is complete.
Block Structure
Enables specified process
control function
SEL
Operation successful
parameter
block
Error
PCFL
14
can be up to 14 registers:
block
Register
Content
Output status:
Standard output bits
10 11 12
13 14 15
16
Input status:
0 0 = select average
0 1 = select high
1 0 = select low
1 1 = reserved/invalid
10 11 12 13 14 15 16
1 = enable input 4
0 = disable input 4
1 = enable input 3
0 = disable input 3
1 = enable input 2
0 = disable input 2
1 = enable input 1
0 = disable input 1
442
Closed
Loop Control
Instructions
Input 1
Input 2
Input 3
Input 4
Output
Closed
Loop Control
Instructions
443
21.6
PCFL Regulatory
Functions
21.6.1
General
Y
Y
Equations
= YP + YI +YD + Bias
= YP + YD + Bias + BT
integral bit ON
integral bit OFF
Y Y lo w
with
.....YP , YI , YD = f(XD )
XD = SP
X (GRZ
XD = SP
X
Proportional
YP = KP
YP = 0
Integral
YI
YI
Closed
Loop Control
KGRZ
))
Calculation
* XD
proportional bit ON
Calculation
= YI + KP *
nt
*
TI
XD_1
+ XD
2
integral bit ON
=0
Derivative Calculation
DXD = X_1
X
DXD = XD
XD_1
444
* (1
Instructions
base derivative or PV
YD
YD
=0
where:
Y = manipulated variable output
YP = proportional part of the calculation
Y I = integral part of the calculation
YD = derivative part of the calculation
Bias = constant added to input
BT = bumpless transfer register
SP = set point
KP = proportional gain
Closed
Loop Control
Instructions
445
21.6.2
KPID
The KPID function offers a superset of the functionality of the PID
function, with additional features that include:
V
A reset mode
Block Structure
Enables specified process
control function
KPID
Operation successful
parameter
block
PCFL
64
446
Closed
Loop Control
Instructions
Error
block
is 64 registers:
Register
Content
Live input, x
Second implied
10
11
12 13 14 15
16
9 10
11 12 13 14 15 16
10 11
12 13 14
15 16
1 = reset mode
1 = manual mode
1 = halt mode
1 = cascade mode
1 = solve proportional algorithm
1 = solve integral algorithm
1 = solve derivative algorithm
1 = solve derivative algorithm based on x
0 = solve derivative algorithm based on xd
0 = normal anti-reset wind-up
1 = anti-reset wind-up on YI only
0 = bumpless transfer
1 = disable bumpless transfer
1 = manual Y tracks Y
1 = reverse action for loop output
0 = direct action for loop output
Closed
Loop Control
Instructions
447
Input Parameters
Inputs
Outputs
Reset time, TI
Manual Y
Reset for Y
Bias
42nd implied
Set point, SP
57th implied
T iming
58th implied
10 ms clock at time n
Information
59th implied
Output
21.6.3
ONOFF
The ONOFF function is used to control the output signal between fully
ON and fully OFF conditions so that a user can manually force the
output ON or OFF. You can control the output via either a direct or
reverse configuration:
V
448
Closed
Loop Control
Instructions
Manual
Override
Two bits in the input status register (the third implied register in the
parameter block ) are used for manual override. When bit 6 is set to 1,
manual mode is enforced. In manual mode, a 0 in bit 7 forces the
output OFF, and a 1 in bit 7 forces the output ON. The state of bit 7 has
meaning only in manual mode.
Block Structure
Enables specified process
control function
ONOFF
Operation successful
parameter
block
Error
PCFL
14
block
is 14 registers:
Register
Content
Current input
Second implied
Output status:
Standard output bits
10 11
12 13 14 15 16
Input status:
Standard input bits
10 11
12 13 14
15 16
Closed
Loop Control
Instructions
449
21.6.4
Set point, SP
Output, ON or OFF
PID
The PID function performs ISA non-interacting
proportional-integral-derivative (PID) operations using floating point
math. Because it uses FP math (unlike PID2), round-off errors are
negligible.
Block Structure
Enables specified process
control function
PID
Operation successful
parameter
block
PCFL
44
450
Closed
Loop Control
Instructions
Error
block
is 44 registers:
Register
Content
Live input, X
Second implied
Output flags:
Standard output bits
10 11 12 13 14 15 16
Error word
10
11
12 13 14
15 16
Input flags:
Standard input bits
10 11 12 13 14 15 16
1 = manual mode
1 = halt mode
1 = solve proportional algorithm
1 = solve integral algorithm
1 = solve derivative algorithm
1 = solve derivative algorithm based on x
0 = solve derivative algorithm based on xd
1 = reverse action for loop output
0 = direct action for loop output
Inputs
Outputs
Manual output
Error, XD
14th implied
27th implied
Closed
Loop Control
Instructions
451
28th implied
T iming
Information
Inputs
Outputs
21.6.5
Current time
29th implied
30th and 31st implied
Proportional gain, KP
Reset time, TI
A PID Example
This example illustrates how a typical PID loop could be configured
using PCFL function 75. The calculation begins with the AIN function,
which takes raw input simulated to cause the output to run between
approximately 20 and 22 when the engineering unit scale is set to
0 ... 100.
The process variable over time should look something like this:
452
Closed
Loop Control
Instructions
20
Time
Logic
The AIN output is block moved to the LKUP function, which is used to
scale the input signal. We do this because the input sensor is not likely
to produce highly linear readings; the result is an ideal linear signal:
7 Points Defined
In Look Up table
*
100
*
80
*
60
50
Linearized Signal
40
20
Actual Input
20 40 50 60 80 100
Input
The look-up table output is block moved to the PID function. RAMP is
used to control the rise (or fall) of the set point for the PID controller
with regard to the rate of ramp and the solution interval. In this
example, the set point is established in another logic section to
simulate a remote setting. The MODE function is placed after the
RAMP so that we can switch between the RAMP-generated set point or
a manual value.
Simulated
Process
Closed
Loop Control
Instructions
453
(4S + 1) (4S + 1) e 5S
(10S + 1) (10S + 1)
The PID controller is tuned to control this process at 20.0, using the
Ziegler-Nichols tuning method. The resulting controller gain is 2.16,
equivalent to a proportional band of 46.3%.
454
Closed
Loop Control
Instructions
The integral time is set at 12.5 s/repeat (4.8 repeats/ min). The
derivative time is initially 3 s, then reduced to 0.3 s to de emphasize
the derivative effect.
An AOUT function is used after the PID. It conditions the PID control
output by scaling the signal back to an integer for use as the control
value.
The entire control loop is preceded by a 0.1 s timer. The target solution
interval for the entire loop is 1 s, and the full solve is 1 s. However, the
nontime-dependent functions that are used (AIN, LKUP, MODE, and
AOUT) do not need to be solved every scan. To reduce the scan time
impact, these functions are scheduled to solve less frequently. The
example has a loop solve every 3 s, reducing the average scan time
dramatically.
It is still important to be aware of the maximum scan impact.
When programming other loops, you will not want all of the loops to
solve on the same scan.
Note:
21.6.6
PI
The PI function performs a simple proportional-integral operations
using floating point math. It features halt/manual/auto operation
modes. It is similar to the PID (page 450) and KPID (page 446)
functions but does not contain as many options. It is available for
higher-speed loops or inner loops in cascade strategies.
Block Structure
Enables specified process
control function
PI
Operation successful
parameter
block
Error
PCFL
36
Closed
Loop Control
Instructions
455
block
is 36 registers:
Register
Content
Live input, X
Second implied
Output status:
Standard output bits
10 11 12 13 14 15 16
Error word
2
9 10 11 12 13
14 15 16
Input flags:
Standard input bits
1 = manual mode
1 = halt mode
Manual output
12th implied
21st implied
T iming
22nd implied
10 ms clock at time n
Information
23rd implied
Outputs
Input Parameters
Output
Closed
10 11 12 13 14 15 16
Inputs
456
Loop Control
Proportional rate, KP
Reset time, TI
Instructions
21.6.7
RA TIO
The RATIO function provides a four-station ratio controller. Ratio
control can be used in applications where one or more raw ingredients
are dependent on a primary ingredient. The primary ingredient is
measured, and the measurement is converted to engineering units via
an AIN function (see page 426). The converted value is used to set the
target for the other ratioed inputs.
Outputs from the ratio controller can provide set points for other
controllers. They can also be used in an open loop structure for
applications where feedback is not required.
Block Structure
Enables specified process
control function
RATIO
Operation successful
parameter
block
Error
PCFL
20
block
is 20 registers:
Register
Content
Live input
Second implied
Output status:
Standard output bits
9 10 11 12
13 14
15 16
Input status:
10
11 12
13 14 15
16
1 = input 1 active
1 = input 2 active
1 = input 3 active
1 = input 4 active
Closed
Loop Control
Instructions
457
21.6.8
TOT AL
The TOTAL function provides a material totalizer for batch processing
reagents. The input signal contains the units of weight or volume per
unit of time. The totalizer integrates the input over time. The
algorithm reports three outputs:
V
The function uses up to three different set pointsa trickle flow set
point, a target set point, and an auxiliary trickle flow set point. The
target set point is for the full amount to be metered in. Here the output
will be turned OFF.
The trickle flow set point is the cut-off point when the output should be
decreased from full flow to a percentage of full flow so that the target
set point is reached with better granularity.
The auxiliary trickle flow set point is optional. It is used to gain
another level of granularity. If this set point is enabled, the output is
reduced further to 10% of the trickle output.
The totalizer works from zero as a base point. The set point must be a
positive value.
In normal operation, the valve output is set to 100% flow when the
integrated value is below the trickle flow set point. When the sum
crosses the trickle flow set point, the valve flow becomes a
programmable percentage of full flow. When the sum reaches the
desired target set point, the valve output is set to 0% flow.
458
Closed
Loop Control
Instructions
Set points can be relative or absolute. With a relative set point, the
deviation between the last summation and the set point is used.
Otherwise, the summation is used in absolute comparison to the set
point.
There is a halt option to stop the system from integrating.
When the operation has finished, the output summation is retained for
future use. You have the option of clearing this sum. In some
applications, it is important to save the sume.g., if the meters or load
cells cannot handle the full batch in one charge and measurements are
split up, if there are several tanks to fill for a batch and you want to
keep track of batch and production sums.
Block Structure
Enables specified process
control function
TOTAL
Operation successful
parameter
block
Error
PCFL
28
Closed
block
is 28 registers:
Loop Control
Instructions
459
Register
Content
Live input
Second implied
Output status:
Standard output bits
0 0 = OFF
0 1 = trickle flow
1 0 = full flow
10 11 12 13
14 15 16
Third implied
Input status:
Standard input bits
10 11
12 13
14 15 16
Time register
Fifth implied
460
Closed
Reset value
Full flow
Remaining amount to SP
Resulting sum
Loop Control
Instructions
Chapter 22
Loadable Instructions
HSBY
CALL
MBUS
PEER
Custom Loadables
EARS
EUCA
Loadable
Instructions
461
22.1
Loadable
Software
Packages
Loadable
Support
for Controller
Option
Modules
Loadable
Part Number*
Option
HSBY
SW-AP9X-RXA
AM-R911-000
Module
PLCs Supported
chassis mounts
SW-AP98-RXA
AS-S911-800
984-680/685/780/785
slot mounts, host
based
CHS
Quantum
ESI
Quantum
CALL
SW-AP9X-CXB
AM-C986-004
chassis mounts
MBUS/ PEER
SW-AP9X-AXA
AM-S975-100
chassis mounts
SW-AP98-AXA
AM-S975-820
984-685/780/785 slot
mounts, host based
SW-AP9X- MBP
AM-S985-0x 0
chassis mounts
MSTR**
When the X in the above software part numbers is a T, the medium is a P190 tape; when
the
X is a D, the software media are 5.25 in and 3.5 in diskettes.
** The MSTR function that is a loadable for the chassis mount controllers is functionally
identical to the MSTR block provided in firmware for the 984-385/485/685/785 PLCs.
22.1.2
Other Loadable
Functions
Loadable
Part Number*
Software
DRUM/ICMP
SW-SAx 9-001
Sequence control
Capability
SW-AP98-Sx A
PLCs Supported
chassis mounts
slot mounts, host
based
FNxx
SW-AP98-GDA
Custom loadable
Loadables Library**
SW-AP9x -Dx A
includes MATH,
DMTH, TBLK, BLKT,
CKSM, and PID2
chassis mounts
PID2**
SW-AP9x -2x a
chassis mounts
EARS
SW-AP9D-EDA
All PLCs
When the x in the above software part numbers is a T, the medium is a P190 tape; when
the
x is a D, the software media are 5.25 in and 3.5 in diskettes.
** TBLK, BLKT, CKSM, and PID2 are functionally identical to those instructions of the
same name provided in firmware for the 984-385/485/685/785 PLCs.
462
Loadable
Instructions
This chapter describes all the loadable functions that support option
modules except:
The sequence control loadables DRUM and ICMP, which are described in Chapter 16 (see pages 320 and 323, respectively)
The MATH and DMTH instructions, which are described in Chapter 7 (see pages 139 and 143, respectively)
The BLKT and TBLK instructions, which are described in Chapter 9 (see pages 193 and 196, respectively)
Loadable
Instructions
463
22.2
HSBY
The HSBY loadable instruction manages a 984 Hot Standby control
system. This instruction must be placed in network 1 of segment 1 in
the application logic for both the primary and standby controllers. It
allows you to program a nontransfer area in system state RAMan
area that protects a serial group of registers in the standby controller
from being modified by the primary controller.
Through the HSBY instruction you can access two registersa
register and a status registerthat allow you to monitor and
control Hot Standby operations. The status register is the third register
in the nontransfer area you specify.
command
22.2.1
Characteristics
Size
Available as a loadable in all 984 PLC types that support Hot Standby
Does not support Hot Standby in any Quantum PLCs (see the CHS
instruction on page 468)
Opcode
FF hex (default)
22.2.2
Representation
Block Structure
Execute HSBY (unconditionally)
Enable command
Enable nontransfer
464
Loadable
Instructions
register
area
command
register
nontransfer
area
HSBY
length
10
11
12 13 14
15
16
The 4x register entered in the middle node is the first register reserved
for the nontransfer area in state RAM. The first three registers in the
nontransfer area are special registers:
Register
Content
reverse
Second implied
Loadable
Instructions
465
0 1
1 0
1 1
0 1
1 0
1 1
10 11
12 13 14
15 16
The content of the remaining registers is application-specific; the length is defined in the
bottom node.
Bottom
Node Content
The integer value entered in the bottom node defines the length i.e.,
the number of registersof the HSBY nontransfer area in state RAM.
The length must be at least four registers; in the range from 4 ... 255
registers in a 16-bit CPU, and in the range 4 ... 8000 registers in a
24-bit CPU.
22.2.3
An HSBY Reverse
Transfer
Example
The two networks below are for a primary controller that monitors two
fault lamps and a reverse transfer that sends status data from the
standby controller to the primary controller. The first network must be
network 2 of segment 1; the second network must not be in segment 1.
466
Loadable
Instructions
40102
00801
BLKM
00001
40100
00815
00816
ST AT
00001
Network
2, Must be segment
40100
00813
00814
00705
BLKM
00001
( )
00715
00813
00208
00716
00813
00209
( )
Network
The first BLKM function transfers the HSBY status register (40102) to
internal coils, starting at 00801. The STAT instruction, which is
enabled if the other controller is in standby mode, sends one status
register word from the standby controller to a reverse transfer register
(40100) in the primary controller.
Loadable
Instructions
467
22.3
CHS
The logic in the CHS loadable instruction is the engine that drives the
Hot Standby capability in a Quantum PLC system. Unlike the 984
HSBY instruction (page 464), the use of the CHS instruction in the
ladder logic program is optional. However, the loadable software itself
must be installed in the Quantum PLC in order for a Hot Standby
system to be implemented.
22.3.1
How to Configure
a Quantum
Hot Standby
System
Method
1: Hot Standby
System
Configuration
Loadable
Instructions
Method
2: The Modsoft
Configuration
Extension
Screens
Your ability to reduce the amount of state RAM data in the transfer area to a small amount of critical I/O; the minimum amount of
state RAM data that needs to be scheduled for transfer in every
scan is 16 registers of 4x data
CHS Instruction
Characteristics
Size
Loadable
Instructions
469
PLC Compatibility
Available as a loadable in all Quantum PLC types (186, 386, 486, etc.)
that support Hot Standby
Does not support Hot Standby in any non-Quantum PLCs (see the
HSBY instruction on page 464)
Opcode
22.3.3
Representation
Block Structure
Execute Hot Standby
(unconditionally)
Enable command
Enable nontransfer
register
area
command
register
nontransfer
area
CHS
length
Inputs
When the CHS instruction is inserted in ladder logic to control the Hot
Standby configuration parameters, its top node must be connected
directly to the power rail by a horizontal short. No control logic, such as
contacts, should be placed between the rail and the input to the top
node.
The middle node enables the command register. This input must be ON
for the Hot Standby system to be functional.
The bottom input enables the nontransfer area. If this input is OFF, the
nontransfer area will not be used, and the Hot Standby status register
will not exist.
Caution:
Although it is legal to enable and disable the
nontransfer
area while the Hot Standby system is running,
strongly discourage
this practice. It can lead to erratic
behavior in the Hot Standby system.
470
Loadable
Instructions
we
Outputs
The output from the top node goes ON to indicate that the Hot Standby
system is running.
The output from the middle node goes ON if the system detects a
system interface error while the ladder logic is being solved.
The output from the bottom node goes ON when the Hot Standby
system configuration has been set by the Hot Standby configuration
extension capability in Modsoft. The configuration parameters may be
changed during system runtime via the CHS Zoom screen or a Modsoft
reference data editor (RDE); however the original configuration
parameters will be reset if the system is powered down and then
restarted.
Top Node Content
The 4x register entered in the top node is the
register ; eight bits in this register are used to
10
11
12 13 14
15
16
least four registers, the first three of which have a predefined usage:
Loadable
Instructions
471
Register
Content
reverse
Second implied
0 1
1 0
1 1
0 1
1 0
1 1
10 11
12 13 14
15 16
The 4x registers in the nontransfer area are never transferred from the
primary to the standby PLC during the logic scans. One reason for
scheduling additional registers in the nontransfer area is to reduce the
impact of state RAM transfer on the total system scan time.
Bottom
Node Content
The integer value entered in the bottom node defines the length i.e.,
the number of registersof the Hot Standby nontransfer area in state
RAM. The length must be in the range 4 ... 8000 registers.
472
Loadable
Instructions
22.4
CALL
A CALL instruction activates an immediate or deferred DX function
from a library of functions defined by function codes. The Copro copies
the data and function code into its local memory, processes the data,
and copies the results back to Controller memory.
22.4.1
Characteristics
Size
5F hex (default)
22.4.2
Representation
Block Structure
The inputs and outputs are different, depending on whether you call an
immediate DX function or a deferred DX function:
An Immediate
DX CALL
function
code
source
table
A Deferred
CALL
length
DX CALL
function
code
source
table
CALL
length
Loadable
Instructions
473
Inputs
The input to the top node is used to initiate the CALL. The instruction
calls a deferred DX when the input to the middle node is enabled and
an immediate DX when no middle input is programmed. The input to
the bottom node is used with an immediate DX function to keep
scanning the instruction regardless of the state of the top input.
Outputs
The output from the top node goes ON when the function completes
successfully. The output from the middle node, which is used only with
deferred DX functions, goes ON to indicate that the function is in
process. The output from the bottom node will go ON if an error is
detected in the function.
Top Node Content
The top node is used to specify the function code to be executed. It may
be entered explicitly as a constant or as a value in a 4x holding register.
The codes fall into two ranges: 0 ... 499 are for user-definable DXs, and
500 ... 9999 are for system DXs (immediate and deferred) provided by
Modicon:
Immediate
474
Loadable
DX Functions
Name
Code
Function
f_config
500
f_2md_fl
501
f_fl_2md
502
f_4md_fl
503
f_fl_4md
504
f_1md_fl
505
f_fl_1md
506
f_exp
507
Exponential function
f_log
508
Natural logarithm
f_log10
509
Base 10 logarithm
f_pow
510
Raise to a power
f_sqrt
511
Square root
f_cos
512
Cosine
f_sin
513
Sine
f_tan
514
Tangent
f_atan
515
Arc tangent x
f_atan2
516
f_asin
517
Arc sine
f_acos
518
Arc cosine
f_add
519
Add
f_sub
520
Subtract
f_mult
521
Multiply
Instructions
f_div
522
Divide
f_deg_rad
523
f_rad_deg
524
f_swap
525
f_comp
526
f_dbwrite
527
f_dbread
528
Deferred
DX Functions
Name
Code
Function
f_config
500
f_d_dbwr
501
f_d_dbrd
502
f_dgets
515
f_dputs
516
f_sprintf
518
f_sscanf
519
f_egets
520
f_eputs
521
f_ectl
522
Loadable
Instructions
475
22.5
ESI
ESI is an optional loadable instruction that can be used in a Quantum
PLC system to support operations using a 140 ESI 062 10 Quantum
ASCII module. The PLC can use the ESI instruction to invoke the
module. The power of the loadable is its ability to cause a sequence of
commands over one or more logic scans
22.5.1
ESI-Driven
Command
Sequences
Via the ESI instruction, the PLC can invoke the ESI 062 ASCII module
to:
V
Read an ASCII message from a serial port on the ESI 062 module, then perform a sequence of Get Data transfers from the module to the PLC
The ESI 062 is a 12-word bidirectional module. User logic can write or
read up to 12 words to/from the module each time the ESI instruction is
scanned. Information is transferred between the PLC and the module
through a routine data area consisting of a 12-word command structure
and a 12-word response structure. The command structure implements
4x output data, and the response structure uses 3x input data. See
sections 22.5.5 ... 22.5.9 for more details on the command/response
structures.
A non-volatile message table and a block of 16K registers for volatile
variable data reside in the ESI 062 module.
476
Loadable
Instructions
Characteristics
Size
Available as a loadable in all Quantum PLC types (186, 386, 486, etc.)
Not supported in any non-Quantum PLCs
22.5.3
Representation
Block Structure
Enable the subfunction
Abort current message
subfunction
(1 ... 4)
subfunction
parameters
ON = operation done
ESI
length
ON = error detected
Inputs
ESI has two inputs, to the top and middle nodes. When the input to the
top node is powered ON, it enables the ESI instruction and starts
executing the command indicated by the subfunction code in the top
node.
When the input to the middle node is powered ON, an Abort command
is issued. If a message is running when the Abort command is received,
the instruction will complete; if a data transfer is in process when the
Abort command is received, the transfer will stop and the instruction
will complete.
Outputs
ESI has three outputs. The output from the top node echoes the state of
the top input. The output from the middle node goes ON for one scan
when the subfunction operation specified in the top node is completed,
840 USE 101 00
Loadable
Instructions
477
timed out, or aborted. The bottom node goes ON for one scan if an error
has been detected. Error checking is the first thing that is performed on
the instruction when it is enabled, it it is completed before the
subfunction
is executed. For more details on error checking, see section
22.5.4.
Top Node
The top node may contain either a 4x register or an integer. The integer
or the value in the register must be in the range 1 ... 4. It represents
one of four possible subfunction command sequences to be executed by
the instruction:
Subfunction
Command
Sequence
478
Loadable
Register
Parameter
Contents
Displayed
First implied
Second implied
Third implied
Fourth implied
Fifth implied
Sixth implied
Instructions
Seventh implied
The last two registers below are used only when the Read/W rite ASCII Messages
commands are being executed (subfunction
indicated in the top node is 1 or 2)
Eighth implied
Ninth implied
1 or 2
Bottom
Node
The bottom node contains the length of the table in the middle
nodei.e., the number of subfunction parameter registers. For
Read/Write operations, the length must be 10 registers. For Put/Get
operations, the required length is eight registers; 10 may be specified
and the last two registers will be unused.
22.5.4
Error Checking
The command sequence executed by the ESI 062 module (specified by
the subfunction value in the top node of the ESI instruction) needs to
go through a series of error checking routines before the actual
command execution begins. If an error is detected, a message is posted
in the register displayed in the middle node. The following table lists
possible error message codes and their meanings:
Error Code (dec)
Meaning
0001
Unknown subfunction
0010
ESI instruction has timed out (exceeded the time specified in the
eighth register of the subfunction parameter table
0101
0102
0103
0104
1000
length
1001
1002
1003
1004
1005
1101
1102
2001
Loadable
Instructions
479
22.5.5
Command
A Read ASCII command causes the ESI 062 module to read incoming
data from one of its serial ports and store the data in internal variable
data registers. The serial port number is specified in the tenth (ninth
implied) register of the subfunction parameters table. The ASCII
message number to be read is specified in the ninth (eighth implied)
register of the subfunction parameters table. The received data is stored
in the 16K variable data space in user-programmed formats.
When the top node of the ESI instruction is 1, the PLC invokes the
module and causes it to execute one Read ASCII command followed by
a sequence of Get Data commands (transferring up to 16,384 registers
of data) from the module to the PLC.
Read ASCII Message
Command
(hex)
Structure
Meaning
W ord
Content
01PD
xxxx
00xx
3 ... 11
Not used
Response
W ord
Content
01PD
xxxx
00xx
xxxx
Data word 1
xxxx
Data word 2
...
...
...
11
xxxx
A Comparative
(hex)
Structure
Meaning
Data Example
480
Loadable
Instructions
#0001
401000
ESI
#0010
Parameter
Value
401000
nnnn
401001
401002
401003
501
401004
401005
100
401006
401007
600
timeout = 60 s
401008
10
401009
Description
With these parameters entered to the table, the ESI instruction will
handle the read and data transfers automatically in one scan.
The same task could be accomplished in ladder logic without the ESI
loadable, but it would require the following three networks to set up
the command and transfer parameters, then copy the data. Registers
400101 ... 400112 are used as workspace for the output values.
Registers 400201 ... 400212 are initial Read ASCII Message command
values. Registers 400501 ... 400504 are the data space for the received
data from the module.
First Network
( )
000011
000011
000011
400201
400101
400101
400001
BLKM
BLKM
#0012
#0012
Loadable
Instructions
481
Register
Value (hex)
Description
400201
0114
400202
0064
400203
nnnn
...
...
...
400212
nnnn
Network
000011
300001
400088
400098
400098
400098
400101
300002
TEST
400102
400099
TEST
#32768
BLKM
AND
#0001
#0001
300001
400089
400099
400099
BLKM
#0001
#0001
#0001
TEST
#0001
( )
000020
( )
000012
AND
#0001
Register
Value (hex)
Description
400098
nnnn
400099
nnnn
400088
7FFF
400089
8000
Loadable
Instructions
If the ANDed result is not the status word valid bit, coil 000012 is
turned ON indicating that the message is done and that you can start
another command in the module.
Third Network
300012
000020
#0001
( )
000099
TEST
#0001
If coil 000020 is ON, this third network will test the module status
word for busy status. If the module is busy, do nothing. If the module
status word is greater than 1 (busy), a detected error has been logged in
the high byte and coil 000099 will be turned ON. At this point, you
need to determine what the error is using some error-handling logic
that you have developed.
22.5.6
Command
(hex)
Structure
W ord
Content
02PD
Meaning
P
xxxx
00xx
xxxx
Data word 1
xxxx
Data word 2
...
...
...
11
xxxx
Data word 9
Loadable
Instructions
483
22.5.7
Response
(hex)
Structure
W ord
Content
02PD
Meaning
xxxx
00xx
0000
...
...
10
0000
11
xxxx
Get Data
A Get Data command transfers up to 10 registers of data from the ESI
062 module to the PLC each time the ESI instruction is solved in ladder
logic. The total number of words to be read is specified in word 0 of the
Get Data command structure (the data count ). The data is returned in
increments of 10 in words 2 ... 11 in the Get Data response structure.
If a sequence of Get Data commands is being executed in conjunction
with a Read ASCII Message command (via subfunction 1), up to nine
registers are transferred when the instruction is solved the first time.
Additional data are returned in groups of ten registers on subsequent
solves of the instruction until all the data has been transferred.
If there is an error condition to be reported (other than a command
syntax error), it is reported in word 11 in the Get Data response
structure. If the command has requested 10 registers and the error
needs to be reported, only nine registers of data will be returned in
words 2 ... 10, and word 11 will be used for error status.
Get Data Command
484
Loadable
Structure
W ord
Content
030D
xxxx
2 ... 11
Not used
Instructions
(hex)
Meaning
= data count
Structure
W ord
Content
030D
(hex)
Meaning
xxxx
xxxx
Data word 1
xxxx
Data word 2
...
...
...
11
xxxx
22.5.8
4)
Structure
W ord
Content
040D
(hex)
Meaning
D
xxxx
xxxx
Data word 1
xxxx
Data word 2
...
...
...
11
xxxx
Data word 10
= data count
Loadable
Instructions
485
Structure
W ord
Content
040D
(hex)
Meaning
xxxx
0000
...
...
10
0000
11
xxxx
A Comparative
#0008
486
Loadable
Instructions
Register
Parameter
401000
nnnn
Value
401001
401002
401003
501
401004
401005
100
401006
30
401007
timeout = never
401009
Description
With these parameters entered to the table, the ESI instruction will
handle the data transfers automatically over three ESI logic solves.
The same task could be accomplished in ladder logic without the ESI
loadable, but it would require the following four networks to set up the
command and transfer parameters, then copy data multiple times until
the operation is complete. Registers 400101 ... 400112 are used as
workspace for the output values. Registers 400201 ... 400212 are initial
Put Data command values. Registers 400501 ... 400530 are the data
registers to be sent to the module.
First Network
( )
000011
000011
000011
400201
400501
400101
400101
400103
400001
BLKM
BLKM
BLKM
#0012
#0012
#0010
Register
Value (hex)
Description
400201
040A
400202
0064
400203
nnnn
...
...
...
400212
nnnn
Loadable
Instructions
487
the workspace, and then moves the workspace to the output registers
for the module.
Second
Network
( )
000020
000020
300001
000011
000020 400101
TEST
#0001
300002
400102
400102
TEST
#0120
#0001
TEST
#0001
( )
000012
As long as coil 000011 is ON and coil 000020 is OFF, Put Data response
word 0 in the input register is tested to make sure it is the same as the
command word in the workspace. The module start register in the
input register is also tested to make sure it is the same as the module
start register in the workspace.
If both these tests show matches, the current module start register is
tested against what would be the module start register of the last Put
Data command for this transfer. If the test shows that the current
module start register is greater than or equal to the last Put Data
command, coil 000020 goes ON indicating that the transfer is done. If
the test shows that the current module start register is less than the
last Put Data command, coil 000012 indicating that the next 10
registers should be transferred.
Third Network
000012
400102
400102
#0100
#0110
TEST
TEST
#0001
#0001
400511
400521
400103
400103
BLKM
BLKM
#0010
#0010
Loadable
Instructions
last command started with module register 400110, then the module
start register for this command is 400120.
Fourth
Network
400101
000012
400001
#0010
BLKM
400102
#0012
AD16
400102
As long as coil 000012 is ON, add 10 to the module start register value
in the workspace and move the workspace to the output registers for
the module to start the next transfer of 10 registers.
22.5.9
Abort (Middle
Input ON)
When the middle input to the ESI instruction is powered ON, the
instruction aborts a running ASCII Read or Write message. The serial
port buffers of the module are not affected by the Abort, only the
message that is currently running.
Abort Command
W ord
Content
0900
2 ... 11
not used
Abort Response
22.5.10
Structure
Structure
W ord
Content
0900
0000
...
...
10
0000
11
xxxx
Module
Status
(hex)
(hex)
Meaning
W ord
Loadable
Instructions
489
15
14
13
12
11
10
490
Loadable
Instructions
22.6
MBUS
The S975 Modbus II Interface option modules use two loadable function
blocksMBUS and PEER (see page 496). MBUS is used to initiate a
single transaction with another device on the Modbus II network. In an
MBUS transaction, you are able to read or write discrete or register
data.
PLCs on a Modbus II network can handle up to 16 transactions
simultaneously. Transactions include incoming (unsolicited) messages
as well as outgoing messages. Thus, the number of message initiations
a PLC can manage at any time is 16 # of incoming messages .
A transaction cannot be initiated unless the S975 has enough resources
for the entire transaction to be performed. Once a transaction has been
initiated, it runs until a reply is received, an error is detected, or a
timeout occurs. A second transaction cannot be started in the same
scan that the previous transaction completes unless the middle input is
ON. A second transaction cannot be initiated by the same MBUS
instruction until the first transaction has completed.
22.6.1
Characteristics
Size
1F hex (default)
Loadable
Instructions
491
22.6.2
Representation
Block Structure
control
block
data
block
MBUS
length
Transaction complete
Transaction in progress or new
transaction starting
Error detected in transaction
Register
Function
Displayed
4x + First implied
Second implied
Read discretes
02
Read registers
03
Write discrete
outputs
04
Write register
outputs
255
Third implied
Loadable
statistics
Fourth implied
Reference numbere.g., if you placed a 4 in the third implied register and you place a 23 in this register, the reference will be holding register 40023
Fifth implied
Sixth implied
492
Get system
Instructions
Read register
251 registers
Write register
249 registers
Read coils
7,848 discretes
Write coils
7,800 discretes
Node Content
22.6.3
490 for reading discretes using 24-bit CPUs: 255 for reading discretes using 16-bit CPUs (up to 16 discretes/word)
487 for writing discretes using 24-bit CPUs; 255 for reading discretes using 16-bit CPUs (up to 16 discretes/word)
Function
Issuing function code 255 in the second implied register of the MBUS
control block obtains a copy of the Modbus II local statisticsa series of
46 contiguous register locations where data describing error and
system conditions is stored. To use MBUS for a get statistics operation,
set the length in the bottom node to 46a length < 46 returns an error
(the bottom output will go ON), and a length > 46 reserves extra
registers that cannot be used. For example:
Enable
40101
Complete
41000
Clear system statistics
MBUS
46
Register 40101 is the first register in the MBUS control block, making
register 40103 the control register that defines the MBUS function
code. By entering a value of 255 in register 40103, you implement a get
Loadable
Instructions
493
function. Registers 41000 ... 41045 are then filled with the
following system statistics:
statistics
Statistic
Register
Content
41000
41001
41002
41003
41004
41005
41006
41007
41008
41009
41010
41011
41012
41013
41014
41015
41016
41017
Receive overruns
41018
Software-maintained
transmit errors
41019
41020
Software-maintained
receive errors
41021
41022
41023
41024
(MMFS) errors
41027
41028
41029
41030
Syntax error
41031
Unspecified error
41032
41033
41034
41035
Software-maintained
receive statistics
494
Loadable
Instructions
Software revision
41037
41038
41039
41040
41041
41042
41043
41044
41045
Loadable
Instructions
495
22.7
PEER
The S975 Modbus II Interface option modules use two loadable function
blocksMBUS and PEER (see page 491). The PEER instruction can
initiate identical message transactions with as many as 16 devices on
Modbus II at one time. In a PEER transaction, you may only write
register data.
22.7.1
Characteristics
Size
3F hex (default)
22.7.2
Representation
Block Structure
control
block
data
block
PEER
length
Transaction complete
496
Loadable
Instructions
Register
Function
Displayed
Indicates the status of the transactions at each device, the leftmost bit being the status of device #1 and the rightmost bit the
status of device #16: 0 = OK, 1 = transaction error
First implied
Second implied
Third implied
Fourth implied
The Modbus port 3 address of the second of the receiving devices; address range: 1 ... 255 (0 = no transaction requested)
...
...
18th implied
The 4x register entered in the middle node is the first register in a data
block to be transmitted by the PEER function.
Bottom
Node Content
The integer value entered in the bottom node is the length i.e., the
number of holding registersof the data block . The length can range
from 1 ... 249.
Loadable
Instructions
497
22.8
Custom
Loadables
Programming
Environment
a Subfunction
Library
Subfunctions
Opcodes
to Functions
Loadable
Instructions
then you need only assign as many unique opcodes as there are custom
functions downloaded at any one time. However, you must inform the
user how to change opcodes using the lodutil utility as one function is
withdrawn and replaced by another. The fact that you are able to create
so many subfunctions within one function allows you to work around
the finite limit of available opcodes.
22.8.2
Characteristics
Size
5F hex (default)
22.8.3
Representation
Block Structure
Top input
(required)
subfunction
Top output
(optional)
Middle input
(optional)
subfunction
table
Middle output
(optional)
Bottom input
(optional)
FN xx
length
Bottom output
(optional)
The input to the top node, which will be used to initiate the instruction,
must be implemented. The remaining two inputs and all three outputs
may or may not be used according to your application requirements.
Top Node Content
The top node can use either a 4x holding register or a constant value to
identify a subfunction ID number . Valid ID numbers range from 0 ...
9999.
As many as 8192 different subfunctions may be designed within a
block. When multiple subfunctions are designed within an FNxx block,
Loadable
Instructions
499
each subfunction within the block must have a unique ID number, but
those numbers do not have to be consecutive.
Middle Node Content
Node Content
The bottom node defines the function number, which may range from
FN01 ... FN99, and uses an integer value to define the length i.e., the
number of 4x registersof the subfunction table. The length range can
range from 1 ... 255 in a 16-bit CPU and from 1 ... 999 in a 24-bit CPU.
500
Loadable
Instructions
22.9
22.9.1
PLC Functions
in an Event/Alarm
Recording
System
22.9.2
Host PL C Interaction
The host MMI device must be able to read and write PLC data registers
via the Modbus protocol. A handshake protocol maintains integrity
between the host and the circular buffer running in the PLC. This
enables the host to receive events asynchronously from the buffer at a
speed suitable to the host while the PLC detects event changes and
load the buffer at its faster scan rate.
Loadable
Instructions
501
22.9.3
state table
pointer /
history table
buffer
table
EARS
length
Content
Displayed
First implied
Second implied
First register of the history table, and the remaining registers allocated
to the top node may be used in the table as required; the history table
can provide monitoring for as many as 992 contiguous events (if 16
bits in all the 62 available registers are used)
The the remaining 61 registers are available to store history data. If all
the remaining registers are not required for the history table, they may
be used elsewhere in the program for other purposes, but they will still
be found (by a Modbus search) in the top node of the EARS block.
Middle Node Content
The 4x register entered
502
Loadable
Instructions
Register
Content
Displayed
A value that defines the maximum number of registers the circular buffer
may occupy
First implied
The Q_take pointerthe pointer to the next register where the host will go
to remove data
Second implied
The low byte contains the Q_put pointerthe pointer to the register in the
circular buffer where the EARS block will begin to place the next statechange data. The high byte contains the last transaction number received.
Third implied
The Q+count a value indicating the number of words currently in the circular buffer
Fourth implied
Status/error codes:
Code
Fifth implied
Condition
Invalid state
10
Count removed
255
First register in the circular buffer where event-change data are stored;
each change in event status produces two contiguous registers:
9 10 11 12 13 14
15 16
10 11 12
13 14
15 16
Loadable
Instructions
503
The following table shows binary weighted values for the time stamp,
where n is the relative bit position in the 20-bit time scheme:
Event Data Register
19 18 17 16
15 14 13 12 11 10
2n
2n
2n
1
2
4
8
16
32
64
128
0
1
2
3
4
5
6
7
256
512
1024
2048
4096
8192
16384
32768
8
9
10
11
12
13
14
15
65536
131072
262144
524288
16
17
18
19
Note:
Bottom
Node Content
The integer value entered in the bottom node is the length i.e., actual
number of registers allocated for the circular buffer. The length can
range from 2 ... 100. Each event requires two registers for data storage.
Therefore, if you wish to trap up to 25 events at any given time in the
buffer, assign a length of 50 in the bottom node.
504
Loadable
Instructions
22.10
EUCA
The use of ladder logic to convert binary-expressed analog data into
decimal units can be memory-intensive and scan-time intensive
operation. The Engineering Unit Conversion and Alarms (EUCA)
loadable is designed to eliminate the need for extra user logic normally
required for these conversions. EUCA scales 12 bits of binary data
(representing analog signals or other variables) into engineering units
that are readily usable for display, data logging, or alarm generation.
Using Y = mX + b linear conversion, binary values between 0 ... 4095
are converted to a scaled process variable (SPV). The SPV is expressed
in engineering units in the range 0 ... 9999.
One EUCA instruction can perform up to four separate engineering
unit conversions. It also provides four levels of alarm checking on each
of the four conversions:
22.10.1
Characteristics
Size
Opcode
Loadable
Instructions
505
22.10.2
Representation
Block Structure
ON initiates the conversion
alarm
status
parameter
table
Alarm input
EUCA
nibble #
Error input
(1 ... 4)
HW1
LW1
LA1
Nibble 1
(first conversion)
HA2
HW2
LW2
LA2
Nibble 2
(second conversion)
HA3
HW3 LW3
LA3
Nibble 3
(third conversion)
HA4
HW4
LW4
LA4
Nibble 4
(fourth conversion)
At any given time a nibble selected by the value in the bottom node
displays one alarm condition:
506
Loadable
An HW alarm is set when SPV exceeds a user-defined high warning value expressed in engineering units
Instructions
Only one alarm condition can exist in any EUCA conversion at any
given time. If the SPV exceeds the high warning level the HW bit will
be set. If the HA is exceeded, the HW bit is cleared and the HA bit is
set. The alarm bit will not change after returning to a less severe
condition until the deadband (DB) area has also been exited.
EUCA Middle Node Description
The 4x register entered in the middle
Content
Range
Displayed
0 ... 4095
First implied
Second implied
Third implied
Low engineering unit (LEU), minimum SPV required and set by the user (bottom end of the
scale)
Fourth implied
0 DB <
(HEU LEU)
Fifth implied
HW < HA HEU
Sixth implied
LW < HW < HA
Seventh implied
LA < LW < HW
Eighth implied
LEU LA < LW
Note:
above.
EUCA Bottom
Node Description
The integer value entered in the bottom node indicates which one of the
four nibbles in the alarm status register to use.
22.10.3
A EUCA Example
This example demonstrates the principles of EUCA operation. The
binary value is manually input in the displayed register in the middle
node, and the result is visually available in the SPV register (the first
implied register in the middle node).
The illustration below shows an input range equivalent of a 0 ... 100 V
measure, corresponding to the whole binary 12-bit range:
Loadable
Instructions
507
MSB
LSB
1 1 1 1 1 1 1 1 1 1 11
100 V
90
80
70
60
50
40
30
20
10
0 V
0 0 0 0 0 0 0 0 0 0 00
= 0 or 000 hex
unused
508
Loadable
Instructions
The nine middle-node registers are set using the reference editor. DB is
5 V followed by 10 V increments of high and low warning. The actual
high and low alarm is set at 20 V above and below nominal. On a
graph, the example looks like this:
100 V
90
80
High Alarm
70
High Warning
60
50
40
46
Normal
30
Low Warning
Low Alarm
20
= Dead Band
10
0 V
You can now verify the instruction in a running PLC by entering values
in register 40450 that fall into the defined ranges. The verification is
done by observing the bit change in register 40440 where:
1 = Low Alarm
1 = Low Warning
1 = High Warning
1 = High Alarm
22.10.4
Example
Loadable
Instructions
509
NO
Alarm
Error
Figure
5,000 rpm
0 rpm
DB
100 rpm
HA Alarm
4,800 rpm
HW Alarm
4,450 rpm
LW Alarm
2,000 rpm
LA Alarm
1,200 rpm
The N.O. contact is used to suppress alarm checks when the drive
system is shutdown, or during initial start up allowing the system to
get above the Low alarm RPM level.
510
Loadable
Instructions
5000 rpm
4950
4900
4850
4800
4750
4700
4650
4600
4550
4500
*
4450
4400
*
4350
4300
*
4250
4200 *
High Absolute
40209 = 8000 hex
*
*
*
*
*
*
*
High Warning
40209 = 4000 hex
Warning DB
40209 = 4000 hex
*
*
*
Return to normal
40209 = 0000 hex
Varying the binary value in register 40210 would cause the bits in
nibble 1 of register 40209 to correspond with the changes illustrated
above. The DB becomes effective when the alarm or warning has been
setthen the signal falls into the DB zone.
The alarm is maintained, thus taking what would be a switch chatter
condition out of a marginal signal level. This point is exemplified in the
chart above, where after setting the HA alarm and returning to the
warning level at 4700 the signal crosses in and out of DB at the
warning level (4450) but the warning bit in 40209 stays ON.
The same action would be seen if the signal were generated through
the low settings.
22.10.5
Example
Loadable
Instructions
51 1
Loadable
Conversion
Conversion
Conversion
40220 = 1220
40230 = 3022
40240 = 3920
40211 = 2501
40221 = 1124
40231 = 7379
40241 = 0770
HEU
40212 = 5000
40222 = 3300
40232 = 9999
40242 = 0800
LEU
40213 = 0000
40223 = 0200
40233 = 0000
40243 = 0100
DB
40214 = 0015
40224 = 0022
40234 = 0100
40244 = 0006
Hi Alarm
40215 = 4000
40225 = 2900
40235 = 8090
40245 = 0768
Hi W arn
40216 = 3500
40226 = 2300
40236 = 7100
40246 = 0680
Lo W arn
40217 = 2000
40227 = 1200
40237 = 3200
40247 = 0280
Lo Alarm
40218 = 1200
40228 = 0430
40238 = 0992
40248 = 0230
Scaled
512
40210 = 2048
Input
Instructions
Appendix A
Optimizing RIO Performance
with the Segment Scheduler
Scan Time
Maximizing Throughput
Sweep Functions
Optimizing
RIO Performance
513
A.1
Scan T ime
The time it takes the PLC to solve the logic program and update the
physical system is called scan time . It comprises the time it takes the
PLC to:
A.1.1
Chassis-mount
1.0 ms/Kwords
E984-685/-785, L984-785
Slot-mount
Quantum Series
AT-984, MC-984
Host-based
0984-780/-785
Slot-mount
Q984
Host-based
0984-685
Slot-mount
2.5 ms/Kwords
Micro
3.0 ms/Kwords
Slot-mount
4.25 ms/Kwords
Compact
Micro
984-380/-381, 984-480
Slot-mount
2.0 ms/Kwords
5.0 ms/Kwords
Optimizing
PLC Types
1.5 ms/Kwords
514
PLC Models
0.75 ms/Kwords
RIO Performance
The following illustration shows how logic solve time fits in the overall
scan time function:
Segment 1
Service
Outputs
Read
Inputs
IST
Segment 2
Service
Outputs
= Other Elements of
Scan Time
Read
Inputs
One Scan
IST
Segment 3
Service
Outputs
Read
Inputs
IST
Overhead
A.1.2
Servicing
I/O
Optimizing
RIO Performance
515
Segment 1
Service
Outputs
Read
Drop 2
Inputs
IST
Segment 2
Service
Outputs
= Other Elements of
Scan Time
Read
Inputs
One Scan
IST
Segment 3
Service
Drop 2
Outputs
Read
Inputs
IST
Overhead
A.1.3
Overhead
An intersegment transfer (IST) occurs between each segment. At this
time, the I/O processor and the state RAM exchange data; previous
inputs are transferred to state RAM and the next outputs are
transferred to the I/O processor. The logic scan and I/O servicing for
each segment are coordinated in this fashion. Using direct memory
access (DMA), ISTs typically take less than 1 ms/segment.
At the end of each scan, input messages to the Modbus communication
ports are serviced. The maximum time allotted for comm port servicing
is 2.5 ms/scan; typical servicing times are less than 1 ms/scan. If the
PLC is using any option processors (C986 Coprocessors or D908
Distributed Communications Processors), they are also serviced at the
end of each scan and typically require less than 1 ms/scan.
System diagnostics take from 1 ... 2 ms/scan to run, depending on PLC
type.
516
Optimizing
RIO Performance
Segment 1
Service
Outputs
Read
Inputs
IST
Segment 2
= Overhead
Support Time
Service
Outputs
= Other Elements of
Scan Time
Read
Inputs
One Scan
Segment 3
IST
IST
Service
Outputs
Read
Inputs
IST
Overhead
Optimizing
RIO Performance
517
A.2
How to Measure
Scan T ime
( )
01000
00500
01000
UCTR
10001
40001
00999
T.01
10001
40003
40002
100
DIV
40005
The up-counter counts 1000 scans as it transitions 500 times. When the
counter has transitioned 500 times, the T.01 timer turns OFF and
stores the number of hundredths of seconds it has taken for the counter
to transition 500 times (1000 scans) in register 40003.
The value stored in 40002/40003 in the DIV block is then divided by
100 and the resultwhich represents logic solve time in msis stored
in register 40005.
Note:
10001 is controlled via a DISABLE or a hard-wired input; if
you are running the program in optimized mode, a hard-wired input is
required to toggle 10001.
Note:
The maximum amount of time allowed for a scan is 250 ms; if
the scan has not completed in that amount of time, a watchdog timer
in the CPU stops the application and sends a timeout error message
to the programming panel display. The maximum limit on scan time
protects the PLC from entering into an infinite loop.
518
Optimizing
RIO Performance
A.3
Maximizing
Throughput
Situation
PLC
10001
Segment 1
( )
I/O
Drop 1
10001 00001
00001
I/O
Drop 2
I/O
Drop 3
Optimizing
RIO Performance
519
When all logic segments are coordinated with all physical I/O drops in
this manner, the throughput for a given logic segment can be less than
one scan. Here is how it can be traced in our scan time model:
Segment 1
Service
Drop 3
Outputs
Read
Inputs
IST
Segment 2
Service
Outputs
Event A
Read
Drop 3
Inputs
Scan 1
IST
Segment 3
Event B
Service
Outputs
Event C
Read
Inputs
Event D
IST
Overhead
Segment 1
Event E
Service
Drop 3
Outputs
Scan 2
Read
Inputs
520
Optimizing
RIO Performance
The model tracks throughput for drop 3. Throughput in this best case
example is about 75% of total scan time. Five benchmark events are
shown:
Event A, where the inputs from drop 3 are available to the I/O
processor
Event D, where data are transferred from state RAM to the I/O
processor
Event E, where the output data are written to the output modules
at drop 3
Optimizing
RIO Performance
521
A.4
Here is what a default order of solve might look like, as seen in the
Modsoft segment scheduler editor:
Service Comm
F1
F2
Insert
F3
F4
F5
F6
Quit
F7
F8
F9
SEGMENT - SCHEDULER
Number of Drops :
Constant Sweep
Number
1
A Default
522
Optimizing
3
:
OFF
Min
Scan Time
Ref.
SegNumber Sense ment
Nr
Type
--- ms
Register :
4----
Drop
Input
Drop
Output
CONTINUOUS
01
01
01
CONTINUOUS
02
02
02
CONTINUOUS
03
03
03
EOL
Order-of-Solve
RIO Performance
Logic Program
A.5
to Improve
Suppose that your logic program is three segments long and that
segment 3 contains logic that is critical to your applicationfor
example, monitoring a proximity switch to verify part presence.
Segments 1 and 2 are running noncritical logic such as part count
analysis and statistic gathering. The program is running in the
standard order-of-solve mode, and you are finding that the PLC is not
able to read critical inputs with the frequency desired, thereby causing
unacceptable system delay.
Using the segment scheduler editor, you can improve the throughput
for the critical I/O at drop 3 by scheduling segment 3 to be solved two
(or more) times in the same scan.
Optimizing
RIO Performance
523
IST
Service
Drop 1
Outputs
Read
Drop 2
Inputs
One Scan
Segment 2
IST
Service
Drop 3
Outputs
Read
Drop 3
Inputs
IST
Segment 3
Service
Drop 2
Outputs
Read
Drop 1
Inputs
IST
Overhead
524
Optimizing
RIO Performance
Here is how the Modsoft segment scheduler would show the resulting
order-of-solve table:
Service Comm
F1
F2
Insert
F3
F4
F5
F6
Quit
F7
F8
F9
SEGMENT - SCHEDULER
Number of Drops :
Constant Sweep
Number
Type
OFF
Min
Scan Time
--- ms
Ref.
Segment
Number Sense
Nr
Register :
4----
Drop
Input
Drop
Output
CONTINUOUS
01
01
01
CONTINUOUS
03
03
03
CONTINUOUS
02
02
02
CONTINUOUS
03
03
03
EOL
An Order-of-Solve
Table Rescheduled
for Critical
I/O
Optimizing
RIO Performance
525
A.6
to Improve
F2
Insert
F3
F4
F5
F6
Quit
F7
F8
F9
SEGMENT - SCHEDULER
Number of Drops :
Constant Sweep
Number
Optimizing
Type
Min
Scan Time
OFF
--- ms
Ref.
Segment
Number Sense
Nr
Register :
4----
Drop
Input
Drop
Output
CONTINUOUS
01
01
01
CONTINUOUS
03
03
03
CONTROLLED
02
02
02
03
03
03
CONTINUOUS
EOL
An Order-of-Solve
526
RIO Performance
00056
Table Rescheduled
ON
for a Controlled
Logic Segment
A.7
Service Comm
F1
F2
Insert
F3
F4
F5
F6
Quit
F7
F8
F9
SEGMENT - SCHEDULER
Number of Drops :
Constant Sweep
Number
Type
CONTINUOUS
WDT RESET
CONTINUOUS
WDT RESET
CONTINUOUS
EOL
An Order-of-Solve
3
OFF
Min
Scan Time
--- ms
Ref.
Segment
Number Sense
Nr
Table Rescheduled
Register :
4----
Drop
Input
Drop
Output
01
01
01
02
02
02
03
03
03
Optimizing
Port Servicings
per Scan
RIO Performance
527
A.8
Sweep
Functions
Constant
Sweep
Constant Sweep allows you to set target scan times from 10 ... 200 ms
(in multiples of 10). A target scan time is the time between the start of
one scan and the start of the next; it is not the time between the end of
one scan and the beginning of the next.
Constant Sweep is useful in applications where data must be sampled
at constant time intervals. If a Constant Sweep is invoked with a time
lapse smaller than the actual scan time, the time lapse is ignored and
the system uses its own normal scan rate. The Constant Sweep target
scan time encompasses logic solving, I/O and Modbus port servicing,
and system diagnostics. If you set a target scan of 40 ms and the logic
solving, I/O servicing, and diagnostics require only 30 ms, the PLC will
wait 10 ms on each scan. Consult your programming documentation for
procedures to invoke a Constant Sweep function.
A.8.2
Single
Sweep
The Single Sweep function allows your PLC to execute a fixed number
of scans (from 1 ... 15) and then to stop solving logic but continue
servicing I/O. This function is useful for diagnostic workit allows
solved logic, moved data, and performed calculations to be examined for
errors.
W arning:
The Single Sweep function should not be used to
debug controls on machine tools, processes,
or material
handling systems when they are active. Once a specified
number of scans has been solved, all outputs are frozen in
their last state. Since no logic solving is taking place, the PLC
ignores all input information.
This can result in unsafe,
hazardous,
and destructive
operation
of the machine or
process connected
to the PLC.
528
Optimizing
RIO Performance
Index
A
AD16 instruction, 84
ADD instruction, 76
ADDDP function, in EMTH, 107
ADDFP function, in EMTH, 123
ADDIF function, in EMTH, 118
addition
floating point, 123
floating point and integer values, 118
signed or unsigned 16-bit, 84
unsigned integer, 76
AIN (analog in) function, in PCFL, 424
B
battery coil assignment, in the configurator,
18
BCD instruction, 100
BCD-to-binary format conversion, 100
benchmark performance, for Equation
Network operations in ladder logic, 167
C
CALC (calculate preset formula) function, in
PCFL, 418
CALL instruction, 471
loadable part numbers, 460
changing signs, for floating point numbers,
126
CHS instruction, 466
CHSIN function, in EMTH, 126
CKSM instruction, in ladder logic, 330
Clear local statistics, via the MSTR
instruction, 349
Index
529
normally open, 32
positive transitional, 33
conversion
binary-expressed analog data to
engineering units, 503
floating point and integer values, 117,
122
radians to degrees, 133
COS function, in EMTH, 129
cosine calculation, in floating point, 129
counters
down, 62
up, 60
coils
0x, 14
as displayed in ladder logic, 3
latched, 36, 37
memory-retentive, 36
memory-retentive, 37
normal, 36
D
data types, in an Equation Network, 154
DCTR instruction, 62
degree-to-radian conversion, in floating
point, 134
DELAY function, in PCFL, 427
derivative control, in PID2, 403
DIO health status table, 276
configuration table, 18
configurator editor, 18
constant sweep, 526
constants, in an Equation Network, 155
contacts
negative transitional, 34
normally closed, 33
530
Index
E
E. See error measurement
EARS instruction, 499
EMTH, overview, 104
EMTH performance benchmarks, compared
to Equation Network, in Quantum PLCs,
167
engineering unit conversion, in ladder logic,
503
environment, for programming 984 custom
loadables, 496
EQN (formatted equation) function, in
PCFL, 420
840 USE 101 00
Index
531
extended memory
in 24-bit CPUs, 288
storage in user memory, 289
F
FIN instruction, 181
FTOI instruction, 98
G
Get Data command, via the ESI instruction,
482
Get local statistics, via the MSTR
instruction, 347
horizontal shorts, 39
532
Index
I
I/O map table, 22
IBKR instruction, 198
K
KPID function, in PCFL, 444
instruction set
built into select PLCs, 8
loadables for select PLCs, 10
standard for all PLCs, 7
J
JSR instruction, 373
M
manipulated variable, in a PID2 function,
400
masking a timer-generated interrupt, 391,
394
masking an I/O-generated interrupt, 391,
394
Index
533
unsigned integer, 80
mv. See manipulated variable
memory-retentive coils, 36
N.C. contacts, 33
Modbus II instructions
MBUS, 489
PEER, 494
N.O. contacts, 32
NBIT instruction, 49
NCBT instruction, 47
NOBT instruction, 45
MSTR operations
clear local statistics, 349
clear remote statistics, 355
get local statistics, 347
get remote statistics, 353
Peer Cop communications health, 357
read, 345
read global data, 352
write, 345
write global data, 351
normal coils, 36
normally open contacts, 32
O
ONOFF function, in PCFL, 446
MUL instruction, 80
opcodes, 24
for ladder logic elements and non-DX
functiona, 24
for standard DX functions, 28
in custom loadable designs, 496
OR instruction, 210
multiplication
floating point, 124
floating point and integer values, 119
signed or unsigned 16-bit, 90
MU16 instruction, 90
534
Index
P
parentheses, in an Equation Network, 159
PCFL instruction, 413
register outputs, 4x , 14
register inputs, 3x , 14
register-to-table move, 171
reset watchdog timer routine, 525
RET instruction, 377
returning from a subroutine, 377
reverse transfer function, in Hot Standby
systems, 464
RIO status table
for Compact PLC users, 250
for Micro PLC users, 255
for S901 users, 234
for S908 users, 240
RIO system status, how the STAT block
works, 232
RMPLN (logarithmic ramp) function, in
PCFL, 437
rotating a bit pattern, in a DX matrix, 226
RStF, Modsoft off-line function for SFC, 230
S
R
SBIT instruction, 51
scan time, 512
RBIT instruction, 53
Index
535
SU16 instruction, 86
SUB instruction, 78
SUBDP function, in EMTH, 108
SUBFI function, in EMTH, 120
SUBFP function, in EMTH, 123
shorts
horizontal, 39
vertical, 39
subtraction
floating point, 123
floating point and integer values, 118,
120
signed or unsigned 16-bit, 86
unsigned integer, 78
Index
T
T.01 instruction, 69
T0.1 instruction, 67
T1.0 instruction, 64
T1MS instruction, 71
table-to-register move, 174
table-to-table move, 177
TAN function, in EMTH, 130
tangent calculation, in floating point, 130
TBLK instruction, 195
TC, Modsoft off-line function for SFC, 229
TEST instruction, 88
throughput, 517
840 USE 101 00
vertical shorts, 39
W
watchdog timer, 516
WRIT instruction, for ASCII
communications, 300
Write ASCII command, via the ESI
instruction, 481
Write global data, via the MSTR instruction,
351
Write operations, via the MSTR instruction,
345
UCTR function, 60
UCTR instruction, 60
user memory, 12
CMOS RAM storage, 13
V
variables, in an Equation Network, 154
Index
537