Micro800 Programmable Controllers General Instructions - FB Logic
Micro800 Programmable Controllers General Instructions - FB Logic
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
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.
Important: Identifies information that is critical for successful application and understanding of the product.
Allen-Bradley, Rockwell Automation, Logix5000, RSLogix 5000, Studio 5000, Connected Components Workbench, ControlLogix, GuardLogix, CompactLogix,
Micro800, PowerFlex, SoftLogix, Rockwell Software, PLC-2, PLC-3, PLC-5, SLC, SLC 500, 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 3
Chapter 4
RockwellAutomationPublication2080-RM001B-EN-E-March20144 3
Table of Contents
Chapter 5
Chapter 6
4 RockwellAutomationPublication2080-RM001B-EN-E-March2014
Table of Contents
Chapter 7
Chapter 8
Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014 5
Table of Contents
Chapter 10
6 RockwellAutomationPublication2080-RM001B-EN-E-March2014
Table of Contents
Chapter 11
Chapter 12
Chapter 13
Chapter 14
RockwellAutomationPublication2080-RM001B-EN-E-March2014 7
Table of Contents
Chapter 15
8 RockwellAutomationPublication2080-RM001B-EN-E-March2014
Table of Contents
Chapter 16
Chapter 17
Motion control instructions General rules for motion control function blocks ........................... 418
Motion control function block parameter details ........................... 421
Motion control axis states .......................................................................... 421
Motion control function block parameter numbers ............................. 423
Motion control function block error IDs ............................................... 424
Axis error scenarios ..................................................................................... 426
AXIS_REF data type .................................................................................. 426
Axis variables ................................................................................................ 427
MC_AbortTrigger ......................................................................... 429
MC_Halt ....................................................................................... 432
MC_Home .................................................................................... 436
Homing modes............................................................................................. 439
MC_MoveAbsolute........................................................................ 441
MC_MoveRelative ......................................................................... 446
MC_MoveVelocity......................................................................... 450
MC_Power .................................................................................... 455
MC_ReadAxisError ....................................................................... 460
AxisErrorID error codes ............................................................................. 462
MC_ReadBoolParameter ............................................................... 465
RockwellAutomationPublication2080-RM001B-EN-E-March2014 9
Table of Contents
Chapter 18
Chapter 19
Chapter 20
Proportional Integral What is Proportional Integral Derivative (PID) control? ................ 532
Derivative (PID) instruction How the IPIDController function block implements PID control . 533
IPIDCONTROLLER .................................................................... 535
GAIN_PID data type ................................................................................. 539
AT_Param data type ................................................................................... 540
IPIDController function block operation ...................................... 541
Using the Proportional Integral Derivative instruction .................. 543
Using auto-tune with the IPIDController function block .................. 543
Example: IPIDController with auto-tune .............................................. 550
Example: How to create a feedback loop for the manipulated value.. 552
Example: How to add a UDFB to a PID program ................................ 553
Example: How to create an IPIDController program to control
temperature................................................................................................... 554
10 RockwellAutomationPublication2080-RM001B-EN-E-March2014
Table of Contents
Chapter 21
Chapter 22
Chapter 23
RockwellAutomationPublication2080-RM001B-EN-E-March2014 11
Preface
RockwellAutomationPublication2080-RM001B-EN-E-March2014 13
Preface
This guide provides reference information about the instruction set available for
In This Manual 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.
14 RockwellAutomationPublication2080-RM001B-EN-E-March2014
Preface
• 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
RockwellAutomationPublication2080-RM001B-EN-E-March2014 15
Preface
16 RockwellAutomationPublication2080-RM001B-EN-E-March2014
Chapter 1
Instruction set
For information about a specific instruction, including a description, parameter
details, and language examples, locate the instruction from the table of contents, or
from the following reference topics.
RockwellAutomationPublication2080-RM001B-EN-E-March2014 17
Chapter 1 Finding informationabout instructionsand ladderelements
Operators
An operator is a basic logical operation such as arithmetic, boolean, comparator, or
data conversion.
Functions
Functions have one or more input parameters and one output parameter.
Output Each output of an instruction block is labeled and has a defined type.
18 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
Calling a function
Connected Components WorkbenchTM does not support recursive function calls.
When a function of the Functions section is called by itself or one of its called
functions, a run-time error occurs. Furthermore, functions do not store the local
values of their local variables. Since functions are not instantiated, they cannot call
function blocks.
• 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.
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 19
Chapter 1 Finding informationabout instructionsand ladderelements
Output Each output of an instruction block is labeled and has a defined type.
20 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 21
Chapter 1 Finding informationabout instructionsand ladderelements
The following table lists the instruction set available in Connected Components
Instruction set in workbench in alphabetical order.
alphabetical order
Instruction Instruction block type
ABL (on page 114) Function block
ABS (on page 66) Function
ACB (on page 116) Function block
ACL (on page 118) Function block
ACOS (on page 68) Function
ACOS_LREAL (on page 70) Function
Addition (on page 72) Operator
AHL (on page 120) Function block
AND (on page 161) Operator
AND_MASK (on page 136) Function
ANY_TO_BOOL (on page 268) Function
ANY_TO_BYTE (on page 269) Function
ANY_TO_DATE (on page 270) Function
ANY_TO_DINT (on page 271) Function
ANY_TO_DWORD (on page 272) Function
ANY_TO_INT (on page 273) Function
ANY_TO_LINT (on page 274) Function
ANY_TO_LREAL (on page 275) Function
ANY_TO_LWORD (on page 276) Function
ANY_TO_REAL (on page 277) Function
ANY_TO_SINT (on page 278) Function
ANY_TO_STRING (on page 279) Function
ANY_TO_TIME (on page 280) Function
ANY_TO_UDINT (on page 281) Function
ANY_TO_UINT (on page 282) Function
ANY_TO_ULINT (on page 283) Function
ANY_TO_USINT (on page 284) Function
ANY_TO_WORD (on page 285) Function
ARD (on page 122) Function block
ARL (on page 124) Function block
ASCII (on page 568) Function
ASIN (on page 73) Function
ASIN_LREAL (on page 75) Function
ATAN (on page 77) Function
22 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 23
Chapter 1 Finding informationabout instructionsand ladderelements
24 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 25
Chapter 1 Finding informationabout instructionsand ladderelements
26 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 27
Chapter 1 Finding informationabout instructionsand ladderelements
28 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
Functions
The following table lists the functions by functional category.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 29
Chapter 1 Finding informationabout instructionsand ladderelements
Operators
The following table lists the operators by functional category.
30 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Finding informationabout instructionsand ladderelements Chapter 1
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 31
Chapter 2
Element Description
LD program (on page 34) Graphical representation of Boolean equations which combines contacts (input arguments) with coils (output
results) using graphic symbols.
LD program development Example showing the language editor for an Ladder Diagram (LD) program.
environment (on page 35)
Ladder Diagram (LD) Components used to build a Ladder Diagram program.
elements (on page 37)
Instruction blocks in LD IEC 61131-3 compliant instruction blocks collectively include function blocks, functions and operators.
programs (on page 53)
Working in the LD Adding elements to a LD program.
language editor (on page
54)
Ladder Diagram (LD) Examples of Ladder Diagram (LD) programs.
program examples (on
page 56)
LD Keyboard shortcuts (on Keyboard shortcuts available for the Ladder Diagram (LD) language.
page 58)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 33
Chapter 2 LadderDiagram(LD) language
34 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD) language Chapter 2
The following illustration shows the language editor for an LD program where
LD program development you develop an LD Program Organizational Unit (POU). Use the LD Toolbox or
environment LD keyboard shortcuts to add elements to your LD POU.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 35
Chapter 3
Ladder diagram elements are the components that you use to build a ladder
diagram program. All the elements listed in the following table can be added to
your ladder diagram from the LD Toolbox within Connected Components
Workbench.
Element Description
Rung (on page 37) Represents a group of circuit elements that lead to the activation of a coil.
Block (LD) (on page 40) Instructions include operators, functions, and function blocks including user-defined function blocks.
Branch (on page 39) Two or more instructions in parallel.
Coil (on page 43) Represents the assignment of outputs or internal variables. In an LD program, a coil represents an action.
Contact (on page 48) Represents the value or function of an input or internal variable.
Return (on page 51) Represents the conditional end of a diagram output.
Jump (on page 51) Represents the conditional and unconditional logic in the LD program that control the control the execution of
diagrams.
Rung
Rungs are graphic components of an LD diagram that represent a group of circuit
elements that lead to the activation of a coil. Rungs can have labels to identify
them within the diagram. Labels, along with jumps, control the execution of a
diagram. You can enter comments (free-format text) above the rung for
documentation purposes.
RockwellAutomationPublication2080-RM001B-EN-E-March2014 37
Chapter 3 LadderDiagram(LD)elements
Rung comments
Comments you enter in the space above the rung are saved in rich text format and
stored in the controller.
1. In the Language Editor, double-click the rectangular area above the rung,
then type comments.
2. Click anywhere in the Language Editor workspace to save the comments.
Example: Label
38 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
• From the Toolbox, drag the rung element into the language editor, or
• From the Toolbox, double-click the rung element to add it to the language
editor, or
• Right-click and existing rung, select Copy and then paste a copy of the rung
into the language editor.
Tip: A plus sign (+) appears on top of a Toolbox element when you hover over a valid target.
Release the mouse button to add the element.
Tip: You can use keyboard shortcut keys to add elements to your LD program. See LD Keyboard
shortcuts (on page 58).
Tip: If your ladder diagram contains more than 355 rungs, use the down triangle rather than the
scroll bar to view additional rungs.
Branch
Branches create alternative routing for connections. You can add parallel branches
to elements on a rung.
Add a branch
From the Toolbox, drag the branch element onto an existing element within the
language editor.
Example: Branches
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 39
Chapter 3 LadderDiagram(LD)elements
Example: Label
Block (LD)
A LD block element is a functional element in a LD diagram that can be a
function block, a function, a user-defined function block, or an operator.
LD instruction blocks
The Connected Components Workbench instruction set includes IEC 61131-3
compliant instruction blocks. Instruction blocks collectively include operators,
functions and function blocks.
40 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
Enable EN/ENO
You can enable the EN input parameter and ENO output parameter so they will
always be added with the instruction block even when there is an available boolean
input or output.
Note: The EN and ENO parameters will only be added to instruction blocks you
add after you enable the setting - instructions blocks already in the LD program
will not be affected.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 41
Chapter 3 LadderDiagram(LD)elements
EN input/EN output
If a first boolean input or output is not present, an EN and/or an ENO parameter
will be added to the block.
• If the first block output is not boolean, an ENO output parameter is added
to the block. The ENO output always has the same state as the first input of
the instruction block.
You can enable/disable the EN/ENO block settings for an individual instruction
block in the Block Selector, or in Block Settings for the Ladder Diagram (LD)
program. The following table describes the results of enabling and disabling the
EN/ENO parameters in the blocks shown in the illustration.
Rung EN/ENO Block 1st boolean EN input added? 1st boolean ENO output
input output added?
1 False <= No Yes Yes No
42 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
Coil
Coils are graphic components of an LD diagram that represent the assignment of
an output or of an internal variable. In an LD diagram, 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. Consequently, coils can only be added to a
defined rung in the LD language editor. After a coil is added, its definition can be
modified.
You can add the following coil element types to your LD program from the
Toolbox.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 43
Chapter 3 LadderDiagram(LD)elements
Example: Coils
44 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
Tip: You can use keyboard shortcut keys to add elements to your LD program. See LD Keyboard
shortcuts (on page 58).
Direct Coil
A direct coil supports a Boolean output of a connection line Boolean state.
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).
The associated Boolean variable must be an output or it must be user-defined.
Example: Direct coil
Reverse Coil
A reverse coil element supports a Boolean output according to the Boolean
negation of a connection line state.
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
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 45
Chapter 3 LadderDiagram(LD)elements
rail (unless you have parallel coils, where only the upper coil must be connected to
the right vertical power rail).
The associated Boolean variable must be output or it must be user-defined.
Example: Reverse Coil
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).
The associated Boolean variable must be output or it must be user-defined.
Example: Pulse Falling Edge Coil
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).
The associated Boolean variable must be output or user-defined.
46 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
Set Coil
Set 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 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).
The associated Boolean variable must be output or it must be user-defined.
Example: Set Coil
Reset Coil
Reset coils support a Boolean output of a connection line Boolean state.
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).
The associated Boolean variable must be output or user-defined.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 47
Chapter 3 LadderDiagram(LD)elements
Contact
Contacts are graphic components of an LD diagram. 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.
Example: Contacts
You can add the following contact element types to your LD program from the
LD Toolbox in Connected Components Workbench.
48 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
2. From the Toolbox, drag the contact element into the language editor and
position it on the rung.
Tip: A plus sign (+) appears on top of a Toolbox element when you hover over a valid target.
Release the mouse button to add the element.
Tip: You can use keyboard shortcut keys to add elements to your LD program. See LD Keyboard
shortcuts (on page 58).
Direct Contact
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.
Example: Direct Contact
Reverse Contact
Reverse contacts support a Boolean operation between a connection line state and
the Boolean negation of a Boolean variable.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 49
Chapter 3 LadderDiagram(LD)elements
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.
Example: Reverse Contact
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.
Example: Pulse Rising Edge Contact
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.
50 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
Return
Returns are outputs that represent a conditional end of an LD diagram.
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).
Example: Return
Insert a return
From the Toolbox, drag the return element into the language editor and place it
on the rung.
Jump
Jumps are conditional or unconditional elements that control the execution of an
LD diagram.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 51
Chapter 3 LadderDiagram(LD)elements
Jump notation
The following notation indicates a jump to the LAB label:
>>LAB - Jump to a label where the label name is "LAB"
Example: Jump
52 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
• The return parameters of a function block can have any name. Multiple
return parameters can provide multiple outputs.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 53
Chapter 3 LadderDiagram(LD)elements
• 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.
• If the element is too large for the current rung, the element is placed on the
next rung.
54 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
3. Click an existing variable, then type constant values in the text box
provided.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 55
Chapter 3 LadderDiagram(LD)elements
Example: Comparing Real Values using Subtraction (-) ABS, and Less
than (<) (on page 56)
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.
56 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 57
Chapter 3 LadderDiagram(LD)elements
The following keyboard shortcuts are available for use with the LD language.
LD Keyboard shortcuts
Shortcut Description
Ctrl+0 Inserts a rung after a selected rung.1
Ctrl+Alt+0 Inserts a rung before a selected rung.1
Ctrl+ 1 Inserts a branch after a selected element.
Ctrl+Alt+ 1 Inserts a branch before a selected element.
Ctrl+2 Inserts an instruction block after a selected element.2
Ctrl+Alt+2 Inserts an instruction block before a selected element.2
Ctrl+3 Inserts a contact after a selected element.2
Ctrl+Alt+3 Inserts a contact before a selected element.2
Ctrl+4 Inserts a coil after a selected element**.
Ctrl+Alt+4 Inserts a coil after a selected element**.
Ctrl+5 Inserts a jump after a selected element**.
Ctrl+Alt+5 Inserts a jump after a selected element**.
Ctrl+6 Inserts a return after a selected element**.
Ctrl+Alt+6 Inserts a return after a selected element**.
Space bar For coils or contacts, toggles between the available types.
Shift+Ctrl+Alt+G Selects/clears the grid in the Language Editor workspace.
Ctrl+Down Arrow Moves to the next rung. When an element is selected on a rung, moves to the
next rung containing the selected element.
Ctrl+R Opens the block selector.
Ctrl+Up Arrow Moves to the previous rung. When an element is selected on a rung, moves to
the previous rung containing the selected element.
Down, Up, Right, Left Moves between branches and sub-.
Delete Removes a selected rung or element.
Enter Calls the Variable/ Block Selector (depending on the selected element).
Shift+Enter Inserts a line break
Ctrl+Enter Opens a line above the current line
Ctrl+Shift+Enter Opens a line below the current line
Ctrl+Shift+L Removes the current line
Ctrl+Delete Removes the next word in the current line
Backspace Removes the character on the left
Ctrl+Backspace Removes the previous word in the current line
Ctrl+C Copies the selected text to the clipboard
58 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
LadderDiagram(LD)elements Chapter 3
Shortcut Description
Ctrl+Insert Copies the selected text to the clipboard
Ctrl+L Cuts the current line to the clipboard
Ctrl+X Cuts the selected text to the clipboard
Shift+Delete Cuts the selected text to the clipboard
Ctrl+V Pastes text saved on the clipboard to the insertion point
Shift+Insert Pastes text saved on the clipboard to the insertion point
Ctrl+Z Undoes the previous command
Ctrl+Y Redoes the previous command
Ctrl+Shift+Z Redoes the previous command
Ctrl+Left Moves to the previous statement or word
Ctrl+Right Moves to the next statement or word
Home Moves to the start of the line
End Moves to the end of the line
Ctrl+Home Moves to the start of the document
Ctrl+End Moves to the end of the document
Page Up Moves to the top of the visible code
Page Down Moves to the bottom of the visible code
Ctrl+Page Up Moves to the top of the visible code
Ctrl+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+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
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 59
Chapter 3 LadderDiagram(LD)elements
Shortcut Description
Ctrl+A Selects the entire document
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
Ctrl+Space Accesses the autocomplete function
Ctrl+Shift+Space Accesses the autocomplete function
Ctrl+Shift+U Changes the selected text into uppercase
Ctrl+U Changes the selected text into lowercase
Esc Deselects the selected text
Ctrl+I Opens the variable selector
Ctrl+Shift+I Opens the variable selector
Ctrl+Alt+R Opens the block selector
Ctrl+Shift+Alt+R Opens the block selector
Insert Toggles between the overwrite/insert typing mode
Ctrl+Shift+T Transposes the current and previous word
Ctrl+Shift+Alt+T Transposes the current and next line
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.
60 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 4
Alarm instruction
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 61
Chapter 4 Alarm instruction
LIM_ALRM is an alarm with hysteresis on a Real value for high and low limits.
LIM_ALRM
LIM_ALRM operation
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.
Process alarms
An alarm occurs when a fault is received and processed by the controller. Process
level alarms alert you when the module has exceeded the configured high or
configured low limits for each channel.
Arguments
62 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Alarm instruction Chapter 4
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 63
Chapter 4 Alarm instruction
Results
64 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 5
Arithmetic instructions
Function Description
ABS (on page 66) Absolute value of a Real value
ACOS (on page 68) Arc cosine of a Real value
ACOS_LREAL (on page 70) Perform 64-bit real arc-cosine calculation
Addition (on page 72) Add a value
ASIN (on page 73) Arc sine of a Real value
ASIN_LREAL (on page 75) Perform 64-bit real arc-sine calculation
ATAN (on page 77) Arc tangent of a Real value
ATAN_LREAL (on page 79) Perform 64-bit Real arc-tangent calculation
COS (on page 81) Cosine of a Real value
COS_LREAL (on page 83) Perform 64-bit Real cosine calculation
Division (on page 85) Divide Integer or Real value
EXPT (on page 86) Exponent calculation of Real values
LOG (on page 88) Logarithm of a Real value
MOD (on page 90) Module
MOV (on page 92) Move a copy of a value
Multiplication (on page 93) Multiply an Integer or Real value
Neg (on page 94) Negate a value
POW (on page 95) Power calculation of Real values
RAND (on page 97) Random value
SIN (on page 99) Sine of a Real value
SIN_LREAL (on page 101) Perform 64-bit real sine calculation
SQRT (on page 103) Square root of a Real value
Subtraction (on page 105) Subtract a value
TAN (on page 106) Tangent of a Real value
TAN_LREAL (on page 108) Perform 64-bit real tangent calculation
TRUNC (on page 110) Truncates Real values, leaving just the integer.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 65
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
(* ST Equivalence: *)
over := (ABS (delta) > range);
66 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 67
Chapter 5 Arithmetic instructions
ACOS yields the Arc Cosine of a Real value. Input and output values are in
ACOS radians.
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
cosine := COS (angle);
68 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 69
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
cosine := COS_LREAL (angle);
70 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 71
Chapter 5 Arithmetic instructions
Addition operation
The Addition function supports additional inputs.
Arguments
i1 Input SINT - USINT - BYTE - Addend in Real, Time, or String data type.
INT - UINT - WORD - All inputs must be the same data type.
DINT - UDINT - DWORD
- LINT - ULINT -
LWORD - REAL - LREAL
- TIME - STRING
i2 Input SINT - USINT - BYTE - Addend in Real, Time, or String data type.
INT - UINT - WORD - All inputs must be the same data type.
DINT - UDINT - DWORD
- LINT - ULINT -
LWORD - REAL - LREAL
- TIME - STRING
o1 Output SINT - USINT - BYTE - Sum of the input values in Real, Time, or String fomat.
INT - UINT - WORD - Input and output must use the same data type.
DINT - UDINT - DWORD
- LINT - ULINT -
LWORD - REAL - LREAL
- TIME - STRING
ENO Output BOOL Enable out.
Applies only to LD programs.
Example
(* ST equivalence: *)
ao10 := ai101 + ai102;
ao5 := (ai51 + ai52) + ai53;
72 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
ASIN yields the Arc sine of a Real value. Input and output values are in radians.
ASIN
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
sine := SIN (angle);
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 73
Chapter 5 Arithmetic instructions
74 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
sine := SIN_LREAL (angle);
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 75
Chapter 5 Arithmetic instructions
76 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
tangent := TAN (angle);
result := ATAN (tangent); (* result is equal to angle*)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 77
Chapter 5 Arithmetic instructions
Results
78 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
tangent := TAN_LREAL (angle);
result := ATAN_LREAL (tangent); (* result is equal to angle*)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 79
Chapter 5 Arithmetic instructions
Results
80 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
cosine := COS (angle);
result := ACOS (cosine); (* result is equal to angle *)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 81
Chapter 5 Arithmetic instructions
Results
82 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
cosine := COS_LREAL (angle);
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 83
Chapter 5 Arithmetic instructions
84 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Division divides the first Integer or Real input value by the second Integer or Real
Division input value.
Arguments
i2 Input SINT - USINT - BYTE - Divisor in non-zero Integer or Real data type.
INT - UINT - WORD - All inputs must be the same data type.
DINT - UDINT -
DWORD - LINT -
ULINT - LWORD -
REAL - LREAL
o1 Output SINT - USINT - BYTE - Quotient of the inputs in non-zero Integer or Real data type.
INT - UINT - WORD - Input and output must use the same data type.
DINT - UDINT -
DWORD - LINT -
ULINT - LWORD -
REAL - LREAL
ENO Output BOOL Enable out.
Applies only to LD programs.
Example
(* ST Equivalence: *)
ao10 := ai101 / ai102;
ao5 := (ai5 / 2) / ai53;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 85
Chapter 5 Arithmetic instructions
Where 'base' is the first argument and 'exponent' is the second argument, EXPT
EXPT yields the Real result of the following operation: (base exponent).
Arguments
Ladder diagram
Structured text
86 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
(* ST Equivalence: *)
tb_size := ANY_TO_DINT (EXPT (2.0, range) );
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 87
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
xpos := ABS (xval);
88 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 89
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
Structured text
90 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
(* ST Equivalence: *)
division_result := (value / divider); (* integer division *)
rest_of_division := MOD (value, divider); (* rest of the division *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 91
Chapter 5 Arithmetic instructions
MOV moves a copy of the value in input (i1) to the output (o1).
MOV
Arguments
Example
(* ST equivalence: *)
ao23 := ai10;
92 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
i1 Input SINT - USINT - BYTE - INT - Factor in Integer or Real data type.
UINT - WORD - DINT - UDINT All inputs must be the same data type.
- DWORD - LINT - ULINT -
LWORD - REAL - LREAL
i2 Input SINT - USINT - BYTE - INT - Factor in Integer or Real data type.
UINT - WORD - DINT - UDINT All inputs must be the same data type.
- DWORD - LINT - ULINT -
LWORD - REAL - LREAL
o1 Output SINT - USINT - BYTE - INT - Product of the inputs in Integer or Real data type.
UINT - WORD - DINT - UDINT Input and output must use the same data type.
- DWORD - LINT - ULINT -
LWORD - REAL - LREAL
ENO Output BOOL Enable out.
Applies only to LD programs.
Example
(* ST equivalence *)
ao10 := ai101 * ai102;
ao5 := (ai51 * ai52) * ai53;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 93
Chapter 5 Arithmetic instructions
Arguments
Example
(* ST equivalence: *)
ao23 := - (ai10);
ro100 := - (ri1 + ri2);
94 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
When the first argument is 'base' and the second argument is 'exponent', POW
POW yields the Real result of the following: (base exponent).
POW operation
The Exponent is a real value.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 95
Chapter 5 Arithmetic instructions
Ladder diagram
Structured text
(* ST Equivalence: *)
result := POW (xval, power);
Results
96 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
• (* ST Equivalence: *)
selected := MUX4 ( RAND (4), 1, 4, 8, 16 );
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 97
Chapter 5 Arithmetic instructions
(*
random selection of 1 of 4 pre-defined values
the value issued of RAND call is in set [0..3],
so 'selected' issued from MUX4, will get 'randomly' the value
1 if 0 is issued from RAND,
or 4 if 1 is issued from RAND,
or 8 if 2 is issued from RAND,
or 16 if 3 is issued from RAND,
*)
Results
98 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
sine := SIN (angle);
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 99
Chapter 5 Arithmetic instructions
100 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT1 := SIN_LREAL(TESTINPUT1) ;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 101
Chapter 5 Arithmetic instructions
Results
102 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 103
Chapter 5 Arithmetic instructions
104 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Subtraction subtracts an Integer, Real, or Time value from another Integer, Real
Subtraction or Time value.
Arguments
Example
(* ST equivalence: *)
ao10 := ai101 - ai102;
ao5 := (ai51 - 1) - ai53;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 105
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
tangent := TAN (angle);
106 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 107
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
tangent := TAN_LREAL (angle);
result := ATAN_LREAL (tangent); (* result is equal to angle*)
108 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 109
Chapter 5 Arithmetic instructions
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
result := TRUNC (+2.67) + TRUNC (-2.0891);
110 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Arithmetic instructions Chapter 5
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 111
Chapter 6
ASCII serial port instructions are communication instructions that use or alter the
communication channel for receiving or transmitting data.
ARL (on page 124) Read one line of characters from the input buffer and place them into a string
AWA (on page 126) Write a string with user-configured characters appended to an external device
AWT (on page 128) Write characters from a source string to an external device
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 113
Chapter 6 ASCIIserial port instructions
ABL counts the total number of characters in the input buffer up to and including
ABL the end-of-line termination character.
Arguments
114 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 115
Chapter 6 ASCIIserial port instructions
Arguments
116 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 117
Chapter 6 ASCIIserial port instructions
ACL clears the Receive and Transmit buffer(s), and removes instructions from
ACL the ASCII queue.
Arguments
ACLInput Input ACL The state of the transmit and receive buffers.
See ACL data type (on page 131)
118 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 119
Chapter 6 ASCIIserial port instructions
AHL sets or resets the RS-232 Request to Send (RTS) handshake control lines for
AHL your modem.
Arguments
AHLInput Input AHLI Set or reset the RTS control line for the modem.
See AHLI data type (on page 132).
Q Output BOOL FALSE - The function block is not done.
TRUE - The function block is done.
ChannelSts Output WORD Displays the current status (0000 to 001F) of the handshake lines for the channel
specified.
See AHL ChannelSts data type (on page 131).
Error Output BOOL FALSE - No error.
TRUE - An error is detected.
ErrorID Output UINT See ABL error codes (on page 130).
120 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 121
Chapter 6 ASCIIserial port instructions
ARD reads characters from the buffer and stores them in a string.
ARD
ARD operations
• ARD will be executed until all characters are received. If another ASCII
command is executed, it will be queued until ARD is finished. An ACL (on
page 118) instruction can be executed in order to abort the ARD
instruction.
• Use the results of an ACB (on page 116) instruction to trigger the ARD
instruction. This prevents the ARD instruction from holding up the ASCII
queue while it waits for the required number of characters.
Arguments
ARDInput Input ARDARL Read characters from the buffer (maximum is 82).
See ARDARL data type (on page 132).
122 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 123
Chapter 6 ASCIIserial port instructions
ARL reads characters from the buffer (up to and including the termination
ARL characters) and stores them in a string.
Arguments
IN Input BOOL If Rising Edge (IN turns from FALSE to TRUE), start the function block with the precondition
that the last operation has been completed.
ARLInput Input ARDARL Read characters from the buffer (maximum is 82).
See ARDARL data type (on page 132).
Destination Output ASCIILOCADDR The string element where you want the characters stored.
124 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 125
Chapter 6 ASCIIserial port instructions
AWA writes characters from a source string to an external device. This instruction
AWA adds the two appended characters that you configure on the configuration dialog
box.
Arguments
126 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 127
Chapter 6 ASCIIserial port instructions
Arguments
128 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 129
Chapter 6 ASCIIserial port instructions
The following topics provide additional details for ASCII parameters and
ASCII parameter details structured data types.
130 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 131
Chapter 6 ASCIIserial port instructions
132 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
ASCIIserial port instructions Chapter 6
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 133
Chapter 7
Binary instructions
Operator Description
AND_MASK (on page 136) Integer bit-to-bit AND_MASK
NOT_MASK (on page 138) Integer bit-to-bit negation NOT_MASK
OR_MASK (on page 140) Integer bit-to-bit OR_MASK
ROL (on page 142) Rotate Left an integer value
ROR (on page 144) Rotate Right an integer value
SHL (on page 146) Shift Left an integer value
SHR (on page 148) Shift Right an integer value
XOR_MASK (on page 150) Integer bit-to-bit Exclusive OR mask
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 135
Chapter 7 Binary instructions
Arguments
Ladder diagram
Structured text
136 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
(* ST Equivalence: *)
parity := AND_MASK (xvalue, 1); (* 1 if xvalue is odd *)
result := AND_MASK (16#abc, 16#f0f); (* equals 16#a0c *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 137
Chapter 7 Binary instructions
Arguments
Ladder diagram
Structured text
(*ST equivalence: *)
result := NOT_MASK (16#1234);
(* result is 16#FFFF_EDCB *)
138 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 139
Chapter 7 Binary instructions
Arguments
Ladder diagram
Structured text
140 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
(* ST Equivalence: *)
parity := OR_MASK (xvalue, 1); (* makes value always odd *)
result := OR_MASK (16#abc, 16#f0f); (* equals 16#fbf *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 141
Chapter 7 Binary instructions
Arguments
Ladder diagram
142 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
Structured text
(* ST Equivalence: *)
result := ROL (register, 1);
(* register = 2#0100_1101_0011_0101*)
(* result = 2#1001_1010_0110_1010*)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 143
Chapter 7 Binary instructions
Arguments
Ladder diagram
144 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
Structured text
(* ST Equivalence: *)
result := ROR (register, 1);
(* register = 2#0100_1101_0011_0101 *)
(* result = 2#1010_0110_1001_1010 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 145
Chapter 7 Binary instructions
For 32-bit integers, SHL moves integers to the left and places 0 in the least
SHL significant bit.
Arguments
146 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
Ladder diagram
Structured text
(* ST Equivalence: *)
result := SHL (register,1);
(* register = 2#0100_1101_0011_0101 *)
(* result = 2#1001_1010_0110_1010 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 147
Chapter 7 Binary instructions
For 32-bit integers, SHR moves integers to the right and places 0 in the most
SHR significant bit.
Arguments
148 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
Ladder diagram
Structured text
(* ST Equivalence: *)
result := SHR (register,1);
(* register = 2#1100_1101_0011_0101 *)
(* result = 2#0110_0110_1001_1010 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 149
Chapter 7 Binary instructions
Arguments
Ladder diagram
Structured text
150 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Binary instructions Chapter 7
(* ST Equivalence: *)
crc32 := XOR_MASK (prevcrc, nextc);
result := XOR_MASK (16#012, 16#011); (* equals 16#003 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 151
Chapter 8
Boolean instructions
Function Description
MUX4B (on page 174) Similar to MUX4, but can accept BOOL type input and output BOOL type value
MUX8B (on page 170) Similar to MUX8, but can accept BOOL type input and output BOOL type value
TTABLE (on page 166) Provides the value of the output according to the combination of inputs
Function block Description
F_TRIG (on page 154) Falling edge detection
RS (on page 158) Reset dominant bistable
R_TRIG (on page 156) Rising edge detection
SR (on page 164) Set dominant bistable
Operator Description
AND (on page 161) Performs a boolean AND operation between two or more values.
NOT (on page 163) For Boolean expressions, converts values to negated values.
XOR (on page 162) Boolean exclusive OR of two values.
OR (on page 160) Boolean OR of two or more values.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 153
Chapter 8 Boolean instructions
Arguments
154 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 155
Chapter 8 Boolean instructions
Arguments
156 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 157
Chapter 8 Boolean instructions
Arguments
158 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 159
Chapter 8 Boolean instructions
OR operation
The OR operator supports additional inputs.
Arguments
160 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
AND operation
The AND operator supports additional inputs.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 161
Chapter 8 Boolean instructions
Arguments
162 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 163
Chapter 8 Boolean instructions
Arguments
164 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 165
Chapter 8 Boolean instructions
The TTABLE function gives the value of the output according to the
TTABLE 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.
Arguments
166 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
Ladder diagram
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 167
Chapter 8 Boolean instructions
Structured text
Results
168 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 169
Chapter 8 Boolean instructions
MUX8B yields a value between eight BOOL type input and output values.
MUX8B
Arguments
170 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 171
Chapter 8 Boolean instructions
Ladder diagram
Structured text
172 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
(* ST Equivalence: *)
range := MUX8 (choice, 1, 5, 10, 50, 100, 500, 1000, 5000);
(* select from 8 predefined ranges, for example, if choice is 3, range will be 50 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 173
Chapter 8 Boolean instructions
MUX4B yields a value between four BOOL type input and output values.
MUX4B
Arguments
174 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Boolean instructions Chapter 8
Ladder diagram
Structured text
(* ST Equivalence: *)
range := MUX4 (choice, 1, 10, 100, 1000);
(* select from 4 predefined ranges, for example, if choice is 1, range will be 10 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 175
Chapter 8 Boolean instructions
176 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 9
Communication instructions
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 177
Chapter 9 Communication instructions
MSG_CIPGENERIC operation
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.
Arguments
When the MSG_CIPGENERIC function block is enabled, the receive buffers for
Read operations are cleared on the rising edge of Enable.
IN Input BOOL If Rising Edge (IN turns from FALSE to TRUE), start the function block
with the precondition that the last operation has been completed.
178 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
ResData Input USINT[1..1] CIP message response data. The array size should not be less than the
‘ResLength’ size.
When a MSG is triggered or re-triggered, data in the ResData array is
cleared.
Q Output BOOL TRUE - MSG instruction is finished.
FALSE - MSG instruction is not finished.
Status Output CIPSTATUS Function block execution status
When a MSG is triggered, or re-triggered, all elements inside Status are
reset.
See CIPSTATUS data type (on page 181).
ResLength Output UINT CIP message response data length:
• 0 - 490
When a MSG is triggered, or re-triggered, ResLength is reset to 0.
Ladder diagram
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 179
Chapter 9 Communication instructions
180 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Message cancellation
If the Cancel parameter is set, and the message is enabled (EN bit is set) and not
done (DN bit is not set), then the message execution is aborted and the ER bit is
set.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 181
Chapter 9 Communication instructions
182 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 183
Chapter 9 Communication instructions
• "<local port>, <1st target’s address>, [<1st target’s local port>, <2nd
target’s address>]"
The 1st hop must be present; the 2nd hop is optional.
184 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Local port of the 1st Target Local port used to send out the message.
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 connection is
message's local port is Ethernet. 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 connection is
message's local port is Ethernet. established.
Message execution is completed, and ConnClose is set to True. If there is only one connection to the target, the connection is 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.
Message execution is completed, and ConnClose is set to False. The connection is not closed.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 185
Chapter 9 Communication instructions
Scenario Results
Connection is not associated with an active message, and The connection is closed.
remains idle for the amount of time specified in ConnTimeOut
parameter.
Controller transitions from an executing mode (Run, Remote All active connections are forcibly closed.
Run, Remote Test Single Scan and Remote Single Rung) to a
non-executing mode.
186 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
MSG_CIPSYMBOLIC operation
When the function block is enabled, the receive buffers for the Read operations
are cleared on the rising edge of Enable. See the Message execution processes and
timing diagrams (on page 211) for examples.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 187
Chapter 9 Communication instructions
Ladder diagram
188 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 189
Chapter 9 Communication instructions
• Be 40 characters or less.
Symbol syntax
The following table defines the valid syntax for symbols.
Note: Only global variables are supported.
190 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Message cancellation
If the Cancel parameter is set, and the message is enabled (EN bit is set) and not
done (DN bit is not set), then the message execution is aborted and the ER bit is
set.
Action Results
Message is enabled Trigger timer starts
Trigger timer expires before the message Message is immediately triggered in the next
completes ladder scan cycle.
Message completes before the trigger time Message is triggered when the trigger time
expires expires.
192 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
- - - - - - - - - - - 4 3 2 1 0
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 193
Chapter 9 Communication instructions
194 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
• "<local port>, <1st target’s address>, [<1st target’s local port>, <2nd
target’s address>]"
The 1st hop must be present; the 2nd hop is optional.
Local port of the 1st Target Local port used to send out the message.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 195
Chapter 9 Communication instructions
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 connection is
message's local port is Ethernet. 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 connection is
message's local port is Ethernet. established.
Message execution is completed, and ConnClose is set to True. If there is only one connection to the target, the connection is 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.
Message execution is completed, and ConnClose is set to False. The connection is not closed.
Connection is not associated with an active message, and The connection is closed.
remains idle for the amount of time specified in ConnTimeOut
parameter.
Controller transitions from an executing mode (Run, Remote All active connections are forcibly closed.
Run, Remote Test Single Scan and Remote Single Rung) to a
non-executing mode.
196 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
MSG_MODBUS operation
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.
Arguments
Parameter Parameter Data type Description
type
IN Input BOOL If Rising Edge (IN turns from FALSE to TRUE), start the function block
with the precondition that the last operation has been completed.
Cancel Input BOOL TRUE - Cancel the execution of the function block.
LocalCfg Input MODBUSLOCPARA Define structure input (local device).
Defines the input structure for the local device.
See MODBUSLOCPARA data type (on page 199).
TargetCfg Input MODBUSTARPARA Define structure input (target device).
Defines the input structure for the target device.
See MODBUSTARPARA data type (on page 203).
LocalAddr Input MODBUSLOCADDR MODBUSLOCADDR is a 125 Word array that is used by Read commands
to store the data (1-125 words) returned by the Modbus slave and by
Write commands to buffer the data (1-125 words) to be sent to the
Modbus slave.
Q Output BOOL TRUE - MSG instruction is finished.
FALSE - MSG instruction is not finished.
Error Output BOOL TRUE - When error occurs.
FALSE - No error.
ErrorID Output UINT Show the error code when message transfer failed.
See Modbus error codes (on page 199).
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 197
Chapter 9 Communication instructions
Note: If a trigger is set to continuous, error codes are also continuously cleared. To view error codes,
add a rung before the MSG_MODBUS instruction.
198 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 199
Chapter 9 Communication instructions
Action Results
Message is enabled Trigger timer starts
Trigger timer expires before the message Message is immediately triggered in the next
completes ladder scan cycle.
Message completes before the trigger time Message is triggered when the trigger time
expires expires.
200 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 201
Chapter 9 Communication instructions
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.
202 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 203
Chapter 9 Communication instructions
MSG_MODBUS2 operation
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.
Arguments
When the MSG_MODBUS2 function block is enabled, the receive buffers for
Read operations are cleared on the rising edge of Enable.
204 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 205
Chapter 9 Communication instructions
206 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 207
Chapter 9 Communication instructions
Action Results
Message is enabled Trigger timer starts
Trigger timer expires before the message Message is immediately triggered in the next
completes ladder scan cycle.
Message completes before the trigger time Message is triggered when the trigger time
expires expires.
208 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
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 3000.
• A value less than 250 (minimum) will be set to 250.
• A value greater than 10,000 (maximum) will be set to 10,000.
See also Modbus/TCP message timeout timers (on page 209).
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 3000.
• A value less than 250 (minimum) will be set to 250.
• A value greater than 10,000 (maximum) will be set to 10,000.
See also Modbus/TCP message timeout timers (on page 209).
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 also Modbus/TCP message connections (on page 210).
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 209
Chapter 9 Communication instructions
Action Results
Connection is requested ConnMsgTimeout timer is activated
Scenario Results
Message request is enabled, and a connection to the target does If a connection to the target does not exist, a new connection is
not exist. . established.
If a connection to the target already exists, the existing connection is used.
Message execution is completed, and ConnClose is set to True. If there is only one connection to the target, the connection is closed.
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 ConnClose is set to False. The connection is not closed.
Connection is not associated with an active message, and The connection is closed.
remains idle for the amount of time specified in ConnTimeOut
parameter.
Controller transitions from an executing mode (Run, Remote All active connections are forcibly closed.
Run, Remote Test Single Scan and Remote Single Rung) to a
non-executing mode.
210 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 211
Chapter 9 Communication instructions
212 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 213
Chapter 9 Communication instructions
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.
214 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 215
Chapter 9 Communication instructions
216 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 217
Chapter 9 Communication instructions
218 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 219
Chapter 9 Communication instructions
This section provides specific details and examples for using communication
Using the 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.
220 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
4. Click Search.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 221
Chapter 9 Communication instructions
• Class Code
• Instance
• Instance Attribute
• Service
222 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
No Task
1 Identify initial values for the input variables (MSG_CIPGENERIC) (on page 223)
5 Add a COP function block, variables and contact (MSG_CIPGENERIC) (on page 229)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 223
Chapter 9 Communication instructions
2. Expand the Drives selection and locate the user manual for the type of
communication adapter you are using (EtherNet/IP Adapter User
Manual).
3. Double- click the manual to open it.
4. Review the Appendix headings to locate the section that provides
information about the EtherNet/IP objects that can be accessed using
Explicit Messages (Appendix C).
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 you will be retrieving.
• Expand the Controllers folder and the Micro850 folder to view all
Micro850 controllers.
224 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
• In the Toolbox, select Block and drag and drop it onto the ladder rung
to display the Block Selector.
• In the Variables page, add the variables and data types listed in the table.
2. For the MyResData variable, double click in Dimension and change the
array size to [1..81].
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 225
Chapter 9 Communication instructions
Result
The Variables page should look similar to the following image.
226 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Result
The parameters in the Variables page should look similar to the following image.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 227
Chapter 9 Communication instructions
2. From the list, assign each input parameter to its correct input variable as
identified in the following table.
Result
Your instance of the MSG_CIPGENERIC function block should look similar to
the following image.
228 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Result
The first rung of your ladder diagram program for MSG_CIPGENERIC
messaging should look similar to the following image.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 229
Chapter 9 Communication instructions
• In the Toolbox, select Block and drag and drop it onto the second
ladder rung to display the Block Selector.
• In the Variables page, add the variables and data types listed in the
following table.
2. For the CatalogID variable, double click in Dimension and change the
array size to [1..1]
Add a contact
1. 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.
2. In the Variable Selector, select the Convert_String variable for the contact.
Result
The second rung of your ladder diagram program for MSG_CIPGENERIC
messaging should look similar to the following image.
230 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Results
The Internet Protocol options in your controller configuration page should look
similar to the following image.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 231
Chapter 9 Communication instructions
232 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
1 Add a COP function block, variables and a contact (MSG_CIPSYMBOLIC) (on page 233)
3 Add a MSG_CIPSYMBOLIC function block, variables and a contact (on page 237)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 233
Chapter 9 Communication instructions
• Expand the Controllers folder and the Micro850 folder to view all
Micro850 controllers.
• In the Toolbox, select Block and drag and drop it onto the first ladder
rung to display the Block Selector.
• In the Variables page, add the variables and data types listed in the table
below.
2. Create Arrays:
234 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Add a contact
1. 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.
2. In the Variable Selector, assign a variable named Convert_Data to contact.
Result
The first rung of your ladder diagram program for MSG_CIPSYMBOLIC
messaging should look similar to the following image.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 235
Chapter 9 Communication instructions
• In the Toolbox, select Block and drag and drop it onto the second
ladder rung to display the Block Selector.
• In Search, type the '=' sign and double-click '=' to add an instance of
the operator to the ladder diagram.
Result
The second rung of your ladder diagram program for MSG_CIPGENERIC
messaging should look similar to the following image.
236 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
• In the Toolbox, select Block and drag and drop it onto the ladder rung
to display the Block Selector.
• 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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 237
Chapter 9 Communication instructions
• 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.
Results
The Local Variables selector should look similar to the following image.
238 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
A_TarCfg.UcmmTimeout 0
A_TarCfg.ConnMsgTimeout 0
A_TarCfg.ConnClose Leave blank
Results
The User Global Variables selector should similar to the following image.
Add a contact
1. 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.
2. In the Variable Selector, assign the WriteValue variable to the contact.
Result
The third rung of your ladder diagram program for MSG_CIPSYMBOLIC
messaging should look similar to the following image.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 239
Chapter 9 Communication instructions
Results
The Internet Protocol options in your controller configuration page should look
similar to the following image.
240 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 241
Chapter 9 Communication instructions
Results
The Global Variables selector should look similar to the following image.
242 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Controller B results
The following two images show the values for Controller B before and after the
messaging program is executed.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 243
Chapter 9 Communication instructions
244 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Micro830 wiring
This example uses a Micro830 controller with a SERIALISOL module plugged
into the first slot (Channel 5). A single PowerFlex 40 is connected, but the
diagram below shows how to wire for multi-drop. Refer to the user manual for
additional wiring information.
Drive status
An "1807" indicates the drive is
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 245
Chapter 9 Communication instructions
246 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 247
Chapter 9 Communication instructions
248 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Communication instructions Chapter 9
Modbus/TCP client and server Over the Ethernet instead of through a serial port MSG_MODBUS2 (on page 204)
Ethernet IP client and server Through an embedded Ethernet channel MSG_CIPSYMBOLIC (on page 187)
MSG_CIPGENERIC (on page 178)
CIP Serial client and server Ethernet cable or Serial cable MSG_CIPSYMBOLIC (on page 187)
ASCII Through an RS-232 port configured with an ASCII See ASCII serial port instructions
driver (on page 113)
Modbus RTU
Modbus is a half-duplex, master-slave communications protocol that allows a
single master to communicate with a maximum of 247 slave devices. The Modbus
network master reads and writes bits and registers. Modbus RTU is supported by
configuring the Serial port as Modbus RTU.
For more information about the Modbus protocol, refer to the Modbus Protocol
Specifications (available from http://www.modbus.org).
Modbus/TCP
The Modbus/TCP Server communication protocol uses the same Modbus
mapping features as Modbus RTU, but it is supported over the Ethernet instead of
through a Serial port.
The Micro850 controller supports up to 16 simultaneous Modbus TCP Server
connections. No protocol configuration is required other than configuring the
Modbus mapping table.
EtherNet/IP
Micro850 controllers support up to 16 simultaneous EtherNet/IP server
connections through an embedded Ethernet communication channel. The
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 249
Chapter 9 Communication instructions
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)
Micro830 and Micro850 controllers support CIP Serial through an RS-232
connection to external devices, such as computers running RSLinx Classic
software, PanelView Component terminals (firmware revisions 1.70 and above),
or other controllers that support CIP Serial over DF1 Full-Duplex, such as
ControlLogix and CompactLogix controllers that have embedded serial ports.
The Serial Port driver can be configured as CIP Serial, Modbus RTU, ASCII or
Shutdown through the device configuration tree.
250 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 10
Compare instructions
Operator Description
(=) Equal (on page 252) Compares the first input to the second input to determine equality for Integer,
Real, Time, Date, and String data types.
(>) Greater Than (on page 254) For Integer, Real, Time, Date, and String values, compares input values to
determine whether the first is greater than the second.
(>=) Greater Than or Equal (on page 255) For Integer, Real, Time, Date, and String values, compares input values to
determine whether the first is greater than or equal to the second.
(<) Less Than (on page 256) For Integer, Real, Time, Date, and String values, compares input values to
determine whether the first is less than the second.
(<=) Less Than or Equal (on page 257) For Integer, Real, Time, Date, and String values, compares input values to
determine whether the first is less than or equal to the second.
(<>) Not Equal (on page 258) For Integer, Real, Time, Date, and String values, compares input values to
determine whether the first is not equal to the second.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 251
Chapter 10 Compare instructions
Equal (=) compares the first input to the second input to determine equality for
Equal Integer, Real, Time, Date, and String data types.
Arguments
252 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Compare instructions Chapter 10
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 253
Chapter 10 Compare instructions
For Integer, Real, Time, Date, and String values, Greater Than compares input
Greater than values to determine whether the first is greater than the second.
Arguments
254 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Compare instructions Chapter 10
For Integer, Real, Time, Date, and String values, Greater Than or Equal compares
Greater than or equal input values to determine whether the first is greater than or equal to the second.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 255
Chapter 10 Compare instructions
For Integer, Real, Time, Date, and String values, Less Than compares input values
Less than to determine whether the first is less than the second.
Arguments
LD 10
LT 25
ST aresult
LD 'z'
LT 'B'
ST mresult
256 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Compare instructions Chapter 10
For Integer, Real, Time, Date, and String values, Less Than or Equal compares
Less than or equal input values to determine whether the first is less than or equal to the second.
Special recommendations
For TON, TP, and TOF, equality testing of Time values is not recommended.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 257
Chapter 10 Compare instructions
For Integer, Real, Time, Date, and String values, Not Equal compares input values
Not equal to determine whether the first is not equal to the second.
Arguments
258 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 11
Counter instructions
Function Description
CTD (on page 260) Block counts (integers) from a given value down to 0, 1 by 1.
CTU (on page 262) Counts (integers) from 0 up to a given value, 1 by 1.
CTUD (on page 264) Counts (integers) from 0 up to a given value, 1 by 1, or from a given value down to 0 (1 by
1).
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 259
Chapter 11 Counter instructions
Arguments
260 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Counter instructions Chapter 11
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 261
Chapter 11 Counter instructions
Arguments
Structure Text
262 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Counter instructions Chapter 11
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 263
Chapter 11 Counter instructions
Arguments
264 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Counter instructions Chapter 11
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 265
Chapter 11 Counter instructions
266 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 12
Data conversion instructions are used to convert the data type of a variable to a
different data type.
Operator Description
ANY_TO_BOOL (on page 268) Converts to Boolean
ANY_TO_BYTE (on page 269) Converts to BYTE
ANY_TO_DATE (on page 270) Converts to Date
ANY_TO_DINT (on page 271) Converts to Double Integer
ANY_TO_DWORD (on page 272) Converts to Double Word
ANY_TO_INT (on page 273) Converts to Integer
ANY_TO_LINT (on page 274) Converts to Long Integer
ANY_TO_LREAL (on page 275) Converts to Long real
ANY_TO_LWORD (on page 276) Converts to Long Word
ANY_TO_REAL (on page 277) Converts to Real
ANY_TO_SINT (on page 278) Converts to Short Integer
ANY_TO_STRING (on page 279) Converts to String
ANY_TO_TIME (on page 280) Converts to Time
ANY_TO_UDINT (on page 281) Converts to Unsigned Double Integer
ANY_TO_UINT (on page 282) Converts to Unsigned Integer
ANY_TO_ULINT (on page 283) Converts to Unsigned Long Integer
ANY_TO_USINT (on page 284) Converts to Unsigned Short Integer
ANY_TO_WORD (on page 285) Converts to Word
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 267
Chapter 12 Dataconversion instructions
Arguments
268 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 269
Chapter 12 Dataconversion instructions
Arguments
270 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 271
Chapter 12 Dataconversion instructions
Arguments
272 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 273
Chapter 12 Dataconversion instructions
Arguments
274 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 275
Chapter 12 Dataconversion instructions
Arguments
276 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 277
Chapter 12 Dataconversion instructions
Arguments
278 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 279
Chapter 12 Dataconversion instructions
Arguments
280 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 281
Chapter 12 Dataconversion instructions
Arguments
282 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 283
Chapter 12 Dataconversion instructions
Arguments
284 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Dataconversion instructions Chapter 12
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 285
Chapter 13
Data manipulation instructions are used to alter the output data to change the
status without altering the program.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 287
Chapter 13 Datamanipulation instructions
AVERAGE stores a value at each cycle and calculates the average value of all
AVERAGE already stored values. Only the N last values are stored.
• If the RUN command is FALSE (reset mode), the output value is equal to
the input value.
• When the maximum number of stored values is reached, the first stored
value is erased by the last one.
Arguments
288 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Datamanipulation instructions Chapter 13
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 289
Chapter 13 Datamanipulation instructions
COP copies the binary data in the Source to the Destination, and leaves the
COP source value unchanged.
Arguments
Parameter Parameter type Data type Description
Enable Input BOOL Function block enable. This FB is level triggered.
When Enable=TRUE, perform copy.
When Enable=FALSE, the function block will not be
executed.
Src Input BOOL DWORD Initial element to copy.
SINT REAL If the source or destination is a String data type, the other
USINT TIME party must also be a String data type, or a USINT (UCHAR
BYTE DATE and BYTE) data type. If it is not, a data type mismatch will
be reported.
INT STRING
See also Copying to a different data type (on page 293).
UINT LWORD
WORD ULINT
DINT LINT
UDINT LREAL
290 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Datamanipulation instructions Chapter 13
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 291
Chapter 13 Datamanipulation instructions
292 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Datamanipulation instructions Chapter 13
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 293
Chapter 13 Datamanipulation instructions
Arguments
Ladder diagram
Structured text
294 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Datamanipulation instructions Chapter 13
(* ST Equivalence: *)
new_value := MAX (MIN (max_value, value), min_value);
(* bounds the value to the [min_value..max_value] set *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 295
Chapter 13 Datamanipulation instructions
Arguments
Ladder diagram
296 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Datamanipulation instructions Chapter 13
Structured text
(* ST Equivalence: *)
new_value := MAX (MIN (max_value, value), min_value);
(* bounds the value to the [min_value..max_value] set *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 297
Chapter 14
High-speed counter instructions are used to monitor and control the high-speed
counter.
HSC_SET_STS (on page HSC_SET_STS manually sets or resets the HSC counting status.
321)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 299
Chapter 14 High-SpeedCounter (HSC)instructions
A high-speed counter detects and counts narrow (fast) pulses and then issues
What is a High-Speed 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.
300 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
HSC applies high presets, low presets and output source values to the high-speed
HSC counter.
Arguments
HSCStsInfo Input HSCSTS HSC dynamic status, which is continuously updated during HSC counting.
See HSCSTS data type (on page 310).
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 301
Chapter 14 High-SpeedCounter (HSC)instructions
HSCCmd values
The following table describes the HSC commands for each HSC command value.
302 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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).
HscCmd =1 Starts the HSC mechanism, and the HSC Setting the Enable input parameter to False does not stop
transitions to running mode. counting while in running mode.
HscCmd =2 must be issued to stop counting.
The HSC mechanism automatically updates HSC AppData.Accumalator is updated with HSC Sts.Accumulator
values.
HscCmd =4 Sets the HSC Acc value to the HSC HscCmd =4 does not stop HSC counting.
(reset) AppData.Accumalator value. If HSC is counting when HscCmd =4 is issued, some counting may
be lost
To set a specific value to HSC Acc while counting, write the value
to HSC AppData.Accumalator immediately before HscCmd =4 is
issued.
HSCAppData parameters
The following table lists the HSCAppData parameters.
Parameter Data type Data format User program Description
access
PLSEnable BOOL bit read/write Enable or disable the Programmable Limit Switch (PLS).
HSCID UINT word read/write Defines the HSC.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 303
Chapter 14 High-SpeedCounter (HSC)instructions
PLSEnable
Parameter Data type Data format User program access
HSCApp.PLSEnable BOOL bit read/write
Enables and disables the High-Speed Counter Programmable Limit Switch (PLS)
function.
HSCID
Parameter Data type Data format User program access
HSCApp.HSCID UINT word read/write
304 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
Identifies the High-Speed Counter to be used. The following table lists the values
for defining the HSC ID:
Output Selection Bit Description
First word of HSC Function Data 15-13 Module type of HSC:
• 0x00 - Embedded.
• 0x01 - Expansion.
• 0x02 - Plug-in Port.
12-8 Slot ID of the module:
• 0x00 - Embedded.
• 0x01-0x1F - ID of Expansion Module.
• 0x01-0x05 - ID of Plug-in Port.
7-0 HSC ID inside the module:
• 0x00-0x0F - Embedded.
• 0x00-0x07 - ID of HSC for Expansion.
• 0x00-0x07 - ID of HSC for Plug-in Port.
Note: For the initial version of Connected Components
Workbench, only IDs 0x00-0x05 are supported.
HSCMode
Parameter Data type User program access
HSCApp.HSCMode UINT read/write
Set the High-Speed Counter to one of 10 types of counting modes. The mode
value is configured through the programming device and is accessible in the
control program.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 305
Chapter 14 High-SpeedCounter (HSC)instructions
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.
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.
1. In the Help menu, click User Manuals, expand Controllers and then the
controller category.
2. Double-click the controller user manual in the controller category to open a
pdf of the manual.
Accumulator
Parameter Data type User program access
HSCApp.Accumulator DINT read/write
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.
HPSetting
Parameter Data type User program access
HSCApp.HPSetting DINT read/write
306 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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.
LPSetting
Parameter Data type User program access
HSCApp.LPSetting DINT read/write
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 an absolute value smaller than the underflow.
OFSetting
Parameter Data type User program access
HSCApp.OFSetting DINT read/write
Overflow setting that defines the upper count limit for the counter.
• When the overflow interrupt is generated, the HSC sub-system resets the
accumulator value to the underflow value and the counter continues
counting from the underflow value (counts are not lost in this transition).
OFSetting values must be:
UFSetting
Parameter Data type User program access
HSCApp.UFSetting DINT read/write
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 307
Chapter 14 High-SpeedCounter (HSC)instructions
Underflow setting that defines the lower count limit for the counter.
• When the underflow interrupt is generated, the HSC sub-system resets the
accumulated value to the overflow value and the counter starts counting
from the overflow value (counts are not lost in the transition).
UFSetting values must be:
OutputMask
Parameter Data type User program access
HSCApp.OutputMask UDINT read/write
Defines the embedded outputs on the controller that the High-Speed Counter
can directly control. The HSC sub-system can, without control program
interaction, turn outputs ON or OFF based on the High or Low presets of the
HSC accumulator.
• Bits that are set (1) are enabled and can be turned on or off by the HSC
sub-system.
• Bits that are set (0) cannot be turned on or off by the HSC sub-system.
For example, to use the HSC to control outputs 0, 1, 3, assign:
• HscAppData.OutputMask = 2#1011, or
• HscAppData.OutputMask = 11
HPOutput
Parameter Data type User program access
308 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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, see OutputMask.
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
Parameter Data type User program access
HSCApp.LPOutput UDINT read/write
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 309
Chapter 14 High-SpeedCounter (HSC)instructions
• If the HSC function block is counting with command 0x01, the HSC status
is continuously updated.
HSCSTSInfo parameters
The following table describes the HSCSTSInfo parameters.
310 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
CountEnable
Parameter Data type HSC mode User program access
HSCSTS.CountEnable BOOL 0...9 read only
Indicates the status of the High-Speed Counter, whether counting is enabled (1)
or disabled (0, default).
ErrorDetected
Parameter Data type HSC mode User program access
HSCSTS.ErrorDetected BOOL 0...9 read/write
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
Parameter Data type HSC mode User program access
HSCSTS.CountUpFlag BOOL 0...9 read only
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
Parameter Data type HSC mode User program access
HSCSTS.CountDownFlag BOOL 2...9 read only
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 311
Chapter 14 High-SpeedCounter (HSC)instructions
Mode1Done
Parameter Data type HSC mode User program access
HSCSTS.Mode1Done BOOL 0 or 1 read/write
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
Parameter Data type HSC mode User program access
HSCSTS.OVF BOOL 0...9 read/write
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.
Overflow conditions do not generate a controller fault.
UNF
Parameter Data type HSC mode User program access
HSCSTS.UNF BOOL 0...9 read/write
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.
Underflow conditions do not generate a controller fault.
CountDir
Parameter Data type HSC mode User program access
HSCSTS.CountDir BOOL 0...9 read only
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).
312 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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
Parameter Data type HSC mode User program access
HSCSTS.HPReached BOOL 2...9 read/write
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
Parameter Data type HSC mode User program access
HSCSTS.LPReached BOOL 2...9 read only
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
Parameter Data type HSC mode User program access
HSCSTS.OFCauseInter BOOL 0...9 read/write
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:
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 313
Chapter 14 High-SpeedCounter (HSC)instructions
UFCauseInter
Parameter Data type HSC mode User program access
HSCSTS.UFCauseInter BOOL 2...9 read/write
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
Parameter Data type HSC mode User program access
HSCSTS.HPCauseInter BOOL 0...9 read/write
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
Parameter Data type HSC mode User program access
314 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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
Parameter Data type HSC mode User program access
HSCSTS.PLSPosition UINT 0...9 read only
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
Parameter Data type HSC mode User program access
HSCSTS.ErrorCode BOOL 0...9 read only
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 315
Chapter 14 High-SpeedCounter (HSC)instructions
Accumulator
Parameter Data type User program access
HSCApp.Accumulator DINT read/write
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
Parameter Data type User program access
HSCSTS.HP DINT read only
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
Parameter Data type HSC mode User program access
HSCSTS.LP DINT read only
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
Parameter Data type User program access
316 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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, see OutputMask.
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
Parameter Data type User program access
HSCApp.LPOutput UDINT read/write
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 317
Chapter 14 High-SpeedCounter (HSC)instructions
The total number of elements for one PLS data structure should not exceed 255.
318 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
PLSData parameters
The following table lists the PLSData parameter details.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 319
Chapter 14 High-SpeedCounter (HSC)instructions
320 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 321
Chapter 14 High-SpeedCounter (HSC)instructions
322 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 323
Chapter 14 High-SpeedCounter (HSC)instructions
This section provides specific details and examples for using high-speed counter
Using the High-Speed instructions in logic programs, including the following:
Counter instructions
Updating 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.
To update the HSC configuration
• Update HSCAppData.
• Configure the interrupt properties, such as ID and the program to use it in.
324 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
Micro830 and Micro850 controllers support up to six HSC User Interrupts that
can be used to execute selected user logic at a pre-configured event.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 325
Chapter 14 High-SpeedCounter (HSC)instructions
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 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.
326 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
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.
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.
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 327
Chapter 14 High-SpeedCounter (HSC)instructions
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.
328 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
• 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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 329
Chapter 14 High-SpeedCounter (HSC)instructions
No Task
4 Test the program and run the High-Speed Counter (on page 337)
330 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
2. Expand he 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.
3. In the Project Organizer, right-click Programs, click Add, and then click
New LD: Ladder Diagram to add a new ladder logic program.
4. Right-click UntitledLD and select Open.
5. In the Toolbox:
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 331
Chapter 14 High-SpeedCounter (HSC)instructions
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.
332 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
Result
The Variables page should look similar to the following image.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 333
Chapter 14 High-SpeedCounter (HSC)instructions
• See HSCMode in HSCAPP data type (on page 303) for more
information on the description for each value.
3. Assign the rest of the values to the MyAppData variables as shown in the
following figure.
334 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
• See HSCAPP data type (on page 303) for more information on the
description for each value
• See HSCCmd values (on page 302) for more information on command
values.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 335
Chapter 14 High-SpeedCounter (HSC)instructions
1. From the ladder diagram, assign each variable to its HSC function block
element as shown in the following figure.
2. From the Project Organizer, click the controller to display the controller
tree.
336 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
3. From the controller tree, click Embedded I/O, and select input filters for
your encoder.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 337
Chapter 14 High-SpeedCounter (HSC)instructions
While in debug mode, you can see the values of the two HSC outputs: STS
(MyStatus) and HSCSTS (MyInfo).
1. Double-click the _IO_EM_DI_05 direct contact to display the Variable
Selector window.
2. Click the I/O Micro830 tab, and then click the _IO_EM_DI_05 row.
3. Select Lock and Logical Value to force the input to the ON position.
338 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
To view results
1. Click the Local Variables tab to view variable changes.
2. Expand MyAppData and MyInfo variable list.
3. 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.
4. Verify the Logical Value of in the MyStatus variable is 1, which indicates the
HSC is running.
5. View the counter value in MyInfo.Accumulator.
Tip: See HSC status codes (STS) (on page 320) for the complete list of
status codes.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 339
Chapter 14 High-SpeedCounter (HSC)instructions
Results
In this example, once MyInfo.Accumulator reaches a High Preset value of 40,
output 0 turns on and the HPReached flag turns on. If MyInfo.Accumulator
reaches a Low Preset value of -40, output 1 turns on and the LPReached flag turns
on as well.
340 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
To enable PLS
1. In the Project Organizer, double-click Local Variables to display the
Variables page.
2. Enable the PLS function:
Results
In this example, the PLS variable has a dimension of [1..4]. This means that
the HSC can have four pairs of High and Low Presets.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 341
Chapter 14 High-SpeedCounter (HSC)instructions
• High Presets should always be set lower than the OFSetting and the
Low Preset should always be greater than the UFSetting.
342 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
High-SpeedCounter (HSC)instructions Chapter 14
• HSCApp.OutputMask = 31
• HSCApp.HSCMode = 0
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 343
Chapter 14 High-SpeedCounter (HSC)instructions
• Sending the high preset output throught the output mask repeats as the
HSCSTS.Accumulator reaches 500, 750, and 1000, and the controller
energizes outputs 0...2, 0...3, and 0...4 respectively.
• After the full operation completes, the cycle resets and repeats from
HSCSTS.HP = 250.
344 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 15
Input/Output instructions
Function Description
LCD (on page 346) Display string or number
(Micro810™ only)
LCD_BKLT_REM (on page 349) Change remote LCD backlight color and mode
LCD_REM (on page 352) Display messages on remote LCD
RHC (on page 357) Read high-speed clock
RPC (on page 359) Reads user program checksum
Function block Description
DLG (on page 360) Save data and global/local variables to an SD Card Data Log file
IIM (on page 363) Update inputs prior to normal output scan
IOM (on page 366) Update outputs prior to normal output scan
KEY_READ (on page 369) Read key status on the optional LCD module
(Micro810™ only)
KEY_READ_REM (on page 372) Read key status on remote LCD
MM_INFO (on page 376) Read memory module header information
PLUGIN_INFO (on page 379) Get module information from a generic plug-in module (excluding Memory Module)
PLUGIN_READ (on page 382) Read data from a generic plug-in module
PLUGIN_RESET (on page 385) Reset a generic plug-in module (hardware reset)
PLUGIN_WRITE (on page 387) Write data to a generic plug-in module
RCP (on page 389) Read/write recipe data to and from an SD memory card
RTC_READ (on page 393) Read real-time clock (RTC) module information
RTC_SET (on page 396) Set real-time clock data to real-time clock module
SYS_INFO (on page 398) Read Micro800™ system status
TRIMPOT_READ (on page 401) Read the trimpot value from a specific trimpot
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 345
Chapter 15 Input/Output instructions
Arguments
346 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := LCD(LCDENABLE, LINE1, LINE2, LINE3, LINE4) ;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 347
Chapter 15 Input/Output instructions
Results
348 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
LCD_BKLT_REM operation
• LCD_BKLT_REM is supported for Micro820 controllers only.
• When the Enable Input goes false the last menu settings will take effect.
LCD_BKLT_REM arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 349
Chapter 15 Input/Output instructions
350 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 351
Chapter 15 Input/Output instructions
LCD_REM function block can be used in a program to display user strings on the
LCD_REM Remote LCD when it is present and connected. This function block is only
supported by the Micro820.
LCD_REM operation
• LCD_REM is supported for Micro820 controllers only.
LCD_REM arguments
352 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 353
Chapter 15 Input/Output instructions
354 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 355
Chapter 15 Input/Output instructions
356 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Arguments
Ladder diagram
Structured text
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 357
Chapter 15 Input/Output instructions
(* ST Equivalence: *)
TESTOUTPUT2 := RHC() ;
358 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RPC reads the user program checksum, either from the controller or Memory
RPC Module.
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT2 := RPC(TESTINPUT) ;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 359
Chapter 15 Input/Output instructions
The Data Logging Function Block can be used to write variable values from the
DLG run-time engine into a Data Logging File on an SD Card.
Important: 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.
DLG operation
• DLG is supported for Micro820 controllers only.
DLG arguments
360 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 361
Chapter 15 Input/Output instructions
362 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
IIM executes an immediate input instruction to update the input data without
IIM having to wait until the beginning of the next input scan.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 363
Chapter 15 Input/Output instructions
Results
364 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 365
Chapter 15 Input/Output instructions
IOM executes an immediate embedded output data update without waiting for
IOM the automatic output scan.
Arguments
366 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 367
Chapter 15 Input/Output instructions
Results
368 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
KEY_READ operation
The KEY_READ function block is available for Micro810 controllers only.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 369
Chapter 15 Input/Output instructions
370 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
(* 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 ;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 371
Chapter 15 Input/Output instructions
KEY_READ_REM checks Key status on a Remote LCD module when the user
KEY_READ_REM display is active. This is only available for the Micro820.
KEY_READ_REM operation
• KEY_READ_REM is supported for Micro820 controllers only.
• This function block can be used to check Key status on Remote LCD
module when user display is active (LCD_REM instruction is used to make
User Display Active). When User display is not active, KEY_READ_REM
instruction flags an error.
KEY_READ_REM arguments
372 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 373
Chapter 15 Input/Output instructions
KEY_READ_REM operation
• KEY_READ_REM is supported for Micro820 controllers only.
• This function block can be used to check Key status on Remote LCD
module when user display is active (LCD_REM instruction is used to make
User Display Active). When User display is not active, KEY_READ_REM
instruction flags an error.
374 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 375
Chapter 15 Input/Output instructions
Arguments
376 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 377
Chapter 15 Input/Output instructions
378 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
PLUGIN_INFO reads the Plug-in Generic Module Information. It can read any
PLUGIN_INFO Plug-in module information except for 2080-MEMBAK-RTC modules. When a
Plug-in Generic Module is not present, all values return to zero (0).
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 379
Chapter 15 Input/Output instructions
380 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 381
Chapter 15 Input/Output instructions
Arguments
382 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 383
Chapter 15 Input/Output instructions
384 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 385
Chapter 15 Input/Output instructions
Results
386 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 387
Chapter 15 Input/Output instructions
388 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Recipe C Function Block can be used to read a variable’s data value from the
RCP recipe data file which exists in the recipe data file folder of SD card and update the
value to the run-time engine. The Recipe C Function Block can be used to write
the variable value with the run time engine into the recipe data file in the SD card.
RCP operation
• RCP is supported for Micro820 controllers only.
RCP arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 389
Chapter 15 Input/Output instructions
390 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 391
Chapter 15 Input/Output instructions
392 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RTC_READ operation
• When used with a Micro810 controller with embedded RTC, RTCBatLow
is always set to zero (0).
• When the embedded RTC has lost its charge/memory due to loss of power,
RTCEnabled is always set to zero (0).
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 393
Chapter 15 Input/Output instructions
Structured Text
394 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 395
Chapter 15 Input/Output instructions
Arguments
RTCEnable Input BOOL TRUE - To enable RTC with the RTC data specified.
FALSE - To disable RTC.
Note: This is ignored by Micro810 controllers.
396 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 397
Chapter 15 Input/Output instructions
Arguments
Results
398 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 399
Chapter 15 Input/Output instructions
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.
Note: Only supported for Micro830 and Micro850 controllers. Value for Micro810 controllers remains 0.
400 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 401
Chapter 15 Input/Output instructions
Trimpot ID definition
The following table describes the Trimpot ID definition.
402 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Input/Output instructions Chapter 15
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 403
Chapter 16
Interrupt instructions
Interrupt instructions are used 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 406) Start the STI timer from the control program rather than starting automatically
UIC (on page 408) Clears specific user interrupt
UID (on page 410) Disable specific user interrupt
UIE (on page 412) Enable specific user input
UIF (on page 414) Flush specific user input
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 405
Chapter 16 Interrupt instructions
Arguments
406 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Interrupt instructions Chapter 16
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := STIS(TESTENABLE, 2, 1000) ;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 407
Chapter 16 Interrupt instructions
UIC clears Interrupt Lost bit for the selected User Interrupt(s).
UIC
Arguments
408 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Interrupt instructions Chapter 16
Ladder diagram
Structure text
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 409
Chapter 16 Interrupt instructions
Arguments
410 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Interrupt instructions Chapter 16
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := UID(TESTENABLE, 2) ;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 411
Chapter 16 Interrupt instructions
Arguments
412 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Interrupt instructions Chapter 16
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := UIE(TESTENABLE, 2) ;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 413
Chapter 16 Interrupt instructions
UIF flushes (removes) a pending user interrupt for selected user interrupt(s).
UIF
Arguments
414 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Interrupt instructions Chapter 16
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := UIF(TESTENABLE, 2) ;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 415
Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 417
Chapter 17 Motioncontrol instructions
The general rules for the Micro800 motion control function blocks follow the
General rules for motion PLCopen Motion control specifications. The following table provides general
control function blocks rules about the interface of motion control function blocks.
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 limits If a function block is commanded with parameters that result in a violation of 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.
418 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
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 CommandAborted The CommandAborted output is set when a commanded motion is interrupted by 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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 419
Chapter 17 Motioncontrol instructions
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 types Due to the naming constraints in the IEC standard on the uniqueness of variable 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.
420 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
The following topics provide details for motion control parameters that are
Motion control function 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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 421
Chapter 17 Motioncontrol instructions
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.
422 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
• MC_ReadParameter
• MC_ReadBoolParameter
• MC_WriteParameter
• MC_WriteBoolParameter
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 423
Chapter 17 Motioncontrol instructions
13 MaxAccelerationAppl REAL R/W Maximal allowed acceleration of the axis in the application.
14 MaxDecelerationSystem REAL R Maximal allowed deceleration of the axis in the system.
15 MaxDecelerationAppl REAL R/W Maximal allowed deceleration of the axis in the application.
16 MaxJerk REAL R/W Maximal allowed jerk of the axis.
1001 TargetPosition REAL R The final target position for current active moving function block
1002 TargetVelocity1 REAL R The final target velocity for current active moving function block.
1005 Duty Cycle REAL R/W The pulse duty cycle for one pulse. The valid value is 0 – 100, indicating 0% -
100%. (PWM function can be realized by adjusting this value).
This parameter is configurable only using this Function Block. The default value is
set 50.0 by the controller.
Note: For Duty Cycle, the value will be overwritten by the default setting, 50.0
when the controller is switched from RUN mode to PRG and RUN again, or when
the controller power is cycled.
1006 PulsePerRevolution REAL R The Pulse per Revolution setting input by user in CCW GUI.
1007 TravelPerRevolution REAL R The Travel per Revolution setting input by user in CCW GUI.
424 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
03 MC_FB_ERR_ The function block cannot execute because there is invalid parameter other than velocity, acceleration,
PARAM 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 configuration data is corrupted, or the
AXISNUM axis is not correctly configured.
05 MC_FB_ERR_ The function block cannot execute because this axis gets a fault due to drive or mechanical issues. Check the
MECHAN 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 block is controlled by some other
RESOURCE 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 block cannot be achieved.
PROFILE Correct the profile in the function block.
09 MC_FB_ERR_ The function block cannot execute because the motion profile requested in the function block cannot be achieved
VELOCITY 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 the function block is aborted
SOFT_LIMIT 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 during axis movement, or
HARD_LIMIT 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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 425
Chapter 17 Motioncontrol instructions
0D MC_FB_ERR_ A motion engine execution error is detected during the execution of this function block.
ERR_ENGINE 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.
Scenario Example
A movement function block instructs an axis, but the axis is in a state in which the The axis has no power, or the axis is in a Homing
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 controlled by another The new function block commands the axis to change
movement function block. The axis cannot allow the motion to be controlled by the new motion direction.
function block without going to a full stop.
When one movement function block tries to control an axis, but the axis is still controlled User Application issues an S-Curve MC_MoveAbsolute
by another movement function block, and the newly-defined motion profile cannot be function block to an axis with too short a distance given
realized by the controller. when the axis is moving.
426 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
ConstVel BOOL Indicates whether the axis is in Constant Velocity movement or not. Stationary axis is not considered
in Constant Velocity.
AccFlag BOOL Indicates whether the axis is in an Accelerating movement or not.
DecelFlag BOOL Indicates whether the axis is in an Decelerating movement or not.
AxisState USINT Indicates the current state of the 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.
TargetPos REAL Indicates the final target position of the axis for MoveAbsolute and MoveRelative function blocks.
For MoveVelocity, Stop, and Halt function blocks, TargetPos is 0 except when the TargetPos set by
previous position function blocks is not cleared.
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.
Important: Once an axis is flagged with and error, and the error ID is not zero, the axis must be reset using MC_Reset before issuing any other movement
function block.
Axis variables
Axis variables are used to control position, speed, acceleration, and error for a
given motion control axis.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 427
Chapter 17 Motioncontrol instructions
428 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_AbortTrigger operation
• The MC_AbortTrigger function block only executes when it is assigned to
an axis that is controlled by MC_TouchProbe.
Arguments
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
TriggerInp Input USINT This parameter is ignored.
Execute Input BOOL When TRUE, aborts the trigger event at the rising edge.
ENO Output BOOL Enable out.
Applies only to LD programs.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 429
Chapter 17 Motioncontrol instructions
430 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 431
Chapter 17 Motioncontrol instructions
MC_Halt commands a controlled motion stop. Use MC_Halt to stop the axis
MC_Halt under normal operating conditions. The axis state changes to DiscreteMotion,
until velocity is zero. When velocity reaches zero, Done is set to True and the axis
state changes to StandStill.
MC_Halt operation
• It is possible to execute another motion command during deceleration of
the axis, which aborts the MC_Halt function block.
• If an MC_Halt function block is issued when the axis state is Homing, the
function block reports an error, and the homing process is not interrupted.
Arguments
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
Execute Input BOOL When TRUE, start the motion at rising edge.
Note: Executing MC_Halt during homing, MC_Halt is set to MC_FB_ERR_STATE
and the homing process continues.
Deceleration Input REAL Value of the deceleration (always positive) (decreasing energy of the
motor).
Note: If Deceleration <= 0 and the axis state is not Standstill, MC_Halt is set to
MC_FB_ERR_RANGE.
432 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 433
Chapter 17 Motioncontrol instructions
Results
434 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 435
Chapter 17 Motioncontrol instructions
MC_Power commands the axis to perform the <search home> sequence. The
MC_Home details of this sequence are manufacturer dependent and can be set by the axis
parameters. The "Position" input is used to set the absolute position when a
reference signal is detected, and the configured Home offset is reached.
MC_Home operation
• 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.
Arguments
436 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Busy Output BOOL When TRUE, the function block is not finished.
Active Output BOOL When TRUE, indicates that the function block has control on the axis.
CommandAborted Output BOOL When TRUE, command was aborted by another command, or error
stop.
Error Output BOOL When TRUE, an error was detected.
ErrorID Output UNIT Error identification.
See also Motion control function block error IDs (on page 424).
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 437
Chapter 17 Motioncontrol instructions
438 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
Homing modes
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"
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 439
Chapter 17 Motioncontrol instructions
440 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_MoveAbsolute operation
• For a Micro800 controller, the sign of the input Velocity for a
MC_MoveAbsolute function block is ignored because the motion direction
is determined by the Current position and the Target position.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 441
Chapter 17 Motioncontrol instructions
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
Execute Input BOOL When TRUE, starts the motion at rising edge.
The axis should be in the home position when this execute command is issued or an
error occurs, MC_FB_ERR_NOT_HOMED.
Position Input REAL Target position for the motion in technical unit (negative or positive).
Note: The technical unit is defined in the Motion - General configuration page for an axis.
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
Note: 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.
Busy Output BOOL When TRUE, the function block is not finished.
442 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 443
Chapter 17 Motioncontrol instructions
Results
444 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 445
Chapter 17 Motioncontrol instructions
MC_MoveRelative operation
• Because the motion direction for a MC_MoveRelative function block is
determined by the current position and the target position, the sign of the
Velocity is ignored.
Arguments
Parameter Parameter Data type Description
type
EN Input BOOL Function block enable.
When EN = TRUE, execute current MC_MoveRelative computation.
When EN = FALSE, there is no computation.
Applies only to LD programs.
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
446 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
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 out.
Applies only to LD programs.
Axis Output AXIS_REF Axis output is read-only in LD programs.
See also AXIS_REF data type (on page 426).
Done Output BOOL When TRUE, commanded distance reached.
When the In-Position input is enabled for an axis, the In-Position signal
must be set to active before Done = True.
Busy Output BOOL When TRUE, the function block is not finished.
Active Output BOOL When TRUE, indicates that the function block has control on the axis
CommandAborted Output BOOL Command is aborted by another command, or Error Stop.
Error Output BOOL When TRUE, an error was detected.
ErrorID Output UINT Error identification.
See also Motion control function block error IDs (on page 424).
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 447
Chapter 17 Motioncontrol instructions
448 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 449
Chapter 17 Motioncontrol instructions
450 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_MoveVelocity operation
• If the MC_MoveVelocity function block DirectionIn input is equal to 0
and the axis is in a moving state, the sign of the Velocity input is ignored,
the axis continues to move in its current direction, and new dynamic
parameters are applied.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 451
Chapter 17 Motioncontrol instructions
452 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 453
Chapter 17 Motioncontrol instructions
Results
454 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 455
Chapter 17 Motioncontrol instructions
MC_Power operation
• After axis power On completes, the axis Homed status is reset to 0 (not
homed).
• If power fails during operation (when Servo ready has been detected) the
axis state goes to ErrorStop.
• If the MC_Power function block with Enable set to True is called while the
axis state is Disabled, the axis state goes to StandStill if there is not an error,
or the axis state goes to ErrorStop if there is an error.
• Only one MC_Power function block should be issued per axis. Using a
different MC_ Power function block to control the same axis
simultaneously will be rejected by the Motion Engine.
• When there is a Power On/Off state switch for an axis, the absolute axis
position is not reset.
• If the MC_Power function block with Enable set to False is called, the axis
state goes to Disabled for every state including ErrorStop. The MC_Power
function block can do the following:
• Power on the axis if Enable is set to True; Power off the axis if Enable is set
to False.
Arguments
456 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 457
Chapter 17 Motioncontrol instructions
Results
458 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 459
Chapter 17 Motioncontrol instructions
MC_ReadAxisError operation
• When an axis is in a Disabled state, the MC_ReadAxisError function block
may or may not get a non-zero Error ID for the axis as a Disabled axis can
contain errors or be error-free.
Arguments
460 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 461
Chapter 17 Motioncontrol instructions
Results
462 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
08 MC_FB_ERR_ The axis is not operational because the motion profile defined in a function block is invalid.
PROFILE Reset the state of the axis using the MC_Reset function block.
Correct the profile in the function block.
09 MC_FB_ERR_ The axis is not operational because the motion profile requested in a function block conflicts
VELOCITY 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_Reset function block.
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 the
SOFT_LIMIT function block would cause a Soft Limit error.
Reset the state of the axis using the MC_Reset function block.
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 463
Chapter 17 Motioncontrol instructions
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_Reset function block.
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.
464 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_ReadBoolParameter operation
When the MC_ReadBoolParameter function block Enable input is set to False,
the Value output is reset to 0.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 465
Chapter 17 Motioncontrol instructions
466 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 467
Chapter 17 Motioncontrol instructions
MC_ReadParameter operation
• When the MC_ReadParameter function block Enable input is set to False,
the Value output is reset to 0.
Arguments
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
Enable Input BOOL When TRUE, gets the value of the parameter continuously.
468 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 469
Chapter 17 Motioncontrol instructions
Results
470 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_ReadStatus returns the status of the axis with respect to the motion
MC_ReadStatus currently in progress.
MC_ReadStatus operation
When the MC_ReadStatus function block Enable is set to False, all status outputs
are reset to False or 0.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 471
Chapter 17 Motioncontrol instructions
472 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 473
Chapter 17 Motioncontrol instructions
474 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 475
Chapter 17 Motioncontrol instructions
MC_Reset transitions the axis state from ErrorStop to StandStill by resetting all
MC_Reset internal axis-related errors. The outputs of the function block instances are not
changed.
MC_Reset operation
The MC_Reset function block only resets the axis state from ErrorStop to
StandStill. The application of MC_Reset function block in other states, including
Disabled, results in an error, and has no impact on on-going motion or the status
of the axis.
Arguments
476 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 477
Chapter 17 Motioncontrol instructions
Results
478 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_SetPosition operation
• The MC_SetPostion function block can successfully complete only when
the axis state is StandStill, continuous Motion (MC_ExecutionMode = 0),
or when the on-going motion completes, and ends with a StandStill state
(MC_ExecutionMode = 1).
Arguments
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
Execute Input BOOL When TRUE, starts setting the axis position.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 479
Chapter 17 Motioncontrol instructions
480 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 481
Chapter 17 Motioncontrol instructions
482 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_Stop commands a controlled motion stop and transfers the axis state to
MC_Stop Stopping. Any ongoing function block execution is aborted. All function block
move commands are ignored until the axis state transitions to StandStill.
MC_Stop operation
• As long as the Execute input is high, the axis remains in the Stopping state.
While the axis is in the Stopping state, no other motion function block can
perform any motion on the same axis.
• The axis goes to StandStill after the Done bit is SET and the Execute input
is changed to False if there is no error detected during the stop sequence.
Arguments
AxisIn Input AXIS_REF See also AXIS_REF data type (on page 426).
Execute Input BOOL When TRUE, starts the action at the rising edge.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 483
Chapter 17 Motioncontrol instructions
Busy Output BOOL When TRUE, the function block is not finished.
Active Output BOOL When TRUE, indicates the function block has control on the axis.
CommandAborted Output BOOL When TRUE, command was aborted by MC_Power(OFF) function block, or ErrorStop.
484 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 485
Chapter 17 Motioncontrol instructions
486 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
MC_TouchProbe operation
• If the window direction (first position --> last position) is in the opposite
direction of the motion direction, the touch probe window will not be
activated.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 487
Chapter 17 Motioncontrol instructions
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 out.
Applies only to LD programs.
488 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 489
Chapter 17 Motioncontrol instructions
Results
490 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 491
Chapter 17 Motioncontrol instructions
MC_WriteBoolParameter operation
The parameters set by the MC_WriteBoolParameter function block are only
applied to the application temporarily. They are overwritten by the permanent
settings, which are configured by the user in Connect Component Workbench
Motion Configuration, when the controller is switched from PRG to RUN, or
when the controller power is cycled.
Arguments
492 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
When (MC_ExecutionMode = 0), for Parameter Duty Cycle (1005), this FB can be
completed successfully except the axis is in Homing or ErrorStop state.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 493
Chapter 17 Motioncontrol instructions
494 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 495
Chapter 17 Motioncontrol instructions
MC_WriteParameter operation
The parameters set by the MC_WriteParameter function block are only applied
to the application temporarily. They are overwritten by the permanent settings,
which are configured by the user in Connect Component Workbench Motion
Configuration, when the controller is switched from PRG to RUN, or when the
controller power is cycled.
Arguments
496 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
When (MC_ExecutionMode = 0), for Parameter Duty Cycle (1005), this FB can be
completed successfully except the axis is in Homing or ErrorStop state.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 497
Chapter 17 Motioncontrol instructions
Results
498 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Motioncontrol instructions Chapter 17
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 499
Chapter 18
Process control instructions are used 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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 501
Chapter 18 Processcontrol instructions
DERIVATE differentiates a Real value. If the CYCLE parameter value is less than
DERIVATE the cycle timing of the execution of the device, the sampling period is forced to
this cycle timing.
Derivate operation
The derivation is performed with a time base of milliseconds (that is, 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, the output must be multiplied by 1000.
Arguments
502 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 503
Chapter 18 Processcontrol instructions
Arguments
504 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 505
Chapter 18 Processcontrol instructions
INTEGRAL operation
• 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.
• 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
506 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
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.
• See also XIN in sync with function block execution example and XIN not
in sync with function block execution example.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 507
Chapter 18 Processcontrol instructions
508 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 509
Chapter 18 Processcontrol instructions
510 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 511
Chapter 18 Processcontrol instructions
PWM (Pulse Width Modulation) turns the PWM output for a configured PWM
PWM channel on or off. It is valid on Micro820 2080-LC20-20QBB controllers only
and only one PWM channel is supported (thru the embedded output channel 6).
PWM operation
• PWM is supported for Micro820 controllers only.
PWM arguments
512 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 513
Chapter 18 Processcontrol instructions
514 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 515
Chapter 18 Processcontrol instructions
Arguments
516 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 517
Chapter 18 Processcontrol instructions
518 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
STACKINT operation
The STACKINT function block 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. STACKINT manages invalid values as follows:
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 519
Chapter 18 Processcontrol instructions
520 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
max_err);
appli_alarm := auto_mode AND NOT(STACKINT1.EMPTY);
err_alarm := STACKINT1.OFLO;
last_error := STACKINT1.OUT;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 521
Chapter 18 Processcontrol instructions
TND stops the current cycle of user program scan. Then, after the output scan,
TND input scan, and housekeeping, the user program will be re-executed from the start
of the first routine.
Arguments
Ladder diagram
Structured text
522 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
(* ST Equivalence: *)
TESTOUTPUT := TND(TESTENABLE) ;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 523
Chapter 18 Processcontrol instructions
LIMIT restricts integer values to a given interval. Integer values between the
LIMIT 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.
Arguments
524 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Processcontrol instructions Chapter 18
Ladder diagram
Structured text
(* ST Equivalence: *)
new_value := LIMIT (min_value, value, max_value);
(* bounds the value to the [min_value..max_value] set *)
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 525
Chapter 18 Processcontrol instructions
Results
526 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 19
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 527
Chapter 19 Programcontrol instruction
SUS suspends the execution of the Micro800 controller. The controller remains
SUS in RUN mode but execution is suspended indefinitely. Suspend catches User
Program errors and aids in User Program debugging. 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.
Arguments
528 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Programcontrol instruction Chapter 19
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 529
Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 531
Chapter 20 Proportional IntegralDerivative (PID) instruction
532 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
• A: Acting (+/- 1)
• td: ãD
• ti: ãI
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 533
Chapter 20 Proportional IntegralDerivative (PID) instruction
534 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 535
Chapter 20 Proportional IntegralDerivative (PID) instruction
536 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 537
Chapter 20 Proportional IntegralDerivative (PID) instruction
IPIDController1(Proc,
SP,
FBK,
Auto,
Init,
G_In,
538 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
A_Tune,
A_TunePar,
Err );
Out_process := IPIDController1.Output ;
A_Tune_Warn := IPIDController1.ATWarning ;
Gain_Out := IPIDController1.OutGains ;
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 539
Chapter 20 Proportional IntegralDerivative (PID) instruction
Deviation REAL Deviation for auto tuning. This is the standard deviation used to evaluate the noise band needed for
AutoTune.
Step REAL Step value for AutoTune. Must be greater than noise band and less than ½ Load.
ATDynamSet REAL Waiting time in seconds before abandoning auto tune.
ATReset BOOL The indication of whether the output value is reset to zero after an AutoTune sequence:
• TRUE - resets output to zero.
• FALSE - leaves 0utput at Load value.
540 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
IPIDController function
Input Auto
block operation
When Input Auto is TRUE, the IPIDController runs in normal auto mode.
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.
Input Initialize
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). You can use this process to
prevent bumping the Output when changes are made to the SetPoint using a
switch function block.
To finalize tuning
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.
542 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
This section provides specific details and examples for using the proportional
Using the Proportional integral derivative instruction, including the following:
Integral Derivative
instruction Using auto-tune with the IPIDController function block
You can use the AutoTune parameter of the IPIDController function block to
implement 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.
• Configure the scan time of the program to be than half of the oscillation
period.
• Flow of fluid from a tank, with potential energy as the storage unit.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 543
Chapter 20 Proportional IntegralDerivative (PID) instruction
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 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.
Configure auto-tuning
Following are the general steps for implementing auto-tuning using the
IPIDController function.
544 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 545
Chapter 20 Proportional IntegralDerivative (PID) instruction
546 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 547
Chapter 20 Proportional IntegralDerivative (PID) instruction
548 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 549
Chapter 20 Proportional IntegralDerivative (PID) instruction
Auto-tune parameters
The following table describes the variables that are used with each parameter in
the example to configure auto-tuning.
550 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
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
Initialize Initialize Initializes AutoTune sequence.
A change in value from TRUE to FALSE or FALSE to TRUE causes the controller to eliminate
any proportional gain during the cycle.
My_Gains Gains Establishes the Gains PID for IPIDController.
My_Gains.DirectActing DirectActing Defines the type of acting for the output.
TRUE - direct acting in which the output moves in the same direction as the error. That is,
the actual process value is greater than the SetPoint and the appropriate controller action is
to increase the output. For example, chilling.
FALSE - reverse acting in which the output moves in the opposite direction as the error. That
is, the actual process value is greater than the SetPoint and the appropriate controller action
is to decrease the output. For example: heating.
My_Gains.ProportionalGain ProportionalGain Proportional gain for PID (>= 0.0001).
My_Gains.TimeIntegral TimeIntegral Time integral value for PID (>= 0.0001).
The tendency for oscillation increases with a decrease in ti.
My_Gains.TimeDerivative TimeDerivative Time derivative value for PID (> 0.0).
Damping increases with an increase in derivative time, but decreases if the derivative time
value is too large.
My_Gains.DerivativeGain Derivative gain for PID (> 0.0).
AutoTune When set to TRUE and Auto and Initialize are FALSE, the AutoTune sequence is started.
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 551
Chapter 20 Proportional IntegralDerivative (PID) instruction
Input parameters
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.
552 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 553
Chapter 20 Proportional IntegralDerivative (PID) instruction
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.
554 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
No Item Description
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 555
Chapter 20 Proportional IntegralDerivative (PID) instruction
556 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
• How the setpoint, process and manipulated values are used in the control
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.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 557
Chapter 20 Proportional IntegralDerivative (PID) instruction
558 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Proportional IntegralDerivative (PID) instruction Chapter 20
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 559
Chapter 20 Proportional IntegralDerivative (PID) instruction
560 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 21
Real Time Clock instructions are used to configure the calendar and the clock.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 561
Chapter 21 RealTimeClock (RTC) instructions
RTC_READ operation
• When used with a Micro810 controller with embedded RTC, RTCBatLow
is always set to zero (0).
• When the embedded RTC has lost its charge/memory due to loss of power,
RTCEnabled is always set to zero (0).
Arguments
562 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
RealTimeClock (RTC) instructions Chapter 21
Structured Text
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 563
Chapter 21 RealTimeClock (RTC) instructions
Arguments
RTCEnable Input BOOL TRUE - To enable RTC with the RTC data specified.
FALSE - To disable RTC.
Note: This is ignored by Micro810 controllers.
564 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
RealTimeClock (RTC) instructions Chapter 21
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 565
Chapter 21 RealTimeClock (RTC) instructions
566 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 22
String manipulation instructions are used to alter a sequence of symbols that are
chosen from a set or alphabet to change the output status.
Note: To read input strings containing special characters correctly, input the string characters after the program containing the function block instance is
online.
Function Description
ASCII (on page 568) Character -> ASCII code
CHAR (on page 570) ASCII code -> Character
DELETE (on page 572) Delete sub-string
FIND (on page 574) Find sub-string
INSERT (on page 576) Insert string
LEFT (on page 578) Extract left of a string
MID (on page 580) Extract middle of a string
MLEN (on page 582) Get string length
REPLACE (on page 586) Replace sub-string
RIGHT (on page 584) Extract right of a string
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 567
Chapter 22 Stringmanipulation instructions
Arguments
Ladder diagram
568 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Structured text
(* ST Equivalence: *)
FirstChr := ASCII (message, 1);
(* FirstChr is the ASCII code of the first character of the string *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 569
Chapter 22 Stringmanipulation instructions
For a given ASCII code, CHAR provides a string containing one character.
CHAR
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
Display := CHAR ( value + 48 );
(* value is in set [0..9] *)
570 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 571
Chapter 22 Stringmanipulation instructions
Arguments
572 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Ladder diagram
Structured text
(* ST Equivalence: *)
complete_string := INSERT (’ABCD ’, ’EFGH’, 5); (* complete_string is
'ABCDEFGH ' *)
sub_string := DELETE (complete_string, 4, 3); (* sub_string is 'ABGH '*)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 573
Chapter 22 Stringmanipulation instructions
Arguments
Ladder diagram
574 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Structured text
(* ST Equivalence: *)
complete_string := 'ABCD' + 'EFGH'; (* complete_string is 'ABCDEFGH ' *)
found := FIND (complete_string, 'CDEF'); (* found is 3 *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 575
Chapter 22 Stringmanipulation instructions
Arguments
576 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Ladder diagram
Structured text
(* ST Equivalence: *)
MyName := INSERT ('Mr JONES', 'Frank ', 4);
(* MyName is 'Mr Frank JONES' *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 577
Chapter 22 Stringmanipulation instructions
From the left end of strings, LEFT yields the number of characters defined.
LEFT
Arguments
Ladder diagram
578 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Structured text
(* ST Equivalence: *)
complete_string := RIGHT ('12345678', 4), LEFT ('12345678', 4), 5;
(* complete_string is '56781234'
the value issued from RIGHT call is '5678'
the value issued from LEFT call is '1234'*)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 579
Chapter 22 Stringmanipulation instructions
Using the position and number of characters provided, MID yields required parts
MID of strings.
Arguments
Ladder diagram
580 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Structured text
(* ST Equivalence: *)
sub_string := MID ('abcdefgh', 2, 4);
(* sub_string is 'de' *)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 581
Chapter 22 Stringmanipulation instructions
Arguments
Ladder diagram
Structured text
(* ST Equivalence: *)
nbchar := MLEN (complete_string);
If (nbchar < 3) Then Return; End_if;
prefix := LEFT (complete_string, 3);
582 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
(* 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
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 583
Chapter 22 Stringmanipulation instructions
From the right ends of strings, RIGHT yields the number of characters defined.
RIGHT
Arguments
Ladder diagram
584 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Structured text
(* ST Equivalence: *)
complete_string := RIGHT ('12345678', 4), LEFT ('12345678', 4),5;
(* complete_string is '56781234'
the value issued from RIGHT call is '5678'
the value issued from LEFT call is '1234'
*)
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 585
Chapter 22 Stringmanipulation instructions
Arguments
586 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Stringmanipulation instructions Chapter 22
Ladder diagram
Structured text
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 587
Chapter 22 Stringmanipulation instructions
588 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Chapter 23
Timer instructions
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 589
Chapter 23 Timer instructions
Time accuracy refers to the time between the moment the processor enables a
Timer instruction 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.
• Preset - Specifies the value that the timer must reach before the processor
sets the done bit.
590 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 591
Chapter 23 Timer instructions
Results
592 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
TON operation
• Do not use a jump to skip over a TON function block in a Ladder Diagram
(LD). If you do, the TON timer will continue after the elapsed time.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 593
Chapter 23 Timer instructions
Results
594 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
TONOFF delays turning on an output on a true rung, then delays turning off the
TONOFF output on the false rung.
Arguments
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 595
Chapter 23 Timer instructions
Results
596 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 597
Chapter 23 Timer instructions
Arguments
TP timing diagram
598 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
Results
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 599
Chapter 23 Timer instructions
The DOY function has four channel inputs; it turns on an output if the value of
DOY Real-Time Clock (RTC) is in the range of the Year Time setting of any one of
four channels. If RTC is not present, the output is always off.
DOY operation
Configure any of the Time input parameters with valid ranges as specified in the
DOYDATA Data Type table. If TimeX.Enable is set to TRUE and an RTC is
present and enabled, an invalid value will fault the controller.
Arguments
DOY Output BOOL If TRUE, the value of the real-time clock is in the range of the Year Time
setting of any one of the four channels.
600 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := DOY(TIMEA1, TIMEB1, TIMEC1, TIMED1) ;
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 601
Chapter 23 Timer instructions
602 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
Arguments
Ladder diagram
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 603
Chapter 23 Timer instructions
Structured text
(* ST Equivalence: *)
TESTTIMEDIFF := TDF(TESTTIME1, TESTTIME2) ;
Results
604 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
The TOW function has four channel inputs; it turns on an output if the value of
TOW the real-time clock (RTC) is in the range of the Time of Week setting of any one
of four channels. If an RTC is not present, the output is always off.
Note: Make sure you configure any TimeX input parameter with valid ranges as specified in the TOWDATA Data Type table. An invalid value will fault the
controller if TimeX.Enable is set to TRUE and an RTC is present and enabled.
Arguments
TOW Output BOOL If TRUE, the value of the real-time clock is in the range of the Day Time
setting of any one of four channels.
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 605
Chapter 23 Timer instructions
Ladder diagram
Structured text
(* ST Equivalence: *)
TESTOUTPUT := TOW(TIMEA, TIMEB, TIMEC, TIMED) ;
Results
606 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Timer instructions Chapter 23
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 607
Chapter 23 Timer instructions
608 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Index
AHL function block 124
alarms
- operator 109 LIM_ALRM function block 64
AND operator 165
AND_MASK function 140
* ANY_TO_BOOL operator 276
* operator 97 ANY_TO_BYTE operator 277
ANY_TO_DATE operator 278
ANY_TO_DINT operator 279
/ ANY_TO_DWORD operator 280
/ operator 88 ANY_TO_INT operator 281
ANY_TO_LINT operator 282
ANY_TO_LREAL operator 283
+
ANY_TO_LWORD operator 284
+ operator 74 ANY_TO_REAL operator 285
ANY_TO_SINT operator 286
< ANY_TO_STRING operator 287
ANY_TO_TIME operator 288
< operator 262
ANY_TO_UDINT operator 289
<= operator 264
ANY_TO_UINT operator 290
<> operator 265
ANY_TO_ULINT operator 291
ANY_TO_USINT operator 292
= ANY_TO_WORD operator 293
ARD function block 126
= operator 258
arithmetic
ABS function 68
> ACOS function 70
ACOS_LREAL function 72
> operator 260
addition operator 74
>= operator 261
ASIN function 76
ASIN_LREAL function 78
1 ATAN function 80
1Gain operator 96 ATAN_LREAL function 82
COS function 84
COS_LREAL function 86
A division operator 88
ABL function block 118 EXPT function 90
ABS function 68 LOG function 92
ACB function block 120 MOD function 94
ACL function block 122 MOV operator 96
ACOS function 70 multiplication operator 97
ACOS_LREAL function 72 Neg operator 98
addition operator 74 POW function 99
advanced control blocks RAND function 101
SCALER 527 SIN function 103
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 609
Index
610 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Index
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 611
Index
612 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Index
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 613
Index
614 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Index
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 615
Index
616 RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014
Index
T
TAN function 110
TAN_LREAL function 112
TDF function 615
time
DOY function 612
TDF function 615
TOF function block 603
TON function block 605
TONOFF function block 607
TOW function 617
TP function block 610
TND function 533
TOF function block 603
RockwellAutomationPublication2080-RM001B-EN-E-March2014March2014 617
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 manuals, a knowledge base of FAQs, technical
and application notes, sample code and links to software service packs, and a MySupport feature that you can customize
to make the best use of these tools.
For an additional level of technical phone support for installation, configuration, and troubleshooting, we offer
TechConnect support programs. For more information, contact your local distributor or Rockwell Automation
representative, or visit http://www.rockwellautomation.com/support/.
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 this form, publication RA-DU002, available at http://www.rockwellautomation.com/literature/.
RockwellAutomationPublication2080-RM001B-EN-E-March2014
Copyright © 2014 Rockwell Automation, Inc. All rights reserved. Printed in the U.S.A.