Function Block Programming
Function Block Programming
1336 FORCE
PLC
Function Block
Communications
Adapter
Programming
(Cat. No. 1336T–GT1EN)
Manual
Important User Information Solid state equipment has operational characteristics differing from
those of electromechanical equipment. “Safety Guidelines for the
Application, Installation and Maintenance of Solid State Controls”
(Publication SGI-1.1) describes some important differences between
solid state equipment and hard–wired electromechanical devices.
Because of this difference, and also because of the wide variety of
uses for solid state equipment, all persons responsible for applying
this equipment must satisfy themselves that each intended
application of this equipment is acceptable.
The examples and diagrams in this manual are included solely for
illustrative purposes. Because of the many variables and
requirements associated with any particular installation, the
Allen-Bradley Company cannot assume responsibility or liability for
actual use based on the examples and diagrams.
1336 FORCE, SCANport, and DH+ are trademarks of Allen-Bradley Company, Inc.
PLC is a registered trademark of Allen-Bradley Company, Inc.
Table of Contents
Preface
Manual Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P–1
Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P–1
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P–3
Function Block Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P–4
Template revised June 23, 1995 Pub number and date go in this shared area
iv Table of Contents
Preface
Manual Overview This manual attempts to accommodate users who are unfamiliar with
the function block system as well as more experienced users. When
read from front to back, this manual provides an increasing level of
detail, with each chapter building upon information presented in the
previous chapter.
Product Overview The function block system allows you to customize drive operation
to your specific application. The function block software contained
in the PLC Comm Adapter Board provides several advantages.
❒ On larger system applications the loading of the PLC control
system will be reduced.
❒ On smaller stand-alone operations, programming will be carried
out completely within the drive, redefining the term standalone
drive.
Function blocks are integral to drive operation and can be combined
together to operate on almost any part of the drive functionality. The
flexibility of the function block system allows blocks to be used with
the drive’s velocity or current control parameters, drive-to-drive
parameters, as well as analog and remote I/O parameters.
Shown below are a portion of the function blocks that are available
viewed through DriveTools DriveBlockEditor. By scrolling forward,
the 28 different function blocks that currently make up the function
block library may be viewed. Functions range from logical function
blocks (AND, OR, XOR and NOT) — to math function blocks
(ADD, SUB, MULT and SCALE) — to more involved functions,
including Proportional/Integral Control and Rate Limiter. Control
functions such as Monostable, Compare with Hysteresis, Delay,
Multiplexer, and Pulse Counter are available, as well as conversion
functions like Binary-to-Decimal and Decimal-to-Binary.
The 1336FORCE when equipped with a PLC Comm Board has 497
fixed parameters which are referred to as linear parameters. The
function block program allows 799 new dynamic node parameters.
Dynamic parameters are not fixed and can be modified and
manipulated to meet the needs of your particular application.
Execution
List
Sequence ID # Type
Once you have entered all events into your execution list, you may
want to adjust the values of the node parameters of the function
blocks. These values are entered in the Value column on the right
side of the DriveBlockEditor screen as shown on the next page.
Node values must be within the range specified by the maximum and
minimum limits. Chapter 2 provides detailed examples on entering
function block nodes.
Limit
Node
Group
Once you have established your execution list with all values and
links, you can download this list from the PC to the drive. The
service will run a series of tests on your execution list before
accepting and compiling the function block task you have
established. Compiling will create the program data sets within the
drive. The DriveBlockEditor will wait until the compile is complete
before sending node values and link connections to the drive.
End of Preface
Getting Started
Chapter Objectives This chapter introduces you to an application using function block
programming. The exercises in this chapter take you through the
programming of the sawtooth generator application shown below.
Sel0
Sel1
ID # 3
Sawtooth Application The output from the RATE LIMITER function block will be a sawtooth
Operation signal. The value of the RATE LIMITER output will ramp up to the
value specified by the MULTIPLEXER input #1 (+32767). When the
RATE LIMITER output reaches the maximum value specified by the
LIMIT block t1 (+32765), the max limit flag will set the SR FLIP
FLOP output, which in turn selects the MULTIPLEXER input #2. The
RATE LIMITER output will then ramp down to this new value of
– 32767.
RATE LIMIT
Max Value LIMIT
Input
B
A t2
Min Value
When the RATE LIMITER output reaches the minimum value specified
by the LIMIT block (– 32765), the min limit flag will clear the SR
FLIP FLOP output (t2), which in turn selects the MULTIPLEXER input
#1. The RATE LIMITER output will continue to ramp up and down
between the LIMIT block minimum and maximum values.
❒ Click on CLOSE.
As shown below, the DriveBlockEditor software now enters one
Limit function block in your new execution list with an ID# of 1.
You have now created the first function block and set the input node
value limits as shown below.
NODE#
BLOCK ID#
You can now link the Set Reset Flip Flop inputs to the outputs of the
Limit function block entered in Step 1.
5. Link the Set Reset FF’s set input (node 0), to the maximum limit
flag of the Limit function block (node 3).
Click on the Link To field for Node 0 and enter 1:3.
Press enter to save the value as shown below.
6. Link the Set Reset FF’s reset input (node 1), to the minimum limit
flag of the Limit function block (node 4).
Click on the Link To field for Node 1 and enter 1:4.
Press enter to save the value as shown above.
With the Set Reset FF function block and links added, the function
block diagram now appears like this.
@ Max Lim 1:3 Set 2:0 Out1 2:2
Input 1 1:0
LIMIT @ Min Lim 1:4 Reset 2:1
Set Reset FF Out2 2:3
Max Val (32765) 1:1
5. Enter a value for input 1 by clicking on the Value field for Node
0 and entering +32767.
Press enter to save the value as shown below.
6. Enter a value for input 2 by clicking on the Value field for Node
1 and entering –32767.
Press enter to save the value as shown above.
7. Link the Multiplexer’s sel0 input (node 4), to the Set Reset FF’s
output (node 2).
Click on the Link To field for Node 4 and enter 2:2.
Press enter to save the value as shown below.
With the Multiplexer function block values and link added, the
function block diagram now appears like this.
@ Max Lim 1:3 Set 2:0 Out1 2:2
Input 1 1:0
LIMIT @ Min Lim 1:4 Reset 2:1
Set Reset FF Out2 2:3
Max Val (32765) 1:1
ID # 3 In3 3:2
In4 3:3
Sel0 3:4
Sel1 3:5
5. Enter a value for the rate by clicking in the Value field for Node
3 and entering 65535.
Press enter to save the value as shown below.
You can now link the Rate Limiter input to the output of the
Multiplexer function block entered in Step 3.
Lim @Lim 4:4 Lim In 4:0 Output 3:6 In1 (32767) 3:0
Sel0 3:4
Sel1 3:5
If any errors were made, a Connection Errors Dialog Box will detail
the errors.
3. Within the link window at the bottom of the screen, double click
on the Par # field associated with Parameter 387.
Link analog output #1, Parameter 387, to Rate Limiter output
node Output (4:5).
The window shown below should appear with entry boxes.
This will cause the output of the Rate Limiter function block to ramp
up and down between 200 and –200.
Getting Started Using a PLC Shown below is a sample program that will transfer data to a drive
that is set up as Rack 1. The block transfers are executed by toggling
input I:00/00. The Block Transfer Write sends the information in
data file N57:0 to the drive. The data in these addresses determines
what type of operation is performed. The Block Transfer Read
instruction receives information from the drive and places it in data
file N57:100. This data contains the status of the operation being
performed and any data (if applicable) that is returned from the
drive.
Toggle switch #0 to initiate the Block Transfer Read/Write pair. File N57:0 contains the data that is transfered to the drive.
ung 5:1
Toggle Switch
Toggle BT Write Block Transfer to Drive Rack 1
Switch Available
I:000 I:010 BTW
BLOCK TRANSFER WRITE (EN)
00 15 Rack 1
Group 0 (DN)
Module 0
Control Block BT50:0 (ER)
Data File N57:0
Length 64
ung 5:2 Continuous N
BT Read
Data Available Block Transfer to Drive Specified as Rack 1
I:000 BTR
BLOCK TRANSFER READ (EN)
00 Rack 1
Group 0 (DN)
Module 0
Control Block BT50:1 (ER)
Data File N57:100
Length 64
Continuous N
ung 5:3
End of File
Important: If a PLC 5/15 or 5/25 is used, the control block must use an
integer data type, not the Block Transfer (BT) data type.
0 1 2 3 4 5 6 7 8 9
BTW N57:0 0000 8F02 0000 0003 0000 0000 0000 0000 0000 0000
Data File
Words N57:0 – N57:3 will be sent to the drive. Values are displayed in
hexadecimal format.
1. Type the data shown in the table below into addresses N57:0 —
N57:9. The Block Transfer Write Data specifies a download
operation and contains the events in the execution list. Values are
displayed in hexadecimal format.
0 1 2 3 4 5 6 7 8 9
BTW N57:0 0000 8F03 4000 0000 0004 0A4A 010C 0216 0315 0413
Data File
3. Verify that the write was successful. If N57:101 = 0F03 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
3. Verify that the write was successful. If N57:101 = 0F01 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
6. Verify that the write was successful. If N57:101 = 0F01 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
9. Verify that the write was successful. If N57:101 = 0F01 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
11. Toggle bit I:00/00 to initiate the block transfer routine which
downloads the node value.
12.Verify that the write was successful. If N57:101 = 0F01 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
13.Set the Rate Limit block Rate value (block 4, node 3) to FFFFhex
= 65535dec.
14.Toggle bit I:00/00 to initiate the block transfer routine which will
download the node value.
15.Verify that the write was successful. If N57:101 = 0F01 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
1. Link the Limit block Input (block 1, node 0) to the Rate Limit
Output (block 4, node 5).
2. Toggle bit I:00/00 to initiate the block transfer routine which will
download the link.
3. Verify that the write was successful. If N57:101 = 0F04 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
5. Toggle bit I:00/00 to initiate the block transfer routine which will
download the link.
6. Verify that the write was successful. If N57:101 = 0F04 hex (Block
Transfer Read data), there are no errors.
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
Chapter Objectives This chapter provides information about the following system
component concepts:
Execution List Overview An execution list provides a way for you to organize the function
blocks, or events, in the order that you want the drive to execute the
events. Within an execution list, you may have up to 128 events in
any combination. Each event is defined by a block type number and
a block ID number.
1 Byte 1 Byte
Hex Value
Stored in drive
0 0 0
The same execution list using a PLC data table is shown here:
0 1 2 3 4 5 6 7 8 9
N57:0 0000 8F03 4000 0000 0004 0A4A 010C 0216 0315 0413
ID Type
When the drive enables a function block application, the events are
executed every 20 milliseconds, regardless of how long it actually
takes to execute the application. For example, if it takes the
processor 5 milliseconds to execute your application, the drive’s
processor will not start to execute the application again until the full
20 milliseconds have elapsed. This is referred to as a 20 millisecond
task interval.
Once you have created your execution list, you can add events to it.
When adding events to your execution list, keep the following
information in mind:
❒ Events are executed in the order in which they appear in the list.
Therefore, you need to add an event at the point in the list where
you want the function block to be executed.
❒ Each event that you add requires a unique block ID.
In DriveTools, you can add multiple events or a single event to an
execution list by selecting the name(s) to add from the Function
Block Library window.
NO–OP Events
You can specify that an event in your execution list have both an ID
number and a type number of zero. This is called a NO-OP event, or
no-operation event. NO-OPs are typically used as placed markers
that place a NULL event within the executed application.
Linking Events
When you link two function blocks, the information about the link
(source reference number) is stored with the function block that
receives the information (destination) and not with the function
block that provides the information (source). In the example above,
the information about the link is stored at the input to the SCALE
function block.
During execution, the drive processes the function block links one
function block at a time. If two function block inputs are both linked
to the same linear drive parameter, the drive transfers the data from
the required parameter twice. Because the drive parameters are
updated every one to two milliseconds, the values for the same drive
parameter may be different during the same pass through the
application.
Velocity Feedback
from the drive LIMIT
Input
Event 1
MULTIPLY
Input
Event 24
If you want both function blocks to receive the same value for a
drive parameter, you should link the first function block’s input node
to the drive parameter. You should link all subsequent inputs using
this drive parameter should be linked to the first function block node
that is linked to the drive parameter.
Velocity Feedback
from the drive LIMIT
Input
Event 1
MULTIPLY
Input
Event 24
If you delete an event from an execution list, you need to remove all
links that reference the block that is being deleted. You need to do
this because the link information is stored with the function block
that receives the information.
If you do not remove the link, you will receive an error when you
download the execution list if you are using DriveTools, or the drive
will generate a fault if you are using a PLC.
Downloading and While you are creating your execution list, you are generally
Compiling the Execution working on a terminal using DriveTools, a PLC, or a GPT. At this
List point, the execution list is an array of words that the software you are
using can understand. You need to download and compile your
execution list before the drive can execute it.
The download process sends a copy of the execution list array from
the terminal to the drive. The compile process uses the execution list
in the drive to create an application which contains the functionality
and data within the drive. The drive can then execute the application.
The process that takes place when you download and compile your
execution list is as follows:
Understanding Function Once you have properly downloaded and compiled your execution
Block I/O Nodes list, you can access the I/O (input/output) nodes associated with each
function block. An I/O node is a parameter that provides information
to or from a function block.
The function block I/O nodes are different from the standard linear
parameters. While the linear parameters always reference the same
information, the I/O nodes are dynamic. The drive allocates memory
for the function block parameters (I/O nodes) depending on the
execution list. Thus, the drive only allocates as much memory as you
need to execute your application.
Because the I/O nodes are dynamic, you cannot use fixed numbers
(such as parameter 723) to refer to function block nodes. Instead,
function block parameters are referenced by block ID number and
node number. The block ID number and node number are also
application dependent.
As the execution list is compiled, the drive allocates the I/O nodes
associated with each event as a group. You can have a maximum of
799 I/O nodes per execution list.
The function block type defines the required number of I/O nodes
and the characteristics of each node for a particular function block.
I/O nodes are numbered from zero up to the proper number of nodes,
with the input nodes numbered first. A function block with six
nodes, numbered from zero to five, is shown below.
The way you reference the block ID and node number depends on
whether you are using DriveTools or a PLC. DriveTools allows you
to use a decimal format to reference nodes, while PLC block transfer
uses a single word value.
MSB LSB
1 0 Node # Block ID
15 14 13 8 7 0
MSB = Most Significant Bit
LSB = Least Significant Bit
Bit Description
0– The value or link reference represents a standard linear Motor Control
board or a PLC Communication board file parameter number.
15
1– The value or link reference represents a function block I/O node
reference.
14 0
8–13 Contains the I/O node reference.
0–7 Contains the block ID number.
The upper-most four bits, bits 12 – 15, typically have a value of 8Hex
for most function block node references. The value will not exceed
8Hex unless you reference a node number of 16 or greater.
Node 0 ADD 15 14 13 8 7 0
ID = 6 Dec Node 2
Node 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0
Hex 8 2 0 6
ADD block output reference = 8206 Hex via PLC Block Transfer
= 6:2Dec via DriveTools
Hex 8 3 1 A
XOR #26 output reference = 831A Hex via PLC Block Transfer
= 26:3Dec via Drive Tools
The value of a function block I/O node will be one of the following
types:
When you create a link between two function blocks, you are
actually creating a connection between a node on one function block
and a node on another function block. The information about the link
is stored at the destination node, which is the node that receives the
data.
In the following example, the link between the LIMIT function block
and the Set Reset FF function block is located between Node 3 of the
LIMIT function block and Node 0 of the Set Reset FF function block.
The information about the link is stored with Node 0 of the Set Reset
FF function block. Therefore, when you create the link, you need to
create it at Node 0 (2:0), not Node 3 (1:3).
If you are using DriveTools, you would create this same link by
doing the following:
If you are using a PLC, you would create this same link by doing the
following:
0 1 2 3 4 5 6 7 8 9
System Interactions
Chapter Objectives This chapter provides information about the following topics:
The Function Block BRAM Function block applications use two kinds of memory: RAM and
Functions BRAM.
The Function Block Init A function block Init operation effectively removes any previous
Command function block application from the working RAM area. However, it
does not actually clear out the BRAM itself; it only clears the
function block application out of the working RAM area. To truly
initialize the BRAM area, you need to perform both an initialization
service and a function block Store operation.
After you initialize the function block system, you cannot access
function blocks or I/O nodes until you either recall the application
stored in BRAM or download a new execution list from a terminal
device. If you try to read data from or write data to an I/O node
before you place another execution list in memory, your request will
be rejected. Trying to link a linear parameter to a function block I/O
node will also be rejected.
The Function Block Store A function block Store writes the function block application in active
Command RAM memory to the drive’s BRAM. When requested, a function
block Store does the following:
The Function Block Recall A function block Recall copies the function block application that is
Command currently stored in BRAM into RAM. This application is then stored
in RAM and is available for execution. When requested, a function
block Recall does the following:
Linear Parameter In a 1336FORCE drive with a PLC Communication Board, the 497
BRAM Functions and Links linear parameters are stored separately from the function block node
parameters. Therefore, the functions for initializing, saving, and
restoring data for the function blocks are separate from the linear
parameter BRAM functions.
D
.. services.
In this example, if you initialize both the linear parameter area and
the function block area, you need to be careful when you restore the
information. When you do a Recall on the linear parameter area,
links A and B are restored. When you do a Recall on the function
block area, links C and D are restored along with the function blocks.
With this type of link information, you need to restore the function
block area before restoring the linear parameter area. If you do a
function block Recall first, the function blocks and links C and D are
restored. You can then execute a linear parameter Recall to restore
links A and B.
The system does not automatically clear a link that was valid but has
become invalid. You need to clear the link or adjust the link to point
to a valid parameter or node before you can clear the fault.
The function block fault read service returns the reference of the first
node with an invalid link reference. You may clear links individually,
or you can clear all links at once.
When using DriveTools, you can access the function block BRAM
functions from DriveBlockEditor EEPROM selection and the linear
parameter BRAM functions from DriveManager. For additional
information about the linear parameter value, link, and BRAM
services, refer to the PLC Communications manual.
Power Up Sequence Whenever you power up the system, the drive does the following:
Compiler Modes and Terminal You can use any of the three supported terminal devices to create and
Operation Differences update your function block applications:
❒ DriveTools’ DriveBlockEditor
❒ Graphic Programming Terminal (or GPT)
❒ PLC block transfer
The three terminal devices use different compiler modes due to
differences in the amount of their available RAM. Depending on
how you change your execution list, you may receive an error when
using one terminal device, but not when you use another terminal
device. This section describes the compiler modes that are used and
information specific to the individual terminal devices to help you
use function blocks more effectively.
Compiler Modes The two basic compiler modes used for function blocks are the initial
compile mode and the subsequent, or comparison, compile mode.
You do not select which mode to use; the compile mode is
automatically determined by the terminal device and whether or not
an application already exists in the RAM area of the drive.
With the initial compile mode, no events exist in the drive when the
execution list is downloaded, and all the objects are created from
scratch.
The DriveTools’ DriveBlockEditor always uses the initial compile
mode for its download and compile service. The DriveBlockEditor
forces an initial compile mode by initializing the function block’s
RAM before downloading the new execution list for compilation.
In this last example, the second execution list is invalid only in the
subsequent compile mode. If the first application was cleared with a
function block Init, the second (new) execution list would be valid
during an initial mode compile. This is a major difference between
using the DriveBlockEditor and a GPT to compile your execution
list. The following sections contain additional information about the
different terminals.
Note: If an error occurs while downloading the new list and this
operation is terminated, there will be no function block application in
RAM because it was initialized.
Graphic Programming Because the Graphical Programming Terminal (GPT) does not have
Terminal as much RAM memory as the DriveTools’ PC, the GPT cannot
retain all the possible node value and link information. Therefore, the
GPT relies on a subsequent or comparison mode of the drive’s
compiler to retain the node value and link information for common
event blocks between subsequent compiles.
When using a GPT, you need to remove the links that refer to the
blocks to be deleted before downloading and compiling to prevent an
invalid function block link fault.
PLC Block Transfer The PLC has the flexibility to use either mode and perform every bit
of functionality the other terminals use via the block transfer
services. PLC block transfers are explained in more detail in Chapter
5 of this manual.
Understanding Multiple Only one function block application is active within the drive at any
Execution List Copies one time. However, multiple execution lists can be present in the
terminal devices attached to the drive. You can connect up to seven
terminal devices to the PLC Communications Adapter board, and
each terminal device can have its own copy of an execution list. In
addition, the DriveBlockEditor can even have multiple OFFLINE
execution lists in RAM or stored in the PCs hard drive.
Task Status Service The compile operation performed during the function block Recall
and the download and compile services are performed as background
tasks. Even though you can perform other service requests while the
execution list is compiling, you should avoid making node value
write requests and link requests during the compilation process.
You can use the Task Status service to determine the current state of
the compiler and the application execution status. The following are
possible states for the compiler:
You can read the fault queue via GPT, PLC block transfer, or
DriveManager.
Important: A function block BRAM Init is recommended after any
function block fault other than a function block link
processing fault. If you do perform an Init, you must
also perform a Recall or download a new program.
You cannot clear function block faults with a clear fault operation
without first addressing the problem. The function block system will
not make an assumption about what to do with an illegal link. You
are forced to either clear the link to this node or reconnect the node
to a valid node. After you do this, the clear faults mechanism can
clear the faults and allow the drive to run.
If multiple link faults occur, you can either remove all the function
block links with the clear function block links service and then clear
the faults, or you can continue reading the code identifier to find the
individual link errors and correct each link, one at a time.
Performance Issues Involving A drive with a connected PLC Communication Board has two link
Links processing mechanisms. One link processing mechanism operates
specifically upon linear parameter links, and the other mechanism
processes the function block links.
For example, if you have an application with 115 events that takes 12
milliseconds to execute and the input for event 1 and event 115 are
linked to the feedback, event 115 may receive a value that is
different than the value event 1 received during the same execution
task interval pass.
Feedback
from the drive LIMIT
Input
L1
Event 1
L2
MULTIPLY
Input
Event 115
Feedback
from the drive LIMIT
Input
T1
Event 1
T2
MULTIPLY
Input
Event 115
Link Processing Sequence When you create your links, you do not always need to transfer data
from a function block that is executed before the function block that
is receiving the data. For example, if you have a FILTER function
block that has an execution number of 25, the FILTER function block
could receive data from a SCALE function block with an execution
number of 50:
Drive Parameter
P146 FILTER
Input
Event 25
SCALE
Input
Event 50
In this example, you should be aware that even though the FILTER
function block receives data from the SCALE function block, the
drive executes the FILTER function block before the SCALE function
block. The first time the drive executes the FILTER function block, it
uses the input node’s initial or default value because the SCALE
function block has not yet been executed. During subsequent passes,
the FILTER function block always receives the data that the SCALE
function block received during the previous pass. For example, if the
SCALE function block received a value of 56 from the drive during
the fourth time that the drive executes the application, the FILTER
function block will not receive a value of 56 until the fifth time it is
executed.
Chapter Objectives Detailed in this chapter are the (28) function blocks that make up the
PLC Comm Board function block set.
Function Block Overview Each function block is a firmware subroutine stored in PLC Comm
Board Memory. Each type of function block has a unique Block type
number that identifies the functionality and the nodes that are
associated with the block. Function blocks can be linked together to
perform the same functions as equivalent analog or digital circuits.
Function blocks are executed in the order in which they are entered
in the execution list. Each function block type can be used any
number of times.
For each function block shown, the value of an I/O node will be one
of the following:
1. A signed decimal integer with a value range of ±32767.
2. An unsigned decimal integer with a value range of 0 – 65535.
3. A logical value where 0 = False and any non-zero value = True.
Important: The use of integer math causes the truncation of any
fractional remainder resulting from a divide operation.
Double Word Function Block The only library function blocks that have double word input or
Caution output nodes are Multiply, Divide and Scale. These three function
blocks are intended to be used together. Special handling may be
required when using any of these three blocks with other function
blocks.
The output range of multiplied input values can be critical. The range
of a double word (32 bit) value is ±2,147,483,647. The range of the
more common, signed single-word 16 bit node is ±32767. If only
one word of the Multiply or Scale function block output were used,
the output would appear to roll over or under should the product
exceed +32767 or go negative.
As shown above, the sign bit for 32 bit values is the most significant
bit, #31. The sign bit for a single word value is the most significant
bit, #15.
Absolute
ABS
ID = Exec =
BLOCK TYPE 1 decimal 1 hexadecimal NODE 0 Input
IN
Out NODE 1
DEFINITION
An absolute (+) output value Out derived from a 16-bit signed
(+ or –) 2’s complement input Input.
INPUT
Input — A signed Integer.
OUTPUT
Out — An unsigned integer that is the absolute value of Input.
FUNCTION
Out = |Input|.
PARAMETERS DATA TYPE LINKABLE DEFAULT VALUE RANGE
Input Signed Integer Yes 0 ± 32767
Out Signed Integer Yes — 0 to + 32767
DEFINITION
Combines 16 logical input words In Bit 0 – In Bit 15 into 1 decimal
output word Output.
INPUTS
In Bit 0 – In Bit 15 — Logical input words.
OUTPUT
Output — A decimal output word.
FUNCTION
If In Bit 0 = 0, Output bit 0 = 0.
If In Bit 0 ≠ 0, Output bit 0 = 1.
•
•
•
If In Bit 15 = 0, Output bit 16 = 0.
If In Bit 15 ≠ 0, Output bit 16 = 1.
BIN2DEC
(continued) EXAMPLES EXAMPLE 1 Example 2 EXAMPLE 3
In Bit 0 False False False
In Bit 1 True True True
In Bit 2 False False False
In Bit 3 False False True
In Bit 4 False False False
In Bit 5 False False True
In Bit 6 False False True
In Bit 7 False False True
In Bit 8 False False True
In Bit 9 False True True
In Bit 10 False False True
In Bit 11 False False True
In Bit 12 False False True
In Bit 13 False False True
In Bit 14 False False True
In Bit 15 False False True
Output 2 514 – 22
Example 2 — Output = 514 dec = 0202 hex = 0000 0010 0000 0010 binary
Binary 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0
Bit # 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
hex 0 2 0 2
Output decimal value (NODE 16) = 514
Compare w/Hyst
COMPHYST
ID = Exec =
BLOCK TYPE 4 decimal 4 hexadecimal NODE 0 In1
NODE 1 Pre
NODE 2 Hyst
EQ NODE 3
LT NODE 4
GT NODE 5
DEFINITION
Compares the input value In1 against a preset value Pre with an
associated hysteresis band Hyst and sets the appropriate indicator
flags.
EQ Output
FALSE TRUE FALSE
INPUTS
In1 — Input value signed integer.
Pre — Preset value signed integer.
Hyst — Hysteresis band unsigned integer between 0 and +32767.
OUTPUTS
EQ — Equal flag set to true when the input is within the hysteresis
band.
LT — Less than flag is set to true when In1 < Pre.
GT — Greater than flag is set to true when In1 > Pre.
FUNCTION
1. If In1 ≤ Pre + Hyst and ≥ Pre – Hyst,
then EQ = true, else EQ = false.
2. If In1 > Pre,
then GT = true and LT = false.
3. If In1 < Pre,
then LT = true and GT = false.
COMPHYST
(continued) PARAMETERS DATA TYPE LINKABLE DEFAULT VALUE RANGE
In1 Signed Integer Yes 0 ± 32767
Pre Signed Integer No 0 ± 32767
Hyst Unsigned Integer No 0 0 to + 32767
EQ Logic Output No — True/False
LT Logic Output No — True/False
GT Logic Output No — True/False
DEFINITION
Takes 1 unsigned decimal input word Input and produces 16 logical
output words Out Bit 0 to Out Bit 15.
INPUT
Input — A decimal input word.
OUTPUT
Out Bit 0 – Out Bit 15 — Logical output words.
FUNCTION
If Input bit 0 = 0, Out Bit 0 = 0.
If Input bit 0 = 1, Out Bit 0 = 65535.
•
•
•
If Input bit 15 = 0, Out Bit 15 = 0.
If Input bit 15 = 1, Out Bit 15 = 65535.
DEC2BIN
(continued) EXAMPLES Example 1 EXAMPLE 2
Input 14 65584
Out Bit 0 False False
Out Bit 1 True False
Out Bit 2 True False
Out Bit 3 True False
Out Bit 4 False True
Out Bit 5 False True
Out Bit 6 False False
Out Bit 7 False False
Out Bit 8 False False
Out Bit 9 False False
Out Bit 10 False False
Out Bit 11 False False
Out Bit 12 False False
Out Bit 13 False False
Out Bit 14 False False
Out Bit 15 False True
Example 1 — Input = 14 dec = 000E hex = 0000 0000 0000 1110 binary
Binary 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
Bit # 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
hex 0 0 0 E
Input decimal value (NODE 0) = 14
Delay
DELAY
ID = Exec =
BLOCK TYPE 6 decimal 6 hexadecimal NODE 0 Input OUT
NODE 1 Enable
NODE 2 On (ms)
NODE 3 Off ms.
IN
Out NODE 4
Out Not NODE 5
DEFINITION
The output echoes the logical input after a specified time delay.
Separate time delays of On (ms) and Off ms. are provided for rising
and falling edges. The resolution of the on and off delay times are
calculated and limited by the 20mS task interval.
INPUTS
Input — A logic input.
Enable — When true, enables the delay function. When false,
holds the output at it’s last state.
On (ms) — On time delay, entered in 20mS increments.
Off ms. — Off time delay, entered in 20mS increments.
OUTPUTS
Out — A logical output that follows Input if Enable is true.
Out Not — A logical output that is the complement of Out.
FUNCTION
1. If Enable 0 0:
— For the rising edge of Input, the on delay is in progress and
the On (ms) counter = mS ÷ 20.
— For the falling edge of Input, the off delay is in progress and
the Off ms. counter = mS ÷ 20.
2. For the On (ms) delay:
Decrement the On (ms) counter
If On (ms) counter = 0, then Out is true and Out Not is false.
3. For the Off ms. delay:
Decrement the Off ms. counter
If Off ms. counter = 0, then Out is false and Out Not is true.
DELAY
(continued) PARAMETERS DATA TYPE LINKABLE DEFAULT VALUE RANGE
Input Logic Input Yes 0 True/False
Enable Logic Input Yes 0 True/False
On (ms) Unsigned Integer No 0 0 to 65535
Off ms. Unsigned Integer No 0 0 to 65535
Out Logic Output No — True/False
Out Not Logic Output No — True/False
Example
Derivative
DERIV
ID = Exec =
BLOCK TYPE 7 decimal 7 hexadecimal NODE 0 In
IN
t
Out NODE 1
DEFINITION
The rate of change of input In over a single sample interval. Τhe
sample interval ∆t = .020 seconds. Output Out is clamped at ±32767
and not allowed to over or under flow.
INPUT
In — A signed Integer.
OUTPUT
Out — A signed integer representing the derivative or change in
input in units per second.
FUNCTION
Out = 50 × [In — In (previous)].
Example 1
IN 500
400
300
0
– 16383
Ramp Input Rate = + 16383 UPS
– 32767
In the example above, the rate limit input to the derivative function is set to allow a
16383 UPS change of output. A constant rate-of-change to the input, yields a constant output
level of ± 16383, with the output sign changing with the input slope.
DIVIDE Divide
ID = Exec =
BLOCK TYPE 23 decimal 17 hexadecimal LSW In
NODE 0
NODE 1 MSW In
NODE 2 Div
Output NODE 3
DEFINITION
Divides a 32 bit signed integer by a 16 bit signed integer. Any
remainder is truncated. If Div = 0, the calculation is not performed
and Output = 0. The Output is clamped to ±32767 should the result
exceed the limits.
INPUTS
LSW In — A least significant dividend word value representing
bits 0–15 of a 32 bit dividend value.
MSW In — A most significant dividend signed integer value
representing bits 16–31 of a 32 bit dividend value.
Div — The signed integer divisor.
OUTPUT
Output — The result of dividing the dividend by the divisor.
FUNCTION
Output = LSW In, MSW In ÷ Div.
Bit 31 is the sign bit, the most significant bit for 32 bit values. For 16
bit values, bit 15 (the sign bit) is the most significant bit.
Example 3 — Double Word Input Value = + 196607 dec = 0002 FFFF hex
2 dec 65535 dec
0002 hex FFFF hex
Most Significant Word Least Significant Word
Node 1 Node 0
DIVIDE Important: If the DIVIDE function block’s LSW input node (node 0) is used without
(continued) manipulating the MSW node (node 1), difficulties can occur should a signed
word be linked to the inputs. False results may be output if the signed input
value goes negative.
A t1 A t2 A t3
A DIVIDE Output
0 (Upper Waveform)
+ 32767 (Lower Waveform) "
A Signed Single-Word
Input to LSW Node 0
0 (Lower Waveform) "
A t1 A t2 A t3
The signed single word value which represents – 1 dec is FFFF hex. The
signed double word value representing – 1 dec is FFFF FFFF hex. Without
the upper MSW word (node 1) being manipulated, the DIVIDE block
interprets the double word input as being 0000 FFFF hex which equals
65535 dec.
With the MSW (node 1) always 0, the lower LSW (node 0) is always
interpreted as an unsigned decimal word with a range of 0 to 65535. As the
signed single word RATE LIM Output (which is linked to the DIVIDE LSW
input) goes negative, it’s sign (bit 15) is always set. While bit 15 is set, the
DIVIDE LSW input value is always interpreted as being greater than
+ 32768 because the LSW is always positive when the DIVIDE MSW input
is 0.
Exclusive OR
EXOR2
ID = Exec =
BLOCK TYPE 25 decimal 19 hexadecimal NODE 0 In #1
NODE 1 In #2
Out #1 NODE 2
Out #2 NODE 3
DEFINITION
An exclusive OR function that takes (2) inputs In #1 and In #2,. and
provides the XOR and XNOR — Out #1 and Out #2.
INPUTS
In #1 — A logical input value.
In #2 — A logical input value.
OUTPUTS
Out #1 — A logical output value.
Out #2 — A logical output value.
Example
In #1 In #2 Out #1 Out #2
False False False True
False True True False
True False True False
True True False True
Filter
FILTER
ID = Exec =
BLOCK TYPE 8 decimal 8 hexadecimal NODE 0 In
NODE 1 Rad /S
Out NODE 2
DEFINITION
A first order low pass algorithmic filter with a programmable
bandwidth in increments of .1 radians/second.
INPUTS
In — The signed integer to be filtered.
Rad/S — The bandwidth in .1 radians/second, with a maximum
value of 400 (40 radians).
OUTPUT
Out — A signed, filtered, output integer that is clamped to ±32767.
FUNCTION
If Rad/S = 0, then Out = In.
If Rad/S ≠ 0, then Out = OutI–1 + k(In – OutI–1).
" 1 Time A
Constant
≈ 63%
≈ 100 mS
+ 32767 "
– 32767 "
+ 32767 "
– 32767 "
+ 32767 "
A FILTER In
– 32767 "
A–– 1 Time –––"
Constant
≈ 63% ≈ 1 S
Out 1 NODE 4
Out 2 NODE 5
DEFINITION
Performs a logic AND and NAND of Input #1, Input #2, Input #3,
and Input #4.
INPUTS
Input #1 — A logic input value.
Input #2 — A logic input value.
Input #3 — A logic input value.
Input #4 — A logic input value.
OUTPUTS
Out 1 — A logic output value.
Out 2 — A logic output value.
FUNCTION
Out 1 = Input #1 & Input #2 & Input #3 & Input #4.
Out 2 = (Not)Out 1.
Four Input OR
4OR
ID = Exec =
BLOCK TYPE 16 decimal 10 hexadecimal NODE 0 Input #1
NODE 1 Input #2
NODE 2 Input #3
NODE 3 Input #4
Out #1 NODE 4
Out #2 NODE 5
DEFINITION
Performs a logic OR and NOR on four input words.
INPUTS
Input #1 — A logic input value.
Input #2 — A logic input value.
Input #3 — A logic input value.
Input #4 — A logic input value.
OUTPUTS
Out #1 — A logic output value.
Out #2 — A logic output value.
FUNCTION
Out #1 = Input #1 or Input #2 or Input #3 or Input #4.
Out #2 = (Not)Out #1.
Function
FUNCTION
ID = Exec =
BLOCK TYPE 9 decimal 9 hexadecimal NODE 0 Input
NODE 1 Smp Val1
NODE 2 Smp Val2
NODE 3 Smp Val3
NODE 4 Smp Val4
NODE 5 Smp Val5
NODE 6 Min Val
NODE 7 Max Val
@Min Lim NODE 8
@Max Lim NODE 9
Output NODE 10
DEFINITION
A function generator that uses:
❒ Sample values Smp Val1—Smp Val5 to define the y-axis
components.
❒ (2) signed integers Min Val & Max Val to describe the x-axis
components spaced in (Max Val—Min Val)/4 increments.
❒ Interpolation between the y-components to calculate the output
Output.
INPUTS
Input — A signed integer specifying an x-axis coordinate.
Smp Val1—Smp Val5 — Signed integers representing the y-axis
components.
Min Val — A signed integer associated with Smp Val1 that defines
the smallest x-axis component.
Max Val — A signed integer associated with Smp Val5 that defines
the largest x-axis component.
OUTPUTS
@Min Lim — A logic value = true when Input < Min Val.
@Max Lim — A logic value = true when Input > Max Val.
Output — A signed integer representing the y-axis value, that
corresponds to the x-axis value specified by Input.
FUNCTION
1. If Input > Max Val, @Max Lim = true, @Min Lim = false, and
Output = Smp Val5.
2. If Input< Min Val, @Max Lim = false, @Min Lim = true, and
Output = Smp Val1.
Examples 1 & 2
Y-Axis Smp
Val4
12
Ex 2 Input
Smp Val5
10
Smp
Val2
8
6
Ex 1 Input
4
Smp
Val3
2
Smp
Val1
X-Axis
2 4 6 8 10 12 14 16
FUNCTION Example 3
(continued)
Smp Val2
B
+ 32767 "
FUNCTION Output
B Smp Val4
+ 16383 "
Y B
Smp Val1
Y
Smp Val3
– 16383 "
FUNCTION Input Y
B Smp Val5
– 32767 "
Example 4
Smp Val2
+ 32767 " FUNCTION Output B
Y
Smp Val1 A Smp Val4
Y
Smp Val3
FUNCTION Input
Y
B Smp Val5
– 32767 "
Integrator
INTEGRATOR
ID = Exec =
BLOCK TYPE 10 decimal 0A hexadecimal NODE 0 Input
NODE 1 Set
NODE 2 Preset
NODE 3
NODE 4
Gain
Min t
NODE 5 Max
Lo Lim NODE 6
Hi Lim NODE 7
Output NODE 8
DEFINITION
Integrates an input value Input over a period of time using
trapezoidal integration. The Output is limited to Min and Max
values that are defined by the user. The integrator can be set to the
Preset value when the Set input is true.
INPUTS
Input — A signed integer signal that will be integrated.
Set — A logic input that forces the Output and integrated internal
variable to the Preset value when not equal to 0.
Preset — A signed integer that is loaded into the integrator when
Set is true.
Gain — A scaled, signed integer that is multiplied by the sum of
the current and last inputs — Scaling 256 = effective gain
of 1.
Min — A signed integer that is the lower limit on the integrated
Output.
Max — A signed integer that is the upper limit on the integrated
Output.
OUTPUTS
Lo Lim — A logic value = true when the integrated value < Min.
Hi Lim — A logic value = true when the integrated value > Max.
Output — A signed value that is the integral of Input with respect
to time.
Important: The Output is clamped between the Hi and Lo Lim
values and cannot over or under flow. When the Output
reaches either of these limits, the internal accumulator
clamps and will not integrate beyond that limit.
INTEGRATOR FUNCTION
(continued) Denominator = 1/2 × ∆t × 1/(divisor gain) = 25600
where: ∆t = a task interval of .020 seconds = 1/50 samples/second.
divisor gain = 256.
1. If Set = true, accumulator = Preset × denominator.
2. If Set = false,
accumulator = [Gain × (Inputi–1 + Input)] +
previous accumulated value.
3. If accumulator ÷ denominator > Max,
Output = Max, Hi Lim = true, Lo Lim = false.
4. If accumulator ÷ denominator < Min,
Output = Min, Hi Lim = false, Lo Lim = true.
5. If accumulator ÷ denominator < Max and > Min,
Output = accumulator ÷ denominator, Hi Lim = false,
Lo Lim = false.
INTEGRATOR Input
B
+ 32767 "
– 32767 " Y
INTEGRATOR Output
+ 32767 "
INTEGRATOR Input
B
+ 16383 "
– 16383 "
– 32767 " Y
INTEGRATOR Output
In Example 2, the Output also changes at a rate of 32767 units-per-second. The Input level
here is only 16383, but input Gain has doubled.
INTEGRATOR Input
B
+ 32767 "
+ 16383 "
– 16383 " Y
INTEGRATOR Output
– 32767 "
In Example 3, the Max and Min input limits have been set at ± 16383 and the Output is
clamped accordingly. The internal accumulator is also held at these limits and not allowed to
accumulate beyond these limits. This allows the Output to come out of it’s limits as soon as
the input moves in the negative direction.
+ 16383 "
– 16383 "
– 32767 "
Y
INTEGRATOR Output
Example 4 demonstrates the Preset functionality. When the Set input is raised the Output is
preset to a value of zero. When the Set node is cleared, the integral begins accumulating
from the Preset value, 0.
Limit
LIMIT
ID = Exec =
BLOCK TYPE 12 decimal 0C hexadecimal NODE 0 Input 1
NODE 1 Max Val
NODE 2 Min Val
DEFINITION
Limits an input Input 1 to the programmed maximum Max Val and
minimum Min Val values.
INPUTS
Input 1 — A signed integer that is limited.
Max Val — A signed integer that represents a maximum input value.
Min Val — A signed integer that represents a minimum input value.
OUTPUTS
Max Lim — High limit flag that is true when Input 1 > Max Val.
Min Lim — Low limit flag that is true when Input 1 < Min Val.
Output — A signed integer that results from limiting Input 1.
FUNCTION
1. If Input 1 < Min Val, then Output = Min Val and Min Lim is
true.
2. If Input 1 > Max Val, then Output = Max Val and Max Lim is
true.
3. If Input 1 < Max Val and > Min Val, then both are false and
Output = Input 1.
Logical NOT
LNOT
ID = Exec =
BLOCK TYPE 15 decimal 0F hexadecimal NODE 0 Input
Output NODE 1
DEFINITION
Performs a logic inversion of the Input.
INPUT
Input — A logic input value.
OUTPUT
Output — A logic output value.
FUNCTION
Output = (Not)Input.
Min/Max
MINMAX
ID = Exec =
BLOCK TYPE 13 decimal 0D hexadecimal NODE 0 In #1
NODE 1 In #2
NODE 2 Select
Output NODE 3
DEFINITION
Chooses the minimum or maximum of two input values In #1, In #2
according to the Select Input.
INPUTS
In #1 — A signed integer that is compared to In #2.
In #2 — A signed integer that is compared to In #1.
Select — When = 0 will select the minimum function.
When ≠ 0 will select the maximum function.
OUTPUT
Output — A signed integer that is the minimum or maximum of
In #1 and In #2.
FUNCTION
1. If Select is false and In #1 < In #2, then Output = In #1.
2. If Select is false and In #1 > In #2, then Output = In #2.
3. If Select is true and In #1 < In #2, then Output = In #2.
4. If Select is true and In #1 > In #2, then Output = In #1.
Monostable
MONOSTABLE
ID = Exec =
BLOCK TYPE 14 decimal 0E hexadecimal NODE 0 Input
NODE 1 Enable
NODE 2 Time
t
Out #1 NODE 3
Out 2 NODE 4
DEFINITION
Elongates a rising edge input signal Input for a duration Time. The
output signal Out #1 is true for the duration set by Time. The Time
resolution is limited by the task interval and calculated by counting
20mS task intervals.
INPUTS
Input — A signal that triggers the monostable function.
Enable — A logic input that when ≠ 0 enables the monostable
function, and when = 0 forces Out #1 = 0.
Time — Represents the time in mS that the input signal Input is
held high. Time value must be entered in 20mS
increments.
OUTPUTS
Out #1 — A logic output value.
Out 2 — The inverse of Out #1.
FUNCTION
If delay = 0 then,
If rising edge input
Set delay = Time ÷ 20
Out #1 = true.
Else delay ≠ 0, decrement delay.
If delay = 0, Out #1 = 0, and Out 2 is the compliment of Out #1.
TRUE
FALSE
INPUT
TRUE
OUT 1
OUT 2
FALSE
0 mS 100
Multiplexer
MULTIPLEXER
ID = Exec =
BLOCK TYPE 21 decimal 15 hexadecimal NODE 0 In 1
NODE 1 In 2
NODE 2 In 3
NODE 3 In 4
NODE 4 Sel 0
NODE 5 Sel 1
Output NODE 6
DEFINITION
Selects one of (4) input values In 1 – In 4 based on selector Sel 0
and Sel 1.
INPUTS
In 1 – In 4 — A signed input integer.
Sel 0 and Sel 1 — Selector inputs that form a two-bit binary value
used to select one of (4) inputs In 1 – In 4.
OUTPUT
Output — A signed integer.
FUNCTION
When Sel 1 is and Sel 0 is Output =
0 0 In 1
0 ≠0 In 2
≠0 0 In 3
≠0 ≠0 In 4
Multiply
MULTIPLY
ID = Exec =
BLOCK TYPE 28 decimal 1C hexadecimal NODE 0 In 1
NODE 1 In 2
DEFINITION
Multiplies two 16 bit inputs. This block calculates a 32 bit result that
is stored in two words Out LSW and Out MSW.
INPUTS
In 1 — A signed input integer.
In 2 — A signed input integer.
OUTPUTS
Out LSW — A least significant result word value representing bits
0–15 of a 32 bit output value.
Out MSW — A most significant result word value representing bits
16–31 of a 32 bit output value.
FUNCTION
Out LSW, Out MSW = In 1 × In 2.
Both the Most Significant Word and the Least Significant Word are
interpreted together by the function algorithm as one word when
using 32 bit values. The range of a double word value is
± 2,147,483,647. The range of the more common, signed single-word
16 bit node is ±32767.
MULTIPLY Bit 31 is the sign bit, the most significant bit for 32 bit values. For 16
(continued) bit values, bit 15 (the sign bit) is the most significant bit.
Important: The output range of the multiplied values can be critical. Should only one
output word (LSW node) of the MULTIPLY block be used, it will appear to
roll over or under if the product exceeds ± 32767.
+ 32767 (Upper Waveform)
MULTIPLY input
0 (Upper Waveform)
t1
0 (Lower Waveform)
No Operation
NO-OP
ID = Exec =
BLOCK TYPE 0 decimal 0 hexadecimal
DEFINITION
A PLC place holder.
PI Controller
PI CTRL
ID = Exec =
BLOCK TYPE 17 decimal 11 hexadecimal NODE 0 In +
NODE 1 In - KI
NODE 2 Set
NODE 3 Preset KP
NODE 4 Gain OUT
NODE 5 KI
NODE 6 KP
NODE 7 Min
NODE 8 Max IN
Lo Lim NODE 9
Hi Lim NODE 10
Output NODE 11
In Dif NODE 12
DEFINITION
A proportional/integral control function block that uses trapezoidal
integration.
INPUTS
IN1+ — A signed input integer to the PI block.
IN1– — A signed input integer to the PI block.
Set — A logic signal that when ≠ 0 sets the integral term’s
accumulator to the Preset value.
Preset — A signed integer that is preloaded into the integrator’s
accumulator when Set = true.
Gain — A scaled, signed integer that adjusts the In+ & In–
summing node. Scaling: 2048 = effective gain of 1.
KI — A word value that represents integral gain.
Scaling: 4096 = effective gain of 1, max effective gain of 8.
KP — A scaled word value that represents proportional gain.
Scaling: 4096 = effective gain of 1, max effective gain of 8.
Min — A signed integer that limits the lower value of the output
and the integral accumulator.
Max — A signed integer that limits the upper value of the output
and the integral accumulator.
OUTPUTS
Lo Lim — Low limit flag that is true when the calculated
Output < Min.
Hi Lim — Hi limit flag that is true when the calculated
Output > Max.
Output — A signed integer representing the output of the PI
controller.
In Dif — A signed integer that represents the difference between
In+ & In–. This value is limited to ±32767 and will not
represent the internal difference if it is not within these
limits.
PI CTRL FUNCTION
(continued) 1. If set = true
KIouti–1 = Preset
KIval = KIvali–1 = 0.
2. If set = false
sum (limited to ±32767) = Gain × (In+ – In–)/2048
KPout = sum × KP/4096
KIval = sum × KI/4096.
0"
A PI CTRL Output
– 32767 "
When the input difference steps from 0 to + 32767, the proportional term responds by going
from – 32767 to zero within one task interval. The Output then takes approximately one se-
cond to integrate up to the Max setting of + 32767.
0"
A PI CTRL Output
– 24576 "
– 32767 "
Y Y
PI CTRL Output PI CTRL Input (–)
When the input difference steps from 0 to – 32767, the proportional term responds by
immediately going to a value of – 24576. After 3 seconds, the Output integrates to zero. With
KI at 1/4 gain, it will accumulate at a rate of approximately 8191 units-per-second with an
input difference of + 32767. Note that it takes (4) seconds to integrate from 0 to + 32767.
+ 32767 "
PI CTRL Input
B
+ 16383 "
A PI CTRL Output
0"
A PI CTRL Output
– 16383 "
– 32767 "
The input difference in this example alternates between ± 16383. The proportional Output
response immediately jumps to 0. The Output takes one second to accumulate to + 16383
and two seconds to move from – 32767 to + 32767.
+ 32767 "
PI CTRL Input
B
+ 16383 "
Y
PI CTRL Output
0"
– 16383 "
– 32767 "
Y
PI CTRL Output
" 500 mS A
A–– 1 Second ––"
The Output reaches 16383 within 500 mS and + 32767 within one second. In this Example,
the Output is clamped at the positive and negative limits. The internal accumulator is also
clamped at these limits, and cannot accumulate beyond these limits. This allows the PI
CTRL function to immediately get out of saturation when the function’s input difference
changes polarity.
Pulse Counter
PULSE CNTR
ID = Exec =
BLOCK TYPE 18 decimal 12 hexadecimal NODE 0 In
NODE 1 Set
NODE 2 Preset
Out NODE 3
DEFINITION
Counts the rising edges of input signal In.
INPUTS
In — A logic input signal.
Set — A logic level value that preloads the pulse counter
accumulator with the Preset value when ≠ 0.
Preset — A signed integer that is preloaded into the pulse counter
accumulator when Set ≠ 0.
OUTPUT
Out — A signed integer that is incremented on every rising edge of
input signal In. Out increments to the positive limit but is
not allowed to roll over.
FUNCTION
If Set is true, then Out = Preset value.
If Set is false, then Out = Out + 1 on rising edge of In.
The plot shown in Example 1 shows the pulse counter Output incrementing with every rising
edge of the input signal.
Rate Limiter
RATE LIMITER
ID = Exec =
BLOCK TYPE 19 decimal 13 hexadecimal NODE 0 Lim In
NODE 1 Lim Set
NODE 2 Lim Data
NODE 3 Lim Rate
DEFINITION
Limits the rate of change of the input value Lim In by the value of
rate Lim Rate.
INPUTS
Lim In — A signed integer that is rate limited in the positive or
negative direction.
Lim Set — A logic value that preloads the output with the
Lim Data value when Lim Set ≠ 0.
Lim Data — A signed integer that the output will be set to when
Lim Set ≠ 0.
Lim Rate — A word that specifies the Lim Out maximum rate of
change in units/second.
OUTPUTS
Lim @ Lim — A logic flag that indicates Lim Out is limited by
Lim Rate.
Lim Out — A signed integer, rate limited to the Lim Rate value.
FUNCTION
1. If Lim Set is true, Lim Out = Lim Data.
RATE LIMITER
(continued) PARAMETERS DATA TYPE LINKABLE DEFAULT VALUE RANGE
Lim In Signed Integer Yes 0 ± 32767
Lim Set Logic Input Yes 0 True/False
Lim Data Signed Integer Yes 0 ± 32767
Lim Rate Unsigned Integer No 0 0 to 65535
Lim @ Lim Logic Output No — True/False
Lim Out Signed Integer No — ± 32767
Example 1
+ 32767
Lim In
Lim Out
0
– 32767 Time
Lim @Lim = True Lim @Lim = False
t1
Scale
SCALE
ID = Exec =
BLOCK TYPE 20 decimal 14 hexadecimal NODE 0 Input
NODE 1 Mult
NODE 2 Div
DEFINITION
Multiplies the input Input by Mult and divides by Div. The result is a
two word output consisting of a least significant word Out LSW, and
a most significant signed integer Out MSW. If the result is a value
between 0 and 65535, Out LSW contains the value and Out MSW is
0. For values less than 0 the sign bit that indicates the negative value
is bit 15 of Out MSW. When Div is equal to 0, the result of the scale
block is 0.
INPUTS
Input — A signed integer between ±32767.
Mult — A signed integer between ±32767.
Div — A signed integer between ±32767.
OUTPUTS
Out LSW — A least significant result word value representing bits
0–15 of a 32 bit output value.
Out MSW — A most significant result word value representing bits
16–31 of a 32 bit output value.
FUNCTION
Out LSW, Out MSW = (Input × Mult) ÷ Div.
PARAMETERS DATA TYPE LINKABLE DEFAULT VALUE RANGE
Input Signed Integer Yes 0 ± 32767
Mult Signed Integer Yes 0 ± 32767
Div Signed Integer Yes 1 ± 32767
Out LSW Unsigned Integer No — 0 to 65535
Out MSW Signed Integer No — ± 32767
SCALE Bit 31 is the sign bit, the most significant bit for 32 bit values. For 16
(continued) bit values, bit 15 (the sign bit) is the most significant bit.
EXAMPLES Example 1 EXAMPLE 2 EXAMPLE 2
Input 32767 56 –2
Mult 32767 128 16383
Div 1 10 1
Out LSW 1 716 32770
Out MSW 16383 0 –1
OUTPUT VALUE 1073676289 716 – 32766
Important: The output range of the multiplied values can be critical. Should only one
output word (LSW node) of the SCALE block be used, it will appear to roll
over or under if the product exceeds ± 32767.
+ 32767 (Upper Waveform)
SCALE Input
+ 16383 (Upper Waveform)
0 (Upper Waveform)
t1
0 (Lower Waveform)
Set Reset FF
SR FF
ID = Exec =
BLOCK TYPE 22 decimal 16 hexadecimal NODE 0 Set
NODE 1 Reset
S
Out S
Out 1 NODE 2
Out 2 NODE 3
DEFINITION
A set/reset function block where:
Out 1 is false if Reset is true.
Out 1 is true if Reset is false and Set is true.
Out 2 is the inverse of Out 1.
INPUTS
Set — A logic input value
Reset — A logic input value.
OUTPUTS
Out 1 — A logic output value
Out 2 — A logic output value.
FUNCTION
Out 1 is Set or Reset.
Subtract
SUB
ID = Exec =
BLOCK TYPE 27 decimal 1B hexadecimal NODE 0 In 1
NODE 1 Sub
Output NODE 2
DEFINITION
Subtracts two signed integers. Output will be clamped to ±32767
and not allowed to over or under flow.
INPUTS
In 1 — A signed integer between ±32767.
Sub — A signed integer between ±32767.
OUTPUT
Output — A signed integer between ±32767.
FUNCTION
Output = In 1 – Sub.
Out 1 NODE 1
Out 2 NODE 2
DEFINITION
A flip-flop function block that toggles the rising edge of the Clock
input.
INPUT
Clock — A logic input.
OUTPUTS
Out 1 — A logic output.
Out 2 — A logic output.
FUNCTION
When Clock signal changes from false to true:
Out 1 changes to the opposite state.
Out 2 is the inverse of Out 1.
Example
TRUE
CLOCK FALSE
TRUE
OUT1 FALSE
OUT2 TRUE
FALSE
0 1 2 3 4 5 6 7 8
Output NODE 2
DEFINITION
Sums two signed numbers Input #1 and Input #2. The output Output
is clamped to ±32767 should the sum exceed these limits.
INPUT
Input #1 — A signed integer between ±32767.
Input #2 — A signed integer between ±32767.
OUTPUT
Output — A signed integer between ±32767.
FUNCTION
Output = Input #1 + Input #2.
Up/Down Counter
UP/DWN CNTR
ID = Exec =
BLOCK TYPE 24 decimal 18 hexadecimal NODE 0 Set
NODE 1 Inc
NODE 2 Dec
NODE 3 Max
NODE 4 Min
UD1
NODE 5 UD1 UD2
NODE 6 UD2
Select t
NODE 7
NODE 8 Preset
NODE 9 Time
Dir NODE 10
@Hi Lim NODE 11
@Lo Lim NODE 12
Output NODE 13
DEFINITION
An up/down counter function block that can be programmed to count
up or down in a specified, programmable time period.
INPUTS
Set — A logic signal that when ≠ 0 sets the counter output to the
value of Preset.
Inc — A logical word that specifies the counter is to increment the
accumulator.
Dec — A logical word that specifies the counter is to decrement the
accumulator.
Max — A signed integer that limits the upper value of the output.
Min — A signed integer that limits the lower value of the output.
UD1 — An signed integer that together with Time determines
the Inc/Dec rate.
UD2 — A signed integer that together with Time determines the
Inc/Dec rate.
Select — An input word value if = 0 selects UD1, if ≠ 0 selects
UD2.
Preset — A signed integer that can be preloaded into the output if
Set ≠ 0.
Time — An unsigned word that determines the period where the
UD1/UD2 increment is to be added or subtracted from the
accumulator counter value. The Time value is entered in
mS, with a resolution limited by the task interval —
(Time in) / 20mS.
FUNCTION
1. If Set ≠ 0, the accumulator = Preset.
2. When Select = 0 and Time = time since last adjustment of
accumulator:
If Inc ≠ 0, the accumulator = accumulator + UD1, and Dir = 1.
If Dec ≠ 0, The accumulator = accumulator – UD1, and Dir = –1.
3. When Select ≠ 0 and Time = time since last adjustment of
accumulator:
If Inc ≠ 0, the accumulator = accumulator + UD2, and Dir = 1
If Dec ≠ 0, The accumulator = accumulator – UD2, and Dir = –1.
4. When the accumulator > Max:
The accumulator = Max, @Hi Lim = true, and @Lo Lim = false.
5. When the accumulator < Min:
The accumulator = Min, @Hi Lim = false, and @Lo Lim = true.
6. When the accumulator is < Max and > Min:
@Lo Lim = @Hi Lim = false.
7. When Output = accumulator, Dir = 0.
0"
– 32767 "
The number of iterations required to decrement the output from it’s Preset value of + 32767
to the Min value of – 32767 would be:
Total Iterations = Range ÷ Increment = 65534 ÷ 2048 = 31.99 ≈ 31.
The time it takes to traverse from a Max setting of + 32767 to – 32767 would be:
Total Time = Total Iterations ÷ Time Input = 31 × 240 mS = 7.44 S or approximately 7.4 S.
Preset = – 32767
Select = 0
UD1 = 2048
Time = 240 mS
+ 32767 "
Inc = 0 UP/DWN CNTR Output "
Dec = 1
Min = – 32767
Max = + 32767
0"
– 32767 "
Example 2 is similar to Example 1 except the UP/DWN CNTR must count up from a Preset
value of – 32767.
Block Transfer This chapter contains the message descriptions that you need to set
Descriptions up data files for the block transfer services using an Allen-Bradley
PLC or SLC-500 (using a 1747 SN adapter with an SLC 503 or 504).
Each block transfer message contains a three word command header
and a data buffer:
Header Word 1
Header Word 2
Header Word 3
Data Word 4
The first three words of a message make up the message header, and
are common to all RIO messages with the 1336T PLC
Communications Adapter Board.
Header and data values vary depending on the operation you are
performing. Also included is a description of the status word that is
returned from the drive and appears in the Block Transfer Read
Header.
Block Transfer Status If a block transfer operation is not successful, header word 2 of the
Word drive response contains a negative value (that is, bit 15 is set to 1
when an operation fails). The drive also usually returns a Status
Word to indicate the reason for the block transfer failure. The
location of the status word varies depending on the message, but it is
typically header word 4 in the drive response.
The status word codes that the drive may return are as follows:
Value Description
0 No error has occurred.
The service failed due to an internal reason, and the drive could not
1 perform the request. This may be returned if you tried to write with a
read only request or read with a write only request.
2 The requested service is not supported.
3 An invalid value is in block transfer request header word 2.
4 An invalid value is in block transfer request header word 3.
5 An invalid value is in block transfer request header word 2.
6 The data value is out of range.
Drive state conflict. The drive is in an incorrect state to perform the function.
7
The drive cannot be running when you perform certain functions.
Application Status The Event List Checksum message is a simple word addition of the
Services: valid events in the current application. This does not include node
Event List Checksum values or links.
Message Structure
Data
BRAM Event List Checksum Word 4
Execution Data
Event List Checksum (RAM) Word 5
Message Operation
The Event List Checksum message returns the sum of the valid events
in the active application (RAM) and in BRAM. The drive makes a
checksum value available so that you can differentiate between the
running application and the application stored in BRAM.
When you request an Event List Checksum, the drive returns the
BRAM event list checksum in word 4 and the execution list
checksum in word 5. If the checksum values are the same, then the
current application has the same events. However, there may be
differences in the links or node values or in the order of events.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F03 0
Data File
BTR
N10:90 0 0F03 0 28C3 0A4A
Data File
BRAM RAM
Checksum Checksum
Notice that the BRAM checksum and the RAM checksum are
different. This indicates that the application that is currently
executing in the drive is not the same as the application that is stored
in BRAM.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F03 0
Data File
BTR
N10:90 0 0F03 0 0A4A 0A4A
Data File
BRAM RAM
Checksum Checksum
Application Status The Read Task Name message is used to read a text string from a data
Services: buffer. The text string is the function block task name, and may
Read Task Name contain up to 16 characters.
Message Structure
Data
Char 2 Char 1
Word 4
• • •
• • •
• • •
Data
Char 16 Char 15 Word 11
Message Operation
The User ID Text String allows you to read the task name from a data
buffer. The task name can be up to 16 characters.
Example
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 \0F\06 0
Data File
BTR
N10:90 \00\00 \0F\06 \00\00 rd vi e 1#
Data File
Application Status The Write Task Name message is used to write a task name to a data
Services: buffer. The task name may contain up to 16 characters.
Write Task Name
Message Structure
Data
Char 16 Char 15 Word 11
Message Operation
Example
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 \0F\06 \00\00 rd vi e 1#
Data File
BTR
N10:90 0 \0F\06 \00\00
Data File
Application Status The Total Number of Events in Application message requests the total
Services: number of events in the currently active execution list.
Total Number of Events in
Application PLC Block Transfer Instruction Data
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
3842 Header Word 2 PLC Decimal Value Header
3842 –– Message OK
–28926 –– Message Error Word 2
16384 Header Word 3
Header
16384
Word 3
Message Operation
The PLC requests the number of events (function blocks) that are in
the current execution list. The drive response indicates the total
number of events. An application can have a maximum of 128
events.
If the drive returns 0 for the number of events in the execution list,
no application is currently active in the drive.
Note: The value returned does not reflect what may or may not be
stored in BRAM.
Example
In this example, the drive’s response reports that 58 events are in the
drive’s execution list. This example uses decimal values.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:0 0 3842 16384
Data File
BTR
N10:90 0 3842 16384 58
Data File
Application Status The Total Number of I/O Nodes message provides the number of
Services: nodes used in the function block application currently running in the
Total Number of I/O Nodes drive.
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
Header Word 2 PLC Decimal Value
3841 Header
3841 –– Message OK
–28927 –– Message Error Word 2
–32768 Header Word 3
Header
–32768 Dec
Word 3
Message Operation
The PLC requests the number of nodes that are associated with the
active execution list in the drive. The drive response indicates the
total number of nodes used by all function blocks in the execution
list.
Example
In this example, the PLC has requested the total number of nodes
used. The drive responds that 24 nodes are used in the current
application.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 3841 -32768
Data File
BTR
N10:90 0 3841 -32768 24
Data File
Application Status The Read Task Status message requests the current status of the
Services: function block program in RAM.
Read Task Status
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
Header Word 2 PLC Decimal Value
3844 Dec Header
3844 –– Message OK
–28924 –– Message Error Word 2
0 Header Word 3
Header
0
Word 3
Data
Task Status
Word 4
Value Task Status
0 Run Mode
1 Download In Progress
2 Compilation In Progress
3 Link Processing
4 Recall in Progress
255 Faulted Mode
Message Operation
The Read Task Status message returns a code value that indicates the
status of the current function block program.
Example
This BTR indicates that the drive is currently in the Run Mode.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 3844 0
Data File
BTR
N10:90 0 3844 0 0
Data File
Application Status The Fault Status Read message reads the fault code information from
Services: the drive when a fault is associated with the function block program.
Fault Status Read A function block fault is indicated by Task Status of FFHex. To get
the Task Status, use the Read Task Status block transfer routine.
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
Header Word 2 PLC Decimal Value
3845 Header
3845 –– Message OK
–28923 –– Message Error Word 2
0 Header Word 3
Header
0
Word 3
Data
Fault Code
Word 4
Data
Code Identifier
Word 5
Message Operation
Word 4 is the actual (bit encoded) value of the function block fault
status register. You should use this word mainly as a fault flag
during download and compile operations.
Fault Status Read Word 5 is interpreted differently depending on the type of compiler
(continued) fault.
If you receive an I/O node limit error (indicated when Word 4 is 4),
the execution list contains more than the allowable number of nodes.
Example
Data Format
0 1 2 3 4 5 6 7 8 9
Example 1 BTW
N10:10 0 0F05 0
Data File
BTR
N10:90 0 0F05 0 2 810A
Data File
Example 2 BTW
N10:10 0 3845 0
Data File
BTR
N10:90 0 3845 0 1024Dec 6
Data File
Program Limits The Library Description message allows you to read the library’s
Information: version number and the number of blocks in the library.
Library Description
Message Structure
Data
Library Version * 100 Word 4
Message Operation
Example
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 3840 –16384
Data File
BTR
N10:90 0 3840 –16384 100 28
Data File
Program Limits The Scheduled Task Interval (mS) message allows you to determine
Information: the task interval used when executing your application.
Scheduled Task Interval (mS)
Message Structure
Data
20 Dec
Word 4
Message Operation
The Scheduled Task Interval (mS) message returns the task interval
used when executing your application. The task interval is given in
milliseconds. Currently, this value is always 20 milliseconds.
Example
In this example, the drive returns 20Dec for the task interval.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 3840 16384
Data File
BTR
N10:90 0 3840 16384 20
Data File
Program Limits The Maximum Number of Events per Application message allows you
Information: to determine the maximum number of events that you can have in
Maximum Number of Events each application.
per Application
Message Structure
Data
128Dec Word 4
Message Operation
This message returns the maximum number of events that you can
have in an application. Currently, this number is always 128.
Example
In this example, the drive returns 128 for the maximum number of
events per application.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 3841 16384
Data File
BTR
N10:90 0 3841 16384 128
Data File
Program Limits The Number of Function Block Task Files in Product message allows
Information: you to determine the number of function block task files in the
Number of Function Block Task product.
Files in Product
Message Structure
Data
1 Word 4
Message Operation
This message returns the number of function block task files that are
in the product. Currently, only one file is available.
Program Limits The Maximum Number of I/O Nodes Allowed per Application message
Information: allows you to determine the maximum number of I/O nodes that you
Maximum Number of I/O Nodes can have in each application.
Allowed per Application
Message Structure
Data
799
Word 4
Message Operation
This message returns the maximum number of I/O nodes that you
can have in each application. Currently, this request always returns
799.
Example
In this example, the drive returns 799 for the maximum number of
available I/O nodes per application.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 3840 –32768
Data File
BTR
N10:90 0 3840 –32768 799
Data File
Application Control The PLC Communication Board sends this message to activate the
Commands: function block BRAM function that is detailed in the message
BRAM Functions request.
Store, Recall, and Initialize
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
Header Word 2 PLC Decimal Value
-28926 Header
3842 –– Message OK
–28926 –– Message Error Word 2
0 Header Word 3
Header
0
Word 3
BRAM Command Data Word 4
Data
BRAM Command Word 4
Value BRAM Command
0 Not used
1 BRAM Store
2 BRAM Recall
3 BRAM Initialize
Message Operation
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 -28926 0 1
Data File
BTR
N10:90 0 3842 0
Data File
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 -28926 0 2
Data File
BTR
N10:90 0 3842 0
Data File
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 -28926 0 3
Data File
BTR
N10:90 0 3842 0
Data File
Application Control The Download and Compile message does the following:
Commands:
Download and Compile ❒ Downloads up to 32 valid events.
❒ Performs service checks.
❒ Compiles these events into a function block application.
Because the download and compile service downloads a maximum
of 32 events in one message, your application may need to be
downloaded in multiple messages, or packets. The number of events
in your application determines the number of packets. Currently, the
maximum number of packets you can have is 4 (packet 0 through
packet 3) because of the 128 event limitation.
0 Header Word 1
Header
0
Word 1
PLC Hex Value Header Word 2
8F03 PLC Hex Value Header
0F03 –– Message OK
8F03 –– Message Error Word 2
4000 (hex) Header Word 3
Header
4000 (hex)
Word 3
Packet Number Data Word 4
0
Number of Events
Data Word 5
in Event List
• •
• •
• •
0 Header Word 1
Header
0
Word 1
PLC Hex Value
Header Word 2 PLC Hex Value
8F03 Header
0F03 –– Message OK
8F03 –– Message Error Word 2
4000 (hex) Header Word 3
Header
4000 (hex)
Word 3
Packet Number Data Word 4
Number of Events
Data Word 5
in Packet
• •
• •
• •
After the drive receives all packets required for the application, the
drive performs a number of checks on the data. After all the service
checks have passed, the function block compiler is activated and the
service is acknowledged. However, compilation is not complete
when the last packet is acknowledged. Instead, compilation is
performed as a background task.
Compile time errors will soft fault the drive. If no compiler errors
are found, all function blocks are processed. If no errors occur after
this, the function block task is enabled for execution.
Note: If the data fails the tests, the drive will Not AcKnowledge
(NAK) the service but will not fault the drive, and a warning will be
logged in the drive’s warning queue. These service failures reset the
service to accept another download and compile attempt. The
currently active application is not interrupted.
BTW
N10:10 0 8F03 4000 0000 0004 0A4A 010C 0216 0315 0413
Data File
BTR
N10:90 0 0F03 4000
Data File
Note: If less than 32 events are in the packet, the rest of the event
data is padded with zeros.
Download and Compile Regardless of the method that you use, the data (in hexadecimal) for
(continued) the three packets is as follows:
Packet 0 Data
0 1 2 3 4 5 6 7 8 9
BTW
N67:0 0 8F03 4000 0 60 663A 705 815 0C14 0
Data File
N67:20 3015 3208 3413 3515 0 3715 380D 3C14 401B 4415
Packet 1 Data
0 1 2 3 4 5 6 7 8 9
BTW
N67:100 0 8F03 4000 1 20 58F1 501B 541A 5814 5C14
Data File
Packet 2 Data
0 1 2 3 4 5 6 7 8 9
BTW
N67:200 0 8F03 4000 2 20 D49E B014 B20D B41C B614
Data File
N67:220 CC0C CD04 CE04 0 D019 D115 D408 D515 D60A D714
Application Control The Read Single Event message reads the block type number and
Commands: block ID number for the requested execution number within the
Read Single Event drive’s execution list.
Message Structure
Message Operation
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F00 4007
Data File
BTR
N10:90 0 0F00 4007 0C14
Data File
Application Control The Clear/Process Links message is used to clear or process all
Commands: function block node links in the event list.
Clear/Process Links
PLC Block Transfer Instruction Data
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
Header Word 2 PLC Decimal Value
-28926 Header
3842 –– Message OK
–28926 –– Message Error Word 2
–32768 Header Word 3
Header
–32768
Word 3
FB Links Command Data Word 4
Data
FB Links Command Word 4
Value Command
0 Not used
1 Clear FB links
2 Process FB links
Message Operation
When word 4 is 1, this request clears all function block links in the
drive. The Clear Links operation also clears links for linear drive
parameters that receive information from function block nodes. To
clear a single link, you need to:
Note: Clearing links using the Clear Links operation clears the links
from the working RAM area. This operation does not affect data
stored in BRAM.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:0 0 -28926 -32768 1
Data File
BTR
N10:90 0 3842 -32768 1
Data File
Application Control The Download Service Init message initializes the download service.
Commands:
Download Service Init PLC Block Transfer Instruction Data
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Decimal Value
Header Word 2 PLC Decimal Value
-28924 Header
3844 –– Message OK
–28924 –– Message Error Word 2
16384 Header Word 3
Header
16384
Word 3
Data
Status Word Word 4
Message Operation
The Download Service Init message is available for you to use when
you need to initialize the download service.
Node Adjustment: The Read Block Value message reads the 16–bit parameter data value
Read Block Value for the specified function block. This returns all node values for one
block.
Message Structure
Data
Node 0 Value
Word 5
Message Operation
The Read Block Value function specified in the BTW reads the
specified function block values from the drive and places the values
(or an error code) in words 5 through 36 of the BTR data file. If an
error has occurred, word 2 of the BTR is 8F05Hex and word 4
contains the status code.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F05 8004
Data File
BTR
N10:90 0 0F05 8004 7FFF 0 7FFF FFFF 584A 0 0
Data File
Node Adjustment: The Write Block Value message writes the 16 bit data values to the
Write Block Value specified function block. All the values for the entire function block
are sent.
Message Structure
Message Operation
The data buffer contains the packet number and up to 32 valid node
values. Therefore, you must pad the length of the buffer with zeros
to reach the 32 value length if the function block has less than 32
nodes.
If any of the values are out of range for any given node, the service
will fail.
Values beyond the valid number of inputs for the given block ID are
ignored.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 8F05 8004 7FFF 0 7FFF FFFF 584A 0 0
Data File
BTR
N10:90 0 0F05 8004
Data File
Node Adjustment: The Read Block Link message reads the link information for an entire
Read Block Link block.
Message Structure
Data
Node 0 Source
Word 5
Data
Node 1 Source
Word 7
• •
• •
• •
Message Operation
The Read Block Link message reads the source nodes that are linked
to the specified block. The returned message packet contains 33 data
buffer words, and is always padded with zeros to length.
Node Adjustment: The Write Block Link message writes the link information for an
Write Block Link entire block.
Message Structure
Data
Node 1 Source
Word 7
• •
• •
• •
Message Operation
The Write Block Link message writes the output parameter to the
input parameter. The data words contain the packet number and up
to 15 source nodes. The buffer must always be padded with zeros if
32 nodes are not being written.
Write Block Link Output values that are beyond the number of valid linkable input
(continued) nodes are ignored. Therefore, if a block type has only one linkable
input and five links are written, only one is established.
Currently, you can disregard the file number. The file numbers are
for future use. For now, you should set the file number to 0 for a
linear parameter output and 1 for a function block node.
Node Adjustment: The Read Full Node Information message provides all known
Read Full Node Information attributes for any node in the current application. This information
includes the node’s current value, descriptor, multiply and divide
value, base value, offset value, text string, file group and element
reference, minimum value, maximum value, and default value.
Message Structure
1 Data
Word 6
1 Data
Word 7
1 Data
Word 8
Data
0
Word 9
Node Text Data
Character 2 Character 1 Word 10
Node Text Data
Character 4 Character 3 Word 11
Node Text Data
Character 6 Character 5 Word 12
Node Text Data
Character 8 Character 7 Word 13
Node Text Data
Character 10 Character 9 Word 14
Data
Minimum Value
Word 18
Data
Maximum Value
Word 19
Data
Word 21
Data
Word 22
Message Operation
Read Full Node Information provides all known attributes for any
node in the current application.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0000 0F00 8504
Data File
BTR
N10:90 0000 0F00 8504 CCCE 002B 0001 0001 0001 0000 6152
Data File
N10:100 6574 4620 6D69 2320 2034 754F 2074 8001 7FFF 0000
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 \00\00 \0F\00 à \04
Data File
BTR
N10:90 \00\00 \0F\00 à \04 \CC\CE \00 + \00\01 \00\01 \00\01 \00\00 a R
Data File
N10:110
Node Adjustment: The Read Node Value message reads the value of the specified
Read Node Value function block node.
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Hex Value
Header Word 2 PLC Hex Value
0F01 Header
0F01 –– Message OK
8NID 8F01 –– Message Error Word 2
N ID Header Word 3 8NID
High Byte Low Byte Header
N ID
High Byte Low Byte Word 3
If N=16, 8NID becomes 90ID.
Node Data
Value Word 4
where:
N = the node number
ID = the block ID number
Message Operation
Example
In this example, a Read Node Value message was sent to the drive to
read the value of node 1 of the Scale function block (block ID 11Dec,
0BHex). The drive response indicates the value of node 1 is 4.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F01 810B
Data File
BTR
N10:90 0 0F01 810B 4
Data File
Node Adjustment: The Write Node Value operation writes a value to a specified function
Write Node Value block node.
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Hex Value
Header Word 2 PLC Hex Value
8F01 Header
0F01 –– Message OK
8F01 –– Message Error Word 2
8NIDHex Header Word 3 8NID Header
N ID
High Byte Low Byte Word 3
Node Value Data Word 4
Header
Status Word
Word 4
where:
N = the node number
ID = the block ID number
Message Operation
Example
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:0 0 8F01 810B 4
Data File
BTR
N10:90 0 0F01 810B
Data File
Node Adjustment: The Read Node Link operation reads the drive parameter or the node
Read Node Link numbers of the source that is linked to the specified function block
node.
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Hex Value
Header Word 2 PLC Hex Value
0F04 Header
0F04 –– Message OK
8NID 8F04 –– Message Error Word 2
N ID Header Word 3 8NID
High Byte Low Byte Header
N ID
If N=16, 8NID becomes 90ID. High Byte Low Byte Word 3
Data
Linked Source
Word 4
where:
N = the node number
ID = the block ID number
Message Operation
The Read Node Link operation reads the output parameter that is
linked to the function block node specified in word 3.
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F04 8304
Data File
Example 1 BTR
N10:90 0 0F04 8304 92
Data File
node 0
ID = 4
node 1
node 2
Source Destination node 3
p.146
(8304)
Data Format
0 1 2 3 4 5 6 7 8 9
BTW
N10:10 0 0F04 8304
Data File
Example 2 BTR
N10:90 0 0F04 8304 8209
Data File
node 0 ID = 9 node 2
(8209)
Source
node 1
node 0
ID = 4
node 1
node 2
Destination
node 3
(8304)
Node Adjustment: The Write Node Link operation creates a single node link between a
Write Node Link specified drive linear parameter number or function block node and
the destination node.
Message Structure
0 Header Word 1
Header
0
Word 1
PLC Hex Value
Header Word 2 PLC Hex Value
8F04 Header
0F04 –– Message OK
8NID 8F04 –– Message Error Word 2
N ID Header Word 3 8NID
High Byte Low Byte Header
N ID
High Byte Low Byte Word 3
Source Data Word 4
Header
Status Word
Word 4
If N=16, 8NID becomes 90ID.
where:
N = the node number
ID = the block ID number
Message Operation
Note: You must make sure that the drive is disabled when you
perform a Write Node Link operation. If the drive is running, it will
not accept the link and it will reject the message.
Data Format
0 1 2 3 4 5 6 7 8 9
Example 1 BTW
N10:10 0 8F04 8304 92
Data File
Example 2 BTW
N10:10 0 8F04 8304 8209
Data File
BTR
N10:90 0 0F04 8304
Data File
node 0 ID = 9 node 2 ID = x
(8209)
node 1
node 0
ID = 4
node 1
node 2
node 3
(8304)
Handling Function Block If there is a problem with your function block application, either a
Faults and Warnings fault or a warning will occur.
All function block faults are soft faults. Soft faults indicate that an
error has been detected that could damage drive components or the
motor. Soft faults may also indicate potential undesirable operation.
You cannot enable the drive if you have a soft fault condition.
You need to correct the problem that caused the fault before you can
clear the function block system fault with a clear faults command. If
you use a clear faults command before you correct the function block
problem, the function block fault will remain in the queue but the
other faults in the system queue will be cleared.
Most function block system faults are designated for compile time
errors. The download service performs a number of tests before
starting the compile process for the purpose of avoiding compile
faults.
To handle the faults and warnings, you need to access the system
fault and warning queues that are associated with each drive. Each
entry in the queue shows the type of fault and the time and date when
the fault occurred.
Accessing the System Once a fault or warning occurs, the information about the fault is
Fault and Warning Queues maintained in BRAM until you clear the fault queue using a Clear
Fault Queue command. To clear the function block fault once you
have corrected the problem within the function block application,
perform one of the following tasks:
Handling Download Because the download operation is more complicated than most of
Service Errors the block transfer services, it is more common to see faults/warnings
at this time. The download operation may require that multiple
messages be sent before initiating a compile operation. When an
application requires more than one message packet, the service
ensures that a compile operation does not begin until the last
required packet is received and acknowledged.
After receiving the last packet, the drive performs a series of checks
to verify the new execution list:
❒ The drive goes over the execution list and verifies the checksum.
If the checksum fails, the service fails.
❒ The drive checks that any new events with block numbers that
match block numbers found within the current application have
the same block type. If the block number verification fails, the
service fails.
❒ The service verifies that the block type numbers are within the
valid range.
❒ The service verifies that events with a zero for a block ID have a
zero value for a block type number and that events with a zero for
a block type number have a zero for a block ID.
When the download service fails, the following steps are taken:
Handling Compile Faults When a new execution list has been downloaded and all the service
checks have been passed:
Even though it is unlikely that you will receive a fault once the event
list has passed the service checks, several faults are possible.
If a link processing fault occurs, the execution list has been compiled
and all the blocks are valid. Link processing faults are actually
generated after the compilation is complete. If no other faults
occurred, you can:
Important: You cannot clear function block faults with a clear fault
operation without first addressing the problem. The
function block system will not make an assumption
about what to do with an illegal link. You must either
clear the link to this node or reconnect the node to a
valid node. You can then use the clear faults mechanism
to clear the faults and allow the drive to run.
If you receive an I/O node limit fault, you have created more than
799 function block nodes due to the number and type of blocks you
entered into your execution list. You need to:
If you receive a BRAM Checksum fault, the data in the BRAM has
been corrupted. You need to:
Using the Task Status Service To check to see if a fault occurred, you can use the Read Task Status
service. The Task Status is returned in word 4 of the drive’s
response. The Task Status returns a code value to indicate the status
of the current function block program. The following are the valid
code values.
Using the Fault Status The function block fault status service actually does more than
Service identify function block system faults. It also provides information
on other parts of the function block system when not faulted. This
helps when you are troubleshooting the system when first setting up,
particularly when you are downloading with a PLC.
Bit # 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 5 x x x x x x x x x x x x 0 0 1 1
In this case, word 4 of the Fault Status is zero because the system has
not encountered a fault.
Download Errors
For example, if you issue a Fault Status Read request and the drive
response indicates that word 4 is 200Hex and word 5 is 183Hex
(387Dec), an invalid link occurred at parameter 387Dec. You need to
adjust the link to parameter 387 before you can clear the fault queue.
The system Clear Faults command initiates the Process All FB Links
service. If no other illegal links are found, the system fault is cleared
and drive enable is allowed.
Fault Codes The following table provides a description of the possible faults and
warnings and the action that you need to take to clear the problem.
You can help! Our manuals must meet the needs of you, the user. This is your opportunity to make sure they do just that.
By filling out this form you can help us provide the most useful, thorough, and accurate manuals available. Please take a
few minutes to tell us what you think - then mail this form or FAX it.
FAX: your local Allen-Bradley Sales Office or 414/512-8579
✔ WHAT LEVEL OF EXPERIENCE DO YOU HAVE WITH EACH OF THE FOLLOWING PRODUCTS?
✔ RATE THE OVERALL QUALITY OF THIS MANUAL BY CIRCLING YOUR RESPONSE BELOW. (1) = POOR (5) = EXCELLENT
✔ PLEASE LIST ANY ERRORS YOU FOUND IN THIS MANUAL (REFERENCE PAGE, TABLE, OR FIGURE NUMBERS).
✁
FOLD HERE
NO POSTAGE
NECESSARY
IF MAILED
IN THE
UNITED STATES
ALLEN-BRADLEY
Attn: Marketing Communications
P.O. Box 760
Mequon, WI 53092-9907
PLC is a registered trademark of Allen–Bradley Company, Inc.
SCANport is a trademark of Allen-Bradley Company, Inc.
1336 FORCE and 1336 PLUS are trademarks of Allen–Bradley Company, Inc.
Allen-Bradley, a Rockwell Automation Business, has been helping its customers improve
productivity and quality for more than 90 years. We design, manufacture and support a broad
range of automation products worldwide. They include logic processors, power and motion
control devices, operator interfaces, sensors and a variety of software. Rockwell is one of the
world’s leading technology companies.
Worldwide representation.
Argentina • Australia • Austria • Bahrain • Belgium • Brazil • Bulgaria • Canada • Chile • China, PRC • Colombia • Costa Rica • Croatia • Cyprus • Czech Republic •
Denmark • Ecuador • Egypt • El Salvador • Finland • France • Germany • Greece • Guatemala • Honduras • Hong Kong • Hungary • Iceland • India • Indonesia •
Ireland • Israel • Italy • Jamaica • Japan • Jordan • Korea • Kuwait • Lebanon • Malaysia • Mexico • Netherlands • New Zealand • Norway • Pakistan • Peru •
Philippines • Poland • Portugal • Puerto Rico • Qatar • Romania • Russia–CIS • Saudi Arabia • Singapore • Slovakia • Slovenia • South Africa, Republic • Spain •
Sweden • Switzerland • Taiwan • Thailand • Turkey • United Arab Emirates • United Kingdom • United States • Uruguay • Venezuela • Yugoslavia
Allen-Bradley Headquarters, 1201 South Second Street, Milwaukee, WI 53204 USA, Tel: (1) 414 382-2000 Fax: (1) 414 382-4444