2080 rm001 - en e
2080 rm001 - en e
2080 rm001 - en e
Activities including installation, adjustments, putting into service, use, assembly, disassembly, and maintenance are required to be carried out by
suitably trained personnel in accordance with applicable code of practice. If this equipment is used in a manner not specified by the manufacturer,
the protection provided by the equipment may be impaired.
In no event will Rockwell Automation, Inc. be responsible or liable for indirect or consequential damages resulting from the use or application of this
equipment.
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, Rockwell Automation, Inc. cannot assume responsibility or liability for actual use based on the examples and
diagrams.
No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, circuits, equipment, or software described in this
manual.
Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation, Inc., is prohibited.
Throughout this manual, when necessary, we use notes to make you aware of safety considerations.
WARNING: Identifies information about practices or circumstances that can cause an explosion in a hazardous environment, which may lead to
personal injury or death, property damage, or economic loss.
ATTENTION: Identifies information about practices or circumstances that can lead to personal injury or death, property damage, or economic
loss. Attentions help you identify a hazard, avoid a hazard, and recognize the consequence
Important: Identifies information that is critical for successful application and understanding of the product.
SHOCK HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that dangerous voltage may be
present.
BURN HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that surfaces may reach dangerous
temperatures.
ARC FLASH HAZARD: Labels may be on or inside the equipment, for example, a motor control center, to alert people to potential Arc Flash. Arc
Flash will cause severe injury or death. Wear proper Personal Protective Equipment (PPE). Follow ALL Regulatory requirements for safe work
practices and for Personal Protective Equipment (PPE).
Allen-Bradley, Rockwell Software, Rockwell Automation, and TechConnect are trademarks of Rockwell Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
Table of contents
Chapter 1
Chapter 2
Chapter 4
Chapter 5
Chapter 6
ASCII serial port instructions ABL (ASCII test for buffer line) ................................................................................... 117
ACB (ASCII characters in buffer)................................................................................ 119
ACL (ASCII clear buffer) .............................................................................................. 122
AHL (ASCII handshake lines)...................................................................................... 124
ARD (ASCII read)........................................................................................................... 127
ARL (ASCII read line).................................................................................................... 130
4 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
Table of contents
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Motion control instructions General rules for motion control function blocks ..................................................... 434
Motion control function block parameter details ..................................................... 436
Motion control axis states....................................................................................... 437
Motion control function block parameter numbers ......................................... 439
Motion control function block error IDs............................................................ 441
Axis error scenarios .................................................................................................. 442
AXIS_REF data type ............................................................................................... 443
FB_AXIS_REF data type ....................................................................................... 444
Axis variables ............................................................................................................. 445
MC_AbortTrigger (motion control abort trigger) ................................................... 445
MC_Halt (motion control halt)................................................................................... 448
MC_Home (motion control home) ............................................................................ 452
MC_MoveAbsolute (motion control move absolute) ............................................. 456
MC_MoveRelative (motion control move relative) ................................................. 461
MC_MoveVelocity (motion control move velocity)................................................ 466
MC_Power (motion control power) ........................................................................... 470
MC_ReadActualPosition (motion control read actual position) .......................... 474
MC_ReadActualVelocity (motion control read actual velocity) ........................... 479
MC_ReadAxisError (motion control read axis error) ............................................. 484
AxisErrorID error codes ......................................................................................... 487
MC_ReadBoolParameter (motion control read BOOL parameter) .................... 489
MC_ReadParameter (motion control read parameter) ........................................... 493
MC_ReadStatus (motion control read status)........................................................... 495
MC_Reset (motion control reset) ................................................................................ 501
MC_SetPosition (motion control set position) ........................................................ 503
MC_Stop (motion control stop) .................................................................................. 507
MC_TouchProbe (motion control touch probe) ..................................................... 510
MC_WriteBoolParameter (motion control write BOOL parameter) ................. 514
Chapter 18
Chapter 19
Chapter 20
Proportional Integral What is Proportional Integral Derivative (PID) control? ....................................... 565
IPIDCONTROLLER (proportionalintegralderivative controller) ................ 565
Derivative (PID) instruction
GAIN_PID data type .............................................................................................. 569
AT_Param data type................................................................................................ 570
How the IPIDController function block implements PID control .............. 571
IPIDController function block operation .......................................................... 572
Use the Proportional Integral Derivative instruction....................................... 574
Use auto-tune with the IPIDController function block .......................... 577
Auto-tune in first and second order systems ............................................... 577
Configure auto-tuning .................................................................................... 578
Use a Structured Timing Interrupt (STI) with auto-tuning ................... 583
Example: IPIDController with auto-tune .................................................. 583
Example: How to create a feedback loop for the manipulated value ..... 585
Example: How to add a UDFB to a PID program .................................... 586
Example: How to create an IPIDController program to control
temperature........................................................................................................ 587
Example: How to create an IPIDController program to control water
supply level ......................................................................................................... 589
PID (proportional-integral-derivative)........................................................................ 592
PID instruction state machine ............................................................................... 597
PID instruction timing diagrams .......................................................................... 598
Chapter 21
Real Time Clock (RTC) RTC_READ ( read real-time clock) ............................................................................ 605
RTC_SET (set real-time clock) .................................................................................... 607
instructions
Chapter 22
Chapter 23
Chapter 24
In This Manual This guide provides reference information about the instruction set available for
developing programs for use in Micro800 control systems. The instruction set
includes Structured Text (ST), Ladder Diagram (LD) Function Block Diagram
(FBD) programming language support. Additionally, the ladder elements
supported in Connected Components Workbench development environment are
defined.
Supported Controllers Connected Components Workbench includes configuration support for the
following Micro800 controllers.
2080-LC10-12AWA 2080-LC30-24QBB
2080-LC10-12DWD 2080-LC30-24QVB
2080-LC10-12QBB 2080-LC30-24QWB
2080-LC10-12QWB 2080-LC30-48AWB
2080-LC20-20AWB 2080-LC30-48QBB
2080-LC20-20QBB 2080-LC30-48QVB
2080-LC20-20QWB 2080-LC30-48QWB
2080-LC30-10QVB 2080-LC50-24AWB
2080-LC30-10QWB 2080-LC50-24QBB
2080-LC30-16AWB 2080-LC50-24QVB
2080-LC30-16QVB 2080-LC50-24QWB
2080-LC30-16QWB 2080-LC50-48AWB
2080-LC50-48QBB
2080-LC50-48QVB
2080-LC50-48QWB
Additional Resources These documents contain additional information concerning related Rockwell
Automation products.
Resource Description
Industrial Automation Wiring and Grounding Guidelines, Provides general guidelines for installing a Rockwell
publication 1770-4.1 available at Automation industrial system.
http://literature.rockwellautomation.com/idc/groups/lite
rature/documents/in/1770-in041_-en-p.pdf .
Resource Description
Product Certifications website, http://www.ab.com Provides declarations of conformity, certificates, and other
certification details.
You can view the Rockwell Automation End-User License Agreement ("EULA")
by opening the License.rtf file located in your product's install folder on your hard
drive.
Trademark Notices
Other Trademarks
Microsoft, Excel, Visual C++, SQL Server and Visual Studio are either registered
trademarks or trademarks of Microsoft Corporation in the United States and/or
other countries. Adobe, Reader, and Acrobat are either registered trademarks or
trademarks of Adobe Systems Incorporated in the United States and/or other
countries. OPC is either a registered trademark or trademark of OPC Foundation
in the United States and/or other countries. Kepware is either a registered
trademark or trademark of Kepware Technologies Corporation in the United
States and/or other countries. All other trademarks are the property of their
respective holders and are hereby acknowledged.
14 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
Preface
Warranty
This product is warranted in accordance with the product license. The products
performance may be affected by system configuration, the application being
performed, operator control, maintenance, and other related factors. Rockwell
Automation is not responsible for these intervening factors. The instructions in
this document do not cover all the details or variations in the equipment,
procedure, or process described, nor do they provide directions for meeting every
possible contingency during installation, operation, or maintenance. This
products implementation may vary among users.
This document is current as of the time of release of the product; however, the
accompanying software may have changed since the release. Rockwell Automation,
Inc. reserves the right to change any information contained in this document or
the software at any time without prior notice. It is your responsibility to obtain the
most current information available from Rockwell when installing or using this
product.
Environmental compliance
Instruction blocks The Connected Components Workbench instruction set includes IEC 61131-3
compliant instruction blocks for Micro800 controllers. Instruction blocks
collectively include operators, functions and function blocks.
See also
Operators on page 17
Functions on page 18
Operators The Connected Components Workbench instruction set includes IEC 61131-3
compliant instruction blocks for Micro800 controllers; operators are included in
the Connected Components Workbench instruction set.
See also
Functions on page 18
Functions Functions have one or more input parameters and one output parameter.
Input Each input of an instruction block is labeled and has a defined type.
Output Each output of an instruction block is labeled and has a defined type.
Calling a function
Any program of any section can call one or more functions. A function can
have local variables.
A function has no instance meaning local data is not stored and so is usually
lost from one call to the other.
Because the execution of a function is driven by its parent program, the
execution of the parent program is suspended until the function ends.
The interface of a function must be explicitly defined with a type and a unique
name for each of its calling (input) parameters or return (output) parameters. A
function has one return parameter. The value of a return parameter for a function
block is different for each programming language (FBD, LD, ST).
Function names and function parameter names can use up to 128 characters.
Function parameter names can begin with a letter or an underscore followed by
letters, numbers, and single underscores.
See also
Operators on page 17
Function blocks A function block is an instruction block that has input and output parameters and
works on internal data (parameters). It can be written in Structured Text, Ladder
Diagram, or Function Block Diagram languages.
Input Each input of an instruction block is labeled and has a defined type.
Output Each output of an instruction block is labeled and has a defined type.
The interface of a function block must be explicitly defined with a type and a
unique name for each of its calling (input) parameters or return (output)
parameters. Function blocks can have more than one output parameter. The value
of a return parameter for a function block is different for each programming
language (FBD, LD, ST).
Function block names and function block parameter names can use up to 128
characters. Function block parameter names can begin with a letter or an
underscore followed by letters, numbers, and single underscores.
See also
Functions on page 18
Operators on page 17
Instruction set in The following table lists the Micro800 controller instructions available in
Connected Components Workbench in alphabetical order.
alphabetical order
Instruction Category Type Description
ABL on page 117 Communications Function block Counts the number of characters in the buffer up to
and including end of line character.
ABS on page 72 Arithmetic Function Returns the absolute value of a Real value.
ACB on page 119 Communications Function block Counts the total number of characters in the buffer.
ACL on page 122 Communications Function block Clears the receive and transmit buffers.
ACOS on page 73 Arithmetic Function Calculates the arc-cosine of a Real value.
ACOS_LREAL on page 75 Arithmetic Function Calculates the arc-cosine of a Long Real value.
Addition on page 77 Arithmetic Operator Adds two or more Integer, Real, Time, or String
values.
AHL on page 124 Communications Function block Sets or resets modem handshake lines.
AND on page 173 Boolean operations Operator Performs a boolean AND operation between two or
more values.
AND_MASK on page 143 Binary operations Function Performs a bit to bit AND between two Integer
values.
ANY_TO_BOOL on page 279 Data conversion Function Converts a non-Boolean value to a Boolean.
ANY_TO_BYTE on page 280 Data conversion Function Converts a value to a Byte.
ANY_TO_DATE on page 282 Data conversion Function Converts a String, Integer, Real, or Time data type to
Date data type.
ANY_TO_DINT on page 283 Data conversion Function Converts a value to a Double Integer.
ANY_TO_DWORD on page Data conversion Function Converts a value to a Double Word value.
284
ANY_TO_INT on page 286 Data conversion Function Converts a value to an Integer.
ANY_TO_LINT on page 287 Data conversion Function Converts a value to a Long Integer.
ANY_TO_LREAL on page 288 Data conversion Function Converts a value to a Long Real.
ANY_TO_LWORD on page Data conversion Function Converts a value to a Long Word.
289
ANY_TO_REAL on page 290 Data conversion Function Converts a value to a Real.
ANY_TO_SINT on page 291 Data conversion Function Converts a value to a Short Integer.
ANY_TO_STRING on page Data conversion Function Converts a value to a String.
292
ANY_TO_TIME on page 294 Data conversion Function Converts a value to the Time data type.
CTU on page 273 Counter Function Counts integers from 0 up to a given value, 1 by 1.
CTUD on page 275 Counter Function Counts integers from 0 up to a given value, 1 by 1, or
from a given value down to 0, 1 by 1.
DELETE on page 673 String manipulation Function Deletes characters from a string.
DERIVATE on page 523 Process Control Function block Differentiation of a real value over a defined cycle
time.
Division on page 88 Arithmetic Operator Division of two Integer or Real values.
DLG on page 371 Input/Output Function Block Writes variable values from the run-time engine into
a Data Logging File on an SD Card.
DOY on page 703 Time Function Turn on an output if the value of the real-time clock is
in the range of the Year Time setting.
Equal on page 257 Compare Operator Tests whether one value is equal to another.
MUX4B on page 184 Boolean Function Multiplexer between four BOOL inputs, outputs a
BOOL value.
MUX8B on page 180 Boolean Function Multiplexer between eight BOOL inputs, outputs a
BOOL value.
NOT on page 175 Boolean operations Operator Converts Boolean values to negated values.
Not Equal on page 268 Compare Operator Compares Integer, Real, Time, Date, and String input
values to determine whether the first is not equal to
the second.
Neg on page 99 Arithmetic Operator Converts a value to a negative.
NOT_MASK on page 152 Binary operations Function Integer bit-to-bit negation mask, inverts a parameter
value.
OR_MASK on page 154 Binary operations Function Integer OR bit-to-bit mask, turns bits on.
OR on page 172 Boolean operations Operator Boolean OR of two or more values.
PID on page 592 Process Control Function block An output instruction that controls physical
properties such as temperature, pressure, liquid level,
or flow rate using process loops.
PLUGIN_INFO on page 400 Input/Output Function block Gets module information from a generic plug-in
module (excluding Memory Module).
PLUGIN_READ on page 403 Input/Output Function block Reads data from a generic plug-in module (excluding
Memory Module).
PLUGIN_RESET on page 405 Input/Output Function block Resets a generic plug-in module, hardware reset
(excluding Memory Module).
PLUGIN_WRITE on page 407 Input/Output Function block Writes data to a generic plug-in module (excluding
Memory Module).
POW on page 100 Arithmetic Function Calculates the value of a Real number raised to a
power of the Real exponent.
PWM on page 549 Process Control Function block Turns the PWM (Pulse Width Modulation) output for
a configured PWM channel ON or OFF.
R_TRIG on page 169 Boolean operations Function block Detects a rising edge of a Boolean variable.
RAND on page 102 Arithmetic Function Calculates random integer values from a defined
range.
REPLACE on page 687 String manipulation Function Replaces parts of a string with new sets of characters.
TP on page 699 Time Function block Pulse timing. On a rising edge, increases an internal
timer up to a given value.
TRIMPOT_READ on page 419 Input/Output Function block Reads the trimpot value from a specific trimpot.
TRUNC on page 114 Arithmetic Function Truncates Real values, leaving just the Integer.
TTABLE on page 177 Boolean Function Provides the value of the output based on the
combination of inputs.
UIC on page 425 Interrupt Function Clears the lost bit for the selected user interrupt.
UID on page 427 Interrupt Function Disables a specific user interrupt.
UIE on page 429 Interrupt Function Enables a specific user input.
UIF on page 430 Interrupt Function Flushes or removes a pending user input.
XOR_MASK on page 164 Binary operations Function Integer exclusive OR bit-to-bit mask, returns inverted
bit values.
XOR on page 174 Boolean operations Operator Boolean exclusive OR of two values.
See also
See also
The LD language uses graphic symbols in a program chart, organized like a relay
ladder wiring diagram, to describe the tests and modifications of Boolean data.
See also
LD program development The following illustration shows the language editor for a Ladder Diagram (LD)
program where you develop an LD Program Organizational Unit (POU). Use the
environment LD language editor menu, LD Toolbox, LD keyboard shortcuts, or
the Multi-language Editor located on the Tools menu to add elements to your
LD POU.
Example: LD Toolbox
See also
Ladder Diagram (LD) elements are the components used to build a ladder
diagram program. All the elements listed in the following table can be added to a
ladder diagram program within Connected Components Workbench.
Element Description
Rung on page 33 Represents a group of circuit elements that lead to the activation of a coil.
Instruction Block (LD) Instructions include operators, functions, and function blocks including user-defined function
on page 41 blocks.
Branch on page 38 Two or more instructions in parallel.
Coil on page 41 Represents the assignment of outputs or internal variables. In an LD program, a coil represents
an action.
Contact on page 50 Represents the value or function of an input or internal variable.
Return on page 57 Represents the conditional end of a diagram output.
Jump on page 58 Represents the conditional and unconditional logic in the LD program that control the control the
execution of diagrams.
See also
Rung Rungs are graphic components of Ladder Diagram (LD) programs that represent
a group of circuit elements that lead to the activation of a coil. Use labels to
identify rungs within the diagram. Labels, along with jumps, control the execution
of a diagram. Comments are free-format text you can add above the rung for
documentation purposes.
See also
LD program on page 29
Add a rung to a LD program Rungs are graphic components of a Ladder Diagram (LD) program that represent
a group of circuit elements that lead to the activation of a coil.
Click Copy, and then click Paste to insert a copy of the rung into the
language editor.
Click Insert Rung, and then either:
Click Above to add the rung above the selected rung.
Click Below to add the rung below the selected rung.
Select a rung or an element in the LD language editor, and then press either:
See also
Rungs on page 33
Rung labels Labels are optional additions for every rung in the Ladder Diagram (LD) language
editor.
1. To add a label to a rung, right-click the rung to open the LD language editor
menu, and then select Display Label.
The rung updates to include the label and the LD language editor menu
shows a checkmark next to Display Label.
3. (optional) To remove the label, click Display Label from the LD language
editor menu.
See also
Rungs on page 33
Rung comments Comments are optional for every rung in the Ladder Diagram (LD) language
editor. By default, a comment is included when you add a rung element in the LD
language editor.
Comments are:
See also
LD program on page 29
Rungs on page 33
Branch Branches create alternative routing for connections. You can add parallel branches
to elements on a rung using the Ladder Diagram (LD) language editor.
Branch example
See also
LD program on page 29
Add a branch to a LD program Branches are graphic components of Ladder Diagram (LD) programs that create
alternative routing for connections and may include parallel branches.
1. In the LD language editor, verify the LD program has a defined rung for the
branch. Then do one of the following:
Select a rung or element in the LD language editor and then press either:
CTRL+ALT+1 to add the branch to the left of the selected element
or rung.
CTRL+1 to add the branch to the right of the selected element.
Select a rung or an element in the LD language editor and then either:
Click Tools > Multi-language Editor > Insert Branch Before to
add the branch to the left of the selected element.
Click Tools > Multi-language Editor > Insert Branch After to
add the branch to the right of the selected element.
Open the LD Toolbox to show the branch element and then either:
Double-click the branch element to add it to the LD language editor.
Drag the branch element into the LD language editor and position it
on the rung.
b. From the LD language editor menu, select Insert Branch and then
click either:
Above to add a branch above the selected branch.
Below to add the branch below the selected branch.
A plus sign (+) appears in the LD language editor to show a valid target.
Release the mouse button to insert the element in the target location.
See also
Branch on page 38
LD program on page 29
Instruction Block (LD) A Ladder Diagram (LD) Instruction Block element is a IEC 61131-3 compliant
functional element in a LD program that can be a function block, a function, a
user-defined function block, a user-defined function, or an operator.
See also
Coils are graphic components of Ladder Diagram (LD) programs that represent
Coil
the assignment of an output or of an internal variable. In LD programs, a coil
represents an action. A coil must be connected on the left to a Boolean symbol,
such as a contact, or to a Boolean output of an instruction block. Coils can only be
added to a defined rung in the LD language editor. The coil definition can be
modified after the coil is added to the rung.
The following example shows the coil element types available for Ladder Diagram
programs.
Example: Coils
See also
Add coil elements Coils are graphic components of Ladder Diagram (LD) programs that represent
an action taken an output or of an internal variable.
1. In the LD language editor, verify the LD program has a defined rung for the
coil. Then do one of the following:
3. (optional) To change the type of coil, in the LD language editor select the
coil, and then press the space bar until the coil type displays in the language
editor.
Every time the space bar is pressed the coil type changes from direct, to
reverse, to set, to reset, to pulse rising edge, to pulse falling edge.
See also
Branch on page 38
Coils on page 41
Direct Coil Coils are graphic components of Ladder Diagram (LD) programs that represent
the assignment of an output or of an internal variable.
The associated variable is assigned with the Boolean state of the left connection.
The state of the left connection is propagated into the right connection. The right
connection must be connected to the right vertical power rail (unless you have
parallel coils, where only the upper coil must be connected to the right vertical
power rail).
See also
Coils on page 41
Reverse Coil Coils are graphic components of Ladder Diagram (LD) programs that represent
the assignment of an output or of an internal variable.
The associated variable is assigned with the Boolean negation of the state of the
left connection. The state of the left connection is propagated into the right
connection. The right connection must be connected to the right vertical power
rail (unless you have parallel coils, where only the upper coil must be connected to
the right vertical power rail).
See also
Coils on page 41
Pulse Falling Edge Coil Coils are graphic components of Ladder Diagram (LD) programs that represent
the assignment of an output or of an internal variable.
Pulse falling edge (or negative) coils support a Boolean output of a connection line
Boolean state.
The associated variable is set to TRUE when the Boolean state of the left
connection falls from TRUE to FALSE. The output variable resets to FALSE in
all other cases. The state of the left connection is propagated into the right
connection. The right connection must be connected to the right vertical power
rail (unless you have parallel coils, where only the upper coil must be connected to
the right vertical power rail).
See also
Coils on page 41
Pulse Rising Edge Coil Coils are graphic components of Ladder Diagram (LD) programs that represent
the assignment of an output or of an internal variable.
Pulse rising edge (or positive) coils support a Boolean output of a connection line
Boolean state.
The associated variable is set to TRUE when the Boolean state of the left
connection rises from FALSE to TRUE. The output variable resets to FALSE in
all other cases. The state of the left connection is propagated into the right
connection. The right connection must be connected to the right vertical power
rail (unless you have parallel coils, where only the upper coil must be connected to
the right vertical power rail).
See also
Coils on page 41
Set Coil Coils are graphic components of Ladder Diagram (LD) programs that represent
the assignment of an output or of an internal variable. In LD programs, a coil
represents an action.
The associated variable is set to TRUE when the Boolean state of the left
connection becomes TRUE. The output variable keeps this value until an inverse
order is made by a Reset coil. The state of the left connection is propagated into
the right connection. The right connection must be connected to the right vertical
power rail (unless you have parallel coils, where only the upper coil must be
connected to the right vertical power rail).
See also
Coils on page 41
Reset Coil Coils are graphic components of Ladder Diagram (LD) programs that represent
the assignment of an output or of an internal variable.
The associated variable is reset to FALSE when the Boolean state of the left
connection becomes TRUE. The output variable keeps this value until an inverse
order is made by a Set coil. The state of the left connection is propagated into the
right connection. The right connection must be connected to the right vertical
power rail (unless you have parallel coils, where only the upper coil must be
connected to the right vertical power rail).
See also
Coils on page 41
Contact Contacts are graphic components of Ladder Diagram (LD) programs. Depending
on the type, a contact represents the value or function of an input or of an internal
variable. Contacts can only be added to a defined rung in the LD language editor.
After a contact is added, its definition can be modified.
The following example shows the contact element types available for Ladder
Diagram programs.
Example: Contacts
See also
Add a contact to a LD program Contacts are graphic components of a Ladder Diagram (LD) program. Depending
on the type, a contact represents the value or function of an input or of an internal
variable. Contacts can only be added to a defined rung in the LD language editor.
1. In the LD language editor, verify the LD program has a defined rung for the
contact. Then do one of the following:
Select a rung or an element in the LD language editor, and then press either:
CTRL+ALT+3 to add the Direct Contact element to the left side of
the selected element or the rung.
CTRL+3 to add the Direct Contact element to the right side of the
selected element or the rung.
Select a rung or an element in the LD language editor and then either:
Click Tools > Multi-language Editor > Insert Contact Before to
add the contact to the left side of the selected element or rung.
Click Tools > Multi-language Editor >Insert Contact After to
add the contact to the right side of the selected element or rung.
Open the LD Toolbox to show the contact elements (Direct
Contact, Reverse Contact, Pulse Rising Edge Contact, Pulse Falling
Edge Contact) and then either:
Double-click the contact element to add it to the LD language editor.
Drag the contact element into the LD language editor and position it
on the rung.
52 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
Ladder Diagram (LD) elements Chapter 3
3. (optional) To change the type of contact, in the language editor select the
contact, and then press the space bar until the the contact type displays in
the language editor.
Every time the space bar is pressed the contact type changes from direct,
to reverse, to pulse rising edge, to pulse falling edge.
See also
Branch on page 38
Contacts on page 50
Direct Contact Contacts are graphic components of Ladder Diagram (LD) programs.
Direct contacts support a Boolean operation between a connection line state and a
Boolean variable.
The state of the connection line on the right of the contact is the logical AND
between the state of the left connection line and the value of the variable
associated with the contact.
See also
Contacts on page 50
Reverse Contact Contacts are graphic components of Ladder Diagram (LD) programs.
Reverse contacts support a Boolean operation between a connection line state and
the Boolean negation of a Boolean variable.
The state of the connection line on the right of the contact is the logical AND
between the state of the left connection line and the Boolean negation of the value
of the variable associated with the contact.
See also
Contacts on page 50
Pulse Rising Edge Contact Contacts are graphic components of Ladder Diagram (LD) programs.
Pulse rising edge (or positive) contacts support a Boolean operation between a
connection line state and the rising edge of a Boolean variable.
The state of the connection line on the right of the contact is set to TRUE when
the state of the connection line on the left is TRUE, and the state of the associated
variable rises from FALSE to TRUE. The state is reset to FALSE in all other cases.
We recommend not using outputs or variables with a Pulse rising edge contact
(positive) or a Pulse falling edge contact (negative). These contacts are for physical
See also
Contacts on page 50
Pulse Falling Edge Contact Contacts are graphic components of Ladder Diagram (LD) programs.
Pulse falling edge (or negative) contacts support a Boolean operation between a
connection line state and the falling edge of a Boolean variable.
The state of the connection line on the right of the contact is set to TRUE when
the state of the connection line on the left is TRUE, and the state of the associated
variable falls from TRUE to FALSE. The state is reset to FALSE in all other cases.
We recommend not using outputs or variables with a Pulse rising edge contact
(positive) or a Pulse falling edge contact (negative). These contacts are for physical
inputs in a ladder diagram. To detect the edge of a variable or an output, we
recommend using the R_TRIG/F_TRIG function block, which is supported and
works in any language at any location in your program.
See also
Contact on page 50
Return Returns are outputs that represent a conditional end of a Ladder Diagram (LD)
program.
When the left connection line has the TRUE Boolean state, the diagram ends
without executing the instructions located on the next lines of the diagram.
When the LD diagram is a function, its name is associated with an output coil to
set the return value (returned to the calling diagram).
Return example
See also
LD program on page 29
Jump notation
Jump example
To insert a jump:
See also
LD program on page 29
Returns on page 57
Instruction blocks in LD The Connected Components Workbench instruction set includes IEC 61131-3
compliant instruction blocks. Instruction blocks collectively include function
programs blocks, functions and operators. You can connect instruction block inputs and
outputs to variables, contacts, coils, or other instruction block inputs and outputs.
Functions and function blocks are represented by a box that displays the name of
the instruction, and the short version of the parameter names. For function blocks,
the instance name is displayed above the function block name.
The return parameter of a function has the same name as the function. The
return parameter is the only output.
The return parameters of a function block can have any name. Multiple
return parameters can provide multiple outputs.
You can define the parameters of programs for multiple devices by
navigating the tabs for individual devices displayed in the Parameter view.
See also
Work in the LD language When you add items to a rung in the Ladder Diagram (LD) program, they are
added according to the following criteria.
editor
The first element on a rung is inserted at the position you select in the
ladder diagram.
Subsequent elements are inserted to the right of the selected item on the
rung.
You cannot insert an element to the right of a coil return or jump.
LD language editor
Add elements, delete elements, and copy and paste elements.
Use LD keyboard shortcuts to add elements.
Multi-language Editor located on the Tools menu
Add elements.
Export an image of the LD program.
Enable or disable the automatic opening of the Variable Selector
and Instruction Block Selector.
LD Toolbox
Add elements.
You can replace an assigned variable directly from the language editor, or from the
Variable Selector.
1. In the language editor, click the variable name to display a drop-down list of
global and local variables.
2. Click the variable name, then select a different variable from the drop-down
list of global and local variables.
3. Click an existing variable, then type constant values in the text box
provided.
See also
Ladder Diagram (LD) The following examples are Ladder Diagram (LD) programs.
Example: Comparing Real Values using Subtraction (-) ABS, and Less than
(<)
The Real data type is not recommended when comparing values for equality
because of differences in the way numbers are rounded. Two output values may
appear equal in a Connected Components Workbench display, but will evaluate as
false.
For example, 23.500001 compared to 23.499999 will both display as 23.5 in the
variable input display, but will not be equal in the controller.
To test whether two Real data type values are equal, you can use a Subtraction
instruction to get the difference between the values and then determine if the
difference is Less Than an established precision value. See the following LD
program example for comparing two Real data type values.
See also
LD Keyboard shortcuts The following keyboard shortcuts are available for use with the Ladder Diagram
language.
Shortcut Description
Shortcut Description
Shortcut Description
Ctrl+End Moves to the last element of the last rung, if there is no rung element, the last
rung is selected.
Page Up Moves to the top of the visible code.
Page Down Moves to the bottom of the visible code.
Ctrl+J Moves to the matching bracket.
Ctrl+Down Scrolls down.
Ctrl+Up Scrolls up.
Shift+Down Selects down.
Shift+Left Mouse Click Selects multiple rungs. Click each rung individually.
Shift+Up Selects up.
Shift+Left Selects left.
Shift+Right Selects right.
Ctrl+Shift+Left Selects to the previous statement or word.
Ctrl+Shift+Right Selects to the next statement or word.
Shift+Home Selects from the insertion point until the start of the line.
Shift+End Selects from the insertion point until the end of the line.
Ctrl+Shift+Home Selects from the insertion point until the start of the document.
Ctrl+Shift+End Selects from the insertion point until the end of the document.
Shift+Page Up Selects from the insertion point until the top of the visible code.
Shift+Page Down Selects from the insertion point until the end of the visible code.
Ctrl+Shift+Page Up Selects from the insertion point until the top of the visible code.
Ctrl+Shift+Page Down Selects from the insertion point until the end of the visible code.
Ctrl+A Selects the entire document.
Ctrl+D When a rung or one element of the rung is selected, after pressing CTRL+D user
can edit rung comment.
Ctrl+R Enable or disable the Automatic Selector Invocation.
By default, either the Instruction Block Selector or Variable Selector dialog opens
when an element is added to a Ladder Diagram program.
Ctrl+Shift+W Selects the next word.
Ctrl+Shift+J Selects to the matching bracket.
Shift+Alt+Down Selects the current and next lines.
Shift+Alt+Up Selects the current and previous lines.
Shift+Alt+Left Selects left on the current line.
Shift+Alt+Right Selects right on the current line.
Ctrl+Shift+Alt+ Left Selects available columns in lines of code from the left to right.
Ctrl+Shift+Alt+Right Selects available columns in lines of code from the right to left.
Esc Deselects the selected text.
Insert Toggles between the overwrite/insert typing mode.
Shortcut Description
1
When no rung is selected, a rung is added at the end of the rung list.
2
When a branch is selected, an element is inserted at the end of the branch.
See also
Alarm instruction
Use the alarm instruction to provide alerts when a configured high or low limit is
reached.
See also
LIM_ALRM is an alarm with hysteresis on a Real value for high and low limits.
LIM_ALRM (limit alarm)
A hysteresis is applied on high and low limits. The hysteresis delta used for either
high or low limit is one half of the EPS parameter.
A Process alarm is an alarm that occurs when a fault is received and processed by
the controller. Process level alarms provide an alert when the module has exceeded
the configured high or configured low limits for each channel.
Use this table to help determine the parameter values for this instruction.
Results
See also
Arithmetic instructions
Function Description
See also
ABS (absolute value) Returns the absolute (positive) value of a Real value.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
ACOS (arccosine of source) Calculates the arc-cosine of a Real value. Input and output values are in radians.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Long Real) Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
See also
Calculates the arcsine of a Real value. Input and output values are in radians.
ASIN (arcsine)
Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Long Real) Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Division Divides the first Integer or Real input value by the second Integer or Real input
value.
Use this table to help determine the parameter values for this instruction.
o1 Output SINT Quotient of the inputs in non-zero Integer or Real data type.
USINT Input and output must use the same data type.
BYTE
INT
UINT
WORD
DINT
UDINT
DWORD
LINT
ULINT
LWORD
REAL
LREAL
ENO Output BOOL Enable out.
Applies only to Ladder Diagram programs.
(* ST Equivalence: *)
See also
EXPT (exponent) Raises the value of IN (base) to the power of EXP (exponent) and outputs the
Real result of the operation.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
LOG (log base 10) Calculates the logarithm (base 10) of a Real value.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Divide the IN input by the Base input and place the remainder in the MOD
MOD (modulo)
output.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
MOV (move) Assigns the input (i1) value to the output (o1).
For Structured Text programs, use the Equal (=) operator instead of MOV.
Use this table to help determine the parameter values for this instruction.
o1 Output BOOL Input and output must use the same data type.
DINT
REAL
TIME
STRING
SINT
USINT
INT
UINT
UDINT
LINT
ULINT
DATE
LREAL
BYTE
WORD
DWORD
LWORD
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
(* ST equivalence: *)
ao23 := ai10;
See also
Use this table to help determine the parameter values for this instruction.
(* ST equivalence *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
ao23 := - (ai10);
ro100 := - (ri1 + ri2);
See also
When the first argument is 'base' and the second argument is 'exponent', calculate
POW (raise power)
the Real result of (base exponent).
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
RAND (random value) Calculates random integer values from a defined range.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(*
*)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT1 := SIN_LREAL(TESTINPUT1) ;
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Subtraction Subtracts one Integer, Real, or Time value from another Integer, Real or Time
value.
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use the ASCII serial port instructions to use or alter the communication channel
for receiving or transmitting data.
ABL on page 117 Counts the number of characters in the buffer up to and including end of line character.
ACB on page 119 Counts the total number of characters in the buffer.
ACL on page 122 Clears the receive and transmit buffers.
AHL on page 124 Sets or resets modem handshake lines.
ARD on page 127 Reads characters from the input buffer and places them into a string.
ARL on page 130 Reads one line of characters from the input buffer and places them into a string.
AWA on page 133 Writes a string with two appended (user-configured) characters to an external device.
AWT on page 135 Writes characters from a source string to an external device.
See also
ABL (ASCII test for buffer Counts the number of ASCII characters in the input buffer up to and including
the end-of-line termination character.
line)
Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
Use this table to determine the ABL error codes and descriptions.
See also
ACB (ASCII characters in Counts the total number of ASCII characters in the buffer including end of line.
Text.
Use this table to help determine the parameter values for this instruction.
Use this table to determine the ABL error codes and descriptions.
See also
ACL (ASCII clear buffer) Clears the receive and transmit buffers, and removes instructions from the ASCII
queue.
Use this table to help determine the parameter values for this instruction.
ACLInput Input ACLI The channel to be operated, and the state of the transmit and receive
buffers.
For RXBuffer, clears the receive buffer and removes the receive ASCII
function blocks (ARL and ARD) from the ASCII queue.
For TXBuffer, clears the transmit buffer and removes the transmit
ASCII function blocks (AWA and AWT) from the ASCII queue.
Use the ACLI data type to define the Channel, RXBuffer, and TXBuffer
parameters for ACLInput.
Q Output BOOL Indicates when the ASCII queue clearing process is ongoing or
complete.
TRUE - The function block is complete.
FALSE - The function block is not complete.
Error Output BOOL Indicates the existence of an error condition.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for this
instruction are defined in ABL error codes.
Use this table to determine the ABL error codes and descriptions.
See also
AHL (ASCII handshake lines) Sets or resets the RS-232 Request to Send (RTS) handshake control lines for a
modem.
Use this table to help determine the parameter values for this instruction.
Use this table to determine the ABL error codes and descriptions.
See also
ARD (ASCII read) Reads ASCII characters from the input buffer and stores them into a string.
Operation details:
The ARD instruction runs until all of the characters in the ASCII buffer are
received. If another ASCII instruction is executed, it is queued until ARD is
finished.
To abort the ARD instruction, execute an ACL instruction.
To prevent the ARD instruction delaying the ASCII queue while it waits
for the required number of characters, use the results of an ACB instruction
to trigger the ARD instruction.
Status of the instruction can be extracted from the control bit of the
instruction instance (for example, ARD_1.controlbit). This shows if the
instruction is blocking the ASCII instruction queue waiting for more
characters:
7th bit = Instruction is enabled.
6th bit = Instruction is in the queue.
5th bit = Instruction is done.
3rd bit = Instruction has an error.
Use this table to help determine the parameter values for this instruction.
Use this table to determine the ABL error codes and descriptions.
07 Cannot complete ASCII send or receive because channel configuration has been shut down using the
channel configuration dialog box.
08 Cannot complete ASCII Write due to an ASCII transmission already in progress.
09 ASCII communication requested is not supported by current channel configuration.
10 The Cancel was set, stopping instruction execution. No action required.
11 The requested length for the string is either invalid, a negative number, greater than 82, or 0. Applies to
ARD and ARL function blocks.
13 The requested (.LEN) in the control block is a negative number or a value greater than the string size
stored with the source string. Applies to AWA and AWT function blocks.
14 The ACL function block was aborted.
16 Serial port is not supporting RTS or CTS control lines.
See also
ARL (ASCII read line) Reads a line of ASCII characters from the buffer, up to and including the
termination characters, and stores them in a string.
Use this table to help determine the parameter values for this instruction.
ARLInput Input ARDARL Read a line of ASCII characters from the buffer. The maximum is 82.
Use the ARDARL data type to define the Channel, Length, and
Cancel parameters for the ARDLInput.
Q Output BOOL Indicates when the read line from the input buffer is ongoing or
complete.
Outputs of this instruction are updated asynchronously from the
program scan. Output Q cannot be used to re-trigger the instruction
since IN is edge triggered.
TRUE - The function block is complete.
FALSE - The function block is not complete.
Destination Output ASCIILOCADDR The string element where the characters are stored.
NumChar Output UINT The number of characters in the line, including the termination
character.
Error Output BOOL Indicates the existence of an error condition.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for this
instruction are defined in ABL error codes.
Use this table to determine the ABL error codes and descriptions.
See also
AWA (ASCII write append) Writes a string with two appended (user-configured) characters to an external
device.
Use this table to help determine the parameter values for this instruction.
AWAInput Input AWAAWT The channel and number (Length) of the characters to write to the
buffer. Maximum is 82.
Use the AWAAWT data type to define Channel, Length, and Cancel
parameters for AWAInput.
Source Input ASCIILOCADDR The source string that was output as a character array by either the
ARD or ARL instruction.
Q Output BOOL Indicates when the write is ongoing or complete.
Outputs of this instruction are updated asynchronously from the
program scan. Output Q cannot be used to re-trigger the instruction
since IN is edge triggered.
TRUE - The function block is complete.
FALSE - The function block is not complete.
NumChar Output UINT The number of characters. NumChar may be less than the Length
requested to be transmitted if the length of the Source String is
shorter than the requested Length.
Updates when the transmission is complete and Q is TRUE.
Error Output BOOL Indicates the existence of an error condition.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for this
instruction are defined in ABL error codes.
Use this table to determine the ABL error codes and descriptions.
See also
AWT (ASCII write) Writes ASCII characters from a source string to an external device.
Use this table to help determine the parameter values for this instruction.
AWTInput Input AWAAWT The channel and number (Length) of the characters to write to the
buffer. Maximum is 82.
Use the AWAAWT data type to define Channel, Length, and Cancel
parameters for AWTInput.
Source Input ASCIILOCADDR The source string that was output as a character array by either the
ARD or ARL instruction.
Q Output BOOL Indicates when the write is ongoing or complete.
Outputs of this instruction are updated asynchronously from the
program scan. Output Q cannot be used to re-trigger the instruction
since IN is edge triggered.
TRUE - The function block is complete.
FALSE - The function block is not complete.
NumChar Output UINT The number of characters. NumChar may be less than the Length
requested to be transmitted if the length of the Source String is
shorter than the requested Length.
Updates when the transmission is complete and Q is TRUE.
Error Output BOOL Indicates the existence of an error condition.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for this
instruction are defined in ABL error codes.
Use this table to determine the ABL error codes and descriptions.
See also
ASCII parameter details The following topics provide additional details for ASCII parameters and
structured data types.
See also
ABLACB data type Use this table to help determine the parameter values for the ABLACB data type.
See also
ACL data type Use this table to help determine the parameter values for the ABL data type.
See also
AHL ChannelSts data type Use this table to help determine the parameter values for the AHL ChannelSts
data type.
See also
AHLI data type Use this table to help determine the parameter values for the AHL data type.
See also
ARDARL data type Use this table to help determine the parameter values for the ARDARL data type.
See also
AWAAWT data type Use this table to help determine the parameter values for the AWAAWT data
type.
See also
Binary instructions
Operator Description
AND_MASK on page 143 Performs a bit-to-bit AND between two Integer values.
NOT_MASK on page 152 Integer bit-to-bit negation mask, inverts a parameter value.
ROR on page 158 For 32-bit integers, rotates integer bits to the left.
SHL on page 160 For 32-bit integers, moves integers to the left and places 0 in the least
significant bit.
SHR on page 162 For 32-bit integers, moves integers to the right and places 0 in the most
significant bit.
XOR_MASK on page 164 Integer exclusive OR bit-to-bit mask, returns inverted bit values.
See also
AND_MASK (AND mask) Performs a bit to bit AND between two integer values.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
BSL (bit shift left) Shifts a bit in an array element to the left.
Operation details:
For wraparound operations, set the position of the BitAddr to the last bit position
or to the Unload bit. Possible usage of the BSL instruction, track bottles through a
bottling line where each bit represents a bottle.
Use this table to help determine the parameter values for this instruction.
Length Input UINT Length contains the number of bits in the Src to be shifted.
Supports shifting across array elements.
For BOOL data type, number of Booleans in the array to be
shifted.
For 16 and 32 bit data types, bits are shifted in multiples of 16
(such as 16, 32, and 64). If Length is not an even multiple of
16, the number of shifted bits are sent to the next 16-bit
boundary.
Length is based on the size of the data type. If Length exceeds
the range, an error occurs, 'Source offset exceeds the size of the
array.' Length values:
BOOL: 1
16 bit word: 1-16
32 bit word: 1-32
64 bit word: 1-64
Done Output BOOL When TRUE, operation completed successfully.
When FALSE, operation encountered an error condition.
Unload Output BOOL Bit shifted out from Src address.
Error Output BOOL When a fault occurs, Error is set to true.
ErrorID Output USINT When a fault occurs, ErrorID contains the error code.
Results
See also
Operation details:
For wraparound operations, set the position of the BitAddr to the last bit position
or to the Unload bit. Possible usage of the BSL instruction, track bottles through a
bottling line where each bit represents a bottle.
Use this table to help determine the parameter values for this instruction.
Results
See also
NOT_MASK (bit to bit NOT Integer bit-to-bit negation mask, inverts a parameter value.
Use this table to help determine the parameter values for this instruction.
(*ST equivalence: *)
(* result is 16#FFFF_EDCB *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
ROL (rotate left) For 32-bit integers, rotates integer bits to the left.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* register = 2#0100_1101_0011_0101*)
(* result = 2#1001_1010_0110_1010*)
Results
See also
ROR (rotate right) For 32-bit integers, rotates integer bits to the right.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* register = 2#0100_1101_0011_0101 *)
(* result = 2#1010_0110_1001_1010 *)
Results
See also
SHL (shift left) For 32-bit integers, moves integers to the left and places 0 in the least significant
bit.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* register = 2#0100_1101_0011_0101 *)
(* result = 2#1001_1010_0110_1010 *)
Results
See also
SHR (shift right) For 32-bit integers, moves integers to the right and places 0 in the most significant
bit.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* register = 2#1100_1101_0011_0101 *)
(* result = 2#0110_0110_1001_1010 *)
Results
See also
XOR_MASK (exclusive OR Integer exclusive OR bit-to-bit mask, returns inverted bit values.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Boolean instructions
Function Description
MUX4B on page 184 Multiplexer between four BOOL inputs, outputs a BOOL value.
MUX8B on page 180 Multiplexer between eight BOOL inputs, outputs a BOOL value.
TTABLE on page 177 Provides the value of the output based on the combination of inputs.
Function block Description
AND on page 173 Performs a boolean AND operation between two or more values.
NOT on page 175 Converts Boolean values to negated values.
XOR on page 174 Boolean exclusive OR of two values.
See also
F_TRIG (falling edge Detects a falling edge of a Boolean variable. Each time a falling edge is detected,
sets output for one more cycle.
detection)
Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
F_TRIG1(cmd);
nb_edge := ANY_TO_DINT(F_TRIG1.Q) + nb_edge;
Results
See also
Use this table to help determine the parameter values for this instruction.
R_TRIG1(cmd);
nb_edge := ANY_TO_DINT(R_TRIG1.Q) + nb_edge;
Results
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
OR Performs a logical OR operation of two or more Boolean values and returns the
Boolean value true if either input is true, otherwise returns false.
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
TTABLE (truth table) Provides the value of the output based on the combination of inputs.
If the value is 0xABCD and In3 through In0 corresponds to the number 7, then
TTABLE is the value of bit 7 in the table (which is 1). The least significant bit in
the table is bit 0.
Use this table to help determine the parameter values for this instruction.
The TTABLE instruction has four inputs, and therefore 16 combinations. These
combinations are found in a truth table; for each combination, the output value
can be adjusted. The number of configurable combinations depends on the
number of inputs connected to the function.
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Results
See also
MUX8B (multiplexer of 8 Multiplexer between eight BOOL inputs, outputs a BOOL value.
BOOL inputs) Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
MUX4B (multiplexer of 4 Multiplexer between four BOOL inputs, outputs a BOOL value.
BOOL inputs) Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Communication instructions
See also
MSG_CIPGENERIC (common Sends a common industrial protocol (CIP) explicit message over an Ethernet
channel or a serial port.
industrial protocol generic
message) A maximum of four message requests per channel can be processed in one scan.
For Ladder Diagram programs, message requests are executed at the end of a
ladder scan.
Use this table to help determine the parameter values for this instruction.
See also
CIPAPPCFG data type Use this table to help define the parameters for the CIPAPPCFG data type.
See also
CIPCONTROLCFG data type Use this table to help determine the parameter values for the
CIPCONTROLCFG data type.
Use this table to help define the actions for the TriggerType parameter.
Action Results
Message is enabled Trigger timer starts
Trigger timer expires before the message Message is immediately triggered in the next ladder scan cycle.
completes
Message completes before the trigger time expires Message is triggered when the trigger time expires.
See also
CIPSTATUS data type Use this table to help determine the parameter values for the CIPSTATUS data
type.
Error BOOL This bit is set to TRUE when the function block execution encounters an error
condition.
ErrorID UINT Error code value.
ErrorIDs are defined in CIPSTATUS error codes.
SubErrorID UINT Sub Error code value.
SubErrorIDs defined in CIPSTATUS error codes.
ExtErrorID UINT CIP extended status error code value.
StatusBits UINT This parameter can be used to verify control bits:
Bit 0: EN Enable
Bit 1: EW Enable Wait
Bit 2: ST Start
Bit 3: ER Error
Bit 4: DN Done
Bit 5: CIPCONN - CIP Connection Closure
Bit 6: EIPSESS - EIP Session Closure
Other bits are reserved
StatusBits are defined for CIPSTATUS status bits.
See also
CIPSTATUS status bits The CIPSTATUS status bits are set based on the status of the message execution,
the communication buffers, and the rung conditions.
- - - - - - - - - - 4 3 2 1 0
-
See also
CIPSTATUS error codes Use this table to help determine the parameter values for the ErrorID and
SubErrorID fields of the CIPSTATUS parameter when the ER bit is set.
113 Message timed out while waiting for the connection to the link layer to be established.
114 Message timed out while waiting to transmit to the link layer.
115 Message timed out while waiting for a response from the link layer.
69 Server response format related error codes
65 Message reply does not match request.
68 Message reply data type not valid/supported. (MSG_CIPSYMBOLIC).
208 No IP address configured for the network.
209 Maximum number of connections used no connections available.
210 Invalid internet address or node address.
217 Message execution was canceled by user. (Cancel parameter was set to TRUE).
218 No network buffer space available.
222 Reserved.
223 The Link address is not available. A TCP/IP or Ethernet configuration change is in progress.
224 CIP response error code. SubErrorID specifies the CIP status and ExtErrorID specifies the CIP extended status
value. Refer to the CIP specification for possible error code values.
255 Channel is shutdown or reconfiguration is in progress. Error code occurs immediately after power on until a
connection is established, and is normal behavior.
It may also occur in one of the following situations:
An Ethernet cable is disconnected
An IP address cannot be detected
A serial port plug-in is present but not configured
See also
CIPTARGETCFG data type Use this table to help determine the parameter values for the CIPTARGETCFG
data type.
ConnMsgTimeout UDINT Class3 Connection timeout (in milliseconds). The amount of time to wait for a
reply for connected messages. The connection closes when the timeout
expires.
Valid values: 800-10,000 ms.
Set to 0 to use the default value of 10,000 ms (10 seconds).
A value set to less than 800 will be set to 800 ms (minimum).
A value set to greater than 10,000 ms will be set to 10,000 ms
(maximum).
ConnClose BOOL Connection closing behavior:
TRUE - Close the connection when the message completes.
FALSE - Do not close the connection when the message completed
(default).
See also
Target path for CIP messaging The target path for CIP messaging contains parameters which determine the path
and destination of the of the CIP message.
"<local port>, <1st targets address>, [<1st targets local port>, <2nd
targets address>]"
The following table lists example values used in a target path string and describes
the results for each string.
See also
CIP/EIP message connections A maximum of 16 CIP (class 3) and 16 EIP connections are supported for client
message execution. The following table describes the CIP/EIP connection
behavior.
Scenario Results
Message request is enabled and CipConnMode=1. If a connection to the target does not exist, a CIP connection is
established.
If a connection to the target already exists, the existing CIP
connection is used.
Message request is enabled, CipConnMode=1, and the If an EIP connection to the target does not exist, an EIP
message's local port is Ethernet. connection is established prior to establishing a CIP connection.
Message request is enabled, CipConnMode=0, and the If an EIP connection to the target does not exist, an EIP
message's local port is Ethernet. connection is established.
Scenario Results
Message execution is completed, and ConnClose is set If there is only one connection to the target, the connection is
to True. closed.
If there is more than one connection to the target, the
connection is closed when the last message execution is
completed.
When a CIP connection is closed, any associated EIP connection
is also closed.
If more than one CIP connection uses the same EIP connection,
the EIP connection will be closed after all associated CIP
connections are closed.
When ConnClose is true, the message connection and If more than one message shares the same connection then the
EIP Session are closed upon completion of the message connection is closed upon completion of the last message.
execution.
A CIP or EIP connection that is not associated with any See CIP Specification Volume II TCP/IP objects for details
active message is closed if it is idle for x seconds. regarding the CIP Set Service.
Where x is a configurable Encapsulation Inactivity
Timeout value that can be set using the CIP Set Service.
Message execution is completed, and ConnClose is set The connection is not closed.
to False.
Connection is not associated with an active message, The connection is closed.
and remains idle for the amount of time specified in
ConnTimeOut parameter.
Controller transitions from an executing mode (Run, All active connections are forcibly closed.
Remote Run, Remote Test Single Scan and Remote
Single Rung) to a non-executing mode.
See also
CIP message timeout timers The following table describes how timers for CIPTARGETCFG timeout
parameters (UcmmTimeout and ConnMsgTimeout) behave based on message
requests and status.
Action Results
Message is enabled UcmmTimeout timer is activated
Connection is requested ConnMsgTimeout timer is activated
See also
MSG_CIPSYMBOLIC Sends a common industrial protocol (CIP) symbolic message over an Ethernet
channel or a serial port.
(common industrial
protocol symbolic message) Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
MSG_CIPSYMBOLIC operation
When the function block is enabled, the receive buffers for the Read operations
are cleared on the rising edge of Enable.
Arguments
See also
CIPSYMBOLICCFG data type Use this table to help determine the parameter values for the
CIPSYMBOLICCFG data type.
Use this table to help determine the data types MSG_CIPSYMBOLIC supports.
BOOL 193 (0xC1) Logical Boolean with values TRUE (1) and FALSE (0)
SINT 194 (0xC2) Signed 8bit integer value
INT 195 (0xC3) Signed 16bit integer value
DINT 196 (0xC4) Signed 32bit integer value
LINT 197 (0xC5) Signed 64bit integer value
USINT 198 (0xC6) Unsigned 8bit integer value
UINT 199 (0xC7) Unsigned 16bit integer value
UDINT 200 (0xC8) Unsigned 32bit integer value
ULINT 201 (0xC9) Unsigned 64bit integer value
REAL 202 (0xCA) 32bit floating point value
LREAL 203 (0xCB) 64bit floating point value
STRING 218 (0xDA) Character string
See also
Symbolic Read/Write syntax Syntax defines the combinations of symbols of a valid read/write instruction
block.
Symbol syntax
Use this table to help define the valid syntax for symbols. Only global variables are
supported.
See also
Supported Data Packet Size for For Micro830 and Micro850 controllers, both embedded serial port and plug-in
serial ports can support CIP serial communication. CIP serial communication
CIP Serial Function
data packet includes user data and CIP packet header.
When working as a CIP serial client, Micro830/Micro850 serial ports can support
a maximum of 490 bytes of read/write user data. This maximum specification
applies to CIP serial data packets with a minimum packet header size. When the
size of a packet header is bigger than the minimum packet header size, the
maximum size of user data that the CIP client can support is less than 490 bytes. If
data packet size is greater than the maximum data size supported by the CIP
client, the function block reports an error (0x21) and a sub-error (0x33).
When working as a CIP serial server, Micro830 and Micro850 serial ports can
support a minimum of 255 bytes of read/write user data. This minimum user data
size specification applies to CIP serial data packets with maximum packet header
size. When the size of CIP packet header is less than the maximum packet header
size, the CIP client can support data packet size that is greater than the minimum
specification (that is, greater than 255 bytes). However, if user data size is greater
than the maximum data size supported by the CIP server function, the CIP data
packet could be dropped, and the client will time out.
Important: For CIP serial server function, it is recommended not to read/write more than 255 bytes of user data in a
single CIP message.
See also
Use this table to help determine the parameter values for this instruction.
See also
MODBUSLOCPARA data type Use this table to help determine the parameter values for the
MODBUSLOCPARA data type.
This table describes the TriggerType parameter behavior when used with the
MSG_MODBUS function block.
208 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
Communication instructions Chapter 9
Action Results
Message is enabled Trigger timer starts
Trigger timer expires before the message completes Message is immediately triggered in the next ladder scan cycle.
Message completes before the trigger time expires Message is triggered when the trigger time expires.
See also
Message execution process The following process diagram describes the message instruction events that occur
when the Rung condition is True.
(Rung = TRUE)
Com queue: Message requests added to the Com queue have a buffer allocated
and processed by the communication task. The maximum queue size limit is 4.
Wait queue: Messages that cannot be added to the Com queue are added to the
Wait queue to be processed at a later time. The Wait queue does not have a
maximum size limit.
See also
MODBUSTARPARA data type The following table describes the MODBUSTARPARA data type.
See also
Use this table to help determine the parameter values for this instruction.
When the ER bit is set, the ErrorID and SubErrorID fields display the following
error codes.
See also
MODBUS2LOCPARA data type Use this table to help determine the parameter values for the
MODBUS2LOCPARA data type.
This table describes what happens when the TriggerType parameter is used with
the MSG_MODBUS2 function block.
Action Results
Message is enabled. Trigger timer starts.
Trigger timer expires before the message completes. Message is immediately triggered in the next ladder scan
cycle.
Message completes before the trigger time expires. Message is triggered when the trigger time expires.
See also
MODBUS2TARPARA data type Use this table to help determine the parameter values for the
MODBUS2TARPARA data type.
UnitId USINT Unit Identifier. Used to communicate with slave devices through a Modbus bridge.
Refer Modbus specification for more details. Note that Micro800 shall not attempt to
validate this value.
0 - 255
Set to 255 if Target device is not a bridge.
MsgTimeOut UDINT Message timeout (in milliseconds). Amount of time to wait for a reply for an
initiated command.
250-10,000
Set to 0 to use the default value 3,000.
A value less than 250 (minimum) is set to 250.
A value greater than 10,000 (maximum) is set to 10,000.
See Modbus/TCP message timeout timers.
ConnTimeOut UDINT TCP Connection establishment timeout (in milliseconds). Amount of time to wait for
establishing successful TCP connection to the Target device.
250-10,000
Set to 0 to use the default value 5,000.
A value less than 250 (minimum) is set to 250.
A value greater than 10,000 (maximum) is set to 10,000.
See Modbus/TCP message timeout timers.
ConnClose BOOL TCP connection closing behavior.
True - Close the TCP connection upon message completion.
False - Do not close the TCP connection upon message completion [Default].
See Modbus/TCP message connections.
This table describes the behavior for MsgTimeOut and ConnTimeOut based on
message requests and status.
Action Results
Message is enabled. Activates the MsgTimeOut timer.
TCP connection is requested. Activates the ConnTimeOut timer.
ConnTimeOut timer is active. Disables the MsgTimeOut timer.
Connection request is complete. Reactivates the MsgTimeOut timer.
Scenario Results
Message request is enabled, and a connection If a connection to the target does not exist, a new connection is
to the target does not exist. established.
If a connection to the target already exists, the existing connection is
used.
Message execution is completed, and If there is only one connection to the target, the connection is closed.
ConnClose is set to True. If there is more than one connection to the target, the connection is
closed when the last message execution is completed.
Message execution is completed, and The connection is not closed.
ConnClose is set to False.
Connection is not associated with an active The connection is closed.
message, and remains idle for the amount of
time specified in ConnTimeOut parameter.
Controller transitions from an executing mode All active connections are forcibly closed.
(Run, Remote Run, Remote Test Single Scan
and Remote Single Rung) to a non-executing
mode.
See also
See also
Message execution process The following diagram shows how and when messages execute based on the status
of the Com queue.
(general)
The following table describes the sequence of events identified in the preceding
diagram.
See also
Message execution process The following process diagram describes the message instruction events that occur
when the Rung condition is True.
(Rung = TRUE)
Com queue: Message requests added to the Com queue have a buffer allocated
and processed by the communication task. The maximum queue size limit is 4.
Wait queue: Messages that cannot be added to the Com queue are added to the
Wait queue to be processed at a later time. The Wait queue does not have a
maximum size limit.
See also
Message execution timing The following table describes the message conditions and bit status for each
execution step identified in the timing diagram while the rung condition remains
diagram (Rung = TRUE)
true.
See also
Message execution process The following process diagram describes the message instruction events that occur
when the Rung condition is False.
(Rung = FALSE)
See also
Message execution timing The following table describes the message conditions and bit status for each
execution step identified in the timing diagram when the rung goes to FALSE
diagram (Rung = FALSE)
during execution.
See also
Message execution process The following table describes the message conditions and bit status for each
execution step identified in the timing diagram when an error occurs during
(Error)
execution.
See also
Message execution timing The following timing diagram shows a typical pattern when an error occurs during
execution.
diagram (Error)
See also
Use the communication This section provides specific details and examples for using communication
instructions in logic programs. See the following topics for details of and examples
(message) function blocks for using the MSG_CIPGENERIC and MSG_CIPSYMBOLIC function blocks
to create programs.
See also
Configure object data values for To use the MSG_CIPGENERIC function block for explicit messaging, configure
the AppCfg parameter with the correct values.
explicit messaging
(MSG_CIPGENERIC) For additional information about message communication
There are several sources of information covering the implementation and use of
message communication, including Connected Components Workbench Help,
user manuals and the Rockwell Automation Literature Library.
4. To access drive manuals, on the Help menu, click User Manuals to display
the Manuals dialog box.
5. Click the plus (+) sign next to Drives to expand the category, and then
expand the class until the manual is located.
7. To access the EtherNet/IP manual, on the Help menu, click User Manuals
to display the Manuals dialog box.
8. Click the plus (+) sign next to Drives to expand the category, and then
expand the PowerFlex 4-class Peripherals class.
1. Go to http://literature.rockwellautomation.com .
4. Click Search.
6. Enter the full or partial device catalog number in the Search box. For
example, enter 2080-LC30 to view Micro830 user manuals.
8. In the Search box, type the full or partial device catalog number. For
example, enter 2080-LC30 to view Micro830 user manuals.
MSG_CIPGENERIC function blocks use the CIP Register object data in the
AppCfg parameter. The object data includes the following:
Class Code
Instance
Instance Attribute
Service
Use the values from the CIP register object in your input variables to configure the
MSG_CIPGENERIC function block parameters. The following image shows the
CIP register object data values used in the MSG_CIPGENERIC function block
parameters.
See also
Example: How to create a This example shows how to create a message program that retrieves Controller B
catalog information from Controller A using a MSG_CIPGENERIC function
MSG_CIPGENERIC messaging
block and a COP function block.
program to read data from a
controller
No Task
1 Identify initial values for the input variables (MSG_CIPGENERIC) on page 228
5 Add a COP function block, variables and contact (MSG_CIPGENERIC) on page 235
See also
Identify initial values for the input Follow these general steps to add input variables and initial values, and obtain the
variables, MSG_CIPGENERIC Identity Object values to configure the AppCfg parameter initial values.
2. Expand the Drives selection and locate the user manual for the type of
communication adapter you are using (EtherNet/IP Adapter User
Manual).
5. Go to the Appendix section and identify the object type related to your
explicit message (Identity object).
6. Identify the initial values for the AppCfg parameters based on the type
information being retrieved.
The following table identifies the specific Ethernet/IP object data used to read
catalog information from a controller.
See also
Add a MSG_CIPGENERIC function To add a MSG_CIPGENERIC function block to a ladder diagram program and
block and variables then add input variables to the function block, perform the following steps.
1. Add a controller:
Expand the Controllers folder and the Micro850 folder to view all
Micro850 controllers.
Double-click a controller (2080-LC50-48QVB) to add it to Project
Organizer.
In the Toolbox, select Instruction Block and drag and drop it onto
the ladder rung to display the Instruction Block Selector.
In Search, type MSG to display the message function blocks.
Type MSG_ReadDrive in the Instance field.
Double-click MSG_CIPGENERIC to add an instance of the function
block to the ladder diagram.
5. For the MyResData variable, double click Dimension and change the array
size to [1..81].
See also
Configure initial values for variables Follow these steps to add initial values to the input variables you previously
created and then assign the variables to the correct MSG_CIPGENERIC
function block input parameter.
In the ladder diagram POU, click the top portion of the variable input
block to display the variable drop-down list.
From the list, assign each input parameter to its correct input variable as
identified in the following table.
Parameter Input variable Comments
CtrlCfg MyCtrlCfg The catalog number must only be retrieved one time so the
MyCtrlCfg.TriggerType initial value is set to 0.
AppCfg MyAppCfg The initial values were determined by looking up the object
data values for Service, Class, Instance and Attribute.
Target MyTargetCfg The initial values are for target device configuration.
ReqData MyReqData Because this is a Read message, there is no request data so the
ReqData parameters is not used.
ReqLength MyReqLength Because this is a Read message, there is no request data so the
ReqLength parameters is not used.
ResData MyResData The catalog number string is stored in the array in the ODVA
short string format.
The first array element defines the strength length and the rest
store the string character's hexadecimal value.
The maximum number of characters is 80, plus the length
element so MyResData is defined as a 1 dimension array with
81 elements.
See also
Add a contact and a coil Use the following steps to add a coil and a contact to the MSG_CIPGENERIC
instruction that converts the catalog information to a human readable string.
1. In the Toolbox, select Direct Contact and drag and drop it to the left of
the MSG_CIPGENERIC function block input on the first ladder rung.
2. In the Variable Selector, type Get_Catalog in the Name field for the
contact.
3. In the Toolbox, select Direct Coil and drag and drop it to the right of the
MSG_CIPGENERIC function block output on the first ladder rung.
4. In the Variable Selector, type Convert_String in the Name field for the
coil.
See also
Add a COP function block, variables Use the following steps to add a COP function block, variables and a contact. The
and contact (MSG_CIPGENERIC) COP instruction is used to convert data from the source data type (for example,
DINT or REAL) to the destination data type. In this example, the catalog
information is converted to a human readable string.
1. In the Toolbox, select Rung and drag and drop it directly under the first
ladder rung to add a second rung.
In the Toolbox, select Block and drag and drop it onto the second
ladder rung to open the Instruction Block Selector.
Double-click COP to add an instance of the function block to the
ladder diagram.
4. For the CatalogID variable, double click Dimension and change the array
size to [1..1]
5. Add a contact:
In the Toolbox, select Direct Contact and drag and drop it to the left
of the COP function block input on the second ladder rung.
In the Variable Selector, select the Convert_String variable for the
contact.
Result
See also
Verify correct IP configuration on Follow these steps to verify the IP address settings are correct on Controller B.
Controller B
To verify the IP address:
4. Verify the IP address settings are correct as identified in the following table.
Results
The Internet Protocol options in your controller configuration page should look
similar to the following image.
See also
Example: How to create a This example shows how to create a message program to write a value to a
Controller B global variable from Controller A.
MSG_CIPSYMBOLIC messaging
program to write a value to a
variable
No Task
1 Add a COP function block, variables and a contact (MSG_CIPSYMBOLIC) on page 239
See also
Add a COP function block, variables The COP instruction is used to convert the data you enter to the destination data
and a contact (MSG_CIPSYMBOLIC) type so the data is compatible with the controller variable.
1. Add a controller:
Expand the Controllers folder and the Micro850 folder to view all
Micro850 controllers.
Double-click a controller (2080-LC50-48QVB) to add it to Project
Organizer.
In the Toolbox, select Instruction Block and drag and drop it onto
the first ladder rung to open the Instruction Block Selector.
In Search, type COP, and double-click COP to add an instance of the
function block to the ladder diagram.
5. Create Arrays:
6. Enter the data from the Value column of the table below into the Initial
Value field for each variable.
7. Add a contact:
In the Toolbox, select Direct Contact and drag and drop it to the left
of the COP function block input on the first ladder rung.
In the Variable Selector, assign a variable named Convert_Data to
contact.
Use the variables defined in the table for the COP function block.
See also
Add an Equal operator and a coil The Equal instruction is used to trigger writing a value if the data type conversion
was successful. To add an Equal (=) operator, variables and a coil, perform the
following steps.
1. In the Toolbox, select Rung and drag and drop it directly under the first
ladder rung to add a second rung.
In the Toolbox, select Instruction Block and drag and drop it onto
the second ladder rung to open the Instruction Block Selector.
In Search, type the '=' sign and double-click '=' to add an instance of
the operator to the ladder diagram.
In the Toolbox, select Direct Coil and drag and drop it to the right
of the Equal operator output on the second ladder rung.
In the Variable Selector, type WriteValue in the Name field for
the coil.
The second rung of your ladder diagram program for
MSG_CIPGENERIC messaging should look similar to the following
image.
See also
Add a MSG_CIPSYMBOLIC function To add a MSG_CIPSYMBOLIC function block, input variables and a contact to
block, variables and a contact a ladder diagram, perform the following steps.
1. In the Toolbox, select Rung and drag and drop it directly under the second
ladder rung to add a third rung.
In the Toolbox, select Instruction Block and drag and drop it onto
the ladder rung to display the Instruction Block Selector.
In Search, type MSG to display the message function blocks.
Type MSG_WriteVariable in the Instance field.
Double-click MSG_CIPSYMBOLIC to add an instance of the
function block called MSG_WriteVariable to the ladder diagram.
4. For the Data variable, double click Dimension and change the array size to
[1...4].
5. Configure initial values for the local variables, add CtrlCfg initial values:
From the Local Variables page, expand the CtrlCfg parameter to view
additional parameters.
Enter the following values in the Initial Value column for each
parameter.
Parameter Initial value
A_CtrlCfg.Cancel Leave blank
A_CtrlCfg.TriggerType 300
A_Ctrlcfg.StrMode Leave blank
From the Local Variables page, expand the SymCfg parameter to view
additional parameters.
Enter the following values in the Initial Value column for each
parameter.
Parameter Initial value
A_SymCfg.Service 1
A_SymCfg.Symbol 'UDINT_FromA'
A_SymCfg.Count Leave blank
A_SymCfg.DataType 200
A_SymCfg.Offset Leave blank
8. Add a contact:
In the Toolbox, select Direct Contact and drag and drop it to the left
of the MSG_CIPSYMBOLIC function block input on the third ladder
rung.
In the Variable Selector, assign the WriteValue variable to the
contact.
The third rung of your ladder diagram program for MSG_CIPSYMBOLIC
messaging should look similar to the following image.
See also
Verify correct IP configuration on Follow these steps to verify the IP address settings are correct on Controller B.
Controller B
4. Verify the IP address settings are correct as identified in the following table.
Results
The Internet Protocol options in your controller configuration page should look
similar to the following image.
See also
Create global variable for Controller Follow these steps to create a Global variable for controller B.
B
To create a Global variable:
The Global Variables selector should look similar to the following image.
See also
Review the complete program results The following example shows the complete MSG_CIPSYMBOLIC messaging
program after it has executed.
Controller B results
The following two images show the values for Controller B before and after the
messaging program is executed.
See also
Example: How to configure These examples describe how to configure Modbus communication to read status
data from and write control data to a PowerFlex 4 drive using the
Modbus communication to read
MSG_MODBUS instruction.
from and write to a drive
Micro830 wiring
The following MSG_MODBUS instruction can be used to read status data from
the PowerFlex 40 drive.
Drive status
Refer to the PowerFlex user manual for additional information about Logic Status
word bits, error code descriptions, commanded and actual speeds, and other status
codes.
The following image shows the variable options for the MSG_MODBUS
instruction block used to read status data from a PowerFlex 40 drive.
The following table identifies the variables and the values used to configure the
MSG_MODBUS instruction to read status data from a PowerFlex 4 drive.
The following images shows an example of using the MOV instruction to move
the *_l[1] array value to a Word, which allows you to directly access the individual
bits.
The following image shows the variables and the values used to configure the
MSG_MODBUS instruction to write control data to a PowerFlex 4 drive.
The following table lists the variables, values and describes the purpose of each
variable.
See also
Communication protocol The MSG_CIP function blocks support different communication protocols as
described in this section.
support
Function block support for message communication protocols.
Modbus RTU
For more information about the Modbus protocol, refer to the Modbus Protocol
Specifications (available from http://www.modbus.org).
Modbus/TCP
EtherNet/IP
The CIP protocol is a transport and application layer protocol used for messaging
over EtherNet/IP, ControlNet, and DeviceNet networks that allows HMIs to
easily connect to a Micro830 or a Micro850 controller.
CIP Serial
CIP serial uses DF1 Full Duplex protocol, and provides point-to-point connection
between two devices. It combines data transparency (American National
Standards Institute ANSI - X3.28-1976 specification subcategory D1) and 2-way
simultaneous transmission with embedded responses (subcategory F1)
The Serial Port driver can be configured as CIP Serial, Modbus RTU, ASCII or
Shutdown through the device configuration tree.
See also
Embedded communication The Micro820, Micro830, and Micro850 controllers have the following
additional embedded communication channels:
channels
A non-isolated RS-232/485 combo port
A non-isolated USB programming port (Micro830 and Micro850 only)
An RJ-45 Ethernet port (Micro820, and Micro850 only)
See also
Compare instructions
Use Compare instructions to compare Integer, Real, Time, Date, and String values
using an expression or a specific compare instruction.
Instruction Description
(=) Equal on page 257 Compares the first input to the second input to determine equality. For
Integer, Real, Time, Date, and String data types.
(>) Greater Than on page 260 Compares input values to determine whether the first is greater than the
second.
(>=) Greater Than or Equal on page 262 Compares input values to determine whether the first is greater than or
equal to the second.
(<) Less Than on page 264 Compares input values to determine whether the first is less than the
second.
(<=) Less Than or Equal on page 266 Compare input values to determine whether the first is less than or
equal to the second.
(<>) Not Equal on page 268 Compares input values to determine whether the first is not equal to the
second.
See also
Equal Performs an operation that compares the first input to the second input to
determine equality for Integer, Real, Time, Date, and String data types.
Operation details:
Equality testing of Time values is not recommended for TON, TP, and
TOF instruction blocks.
The Real data type is not recommended when comparing values for equality
because numbers in the math operation are rounded differently than those
that appear in the variable output display. Consequently, two output values
may appear equal in the display, though evaluate as false. For example,
23.500001 compared to 23.499999, both display as 23.5 in the variable
input display, but are not equal in the controller.
Use this table to help determine the parameter values for this instruction.
Compare Real Values using Subtraction (-) ABS, and Less than (<) example
The Real data type is not recommended when comparing values for equality
because of differences in the way numbers are rounded. Two output values may
appear equal in a Connected Components Workbench display, but will evaluate as
false.
For example, 23.500001 compared to 23.499999 will both display as 23.5 in the
variable input display, but will not be equal in the controller.
To test whether two Real data type values are equal, you can use a Subtraction
instruction to get the difference between the values and then determine if the
difference is Less Than an established precision value. See the following LD
program example for comparing two Real data type values.
(* ST Equivalence: *)
See also
Greater than Compares Integer, Real, Time, Date, and String input values to determine
whether the first is greater than the second.
Use this table to help determine the parameter values for this instruction.
i2 Input SINT
USINT
- BYTE
INT
UINT
WORD
DINT
UDINT
DWORD
LINT
ULINT
LWORD
REAL
LREAL
TIME
DATE
STRING
o1 Output BOOL TRUE if i1 > i2.
(* ST Equivalence: *)
See also
Greater than or equal Compares Integer, Real, Time, Date, and String input values to determine
whether the first is greater than or equal to the second.
For TON, TP, and TOF, equality testing of Time values is not recommended.
Use this table to help determine the parameter values for this instruction.
i1 Input SINT All inputs must be the same data type. The Time input applies
USINT to the Structured Text, Ladder Diagram and Function Block
BYTE Diagram languages.
INT
UINT
WORD
DINT
UDINT
DWORD
LINT
ULINT
LWORD
REAL
LREAL
TIME
DATE
STRING
(* ST Equivalence: *)
See also
Less than Compares Integer, Real, Time, Date, and String input values to determine
whether the first is less than the second.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* IL equivalence: *)
LD 10
LT 25
ST aresult
LD 'z'
LT 'B'
ST mresult
See also
Less than or equal Compares Integer, Real, Time, Date, and String input values to determine
whether the first is less than or equal to the second.
For TON, TP, and TOF, equality testing of Time values is not recommended.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Not equal Compares Integer, Real, Time, Date, and String input values to determine
whether the first is not equal to the second.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Counter instructions
Instruction Description
See also
Use this table to help determine the parameter values for this instruction.
CTD1(trigger,load_cmd,100);
underflow := CTD1.Q;
result := CTD1.CV;
Results
See also
Use this table to help determine the parameter values for this instruction.
CTU1(trigger,NOT(auto_mode),100);
overflow := CTU1.Q;
result := CTU1.CV;
Results
See also
CTUD (count up down) Counts integers from 0 up to a given value, 1 by 1, or from a given value down to
0, 1 by 1.
Use this table to help determine the parameter values for this instruction.
See also
Instruction Description
ANY_TO_BOOL on page 279 Converts a non-Boolean value to a Boolean.
ANY_TO_BYTE on page 280 Converts a value to a Byte.
ANY_TO_DATE on page 282 Converts a String, Integer, Real, or Time data type to Date data type.
ANY_TO_DINT on page 283 Converts a value to a Double Integer.
ANY_TO_DWORD on page 284 Converts a value to a Double Word value.
ANY_TO_INT on page 286 Converts a value to an Integer.
ANY_TO_LINT on page 287 Converts a value to a Long Integer.
ANY_TO_LREAL on page 288 Converts a value to a Long Real.
ANY_TO_LWORD on page 289 Converts a value to a Long Word.
ANY_TO_REAL on page 290 Converts a value to a Real.
ANY_TO_SINT on page 291 Converts a value to a Short Integer.
ANY_TO_STRING on page 292 Converts a value to a String.
ANY_TO_TIME on page 294 Converts a value to the Time data type.
ANY_TO_UDINT on page 295 Converts a value to an Unsigned Double Integer.
ANY_TO_UINT on page 296 Converts a value to an Unsigned Integer.
ANY_TO_ULINT on page 298 Converts a value to an Unsigned Long Integer.
ANY_TO_USINT on page 299 Converts a value to an Unsigned Short Integer.
ANY_TO_WORD on page 300 Converts a value to a Word.
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Converts a String, Integer, Real, or Time data type to Date data type.
ANY_TO_DATE
Boolean, Byte, and Word date types are supported but are not recommended.
Use this table to help determine the parameter values for this instruction.
ANY_TO_DATE
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
290 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
Data conversion instructions Chapter 12
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use Data manipulation instructions to alter the output data to change the status
without altering the program.
Instruction Description
AVERAGE on page 303 Calculates a running average over a number of a defined samples.
COP on page 305 Copies the binary data in the source element to the destination element.
MAX on page 313 Calculates the maximum of two integer values.
MIN on page 311 Calculates the minimum of two integer values.
See also
AVERAGE Calculates a running average over a number of a defined samples and stores the
value at each cycle.
Operation details:
Use this table to help determine the parameter values for this instruction.
See also
Copies the binary data in the source element to the destination element. The
COP
source element remains unchanged.
Use this table to help determine the parameter values for this instruction.
Enable Input BOOL Instruction block enable. COP iis level triggered.
TRUE - perform copy.
FALSE - the function block is idle.
Src Input BOOL DWORD Initial element to copy.
SINT REAL If the source is a STRING data type the destination must be a
USINT TIME either a STRING data type or a USINT (UCHAR and BYTE)
BYTE DATE data type. If it is not, a data type mismatch is reported.
INT STRING
UINT LWORD
WORD ULINT
DINT LINT
UDINT LREAL
SrcOffset Input UINT The source element offset is used with array data types to
identify the position in the source array to copy the data
from.
Set the offset to 0 if:
If it is not an array data type, or
To copy from the first element for an array data type.
Dest Input BOOL DWORD Initial element to be overwritten by the source.
SINT REAL If the destination is a STRING data type the source must be
USINT TIME either a STRING data type or a USINT (UCHAR and BYTE)
BYTE DATE data type. If it is not, a data type mismatch is reported.
INT STRING
UINT LWORD
WORD ULINT
DINT LINT
UDINT
DestOffset Input UINT The destination element offset is used with array data types
to identify the position in the destination array to copy the
data to.
Set the offset to 0 if:
If it is not an array data type, or
To copy from the first element for an array data type.
Length Input UINT Number of destination elements to copy.
When the destination is a STRING data type, it indicates the
number of strings to be copied.
Swap Input BOOL Used to exchange the data from the source and destination
elements, so that the destination data replaces the source
data and the source data replaces the destination data.
TRUE - Swap bytes according to the data type. A swap
operation does not occur if:
The source data type or the destination data type is a
STRING, or
If both the source and the destination are 1-byte length
data.
Sts Output UINT Status of the copy operation. The definitions for the Sts
parameter are defined in COP status codes.
See also
Copy to a different data type When a copy to or from a String data type is performed, the ODVA short String
format is used for data in the USINT array.
When COP is used between any other pair of data types, the copy operation is
valid, even if the data type in the source is not the same as the data type in the
destination, and even when they are not in a valid format. The logic must be
validated at the application level.
To copy a USINT array to a String array, the data in the USINT array must be in
this format:
See also
COP string array example The following example shows a COP instruction copying a string array into Usint
array. The COP instruction skips all the elements in the source array with Zero
length.
Ladder Diagram
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Instruction Description
HSC on page 318 HSC applies high presets, low presets and output source values to the high-speed counter.
See also
What is a High-Speed A high-speed counter detects and counts narrow (fast) pulses and then issues
specialized instructions to initiate control operations when the detected counts
Counter? reach their preset values. Control operations include the automatic and
immediate execution of the high-speed counter interrupt routine and the
immediate update of outputs based on the configured source and mask pattern.
Important: The HSC function can only be used with the controller's embedded I/O. It cannot be used with
expansion I/O modules.
See also
HSC (high-speed counter) HSC applies high presets, low presets and output source values to the high-speed
counter.
Operation details:
This instruction is available for controllers with embedded high speed counters
such as Micro830 and Micro850.
Use this table to help determine the parameter values for this instruction.
See also
HSCCmd values The following table describes the HSC commands for each HSC command value.
0x03 HSC Load/Set: reload the HSC Application Data (if rung is enabled) for 6 input elements: HPSetting,
LPSetting, HPOutput, LPOutput, OFSetting, and UFSetting.
Note: This command does not re-load the following input element: HSC accumulator.
0x04 HSC Accumulator Reset (if rung is enabled).
See also
HSCAPP data type Use the HSCAPP data type to define the HSCAppData parameter in HSC
instruction. The HSCApp data type parameters are used to define HSC
configuration data.
Use this table to help determine the parameter values for the HSCAPP data type.
When the PLS function is enabled, relevant HSCApp settings are superseded by
the corresponding PLSData settings as shown in the following table.
HSCApp.HSCID
HSCApp.HSCMode
For additional information on HSC operating modes and input assignments, see
HSC Inputs and Wiring Mapping in the Micro830 and Micro850 Programmable
Controllers User Manual.
HSC operating modes, the main HSC and sub HSC support different modes.
5 Two input counter (up and down) with external reset and hold.
7 Quadrature counter (phased inputs A and B) with external reset and hold.
9 Quadrature X4 counter (phased inputs A and B) with external reset and hold.
See also
HSCSTS data type HSCSTSInfo (data type HSCSTS) displays the status of the High-Speed
Counter.
If the HSC function block is counting with command 0x01, the HSC status
is continuously updated.
If an error occurs, the Error_Detected flag is turned on and an error code is
set.
HSCSTSInfo parameters
HSCSTSInfo (data type HSCSTS) parameters are used to determine the status of
the High-Speed Counter.
CountEnable
Indicates the status of the High-Speed Counter, whether counting is enabled (1)
or disabled (0, default).
ErrorDetected
Detects if an error is present in the HSC sub-system. Configuration errors are the
most common types of error represented by the ErrorDetectedr. When the bit is
set (1), look at the specific error code in parameter HSCSTS.ErrorCode, which is
maintained by the controller. You can clear the ErrorDetected bit when necessary.
CountUpFlag
Used with all of the HSCs (modes 0...9). If the HSCSTS.CountEnable bit is set,
the Count Up bit is set (1). If the HSCSTS.CountEnable is cleared, the Count
Up bit is cleared (0).
CountDownFlag
Mode1Done
The HSC sub-system sets the HSCSTS.Mode1Done status flag to (1) when the
HSC is configured for Mode 0 or Mode 1 behavior, and the accumulator counts
up to the High Preset value.
OVF
The HSC sub-system sets the HSCSTS.OVF status flag to (1) whenever the
accumulated value (HSCSTS.Accumulator) has counted through the overflow
variable (HSCAPP.OFSetting). This bit is transitional and is set by the HSC
sub-system. It is up to the control program to use, track, and clear (0) the overflow
condition.
UNF
The HSC sub-system sets the HSCSTS.UNF status flag to (1) whenever the
accumulated value (HSCSTS.Accumulator) has counted through the underflow
variable (HSCAPP.UFSetting). This bit is transitional and is set by the HSC
sub-system. It is up to the control program to use, track, and clear (0) the
underflow condition.
CountDir
The HSC sub-system controls the HSCSTS.CountDir status flag. When the
HSC accumulator counts up, the direction flag is set to (1). Whenever the HSC
accumulator counts down, the direction flag is cleared (0).
If the accumulated value stops, the direction bit retains its value. The only time the
direction flag changes is when the accumulated count reverses.
This bit is updated continuously by the HSC sub-system whenever the controller
is in a run mode.
HPReached
The HSC sub-system sets the HSCSTS.HPReached status flag to (1) whenever
the accumulated value (HSCSTS.Accumulator) is greater than or equal to the
high preset variable (HSCAPP.HPSetting).
This bit is updated continuously by the HSC sub-system whenever the controller
is in an executing mode. Writing to this element is not recommended.
LPReached
The HSC sub-system sets the HSCSTS.LPReached status flag to (1) whenever the
accumulated value (HSCSTS.Accumulator) is less than or equal to the low preset
variable (HSCAPP.LPSetting).
This bit is updated continuously by the HSC sub-system whenever the controller
is in an executing mode. Writing to this element is not recommended.
OFCauseInter
The Overflow Interrupt status bit sets (1) when the HSC accumulator counts
through the overflow value and the HSC interrupt is triggered. This bit can be
used in the control program to identify that the overflow variable caused the HSC
interrupt. If the control program needs to perform any specific control action
based on the overflow, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
UFCauseInter
The Underflow Interrupt status bit sets (1) when the HSC accumulator counts
through the underflow value and the HSC interrupt is triggered. This bit can be
used in the control program to identify that the underflow condition caused the
HSC interrupt. If the control program needs to perform any specific control
action based on the underflow, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
HPCauseInter
The High Preset Interrupt status bit sets (1) when the HSC accumulator reaches
the high preset value and the HSC interrupt is triggered. This bit can be used in
the control program to identify that the high preset condition caused the HSC
interrupt. If the control program needs to perform any specific control action
based on the high preset, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
LPCauseInter
The Low Preset Interrupt status bit sets (1) when the HSC accumulator reaches
the low preset value and the HSC interrupt is triggered. This bit can be used in the
control program to identify that the low preset condition caused the HSC
interrupt. If the control program needs to perform any specific control action
based on the low preset, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
PlsPosition
When the HSC is in Counting mode, and PLS is enabled, this parameter indicates
which PLS element is used for the current HSC configuration.
ErrorCode
Accumulator
Sets the initial accumulator value when the High-Speed Counter starts. When the
HSC is in Counting mode, the Accumulator is automatically updated by the HSC
sub-system to reflect the actual HSC accumulator value.
HP
The HSCSTS.HP is the upper setpoint (in counts) that defines when the HSC
sub-system generates an interrupt.
The data loaded into the high preset must be less than or equal to the data resident
in the overflow (HSCAPP.OFSetting) parameter or an HSC error is generated.
This is the latest high preset setting, which may be updated by PLS function from
the PLS data block.
LP
The HSCSTS.LP is the lower setpoint (in counts) that defines when the HSC
sub-system generates an interrupt.
The data loaded into the low preset must be greater than or equal to the data
resident in the underflow (HSCAPP.UFSetting) parameter or an HSC error is
generated. If the underflow and low preset values are negative numbers, the low
preset must be a number with a smaller absolute value.
This is the latest low preset setting, which may be updated by PLS function from
the PLS data block.
HPOutput
Defines the state (1 = ON or 0 = OFF) of the outputs on the controller when the
high preset is reached. For more information on how to directly turn outputs on
or off based on the high preset.
You can configure the high output bit pattern during initial setup, or you can use
the HSC function block to load the new parameters while the controller is
operating.
LPOutput
You can configure the low output bit pattern during initial setup, or you can use
the HSC function block to load the new parameters while the controller is
operating.
The following image shows the HSCStsInfo parameters in the Variable Selector.
See also
PLS data type PLSData (data type PLS) is used to configure the programmable limit switch.
The PLS data structure is a flexible array with the following elements.
The total number of elements for one PLS data structure should not exceed 255.
PLSData parameters
Element Data Type Data Format HSC mode User program Description
access
HSCHP DINT 32-bit signed 0 read/writer High preset
integer
HSCLP DINT 32-bit signed 0 read/writer Low preset
integer
HSCHPOutput UDINT 32-bit binary 0 read/writer Output high data
HSCLPOutput UDINT 32-bit binary 0 read/writer Output low data
When the PLS function is enabled, relevant HSCApp settings are superseded by
the corresponding PLSData settings as shown in the following table.
The following figure shows the PLSData parameters in the Variable Selector.
See also
HSC_SET_STS (high-speed HSC_SET_STS manually sets or resets the HSC counting status.
The HSC function block must be stopped (not counting) for the
HSC_SET_STC function block to set or reset the HTS status. If HSC
function is not stopped, the input parameters continue to update and
changes made using HSC_SET_STS are ignored.
Use this table to help determine the parameter values for this instruction.
The following table describes the status codes for the HSC function block.
See also
Use the High-Speed Counter This section provides specific details and examples for using high-speed counter
instructions in logic programs, including the following:
instructions
Update HSC application data on page 338
Example: How to add a Programmable Limit Switch (PLS) function on page 355
Update HSC application data HSC configuration is defined in the HSC application data, and is usually only
configured once before programming the HSC instruction. Changes made to the
HSC application data (HSCAppData parameter) are ignored while the HSC is
counting.
1. Update HSCAppData.
See also
High-Speed Counter (HSC) User In Interrupt Type, select High-Speed Counter (HSC) User Interrupt.
Interrupt dialog box Use the HSC interrupt dialog box to:
Configure the interrupt properties, such as ID and the program to use it in.
Configure the interrupt parameters.
See also
Configure a High-Speed Counter A user interrupt causes the controller to suspend the task it is currently
performing, perform a different task, and then return to the suspended task at the
(HSC) User Interrupt
point where the task was suspended.
<Mi830> and Micro850 controllers support up to six HSC User Interrupts that
can be used to execute selected user logic at a pre-configured event.
See also
Add and configure a High-Speed To add and configure a HSC interrupt from the controller's configuration
workspace, perform the following steps.
Counter (HSC) User Interrupt
To add an HSC interrupt:
3. Right-click an empty row, and click Add to open the Interrupt properties
dialog box.
See also
HSC Interrupt properties The HSC Interrupt properties status bits indicate the enabled/disabled status, the
execution status, and whether or not the interrupt condition is lost.
The EX (User Interrupt Executing) bit is set (1) whenever the HSC sub-system
begins processing the HSC subroutine due to any of the following conditions:
The HSC EX bit can be used in the control program as conditional logic to detect
if an HSC interrupt is executing.
The HSC sub-system will clear (0) the EX bit when the controller completes its
processing of the HSC subroutine.
The PE (User Interrupt Pending) status flag indicates an interrupt is pending. The
PE status bit can be monitored or used for logic purposes in the control program if
you need to determine when a subroutine cannot be immediately executed. The
PE bit is maintained by the controller and is set and cleared automatically.
The LS (User Interrupt Lost) is a status flag that indicates an interrupt has been
lost. The controller can process 1 active user interrupt condition and maintain 1
pending user interrupt condition before it sets the lost bit.
The LS bit is set by the controller. It is up to the control program to use and
monitor a lost condition.
See also
HSC Interrupt parameters The HSC interrupt parameters are used to configure the start and mask options.
Auto Start is configured with the programming device and stored as part of the
user program. The auto start bit defines if the HSC interrupt function
automatically starts whenever the controller enters any run or test mode.
The MV (Overflow Mask) control bit is used to enable (allow) or disable (not
allow) an overflow interrupt from occurring. If the bit is clear (0), and
an Overflow Reached condition is detected by the HSC, the HSC user interrupt
is not executed.
342 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
High-Speed Counter (HSC) instructions Chapter 14
The MV bit is controlled by the user program and retains its value through a
power cycle. The user program must set and clear the MV bit.
The MN (Underflow Mask) control bit is used to enable (allow) or disable (not
allow) an underflow interrupt from occurring. If the bit is clear (0), and an
Underflow Reached condition is detected by the HSC, the HSC user interrupt is
not executed.
The MN bit is controlled by the user program and retains its value through a
power cycle. The user program must set and clear the MN bit.
The MH (High Preset Mask) control bit is used to enable (allow) or disable (not
allow) a high preset interrupt from occurring. If this bit is clear (0), and a High
Preset Reached condition is detected by the HSC, the HSC user interrupt is not
executed.
The MH bit is controlled by the user program and retains its value through a
power cycle. The user program must set and clear the MH bit.
The ML (Low Preset Mask) control bit is used to enable (allow) or disable (not
allow) a low preset interrupt from occurring. If this bit is clear (0), and a Low
Preset Reached condition is detected by the HSC, the HSC user interrupt is not
executed.
The ML bit is controlled by the user program and retains its value through a
power cycle. The user program must set and clear the ML bit.
See also
Configure a Programmable The high-speed counter has additional operating modes for implementing a
Programmable Limit Switch (PLS). The PLS function is used to configure the
Limit Switch (PLS)
High-Speed Counter to operate as a PLS or as a rotary cam switch. The PLS
function supports up to 255 pairs of high and low presets, and can be used when
you need more than one pair of high and low presets.
The PLS mode only operates in tandem with the HSC of the Micro800
controller, and must be enabled in the HSC instruction by setting the
HSCAppData.PLSEnable parameter to True.
The PLSPosition parameter is reset after completing a full cycle and reaching the
HSCSTS.HP value. Resetting the HSC instruction or moving 0 to the
PLSPositon parameter does not reset the PLSPosition.
The PLS function can operate with all other HSC capabilities, including the
ability to select which HSC events generate a user interrupt.
When the PLS function is enabled, and the controller is in run mode, the HSC
counts incoming pulses, and the following events occur.
When the count reaches the first preset (HSCHP or HSCLP) defined in
the PLS data, the output source data (HSCHPOutput or HSCLPOutput)
is written through the HSC mask (HSCAPP.OutputMask).
At that point, the next presets (HSCHP and HSCLP) defined in the PLS
data become active.
When the HSC counts to the new preset, the new output data is written
through the HSC mask.
This process continues until the last element within the PLS data block is
loaded.
At that point the active element within the PLS data block is reset to zero.
See also
Example: How to create a This example shows how to create a High-Speed Counter (HSC) program that
uses a quadrature encoder and includes a Programmable Limit Switch (PLS)
High-Speed Counter (HSC)
function.
program
Quadrature encoder used in the example
The High Speed Counter program example uses an HSC function block and a
quadrature counter with phased inputs A and B. The quadrature encoder
determines the direction of rotation and the position for rotating equipment, such
as a lathe. The Bidirectional Counter counts the rotation of the quadrature
encoder.
Perform the following tasks for to create, build, and test the HSC program, and
then add a PLS function.
See also
Create a ladder diagram and add Create a ladder diagram and then add local variables to the rung. This sample
variables program uses a 2080-LC50-24QVB controller. The HSC is supported on all
Micro830 and Micro850 controllers except 2080-LCxx-xxAWB controller types.
1. In the Device Toolbox, expand the Catalog tab to view the device folders.
2. Expand the Controllers folder and the Micro830 folder to view all
Micro830 controllers. Double-click a controller (2080-LC50-24QVB) to
add it to the Project Organizer.
5. In the Toolbox:
7. In the Toolbox, select a function block and drag it to the right of the direct
contact as shown in the following image.
10. Verify the ladder rung looks similar to the following figure.
12. In the Variables page, add the following variables and data types.
Result
See also
Assign values to the HSC variables After you add variables, follow these steps to add values to the variables using the
Initial Value column in the Variable Selector. A standard program usually uses a
routine to assign values to the variables.
3. Assign the rest of the values to the MyAppData variables as shown in the
following figure.
See also
Assign variables and build the After you enter values in the HSC variables, follow these steps to assign the
program variables to the function block, and build the program.
1. From the Ladder Diagram editor, assign each variable to the HSC function
block element as shown.
3. From the Controller tree, click Embedded I/O, and select input filters for
the encoder.
5. Start the Micro830 controller and connect the controller to your computer.
6. Build the program and then download the program to the controller.
See also
Test the program and run the After you download the HSC program to the controller, you can test it and then
High-Speed Counter run the High-Speed Counter.
4. Click the I/O Micro830 tab, and then click the _IO_EM_DI_05 row.
5. Select Lock and Logical Value to force the input to the ON position.
6. To view results, click the Local Variables tab to view variable changes.
8. Turn on the encoder to see the counter count up/down. For example, if the
encoder is attached to a motor shaft, then turn on the motor to trigger the
HSC count.
9. Verify the Logical Value of in the MyStatus variable is 1, which indicates the
HSC is running.
Results
See also
Add a Programmable Limit This example explains how to add a Programmable Limit Switch (PLS) function
to the HSC program.
Switch (PLS) function
Variable values for the counter settings:
To enable PLS:
The PLS variable has a dimension of [1..4]. This means that HSC can
have four pairs of High and Low Presets.
High Preset values should be lower than the OFSetting and the Low
Preset should be greater than the UFSetting.
The HscHPOutPut and HscLPOutPut values determine which
outputs are turned on when a High Preset or Low Preset is reached.
See also
Example: Programmable Limit This example describes the results when PLS is enabled using specific HSC and
PLSData parameter values.
Switch (PLS) enabled
HSC parameter values
This example assumes the HSC parameters are set to the following values:
HSCApp.OutputMask = 31
HSCApp.HSCMode = 0
HSC controls Embedded Output 0...4 only
This example assumes the PLSData parameters for the variable (HSC_PLS) are
configured as follows.
See also
Input/Output instructions
Instruction Description
LCD_REM on page 364 Displays user defined messages for the remote LCD.
RHC on page 368 Reads the high speed clock value in the Micro800 controller.
RPC on page 370 Reads the user program checksum, either from the controller or memory module.
DLG on page 371 Writes variable values from the run-time engine into a Data Logging File on an SD
Card.
IIM on page 373 Updates inputs prior to normal output scan.
IOM on page 375 Updates outputs prior to normal output scan.
KEY_READ on page 378 Micro810 only.
Reads the Key status on the optional LCD module when the user display is active.
KEY_READ_REM on page 381 Micro820 only.
Reads the Key status on the optional remote LCD module when the user display is
active.
MM_INFO on page 383 Reads memory module header information.
MODULE_INFO on page 387 Reads module information from a plug-in or expansion module excluding the
2080-MEMBAK-RTC memory module.
PLUGIN_INFO on page 400 Reads module information from a generic plug-in or expansion module excluding
the 2080-MEMBAK-RTC memory module.
PLUGIN_READ on page 403 Reads data from a generic plug-in module excluding the 2080-MEMBAK-RTC
memory module.
PLUGIN_RESET on page 405 Resets the hardware for a generic plug-in module excluding the
2080-MEMBAK-RTC memory module.
PLUGIN_WRITE on page 407 Writes data to a generic plug-in module excluding the 2080-MEMBAK-RTC
memory module.
RCP on page 409 Reads and writes recipe data to and from an SD memory card.
RTC_READ on page 412 Reads the real-time clock (RTC) module information.
RTC_SET on page 414 Sets RTC data to the RTC module information.
SYS_INFO on page 417 Reads the status data block for the Micro800 controller.
Instruction Description
TRIMPOT_READ on page 419 Reads the trimpot value from a specific trimpot.
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
LCD_BKLT_REM (remote Sets the Remote LCD backlight parameters in a user program.
The backlight settings defined in LCD_BKLT_REM are used when the Remote
LCD display is:
Use this table to help determine the parameter values for this instruction.
See also
LCD_REM (remote LCD) Displays user defined messages for the Remote LCD.
Operation details:
Use this table to help determine the parameter values for this instruction.
When the font size for the start up message is large or extra
large, the Remote LCD displays:
strings in Line1 to Line4.
ignores strings in Line5 to Line8.
a maximum of 12 characters per line.
See also
RHC (read high speed clock) Reads the high speed clock value in the Micro800 controller.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT2 := RHC() ;
See also
RPC (read program Reads the user program checksum, either from the controller or memory module.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT2 := RPC(TESTINPUT) ;
See also
DLG (data log) Writes variable values from the run-time engine into a Data Logging File on an
SD Card.
When writing to a data log a maximum of 50 group folders are allowed per day.
Each group folder has a maximum of 50 files with a file size of 4k-8k.
Use this table to help determine the parameter values for this instruction.
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
Results
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
Results
See also
KEY_READ (read keys on Reads the Key status on the optional LCD module when the user display is active.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
KEY_READ_1(KEYENABLE) ;
KEY_EKYL := KEY_READ_1.EKYL ;
KEY_CKY := KEY_READ_1.CKY ;
KEY_EKY := KEY_READ_1.EKY ;
KEY_UKY := KEY_READ_1.UKY ;
KEY_DKY := KEY_READ_1.DKY ;
KEY_RKY := KEY_READ_1.RKY ;
KEY_LKY := KEY_READ_1.LKY ;
See also
KEY_READ_REM (read keys Reads the Key status on the optional Remote LCD module when the user display
is active.
for remote LCD)
Operation details:
Use the LCD_REM instruction to activate the user display on the Remote
LCD module. If the user display is not active, an error occurs during
KEY_READ_REM execution.
P-BUTTON property in LCD Function File activates; otherwise all key
status is FALSE.
Only single key presses are supported for the KEY_READ_REM
instruction; two-key press combinations are not supported.
Use this table to help determine the parameter values for this instruction.
Use this table to help determine the KeyData bitfields for KEY_READ_REM.
See also
MM_INFO (memory module Reads Memory Module header information. When a Memory Module is not
present, all values return zero (0).
information)
Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
Results
See also
MMINFO data type The following table describes the MMINFO data type parameters.
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
Use this table to determine the MODULE_INFO error codes and descriptions.
6 Plug-in module read error occurred while reading the Module ID.
7 Plug-in module read error occurred while reading the Vendor ID.
9 Plug-in module read error occurred while reading the Product Code.
10 Plug-in module read error occurred while reading the Module Revision.
Results
See also
MODULE_INFO - plug-in and The following information provides the plug-in and expansion module Type,
Module ID, Vendor ID, Product Codes and the Revision Word descriptions for
expansion module information
expansion modules as defined by Allen-Bradley.
Plug-in Module Plug-in Type Module ID Vendor ID Product Type Product Code
2080-IF2 Analog 96 1 10 32
2080-IF4 Analog 98 1 10 33
2080-SERIALISOL Communication 32 1 - -
2080-MOT-HSC Specialty 48 1 43 48
2080-TRIMPOT6 Specialty 72 1 - -
Model number Expansion Type Module ID Vendor ID Product Type Product Code
2085-IF4 Analog - 1 10 208
Use this table to determine the Revision Word information for Allen-Bradley
expansion modules.
15 Max Baud Rate (1:0) These bits identify the maximum frequency for Max Baud Rate (1:0).
00 (bin) is 2 Mbps
14
01 (bin) is 4 Mbps
10 (bin) is 8 Mbps
11 (bin) is 16 Mbps
13 Minor Revision (3:0) Minor Revision (3:0) is the product minor revision designation. This field indicates the
minor revision of the Catalog number designated by the Vendor ID, Product Type,
12 Product Code, Series and Major Revision.
The Minor Revision ranges from 0 to 15.
11
10
9 Major Revision (4:0) Major Revision (4:0) is the product major revision designation. This field indicates the
major revision of the Catalog number designated by the Vendor ID, Product Type,
8 Product Code, and Series.
The Major ranges from 0 to 31.
7
4 Series (4:0) SERIES (4:0) is the product Series designation. This field indicates the Series letter of the
Catalog number designated by the Vendor ID, Product Type, and Product Code.
Series Series Series Series Series Series Series Series
(4:0) (4:0) (4:0) (4:0)
0 A 8 I 16 Q 24 Y
1 B 9 J 17 R 25 Z
2 C 10 K 18 S 26 AA
3 D 11 L 19 T 27 AB
4 E 12 M 20 U 28 AC
5 F 13 N 21 V 29 AD
6 G 14 O 22 W 30 AE
7 H 15 P 23 X 31 >AE
See also
MODULE_INFO instruction The following timing diagram examples describe execution scenarios for the
MODULE_INFO instruction.
timing diagrams
Use this table to help determine the MODULE_INFO parameter values for each
scan cycle.
Use this table to help determine the MODULE_INFO parameter values for each
scan cycle.
Use this table to help determine the MODULE_INFO parameter values for each
scan cycle.
Use this table to help determine the MODULE_INFO parameter values for each
scan cycle.
Use this table to help determine the MODULE_INFO parameter values for each
scan cycle.
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
PLUGIN_WRITE (write Writes a block of data to any Plug-in Generic Module hardware except
2080-MEMBAK-RTC modules.
plugin)
Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
See also
RCP (recipe) Reads the data value of a variable from the recipe data file that resides in the recipe
data file folder in the SD card and updates the value to the run-time engine.
Writes the variable value with the run-time engine to the recipe data file in the SD
card.
Use this table to help determine the parameter values for this instruction.
See also
RTC_READ ( read real-time Reads the real-time clock (RTC) module information.
Use this table to help determine the parameter values for this instruction.
Use this table to help determine the parameter values for the RTC data type.
See also
RTC_SET (set real-time Set RTC (real-time clock) data to the RTC module information.
Text.
Use this table to help determine the parameter values for this instruction.
Use this table to help determine the parameter values for the RTC data type.
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
SYS_INFO data type The following table describes the SYSINFO data type.
MMLoadOnError BOOL Memory Module restore to controller if power up with error (TRUE: Restore).
MMPwdMismatch BOOL Memory Module password mismatch (TRUE: Controller and Memory Module
password mismatch).
FreeRunClock UINT Free running clock that increments every 100 microseconds from 0 to 65535 and
then returns to 0. You can use the Clock, which is globally accessible, if you need
more resolution than the standard 1 millisecond timer.
Only supported for Micro830 and Micro850 controllers. Value for Micro810
controllers remains 0.
See also
Use this table to help determine the parameter values for this instruction.
See also
Trimpot ID definition The following table describes the Trimpot ID definition used in the
TRIMPOT_read instruction.
See also
Interrupt instructions
Use Interrupt instructions to signal the processor that an event needs attention.
Usually the interrupt signal is used for high-priority conditions that require
interruption of the current code the processor is executing.
Function Description
STIS on page 423 Starts the selected timed user interrupt (STI ) timer from the control program rather than
starting automatically.
UIC on page 425 Clears the lost bit for the selected user interrupt.
UID on page 427 Disables a specific user interrupt.
See also
STIS (select timed start) Starts the selectable timed user interrupt (STI ) timer from the control program
rather than starting automatically.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
UIC (clear interrupt lost bit) Clears the lost bit for the selected user interrupt(s).
Use this table to help determine the parameter values for this instruction.
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT := UID(TESTENABLE, 2) ;
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT := UIE(TESTENABLE, 2) ;
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT := UIF(TESTENABLE, 2) ;
Results
See also
Use the motion control instructions to program and design the motion of a
particular axis. Motion control requires Connected Components Workbench 2.0
or higher.
Tips: Administrative instructions support both PTO motion and Feedback motion.
The motion control instructions that support an FBAxis are: MC_ReadActualPosition and
MC_ReadActualVelocity.
Instruction Description
Administrative
MC_AbortTrigger on page 445 Aborts Motion function blocks that are connected to trigger events.
MC_Power on page 470 Control the power stage, ON or OFF.
MC_ReadAxisError on page 484 Reads the axis errors not related to the Motion control instruction blocks.
MC_ReadBoolParameter on page 489 Returns the value of a vendor specific parameter of type BOOL.
MC_ReadParameter on page 493 Returns the value of a vendor specific parameter of type Real.
MC_ReadStatus on page 495 Returns the status of the axis with respect to the motion currently in
progress.
MC_Reset on page 501 Transitions the axis state from ErrorStop to StandStill by resetting all
internal axis-related errors.
MC_SetPosition on page 503 Shifts the coordinate system of an axis by manipulating the actual position.
MC_MoveVelocity on page 466 Commands a never ending controlled motion at a specified velocity.
MC_ReadActualPosition on page 474 Returns the actual position of the feedback axis.
Requires Connected Components Workbench 8 or higher.
MC_ReadActualVelocity on page 479 Returns the actual velocity of the feedback axis.
Requires Connected Components Workbench 8 or higher.
Instruction Description
MC_Stop on page 507 Commands a controlled motion stop and transfers the axis state to
Stopping.
See also
General rules for motion The general rules for the Micro800 motion control function blocks follow the
PLC open Motion control specifications. The following table provides general
control function blocks rules about the interface of motion control function blocks.
Input parameters With Execute: The parameters are used with the rising edge of the execute input. To
modify any parameter, change the input parameter(s) and trigger the motion again.
If an instance of a function block receives a new Execute before it finishes (as a series
of commands on the same instance), the new Execute is ignored, and the previously
issued instruction continues with its execution.
With Enable: The parameters are used with the rising edge of the enable input and
can be modified continuously.
Missing input parameters Missing input is captured during User Application compilation. There is no missing
input error handling at the controller level.
Inputs exceeding application If a function block is commanded with parameters that result in a violation of
limits application limits, the instance of the function block generates an error. In this case,
the Error output is flagged On, and error information is indicated by the output
ErrorID. The controller, in most cases, remains in Run mode, and there is no Motion
Error reported as a major controller fault.
Sign rules for inputs The Acceleration, Deceleration, and Jerk inputs are always positive values. Velocity,
Position and Distance inputs can have positive and negative values.
Position versus Distance Position is a value defined within a coordinate system. Distance is a relative measure
related to technical units. Distance is the difference between two positions.
Position/Distance input Only linear motion is supported on Micro800 controllers. For MC_MoveAbsolute
function block, the position input is the absolute location to be commanded to the
axis. For MC_MoveRelative, the distance input is the relative location (considering
current axis position is 0) from current position.
Velocity input Velocity can be a signed value, but it can also use Direction input to define the sign of
the velocity (negative velocity x negative direction = positive velocity). The E
parameter "Direction" refers to the velocity input and output for compatibility
reasons.
Direction input For distance (position) motion, with the target position (either absolute, or relative)
defined, the motion direction is unique. The direction input for distance move is
ignored.
For velocity motion, direction input value can be 1 (positive direction), 0 (current
direction) or -1 (negative direction). For any other value, only the sign is considered.
For example, -3 denotes negative direction, +2 denotes positive direction, and so on.
For velocity move (MC_MoveVelocity), the sign (velocity x direction) determines the
actual motion direction if the value is not 0. For example, if velocity x direction =
+300, then direction is positive.
Acceleration, Deceleration Deceleration or Acceleration inputs should have a positive value. If Deceleration or
and Jerk inputs Acceleration is set to a non-positive value, the function block reports an error
(Error ID: MC_FB_ERR_RANGE).
Jerk input should have a non-negative value. If Jerk is set to a negative value, the
function block reports an error (Error ID: MC_FB_ERR_RANGE).
If Maximum Jerk is set to zero, all jerk parameters for the motion control function
block, including jerk setting for MC_Stop have to be set to zero. If they are not, the
function block reports an error (Error ID: MC_FB_ERR_RANGE).
If Jerk is set to a non-zero value, S-Curve profile is generated; if Jerk is set to 0,
trapezoidal profile is generated.
Home Jerk configuration is not limited to Max Jerk configuration.
If the motion engine fails to generate the motion profile prescribed by the
dynamic input parameters, the function block reports an error (Error ID:
MC_FB_ERR_PROFILE).
Output exclusivity With Execute: When Execute is TRUE, one of the Busy, Done, Error, or
CommandAborted outputs must also be TRUE. The outputs are mutually exclusive:
only one output on one function block can be TRUE.
Only one of the outputs Active, Error, Done and CommandAborted is set at one time.
With Enable: The Valid and Error outputs are mutually exclusive: only one output on
one function block can be TRUE.
Output status With Execute: The Done, Error, ErrorID and CommandAborted outputs are reset with
the falling edge of Execute instruction. However, the falling edge of Execute does not
stop or influence the execution of the actual function block. Even if Execute is reset
before the function block completes, the corresponding outputs are set for at least
one cycle.
If an instance of a function block receives a new Execute command before it completes
(as a series of commands on the same instance), the new Execute command is
ignored, and the previously issued instruction continues with execution.
With Enable: Valid, Enabled, Busy, Error, and ErrorID outputs are reset with the
falling edge of Enable as soon as possible.
Behavior of Done output The Done output is set when the commanded action has successfully completed.
When multiple function blocks are working on the same axis in a sequence, the
following applies:
When one movement on an axis is interrupted with another movement on the
same axis without having reached the final goal, Done on the first function block
will not be set.
Behavior of Busy output Every function block can have a Busy output, indicating the function block is not
finished (for function blocks with an Execute input) or is not working and new output
values can be expected (in case of Enable input).
Busy is set at the rising edge of Execute and reset when one of the outputs Done,
Aborted, or Error is set. The function block should be kept in the active loop of the
application program for at least as long as Busy is TRUE because the outputs may
change.
Function blocks with the same instance that are busy cannot execute until it is no
longer busy. Function blocks with different instances can abort the currently
executing function block.
Behavior of The CommandAborted output is set when a commanded motion is interrupted by
CommandAborted another motion command.
output The reset behavior of CommandAborted output is similar to Done output. When
CommandAborted occurs, other output signals such as InVelocity are reset.
Output Active The Active output is required on buffered function blocks, and is set at the moment
the function block takes control of the motion of the according axis.
For unbuffered mode, the Active and Busy outputs can have the same value.
Enable and Valid status The Enable input is coupled to a Valid output. Enable is level sensitive, and Valid
shows that a valid set of outputs is available at the function block.
The Valid output is TRUE as long as a valid output value is available and the Enable
input is TRUE. The relevant output value can be refreshed as long as the input Enable
is TRUE.
If there is a function block error, the output is not valid (Valid set to FALSE). When the
error condition disappears, the values reappear and Valid output is set again.
Output error handling Outputs used to define errors
All blocks have the following two outputs that are used for errors that occur during
execution:
Error Rising edge of "Error" informs that an error occurred during the execution
of the function block.
ErrorID Error number.
Done and InVelocity outputs are used for successful completion so they are logically
exclusive to Error.
Instance errors do not always result in an axis error (bringing the axis to ErrorStop).
How the error outputs are reset
Error outputs of the relevant function blocks are reset with the falling edge of
Execute and Enable.
The error outputs of a function block with Enable can be reset during operation
without having to reset Enable.
Types of errors
Function blocks logics (for example, parameters out of range, state machine
violation attempted, and so on)
HW Limit or SW Limit
Mechanism/Motor
Drive
Naming conventions ENUM Due to the naming constraints in the IEC standard on the uniqueness of variable
types names, the 'mc' reference to the PLCopen Motion Control namespace is used for the
ENUMs.
In this way we avoid the conflict that using the ENUM types 'positive' and 'negative'
for instance with variables with these names throughout the rest of the project since
they are called mcPositive and mcNegative respectively.
See also
Motion control function The following topics provide details for motion control parameters that are
relevant to all motion control function blocks.
block parameter details
Motion control axis states The basic rule for the behavior of the axis at a high level when multiple motion
control function blocks are activated is that motion commands are always taken
sequentially, even if the controller has the capability of real parallel processing.
Any motion command is a transition that changes the state of the axis and, as a
consequence, modifies the way the current motion is computed.
The axis is always in one of the defined states as shown in the following diagram.
No Note
1 In the ErrorStop and Stopping states, all function blocks (except MC_Reset), can be called although they will not
be executed.
MC_Reset generates a transition to the Standstill state. If an error occurs while the state machine is in the
Stopping state, a transition to the ErrorStop state is generated.
2 Power.Enable = TRUE and there is an error in the axis.
No Note
3 Power.Enable = TRUE and there is no error in the axis
5 When MC_Power is called with Enable = False, the axis goes to the Disabled state for every state including
ErrorStop.
6 If an error occurs while the state machine is in Stopping state, a transition to the ErrorStop state is generated.
You can monitor the axis state using the Axis Monitor feature. The following table
identifies the values used to define each of the predefined axis states.
0x01 Standstill
0x04 Homing
0x06 Stopping
On motion execution, the axis state update is dependent on when the relevant
motion function block is called by the POU scan. This is the case even though the
motion profile is controlled by the Motion Engine as a background task, and is
independent from the POU scan.
See also
Motion control function block The following function blocks use specific parameter numbers when the function
blocks are programmed.
parameter numbers
MC_ReadParameter
MC_ReadBoolParameter
MC_WriteParameter
MC_WriteBoolParameter
Parameter numbers between 0 and 999 are reserved for standard parameters.
Extensions by a supplier or user are also allowed, although using them can affect
portability between different platforms. If the parameter number is greater than
999, the parameter is supplier-specific.
See also
Motion control function block When a motion control function block ends with an error and the axis state is
ErrorStop, use MC_Reset function block or MC_Power Off/On and MC_Reset
error IDs
to recover the axis. The axis can be reset to normal motion operation without
stopping the controller operation.
Use this table to help determine the errors for the motion control function blocks.
01 MC_FB_ERR_ The function block cannot execute because the axis is not in the correct state. Check
WRONG_STATE the axis state.
02 MC_FB_ERR_ The function block cannot execute because there is invalid axis dynamic parameter(s)
RANGE (velocity, acceleration, deceleration, or jerk) set in the function block.
Correct the setting for the dynamic parameters in the function block against Axis
Dynamics configuration page.
03 MC_FB_ERR_ The function block cannot execute because there is invalid parameter other than
PARAM velocity, acceleration, deceleration, or jerk, set in the function block.
Correct the setting for the parameters (for example, mode or position) for the
function block.
04 MC_FB_ERR_ The function block cannot execute because the axis does not exist, the axis
AXISNUM configuration data is corrupted, or the axis is not correctly configured.
05 MC_FB_ERR_ The function block cannot execute because this axis gets a fault due to drive or
MECHAN mechanical issues. Check the connection between the drive and the controller (Drive
Ready and In-Position signals), and ensure the drive is operating normally.
06 MC_FB_ERR_ The function block cannot execute because the axis is not powered on.
NOPOWER Power on the axis using MC_Power function block.
07 MC_FB_ERR_ The function block cannot execute because the resource required by the function
RESOURCE block is controlled by some other function block or it is not available.
Ensure the resource required by the function block is available for use.
Examples:
MC_Power try to control the same axis.
MC_Stop are executed against the same axis at the same time.
MC_TouchProbe are executed against the same axis at the same time.)
MC_TouchProbe is executed, while touch probe input is not enabled in Motion
Configuration.
08 MC_FB_ERR_ The function block cannot execute because the motion profile defined in the function
PROFILE block cannot be achieved.
Correct the profile in the function block.
09 MC_FB_ERR_ The function block cannot execute because the motion profile requested in the
VELOCITY function block cannot be achieved due to current axis velocity.
Examples:
The function block requests the axis to reverse the direction while the axis is
moving.
The required motion profile cannot be achieved due to current velocity too low or
too high.
Check the motion profile setting in the function block, and correct the profile, or
re-execute the function block when the axis velocity is compatible with the requested
motion profile.
0A MC_FB_ERR_ This function block cannot execute as it will end up moving beyond the Soft Limit, or
SOFT_LIMIT the function block is aborted as the Soft Limit has been reached.
Check the velocity or target position settings in the function block, or adjust Soft
Limit setting.
0B MC_FB_ERR_ This function block is aborted as the Hard Limit switch active state has been detected
HARD_LIMIT during axis movement, or aborted as the Hard Limit switch active state has been
detected before axis movement starts.
Move the axis away from the Hard Limit switch in the opposite direction.
0C MC_FB_ERR_ This function block cannot execute as it will end up moving beyond the PTO
LOG_LIMIT Accumulator logic limit, or the function block is aborted as the PTO Accumulator logic
limit has been reached.
Check the velocity or target position settings for the function block. Or use
MC_SetPosition function block to adjust the axis coordinate system.
0D MC_FB_ERR_ A motion engine execution error is detected during the execution of this function
ERR_ENGINE block.
Power cycle the whole motion setup, including controller, drives and actuators, and
re-download the User Application. If the fault persists, call Tech support.
10 MC_FB_ERR_ The function block cannot execute because the axis need to be homed first.
NOT_HOMED Execute homing against the axis using MC_Home function block.
80 MC_FB_ERR_ Warning: The requested velocity for the axis has been adjusted to a lower value.
PARAM_MODIFIED The function block executes successfully at a lower velocity.
See also
Axis error scenarios In most cases, when a movement function block instruction issued to an axis
results in a function block error, the axis transitions to an Error state, and the
corresponding ErrorID element is set on the AXIS_REF data for the axis.
In the following situations, the axis may not transition to an Error state, and it is
possible for the user application to issue a successful movement function block to
the axis after the axis state changes.
Scenario Example
A movement function block instructs an axis, but the axis is in a state The axis has no power, or the axis is in a Homing
in which the function block cannot be executed properly. sequence, or in an Error Stop state.
A movement function block instructs an axis, but the axis is still The new function block commands the axis to
controlled by another movement function block. The axis cannot allow change motion direction.
the motion to be controlled by the new function block without going
to a full stop.
When one movement function block tries to control an axis, but the User Application issues an S-Curve
axis is still controlled by another movement function block, and the MC_MoveAbsolute function block to an axis
newly-defined motion profile cannot be realized by the controller. with too short a distance given when the axis is
moving.
See also
AXIS_REF data type The AXIS_REF data type is a data structure that contains information for a
motion axis and is used as an input and output variable in all motion control
function blocks. An instance of an AXIS_REF data type is automatically created
when you add a motion axis to the configuration.
Axis_ID AXIS_REF The logic axis ID automatically assigned by Connected Components Workbench. It
cannot be edited or viewed by user.
CommandPos REAL During motion, this is the current position the controller commands the axis to take.
There may be a slight delay between the axis actual position and this CommandPos.
TargetVel REAL The maximum target velocity instructed to the axis for a moving function block. The
value of TargetVel in current function block, or smaller than it, depending on the other
parameters in the same function block.
CommandVel REAL During motion, this element indicates the current velocity the controller instructs the
axis to use.
Note that there may be a slight difference between the axis actual velocity and
CommandVel, due to the drive delay or drive adjustment overshoot.
See also
FB_AXIS_REF data type The FB_AXIS_REF data type is a data structure that contains information for a
Motion Feedback Axis. It is used as an input and output variable in motion
control function blocks. An instance of an FB_AXIS_REF data type is
automatically created when you add a HSC module and the mode is configured as
Feedback Axis mode.
Important: Once a Feedback Axis is flagged with an error, and the error ID is not zero, the FBAxis must be reset using
MC_Reset before issuing any other movement function block.
Axis_ID FB_AXIS_REF The logic axis ID automatically assigned by Connected Components Workbench. It
cannot be edited or viewed by user.
DecelFlag BOOL Indicates whether the Feedback Axis is in an Decelerating movement or not.
AxisState USINT Indicates the current state of the Feedback Axis.
ErrorID UINT Indicates the cause for axis error when error is indicated by ErrorFlag. This error
usually results from motion control function block execution failure.
ExtraData UINT Reserved.
ActualPos REAL Actual mechanical position read back from Motion feedback channel (HSC).
ActualVel REAL Actual mechanical velocity read back from Motion feedback channel (HSC).
See also
Axis variables Axis variables are used to control position, speed, acceleration, and error for a
given motion control axis.
See also
MC_AbortTrigger (motion Aborts Motion function blocks that are connected to trigger events.
control abort trigger) MC_AbortTrigger only executes when assigned to an axis that is controlled by
MC_TouchProbe.
Use this table to help determine the parameter values for this instruction.
Results
See also
MC_Halt (motion control Commands a controlled motion stop under normal operating conditions.
Use this table to help determine the parameter values for this instruction.
Results
See also
MC_Home (motion control Commands the axis to perform the <search home> sequence. The details of this
sequence are manufacturer dependent and can be set by the axis parameters. The
home) Position input is used to set the absolute position when a reference signal is
detected, and the configured Home offset is reached.
Operation details:
After MC_Power is issued, the axis Homed status is reset to 0 (not homed).
In most cases, after the axis is powered on, the MC_Home function block
needs to be executed to calibrate the axis position and the Home reference.
The MC_Home function block can only be aborted using a MC_Stop or a
MC_Power function block. If it is aborted before it completes, the
previously searched Home position is considered invalid and the axis
Homed status is cleared.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type parameters to define AxisIn.
Execute Input BOOL Indicates when to start motion.
TRUE - start the motion at rising edge.
FALSE - do not start motion.
Position Input REAL Absolute position is set when the reference signal is detected and
configured Home offset is reached.
The value range for this input is -0x40000000 0x40000000 physical
pulse after the position is converted from user position unit to PTO
pulse. Set the Position value within the Soft Limit.
An invalid input value results in an error.
Error ID = MC_FB_ERR_PARAM.
HomingMode Input SINT Enum input for Homing mode.
BufferMode Input SINT Not used. The mode is always mcAborting.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Axis Output AXIS_REF Axis output is read-only in Ladder Diagram programs.
Done Output BOOL TRUE - the Homing operation completed successfully and the axis
state is set to StandStill.
FALSE - Homing operation is ongoing or incomplete.
Busy Output BOOL TRUE - the instruction block is not finished.
FALSE - the instruction block is finished.
HomingModes
Use this table to help determine the values for the HomingMode parameter in the
MC_Home motion control instruction.
0x03 MC_HOME_REF_PULSE Homing process by searching limit switch plus using encoder
reference pulse
0x04 MC_HOME_DIRECT Static homing process with direct forcing a home position from user
reference. The function block will set current position the
mechanism is in as home position, with its position determined by
the input parameter, "Position"
Results
See also
Use this table to help determine the parameter values for this instruction.
Acceleration Input REAL Value of the acceleration (always positive - increasing energy to the motor.)
user unit/sec2
Deceleration Input REAL Value of the deceleration (always positive - decreasing energy to the
motor).
u/sec2
Jerk Input REAL Value of the Jerk (always positive).
u/sec3
When the value of the input Jerk = 0, the Trapezoid profile is calculated by
Motion Engine. When Jerk > 0, the S-Curve profile is calculated.
Results
See also
MC_MoveRelative operation
Use this table to help determine the parameter values for this instruction.
Acceleration Input REAL Value of the acceleration (increasing energy of the motor) [u/s2]
Deceleration Input REAL Value of the deceleration (decreasing energy of the motor) [u/s2]
Jerk Input REAL Value of the Jerk [u/s3]
BufferMode Input SINT This parameter is not used.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Axis Output AXIS_REF Axis output is read-only in Ladder Diagram programs.
Results
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
If you import a project created in CCW 7 into CCW 8, the Mc_Power new
input parameter, __DTI_AxisIn shows. If a Build error occurs, reselect the
instruction and rebuild.
After axis power On completes, the axis Homed status is reset to 0 (not
homed).
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type parameters to define AxisIn.
FB_AXIS_REF For an FB_Axis (feedback axis), use the FB_AXIS_REF data type to
define AxisIn.
Enable Input BOOL TRUE - power is ON.
FALSE - power is OFF
Enable_Positive Input BOOL TRUE - motion is allowed in the positive direction.
Enable_Negative Input BOOL TRUE - motion is allowed in the negative direction.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Axis Output AXIS_REF Axis output is read-only in Ladder Diagram programs.
AXIS_REF data type.
Status Output BOOL State of the power stage:
TRUE - drive power on is done.
FALSE - drive power on is not done.
Busy Output BOOL TRUE - the instruction block is not finished.
FALSE - the instruction block is finished.
Active Output BOOL TRUE - indicates the function block has control on the axis.
Error Output BOOL Indicates an error occurred.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for this
instruction are defined in Motion control function block error IDs.
Results
See also
MC_ReadActualPosition Returns the actual position of the feedback axis. MC_ReadActualPosition is only
applicable to feedback motion.
(motion control read actual
position) Operation details:
Use this table to help determine the parameter values for this instruction.
Position Output REAL The value of the actual absolute position for feedback motion
Axis. (in axis unit [u])
Results
See also
MC_ReadActualVelocity Returns the value of the actual velocity of the feedback axis.
Standstill
Discrete Motion
Error Stop
Use this table to help determine the parameter values for this instruction.
ActualVelocity Output REAL The value of the actual velocity for the feedback motion axis (in axis
unit [u/s]).
ActualVelocity is a signed value, which includes direction
information.
Results
See also
MC_ReadAxisError (motion Reads the axis errors not related to the Motion control instruction blocks.
control read axis error) When an axis is in a Disabled state, MC_ReadAxisError may or may not get a
non-zero Error ID for the axis because a Disabled axis can contain errors or be
error-free.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type parameters to define AxisIn.
FB_AXIS_REF For an FB_Axis (feedback axis), use the FB_AXIS_REF data type to
define AxisIn.
Enable Input BOOL TRUE - get the value of the parameter continuously while enabled.
FALSE - resets Error, ErrorID, and AxisErrorID outputs to 0.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Axis Output AXIS_REF Axis output is read-only in Ladder Diagram programs.
The Axis output parameters are defined in the FB_AXIS_REF data type.
Valid Output BOOL TRUE - the instruction block is active and new output values are
expected.
FALSE - the instruction block is inactive.
Busy Output BOOL TRUE - the instruction block is not finished.
FALSE - the instruction block is finished.
Error Output BOOL Indicates an error occurred.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for this
instruction are defined in Motion control function block error IDs.
AxisErrorID Output UINT A unique numeric that identifies the axis error. The errors for this
instruction are defined in AxisErrorID error codes.
Results
See also
AxisErrorID error codes The following table describes the Axis error codes identified in the AxisErrorID
for MC_ReadAxisError.
01 MC_FB_ERR_ The axis is not operational because an incorrect axis state was detected during a
WRONG_STATE function block execution.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
02 MC_FB_ERR_ The axis is not operational because an invalid axis dynamic parameter (velocity,
RANGE acceleration, deceleration, or jerk) is set in a function block.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
In the function block, correct any setting for the dynamic parameters that
conflict with the settings on the Axis Dynamics configuration page.
03 MC_FB_ERR_ The axis is not operational because an invalid parameter, (other than velocity,
PARAM acceleration, deceleration, or jerk), is set in a function block.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
In the function block, correct the settings for the parameters, such as mode or
position.
05 MC_FB_ERR_ The axis is not operational because a drive or mechanical issue was detected.
MECHAN Check the connection between the drive and the controller (Drive Ready and
In-Position signals), and ensure the drive is operating normally.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
07 MC_FB_ERR_ The axis is not operational because it or its related resources required by a
RESOURCE function block are under the control of other function block, or not available.
Ensure the axis or its related resources required by the function block are
available for use.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
Review and correct the application if there are multiple instances of the same
function block trying to control the axis at the same time.
08 MC_FB_ERR_ The axis is not operational because the motion profile defined in a function
PROFILE block is invalid.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
Correct the profile in the function block.
09 MC_FB_ERR_ The axis is not operational because the motion profile requested in a function
VELOCITY block conflicts with the current axis velocity.
Possible causes:
The function block requests the axis to reverse the direction while the axis is
moving.
The current velocity is too low or too high for the requested motion profile.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
Correct the motion profile in the function block, or re-execute the function block
when the axis velocity is compatible with the requested motion profile.
10 MC_FB_ERR_ The axis is not operational because a Soft Limit error was detected, or executing
SOFT_LIMIT the function block would cause a Soft Limit error.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
Check the velocity or target position settings for the function block, or adjust
Soft Limit setting.
11 MC_FB_ERR_ The axis is not operational because a Hard Limit error was detected.
HARD_LIMIT Reset the state of the axis using the MC_Reset function block, and then move
the axis away from the Hard Limit switch in the opposite direction.
12 MC_FB_ERR_ The axis is not operational because a PTO Accumulator logic limit error was
LOG_LIMIT detected, or executing the function block would cause a PTO Accumulator logic
limit error.
Reset the state of the axis using the MC_Power and MC_Reset function blocks.
Check the velocity or target position settings for the function block. Use the
MC_SetPosition function block to adjust the axis coordinate system.
13 MC_FB_ERR_ The axis is not operational because a motion engine execution error was
ERR_ENGINE detected.
Power cycle the entire machine and download the User Application to the
controller again.
If the fault persists, contact your local Rockwell Automation technical support
representative. For contact information, see:
http://www.rockwellautomation.com/support .
16 MC_FB_ERR_ The axis is not operational because the axis is not homed.
NOT_HOMED Reset the state of the axis using the MC_Power and MC_Reset function blocks.
Execute homing against the axis using MC_Home function block.
128 MC_FB_ERR_ Motion internal warning, Warning ID = 0x80.
PARAM_MODIFIED Contact your local Rockwell Automation technical support representative. For
contact information, see:
http://www.rockwellautomation.com/support .
See also
(motion control read BOOL Languages supported: Function Block Diagram, Ladder Diagram, Structured
parameter) Text.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define AxisIn.
FB_AXIS_REF For FB_Axis (feedback axis), use the FB_AXIS_REF data type to
define AxisIn.
Enable Input BOOL TRUE - get the value of the parameter continuously while enabled.
FALSE - the Value output is reset to 0.
ParameterNumber Input DINT Parameter identification.
Parameter numbers definitions are defined in Motion control
function block parameter numbers.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Axis Output AXIS_REF Axis output is read-only in Ladder Diagram programs.
Valid Output BOOL TRUE - the value of the Parameter is available.
FALSE - the Parameter value is unavailable.
Busy Output BOOL TRUE - the function block is working and new output values are
expected.
FALSE - the function is idle.
Value Output BOOL Value of the specified parameter in the data type, as specified by
the vendor.
Results
See also
MC_ReadParameter Returns the value of a vendor specific parameter in a Real data type.
(motion control read Languages supported: Function Block Diagram, Ladder Diagram, Structured
parameter) Text.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define AxisIn.
FB_AXIS_REF For FB_Axis (feedback axis), use the FB_AXIS_REF data type to
define AxisIn.
Enable Input BOOL TRUE - get the value of the parameter number continuously.
FALSE - the Value output is reset to 0.
ParameterNumber Input DINT Parameter identification.
Parameter numbers definitions are defined in Motion control
function block parameter numbers.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Axis Output AXIS_REF Axis output is read-only in Ladder Diagram programs.
Valid Output BOOL TRUE - valid outputs are available.
FALSE - valid outputs are unavailable.
Busy Output BOOL TRUE - the function block is working and new output values are
expected.
FALSE - the function block is idle.
Results
See also
MC_ReadStatus (motion Returns the status of the axis with respect to the motion currently in progress.
control read status) Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
Results
See also
MC_Reset (motion control Transitions the axis state from ErrorStop to StandStill by resetting all internal
axis-related errors. The outputs of the function block instances are not changed.
reset)
Operation details:
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define AxisIn.
FB_AXIS_REF For FB_Axis (feedback axis), use the FB_AXIS_REF data type to define
AxisIn.
Execute Input BOOL TRUE - resets the axis to the rising edge.
Results
See also
MC_SetPosition (motion Shifts the coordinate system of an axis by manipulating the actual position of an
axis with the same value without causing any movement.
control set position)
Operation details:
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define AxisIn.
FB_AXIS_REF For FB_Axis (feedback axis), use the FB_AXIS_REF data type
to define AxisIn.
Results
See also
MC_Stop (motion control Commands a controlled motion stop and transfers the axis state to Stopping. Any
ongoing function block execution is aborted. All function block move commands
stop) are ignored until the axis state transitions to StandStill.
Operation details:
As long as the Execute input is high, the axis remains in the Stopping state.
While the axis is in the Stopping state, other motion function blocks cannot
perform any motion on the same axis.
If Deceleration equals zero, the MC_Stop parameters are determined by the
Axis configuration Emergency Stop setting, including E-Stop type, E-stop
Deceleration and E-stop Jerk.
When there are no errors detected during the stop sequence, the axis state
transitions to StandStill after the Done bit is SET and the Execute input
changes to False.
Use MC_Stop for emergency stop functionality or exception situations.
Use MC_Halt for normal motion stops.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define the parameters for
AxisIn.
Execute Input BOOL TRUE - starts the action at the rising edge.
FALSE - not executing.
Deceleration Input REAL Value of the deceleration [u/s2].
Results
See also
If the window direction (first position --> last position) is in the opposite
direction of the motion direction, the touch probe window does not
activate.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define the parameters for AxisIn.
FB_AXIS_REF For a feedback axis, use the FB_AXIS_REF data type to define the
parameters for AxisIn.
TriggerInp Input USINT Only embedded motion supported.
Execute Input BOOL TRUE - starts touch probe recording at the rising edge.
FALSE - not executing.
LastPosition Input REAL Stop position of the window from where trigger events are not
accepted (in technical units [u]). Value included in window.
ENO Output BOOL Enable output.
Applies only to Ladder Diagram programs.
Results
See also
(motion control write BOOL The parameters set by the MC_WriteBoolParameter function block are only
parameter) applied to the application temporarily. They are overwritten by the permanent
settings, which are configured by the user in Connected Components Workbench
Motion Configuration, when the controller is switched from PRG to RUN mode,
or when the power to the controller is cycled OFF and ON.
Use this table to help determine the parameter values for this instruction.
Results
See also
(motion control write The parameters set by the MC_WriteParameter function block are only applied
parameter) to the application temporarily. They are overwritten by the permanent settings,
which are configured by the user in Connected Components Workbench Motion
Configuration, when the controller is switched from PRG to RUN, or when the
controller power is cycled OFF and ON.
Use this table to help determine the parameter values for this instruction.
AxisIn Input AXIS_REF Use the AXIS_REF data type to define the parameters for
FB_AXIS_REF AxisIn.
For a feedback axis, use the FB_AXIS_REF data type to
define the parameters for AxisIn.
Execute Input BOOL TRUE - writes the value of the parameter at the rising edge.
Busy Output BOOL TRUE - indicates the function block has control of the axis.
Error Output BOOL Indicates an error occurred.
TRUE - An error is detected.
FALSE - No error.
ErrorID Output UINT A unique numeric that identifies the error. The errors for
this instruction are defined in Motion control function
block error IDs.
Results
See also
Use Process control instructions to monitor and maintain process loops for
quantities such as pressure, temperature, flow rate, and fluid level. Process controls
regulate the course by sending an output signal to the control valve.
Instruction Description
DERIVATE on page 523 Differentiates a real value over a defined cycle time.
FFL on page 525 Loads 8 bit, 16 bit, 32 bit, or 64 bit data into a user-created array called a FIFO
stack.
FFU on page 535 Unloads 8 bit, 16 bit, 32 bit, or 64 bit data from a user-created array called a
FIFO stack. The data unloads in the same order as loaded using the FFL
instruction.
HYSTER on page 541 Performs aBoolean hysteresis on difference of reals.
INTEGRAL on page 543 Integrates a real value during the defined cycle time.
PWM on page 549 Turns the pulse width modulation (PWM) output for a configured PWM channel
ON or OFF.
SCALER on page 552 Scales the input value according to the output range.
STACKINT on page 555 Manages a stack of integer values.
LIMIT on page 560 Restricts integer values to a given interval.
TND on page 558 Stops the current cycle of the user program scan.
See also
Operation details:
If the CYCLE parameter value is less than the cycle timing of the execution
of the device, the sampling period is forced to this cycle timing.
The derivation is performed with a time base of milliseconds.For example,
the derivation of an input of 1000 that changes to 2000 over a time period
of 1 second results in a value of 1. To convert the output of the instruction
to units of seconds, multiply the output by 1000.
Use this table to help determine the parameter values for this instruction.
See also
Loads 8 bit, 16 bit, 32 bit, or 64 bit data into a user-created array called a FIFO
FFL (FIFO load)
stack.
Operation details:
Use this table to help determine the parameter values for this instruction.
Use this table to help determine the parameter values for the FF_LF_CON data
type.
Length UINT Number of elements used for FIFO operation. Maximum limit is 1024.
Position USINT Determines the next available location in the FIFO for the Src entry or removal. Position is the
offset of the array.
Example 1:
User configured array, arr[0..5]. Initial position is configured as 1. Data is pushed into
arr[1] and position increments by position + 1.
Example 2:
User configured array as arr[1..5]. Initial position is configured as 1. Data is pushed into
arr[2] and position increments by position + 1.
Use this table to determine the FFL and FFU error codes and descriptions.
0 No error.
4 Src and Dest data type mismatch with the FIFO data type.
Corrective Action:
FFL Src parameter and FFU Dest parameter data type should match with the FIFO array data type.
5 FIFO - Array dimension is not supported.
Corrective Action:
FIFO only supports single dimension Arrays.
6 FIFOCon control Length exceeds FIFO array size.
Corrective Action:
FIFOCon control Length cannot exceed the FIFO array size.
7 FIFOCon Length exceeds the max length.
Results
See also
FFL and FFU instruction timing The following timing diagram examples describe execution scenarios for the FFL
(FIFO load) and FFU (FIFO unload) instructions.
diagrams
Use this table to help determine the parameter values for each scan cycle.
Use this table to help determine the parameter values for each scan cycle.
Use this table to help determine the parameter values for each scan cycle.
Use this table to help determine the parameter values for each scan cycle.
See also
FFU (FIFO unload) Unloads 8 bit, 16 bit, 32 bit, or 64 bit data from a user-created array called a FIFO
(first in first out) stack in the same order data was loaded using the FFL
instruction.
Operation details:
Use this table to help determine the parameter values for this instruction.
FIFO Input ANY_ELEMENTARY The starting address of the stack. FIFO must be configured the
same in the FFL and FFU instructions.
Elementary data types supported for FIFO:
DWORD, REAL, TIME, DATE, LWORD, ULINT, LINT, LREAL,
BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT.
String is not supported.
Only single dimension is supported for FIFO.
FIFOCon Input FF_LF_CON FIFO configuration and control. The same configuration must be
configured for FFL and FFU instructions.
Use the FF_LF_CON data type to configure Position and Length.
Done Output BOOL Indicates when the FFU operation is complete.
TRUE - Operation completed successfully.
FALSE - Operation encountered an error condition or the FFU
instruction is not executing.
Full Output BOOL Indicates when the FIFO stack is full.
TRUE - When Length is equal to Position.
FALSE - When Position is greater than zero and less than
Length.
Empty Output BOOL Indicates when the FIFO stack is empty.
TRUE - When Position equals 0.
FALSE - When Position is not equal to 0.
Error Output BOOL Indicates the existence of an error condition.
TRUE - Operation encountered an Error.
FALSE - Operation completed successfully or the instruction is
not executing.
ErrorID Output USINT A unique numeric that identifies the error. The errors are
defined in FFU error codes.
Use this table to help determine the parameter values for the FF_LF_CON data
type.
Length UINT Number of elements used for FIFO operation. Maximum limit is 1024.
Position USINT Determines the next available location in the FIFO for the Src entry or removal. Position is the
offset of the array.
Example 1:
User configured array, arr[0..5]. Initial position is configured as 1. Data is pushed into
arr[1] and position increments by position + 1.
Example 2:
User configured array as arr[1..5]. Initial position is configured as 1. Data is pushed into
arr[2] and position increments by position + 1.
Use this table to determine the FFL and FFU error codes and descriptions.
0 No error.
4 Src and Dest data type mismatch with the FIFO data type.
Corrective Action:
FFL Src parameter and FFU Dest parameter data type should match with the FIFO array data type.
5 FIFO - Array dimension is not supported.
Corrective Action:
FIFO only supports single dimension Arrays.
6 FIFOCon control Length exceeds FIFO array size.
Corrective Action:
FIFOCon control Length cannot exceed the FIFO array size.
7 FIFOCon Length exceeds the max length.
0 No error.
4 Src and Dest data type mismatch with the FIFO data type.
Corrective Action:
FFL Src parameter and FFU Dest parameter data type should match with the FIFO array data type.
5 FIFO - Array dimension is not supported.
Corrective Action:
FIFO only supports single dimension Arrays.
6 FIFOCon control Length exceeds FIFO array size.
Corrective Action:
FIFOCon control Length cannot exceed the FIFO array size.
12 FFL or FFU array dimension is not supported.
Corrective Acton:
FFL and FFU only support single dimension arrays.
13 FFL or FFU DestOffset exceeds Dest array size.
Results
See also
HYSTER (hysteresis) Boolean hysteresis on difference of reals. Compares the current value of an input
with the high limit established by adding the historical amount of lag as measured
by hysteresis to the expected value for an input and assessing whether the current
value exceeds that limit.
Use this table to help determine the parameter values for this instruction.
In the following diagram HYSTER is used to assess the performance lag due to
motor friction over a 5 second time period. The instruction is run every 10
milliseconds. During the startup phase the motor was operating less efficiently.
See also
Operation details:
When the INTEGRAL function block is first initialized, its initial values
are not considered. Use the R1 parameter to set the initial values for a
calculation.
To prevent loss of the integrated value, the integration value is not cleared
automatically when the controller transitions from PROGRAM to RUN or
when the RUN parameter transitions from FALSE to TRUE. Use the R1
parameter to clear the integral value when first transitioning the controller
from PROGRAM to RUN mode and when starting a new integration.
It is recommended that the optional EN or ENO parameters are not used
with this function block because the cycle time calculation becomes
disrupted when EN is FALSE, resulting in an incorrect integration. If the
EN or ENO parameters are used, toggle the R1 parameter with EN equal to
TRUE to clear the current result and ensure correct integration.
Integration is performed with a time base of milliseconds (that is,
integrating an input of 1 with an initial value of 0 for 1 second results in a
value of 1000). To convert the output of the instruction to units of seconds,
divide the output by 1000.
If the CYCLE parameter value is less than the cycle timing of the execution
of the device, the sampling period is forced to the cycle timing.
XIN sampling and function block executions occur every cycle time + Scan
Time Jitter.
For a given user program, Scan Time Jitter varies from controller to
controller.
The cycle time determines the sensitivity of the Integral function block.
Changes occurring in XIN between two samplings (or within the cycle
time) are not taken into account when the integral XOUT value is
calculated.
Cycle time and Scan Time Jitter both contribute to the overall inaccuracy of
Integral output as shown in the XIN in sync with the function block
execution example and the XIN not in sync with function block execution
example.
Use this table to help determine the parameter values for this instruction.
Results
The following images show the effect of Scan Time Jitter on the XOUT value:
See also
Turns the PWM (Pulse Width Modulation) output for a configured PWM
PWM (Pulse Width
channel ON or OFF.
Modulation)
This instruction block is used with Micro820 2080-LC20-20QBB controllers and
supports one PWM channel using the embedded output channel 6.
Use this table to help determine the parameter values for this instruction.
See also
SCALER (scale) Scales the input value according to the output range.
Use this table to help determine the parameter values for this instruction.
Results
See also
Operation details:
STACKINT includes a rising edge detection for both PUSH and POP
commands. The maximum size of the stack is 128. The OFLO value is valid
only after a reset (R1 has been set to TRUE at least once and back to
FALSE).
The application defined stack size (N) cannot be less than 1 or greater than
128.
If N < 1, STACKINT assumes a size of 1.
If N > 128, STACKINT assumes a size of 128.
Use this table to help determine the parameter values for this instruction.
PUSH Input BOOL TRUE - Rising edge detected, on PUSH command. Adds the IN
value on the top of the stack.
FALSE - Rising edge not detected on PUSH command.
POP Input BOOL TRUE - Rising edge detected, on PUSH command. Deletes the
last value pushed to the top of the stack.
FALSE - Rising edge not detected on POP command.
R1 Input BOOL TRUE - Resets the stack to its empty state.
FALSE - No reset.
IN Input DINT Pushed value.
N Input DINT Application defined stack size.The maximum size of the stack
is 128
EMPTY Output BOOL TRUE - the stack is empty.
FALSE - the stack contains values.
OFLO Output BOOL TRUE - Overflow, the stack is full and R1 has been set to TRUE
at least once and back to FALSE.
FALSE - the stack size is 128 or less. No overflow.
OUT Output DINT Value at the top of the stack.
OUT equals 0 when OFLO is TRUE.
Results
See also
TND (abort current Stops the current cycle of a user program scan. After the output scan, input scan,
and housekeeping are complete, re-executes the user program from the start of the
program) first routine.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
TESTOUTPUT := TND(TESTENABLE) ;
Results
See also
LIMIT (limit test) Restricts integer values to a given interval. Integer values between the minimum
and maximum are unchanged. Integer values greater than the maximum are
replaced with the maximum value. Integer values less than the minimum are
replaced with the minimum value.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Instruction Description
See also
SUS (suspend) Suspends the execution of the controller. The controller remains in RUN mode
but execution is suspended indefinitely. Suspend catches User Program errors and
aids in User Program monitoring. Place the SUS instruction in User Program
sections where you want to trap unusual conditions. In suspend mode, RUN LED
is set to OFF to indicate the program scan is Idle.
Use this table to help determine the parameter values for this instruction.
Results
See also
Instruction Description
IPIDCONTROLLER on page 565 Configure and control the inputs and outputs used for the Proportional
Integral Derivative (PID) logic.
PID on page 592 Configure and control the outputs that control physical properties such as
temperature, pressure, liquid level, or flow rate using process loops.
See also
See also
IPIDCONTROLLER Configure and control the inputs and outputs used for
proportional-integral-derivative (PID) logic. PID logic is used to control physical
(proportionalintegralder properties such as temperature, pressure, liquid, level, or flow rate by using process
ivative controller) loops that calculate an error value as the difference between a desired setpoint and
a measured process variable. The controller attempts to minimize the error over
time by adjustment of a control variable. The calculation includes proportional
(P), integral (I), and derivative (D) terms, which are used as follows:
- D - possible future values of the error, based on its current rate of change, which
controls physical properties such as temperature, pressure, liquid level, or flow rate
using process loops.
Use this table to help determine the parameter values for this instruction.
ATWarnings Output DINT (ATWarning) Warning for the Auto Tune sequence. Possible values
are:
0 - no auto tune done.
1 - in auto tune mode.
2 - auto tune done.
-1 - ERROR 1 input automatically set to TRUE, no auto tune
possible.
-2 - ERROR 2 auto tune error, ATDynaSet expired.
OutGains Output GAIN_PID Gains calculated after AutoTune sequences.
Use the GAIN_PID data type to define the OutGains output.
ENO Output BOOL Enable output.
Applies to Ladder Diagram programs.
IPIDController1(Proc,
SP,
FBK,
Auto,
Init,
G_In,
A_Tune,
A_TunePar,
Err );
Out_process := IPIDController1.Output ;
A_Tune_Warn := IPIDController1.ATWarning ;
Gain_Out := IPIDController1.OutGains ;
Results
See also
GAIN_PID data type The following table describes the GAIN_PID data type for the
IPIDCONTROLLER instruction.
See also
AT_Param data type The following table describes the AT_Param data type parameters.
See also
How the IPIDController function The IPIDController function block, available in the Connected Components
Workbench instruction set, is based on PID control theory and combines all of
block implements PID control
the necessary logic to perform analog input channel processing and proportional
integral-derivative (PID) control. In the HMI, the IPID faceplate is available for
use with the IPIDController function block.
A: Acting (+/- 1)
PG: Proportional Gain
DG: Derivative Gain
td: D
ti: I
If the difference between the setpoint value and the process value is great, the
output value increases significantly, and during the time it takes to decrease, the
process is not in control. The IPIDController function block interactively tracks
feedback and prevents integral windup. When the output is saturated, the integral
term in the controller is recomputed so that its new value provides an output at
the saturation limit.
See also
IPIDController function block When Input Auto is TRUE, the IPIDController runs in normal auto mode.
operation
When Input Auto is FALSE, it causes reset R to track (F-GE) forcing the
IPIDController Output to track the Feedback within the IPIDController limits
at which time the controller switches back to auto without incrementing the
Output.
For Input Initialize, changing from FALSE to TRUE or TRUE to FALSE when
AutoTune is FALSE causes the IPIDController to eliminate any proportional
gain action during that cycle (for example, Initialize). Use this process to prevent
bumping the Output when changes are made to the SetPoint using a switch
function block.
To finalize the tuning, some fine tuning may be needed depending on the
processes and needs. When setting TimeDerivative to 0.0, the IPIDController
forces DerivativeGain to 1.0 then works as a PI controller.
See also
Use the Proportional Integral This section provides specific details and examples for using the proportional
integral derivative instruction, including the following:
Derivative instruction
Example: How to create a feedback loop for the manipulated value
Adding a feedback loop for the manipulated value prevents excessive overshooting
by providing a minimum and maximum value for the MV.
At the beginning of the temperature control process, the difference between the
process value (PV) and the setpoint value (SP) is large, as shown in the following
graph. In this example of a temperature feedback loop, the PV starts at 0 degrees
Celsius and moves towards the SP value of 40 degrees Celsius. Notice also that the
fluctuation between the high and low manipulated value (MV) decreases and
stabilizes with time. The behavior of the MV depends on the values used in each of
the P, I, and D parameters.
The following function block diagram includes a feedback loop for the
manipulated value that prevents excessive overshooting by providing a minimum
and maximum value for the MV.
Autotuning must cause the output of the control loop to oscillate, which
means the IPIDController must be called frequently enough to adequately
sample the oscillation.
The IPIDController instruction block must be executed at a relatively
constant time interval.
Configure the scan time of the program to be than half of the oscillation
period.
Consider using a Structured Text Interrupt (STI) instruction block to
control the IPIDController instruction block.
Add UDFBs outside the main program to perform specialized functions such as
converting units or transferring values.
This UDFB converts a manipulated value (MV) to a digital output (DO) so it can
be used to control a digital input n(DI).
See also
Use auto-tune with the Use the AutoTune parameter of the IPIDController function block to implement
IPIDController function block auto-tuning in the control program.
Autotuning must cause the output of the control loop to oscillate, which
means the IPIDController must be called frequently enough to adequately
sample the oscillation.
The IPIDController instruction block must be executed at a relatively
constant time interval.
Configure the scan time of the program to be than half of the oscillation
period.
Consider using a Structured Text Interrupt (STI) instruction block to
control the IPIDController instruction block.
See also
Auto-tune in first and second order Use auto-tune in first order system, which uses a single element, or in a second
systems order system, which uses two independent elements.
A first order system uses a single independent energy storage element. Examples
include:
In a first order system, the function may be written in a standard form such as f(t)
= dy/dt + y(t)
Where:
Variable Description Example: Cooling of a fluid tank using heat energy as the storage
element
t System time constant Is equal to RC
Where
R = Thermal resistance of the walls of the tank
C = Thermal capacitance of the fluid
f Forcing function Is the Ambient temperature
y System state variable Is the Fluid temperature
A second order system uses two independent energy storage elements that
exchange stored energy. Examples include:
A motor driving a disk flywheel with the motor coupled to the flywheel via a
shaft with torsional stiffness; Rotational kinetic energy and torsion spring
energy are the storage units.
An electric circuit composed of a current source driving a series LR
(inductor and resistor) with a shunt C (capacitor); Inductive energy and
capacitive energy are the storage units.
Motor driven systems and heating systems can typically be modeled by the LR and
the C electric circuit.
See also
Configure auto-tuning Use these general steps when implementing auto-tuning using the
IPIDController function.
4 Set Auto-Tune parameters. Set auto-tune parameters including an initial load value, step change for the
output, an estimated time to complete the auto tuning, and the auto-tune reset.
6 Notice the Output changes to the value of Load when you set AutoTune to True.
11 Controller starts
auto-tuning. Wait for
ATWarning to become 2.
See also
Use a Structured Timing Interrupt Although a PID instruction works if it is not controlled by a Structured Timing
(STI) with auto-tuning Interrupt (STI), using an STI increases the auto-tune success rate because the
auto-tune operates on a fixed cycle.
See also
The following example program shows the variables used to configure the
parameters for auto-tuning.
Auto-tune parameters
The following table describes the variables that are used with each parameter in
the example to configure auto-tuning.
Input parameters
Variable Parameter Description
AutoMode Auto The operation mode of the PID controller:
TRUE - controller runs in normal mode.
FALSE derivative term is ignored forcing the controller output to
track the feedback within the controller limits, and allowing the
controller to switch back to auto without bumping the output.
Input parameters
ATParameters
Load Initial output value during auto-tuning.
Allows the process value to stabilize at the load
Deviation The standard deviation for a series of stabilized process values. For example, if the
process value stabilized between 31.4 to 32.0, then the deviation value would be
(32.0-31.4)/2 = 0.3.
Some process values, such as temperature, take a very long time to stabilize.
Step The auto-tune process considers how the process value reacts to the changes in step
value and derives the Gain parameters.
ATDynaSet Allocated time for the auto-tune to complete. It must be longer than what is required
for the auto-tune process.
A common value for many systems is 600 seconds, but some systems may require more
time.
ATReset If TRUE, the output will be reset to "0" after auto-tune completes.
If FALSE, the output will remain at the load value after auto-tune completes.
Output parameters
Parameter Description
AbsoluteError Absolute error (Process SetPoint) from the controller.
ATWarning Warning for the Auto Tune sequence. Possible values are:
0 - no auto tune done.
1 - in auto tune mode.
2 - auto tune done.
-1 - ERROR 1 input automatically set to TRUE, no auto tune possible.
-2 - ERROR 2 auto tune error, ATDynaSet expired
OutGains Gains calculated after AutoTune sequences.
See also
Example: How to create a feedback Adding a feedback loop for the manipulated value prevents excessive overshooting
loop for the manipulated value by providing a minimum and maximum value for the MV.
At the beginning of the temperature control process, the difference between the
process value (PV) and the setpoint value (SP) is large, as shown in the following
graph. In this example of a temperature feedback loop, the PV starts at 0 degrees
Celsius and moves towards the SP value of 40 degrees Celsius. Notice also that the
fluctuation between the high and low manipulated value (MV) decreases and
stabilizes with time. The behavior of the MV depends on the values used in each of
the P, I, and D parameters.
The following function block diagram includes a feedback loop for the
manipulated value that prevents excessive overshooting by providing a minimum
and maximum value for the MV.
See also
Example: How to add a UDFB to a PID For PID programs, use user-defined function blocks (UDFB) outside the main
program program to perform specialized functions such as converting units or transferring
values. The following are examples of UDFBs.
This UDFB converts a manipulated value (MV) to a digital output (DO) so it can
be used to control a digital input n(DI).
See also
Example: How to create an The temperature control program maintains the temperature within the control
IPIDController program to control zone.
temperature
Setpoint, process and manipulated values
The following table defines the SP, PV, and MV values used in the temperature
control program.
Item Description
Setpoint (SP) Measurement of temperature in degrees Celsius that defines the temperature for the
control zone.
Process value (PV) Must be converted to the same unit as the SP, which is a measurement of degrees Celsius.
Manipulated value (MV) Must be converted to an analog value so it can be output to the PWM to control the heating
element.
The following diagram and table define the components in the temperature
control system that are controlled by the temperature control program the events
that occur when the control program runs.
The following table identifies the components in the temperature control system
and describes the sequence of events that occurs in the system when the
temperature control program runs.
No Item Description
Controller output Sends the MV to the PWM (On/Off).
Pulse Width Modulation (PWM Solid state relay that controls the heating element.
temperature controller
Heating element Increases temperature in the control zone.
Resistance temperature detector Measures the temperature in the control zone and sends the PV (RTD
(RTD) signal) to the controller input.
Controller input Receives the PV (RTD signal).
No Item Description
PLC program Converts the PV (RTD signal) to the same unit as the SP (degrees Celsius)
and determines the difference between the PV and the SP and adjusts the
MV according to the parameter values defined in the P, I and D
parameters.
This function block diagram shows the predefined and user-defined function
blocks used in the application to control temperature in a control zone.
See also
Example: How to create an The water supply level control program example maintains sufficient water in a
IPIDController program to control water supply tank that has an outflow. A solenoid valve controls incoming water
water supply level and fills the tank at a preset rate; outflowing water is also controlled at a preset
rate.
The water supply level program example includes the following information.
The following table defines how the SP, PV, and MV values are used in the water
supply level program.
Item Description
Setpoint (SP) Measurement of height that defines the target water supply level.
Process value (PV) The 4-20mA must be converted to the same unit as the SP, which is a measurement of
height.
Manipulated value (MV) Must be converted to an analog value so it can be output to the drive to control the
pump.
The following diagram shows the components in the water supply level system
that are controlled by the water supply level program. The table following the
diagram describes the events that occur when the control program runs.
The following table identifies the components in the water supply system and
describes, in sequence, the events that occur in the system when the water supply
level program runs.
No Item Description
Controller Sends the MV to the PowerFlex drive (0-10V).
output
No Item Description
PowerFlex drive Controls the water pump (0-50Hz).
Output transfer Measures the height of the water supply level (4-20mA) and sends the PV to the controller.
device
Controller input Receives the PV (water supply level of 4-20mA).
PLC program Converts the PV to the same unit as the SP (measurement of height) and determines the
difference between the PV and SP and adjusts the MV according to the parameter values
defined in the P, I and D parameters.
The following function block diagram shows the predefined and user-defined
function blocks for the program to control the water supply level.
This application, developed in the Function Block Diagram (FBD) language, uses
the instructions described in the following table.
See also
When enabled, PID controls the process using the input parameters
including SP and Gains of the PID controller.
Run to Program mode transition, the PID instruction is disabled, parameter
values are retained.
Program to Run mode transition, the PID instruction remains disabled
until a user resets Enable to true.
Use this table to help determine the parameter values for this instruction.
The following table describes the PID_GAINS data type for the PID instruction.
Use this table to determine the PID error codes and descriptions.
1 Kc is invalid.
2 Ti is invalid.
3 Td is invalid.
4 FC is invalid.
PID Results
See also
PID instruction state machine The PID State Machine diagram describes the processing states for the PID
instruction.
See also
PID instruction timing diagrams The following timing diagram examples describe execution scenarios for the PID
(proportional-integral-derivative) instruction.
Use this table to help determine the parameter values for each scan cycle.
Use this table to help determine the parameter values for each scan cycle.
Use this table to help determine the parameter values for each scan cycle.
Use this table to help determine the parameter values for each scan cycle.
See also
Use Real Time Clock instructions to configure the calendar and the clock.
Instruction Description
RTC_READ on page 412 Reads the real-time clock (RTC) module information.
RTC_SET on page 414 Sets real-time clock data to the RTC module information.
See also
RTC_READ ( read real-time Reads the real-time clock (RTC) module information.
Use this table to help determine the parameter values for this instruction.
Use this table to help determine the parameter values for the RTC data type.
See also
RTC_SET (set real-time Set RTC (real-time clock) data to the RTC module information.
Use this table to help determine the parameter values for this instruction.
Use this table to help determine the parameter values for the RTC data type.
See also
Socket instructions
Use the Sockets protocol for Ethernet communications to devices that do not
support Modbus TCP and EtherNet/IP. Sockets support client, server,
Transmission Control Protocol (TCP), and User Datagram Protocol (UDP).
Typical applications include communicating to printers, bar codes readers, and
personal computers.
See also
SOCKET_ACCEPT For Transmission Control Protocol (TCP) connections only. Accepts a TCP
connection request from a remote destination and returns a Socket Instance used
to send and receive data on the newly created connection.
Operation details:
Use this table to help determine the parameter values for this instruction.
Timeout Input UDINT Timeout for the SOCKET_ACCEPT instruction block instances. The
function block returns an Error if the timeout value is less than
minimum value.
Timeout range: 1000- 86400000 milliseconds
Set Timeout to 0 to use the default value 10000 (10 Second).
Results
TCP Server
See also
SOCKET_CREATE Creates an instance of the socket and returns an instance number that is used as an
input in any follow-on socket operations.
Operation details:
Use all eight instances for client Transmission Control Protocol (TCP)
connections.
Use all eight instances to listen for incoming TCP connections and
then accept eight connections from other devices.
Perform both TCP client and server operations.
Perform both TCP and UDP operations.
To accept incoming TCP connections to the same port, create a new Socket
Instance.
TCP Connection Loss:
User application program should detect the loss of TCP connections
and handle the event. Depending on the user application, consider the
option to Fault the controller.
Use this table to help determine the parameter values for this instruction.
Results
UDP example
See also
SOCKET_DELETE Deletes a created socket instance. For Transmission Control Protocol (TCP)
connections, SOCKET_DELETE also closes (Passive Close) the connection
before deleting the instance. Outputs are updated synchronously from the
program scan.
Use this table to help determine the parameter values for this instruction.
Results
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
Results
See also
SOCKET_INFO Returns information for a socket instance such as error codes and execution status.
Outputs update synchronously from the program scan.
Use this table to help determine the parameter values for this instruction.
LocalAddr Output SOCKETADDR_CFG Local address for the socket. For more information refer to
SOCKADDR_CFG data type.
When Socket_Info Instance is 0, LocalAddr displays as 0.
RemoteAddr Output SOCKETADDR_CFG Remote address for the socket. For more information refer to
SOCKADDR_CFG data type.
RemoteAddr displays as 0, in the following cases:
Socket_Info Instance is 0
User Datagram Protocol (UDP) connections without
SOCKET_OPEN
UDP with SOCKET_OPEN and disabled RxFilter.
Results
See also
SOCKET_OPEN Opens the connection for the specified destination address for Transmission
Control Protocol (TCP) connections. For User Datagram Protocol (UDP)
connections, associates a destination IP address and port number with the
specified socket.
Operations details:
Use this table to help determine the parameter values for this instruction.
EnUDPRxFilte Input BOOL For UDP socket, when SOCKET_OPEN and Enable EnUDPRxFilter are
r used, a packet filter for specific IP Address and port number is not
needed each time to read data.
A UDP socket with open is created. DestAddr as IP 192.168.1.157 /
Port 161. EnUDPRxFilter Enable, perform Socket_Read.
When controller receive data from DestAddr (192.168.1.157 /
161), Socket_Read completes the operation successfully. If
controller receives data from any other IP or Port then socket_Read
ignores that packet and waits for DestAddr Packet.
EnUDPRxFilter Disabled:
Perform SOCKET_READ. The controller receives any data on
configure UDP port, SOCKET_READ completes operation successfully.
The application checks whether the incoming packet arrives from
the expected device or not.
The application handles filtering based on the SOCKET_READ output
parameter UDPAddr.
Done Output BOOL Indicates when operation is complete.
TRUE - operation completed successfully.
FALSE - operation is in progress or encountered an error condition.
Busy Output BOOL TRUE - the operation is not finished.
FALSE - the operation is finished.
Results
TCP example
UDP example
See also
SOCKET_READ Reads data on a socket and returns the specified number of bytes. For
Transmission Control Protocol (TCP), returns when any data is received, up to
the requested number of bytes. For User Datagram Protocol (UDP), completes
when a datagram is available.
Operation details:
Use this table to help determine the parameter values for this instruction.
For Transmission Control Protocol (TCP), this structure is not used and
contain all zeros. The TCP connection conveys the remote address
information.
Results
TCP example:
UDP example:
See also
Operation details:
Use this table to help determine the parameter values for this instruction.
Results
TCP example:
See also
SOCKADDR_CFG data type The following table describes the SOCKADDR_CFG data type.
Port UINT Specify a local port number on which an application is listening and receiving.
See also
SOCK_STATUS data type The following table describes the SOCK_STATUS data type.
See also
Socket error codes The following table describes the status error codes for Socket instructions.
4 8 Illegal Parameter, Invalid Array Dimension. Use single dimensional array to contain the
Socket read and write data.
10 3 Socket background processing Error, TCP Receive Make sure the SOCKET_READ Length is
Large packet. Packet received is larger than the equal to greater than the received packet
Socket Read length. size. Since client may send up to the
receive window size of 256, 256 is
recommended.
10 4 Socket background processing Error, Received RST Restart Controller TCP Client or Server as
or Disconnect from Remote Device. shown in the State Diagram. Verify the
Target device that sent RST and make sure
the Target is restarted with correct state.
10 5 Socket background processing Error, UDP Packet
received from different device, drop packet.
Reserved for future.
10 6 Socket background processing Error, Queue is full. Wait for SOCKET_READ and
Error occurs when: SOCKET_WRITE queue availability for
respective Socket instance.
SOCKET_READ or SOCKET_WRITE execute four
instructions for the same Socket instance in
same scan.
Perform a SOCKET_READ when four
SOCKET_READ instructions are in BUSY state
for same Socket instance.
10 7 Socket background processing Error, When the SOCKET_READ state is BUSY, do
SOCKET_READ Parameter change (Length, Offset, not modify the input parameters.
Data Array Size, and Data Array Variable).
11 1 Socket background processing Fatal Error, Missing
data pointer.
11 2 Socket background processing Fatal Error, Missing
Session Pointer.
11 3 Socket background processing Fatal Error, Invalid
TCP or UDP Socket pointer.
See also
Socket instruction status The following table describes the execution status bits for socket instructions.
bits
Bit Number Name Description
0 EN - Enable Bit The EN bit is set when the instruction is enabled due to a False-to-True
transition, but has not yet completed or erred.
1 EW - Enable Wait The EW bit is set when the controller detects that a Socket instruction request
Queue Bit has entered into queue.
The controller resets the EW bit when the ST bit is set.
2 ST - Start Bit The ST bit is set when the queued instruction is executing.
The ST bit is reset when the DN or ER bit is set.
3 ER - Error Bit Indicates that an error occurred while executing the instruction. The ER bit is
reset the next time the run-condition-in goes from False to True.
4 DN - Done Bit The DN bit is set when the Socket instruction completes successfully. The DN bit
is reset the next time the run-condition-in goes from False to True.
See also
Socket instruction timing Successful execution for Socket instructions when process is immediate
diagrams
See also
Socket instruction The following diagram shows a typical sequence of socket interface transactions
with the controller acting as a TCP client.
transaction diagrams
Transactions for TCP Client
Transactions for TCP Server The following diagram shows a typical sequence of socket interface transactions
with the controller as a TCP server.
Transactions for UDP with The following diagram shows a typical sequence of socket interface transactions
for UDP communications when using the Open Connection service to specify the
Open Connection destination address.
Transactions for UDP The following diagram shows a typical sequence of socket interface transactions
for UDP communications without using the Open Connection service to specify
without Open Connections the destination address. In this case, the controller specifies the destination for
each datagram and receives the sender's address along with each datagram it
receives.
See also
TCP
See also
UDP
See also
Instruction Description
ASCII on page 669 Returns the ASCII code for characters in a string. Character -> ASCII code.
CHAR on page 671 Returns a one character string for an ASCII code. ASCII code -> character.
See also
Use this table to help determine the parameter values for this instruction.
ASCII Output DINT ASCII code of the selected character (in set [0 .. 255]) yields 0 is Pos is
out of the string.
(* ST Equivalence: *)
Results
See also
CHAR (ASCII code to string Returns a one character string for an ASCII code. ASCII code -> character.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
FIND (find sub-string) Locates and provides the position of sub-strings within strings.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
LEFT (extract left of a sting) Extract characters from the left side of a string.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* complete_string is '56781234'
Results
See also
MID (extract middle of a Extract characters from the middle of a string. Use the position and number of
characters provided to calculate the required parts of strings.
string)
Languages supported: Function Block Diagram, Ladder Diagram, Structured
Text.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* sub_string is 'de' *)
Results
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* this program extracts the 3 characters on the left of the string and puts the result
in the prefix string variable. Nothing is done if the string length is less than 3
characters *)
Results
See also
RIGHT (extract right of a Extract characters from the right side of a string.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
(* complete_string is '56781234'
*)
686 Rockwell Automation Publication 2080-RM001F-EN-E - November 2016
String manipulation instructions Chapter 23
Results
See also
Use this table to help determine the parameter values for this instruction.
REPLACE Output STRING Modified string. The NbC characters are deleted at position
Pos, then the substring Str is inserted at this position. Can be:
empty string if Pos <= 0
strings concatenation (IN+Str) if Pos is greater than the
length of the IN string
initial string IN if NbC <= 0
ENO Output BOOL Enable output.
Applies to Ladder Diagram programs.
(* ST Equivalence: *)
Results
See also
Timer instructions
Instruction Description
TOF on page 692 Off-delay timing. Increase an internal timer up to a given value.
TON on page 694 On-delay timing. Increase an internal timer up to a given value.
TONOFF on page 696 Delay turning on an output on a true rung, and then delay turning off the output on the
false rung.
TP on page 699 Pulse timing. On a rising edge, increases an internal timer up to a given value.
RTO on page 701 Retentive timing. Increases an internal timer when input is active, but does not reset
the internal timer when input changes to inactive.
DOY on page 703 Turn on an output if the value of the real-time clock is in the range of the Year Time
setting.
TDF on page 706 Computes the time difference between TimeA and TimeB.
TOW on page 708 Turns on an output if the value of the real-time clock is in the range of the Time of Week
setting.
See also
Timer instruction Time accuracy refers to the time between the moment the processor enables a
timer instruction and the moment the processor completes the timed interval.
configuration
The processor uses the following information from the timer instruction:
Timer - The timer control address in the timer area of data storage.
Time Base - Determines how the timer operates.
Preset - Specifies the value that the timer must reach before the processor
sets the done bit.
Accumulated value - The number of time increments the instruction has
counted. When enabled, the timer updates this value continually.
See also
Operation details:
If the EN parameter is used with this instruction block, the timer starts
incrementing when EN is set to TRUE, and continues to increment even if
EN is set to FALSE.
Use this table to help determine the parameter values for this instruction.
Results
See also
Use this table to help determine the parameter values for this instruction.
Results
See also
TONOFF (time-delay, on, Delays turning on an output on a true rung, then delays turning off the output on
the false rung.
off)
Operation details:
Use this table to help determine the parameter values for this instruction.
PTOF Input TIME The off-delay time setting defined using the Time data type.
Q Output BOOL TRUE - the Programmed On-delay time is elapsed and
Programmed Off-delay time is not elapsed.
ET Output TIME Current elapsed time. Possible values range from 0ms to
1193h2m47s294ms.
If the Programmed On-delay time is elapsed and the Off-delay
timer is not starting, the elapsed time (ET) remains at the on-delay
(PT) value. If the Programmed Off-delay time is elapsed and the
Off-delay timer is not starting, the elapsed time (ET) remains at
the off-delay (PTOF) value until the rising edge occurs again.
Results
See also
Operation details:
If the EN parameter is used with TP, the timer starts incrementing when
EN is set to TRUE, and continues to increment even if EN is set to FALSE.
Use this table to help determine the parameter values for this instruction.
TP timing diagram
Results
See also
Increases an internal timer when input is active, but does not reset the internal
RTO (retentive timer,
timer when input changes to inactive.
on-delay)
Operation details:
Micro810 or Micro820 controllers, the RTO internal timer does not persist
through a power cycle by default. To persist the internal timer, set the
Retained configuration parameter to true.
Micro830 or Micro850 controller, the RTO internal timer persists through
a power cycle.
Use this table to help determine the parameter values for this instruction.
RST Input BOOL TRUE - Rising edge, resets the internal timer.
FALSE - Does not reset internal timer.
PT Input TIME Maximum programmed on-delay time. PT is defined using the
Time data type.
Q Output BOOL TRUE - Programmed on-delay time is elapsed.
FALSE - Program on-delay time has not elapsed.
ET Output TIME Current elapsed time.
Values range from 0ms to 1193h2m47s294ms.
ET is defined using the Time data type.
See also
DOY (check year for Turns on an output when the value of real-time clock (RTC) is in the range of the
Year Time setting.
real-time clock)
Operation details:
Configure the Time input parameters with valid ranges as specified in the
DOYDATA Data Type. An invalid value faults the controller when
TimeX.Enable is set to TRUE and an RTC is present and enabled.
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
See also
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
TOW (check week for Turns on an output if the value of the real-time clock (RTC) is in the range of the
Time of Week setting.
real-time clock)
Operation details:
Use this table to help determine the parameter values for this instruction.
(* ST Equivalence: *)
Results
See also
T
TAN function 111
TAN_LREAL function 112
TDF function 706
time
DOY function 703
RTO function block 701
TDF function 706
TOF function block 692
TON function block 694
TONOFF function block 696
TOW function 708
TP function block 699
TND function 558
TOF function block 692
Rockwell Automation Publication 2080-RM001F-EN-E - November 2016 721
Rockwell Automation support
Rockwell Automation provides technical information on the web to assist you in using its products.
At http://www.rockwellautomation.com/support you can find technical and application notes, sample code, and links to software service packs.
You can also visit our Support Center at https://rockwellautomation.custhelp.com for software updates, support chats and forums, technical
information, FAQs, and to sign up for product notification updates.
In addition, we offer multiple support programs for installation, configuration, and troubleshooting. For more information, contact your local
distributor or Rockwell Automation representative, or visit http://www.rockwellautomation.com/services/online-phone .
Installation assistance
If you experience a problem within the first 24 hours of installation, review the information that is contained in this manual. You can contact
Customer Support for initial help in getting your product up and running.
United States Contact your distributor. You must provide a Customer Support case number (call the phone number above to obtain one) to
your distributor to complete the return process.
Outside United States Please contact your local Rockwell Automation representative for the return procedure.
Documentation feedback
Your comments will help us serve your documentation needs better. If you have any suggestions on how to improve this document, complete the
feedback form, publication RA-DU002.
Copyright 2016 Rockwell Automation, Inc. All rights reserved. Printed in the U.S.A.