PLC Modicon Software Block Library v3.0
PLC Modicon Software Block Library v3.0
August 2001
Schneider Electric
One High Street
North Andover , MA 01845
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 Schneider Electric.
DIGITALandDECareregisteredtrademarksofDigitalEquipment
Corporation.
4.1 Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.1.1 Normally Open Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.1.2 Normally Closed Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1.3 Positive Transitional Contacts . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1.4 Negative Transitional Contacts . . . . . . . . . . . . . . . . . . . . . . . 34
4.2 Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.2.1 Normal Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.2.2 Latched or Memory-retentive Coils . . . . . . . . . . . . . . . . . . . 36
4.2.3 A Simple Contact-Coil logic Example . . . . . . . . . . . . . . . . . . 37
4.2.4 Coil Usage in a Logic Network . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2.5 General Coil Usage Guidelines . . . . . . . . . . . . . . . . . . . . . . . 38
4.3 Shorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.3.1 Horizontal Shorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.3.2 Vertical Shorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.4 Using Logic Elements to Create Control Circuits . . . . . . . . . . . . . . . . . . 40
4.4.1 A Logical AND Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.4.2 A Logical OR Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.4.3 A Logical XOR Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.4.4 Building a Seal Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.5 Storing Contacts and Coils in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.6 NOBT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.7 NCBT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.8 NBIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.9 SBIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.10 RBIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
vi Contents 840 USE 101 00
4.11 Example: Implementing a Motor Starter Circuit . . . . . . . . . . . . . . . . . . . 55
5.1 UCTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.2 Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.3 Up-Counter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 DCTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3 T1.0 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.2 Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . . 64
5.3.3 A One-second Timer Example . . . . . . . . . . . . . . . . . . . . . . . . 66
5.4 T0.1 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.5 T.01 Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.6 T1MS Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.6.1 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.6.2 Representation in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . . 71
5.6.3 A Millisecond Timer Example . . . . . . . . . . . . . . . . . . . . . . . . 72
6.1 ADD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.2 SUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.3 MUL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
6.4 DIV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6.5 AD16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.6 SU16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.7 TEST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.8 MU16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.9 DV16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
6.10 ITOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
6.11 FTOI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
6.12 BCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.13 A Fahrenheit-to-Centigrade Conversion Example . . . . . . . . . . . . . . . . . . 102
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Power
Rail 1 2 3 4 5 6 7 8 9 10 11
1 ( )
2 ( )
3 ( )
4 ( )
5 ( )
6 ( )
7 ( )
NOTE Only coils can be shown in column 11
The two examples below show the same logic structure with the coils
displayed differently according to user preference. The first example
shows the coils displayed in their logic-solve positions and the second
example shows the coils displayed in expanded positions.
30101 ( )
10032 10033 00101
40101 ( )
10034 00102
SUB
40102 ( )
00103
30101 ( )
10032 10033 00101
40101 ( )
10034 00102
SUB
40102 ( )
00103
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.
With some PLCs, you may also create an unscheduled segment that
contains one or more ladder logic subroutines, which can be called from
the scheduled segments via the JSR function.
The PLC scans the ladder logic program sequentially in the following
order:
Segment 1 Start
Network 1
Segment 1
Network 2
Segment Boundary
Segment 2
Network 3
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.
( ) A normal coil 1
A vertical short 0
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:
Nodes
Instruction Meaning Consumed
HSBY Sets up a 984 hot standby back-up PLC that takes control of 3
the application if the primary PLC goes down
CHS Optional method for setting up a Quantum hot standby 3
back-up PLC
CALL Supports 984 Coprocessor option module applications 3
MBUS For initiating message transactions on a Modbus II network 3
PEER
ESI Optional instruction in Quantum PLCs that supports the 3
140 ESI 062 10 Quantum ASCII module
FNxx A three-node template for creating custom loadable 3
instructions via Assembly or C source code
DRUM Supports sequence control application logic in some PLC 3
ICMP models that do not have the built-in SCIF instruction
MATH Support some square root, logarithm, and double-precision 3
DMTH math functions in PLCs that cannot support the Enhanced
Math library
EARS Supports an event/alarm recording system by tracking 3
events/alarms and reporting time-stamped messages
EUCA Performs an engineering unit conversion algorithm 3
HLTH Detects changes in the I/O system and reports problems on 3
an exception-only basis
V 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 PLC’s 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 Approximately
(up to 277 words) 888 Words
Overhead System Diagnostics
Configuration Extension
Table (optional)
ASCII Message area
User (optional)
Logic
User Application Program
( ) =1
8 words
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 PLCs—e.g., the Micro PLCs—a 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.)
page F
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
Counter input states for the previous scan are represented on page F in
an up-counter/down-counter history table. Each counter register is
represented by a single bit in a word in the table; a value of 1 indicates
that the top input was ON in the last scan, and a value of 0 indicates
that the top input was OFF in the last scan.
Words are entered into the state RAM table from the top down in the
following order:
Word 0001
0x
..
.
0x + n
1x
..
.
1x + n
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
Register Meaning
1 2 3 4 5 6 7 8 9 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 Day of the week (Sunday = 1, Monday = 2, etc.)
4x + 2 Month of the year (Jan. = 1, Feb. = 2, etc.)
4x + 3 Day of the month (1 ... 31)
4x + 4 Year (00 ... 99)
4x + 5 Hour in military time (0 ... 23)
4x + 6 Minute (0 ... 59)
4x + 7 Second (0 ... 59)When a 4x holding register assignment is made in
the configurator for the time of day (TOD) clock, that register and
the next seven consecutive registers (4x ... 4x + 7) are set aside in
the configuration to store TOD information.
Register Meaning
400500 0110000000000000
400501 3 (decimal)
400502 7 (decimal)
400503 16 (decimal)
400504 91 (decimal)
400505 9 (decimal)
400506 25 (decimal)
400507 30 (decimal)
Configuration Size
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.
With your programming panel software, you can access a I/O map
editor that allows you to define:
V The number, type, and slot location of the I/O modules in the drop
The five most significant bits in a 16-bit node and the eight most
significant bits in a 24-bit node—the x bits—are reserved for opcodes .
An opcode defines the type of functional element associated with the
node—for 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.
With a 16-bit node, 11 bits are available as state RAM pointers, giving
you a total addressing capability of 2048 words. The maximum number
of configurable registers in most 16 bit machines is 1920, with the
balance occupied by up to 128 words (2048 bits) of discrete reference,
disable, and history bits. An exception is the 984-680/-685 PLCs, which
have an extended registers option that supports 4096 registers in state
RAM.
With a 24-bit node, 16 bits are available as state RAM pointers. The
maximum number of configurable registers in a 24-bit machine is 9999.
When you are using a 16-bit CPU, you are left with only four more x-bit
combinations—11100, 11101, 11110, and 11111—with which to express
opcodes for the DX instructions. To gain the necessary bit values, the
system uses the three least significant (z) bits along with the x bits to
express the opcodes:
1 1 1 0 0 z z z
0 0 0 = R→T
0 0 1 = T→R
0 1 0 = T→ T
0 1 1 = BLKM
1 0 0 = FIN
1 0 1 = FOUT
1 1 0 = SRCH
1 1 1 = STAT
1 1 1 0 1 z z z
0 0 0 = AND
0 0 1 = OR
0 1 0 = CMPR
0 1 1 = SENS
1 0 0 = MBIT
1 0 1 = COMP
1 1 0 = XOR
1 1 1 = BROT
1 1 1 1 0 z z z
0 0 0 = READ
0 0 1 = WRIT
0 1 0
0 1 1
For Loadable Options 1 0 0
1 0 1
1 1 0
1 1 1
In the 24-bit CPUs, the three most significant x bits are used to
indicate the type of DX function:
x x x 1 1 1 0 0 z z z
0 0 0 = R→T 0 0 0
0 0 1 = T→R 0 0 1
0 1 0 = T→ T 0 1 0
0 1 1 = BLKM 0 1 1
1 0 0 = FIN 1 0 0
1 0 1 = FOUT 1 0 1
1 1 0 = SRCH 1 1 0
1 1 1 = STAT 1 1 1
x x x 1 1 1 0 1 z z z
0 0 0 = AND 0 0 0
0 0 1 = OR 0 0 1
0 1 0 = CMPR 0 1 0
0 1 1 = SENS 0 1 1
1 0 0 = MBIT 1 0 0
1 0 1 = COMP 1 0 1
1 1 0 = XOR 1 1 0
1 1 1 = BROT 1 1 1
x x x 1 1 1 1 0 z z z
0 0 0 = READ 0 0 0
0 0 1 = WRIT 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 For Loadable Options 1 0 0
1 0 1 1 0 1
1 1 0 1 1 0
1 1 1 1 1 1
The z bits, which simply echo the three most significant x bits, may be
ignored in the 24-bit nodes.
1C R→T instruction
3C T→R instruction
5C T→T 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
FF HSBY instruction
5F CALL, FNxx , or EARS instruction
1F MBUS instruction
3F PEER instruction
DE DMTH instruction
BE MATH or EARS instruction
FE DRUM instruction
7F ICMP instruction
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.
V Contacts
V Coils
V Shorts
V NCBT
V NOBT
V NBIT
V SBIT
V RBIT
Size
One node high
Symbol
Function
Passes power when its referenced coil or input is ON:
ON
N.O. Contact
OFF OFF
ON
Power Flow
OFF OFF
PLC Compatibility
Standard in all PLC types
Opcode
08 hex
Size
One node high
Symbol
Function
Passes power when its referenced coil or input is OFF:
ON
N.C. Contact
OFF OFF
Power Flow
ON ON
OFF
PLC Compatibility
Standard in all PLC types.
Opcode
09 hex
Size
One node high
Symbol
ON
P. T. Contact
OFF
ON
Power Flow
OFF OFF
One Scan
PLC Compatibility
Standard in all PLC types
Opcode
0A hex
Size
One node high
Symbol
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
Standard in all PLC types
Opcode
0B hex
34 Ladder Logic Elements 840 USE 101 00
Note: A transitional contact will pass power continuously if the
referenced coil is skipped by a SKP instruction (see Chapter 13) or by
the segment scheduler (see Appendix A). A transitional contact may
not pass power if it is referenced to an input that has been scheduled
to read from the I/O drop more than once per scan via the segment
scheduler.
V A normal coil
Size
One node high
Symbol
( )
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
Standard in all PLC types
Opcode
0C hex
Size
One node high
Function
If a memory-retentive (or latched) coil is ON at the time a PLC loses
power, the coil will come back up in an ON state when power is
restored. The coil will maintain that ON state for the first logic scan,
and then the logic program will take control.
PLC Compatibility
Standard in all PLC types
Opcodes
0D hex
Input Output
Module ( ) Module
Memory protection in the PLC must be OFF before you disable (or
enable) a coil or a discrete input.
Size
One node high
Symbol
Function
Expands logic horizontally along a rung in a ladder logic network
PLC Compatibility
Standard in all PLC types
Opcode
07 hex
Size
Unique among logic elements in that it does not use any nodes in a
logic network
Function
Connects contacts or instructions vertically in a network column, or
node inputs and outputs to create either/or conditions. When two
contacts are connected by vertical shorts, power is passed when one or
both contacts receive power.
PLC Compatibility
Standard in all PLC types
( )
10001 10002 10003 00001
( )
10001 10002 00001
10003
( )
10001 10002 00001
10001 10002
Coil 00001 can be enabled only when one but not both of the following
conditions is true:
V The field device sensed by contact 10001 is ON and the field de-
vice sensed by contact 10002 is OFF
V The field device sensed by contact 10001 is OFF and the field de-
vice sensed by contact 10002 is ON
00001
Running
( ) Lamp (Red)
00001 00002
Stopped
( ) Lamp (Green)
00001 00003
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.
V RBIT, for resetting a specified bit that has been set in a 4x regis-
ter
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 16
point 15
point 14
point 13
point 12
point 11
point 10
point 9
point 8
point 7
point 6
point 5
point 4
point 3
point 2
point 1
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
Two nodes high
PLC Compatibility
V Standard in the Quantum Automation Series PLCs
Opcode
40 hex
Block Structure
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 ON—i.e., its logic
state is 1.
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
Two nodes high
PLC Compatibility
V Standard in the Quantum Automation Series PLCs
Opcode
41 hex
Block Structure
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 OFF—i.e., its logic
state is zero.
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 coils—when a bit is
turned ON, it stays ON until a control signal turns it OFF.
Note: 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.
4.8.1 Characteristics
Size
Two nodes high
PLC Compatibility
V Standard in the Quantum Automation Series PLCs
Opcode
42 hex
Block Structure
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.
The set bit (SBIT) instruction lets you set the state of the specified bit
to ON (1) by powering the top input.
Note: 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.
4.9.1 Characteristics
Size
Two nodes high
PLC Compatibility
V Standard in the Quantum Automation Series PLCs
Opcode
43 hex
Block Structure
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.
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.
Note: 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.
4.10.1 Characteristics
Size
Two nodes high
PLC Compatibility
V Standard in the Quantum Automation Series PLCs
Opcode
44 hex
Block Structure
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.
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.
A Discrete Implementation
Below is an illustration of conventional ladder logic used to implement
the motor starter. A 16-point discrete input module has been I/O
mapped to 16 contiguous 1x references (100001 ... 100016) in logic, and
an 8-point discrete output module has been I/O mapped to eight
contiguous 0x references (000001 ... 000008).
Discrete Discrete
Input Module Output Module
100001 ( ) 000001 M1
START 100001 100002 000003 000001
100002 000002
STOP 000001
100003 000003
400100 ( )
M1 AUX 100003 000002
T0.1
100004 400101
RESET 100003 000008
( )
100016 000002 100004 000003
000003
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.
Register
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
300001
Network 1
400001
NOBT
001
Network 2
300001
NCBT
003
300001 400002
NOBT RBIT
004 000001
Register
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
400001
M1
Network 1
300001 400001
NOBT SBIT
001 000001
Network 2
300001
NCBT
003
300001
NCBT
002
V UCTR
V DCTR
V T1.0 Timer
V T0.1 Timer
V T.01 Timer
V T1MS Timer
5.1.1 Characteristics
Size
Two nodes high
PLC Compatibility
Standard in all PLC types
Opcode
14 hex
Block Structure
UCTR
OFF = reset accumulator to 0
accumulated count < counter preset
ON = counter accumulating 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.
00100 ( )
00077
10027
UCTR
40007
( )
00055
00077
5.2.1 Characteristics
Size
Two nodes high
PLC Compatibility
Standard in all PLC types
Opcode
13 hex
Block Structure
DCTR
OFF = reset to preset value accumulated count >0
ON = counter accumulating 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.
5.3.1 Characteristics
Size
Two nodes high
PLC Compatibility
Standard in all PLC types
Opcode
15 hex
Block Structure
T1.0
OFF = accumulator reset to 0 accumulated accumulated time < timer preset
ON = timer accumulating 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.
00005 ( )
00107
10001
T1.0
40040
( )
00108
10002
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.
5.4.1 Characteristics
Size
Two nodes high
PLC Compatibility
Standard in all PLC types
Opcode
16 hex
Block Structure
T0.1
OFF = accumulator reset to 0 accumulated accumulated time < timer preset
ON = timer accumulating 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.
5.5.1 Characteristics
Size
Two nodes high
PLC Compatibility
Standard in all PLC types
Opcode
17 hex
Block Structure
T.01
OFF = accumulator reset to 0 accumulated accumulated time < timer preset
ON = timer accumulating 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.
5.6.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in Micro PLC models and the Quantum CPU 424 02
PLC
Opcode
1E hex
Block Structure
accumulated
OFF = accumulator reset to 0 accumulated time < timer preset
time
ON = timer accumulating
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.
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
1 40054 60
00003
( )
UCTR
40053 60
00002
00004
( )
UCTR
00003 40052 24
00005
UCTR
00004 40051
00005
As the times accumulate in each counter, the time of day can be read in
five holding registers as follows:
The second group, which is available only in certain PLCs, contains five
comparable instructions—AD16, SU16, TEST, MU16, and DV16—that
support signed and unsigned 16-bit math calculations and comparisons.
The ADD instruction adds unsigned value 1 (its top node) to unsigned
value 2 (its middle node) and stores the sum in a holding register in the
bottom node.
6.1.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
18 hex
Block Structure
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 .
6.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
19 hex
Block Structure
SUB
difference value 1 < value 2
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 .
6.3.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
1A hex
Block Structure
ON = value 1 value 1
Echoes the state
multiplied by value 2 of the top input
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.
The DIV instruction divides unsigned value 1 (its top node) by unsigned
value 2 (its middle node) and posts the quotient and remainder in two
contiguous holding registers in the bottom node.
6.4.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
1B hex
Block Structure
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
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.
6.5.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
31 hex
Block Structure
value 2
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 .
6.6.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
32 hex
Block Structure
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 .
6.7.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
35 hex
Block Structure
TEST
ON = signed operation value 1 < value 2
OFF = unsigned operation 1
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 .
6.8.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
33 hex
Block Structure
Enables value 1 x value 2 value 1 Echoes the state of the top input
value 2
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.
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.
6.9.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
34 hex
Block Structure
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.
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.)
6.10.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
36 hex
Block Structure
converted
FP
ON = signed operation IT OF
OFF = unsigned operation 1
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.
Size
Three nodes high
PLC Compatibility
V Standard in E984-685 and E984-785 PLCs and in the Quantum
Automation Series PLCs
Opcode
37 hex
Block Structure
FP
Enables conversion integer conversion completed successfully
converted
integer
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
6.12.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in the Quantum Automation Series PLCs
Opcode
53 hex
Block Structure
source
Enables conversion echoes the state of the top input
register
destination
register
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 performed—when 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.
( )
00011
Note: The vertical short to coil 00011 must be to the left of the
vertical shorts linking the three outputs from the SUB block.
°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.
7.1.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in all PLC models except the 984A, 984B, or 984X Chas-
sis Mount PLCs and the 110CPU311 and 110CPU411 Micro PLCs
Opcode
7F hex
EMTH
Bottom In indicator Bottom Out
Block Structure
EMTH
ADDDP
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.
V 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
V The third and fourth implied registers store the high-order and
low-order halves of the double precision sum, respectively
V The fifth implied register is not used in the calculation but must
exist in state RAM
Block Structure
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.
V 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
V The second and third implied registers store the high-order and
low-order halves, respectively, of the absolute difference in double
precision format
V The fifth implied register is not used in this calculation but must
exist in state RAM
Block Structure
EMTH
MULDP
V 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
V The last four implied registers store the double precision product
in the range 0 ... 9,999,999,999,999,999
Block Structure
ON = operand 1 divided by
operand 1 ON = operation successful
operand 2 and result posted
in designated registers
operand 2
ON = decimal remainder quotient ON = an operand out of range
OFF = fractional remainder remainder
EMTH ON = operand 2 is 0
DIVDP
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.
V 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
V 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 deci-
mal, it is four digits long and only the fourth implied register is
used
Block Structure
EMTH
SQRT
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.9922—the square
root of 4095—and stores that linearized result in the middle-node
registers.
Block Structure
EMTH
SQRTP
30030
40030
EMTH
SQRTP
√2000 = 0044.72
Block Structure
EMTH
LOG
Block Structure
EMTH
ANLOG
The most significant bits are posted in the displayed register, and the
least significant bits are posted in the implied register. The largest
antilog value that can be calculated is 99770006 (9977 posted in the
displayed register and 0006 posted in the implied register).
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.
Block Structure
result
EMTH
CNVIF
Block Structure
FP and
sum
EMTH
ADDIF
Block Structure
FP and
difference
EMTH
SUBIF
Block Structure
FP and
product
EMTH
MULIF
Block Structure
FP and
quotient
EMTH
DIVIF
Block Structure
integer and
difference
EMTH
SUBFI
Block Structure
integer and
quotient
EMTH
DIVFI
Block Structure
Block Structure
integer
Note: If the resultant integer is too large for 984 double precision
integer format (> 99,999,999), the conversion still occurs but an error
is logged in the EMTH ERLOG function (see page 138).
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.
Block Structure
value 2
and sum
EMTH
ADDFP
Block Structure
value 2 and
difference
EMTH
SUBFP
Block Structure
value 2 and
product
EMTH
MULFP
Block Structure
value 2 and
quotient
EMTH
DIVFP
Block Structure
Block Structure
result
EMTH
SQRFP
Block Structure
(value )
EMTH
CHSIN
The top node FP value in the top node is posted in the second and third
implied registers. The displayed register and the first implied register
in the middle node are not used in the operation but their allocation in
state RAM is required.
EMTH
PI
Block Structure
sine of
value
EMTH
SINE
The sine of the value in the top node is posted in the second and third
implied registers in FP format. The displayed register and the first
implied register are not used but their allocation in state RAM is
required.
Block Structure
cosine of
value
EMTH
COS
The cosine of the value in the top node is posted in the second and third
implied registers in FP format. The displayed register and the first
implied register are not used but their allocation in state RAM is
required.
Block Structure
EMTH
TAN
The tangent of the value in the top node is posted in the second and
third implied registers in FP format. The displayed register and the
first implied register are not used but their allocation in state RAM is
required.
Block Structure
arcsine of
value
EMTH
ARSIN
The arcsine in radians of the value in the top node is posted in the
second and third implied registers in FP format. The displayed register
and the first implied register are not used but their allocation in state
RAM is required.
Block Structure
arc cosine
of value
EMTH
ARCOS
The arc cosine in radians of the FP value in the top node is posted in
the second and third implied registers. The displayed register and the
first implied register are not used but their allocation in state RAM is
required.
Block Structure
EMTH
ARTAN
The arc tangent in radians of the FP value in the top node is posted in
the second and third implied registers. The displayed register and the
Block Structure
result
EMTH
CNVRD
Block Structure
result
EMTH
CNVDR
Block Structure
integer
and result
EMTH
POW
The bit values in the displayed register must all be cleared to zero. An
integer value representing the power to which the top-node value will
be raised is stored in the first implied register. The result of the FP
value being raised to the power of the integer value is stored in the
second and third implied registers.
Block Structure
result
EMTH
EXP
If the value is out of range, the result will either be 0 or the maximum
value. No error will be flagged.
Block Structure
result
EMTH
LNFP
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).
Block Structure
result
EMTH
LOGFP
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).
Block Structure
error
data
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.
Code MA TH Function
7.5.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Available as a loadable for the 984A, 984B, and 984X Chassis
Mount PLCs (SW-AP9x -Dx A loadable library)
Opcode
BE hex (default)
Block Structure
MA TH
1
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.9922—the square
root of 4095—and stores that linearized result in the middle-node
registers.
Block Structure
MA TH
2
In order to generate values that have meaning, the source value must
not exceed 4095. In a 4x register group the source value will therefore
Block Structure
MA TH
3
If you specify a 4x register, the source value may be in the range 0 ...
99,999,99. The low-order half of the value is stored in the implied
register, and the high-order half is stored in the displayed register.
Block Structure
MA TH
4
The most significant bits are posted in the displayed register, and the
least significant bits are posted in the implied register. The largest
antilog value that can be calculated is 99770006 (9977 posted in the
displayed register and 0006 posted in the implied register).
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:
7.6.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Available as a loadable for the 984A, 984B, and 984X Chassis
Mount PLCs (SW-AP9x -Dx A loadable library)
Opcode
DE hex (default)
Block Structure
DMTH
1
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.
V 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
V The third and fourth implied registers store the high-order and
low-order halves of the double precision sum, respectively
V the fifth implied register is not used in the calculation but must
exist in state RAM
Block Structure
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.
V 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
V The second and third implied registers store the high-order and
low-order halves, respectively, of the absolute difference in double
precision format
V The fifth implied register is not used in this calculation but must
exist in state RAM
Block Structure
DMTH
3
V 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
V The last four implied registers store the double precision product
in the range 0 ... 9,999,999,999,999,999
Block Structure
ON = operand 1 divided by
operand 1 ON = operation successful
operand 2 and result posted
in designated registers
operand 2
ON = decimal remainder quotient ON = an operand out of range
OFF = fractional remainder remainder
DMTH
4 ON = operand 2 is 0
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.
V 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
V 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 deci-
mal, it is four digits long and only the fourth implied register is
used
8.1.1 Characteristics
Size
One full ladder logic network
PLC Compatibility
Standard in Quantum PLCs with Executive 2.0 or greater; unavailable
in earlier Quantums and for other PLC types
Block Structure
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
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
V When the equation passes power to the output from the second
row, the equation has completed successfully and the result is less
than zero
V When the equation passes power to the output from the third row,
the equation has completed successfully and the result is equal to
zero
V When the equation passes power to the output from the fourth
row, the equation has completed successfully and the result is
greater than zero
V 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 Content
The content of the Equation Network is in the form:
result := algebraic expression
where
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.
V If you enter a register with the suffix L appended to it, you indi-
cate that two contiguous registers containing a signed 32-bit long
integer variable are used—e.g., 400012L implies that register
400013 is also used
V If you enter a register with the suffix UL appended to it, you indi-
cate that two contiguous registers containing an unsigned 32-bit
long integer variable are used—e.g., 300006UL implies that regis-
ter 300007 is also used
V If you enter a register with the suffix F appended to it, you indi-
cate that two contiguous registers containing a floating point vari-
able are used—e.g., 400101F implies that register 400102 is also
used
A Boolean constant must have the suffix B appended to it. The only two
valid Boolean constants are #0B and #1B; no other values are legal
Boolean constants.
If you use one or more of the six relational operators shown in the
previous table, you are creating the first of three arguments that
comprise a conditional expression. The conditional operators must be
used to create Then/Else arguments in the expression , and method 2 is
used to execute the result . For example, in the equation:
and
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.
Nested Parentheses
When multiple levels of parenthetical data are nested in an expression,
the most deeply nested parenthetical data is evaluated first. An
Equation Network permits up to 10 nested levels of parentheses in an
expression.
Each pair of open and closed parentheses consumes two words in the
Equation Network.
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:
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:
V An absolute value operation does not change the data type of the
result.
401010F = SIN(#45)
and produce the result 0.8509035, whereas the 140 CPU 113 02/03 will
handle the same equation and produce the result 0.8509022.
401015F = TAND(#225)
401040 = TAND(#225)
A = ((B*C) + D E / SINE F)
Note: This equation was the only logic loaded to the Quantum PLCs
for the benchmark tests.
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.
5 EMTH Logic
Equation Network
0
CPU1130x CPU21304 CPU42402
V DX Move Operations
V R→T
V T→R
V T→T
V FIN
V FOUT
V SRCH
V BLKM
V BLKT
V TBLK
V IBKW
V IBKR
9.1.1 DX Tables
9.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
1C hex
9.2.2 Representation
Block Structure
ON copies source data and source Echoes state of the top input
increments the pointer value
R →T
ON resets the pointer value to zero
table length
Inputs
R→T 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
destination 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.
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.
9.2.3 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
pointer
30001 40340
10001
source destination
40340 ( ) 30001 40341
10002 00135
40342
R →T
40343
00005
40344
10003
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.
Note: No further R→T operations are possible while the two values
are equal, and the middle output continues to pass power regardless
of the state of the input.
Now let’s 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.
9.3.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
3C hex
9.3.2 Representation
Block Structure
ON copies data and increments source Echoes state of the top input
the pointer value table
T →R
ON resets the pointer value to zero table
length
Inputs
T→R 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.
The value stored in the pointer register indicates which register in the
source table 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.
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
pointer
40371
10001 40376
destination source
40376 ( ) 40377 40371
10002 00136 40372
T →R
40373
00005
40374
10003
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.
Note: No further T→R operations are possible while the two values
are equal, and the middle output continues to pass power regardless
of the state of the input.
Now let’s 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.
9.4.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
5C hex
9.4.2 Representation
Block Structure
ON copies data and increments source Echoes state of the top input
the pointer value table
T →T
ON resets the pointer value to zero table
length
Inputs
T→T 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.
Outputs
T→T 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.
The value stored in the pointer register indicates which register in the
source table will be copied to which register in the destination table.
Since the length of the two tables is equal and T→T 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.
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.
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
10001 40380
source destination
40380 ( ) 30001 40381
10002 00137
30002 40382
T →T 30003 40383
00003
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.
Note: No further T→T operations are possible while the two values
are equal, and the middle output continues to pass power regardless
of the state of the input.
Now let’s 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.
An FIN instruction has one control input and can produce three
possible outputs.
9.5.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
9C hex
Block Structure
FIN
Queue empty
queue
length
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.
V A 3x input register
V A 4x holding register
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.
FIN FIN
3333 3333 3333 4444 4444
Source 2222 2222 FOUT Source 3333
1111 1111 1111 2222
Queue Queue Destination Queue
An FOUT instruction has one control input and can produce three
possible outputs.
9.6.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
BC hex
Block Structure
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 empty—i.e., when the value in the queue pointer
register is zero.
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 .
9.7.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
DC hex
9.7.2 Representation
Block Structure
source
ON initiates search Echoes state of top input
table
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 .
register
40421 40430 source table content
pointer
10001 40421 = 1111
40430
40430 40500 40422 = 2222
40423 = 3333
10002 SRCH BLKM register
40424 = 4444
00005 0001 content
40425 = 5555 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.
9.8.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
7C hex
9.8.2 Representation
Block Structure
BLKM
table
length
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.
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 registers—if 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:
40109
10102 10101 10103
40201
BLKM
00008
40117
10103 10101 10102
40201
BLKM
00008
9.9.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in 110CPU512 and 110CPU612 Micro PLCs, in all
Quantum Automation Series PLCs, and in all Slot Mount and
Compact PLC models
Opcode
9F hex
9.9.2 Representation
Block Structure
BLKT
Reset pointer 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
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.
10001 00001
block
40020 = 1
40010
40020 destination
40020 40011 table
40012
BLKT 40021 Block 1
5 40013
5 40022
40014
40023
SUB
40024
40100
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.
9.10.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in 110CPU512 and 110CPU612 Micro PLCs, all Quan-
tum Automation Series PLCs, and all Slot Mount and Compact
PLC models
Opcode
DF hex
9.10.2 Representation
Block Structure
TBLK
Reset pointer block
length
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.
The value stored in the pointer indicates which block of data from the
source tablewill be copied to the destination block. This value specifies
a block number within the source table .
840 USE 101 00 DX Move Instructions 197
Bottom Node Content
The integer value entered in the bottom node specifies block
length —i.e., the number of 4x registers—of the destination block (and of
the blocks within the source table ). The valid range is from 1 ... 100.
40020 ( ) pointer
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.
Size
Three nodes high
PLC Compatibility
V Standard in all Quantum Automation Series PLCs
Opcode
51 hex
Block Structure
IBKR
length 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.
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 ( )
10001 000001
400001
IBKR
5 ( )
000002
Source Content
Register (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
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
Three nodes high
PLC Compatibility
V Standard in all Quantum Automation Series PLCs
Opcode
52 hex
9.12.2 Representation
Block Structure
IBKW
length 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 .
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
400001 ( )
10001 00001
400100
IBKW
5
Source Destination
Register Register
400100 = 400014
400101 = 400037
400102 = 400019
400103 = 400061
400104 = 400041
Source Content
Register (pointer)
400100 = 14
400101 = 37
400102 = 19
400103 = 61
400104 = 41
Destination
Pointer Content
400014 = 200
400037 = 400
400019 = 600
400061 = 800
400041 = 1,000
V DX Matrix Operations
V AND
V OR
V XOR
V COMP
V CMPR
source
bits 0 1 1 0
destination
0 0 0 0 1 1 1 0
bits
10.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
1D hex
Block Structure
AND
length
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.
source matrix
40600 = 1111111100000000 40601 = 1111111100000000
40600
10001
Original destination matrix
40604 40604 = 1111111111111111 40605 = 0000000000000000
AND
ANDed destination matrix
00002
40604 = 1111111100000000 40605 = 0000000000000000
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 .
source
0 1 1 0
bits
destination 0 0 0 1 1 1 1 1
bits
10.3.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
3D hex
Block Structure
OR
length
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.
source matrix
40600 = 1111111100000000 40601 = 1111111100000000
40600
10001
Original destination matrix
40606 40606 = 1111111111111111 40607 = 0000000000000000
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.
source
bits 0 1 1 0
destination
0 0 0 1 1 0 1 1
bits
10.4.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
DD hex
Block Structure
XOR
length
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.
source matrix
40600 = 1111111100000000 40601 = 1111111100000000
40600
10001
Original destination matrix
40608 40608 = 1111111111111111 40609 = 0000000000000000
XOR
00002 XORed destination matrix
40608 = 0000000011111111 40609 = 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.
10.5.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
BD hex
10.5.2 Representation
Block Structure
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
Top Node Content
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:
source matrix
40600 40600 = 1111111100000000 40601 = 1111111100000000
10001
40602
Complemented destination matrix
40602 = 0000000011111111 40603 = 0000000011111111
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 .
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
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
5D hex
10.6.2 Representation
Block Structure
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.
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.
40620 matrix a
10001 40620 = 1111000011110000 40621 = 1000000000000000
40622 ( ) matrix b
00043 40623 = 1111000011110000 40624 = 0000000000000000
10002
CMPR
00002 ( )
00044
10.7.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
7D hex
10.7.2 Representation
Block Structure
ON senses the bit loc bit Echoes state of the top input
location
SENS
Reset bit loc to 1 length bit loc > matrix length
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.
ST AT 40201 ( )
0012 00003
SENS
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.
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.
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.
10.8.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
9D hex
10.8.2 Representation
Block Structure
OFF = clear bit locs to 0 data Echoes state of the middle input
ON = set bit locs to 1 matrix
Increment bit loc after modification MBIT bit loc > matrix length
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.
Power passing to the output from the bottom node indicates an error
condition.
The BROT (bit rotate) instruction shifts the bit pattern in a source
matrix , then posts the shifted bit pattern in a destination matrix . The
bit pattern shifts left or right by one position per scan.
10.9.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types
Opcode
FD hex
10.9.2 Representation
Block Structure
source
ON shifts bit pattern in Echoes state of the top input
matrix
source matrix by one
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.
T →R ADD ADD
00084 40202 40201
( )
AVERAGE = 40301 . 40302
40201 40201
00003
40203 40201
DIV XOR
40301 00003
When contact 10006 passes power to the top node of the T→R
instruction, the value in the first register of the table (register 40101) is
copied into the middle node (40204) of the first ADD instruction. The
middle node of the DIV instruction (40203) holds the pointer value.
Because the top output of the T→R block is passing power, the first
ADD block receives power, causing the value copied to register 40204 to
be added to the value in register 40202. The initial value stored in
register 40202 is 0.
This routine continues until the value in the pointer register of the
T→R instruction (40203) increments to the table length —84. The
middle output in the T→R block then passes power to the DIV
instruction. The values in registers 40201 and 40202 are divided by 84.
The quotient is posted in register 40301, and the remainder is posted in
register 40302.
The top output from the DIV instruction passes power to the XOR
instruction. By using the XOR to exclusively OR the values in matrix
40201 ... 40203 with themselves, you clear the matrix to 0. The top
output of the XOR instruction passes power to coil 00003, indicating
that the current table averaging operation is complete and that a new
one should start.
V 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
V 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
Size
Three nodes high
PLC Compatibility
Not PLC-based instructions; reside in Modsoft panel software and are
executed as SKP instructions by the PLC
TC
TC
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.
V STAT
V HLTH
V PLC status
The full length—i.e., number of words—in 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.
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
Two nodes high
PLC Compatibility
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
Block Structure
ST AT
length
V 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
V For PLCs with 16-bit CPUs using the S908 RIO protocol—e.g. the
38x , 48x , and 68x Slot Mount PLCs—the available range of the
system status table is 1 ... 255
V For PLCs with 24-bit CPUs using the S908 RIO protocol—e.g.,
the 78x Slot Mount PLCs, the Quantum PLCs—the available
range of the system status table is 1 ... 277
V For Modicon Micro PLCs, the available range of the system status
table is 1 ... 56
840 USE 101 00 Remote I/O System Status 235
11.2 The S901 Status Table
The 75 words in the S901 status table are divided into three
sections—the 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:
1 Controller Status 01
2 02
3 Controller Status 03
4 S901 Status 04
5 Controller Stop State 05
6 Number of Segments in User Logic 06
7 Address of End-0f-Logic Pointer 07
8 RIO Redundancy and Timeout 08
9 ASCII Message Status 09
10 Run Load Debug Status 0A
11 Address of Status Word Pointer Table 0A
High Byte Low Byte
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
EOL Pointer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Word 10 uses its two most significant bits to display the RUN load
debug status:
0 0 = Debug
0 1 = Run
1 0 = Load
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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:
1 2 3 4 5 6 7 8 9 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 module’s COMM ACTIVE LED
is ON, the bit is 0; if slot contains an output module and the module’s
COMM ACTIVE LED is OFF, the bit is 1.
Note: These indicators are valid only when scan time > 30 ms.
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 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
The 277 words in the S908 status table are organized in three
sections— controller status, I/O module health, and I/O communication
health:
1 Controller Status 01
2 Hot Standby Status 02
3 Controller Status 03
4 RIO Status 04
5 Controller Stop State 05
6 Number of Ladder Logic Segments 06
7 End-of-logic (EOL) Pointer 07
8 RIO Redundancy and Timeout 08
9 ASCII Message Status 09
..10 RUN/LOAD/DEBUG Status 0A
11 0B
12 Drop 1, Rack 1 0C
..13 Drop 1, Rack 2 0D
... ... ... ...
16 Drop 1, Rack 5 0F
17 Drop 2, Rack 1 10
18 Drop 2, Rack 2 11
... ... ... ...
171 Drop 32, Rack 5 AB
172 S908 Startup Error Code 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 Global Communication Errors B3
180 Global Communication Errors B4
181 Global Communication Errors B5
182 Drop 1 Errors/Health Status and Retry Counters (in the B6
Compact 984 Controllers) (First word)
183 Drop 1 Errors/Health Status and Retry Counters (in the B7
Compact 984 Controllers) (Second word)
184 Drop 1 Errors/Health Status and Retry Counters (in the B8
Compact 984 Controllers) (Third word)
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Extended Memory Parity Error (for chassis mount controllers ) or Traffic Cop/S908
Error (for other controllers )
If the bit = 1 in a 984B Controller, an error has been detected in extended
memory; the controller will run, but the error output will be ON for XMRD/XMWT
functions. If the bit = 1 for any controller other than a chassis mount, then either a
traffic cop error has been detected or the S908 is missing from a multi-drop
configuration.
Peripheral Port Stop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Word 9 uses its four least significant bits to display ASCII message
status:
Debug = 0 0
Run = 0 1
Load = 1 0
Five words are reserved for each of up to 32 drops, one word for each of
up to five possible racks (I/O housings) in each drop. Bits 1 ... 16 in each
word represent the health of the associated I/O module in each rack.
1 2 3 4 5 6 7 8 9 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:
Word # 12
= Quotient + Remainder
5
where
Drop # = Quotient + 1
Rack # = Remainder + 1
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
start—it generates a stop state code of 10 (word 5):
W ord 173
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
W ord 176
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
W ord 177
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The third word in each group of three is the drop cumulative error
counter on Cable B for the appropriate drop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Note: For PLCs where drop 1 is reserved for local I/O, status words
182 ... 184 are used as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
word # 182
= quotient and remainder
3
quotient + 1 = drop #
remainder + 1 = word
1 Controller Status 01
2 02
3 Controller Status 03
4 04
5 Controller Stop State 05
6 Number of Ladder Logic Segments 06
7 End-of-logic (EOL) Pointer 07
8 Memory Sizing Word for Panel (in the 984-145 Com- 08
pact Controller)
9 09
10 RUN/LOAD/DEBUG Status 0A
11 0B
12 Rack 1 0C
13 Rack 2 0D
14 Rack 3 0E
15 Rack 4 0F
16 10
... ... ... ...
182 Systemwide I/O health status B9
183 I/O Error Count BA
184 PAB Bus Retry Count BB
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Debug = 0 0
Run = 0 1
Load = 1 0
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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Three conditions must be met before an I/O module can indicate good
health:
The last three words in the Compact PLC status table describe the
health of the communications on the installed A120 I/O modules.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
V 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 de-
tected, the PLC stops and displays error code 10 on the program-
ming panel. Normally, all bits in this word should be 0s.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 Controller Status 01
2 PLC Drop Address 02
3 Controller Status 03
4 Maximum number of I/O drops 04
5 Controller Stop State 05
6 Number of Ladder Logic Segments 06
7 End-of-logic (EOL) Pointer 07
8 08
9 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 Start-up Error Code Log 20
33 Global Communications Status (word 1) 21
... ... ... ...
36 Global Communications Status (word 4) 24
37 Rack 1 I/O Health Status 25
38 Rack 1 I/O Error Detection Counter 26
39 Rack 1 I/O Retry Counter 27
40 28
41 Communication health on an I/O expansion network 29
(parent PLC only)
... ... ... ...
56 Communication health on an I/O expansion network 38
(parent PLC only)
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Single Sweeps
Scan Has Exceeded Constant Sweep Target
Start Command Pending
First Scan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Mismatch between coil use table and ladder logic Fatal error in A120 I/O link
Invalid Node
Logic chksm error
Coil Disabled in
RUN Mode
Bad Config
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Word 8 is reserved.
Word 9 is reserved.
Debug = 0 0
Run = 0 1
Load = 1 0
Word 11 is reserved.
Rack 1 is always a Modicon Micro PLC. Racks 2 ... 4 are A120 I/O racks
connected to rack 1 via an A120 I/O expansion port.
Each word contains five representative bits that show the health of the
associated I/O unit in each rack—i.e., each rack can support a
maximum of five I/O locations:
Location 5
Location 4
Location 3
Location 2
Location 1
word # 12
= quotient + remainder
4
where
V quotient + 1 = drop #
V remainder + 1 = rack #
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 = unsuccessful communication to
a child Number of nonrecoverable com-
munication losses at any PLC
set-up on the I/O expansion net
for a child-mode PLC:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
W ord 34
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Number of times an error has been detected while communicating with I/O
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Words 41, 45, 49, and 53 have the following common format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 = unsuccessful communication
from parent to a specific child Number of nonrecoverable
1 = successful communication communication losses at the
at a specific child specific child
Words 42, 46, 50, and 54 have the following common format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Words 43, 47, 51, and 55 have the following common format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Words 44, 48, 52, and 56 have the following common format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
V S911 Health
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:
11.6.3 Characteristics
Size
Three nodes high
PLC Compatibility
Available as a loadable in all PLC types except:
Opcode
03F hex (default)
11.6.4 Representation
Block Structure
ON initiates the designated operation history Echoes state of the top input
HL TH
learn / monitor mode length ON = Error
The history matrix can range from 6 ... 135 registers in length. Below is
a description of the words in the history matrix. The information from
word 1 is contained in the displayed register in the top node and the
information from words 2 ... 135 is stored in the implied registers.
V Word 1: Enter drop number (range 0 ... 32) to be monitored for re-
tries
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
V Words 7 ... 10: Four words that define the learned condition of
drop 1
V Words 11 ... 14: Four words that define the learned condition of
drop 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ON = cable A monitored
ON = cable B monitored
1 = at least one disabled output has been found
V 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
Rack 1, slot 11, module found
Rack 1, slot 10, module found
Rack 1, slot 9, module found
Rack 1, slot 8, module found
Rack 1, slot 7, module found
Rack 1, slot 6, module found
Rack 1, slot 5, module found
Rack 1, slot 4, module found
Rack 1, slot 3, module found
Rack 1, slot 2, module found
Rack 1, slot 1, module found
1 2 3 4 5 6 7 8 9 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Third W ord
Rack 4, slot 10, module found
Rack 4, slot 9, module found
Rack 4, slot 8, module found
Rack 4, slot 7, module found
Rack 4, slot 6, module found
Rack 4, slot 5, module found
Rack 4, slot 4, module found
Rack 4, slot 3, module found
Rack 4, slot 2, module found
Rack 4, slot 1, module found
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The status matrix can range from 3 ... 132 registers in length. Below is
a description of the words in the status matrix. The information from
word 1 is contained in the displayed register in the middle node and the
information from words 2 ... 132 is stored in the implied registers.
1 2 3 4 5 6 7 8 9 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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Third W ord
Rack 4, slot 1, module fault
Rack 4, slot 2, module fault
Rack 4, slot 3, module fault
Rack 4, slot 4, module fault
Rack 4, slot 5, module fault
Rack 4, slot 6, module fault
Rack 4, slot 7, module fault
Rack 4, slot 8, module fault
Rack 4, slot 9,
module fault
Rack 4, slot 10,
module fault
Rack 4, slot 11,
module fault
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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 registers—i.e., the size of
the history matrix is length + 3.
11.6.5 HL TH Example
or
(2 x 4) + 3 = 11
40101
History Status
Matrix Matrix
40121
40101 40121
01408 HL TH
11
First Scan 40131
Detector 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.
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, it’s 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.
V DIOH
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.
The DIO table is divided into three sections, with 64 words reserved for
each of the three possible networks:
W ord Content
Slot 16
Slot 15
Slot 14
Slot 13
Slot 12
If the bit is set to 1, then the condition is healthy
1 2 3 4 5 6 7 8 9 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
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
Three nodes high
PLC Compatibility
V Standard in the CPU 113 02, CPU 113 03, and
CPU 213 04 Quantum Automation Series PLC
Opcode
20 hex
12.2.2 Representation
Block Structure
ON copies specified number of source Echoes the state of the top input
words from the status table
destination
DIOH
length ON = invalid source entry
(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.
13.1.1 Characteristics
Size
One node high
PLC Compatibility
Standard instruction in all PLC types
Opcode
V 0E hex if the number of networks to be skipped is specified as a
constant
Block Structure
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.
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.
( )
10003 00193
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.
V 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
V 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
One node high
PLC Compatibility
Not PLC-based instructions; reside in Modsoft panel software and are
executed as SKP instructions by the PLC
SKIP
SKPC
SKPR
V XMWT
V XMRD
Extended memory provides up to ten files, and each file can contain as
many as 10,000 registers ranging from 60000 ... 69999:
Optional sizes of extended memory are available for the various PLC
models that support it:
The total memory available may be up to 128K words, with either 32K
words or 64K words allocated for user logic memory so that:
V 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
V 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
V 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
16 bits page F
page 3
Executive PROM
Extended Memory
page 2 IOP Address Space
Extended Memory
page 1
Optional User Logic or
State RAM
Extended Memory
page 0
User Logic
Executive Scratchpad
ASCII Message Table
Loadable Instructions 16 bits
Traffic Cop Table
Segment Scheduler
Status Tables
Other Diagnostics
Configuration Table
24 bits
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.
14.3.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in 984B Chassis Mount PLCs
E984-785 and L984-785 Slot Mount PLCs, and
all Quantum Automation Series PLCs
Opcode
7E hex
14.3.2 Representation
Block Structure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
If you are in multi-scan mode, these six registers should be reserved for
use only by this instruction.
14.4.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in 984B Chassis Mount PLCs
E984-785 and L984-785 Slot Mount PLCs, and
all Quantum Automation Series PLCs
Opcode
9E hex
14.4.2 Representation
Block Structure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The READ instruction provides the ability to read data from an ASCII
input device (keyboard, bar code reader, etc.) into the PLC’s memory via
its RIO network. The connection to the ASCII device is made at an RIO
interface.
15.1.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in all PLC types that support S901 or S908 remote I/O
communications
Opcode
1E hex
Block Structure
ON pauses READ operation destination Error condition detected (for one scan)
READ
table
ON aborts READ operation READ complete (for one scan)
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The WRIT instruction sends a message from the PLC over the RIO
communications link to an ASCII display (screen, printer, etc.).
15.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in all PLC types that support S901 or S908 remote I/O
communications
Opcode
3E hex
Block Structure
control
ON pauses WRIT operation Error condition detected (for one scan)
block
WRIT
ON aborts WRIT operation table WRIT complete (for one scan)
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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:
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
Three nodes high
PLC Compatibility
Available only in the Micro PLCs
Opcode
hex
15.4.2 Representation
Block Structure
control
ON starts the comm operation Echoes state of the top input
block
COMM
ON aborts the operation and length ON = operation complete
sets the middle output (3 ... 255) (for one scan)
1 2 3 4 5 6 7 8 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 0 0 1 0
ninth implied register
Invalid operation type (format) selected in displayed register 0 0 1 1
V For a read operation with CR/LF, the format is satisfied when ei-
ther the selected number of items is input—i.e., taken out of the
output buffer—or 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
T ip In this format, only the local port can be used for messaging—i.e., a
parent PLC cannot monitor or control the signals on a child port.
Therefore, the port number specified in the fifth implied node of the
control block must always be 1.
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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.
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:
displayed
first implied
second implied
Step Data Table Set-up Registers
third implied
fourth implied
fifth implied
sixth implied 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 0 step 1
seventh implied 1 0 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 step 2
eighth implied 0 0 0 0 1 1 0 1 1 0 0 0 0 1 0 0 0 step 3
16.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
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
DRUM
Reset step pointer to 0 length 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
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 step—i.e., when the step pointer value = length . The
output from the bottom node goes ON if an error is detected.
Displayed masked output data Loaded by DRUM each time the block is
solved; contains the contents of the current
step data register masked with the output mask
register
First implied current step data Loaded by DRUM each time the block is
solved; contains data from the step pointer ;
causes the block logic to automatically calcu-
late register offsets when accessing step data
in the step data table
Second implied output mask Loaded by user before using the block, DRUM
will not alter output mask contents during logic
solve; contains a mask to be applied to the
data for each sequencer step
Third 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
Fourth 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 ma-
chine ID number must have the same profile ID
number
Fifth implied steps used 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 < table length in the bottom
node
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.
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
pointer register. As the pointer increments, ICMP moves through its
data table in lock step with DRUM. As ICMP moves through each new
step, it compares—bit for bit—the live input data to the expected status
of each point in its data table.
16.3.1 Characteristics
Size
Three nodes high
PLC Compatibility
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 step Echoes the state of the top input
pointer
A cascading input, telling the step data This comparison and all previous
block that previous ICMP table cascaded ICMPs are good
comparisons were all good
ICMP
Error
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.
Displayed raw input data Loaded by user from a group of sequential inputs
to be used by ICMP for current step
First implied current step data Loaded by ICMP each time the block is solved;
contains a copy of data in the step pointer ; causes
the block logic to automatically calculate register
offsets when accessing step data in the step data
table
Second implied input mask Loaded by user before using the block; contains a
mask to be ANDed with raw input data for each
step—masked bits will not be compared; masked
data are put in the masked input data register
Third implied masked input data Loaded by ICMP each time the block is solved;
contains the result of the ANDed input mask and
raw input data
Fourth implied compare status Loaded by ICMP each time the block is solved;
contains the result of an XOR of the masked input
data and the current step data ; unmasked inputs
that are not in the correct logical state cause the
associated register bit to go to 1—non-zero bits
cause a miscompare, and middle output will not
go ON
Fifth implied machine ID number Identifies DRUM/ICMP blocks belonging to a spe-
cific machine configuration; value range: 0 ... 9999
(0 = block not configured); all blocks belonging to
same machine configuration have the same ma-
chine ID number
Seventh implied steps used 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 num-
ber 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.
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.4.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in the Micro and Quantum Automation Series PLCs
Opcode
3F hex
16.4.2 Representation
Block Structure
step data
Operation-specific Operation-specific
table
SCIF
Reset step pointer to 0 length Error
(1 ... 255)
Inputs
SCIF has three control inputs. When the input to the top node is ON,
the drum or ICMP operation is initiated.
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
step—i.e., when the step pointer = length . In ICMP mode, this output
goes ON to indicate a valid input comparison.
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.
If Cycle Stop is requested, the drum sequence continues until the last
step in the step data table has been completed. If E-stop is pressed, the
drum sequencing stops immediately on the current step.
Caution: Running this example will fire live outputs. Use this
example only on a simulator , not on live machinery .
Network 1 controls the starting and stopping of the drum example. Coil
00128—Cyclestart SCIF_CONTR— indicates that the SCIF cycle has
started. Coil 00129—Seq_start SCIF_CONTR—indicates that the SCIF
sequence has started or restarted.
Network 1
00128
CycleStart
SCIF_CONTR
0001 #000
00130 00129
Last_step Seq_start
SCIF_CONTR SCIF_CONTR
0003 #000 0001 #000
Network 2
40150
Steppointr
SCIF_CONTR
40200
Dwelltable
SCIF_DWELL
SCIF
#0016
40201
Dwelltime
00129 SCIF_DWELL 00131
Seq_start Next_Step
SCIF_CONTR
T.01
40400
00131 00129 Junk_reg
Next_Step Seq_start SCIF_DWELL
SCIF_CONTR SCIF_CONTR
0002 #000 0001 #000
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 3
10017 40150
Input_1 Steppointr
00129
SCIF_ICMP SCIF_CONTR
Seq_start
SCIF_CONTR
0001 #000 40101 40100
ICMP_raw ICMP_mode
SCIF_ICMP SCIF_ICMP 00132
Compare_OK
BLKM SCIF
#0001 #0016
40150 40301
00129 Steppointr DRUMmasked
Seq_start SCIF_CONTR SCIF_DRUM
SCIF_CONTR
0001 #000
40300 00001
DRUM_mode Output_1
00131 00132 SCIF_DRUM
Next_step Compare_OK
SCIF_CONTR SCIF_CONTR
0002 #000 0003 #000
SCIF BLKM
#0016 #0001
00130
Last_step
SCIF_CONTR 00130
Last_step
0003 #000
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.
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
Three nodes high
PLC Compatibility
V Standard in most PLCs that do not support Modbus Plus—Excep-
tions: the 984A, 984B, and 984X Chassis Mount PLCs
Opcode
BF hex
Block Structure
CKSM
cksm select 2
length
Inputs
CKSM has three control inputs. The states of the inputs indicate the
type of checksum calculation to be performed:
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.
V MSTR Overview
V MSTR Function Error Codes
V Read and W rite MSTR Operations
V Get Local Statistics MSTR Operation
V Clear Local Statistics MSTR Operation
V W rite Global Data MSTR Operation
V Read Global Data MSTR Operation
V Get Remote Statistics MSTR Operation
V Clear Remote Statistics MSTR Operation
V Reset Option Module MSTR Operation
V Read CTE (Config Extension) MSTR Operation
V W rite CTE (Config Extension) MSTR Operation
V Modbus Plus Network Statistics
V TCP/IP EtherNet Statistics
18.1.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in PLCs that have built-in Modbus Plus capabilities
(Modbus Plus functionality only)
Opcode
BF hex
18.1.2 Representation
Block Structure
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 input—i.e., it goes ON while the
instruction is active. The output from the middle node echoes the state
of the middle input—i.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.
0 0 0 0 0 0 0 0 0 x x x x x x x
0 0 0 0 0 0 0 1 0 x x x x x x x
0 0 0 0 0 0 1 0 0 x x x x x x x
0 0 0 0 0 1 1 1 0 x x x x x x x
In the case of the EtherNet Read and Write CTE operations (see
sections 18.12 and 18.13), the middle node stores the contents of the
EtherNet configuration extension table in a series of registers.
The form of the function error code for Modbus Plus and SY/MAX
EtherNet transactions is Mmss , where
V ss represents a subcode
01 No response received
02 Program access denied
03 Node off-line and unable to communicate
04 Exception response received
05 Router node data paths busy
06 Slave device down
07 Bad destination address
08 Invalid node type in routing path
10 Slave has rejected the command
20 Initiated transaction forgotten by slave device
40 Unexpected master output path received
80 Unexpected response received
F001 Wrong destination node specified for the MSTR operation
An error on the TCP/IP EtherNet network itself may produce one of the
following errors in the MSTR control block :
The following error codes are returned if there is a problem with the
EtherNet configuration extension table (CTE) in your program
configuration.
V See page 367 for the listing of available Modbus Plus network
statistics
V See page 18.15 for the listing of TCP/IP EtherNet network statis-
tics
Note: If you are using the MSTR instruction for Modbus Plus
networking and your PLC does not support Modbus Plus option
modules (S985s or NOMs), the fourth implied register is not used.
The Clear local statistics operation clears statistics relative to the local
node—where the MSTR has been programmed. This operation takes
one scan to complete and does not require a data master transaction
path.
V See page 367 for the listing of available Modbus Plus network
statistics
Note: If you are using the MSTR instruction for Modbus Plus
networking and your PLC does not support Modbus Plus option
modules (S985s or NOMs), the fourth implied register is not used.
The Write global data operation (type 5 in the displayed register of the
top node) can be implemented only for Modbus Plus networks.
The registers in the MSTR control block (the top node) are used in a
Write global data operation:
Note: If your PLC does not support Modbus Plus option modules
(S985s or NOMs), the fourth implied register is not used.
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.
The Read global data operation (type 6 in the displayed register of the
top node) can be implemented only for Modbus Plus networks.
The registers in the MSTR control block (the top node) are used in a
Read global data operation:
Note: If your PLC does not support Modbus Plus option modules
(S985s or NOMs), the high byte of the fourth implied register is not
used and the high-byte bits must all be set to 0.
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
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.
The registers in the MSTR control block (the top node) contain the
following information in a Peer cop health operation:
Note: If your PLC does not support Modbus Plus option modules
(S985s or NOMs), the fourth implied register is not used.
Type of W ord
Status Index Bit-to-Network Node Relationship
Global
Input 0 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
1 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
2 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
3 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
Specific
Output 4 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
5 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
6 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
7 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
Specific
Input 8 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
9 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
10 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
11 64 63 62 61 60 59 58 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.
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.
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.
In a Read CTE operation, the registers in the MSTR control block (the
top node) differ according to the network in use:
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.
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.
In a Read CTE operation, the registers in the MSTR control block (the
top node) differ according to the network in use:
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.
Note: When you issue the Clear local or Clear remote statistics
operations, only words 13 ... 22 are cleared.
00 Node type ID
0 Unknown node type
1 PLC node
2 Modbus bridge node
3 Host computer node
4 Bridge Plus node
5 Peer I/O node
01 0 ... 11 Software version number in hex (to read, strip bits 12 15 from
word)
12 ... 14 Reserved
15 Defines Word 15 error counters (see Word 15)
Most significant bit defines use of error counters in Word 15. Least
significant half of upper byte, plus lower byte, contain software ver-
sion.
W ord Meaning
00 ... 02 MAC address
03 Board Status
04 and 05 Number of receiver interrupts
06 and 07 Number of transmitter interrupts
08 and 09 Transmit timeout error count
10 and 11 Collision detect error count
12 and 13 Missed packets
14 and 15 Memory error
16 and 17 Number of times driver has restarted lance
18 and 19 Receive framing error
20 and 21 Receiver overflow error
22 and 23 Receive CRC error
24 and 25 Receive buffer error
26 and 27 Transmit silo underflow
28 and 29 Late collision
30 and 31 Lost carrier
32 and 33 Number of retries
34 and 35 IP address
V Subroutine Overview
V JSR
V LAB
V RET
V A Subroutine Example
V CTIF
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.
Ladder logic subroutines allow you to save memory space in the user
logic table in cases where you need to implement the same logic
functions multiple times in a single scan. You need only create the logic
once, store it in the logic segment reserved for subroutines, and call it
from user logic whenever it is needed.
All ladder logic subroutines must be built in the last segment of user
logic. This segment must be removed from the segment scheduler—it is
not part of the regular order-of-solve table and is reserved for
subroutine and interrupt handling (Chapter 20) logic.
Note: This means that you must specify at least one more segment
than is required for regular user logic in the configuration table.
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
Two nodes high
PLC Compatibility
V Not available in the 984A/B/X Chassis Mount PLCs
Opcode
DE
Block Structure
Enables the source subroutine source Echoes state of the top input
JSR Error
????
Input
The input to the top node enables the source subroutine specified by the
number in the top node.
19.3.1 Characteristics
Size
One node high
PLC Compatibility
V Not available in the 984A/B/X Chassis Mount PLCs
Opcode
BE hex
Block Structure
LAB
Initiates the specified subroutine Error
subroutine
number
Input
The input to the top node initiates the subroutine or interrupt handler
specified by the number in the bottom node.
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
subroutine value, the lowest-numbered network is used as the starting
point for the subroutine.
19.4.1 Characteristics
Size
One node high
PLC Compatibility
V Not available in the 984A/B/X Chassis Mount PLCs
Opcode
FE hex
Block Structure
RET
Return to previous logic Error
00001
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
The node contains the constant value 00001.
840 USE 101 00 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:
Segment 001
Network 00001
Subroutine Segment
Segment 003
Network 00001
LAB 40256 40256 RET
00001 00001
Network 00002 00001 40256
00001 ADD SUB
40256 40256
JSR
10001 00001 40256
00010
SUB 00001
40999 JSR
00001
Segment 002
Network 00001
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.
Pre-assigned
Subroutine
INT 1 enable
Hardwire INT 1 LAB 2
Controlled by bits 7 and 8
INT 2 enable
Hardwire INT 2 LAB 3
(DC models only) Controlled by bits 5 and 6
INT 3 enable
User-selectable LAB 4
Hardwire Interrupt Controlled by bits 3 and 4
(see Note 1)
OR
TMR/CNTR enable
Timer / counter TMR / LAB 1
CTR Controlled by bits 9 and 10
(see Note 2)
Note 1. INT 3 is available only when the timer / counter is not used.
Note 2. Bits 15 and 16 select the mode (TMR or CTR). In CTR mode,
pulses on the input are counted. In TMR mode, the input acts
as a timer gate and must be high to time.
19.6.1 Characteristics
Size
Two nodes high
PLC Compatibility
V Standard in the Micro PLCs
Opcode
1F hex
Block Structure
CTIF
drop Error
number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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 Current count value of the timer/counter in-
put (set by the instruction block as the cur-
rent count in Get Mode; set by the user to
the counter/timer preset in Set Mode)
V Overview
V READ/WRIT
V PCFL/EMTH
V Equation Networks
V T1.0/T0.1/T.01 timers (will not set error bit 2, timer results inval-
id)
An interval timer can execute at any time during normal logic scan,
including system I/O updating or other system housekeeping
operations. The resolution of each interval timer is 1 ms. An interval
can be programmed in units of 1 ms, 10 ms, 100 ms, or 1 s. An internal
counter increments at the specified resolution.
20.2.1 Characteristics
Size
Two nodes high
PLC Compatibility
V Standard in all Quantum PLCs
Opcode
4516
Block Structure
ITRM
timer Error
number
Input
When the top input is energized, the ITRM instruction is enabled. It
begins counting the programmed time interval. When that interval has
expired the counter is reset and the designated error handler logic
executes.
When the top input is not energized, the following events occur:
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 = instruction disabled
1 = instruction enabled
0 = Enable OFF resets counter
1 = Enable OFF holds counter
0 = PLC stop resets counter
1 = PLC stop holds counter
0 0 = 1 ms time base
0 1 = 10 ms time base
1 0 = 100 ms time base
1 1 = 1 s time base
Timer number used in previous network
No LAB or invalid LAB
Execution overrun
Mask interrupt overrun
Time = 0
Invalid block in the interrupt handler subroutine
Execution delayed because of interrupt mask
In the third register of the control block , specify a value indicating the
label (LAB) number that will start the interrupt handler subroutine,
The number must be in the range 1 ... 1023.
BMDI instructions can be used to reduce the time between the disable
and enable of interrupts. For example, BMDI instructions can be used
to protect the data used by the interrupt handler when the data is
updated or read by Modbus, Modbus Plus, Peer Cop, or Distributed I/O
(DIO).
Size
One node high
PLC Compatibility
V Standard in Quantum PLCs
Opcode
4716
Block Structure
Input
When the input is energized, the ID instruction masks timer-generated
and/or local I/O-generated interrupts.
Outputs
The output echoes the state of the input.
Node Content
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:
Size
One node high
PLC Compatibility
V Standard in Quantum PLCs
Opcode
4816
Block Structure
Input
When the input is energized, the IE instruction unmasks interrupts
from the timer or local I/O module and responds to the pending
interrupts by executing the designated subroutines.
Outputs
The output echoes the state of the input.
Node Content
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:
Size
Three nodes high
PLC Compatibility
V Standard in Quantum PLCs
Opcode
4916
Block Structure
BMDI
table
length
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.
20.4.1 Characteristics
Size
Two nodes high
PLC Compatibility
V Standard in Quantum PLCs
Opcode
BB16 Block Structure
IMIO
Error
type
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 cod e in the error status register in the IMIO control block , which is
described below..
398 Ladder Logic Interrupt Handling 840 USE 101 00
Top Node Content
The 4 x register in the top node is the first of two contiguous registers in
the IMIO control block . The first (the displayed) register in the control
block specifies the physical address of the I/O module to be accessed.
The second (the implied) register in the control block logs the error
status, which is maintained by the instruction.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 0 1 = rack 1* 0 0 0 0 1 = slot 1
0 1 0 = rack 2 0 0 0 1 0 = slot 2
0 1 1 = rack 3 0 0 0 1 1 = slot 3
1 0 0 = rack 4 0 0 1 0 0 = slot 4
0 0 1 0 1 = slot 5
Local racks 1-4 are supported 0 0 1 1 0 = slot 6
by Compact PLCs 0 0 1 1 1 = slot 7
0 1 0 0 0 = slot 8
* Only rack 1 is currently supported 0 1 0 0 1 = slot 9
by Quantum PLCs 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.
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.
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 PV (Input)
(Output) Control E +
Calculation SP
Derivative
xn Contribution
xn 1 + xn
+
(4y + 6) 8 (4y + 6) 8
∆Pv ∆x
60(RGL 1)K3
PV + RGL
RGL Ts
4x 13 Zn
E E
SP + +
Proportional
(4x 1 4x 2) Contribution
x 4095 100
(4x 11 4x 12) PB
GE
+
Output
Bias + Clamp Mn
4x 8 +
Integral 4x 17 4x 2
Feedback Integral 4x 18
In
Mn 1 F Contribution
loc
4x16 +
M Preload Qn
Mode Integral
Tloc Clamp
4x 20 Wn
+ ∆I
K2 Ts
600000
In 1 + In
In 1 + 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
K1 = 100
PB
Proportional Control
With proportional-only control (P), you can calculate the manipulated
variable by multiplying error by a proportional constant, K1, then
adding a bias:
Mv = K1E + bias
t
Mv = K1(E + K2 ∫ E∆t)
0
Proportional-Integral-Derivative Control
You may want to add derivative functionality to the control equation to
minimize the effects of frequent load changes or to override the integral
function in order to get to the SP condition more quickly:
t
Mv = K1(E + K2 ∫ E∆t + K3
∆PV
∆t
)
0
21.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
Standard in all PLC types except the 984A/B/X Chassis Mounts, where
it is available as a loadable
Opcode
5E hex
Block Structure
PID2
0 = Output increases as E increases solution PV ± low alarm limit
1 = Output decreases as E increases 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
PID2 can produce three possible outputs, each indicating an error
condition.
P ON ON
PI ON ON
PID ON ON ON
Displayed Loop Status Regis- Twelve of the 16 bits in this register are used to de-
ter fine loop status:
1 2 3 4 5 6 7 8 9 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)
V The current value in the real-time clock is stored in the first im-
plied register
First implied Error (E) Status Bits This register displays PID2 error codes:
zero.
Second implied Loop Timer Regis- This register stores the real-time clock reading on
ter the system clock each time the loop is solved: the
difference between the current clock value and the
value stored in the register is the elapsed time; if
elapsed time ² solution interval (10 times the value
given in the bottom node of the PID2 block), then
the loop should be solved in this scan
Third implied For Internal Use Integral (integer portion)
Fourth implied For Internal Use Integral—fraction 1 (1/3,000)
Fifth implied For Internal Use Integral—fraction 2 (1/600,000)
Sixth implied Pv x 8 (Filtered) This register stores the result of the filtered analog
input (from register 4x 14) multiplied by 8; this value
is useful in derivative control operations
Seventh implied Absolute Value of This register, which is updated after each loop solu-
E tion, contains the absolute value of (SP PV); bit 8
in register 4y + 1 indicates the sign of E
Eighth implied For Internal Use Current solution interval
Inlet Vent
Plant
Inlet
FCV
Inlet Block
LT
1
LSH Gas
1
LC PV 1
1
LSL
1
LV
I/P FC
1
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.
0 0
SUB SUB
40113 40500
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:
Numeric Meaning
Numeric Meaning
40111 4000 High engineering range (mm) The scaled value of the process
variable when the raw input is at
4095
40112 0000 Low engineering range (mm) The scaled value of the process
variable when the raw input is at 0
40113 Raw analog measure (0 ... 4095) A copy of the input from the analog
input module register (30001) cop-
ied by the first SUB
40114 0000 Offset to loop counter register Zero disables this feature.
Normally, this is not used
40115 0000 Max loops solved per scan See register 40114
40116 0102 Pointer to reset feedback If you leave this as zero, the PID2
function automatically supplies a
pointer to the loop output register. If
the actual output (40500) could be
changed from the value supplied by
PID2, then this register should be
set to 500 (40500) to calculate the
integral properly
40117 4095 Output clamp high (0 ... 4095) Normally set to maximum
40118 0000 Output clamp low (0 ... 4095) Normally set to minimum
40119 0015 Rate Gain Limit Constant (2 ... 30) Normally set to about 15. The actu-
al value depends on how noisy the
input signal is. Since we are not us-
ing derivative mode, this has no ef-
fect on PID2
40120 0000 Pointer to track input Used only if the PRELOAD feature
is used. If the PRELOAD is not
used, this is normally zero
The values in the registers in the 40200 destination block are all set by
the PID2 block.
V Advanced calculations
V Signal processing
V Regulatory control
PCFL uses the same FP library as EMTH. If the PLC that you are
using for PCFL does not have the onboard 80x87 math coprocessor
chip, calculations take a comparatively long time to execute. PLCs with
the math coprocessor can solve PCFL calculations ten times faster than
PLCs without the chip. Speed, however, should not be an issue for most
traditional process control applications where solution times are
measured in seconds, not milliseconds.
21.3.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Standard in the E984-685 and E984-785 Slot Mount PLCs and in
the Quantum Automation Series PLCs. Some operations are not
available on all of the above PLC types; for details see the table
beginning on page 416
Opcode
7B hex
Block Structure
PCFL Error
length
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.
Within the parameter block of each PCFL function are two registers
used for input and output status.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Standard outputs
1 2 3 4 5 6 7 8 9 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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = Timer override
1 = Function initialization complete or in progress
0 = Initialize the function
21.4.1 AVER
(k + (w 1 x In 1 ) + (w 2 x In 2 ) + (w 3 x In 3 ) + (w 4 x In 4 ))
result =
1 + w1 + w2 + w3 + w4
where
Block Structure
PCFL
24 Error
Standard outputs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = no inputs activated
0 = result positive
1 = result negative
Third implied Input status:
Standard inputs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = k is active
1 = In 1 and w 1 are used
1 = In 2 and w 2 are used
1 = In 3 and w 3 are used
1 = In 4 and w 4 are used
Fourth and fifth implied Value of In 1
Sixth and seventh implied Value of In 2
Eighth and ninth implied Value of In 3
10th and 11th implied Value of In 4
12th and 13th implied Value of k
14th and 15th implied Value of w 1
16th and 17th implied Value of w 2
18th and 19th implied Value of w 3
20th and 21th implied Value of w 4
22nd and 23rd implied Value of result
21.4.2 CALC
PCFL
14 Error
Register Content
Standard outputs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 0 0 1 = (A * B ) + (C * D )
0 0 1 0 = (A * B ) (C * D )
0 0 1 1 = (A * B ) / (C *D )
0 1 0 0 = A / (B * C * D )
0 1 0 1 = (A * B * C ) / D
0 1 1 0=A *B *C *D
0 1 1 1=A +B +C +D
1 0 0 0=A * B (C D)
1 0 0 1=A [ (B / C ) D ]
1 0 1 0=A * LN(B / C )
1 0 1 1=A B ) (C D ) / LN[ (A B) / (C D) ]
1 1 0 0 = (A / B ) C / D
1 1 0 1 = (A B ) / (C D)
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
PCFL
15 ... 64 Error
Register Content
1 2 3 4 5 6 7 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
Standard inputs for display in Modsoft
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
arctangent = 1 0 0 1 1
arccosine = 1 0 0 1 0
arcsine = 1 0 0 0 1
tangent = 1 0 0 0 0
cosine = 0 1 1 1 1
sine = 0 1 1 1 0
subtraction = 0 1 1 0 1
square root = 0 1 1 0 0
power = 0 1 0 1 1
negation = 0 1 0 1 0
multiplication = 0 1 0 0 1
LOG (logarithm) = 0 1 0 0 0
LN (natural logarithm) = 0 0 1 1 1
exponent = 0 0 1 0 0
division = 0 0 0 1 1
addition = 0 0 0 1 0
absolute value = 0 0 0 0 1
no operation = 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.5.1 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:
Deadband
When enabled, the DB option is incorporated into the HH/H/LL/L
limits. These calculated limits are inclusive of the more extreme
range—e.g., if the input has been in the high range, the output remains
high and does not transition when the input hits the calculated H limit.
Operations
A flag is set when the input or deviation equals or crosses the
corresponding limit. If the DB option is used, the HH, H, LL, L limits
are adjusted internally for crossed-limit checking and hysteresis.
PCFL
Error
16
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = L crossed (x ± L, or
(LL < x ± L) with HH/LL option set)
1 = LL crossed (x ± LL)
1 = deviation mode chosen with DB option
1 = DB set to negative number
Third implied Input status:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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:
Range
PCFL Error
14
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 0 0 0 0 = 1 ... 4,096
984 0 0 0 0 1 = 4,096 ... 8,192
Ranges 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
21.5.3 AOUT
PCFL
Error
9
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.5.4 DELA Y
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.
Block Structure
PCFL Error
32
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
x y
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.
Block Structure
PCFL Error
39
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 16
0
21.5.6 INTEG
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.
PCFL Error
16
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Reset sum
Standard input bits
Fourth implied Time register
Fifth implied
Sixth and seventh implied ∆t (in ms) since last solve
Eighth and ninth implied Solution interval (in ms)
10th and 11th implied Last input
12th and 13th implied Reset value
14th and 15th implied Result
21.5.7 LLAG
For best results, use lead and lag terms that are ² 4 *nt. This will
ensure sufficient granularity in the output response.
840 USE 101 00 Closed Loop Control Instructions 433
LLAG returns a DXDONE message when the operation completes.
Block Structure
PCFL Error
20
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.5.8 LIMIT
PCFL Error
9
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.5.9 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.
PCFL
Error
14
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.5.10 MODE
In auto mode, the input is copied to the output. In manual mode, the
output is overwritten by a user entry.
Block Structure
PCFL Error
8
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Echo mode
1 = manual mode
0 = auto mode
Third implied Input status:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = manual mode
0 = auto mode
Standard input bits
Fourth and fifth implied Manual input
Sixth and seventh implied Output register
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 in-
put register are specified
V A positive rate toward the target set point—negative rates are il-
legal
Block Structure
PCFL Error
14
Register Content
1 2 3 4 5 6 7 8 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
Third implied Input status:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.5.12 RMPLN
V The target set point, in the same units as the contents of the in-
put register are specified
V 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.
RMPLN terminates when the input reaches the target set point + the
specified DB and returns a DXDONE message.
Block Structure
PCFL Error
16
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = ramping up
1 = ramping down
1 = ramp complete
0 = ramp in progress
1 = DB or τ set to negative number
Third implied Input status:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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.
Block Structure
PCFL Error
14
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Block Structure
PCFL Error
14
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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
Note:
Y h ig h ± Y ± Y lo w
with
.....YP , YI , YD = f(XD )
XD = SP X ¦ (GRZ * (1 KGRZ )) gain reduction zone used
XD = SP X gain reduction zone not used
Proportional Calculation
YP = KP * XD proportional bit ON
YP = 0
Integral Calculation
nt XD_1 + XD
YI = YI + KP * *
TI 2 integral bit ON
YI =0
Derivative Calculation
DXD = X_1 X base derivative or PV
DXD = XD XD_1
YD =0
where:
V A reset mode
Block Structure
PCFL Error
64
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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
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:
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
parameter
block
PCFL Error
14
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
21.6.4 PID
Block Structure
PCFL
44 Error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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 sixth and seventh implied Set point, SP
Eighth and ninth implied Manual output
10th and 11th implied Summing junction, Bias
Outputs 12th and 13th implied Error, XD
14th implied Previous operating mode
15th and 16th implied Elapsed time (in ms) since last solve
17th and 18th implied Previous system deviation, XD_1
19th and 20th implied Previous input, X_1
21st and 22nd implied Integral part of output Y, YI
23rd and 24th implied Differential part of output Y, YD
25th and 26th implied Proportional part of output Y, YP
27th implied Previous operating status
The process variable over time should look something like this:
22
20
Time
7 Points Defined
In Look Up table
100 *
*
80
*
60
50 * Linearized Signal
40
* Actual Input
20
*
0 Input
20 40 50 60 80 100
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
The PID function is actually controlling the process simulated by this
logic:
The solution intervals for the LLAG filters do not affect the process
dynamics and were chosen to give fast updates. The solution interval
for the DELAY queue is set at 1000 ms with a delay of 5 intervals—i.e.,
5 s. The LLAG filters each have lead terms of 4 s and lag terms of 10 s.
The gain for each is 1.0.
(4S + 1) (4S + 1) e 5S
Gp (S) =
(10S + 1) (10S + 1)
PID Parameters
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%.
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.
21.6.6 PI
Block Structure
PCFL Error
36
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = manual mode
1 = reverse action for loop output
1 = halt mode 0 = direct action for loop output
Inputs sixth and seventh implied Set point, SP
Eighth and ninth implied Manual output
10th and 11th implied Calculated control difference (error), XD
Outputs 12th implied Previous operating mode
13th and 14th implied ∆t (in ms) since last solve
15th and 16th implied Previous system deviation, XD_1
17th and 18th implied Integral part of output Y
19th and 20th implied Previous input, X_1
21st implied Previous operating status
T iming 22nd implied 10 ms clock at time n
Information 23rd implied
24th and 25th implied Solution interval (in ms)
Input Parameters 26th and 27th implied Proportional rate, KP
28th and 29th implied Reset time, TI
30th and 31st implied High limit on output Y
32nd and 33rd implied Low limit on output Y
Output 34th and 35th implied Manipulated variable output, Y
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
PCFL Error
20
Register Content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 = input 1 active
1 = input 2 active
1 = input 3 active
1 = input 4 active
21.6.8 TOT AL
The function uses up to three different set points—a 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 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.
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 sum—e.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
PCFL Error
28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
V HSBY
V CALL
V MBUS
V PEER
V Custom Loadables
V EARS
V EUCA
V The sequence control loadables DRUM and ICMP, which are de-
scribed in Chapter 16 (see pages 320 and 323, respectively)
22.2.1 Characteristics
Size
Three nodes high
PLC Compatibility
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
HSBY
Enable nontransfer area length
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Register Content
Displayed and first implied reversetransfer registers for passing information from the
standby to the primary PLC
Second implied HSBY status register :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The content of the remaining registers is application-specific; the length is defined in the
bottom node.
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.
00801
BLKM
00001
40100
00815 00816 ST AT
00001
40100
00813 00814
00705
BLKM
00001
( )
00715 00813 00208
( )
00716 00813 00209
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.
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.
You may use the configuration extension screens to define and control
the Hot Standby configuration while inserting a CHS instruction in
ladder logic to access the CHS Zoom screen in Modsoft. The CHS Zoom
screen allows you to access the Hot Standby command and status
registers, and it is an easy way to perform PLC executive upgrades
without shutting down the system. For more details, refer to the
Quantum CHS 110 Hot Standby Planning and Installation Guide .
If you are using the CHS instruction in ladder logic, the only difference
between it and the HSBY instruction is the use of an output from the
bottom node. This output senses whether or not method 2 has been
used. If the Hot Standby configuration extension screens have been
used to define the Hot Standby configuration, the configuration
parameters in the screens will override any different parameters
defined by the CHS instruction at system startup.
468 Loadable Instructions 840 USE 101 00
Method 2: The Modsoft Configuration Extension Screens
Method 2 is designed to make the Hot Standby configuration process
more versatile. The details of the configuration are all defined in a pair
of configuration extension screens in Modsoft. Although the CHS
software must be loaded to the PLC, the instruction itself does not need
to be entered in the ladder logic program. If you use method 2 and
insert a CHS instruction in the logic, the parameters defined in the
configuration extension screens will override attempts you have made
to configure the Hot Standby system in ladder logic at the time of
startup.
V Your ability to reduce the amount of state RAM data in the trans-
fer 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
Size
Three nodes high
Does not support Hot Standby in any non-Quantum PLCs (see the
HSBY instruction on page 464)
Opcode
22.3.3 Representation
Block Structure
CHS
Enable nontransfer area length Configuration extension screens
are defining the Hot Standby configuration
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 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.
22.4.1 Characteristics
Size
Three nodes high
PLC Compatibility
Available as a loadable in PLC types that support a C986 Copro module
Opcode
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
source
table
A Deferred DX CALL
CALL
Error in deferred DX function
length
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.
Immediate DX Functions
Deferred DX Functions
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 mod-
ule, then perform a sequence of Get Data transfers from the mod-
ule 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.
22.5.2 Characteristics
Size
Three nodes high
PLC Compatibility
Available as a loadable in all Quantum PLC types (186, 386, 486, etc.)
22.5.3 Representation
Block Structure
Enable the subfunction subfunction # Echoes the state of the top input
(1 ... 4)
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:
Middle Node
The middle node contains the first 4x register in a list of contiguous
registers that define the subfunction parameters needed to run the
command sequence:
Bottom Node
The bottom node contains the length of the table in the middle
node—i.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.
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.
401000
ESI
#0010
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
400201 400101
000011 400101 400001
BLKM BLKM
#0012 #0012
Second Network
The module start register in the input register is also tested against the
module start register in the workspace to make sure that are the same.
If both these tests show matches, test the status word valid bit in
response word 0. To do this, AND response word 0 in the input register
with 8000 hex to get rid of the echoed command word 0 information. If
the ANDed result equals the status word valid bit, coil 000020 is
turned ON indicating an error and/or status in the module status word.
482 Loadable Instructions 840 USE 101 00
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 000099
#0001
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.
When the top node of the ESI instruction is 2, the PLC invokes the
module and causes it to execute one Write ASCII command. Before
starting the Write command, subfunction 2 executes a sequence of Put
Data transfers (transferring up to 16,384 registers of data) from the
PLC to the module.
Note: If the data count and starting register number that you
specify are valid but some of the registers to be read are beyond the
valid register range, only data from the registers in the valid range
will be read. The data count returned in word 0 of the response
structure will reflect the number of valid data registers returned, and
an error code (1280 hex) will be returned in the module status word
(word 11 in the response table).
Note: If the data count and starting register number that you
specify are valid but some of the registers to be written are beyond
the valid register range, only data from the registers in the valid
range will be written. The data count returned in word 0 of the
response structure will reflect the number of valid data registers
returned, and an error code (1280 hex) will be returned in the module
status word (word 11 in the response table).
#0004
401000
ESI
#0008
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
Second Network
( )
000020 000020
300001
000011 000020 400101
300002
TEST
400102 400102
#0001
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
400102 400102
000012
#0100 #0110
TEST TEST
#0001 #0001
400511 400521
400103 400103
BLKM BLKM
#0010 #0010
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.
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.
The low byte of the module status word defines status conditions. The
high byte defines module status error conditions (when bit 7 is set).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The S975 Modbus II Interface option modules use two loadable function
blocks—MBUS 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.
22.6.1 Characteristics
Size
Three nodes high
PLC Compatibility
Available as a loadable in PLC types that support an S975 Modbus II
module
Opcode
1F hex (default)
Block Structure
control
Enable MBUS transaction Transaction complete
block
data
Repeat transaction in same scan block
Transaction in progress or new
transaction starting
MBUS
Clears system statistics length Error detected in transaction
Register Function
Displayed Address of destination device (range: 0 ... 246)
4x + First implied
Second implied Function code for requested action:
01 Read discretes
02 Read registers
03 Write discrete outputs
04 Write register outputs
255 Get system statistics
Third implied Discrete or register reference type:
0 Discrete output (0x )
1 Discrete input (1x )
3 Input register (3x )
4 Holding register (4x )
Fourth implied Reference number—e.g., if you placed a 4 in the third im-
plied register and you place a 23 in this register, the refer-
ence will be holding register 40023
Fifth implied Number of words of discrete or register references to be
read or written; the length limits are:
Read register 251 registers
Write register 249 registers
Read coils 7,848 discretes
Write coils 7,800 discretes
Sixth implied Time allowed for a transaction to be completed before an
error is declared; expressed as a multiple of 10 ms—e.g.,
100 indicates 1,000 ms; the default timeout is 250 ms
V 490 for reading discretes using 24-bit CPUs: 255 for reading dis-
cretes using 16-bit CPUs (up to 16 discretes/word)
V 487 for writing discretes using 24-bit CPUs; 255 for reading dis-
cretes using 16-bit CPUs (up to 16 discretes/word)
Issuing function code 255 in the second implied register of the MBUS
control block obtains a copy of the Modbus II local statistics—a 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 46—a length < 46 returns an error
(the bottom output will go ON), and a length > 46 reserves extra
registers that cannot be used. For example:
41000
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
The S975 Modbus II Interface option modules use two loadable function
blocks—MBUS 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
Three nodes high
PLC Compatibility
Available as a loadable in PLC types that support an S975 Modbus II
module
Opcode
3F hex (default)
22.7.2 Representation
Block Structure
control
Enable MBUS transaction Transaction complete
block
data
Repeat transaction in same scan block
Transaction in progress or new
transaction starting
PEER
length Error detected in transaction
Naming Subfunctions
In addition to an individual ID number, each subfunction in a
customized block must be assigned a name. The name may contain
from one to four alphabetical characters, either upper or lower case.
The programmer creates a separate file—the subfunction list
file—where a subfunction ID number is linked to its subfunction name,
and the name can be used by utility tools to access and display the
subfunction and its specific characteristics.
22.8.2 Characteristics
Size
Three nodes high
PLC Compatibility
Available as a loadable in all PLC types except the 984A/B/X Chassis
Mounts
Opcode
5F hex (default)
22.8.3 Representation
Block Structure
subfunction
Middle input Middle output
table
(optional) (optional)
When the PLC detects a change between the current state bit and the
history bit for an event, the EARS instruction prepares a two-word
message and places it in a buffer where they can be off-loaded to a host
MMI. This message contains:
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.
Buffer Reset—event table and top node EARS Buffer full—no events can
pointers cleared to 0 length be added until host off-loads
some or until Buffer Reset
Register Content
Displayed Indirect pointer to the current state table—e.g., if the register contains
a value of 5, then the state table begins at register 40005; the indirect
pointer register must be hard-coded by the programmer
First implied Contains a value in the range 1 ... 62 that specifies the number of
registers in the current state table; this value must be hard-coded by
the programmer
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2n n 2n n 2n n
1 0 256 8 65536 16
2 1 512 9 131072 17
4 2 1024 10 262144 18
8 3 2048 11 524288 19
16 4 4096 12
32 5 8192 13
64 6 16384 14
128 7 32768 15
Note: The real time clock in the chassis mount controllers has a
tenth-of-a-second resolution, but the other 984s have real time clock
chips that resolve only to a second. An algorithm is used in EARS to
provide a best estimate of tenth-of-a-second resolution—it is accurate
in the relative time intervals between events, but it may vary slightly
from the real time clock.
22.10.1 Characteristics
Size
Three nodes high
PLC Compatibility
V Available as a loadable in the E984-685 and E984-785 Slot Mount
PLCs and in the Quantum Automation Series PLCs
Opcode
01F hex (default)
Block Structure
ON initiates the conversion alarm Echoes the state of the top input
status
HA1 HW1 LW1 LA1 HA2 HW2 LW2 LA2 HA3 HW3 LW3 LA3 HA4 HW4 LW4 LA4
At any given time a nibble selected by the value in the bottom node
displays one alarm condition:
unused
Setup
Programming the EUCA block is accomplished by selecting the EUCA
loadable and writing in the data as illustrated in the Modsoft screen
below:
100 V
90
80
High Alarm
70
60 High Warning
50 Normal
46 *
40 Low Warning
30 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 2
Error
Figure 1
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.
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
set—then the signal falls into the DB zone.
The same action would be seen if the signal were generated through
the low settings.
22.10.5 Example 3
As you observe the status content of register 40209 you see; no alarm in
block 1, an LW alarm in block 2, an HW alarm in Block 3, and an HA
alarm in block 4.
The alarm conditions for the four blocks can be represented with the
following table settings:
V Scan Time
V Maximizing Throughput
V Sweep Functions
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:
Logic solve time is the time it takes the CPU to solve the elements and
instructions used in the logic program. It is a part of the total scan time
that is independent of I/O service time and system overhead time. Logic
solve time is measured in ms/Kwords of user logic. Various PLC models
have different logic solve times, as shown below:
Segment 1
Service
Outputs
Read
Inputs
Segment 2 IST
= Logic Solve Time
Service
Outputs = Other Elements of
Scan Time
Segment 3 IST
Service
Outputs
Read
Inputs
IST
Overhead
This method of I/O servicing assures that the most recent input status
is available for logic solve and that outputs are written as soon as
possible after logic solve. It ensures predictability between the PLC
and the process it is controlling.
Service
Outputs
Read
Drop 2
Inputs
Segment 2 IST
= I/O Service Time
Service for Drop 2
Outputs
= Other Elements of
Scan Time
Segment 3 IST
Service
Drop 2
Outputs
Read
Inputs
IST
Overhead
A.1.3 Overhead
Service
Outputs
Read
Inputs
Segment 2 IST
= Overhead
Service Support Time
Outputs = Other Elements of
Scan Time
Segment 3 IST
IST
Service
Outputs
Read
Inputs
IST
Overhead
( )
01000
00500
01000
UCTR
00999
40001
10001
T.01
40003
10001
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.
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.
PLC
10001 Segment 1
( )
I/O
Drop 1 10001 00001
00001
I/O
Drop 2
I/O
Drop 3
Segment 1
Service
Drop 3
Outputs
Read
Inputs
Segment 2 IST
Service
Outputs
Event A
Read
Scan 1 Drop 3
Inputs
Service
Outputs
Event C
Read
Inputs
IST Event D
Overhead
Segment 1
Event E
Service
Drop 3
Outputs
Scan 2
Read
Inputs
V Event A, where the inputs from drop 3 are available to the I/O
processor
V Event D, where data are transferred from state RAM to the I/O
processor
V Event E, where the output data are written to the output modules
at drop 3
You specify the number of segments and I/O drops with the
configurator editor in your panel software package. The default
order-of-solve condition is segment 1 through segment n consecutively
and continuously, once per scan, with the corresponding I/O drops
serviced in like order. You are able to change the order of solve using
the segment scheduler editor in your panel software package.
There may be times when you can modify the order of solve to improve
overall system performance. The segment scheduler can be used
effectively to:
Here is what a default order of solve might look like, as seen in the
Modsoft segment scheduler editor:
F1 F2 F3 F4 F5 F6 F7 F8 F9 L
SEGMENT - SCHEDULER
Number of Drops : 3
Min Register :
Constant Sweep : OFF Scan Time --- ms 4----
Suppose that your logic program is three segments long and that
segment 3 contains logic that is critical to your application—for
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.
Segment 1
Service
Drop 3
Outputs
Read
Drop 3
Inputs
Segment 3 IST
Service
Drop 1
Outputs
Read
Drop 2
Inputs
Read
Drop 3
Inputs
Segment 3 IST
Service
Drop 2
Outputs
Read
Drop 1
Inputs
IST
Overhead
F1 F2 F3 F4 F5 F6 F7 F8 F9 L
SEGMENT - SCHEDULER
Number of Drops : 3
Min Register :
Constant Sweep : OFF Scan Time --- ms 4----
1 CONTINUOUS 01 01 01
2 CONTINUOUS 03 03 03
3 CONTINUOUS 02 02 02
4 CONTINUOUS 03 03 03
5 EOL
For example, suppose that you have some alarm handling logic in
segment 2 of a three-segment logic program. You can use the segment
scheduler editor to control segment 2 based on the status of a coil
00056—if the coil is ON, segment 2 logic will be activated in the scan,
and if the coil is OFF the segment will not be solved in the scan. I/O
servicing is still performed, regardless of the conditional status. Here is
how the Modsoft segment scheduler would show the resulting
order-of-solve table:
F1 F2 F3 F4 F5 F6 F7 F8 F9 L
SEGMENT - SCHEDULER
Number of Drops : 3
Min Register :
Constant Sweep : OFF Scan Time --- ms 4----
1 CONTINUOUS 01 01 01
2 CONTINUOUS 03 03 03
3 CONTROLLED 00056 ON 02 02 02
4 CONTINUOUS 03 03 03
5 EOL
F1 F2 F3 F4 F5 F6 F7 F8 F9 L
SEGMENT - SCHEDULER
Number of Drops : 3
Min Register :
Constant Sweep : OFF Scan Time --- ms 4----
1 CONTINUOUS 01 01 01
2 WDT RESET
3 CONTINUOUS 02 02 02
4 WDT RESET
5 CONTINUOUS 03 03 03
6 EOL
An Order-of-Solve Table Rescheduled for Three Comm Port Servicings per Scan
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.
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 work—it allows
solved logic, moved data, and performed calculations to be examined for
errors.
S
R SBIT instruction, 51
raising an FP number to an integer power, scan time, 512
134 scan time evaluation circuit, 516
RAMP function, in PCFL, 436 scanning logic segments, 5
RATE function, in PCFL, 439 SCIF instruction, 324
RATIO function, in PCFL, 455 seal circuit, built from contacts and coils, 41
RBIT instruction, 53 search for bit pattern, in a DX table, 187
Read ASCII command, via the ESI segment scheduler, 4, 520
instruction, 478 defining order of logic solution, 5
Read global data, via the MSTR instruction, improving overall system performance,
352 524
U X
UCTR function, 60 XMRD instruction, 292
UCTR instruction, 60 XMWT instruction, 290
user logic, in user memory, 12 XOR circuit, built from contacts and coils,
41
user memory, 12
CMOS RAM storage, 13 XOR instruction, 213
V
variables, in an Equation Network, 154