Allen-Bradley Micro800 General Instructions Manual

Allen-Bradley Micro800 General Instructions Manual

Programmable controllers
Hide thumbs Also See for Micro800:
Table of Contents

Advertisement

Reference Manual
Micro800 Programmable Controllers General Instructions
Catalog Numbers 2080-LC10, 2080-LC20, 2080-LC30, 2080-LC50

Advertisement

Table of Contents
loading

Summary of Contents for Allen-Bradley Micro800

  • Page 1 Reference Manual Micro800 Programmable Controllers General Instructions Catalog Numbers 2080-LC10, 2080-LC20, 2080-LC30, 2080-LC50...
  • Page 2 Flash will cause severe injury or death. Wear proper Personal Protective Equipment (PPE). Follow ALL Regulatory requirements for safe work practices and for Personal Protective Equipment (PPE). Allen-Bradley, Rockwell Software, Rockwell Automation, Connected Components Workbench, Micro800, PowerFlex, PanelView, and RSLinx are trademarks of Rockwell Automation, Inc. Trademarks not belonging to Rockwell Automation are property of their respective companies.
  • Page 3: Table Of Contents

    Table of contents Preface In This Manual ..................... 13 Supported Controllers ..................13 Additional Resources ................... 14 Chapter 1 Finding information about Instruction blocks ....................15 Operators ......................16 instructions and ladder Functions ......................16 elements Function blocks....................18 Instruction set in alphabetical order ..............19 Instruction set by type and function ..............
  • Page 4 Table of contents Chapter 5 Arithmetic instructions ABS.......................... 62 ACOS ........................64 ACOS_LREAL ..................... 66 Addition ......................... 68 ASIN ........................69 ASIN_LREAL ...................... 71 ATAN........................73 ATAN_LREAL ....................75 COS ........................77 COS_LREAL ......................79 Division ........................81 EXPT ........................82 LOG ........................
  • Page 5 Table of contents ASCII parameter details ..................127 ABL error codes ................... 127 ABLACB data type ..................128 ACL data type ....................128 AHL ChannelSts data type ................ 129 AHLI data type .................... 129 ARDARL data type ..................130 AWAAWT data type ................. 130 Chapter 7 Binary instructions AND_MASK ......................
  • Page 6 Table of contents MSG_CIPSYMBOLIC ..................184 CIPSYMBOLICCFG data type ............... 187 CIPAPPCFG data type ................189 CIPCONTROLCFG data type ............... 190 CIPSTATUS data type ................191 CIPTARGETCFG data type ..............193 Supported Data Packet Size for CIP Serial Function ......196 MSG_MODBUS ....................
  • Page 7 Table of contents Chapter 10 Compare instructions Equal ........................260 Greater than ......................262 Greater than or equal ..................263 Less than ....................... 264 Less than or equal ....................265 Not equal ......................266 Chapter 11 Counter instructions CTD ........................268 CTU ........................
  • Page 8 Table of contents Chapter 13 Data manipulation AVERAGE ......................298 COP ........................300 instructions COP operation status values ..............304 Copying to a different data type ............... 304 MIN ........................305 MAX ........................307 Chapter 14 High-Speed Counter (HSC) What is a High-Speed Counter? ..............309 HSC ........................
  • Page 9 Table of contents IIM ........................376 IIM status codes ................... 378 IOM ........................379 IOM status codes ..................381 KEY_READ ......................382 KEY_READ_REM .................... 386 KEY_READ_REM operation ..............387 KEY_READ_REM status codes .............. 388 KeyData bitfields table ................389 MM_INFO ......................390 MMINFO data type ...................
  • Page 10 Table of contents Chapter 17 Motion control instructions General rules for motion control function blocks ........432 Motion control function block parameter details ........435 Motion control axis states ................435 Motion control function block parameter numbers ......438 Motion control function block error IDs ..........440 Axis error scenarios ..................
  • Page 11 Table of contents Chapter 18 Process control instructions DERIVATE ......................528 HYSTER ......................530 INTEGRAL ......................532 PWM ........................539 PWM status codes ..................542 SCALER ....................... 543 STACKINT ......................546 TND ........................549 LIMIT ........................551 Chapter 19 Program control instruction SUS ........................
  • Page 12 Table of contents Chapter 22 String manipulation ASCII ........................594 CHAR ........................596 instructions DELETE ......................598 FIND ........................600 INSERT ....................... 602 LEFT ........................604 MID ........................606 MLEN........................608 RIGHT ......................... 610 REPLACE......................613 Chapter 23 Timer instruction configuration ..............618 Timer instructions TOF ........................
  • Page 13: Preface

    In This Manual This guide provides reference information about the instruction set available for developing programs for use in Micro800 control systems. The instruction set includes Structured Text (ST), Ladder Diagram (LD) Function Block Diagram (FBD) programming language support. Additionally, the ladder elements supported in Connected Components Workbench development environment are defined.
  • Page 14: Additional Resources

    Preface These documents contain additional information concerning related Rockwell Additional Resources Automation products. Resource Description Industrial Automation Wiring and Grounding Guidelines, Provides general guidelines for installing a Rockwell publication 1770-4.1 available at Automation industrial system. http://literature.rockwellautomation.com/idc/groups/lite rature/documents/in/1770-in041_-en-p.pdf Product Certifications website, http://www.ab.com Provides declarations of conformity, certificates, and other certification details.
  • Page 15: Finding Information About Instructions And Ladder Elements

    Additionally, Connected Components Workbench includes user-interface configuration tools for Micro800™ controllers, PowerFlex ® drives, a Safety Relay device, PanelView™ Component graphic terminals, and serial and network connectivity options.
  • Page 16: Operators

    Chapter 1 Finding information about instructions and ladder elements 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. Instruction block format An instruction block is represented by a single rectangle, and has a fixed number of input connection points and output connection points.
  • Page 17 Chapter 1 Finding information about instructions and ladder elements Calling a function Connected Components Workbench 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.
  • Page 18: Function Blocks

    Chapter 1 Finding information about instructions and ladder elements 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. Instruction block format An instruction block is represented by a single rectangle, and has a fixed number of input connection points and output connection points.
  • Page 19: Instruction Set In Alphabetical Order

    Chapter 1 Finding information about instructions and ladder elements Defining function block and parameter names The interface of a function block must be explicitly defined with a type and a unique name for each of its calling (input) parameters or return (output) parameters.
  • Page 20 Chapter 1 Finding information about instructions and ladder elements Instruction Instruction block type ANY_TO_WORD page 294 Function page 118 Function block page 121 Function block ASCII page 594 Function ASIN page 68 Function ASIN_LREAL page 71 Function ATAN page 73 Function ATAN_LREAL page 75...
  • Page 21 Chapter 1 Finding information about instructions and ladder elements Instruction Instruction block type Less Than or Equal page 265 Operator LIM_ALRM page 58 Function block LIMIT page 551 Function page 84 Function page 307 Function MC_AbortTrigger page 446 Function block MC_Halt page 449 Function block...
  • Page 22 Chapter 1 Finding information about instructions and ladder elements Instruction Instruction block type NOT_MASK page 134 Function OR_MASK page 136 Function page 156 Operator PLUGIN_INFO page 393 Function block PLUGIN_READ page 396 Function block PLUGIN_RESET page 399 Function block PLUGIN_WRITE page 401 Function block page 91...
  • Page 23: Instruction Set By Type And Function

    Chapter 1 Finding information about instructions and ladder elements Instruction Instruction block type page 628 Function block TRIMPOT_READ page 416 Function block TRUNC page 106 Function TTABLE page 162 Function page 422 Function page 424 Function page 426 Function page 428 Function XOR_MASK page 146...
  • Page 24 Read real-time clock (RTC) module information RTC_SET page 410 Set real-time clock data to real-time clock module SYS_INFO page 413 Read Micro800 system status TRIMPOT_READ page 416 Read the trimpot value from a specific trimpot Motion control page 431 MC_AbortTrigger...
  • Page 25 Chapter 1 Finding information about instructions and ladder elements Category Function block Description MC_TouchProbe page 513 Records the axis position at a trigger event MC_WriteBoolParameter Modifies the value of a vendor specifiic parameter of type BOOL page 519 MC_WriteParameter page Modifies the value of a vendor specific parameter Process control page 527 DERIVATE...
  • Page 26 Chapter 1 Finding information about instructions and ladder elements Instruction Functional category page 634 Timer instructions page 617 EXPT page 82 Arithmetic instructions page 61 FIND page 600 String manipulation instructions page 593 INSERT page 602 page 358 Input/Output instructions page 357 LEFT page 604...
  • Page 27 Chapter 1 Finding information about instructions and ladder elements Instruction Functional category page 426 page 428 XOR_MASK page 146 Binary instructions page 131 Operators The following table lists the operators by functional category. Instruction Functional category Addition page 68 Arithmetic instructions page 61 page 157 Boolean instructions...
  • Page 28 Chapter 1 Finding information about instructions and ladder elements Instruction Functional category Addition page 68 Arithmetic instructions page 61 Not Equal page 266 Compare instructions page 259 page 156 Boolean instructions page 149 Subtraction page 101 Arithmetic instructions page 61 page 158 Boolean instructions page 149...
  • Page 29: Ladder Diagram (Ld) Language

    Chapter 2 Ladder Diagram (LD) language Ladder diagram language reference. Element Description LD program page 29 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 page 30 Ladder Diagram (LD)
  • Page 30: Ld Program Development Environment

    Chapter 2 Ladder Diagram (LD) language 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. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 31 Chapter 3 Ladder Diagram (LD) elements 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.
  • Page 32: Ladder Diagram (Ld) Elements

    Chapter 3 Ladder Diagram (LD) elements 5. Create and open a new LD program. 6. Hold down the Ctrl key while rolling the thumb wheel down on your mouse until the entire rung is visible on your computer. Rung comments Comments you enter in the space above the rung are saved in rich text format and stored in the controller.
  • Page 33 Chapter 3 Ladder Diagram (LD) elements To add a label for a rung 1. Right-click the area to the left of the rung, and select Add Label. 2. Select the Label, and type a description for the rung. Example: Label To add an element to an LD program To add a rung to the LD language editor, do one of the following: •...
  • Page 34 Chapter 3 Ladder Diagram (LD) elements 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 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 35: Instruction Block (Ld)

    Chapter 3 Ladder Diagram (LD) elements Instruction Block (LD) A LD instruction 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.
  • Page 36 Chapter 3 Ladder Diagram (LD) elements To enable EN/ENO for all blocks added to LD program 1. On the Tool menu, click Options. 2. Select IEC Languages > Ladder Diagram (LD) to display the language editor properties. 3. In Block Settings, set Enable EN/ENO to True. 4.
  • Page 37 Chapter 3 Ladder Diagram (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 input is not Boolean, an EN input parameter is added to the block.
  • Page 38 Chapter 3 Ladder Diagram (LD) elements 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.
  • Page 39: Coil

    Chapter 3 Ladder Diagram (LD) elements Example: Enable input In some cases, Enable parameters are required for instruction blocks that execute on call. The following example shows an SUS instruction block with an Enable input. Coil Coils are graphic components of an LD diagram that represent the assignment of an output or of an internal variable.
  • Page 40 Chapter 3 Ladder Diagram (LD) elements Example: Coils Adding coil elements Follow these steps to add and modify coil elements. Add a coil element 1. Verify the LD program has a defined rung for the coil. 2. From the Toolbox, drag the coil into the LD language editor to the right of a Boolean symbol or of a Boolean output.
  • Page 41 Chapter 3 Ladder Diagram (LD) elements Change the type of coil In the language editor, select the coil, then press the space bar until the new coil type is available. Every time the space bar is pressed the type changes from direct, to reverse, to set, to reset, to pulse rising edge, to pulse falling edge.
  • Page 42 Chapter 3 Ladder Diagram (LD) elements Example: Reverse Coil Pulse Falling Edge Coil Pulse falling edge (or negative) coils support a Boolean output of a connection line Boolean state. The associated variable is set to TRUE when the Boolean state of the left connection falls from TRUE to FALSE.
  • Page 43 Chapter 3 Ladder Diagram (LD) elements 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.
  • Page 44: Contact

    Chapter 3 Ladder Diagram (LD) elements 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.
  • Page 45 Chapter 3 Ladder Diagram (LD) elements You can add the following contact element types to your LD program from the LD Toolbox in Connected Components Workbench. Contact element Description Direct contact page 46 Direct contacts support a Boolean operation between a connection line state and a Boolean variable. Reverse contact page 46 Reverse contacts support a Boolean operation between a connection line state and the Boolean negation of a...
  • Page 46 Chapter 3 Ladder Diagram (LD) elements 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.
  • Page 47 Chapter 3 Ladder Diagram (LD) elements Pulse Rising Edge Contact Pulse rising edge (or positive) contacts support a Boolean operation between a connection line state and the rising edge of a Boolean variable. The state of the connection line on the right of the contact is set to TRUE when the state of the connection line on the left is TRUE, and the state of the associated variable rises from FALSE to TRUE.
  • Page 48: Return

    Chapter 3 Ladder Diagram (LD) elements Example: Pulse Falling Edge Contact Recommendation: Restrict the use of output variables with edge contacts We recommend you do not use outputs or variables with a Pulse rising edge contact (positive) or a Pulse falling edge contact (negative). These contacts are for physical inputs in a ladder diagram.
  • Page 49: Jump

    Chapter 3 Ladder Diagram (LD) elements 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. Jump notation The following notation indicates a jump to the LAB label: >>LAB - Jump to a label where the label name is "LAB"...
  • Page 50: Working In The Ld Language Editor

    Chapter 3 Ladder Diagram (LD) elements Instruction block names Functions and function blocks are represented by a box that displays the name of the instruction, and the short version of the parameter names. For function blocks, the instance name is displayed in italics. Instruction block return parameters •...
  • Page 51 Chapter 3 Ladder Diagram (LD) elements Add an element to an LD program From the LD Toolbox, drag the element into the LD language editor, and place it on a 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.
  • Page 52: Ladder Diagram (Ld) Program Examples

    Chapter 3 Ladder Diagram (LD) elements See the following examples of Ladder Diagram (LD) programs. Ladder Diagram (LD) program examples Example: R_TRIG function block page 52 Example: Comparing Real Values using Subtraction (-) ABS, and Less than (<) page 52 Example: R_TRIG function block The following example program shows the recommended usage of an R_TRIG function block being used to detect an edge while connected to the controller.
  • Page 53: Example: Comparing Real Values Using Subtraction (-) Abs, And Less Than (<)

    Chapter 3 Ladder Diagram (LD) elements 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.
  • Page 54: Ld Keyboard Shortcuts

    Chapter 3 Ladder Diagram (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. Ctrl+Alt+0 Inserts a rung before a selected rung. Ctrl+ 1 Inserts a branch after a selected element.
  • Page 55 Chapter 3 Ladder Diagram (LD) elements Shortcut Description 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...
  • Page 56 Chapter 3 Ladder Diagram (LD) elements Shortcut Description 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...
  • Page 57: Chapter 4

    Chapter 4 Alarm instruction Alarm instruction is used to provide alerts when a configured high or a configured low limit has been reached. Function block Description LIM_ALRM page 58 Hysteresis on a real value for high and low limits. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 58: Alarm Instruction

    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.
  • Page 59 Chapter 4 Alarm instruction LIM_ALRM timing diagram example LIM_ALRM function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 60 Chapter 4 Alarm instruction Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 61 Chapter 5 Arithmetic instructions Arithmetic instructions give a controller the ability to perform mathematical functions, such as addition, subtraction, multiplication, and division on data. Function Description page 62 Absolute value of a Real value ACOS page 64 Arc cosine of a Real value ACOS_LREAL page 66 Perform 64-bit real arc-cosine calculation...
  • Page 62: Abs

    Chapter 5 Arithmetic instructions ABS yields the absolute (positive) value of a Real value. Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current absolute computation. When EN = FALSE, there is no computation. Input REAL Any signed Real value.
  • Page 63 Chapter 5 Arithmetic instructions Structured text diagram (* ST Equivalence: *) over := (ABS (delta) > range); Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 64: Acos

    Chapter 5 Arithmetic instructions ACOS yields the Arc Cosine of a Real value. Input and output values are in ACOS radians. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current arc-cosine computation. When EN = FALSE, there is no computation.
  • Page 65 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) cosine := COS (angle); result := ACOS (cosine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 66: Acos_Lreal

    Chapter 5 Arithmetic instructions ACOS_LREAL calculates the Arc cosine of a Long Real value. ACOS_LREAL Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current computation. When EN = FALSE, there is no computation. Input LREAL Must be in set [-1.0 ..
  • Page 67 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) cosine := COS_LREAL (angle); result := ACOS_LREAL (cosine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 68: Addition

    Chapter 5 Arithmetic instructions Addition adds two or more Integer, Real, Time, or String values. Addition Addition operation The Addition function supports additional inputs. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When Enable = TRUE, execute current addition computation. When Enable = FALSE, there is no computation.
  • Page 69: Asin

    Chapter 5 Arithmetic instructions ASIN yields the Arc sine of a Real value. Input and output values are in radians. ASIN Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current arc sine computation.
  • Page 70 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) sine := SIN (angle); result := ASIN (sine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 71: Asin_Lreal

    Chapter 5 Arithmetic instructions ASIN_LREAL calculates the Arc sine of a Long Real value. ASIN_LREAL Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current computation. When EN = FALSE, there is no computation. Input LREAL Must be in set [-1.0 ..
  • Page 72 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) sine := SIN_LREAL (angle); result := ASIN_LREAL (sine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 73: Atan

    Chapter 5 Arithmetic instructions ATAN yields the Arc Tangent of a Real value. ATAN Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current arc-tangent computation. When EN = FALSE, there is no computation. Input REAL Any Real value.
  • Page 74 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) tangent := TAN (angle); result := ATAN (tangent); (* result is equal to angle*) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 75: Atan_Lreal

    Chapter 5 Arithmetic instructions ATAN_LREAL calculates the Arc tangent of a Long Real value. ATAN_LREAL Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current computation. When EN = FALSE, there is no computation. Input LREAL Any Long Real value.
  • Page 76 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) tangent := TAN_LREAL (angle); result := ATAN_LREAL (tangent); (* result is equal to angle*) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 77: Cos

    Chapter 5 Arithmetic instructions COS yields the Cosine of a Real value. Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current cosine computation. When EN = FALSE, there is no computation. Input REAL Any Real value.
  • Page 78 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) cosine := COS (angle); result := ACOS (cosine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 79: Cos_Lreal

    Chapter 5 Arithmetic instructions COS_LREAL calculates the cosine of a Long Real value. COS_LREAL Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute current computation. When EN = FALSE, there is no computation. Input LREAL Any Long Real value.
  • Page 80 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) cosine := COS_LREAL (angle); result := ACOS_LREAL (cosine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 81: Division

    Chapter 5 Arithmetic instructions Division divides the first Integer or Real input value by the second Integer or Real Division input value. Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When Enable = TRUE, execute current division computation. When Enable = FALSE, there is no computation.
  • Page 82: Expt

    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 Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current exponent computation. When EN = FALSE, there is no computation.
  • Page 83 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) tb_size := ANY_TO_DINT (EXPT (2.0, range) ); Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 84: Log

    Chapter 5 Arithmetic instructions LOG yields the logarithm (base 10) of a Real value. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current logarithm computation. When EN = FALSE, there is no computation. Input REAL Must be greater than zero.
  • Page 85 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) xpos := ABS (xval); xlog := LOG (xpos); Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 86: Mod

    Chapter 5 Arithmetic instructions MOD yields the module of an integer value. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute the module computation. When EN = FALSE, there is no computation. Input DINT Any signed integer value.
  • Page 87 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) division_result := (value / divider); (* integer division *) rest_of_division := MOD (value, divider); (* rest of the division *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 88: Mov

    Chapter 5 Arithmetic instructions MOV moves a copy of the value in input (i1) to the output (o1). Tip: The MOV instruction displays in the Block Selector when it is launched from a Ladder Diagram POU or a Function Block Diagram POU, but it does not display in a Structured Text POU.
  • Page 89: Multiplication

    Chapter 5 Arithmetic instructions Multiplication multiplies two or more Integer or Real values. The Multiplication Multiplication function supports additional inputs. Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When Enable = TRUE, execute current multiplication computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 90: Neg

    Chapter 5 Arithmetic instructions Neg converts a value to a negated value. Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute current convert to negative computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 91: Pow

    Chapter 5 Arithmetic instructions When the first argument is 'base' and the second argument is 'exponent', POW yields the Real result of the following: (base exponent). POW operation The Exponent is a real value. Arguments Parameter Parameter Type Data Type Description Input BOOL...
  • Page 92 Chapter 5 Arithmetic instructions Ladder diagram Structured text (* ST Equivalence: *) result := POW (xval, power); Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 93: Rand

    Chapter 5 Arithmetic instructions From a defined range, RAND yields random integer values. RAND Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute the random integer value computation When EN = FALSE, there is no computation. base Input DINT...
  • Page 94 Chapter 5 Arithmetic instructions Structured text • (* ST Equivalence: *) selected := MUX4 ( RAND (4), 1, 4, 8, 16 ); 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,...
  • Page 95: Sin

    Chapter 5 Arithmetic instructions SIN yields the Sine of a Real value. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current sine computation. When EN = FALSE, there is no computation. Input REAL Any Real value.
  • Page 96 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) sine := SIN (angle); result := ASIN (sine); (* result is equal to angle *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 97: Sin_Lreal

    Chapter 5 Arithmetic instructions SIN_LREAL SIN_LREAL calculates the sine of a Long Real value. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current computation. When EN = FALSE, there is no computation. Input LREAL Any Long Real value.
  • Page 98 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) TESTOUTPUT1 := SIN_LREAL(TESTINPUT1) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 99: Sqrt

    Chapter 5 Arithmetic instructions SQRT SQRT yields the square root of a Real value. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute current square root computation. When EN = FALSE, there is no computation. Input REAL Must be greater than or equal to zero.
  • Page 100 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) xpos := ABS (xval); xroot := SQRT (xpos); Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 101: Subtraction

    Chapter 5 Arithmetic instructions Subtraction Subtraction subtracts an Integer, Real, or Time value from another Integer, Real or Time value. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When Enable = TRUE, execute current addition computation. When Enable= FALSE, there is no computation. Applies only to LD programs.
  • Page 102: Tan

    Chapter 5 Arithmetic instructions TAN yields the tangent of a Real value. Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, perform current tangent computation. When EN = FALSE, there is no computation. Input REAL Cannot be equal to PI/2 modulo PI.
  • Page 103 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) tangent := TAN (angle); result := ATAN (tangent); (* result is equal to angle*) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 104: Tan_Lreal

    Chapter 5 Arithmetic instructions TAN_LREAL calculates the tangent of a Long Real value. TAN_LREAL Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, perform current computation. When EN = FALSE, there is no computation. Input LREAL Cannot be equal to PI/2 modulo PI.
  • Page 105 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) tangent := TAN_LREAL (angle); result := ATAN_LREAL (tangent); (* result is equal to angle*) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 106: Trunc

    Chapter 5 Arithmetic instructions TRUNC truncates Real values, leaving just the integer. TRUNC Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, perform the truncation of Real value computation. When EN = FALSE, there is no computation. Input REAL Any Real value.
  • Page 107 Chapter 5 Arithmetic instructions Structured text (* ST Equivalence: *) result := TRUNC (+2.67) + TRUNC (-2.0891); (* means: result := 2.0 + (-2.0) := 0.0; *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 109: Ascii Serial Port Instructions

    Chapter 6 ASCII serial port instructions ASCII serial port instructions are communication instructions that use or alter the communication channel for receiving or transmitting data. Function block Description page 110 Determine number of characters in buffer (up to and including end of line character) page 111 Determine total number of characters in buffer page 114...
  • Page 110: Abl

    Chapter 6 ASCII serial port instructions ABL counts the total number of characters in the input buffer up to and including the end-of-line termination character. Arguments Parameter Parameter type Data type Description 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.
  • Page 111 Chapter 6 ASCII serial port instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 112: Acb

    Chapter 6 ASCII serial port instructions ACB determines the total characters in the buffer. Arguments Parameter Parameter type Data type Description 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.
  • Page 113 Chapter 6 ASCII serial port instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 114: Acl

    Chapter 6 ASCII serial port instructions ACL clears the Receive and Transmit buffer(s), and removes instructions from the ASCII queue. Arguments Parameter Parameter type Data type Description 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.
  • Page 115 Chapter 6 ASCII serial port instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 116: Ahl

    Chapter 6 ASCII serial port instructions AHL sets or resets the RS-232 Request to Send (RTS) handshake control lines for your modem. Arguments Parameter Parameter type Data type Description 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.
  • Page 117 Chapter 6 ASCII serial port instructions AHL function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 118: Ard

    Chapter 6 ASCII serial port instructions ARD reads characters from the buffer and stores them in a string. 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 page 114 instruction can be executed in order to abort the ARD instruction.
  • Page 119 Chapter 6 ASCII serial port instructions Arguments Parameter Parameter Data type Description type 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. ARDInput Input ARDARL Read characters from the buffer (maximum is 82).
  • Page 120 Chapter 6 ASCII serial port instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 121: Arl

    Chapter 6 ASCII serial port instructions ARL reads characters from the buffer (up to and including the termination characters) and stores them in a string. Arguments Parameter Parameter type Data type Description 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.
  • Page 122 Chapter 6 ASCII serial port instructions ARL function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 123: Awa

    Chapter 6 ASCII serial port instructions AWA writes characters from a source string to an external device. This instruction adds the two appended characters that you configure on the configuration dialog box. Arguments Parameter Parameter Data type Description type 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.
  • Page 124 Chapter 6 ASCII serial port instructions AWA function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 125: Awt

    Chapter 6 ASCII serial port instructions AWT writes characters from a source string to an external device. Arguments Parameter Parameter Data type Description type 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.
  • Page 126: Rockwell Automation Publication 2080-Rm001D-En-E - February

    Chapter 6 ASCII serial port instructions AWT function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 127: Ascii Parameter Details

    Chapter 6 ASCII serial port instructions The following topics provide additional details for ASCII parameters and ASCII parameter details structured data types. ABL error codes page 127 ABLACB data type page 127 ACL data type page 128 AHL ChannelSts data type page 128 AHLI data type page 129...
  • Page 128: Ablacb Data Type

    Chapter 6 ASCII serial port instructions ABLACB data type The following table describes the ABLACB data type. Parameter Data type Description Channel UINT Serial port number: • 2 for the embedded serial port, or • 5-9 for serial port plug-ins installed in slots 1 through 5: •...
  • Page 129: Ahl Channelsts Data Type

    Chapter 6 ASCII serial port instructions AHL ChannelSts data type The following table describes the AHL ChannelSts data type. Parameter Data type Description DTRstatus UINT Used for the DTR signal (reserved) DCDstatus UINT Used for the DCD signal (bit 3 of word) 1 indicates active DSRstatus UINT...
  • Page 130: Ardarl Data Type

    Chapter 6 ASCII serial port instructions ARDARL data type The following table describes the ARDARL data type. Parameter Data type Description Channel UINT Serial port number: • 2 for the embedded serial port, or • 5-9 for serial port plug-ins installed in slots 1 through 5: •...
  • Page 131: Chapter 7

    Chapter 7 Binary instructions Binary instructions perform mathematical operations in which two elements are combined to yield a single result. Operator Description AND_MASK page 132 Integer bit-to-bit AND_MASK NOT_MASK page 134 Integer bit-to-bit negation NOT_MASK OR_MASK page 136 Integer bit-to-bit OR_MASK page 138 Rotate Left an integer value page 140...
  • Page 132: Binary Instructions

    Chapter 7 Binary instructions Integer bit-to-bit AND mask. AND_MASK Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute the Integer AND bit-to-bit mask computation. When EN = FALSE, there is no computation. Input DINT Must have integer format.
  • Page 133 Chapter 7 Binary instructions Structured text (* ST Equivalence: *) parity := AND_MASK (xvalue, 1); (* 1 if xvalue is odd *) result := AND_MASK (16#abc, 16#f0f); (* equals 16#a0c *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 134: Not_Mask

    Chapter 7 Binary instructions Integer bit-to-bit negation mask, NOT_MASK inverts a parameter value. NOT_MASK Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute the bit-to-bit negation mask computation. When EN = FALSE, there is no computation. Input DINT Must have integer format.
  • Page 135 Chapter 7 Binary instructions Structured text (*ST equivalence: *) result := NOT_MASK (16#1234); (* result is 16#FFFF_EDCB *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 136: Or_Mask

    Chapter 7 Binary instructions OR_MASK Integer OR bit-to-bit mask, OR_MASK turns bits on. Arguments Parameter Data Type Description Parameter Type Input BOOL Function enable. When EN = TRUE, execute the Integer OR bit-to-bit mask computation. When EN = FALSE, there is no computation. Input DINT Must have integer format.
  • Page 137 Chapter 7 Binary instructions Ladder diagram Structured text (* ST Equivalence: *) parity := OR_MASK (xvalue, 1); (* makes value always odd *) result := OR_MASK (16#abc, 16#f0f); (* equals 16#fbf *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 138: Rol

    Chapter 7 Binary instructions For 32-bit integers, ROL rotates integer bits to the left. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute the rotate bits left integer value computation. When EN = FALSE, there is no computation. Input DINT Integer value.
  • Page 139 Chapter 7 Binary instructions Ladder diagram Structured text (* ST Equivalence: *) result := ROL (register, 1); (* register = 2#0100_1101_0011_0101*) (* result = 2#1001_1010_0110_1010*) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 140: Ror

    Chapter 7 Binary instructions For 32-bit integers, ROR rotates integer bits to the right. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute the rotate bit right integer value computation. When EN = FALSE, there is no computation. Input DINT Any integer value.
  • Page 141 Chapter 7 Binary instructions Ladder diagram Structured text (* ST Equivalence: *) result := ROR (register, 1); (* register = 2#0100_1101_0011_0101 *) (* result = 2#1010_0110_1001_1010 *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 142: Shl

    Chapter 7 Binary instructions For 32-bit integers, SHL moves integers to the left and places 0 in the least significant bit. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, move integers to the left. When EN = FALSE, there is no integer movement.
  • Page 143 Chapter 7 Binary instructions Ladder diagram Structured text (* ST Equivalence: *) result := SHL (register,1); (* register = 2#0100_1101_0011_0101 *) (* result = 2#1001_1010_0110_1010 *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 144: Shr

    Chapter 7 Binary instructions For 32-bit integers, SHR moves integers to the right and places 0 in the most significant bit. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, move integers to the right. When EN = FALSE, there is no integer movement.
  • Page 145 Chapter 7 Binary instructions Ladder diagram Structured text (* ST Equivalence: *) result := SHR (register,1); (* register = 2#1100_1101_0011_0101 *) (* result = 2#0110_0110_1001_1010 *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 146: Xor_Mask

    Chapter 7 Binary instructions Integer exclusive OR bit-to-bit mask, XOR_MASK returns inverted bit values. XOR_MASK Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, perform the exclusive OR bit-to-bit mask computation. When EN = FALSE, there is no computation. Input DINT Must have integer format.
  • Page 147 Chapter 7 Binary instructions Structured text (* ST Equivalence: *) crc32 := XOR_MASK (prevcrc, nextc); result := XOR_MASK (16#012, 16#011); (* equals 16#003 *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 149: Boolean Instructions

    Chapter 8 Boolean instructions Boolean instructions determine a value output based on some logical calculation from inputs. The module outputs can be directly controlled from the program or independently controlled by the module using the Boolean instructions. Function Description MUX4B page 170 Similar to MUX4, but can accept BOOL type input and output BOOL type value MUX8B...
  • Page 150: F_Trig

    Chapter 8 Boolean instructions F_TRIG detects a falling edge of a Boolean variable. F_TRIG Arguments Parameter Parameter Data type Description type Input BOOL Any Boolean variable. Output BOOL TRUE when CLK changes from TRUE to FALSE. FALSE in all other cases. F_TRIG function block language examples Function Block Diagram (FBD) Ladder Diagram (LD)
  • Page 151 Chapter 8 Boolean instructions Structured Text (ST) (* ST Equivalence: F_TRIG1 is an instance of a F_TRIG block *) F_TRIG1(cmd); nb_edge := ANY_TO_DINT(F_TRIG1.Q) + nb_edge; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 152: R_Trig

    Chapter 8 Boolean instructions R_TRIG R_TRIG detects a rising edge of a Boolean variable. Arguments Parameter Parameter Data type Description type Input BOOL Any Boolean variable. Output BOOL TRUE when CLK rises from FALSE to TRUE. FALSE in all other cases. R_TRIG function block language examples Function Block Diagram (FBD) Ladder Diagram (LD)
  • Page 153 Chapter 8 Boolean instructions Structured Text (ST) (* ST Equivalence: R_TRIG1 is an instance of a R_TRIG block *) R_TRIG1(cmd); nb_edge := ANY_TO_DINT(R_TRIG1.Q) + nb_edge; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 154 Chapter 8 Boolean instructions RS resets dominant bistable. Arguments Parameter Data type Description Parameter type Input BOOL If TRUE, sets Q1 to TRUE. RESET1 Input BOOL If TRUE, resets Q1 to FALSE (dominant). Output BOOL Boolean memory state. RS function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 155 Chapter 8 Boolean instructions Structured Text (ST) (* ST Equivalence: RS1 is an instance of a RS block *) RS1(start_cmd, (stop_cmd OR alarm)); command := RS1.Q1; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 156 Chapter 8 Boolean instructions Boolean OR of two or more values. OR operation The OR operator supports additional inputs. Arguments Parameter Data Type Description Parameter Type Input BOOL Input BOOL Output BOOL Boolean OR of the input terms. OR operator ST language example (* ST equivalence: *) bo10 := bi101 OR NOT (bi102);...
  • Page 157: And

    Chapter 8 Boolean instructions AND performs a boolean AND operation between two or more values. AND operation The AND operator supports additional inputs. Arguments Parameter Parameter Data Type Description Type Input BOOL Value in Boolean data type. Input BOOL Value in Boolean data type. Output BOOL Result of the Boolean AND operation of the input values.
  • Page 158: Xor

    Chapter 8 Boolean instructions Boolean exclusive OR of two values. Arguments Parameter Parameter Data Type Description Type Input BOOL Input BOOL Output BOOL Boolean exclusive OR of the two input terms. XOR operator ST language example (* ST equivalence: *) bo10 := bi101 XOR NOT (bi102);...
  • Page 159: Not

    Chapter 8 Boolean instructions For Boolean expressions, NOT converts values to negated values. Arguments Parameter Parameter Data Type Description Type Input BOOL Any Boolean value or complex expression. Output BOOL TRUE when IN is FALSE. FALSE when IN is TRUE. NOT operator ST language example (* ST equivalence: *) bo10 := NOT (bi101);...
  • Page 160 Chapter 8 Boolean instructions SR sets dominant bistable. Arguments Parameter Data type Description Parameter type SET1 Input BOOL If TRUE, sets Q1 to TRUE (dominant). RESET Input BOOL If TRUE, resets Q1 to FALSE. Output BOOL Boolean memory state. Dominant bistable example Set1 Reset Result Q1...
  • Page 161 Chapter 8 Boolean instructions Ladder Diagram (LD) Structured Text (ST) (* ST Equivalence: SR1 is an instance of a SR block *) SR1((auto_mode & start_cmd), stop_cmd); command := SR1.Q1; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 162: Ttable

    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.
  • Page 163: Ttable Input Combinations

    Chapter 8 Boolean instructions TTABLE input combinations The function has four inputs, and therefore 16 combinations. These combinations can be found in a truth table; for each combination, the output value can be adjusted. The number of configurable combinations depends on the number of inputs connected to the function.
  • Page 164 Chapter 8 Boolean instructions TTABLE function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 165 Chapter 8 Boolean instructions Structured text Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 166: Mux8B

    Chapter 8 Boolean instructions MUX8B yields a value between eight BOOL type input and output values. MUX8B Arguments Parameter Parameter Data Type Description Type Selector Input USINT Selector integer value, must be in set [0...7]. Input BOOL Any BOOL input value. Input BOOL Any BOOL input value.
  • Page 167 Chapter 8 Boolean instructions MUX8B function language examples Function block diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 168 Chapter 8 Boolean instructions Ladder diagram Structured text Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 169 Chapter 8 Boolean instructions (* 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 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 170: Mux4B

    Chapter 8 Boolean instructions MUX4B yields a value between four BOOL type input and output values. MUX4B Arguments Parameter Parameter Data Type Description Type Selector Input USINT Selector integer value, must be in set [0...3]. Input BOOL Any BOOL input value. Input BOOL Any BOOL input value.
  • Page 171 Chapter 8 Boolean instructions MUX4B function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 172 Chapter 8 Boolean instructions 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 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 173: Chapter 9

    Chapter 9 Communication instructions Communication instructions read, write, compare, and convert communication strings. Function block Description MSG_CIPGENERIC page 174 Send a CIP generic explicit message MSG_CIPSYMBOLIC page 183 Send a CIP symbolic explicit message MSG_MODBUS page 197 Send a Modbus message MSG_MODBUS2 page 204 Send a MODBUS/TCP message over an Ethernet Channel...
  • Page 174: Msg_Cipgeneric

    Chapter 9 Communication instructions MSG_CIPGENERIC sends a common industrial protocol (CIP) explicit message MSG_CIPGENERIC over an Ethernet channel or a serial port. 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.
  • Page 175 Chapter 9 Communication instructions Parameter Parameter type Data type Description 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. Output BOOL Outputs of this instruction are updated asynchronously from the program scan.
  • Page 176: Cipappcfg Data Type

    Chapter 9 Communication instructions Ladder diagram Structured Text (ST) CIPAPPCFG data type The following table describes the CIPAPPCFG data type. Parameter Data type Description Service USINT Service code: 1 – 127 Class UINT Logical segment’s Class ID value: 1 – 65535 Instance UDINT Logical segment’s Instance ID value:...
  • Page 177: Cipcontrolcfg Data Type

    Chapter 9 Communication instructions Parameter Data type Description MemberCnt USINT Members ID count. Maximum Member ID values used: 1 - 3, 0 - No Member ID used MemberId UINT[3] Member ID values: 0 - 65535 CIPCONTROLCFG data type The following table describes the CIPCONTROLCFG data type. Parameter Data type Description...
  • Page 178: Cipstatus Data Type

    Chapter 9 Communication instructions Example: message triggering In the following example, the TriggerType value is set to 100. CIPSTATUS data type The following table describes the CIPSTATUS data type. Parameter Data type Description Error BOOL This bit is set to TRUE when the function block execution encounters an error condition. ErrorID UINT Error code value.
  • Page 179 Chapter 9 Communication instructions CIPSTATUS status bits The CIPSTATUS status bits are set based on the status of the message execution, the communication buffers, and the rung conditions. Name Description Behavior Enable Set when the rung goes true and remains set until either the DN bit or the ER bit is set and the rung goes false. Enable Waiting Set when the communication buffer is allocated for the message request.
  • Page 180: Ciptargetcfg Data Type

    Chapter 9 Communication instructions ErrorID SubErrorID Error code description code Message timed out while waiting for a response from the link layer. Server response format related error codes Message reply does not match request. Message reply data type not valid/supported. (MSG_CIPSYMBOLIC). No IP address configured for the network.
  • Page 181 Chapter 9 Communication instructions Parameter Data type Description ConnMsgTimeout UDINT Class3 Connection timeout (in milliseconds). The amount of time to wait for a reply for connected messages. The connection closes when the timeout expires. • Valid values: 800-10,000 • Set to 0 to use the default value of 3000 •...
  • Page 182 Chapter 9 Communication instructions Target path example The following table lists example values used in a target path string and describes the results for each string. String example Results "0,0" The target device is the local device. "6,1" Through Port 6 (Micro830 UPM Serial port) reach the Node at 1. "4,192.168.1.100"...
  • Page 183 Chapter 9 Communication instructions CIP message timeout timers The following table describes how timers for CIPTARGETCFG timeout parameters (UcmmTimeout and ConnMsgTimeout) behave based on message requests and status. Action Results Message is enabled UcmmTimeout timer is activated Connection is requested ConnMsgTimeout timer is activated ConnMsgTimeout timer is active UcmmTimeout timer is disabled...
  • Page 184: Msg_Cipsymbolic

    Chapter 9 Communication instructions MSG_CIPSYMBOLIC sends a common industrial protocol (CIP) symbolic MSG_CIPSYMBOLIC message over an Ethernet channel or a serial port. 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 page 213...
  • Page 185 Chapter 9 Communication instructions Arguments Parameter Parameter Data type Description type 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. CtrlCfg Input CIPCONTROLCFG Function block execution control configuration. CIPCONTROLCFG data type page 177.
  • Page 186 Chapter 9 Communication instructions MSG_CIPSYMBOLIC function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 187: Cipsymboliccfg Data Type

    Chapter 9 Communication instructions Structured Text (ST) CIPSYMBOLICCFG data type The following table describes the CIPSYMBOLICCFG data type. Parameter Data type Description Service USINT Service code: • 0 - Read (default) • 1 - Write Symbol STRING Name of the variable to Read/Write. •...
  • Page 188 Chapter 9 Communication instructions Symbolic data type support The following table lists the data types that the MSG_CIPSYMBOLIC function block supports. Data type Data type value (hexadecimal) Description BOOL 193 (0xC1) Logical Boolean with values TRUE (1) and FALSE (0) SINT 194 (0xC2) Signed 8–bit integer value...
  • Page 189: Cipappcfg Data Type

    Chapter 9 Communication instructions Symbol syntax The following table defines the valid syntax for symbols. Tip: Only global variables are supported. Symbol Syntax Example Variable PROGRAM:<program name>,<symbol name> PROGRAM:POU1.MyTag Array <symbol name>[dim3, dim2, dim1] MyTag1[0] (Maximum supported dimension is 3. MyTag2[3,6] MyTag3[1,0,4] Structure...
  • Page 190: Cipcontrolcfg Data Type

    Chapter 9 Communication instructions CIPCONTROLCFG data type The following table describes the CIPCONTROLCFG data type. Parameter Data type Description Cancel BOOL TRUE - Cancel the execution of the function block. Bit is cleared when the message is enabled. TriggerType USINT Represents one of the following: •...
  • Page 191: Cipstatus Data Type

    Chapter 9 Communication instructions CIPSTATUS data type The following table describes the CIPSTATUS data type. Parameter Data type Description Error BOOL This bit is set to TRUE when the function block execution encounters an error condition. ErrorID UINT Error code value. CIPSTATUS error codes page 179.
  • Page 192 Chapter 9 Communication instructions CIPSTATUS error codes The following table describes the error codes that are displayed in the ErrorID and SubErrorID fields of the CIPSTATUS parameter when the ER bit is set. ErrorID SubErrorID Error code description code Parameter configuration related errors Bad Channel number.
  • Page 193: Ciptargetcfg Data Type

    Chapter 9 Communication instructions ErrorID SubErrorID Error code description code Channel is shutdown or reconfiguration is in progress. Error code occurs immediately after power on until a connection is established, and is normal behavior. It may also occur in one of the following situations: •...
  • Page 194 Chapter 9 Communication instructions Target path for CIP messaging The target path for CIP messaging contains parameters which determine the path and destination of the of the CIP message. Target path syntax The target path string parameter uses the following syntax: •...
  • Page 195 Chapter 9 Communication instructions CIP/EIP message connections A maximum of 16 CIP (class 3) and 16 EIP connections are supported for client message execution. The following table describes the CIP/EIP connection behavior. Scenario Results Message request is enabled and CipConnMode=1. If a connection to the target does not exist, a CIP connection is established.
  • Page 196: Supported Data Packet Size For Cip Serial Function

    Chapter 9 Communication instructions Supported Data Packet Size for CIP Serial Function For Micro830 and Micro850 controllers, both embedded serial port and plug-in serial ports can support CIP serial communication. CIP serial communication data packet includes user data and CIP packet header. When working as a CIP serial client, Micro830/Micro850 serial ports can support a maximum of 490 bytes of read/write user data.
  • Page 197: Msg_Modbus

    Chapter 9 Communication instructions MSG_MODBUS sends a Modbus message over a serial port. MSG_MODBUS 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.
  • Page 198 Chapter 9 Communication instructions Tip: 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. MSG_MODBUS function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 199: Modbus Error Codes

    Chapter 9 Communication instructions Structured Text (ST) Modbus error codes The following table describes error codes for the MSG_MODBUS function block. Error code Error description The value of the TriggerType has been changed from 2 - 255. The local communication driver is incompatible with the MSG instruction. A local channel configuration parameter error exists.
  • Page 200: Modbuslocpara Data Type

    Parameter Data type Description Channel UINT Micro800 PLC serial port number: • 2 for the embedded serial port, or • 5-9 for serial port plug-ins installed in slots 1 through • 5 for slot 1 • 6 for slot 2 •...
  • Page 201 Chapter 9 Communication instructions MSG_MODBUS message triggering A Modbus message can be triggered periodically by setting a non-zero value to the TriggerType parameter. The following table describes what happens when the TriggerType parameter is used with the MSG_MODBUS function block. Action Results Message is enabled...
  • Page 202: Message Execution Process (Rung = True)

    Chapter 9 Communication instructions MODBUSLOCPARA custom command support Custom Commands in the range of 0-255 that are not already assigned to a Modbus command are also supported. If a custom command is used then the LocalCfg:ElementCnt contains the number of bytes received. The response is received into the Local Address Data and overwrites the request data.
  • Page 203 Chapter 9 Communication instructions Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 204: Modbustarpara Data Type

    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. Wait queue: Messages that cannot be added to the Com queue are added to the Wait queue to be processed at a later time.
  • Page 205: Msg_Modbus2

    Chapter 9 Communication instructions MSG_MODBUS2 sends a MODBUS/TCP message over an Ethernet Channel. MSG MODBUS2 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.
  • Page 206 Chapter 9 Communication instructions Parameter Parameter Data type Description type Error Output BOOL TRUE - When error occurs. FALSE - No error. ErrorID Output UINT Show the error code when message transfer failed. Modbus2 error codes page 208. SuberrorID Output UINT Used to verify status bits: •...
  • Page 207 Chapter 9 Communication instructions MSG_MODBUS2 function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 208: Modbus2 Error Codes

    Chapter 9 Communication instructions Structured Text (ST) Modbus2 error codes The following table describes error codes for the MSG_MODBUS2 function block. Error code Error description The value of the TriggerType has been changed from 2 - 255. The local communication driver is incompatible with the MSG instruction. A local channel configuration parameter error exists.
  • Page 209: Modbus2Locpara Data Type

    Chapter 9 Communication instructions MODBUS2LOCPARA data type The following table describes the MODBUSLOCPARA data type parameters. Parameter Data type Description Channel UINT Local Ethernet port number: • 4 for Micro850 & Micro820 embedded Ethernet port TriggerType UDINT Message trigger type: •...
  • Page 210: Modbus2Tarpara Data Type

    USINT Unit Identifier. Used to communicate with slave devices through a Modbus bridge. Refer Modbus specification for more details. Note that Micro800 shall not attempt to validate this value. 0 - 255 Set to 255 if Target device is not a bridge.
  • Page 211 Chapter 9 Communication instructions Parameter Data type Description 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. •...
  • Page 212 Chapter 9 Communication instructions Modbus/TCP message connections Modbus/TCP client supports a maximum of 16 connections. The following table describes Modbus/TCP connection behavior. Scenario Results Message request is enabled, and a connection to the target does not If a connection to the target does not exist, a new connection is established. exist.
  • Page 213: Message Execution Processes And Timing Diagrams

    Chapter 9 Communication instructions The following topics describe how and when MSG_CIPGENERIC, Message execution MSG_CIPSYMBOLIC and MSG_MODBUS2 message instructions execute processes and timing based on their bit and rung conditions. diagrams Message execution process (general) page 213 Message execution sequence (general) page 214 Message execution process (Rung = TRUE) page 202...
  • Page 214: Message Execution Process (General)

    Chapter 9 Communication instructions Message execution process (general) The following diagram shows how and when messages execute based on the status of the Com queue. See the table below for a detailed description of each the sequence. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 215: Message Execution Sequence (General)

    Chapter 9 Communication instructions Message execution sequence (general) The following table describes the sequence of events identified in the preceding diagram. Description of events The message is enabled. If the Com queue is empty, the buffer is allocated for the message and the message is added to the Com queue for transmission. The Com queue size is 4 and each channel has a separate queue.
  • Page 216 Chapter 9 Communication instructions Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 217: Message Execution Timing Diagram (Rung = True)

    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. Wait queue: Messages that cannot be added to the Com queue are added to the Wait queue to be processed at a later time.
  • Page 218: Message Execution Process (Rung = False)

    Chapter 9 Communication instructions Timing diagram for (Rung = TRUE) Message execution process (Rung = FALSE) The following process diagram describes the message instruction events that occur when the Rung condition is True. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 219 Chapter 9 Communication instructions Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 220: Message Execution Timing Diagram (Rung = False)

    Chapter 9 Communication instructions Message execution timing diagram (Rung = FALSE) The following table describes the message conditions and bit status for each execution step identified in the timing diagram when the rung goes to FALSE during execution. Step Message description Bit status Rung condition goes TRUE.
  • Page 221: Message Execution Process (Error)

    Chapter 9 Communication instructions Message execution process (Error) The following table describes the message conditions and bit status for each execution step identified in the timing diagram when an error occurs during execution. Step Message description Bit status Rung condition goes TRUE. EN bit is set.
  • Page 222: Using The Communication (Message) Function Blocks

    Defines the objects to be included in every CIP device: ODVA web site (http://www.odva.org) Identity object, Messsage Router object and the Network object. Micro800 Programmable Controllers: Getting Provides quickstart instructions for using CIP GENERIC and Rockwell Automation Literature Library Started with CIP Client Messaging CIP Symbolic Messaging in Micro830 and Micro850 programmable logic controllers (PLC).
  • Page 223 Chapter 9 Communication instructions Accessing user manuals and quickstart guides To access quickstart guide from the Help Menu 1. On the Help menu, click View Help. 2. Double-click on Connected Components Workbench. 3. Double-click on Getting Started with Connected Components Workbench.
  • Page 224 Chapter 9 Communication instructions To access manuals from the Rockwell Automation Literature Library 1. Go to http://literature.rockwellautomation.com. 2. Click Advanced Search. 3. Enter the product information and other search criteria. This example shows search criteria for Kinetix manuals: 4. Click Search. To access non-English language versions of user manuals 1.
  • Page 225: Example: How To Create A Msg_Cipgeneric Messaging Program To Read Data From A Controller

    Chapter 9 Communication instructions Values for the MSG_CIPGENERIC AppCfg parameter Use the values from the CIP register object in your input variables to configure the MSG_CIPGENERIC function block parameters. The following image shows how the CIP register object data values are used in the MSG_CIPGENERIC function block parameters.
  • Page 226 Chapter 9 Communication instructions Creating a MSG_CIPGENERIC messaging program Perform the following tasks to create a MSG_CIPGENERIC messaging program that can be used to read information from a different controller. Task Identify initial values for the input variables (MSG_CIPGENERIC) page 227 Add a MSG_CIPGENERIC function block and variables page 227 Configure initial values for variables...
  • Page 227 Chapter 9 Communication instructions Identify initial values for the input variables (MSG_CIPGENERIC) Follow these general steps to obtain the Identity Object values to use for configuring the AppCfg parameter initial values. To add input variables and initial values 1. From the Help menu, click User Manuals. 2.
  • Page 228 Chapter 9 Communication instructions Add a MSG_CIPGENERIC function block and variables Follow these steps to start a project, add a MSG_CIPGENERIC function block to a ladder diagram program and then add input variables to the function block. Add a MSG_CIPGENERIC function block 1.
  • Page 229 Chapter 9 Communication instructions Add MSG_CIPGENERIC variables 1. Add local input variables: • In the Project Organizer, double-click Local Variables to display the Local Variables page. • In the Variables page, add the variables and data types listed in the table. Parameter Variable Name Data Type...
  • Page 230 Chapter 9 Communication instructions Configure initial values for variables Follow these steps to add initial values to the input variables you previously created and then assign the variables to the correct MSG_CIPGENERIC function block input parameter. To configure initial values for the MyCtrlCfg input variable 1.
  • Page 231 Chapter 9 Communication instructions To configure initial values for the MyTargetCfg input variable 1. From the Local Variables page, expand MyTargetCfg to view its parameters. 2. Enter the following values in the Initial Value column for each parameter. Parameter Initial Value Comments MyTargetCfg.Path ‘4,192.168.100.4’...
  • Page 232 Chapter 9 Communication instructions Result The parameters in the Variables page should look similar to the following image. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 233 Chapter 9 Communication instructions To assign the variables to the parameters 1. In the ladder diagram POU, click the top portion of the variable input block to display the variable drop-down list. 2. From the list, assign each input parameter to its correct input variable as identified in the following table.
  • Page 234 Chapter 9 Communication instructions Add a contact and a coil Follow these steps to add a coil and a contact to the MSG_CIPGENERIC function block, which will be used to convert the catalog information to a human readable string. 1. In the Toolbox, select Direct Contact and drag and drop it to the left of the MSG_CIPGENERIC function block input on the first ladder rung.
  • Page 235 Chapter 9 Communication instructions Add a COP function block, variables and contact (MSG_CIPGENERIC) Follow these steps to add a COP function block, variables and a contact. The COP instruction is used to convert data from the source data type (for example, DINT or REAL) to the destination data type.
  • Page 236 Chapter 9 Communication instructions 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.
  • Page 237 Chapter 9 Communication instructions Verify correct IP configuration on Controller B Follow these steps to verify the IP address settings are correct on Controller B. 1. Open the application workspace for the controller: 2. From the Project Organizer, double-click the controller to display it in the application workspace.
  • Page 238 Chapter 9 Communication instructions Results The Internet Protocol options in your controller configuration page should look similar to the following image. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 239: Example: How To Create A Msg_Cipsymbolic Messaging Program To Write A Value To A Variable

    Chapter 9 Communication instructions Example: How to create a MSG_CIPSYMBOLIC messaging program to write a value to a variable This example shows you how to create a message program to write a value to a Controller B global variable from Controller A. Creating a MSG_CIPSYMBOLIC messaging program Perform the following tasks to create a MSG_CIPSYMBOLIC messaging program that can be used to write a value to a global variable on another...
  • Page 240 Chapter 9 Communication instructions Add a COP function block, variables and a contact (MSG_CIPSYMBOLIC) Follow these steps to add a COP function block, variables and a contact. The COP instruction is used to convert the data you enter to the destination data type so it will be compatible with the controller variable.
  • Page 241 Chapter 9 Communication instructions Add COP variables and initial values 1. Add variables: • In the ladder diagram POU, double-click Local Variables to display the Local Variables page. • In the Variables page, add the variables and data types listed in the table below.
  • Page 242 Chapter 9 Communication instructions 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.
  • Page 243 Chapter 9 Communication instructions Add an Equal operator and a coil Follow these steps to add an Equal (=) operator, variables and a coil. The Equal instruction is used to trigger writing a value if the data type conversion was successful.
  • Page 244 Chapter 9 Communication instructions To add a coil to the Equal operator 1. In the Toolbox, select Direct Coil and drag and drop it to the right of the Equal operator output on the second ladder rung. 2. In the Variable Selector, type WriteValue in the Name field for the coil. Result The second rung of your ladder diagram program for MSG_CIPGENERIC messaging should look similar to the following image.
  • Page 245 Chapter 9 Communication instructions 3. Assign variable names: • In the ladder diagram POU, double-click a variable to display the Variable Selector. • In the Variable Selector, assign variable names as listed in the following table. 4. For the Data variable, double click Dimension and change the array size to [1..4].
  • Page 246 Chapter 9 Communication instructions Results The Local Variables selector should look similar to the following image. Configure initial values for TargetCfg 1. From the ladder diagram POU, double-click the A_TarCfg variable to open the global variables selector. 2. Expand the TargetCfg parameter to view additional parameters. 3.
  • Page 247 Chapter 9 Communication instructions Results The User Global Variables selector should similar to the following image. Values for the Data parameter The values for A_Data will be automatically obtained from the COP function block on Rung 1. Also, notice that A UDINT is 32 bit data, USINT is 8 bit data, so A_Data is a one dimension array with 4 elements Add a contact 1.
  • Page 248 Chapter 9 Communication instructions Result The third rung of your ladder diagram program for MSG_CIPSYMBOLIC messaging should look similar to the following image. Verify correct IP configuration on Controller B Follow these steps to verify the IP address settings are correct on Controller B. 1.
  • Page 249 Chapter 9 Communication instructions Results The Internet Protocol options in your controller configuration page should look similar to the following image. Create global variable for Controller B Follow these steps to create a Global variable for controller B. 1. In the Project Organizer, double-click Global Variables to display the global variables selector.
  • Page 250 Chapter 9 Communication instructions Results The Global Variables selector should look similar to the following image. Review the complete program results The following example shows the complete MSG_CIPSYMBOLIC messaging program after it has executed. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 251: Example: How To Configure Modbus Communication To Read From And Write To A Drive

    Chapter 9 Communication instructions Controller B results The following two images show the values for Controller B before and after the messaging program is executed. Before the program is executed After the program is executed Example: How to configure Modbus communication to read from and write to a drive These examples show you how to configure Modbus communication to read status data from and write control data to a PowerFlex 4 drive using the...
  • Page 252 Chapter 9 Communication instructions 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.
  • Page 253 Chapter 9 Communication instructions Drive status An "1807" indicates the drive is • Ready (bit 0 ON), • Active (bit 1 ON) • Commanded Forward (bit 2 ON) • Rotating Forward (bit 3 ON) • Status of some digital inputs on the drive A "278"...
  • Page 254 Chapter 9 Communication instructions Variable Value Description *.Channel Channel 5 - location of SERIALISOL module *.TriggerType Trigger on False-to-True transition *.Cmd Modbus Function Code "03" - Read Holding Registers *.ElementCnt Length *.Addr 8449 PowerFlex Logic Status word address + 1 *.Node PowerFlex Node address *_laddr[1]...
  • Page 255 Chapter 9 Communication instructions Modbus Write example The following MSG_MODBUS instruction is used to write control data to a PowerFlex 40 drive. MSG_MODBUS Write configuration The following image shows the variables and the values used to configure the MSG_MODBUS instruction to write control data to a PowerFlex 4 drive. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 256 Chapter 9 Communication instructions MSG_MODBUS Write variables The following table lists the variables, values and describes the purpose of each variable. Variable Value Description *.Channel Channel 5 - location of SERIALISOL module *.TriggerType Trigger on False-to-True transition *.Cmd Modbus Function Code "16" - Write Holding Registers *.ElementCnt Length *.Addr...
  • Page 257: Communication Protocol Support

    Chapter 9 Communication instructions The MSG_CIP function blocks support different communication protocols as Communication protocol described in this section. support Function block support for message communication protocols The following table lists the communication protocols supported by the Modbus and CIP message function blocks. Messaging Protocol Communication media Use this function block...
  • Page 258: Embedded Communication Channels

    Chapter 9 Communication instructions EtherNet/IP Micro850 controllers support up to 16 simultaneous EtherNet/IP server connections through an embedded Ethernet communication channel. The channel can be used to connect a Micro850 controller to various devices through a local area network using a 10 Mbps/100 Mbps transfer rate. Common Industrial Protocol (CIP) CIP Serial CIP serial uses DF1 Full Duplex protocol, and provides point-to-point connection...
  • Page 259: Rockwell Automation Publication 2080-Rm001D-En-E - February

    Chapter 10 Compare instructions Compare instructions compare values using an expression or a specific compare instruction. Operator Description Equal page 260 Compares the first input to the second input to determine equality for Integer, Real, Time, Date, and String data types. (>) Greater Than page 262...
  • Page 260: Compare Instructions Equal

    Chapter 10 Compare instructions Equal Equal (=) compares the first input to the second input to determine equality for Integer, Real, Time, Date, and String data types. Recommendation: Using the Equal (=) operator Equality testing of Time values is not recommended for TON, TP, and TOF functions.
  • Page 261 Chapter 10 Compare instructions 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.
  • Page 262: Greater Than

    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 Parameter Data Type Description Parameter Type Input BOOL Function enable. When Enable = TRUE, execute the input comparison.
  • Page 263: Greater Than Or Equal

    Chapter 10 Compare instructions 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. Special recommendations for >= operator For TON, TP, and TOF, equality testing of Time values is not recommended.
  • Page 264: Less Than

    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 Parameter Data Type Description Parameter Type Input BOOL Function enable. When Enable = TRUE, execute the input comparison.
  • Page 265: Less Than Or Equal

    Chapter 10 Compare instructions Less than or equal For Integer, Real, Time, Date, and String values, Less Than or Equal compares 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 Parameter Parameter Type...
  • Page 266: Not Equal

    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 Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute current compare computation.
  • Page 267: Counter Instructions

    Chapter 11 Counter instructions Counter instructions are used to control operations based on the number of events. Function Description page 268 Block counts (integers) from a given value down to 0, 1 by 1. page 269 Counts (integers) from 0 up to a given value, 1 by 1. CTUD page 273 Counts (integers) from 0 up to a given value, 1 by 1, or from a given value down to 0 (1 by 1).
  • Page 268: Ctd

    Chapter 11 Counter instructions CTD counts (integers) from a given value down to 0, 1 by 1. Arguments Parameter Parameter type Data type Description Input BOOL Counting input (down-counting when CD is a rising edge). LOAD Input BOOL Load command (dominant) (CV = PV when LOAD is TRUE).
  • Page 269 Chapter 11 Counter instructions Ladder Diagram (LD) Structured Text (ST) (*ST Equivalence: CTD1 is an instance of block *) CTD1(trigger,load_cmd,100); underflow := CTD1.Q; result := CTD1.CV; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 270: Ctu

    Chapter 11 Counter instructions CTU counts (integers) from 0 up to a given value, 1 by 1. Arguments Parameter Parameter type Data type Description Input BOOL Counting input (counting when CU is a rising edge). RESET Input BOOL Reset dominant command. Input DINT Programmed maximum value.
  • Page 271 Chapter 11 Counter instructions CTU function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 272 Chapter 11 Counter instructions Structure Text (* ST Equivalence: CTU1 is an instance of CTU block*) CTU1(trigger,NOT(auto_mode),100); overflow := CTU1.Q; result := CTU1.CV; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 273: Ctud

    Chapter 11 Counter instructions CTUD CTUD counts (integers) from 0 up to a given value, 1 by 1, or from a given value down to 0 (1 by 1). Arguments Parameter Parameter type Data type Description Input BOOL Up-counting (when CU is a rising edge). Input BOOL Down-counting (when CD is a rising edge).
  • Page 274 Chapter 11 Counter instructions CTUD function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 275 Chapter 11 Counter instructions Structured Text (ST) (* ST Equivalence: We suppose CTUD1 is an instance of block*) CTUD1(trigger1, trigger2, reset_cmd, load_cmd,100); full := CTUD1.QU; empty := CTUD1.QD; nb_elt := CTUD1.CV; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 277: Chapter 12

    Chapter 12 Data conversion instructions Data conversion instructions are used to convert the data type of a variable to a different data type. Operator Description ANY_TO_BOOL page 278 Converts to Boolean ANY_TO_BYTE page 279 Converts to BYTE ANY_TO_DATE page 280 Converts to Date ANY_TO_DINT page 281...
  • Page 278: Any_To_Bool

    Chapter 12 Data conversion instructions ANY_TO_BOOL converts a value to a Boolean value. ANY_TO_BOOL Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When Enable = TRUE, execute the conversion to BOOLEAN computation. When Enable = FALSE, there is no computation. Input SINT - USINT - BYTE - INT - UINT - WORD - Any non-Boolean value.
  • Page 279: Any_To_Byte

    Chapter 12 Data conversion instructions ANY_TO_BYTE converts a value to an 8-bit Byte value. ANY_TO_BYTE Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 8-bit BYTE computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 280: Any_To_Date

    Chapter 12 Data conversion instructions ANY_TO_DATE converts a value to a Date value. ANY_TO_DATE Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the Date computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 281: Any_To_Dint

    Chapter 12 Data conversion instructions ANY_TO_DINT converts a value to 32-bit Double Integer value. ANY_TO_DINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 32-bit Double Integer computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 282: Any_To_Dword

    Chapter 12 Data conversion instructions ANY_TO_DWORD converts a value to a 32-bit double Word value. ANY_TO_DWORD Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 32-bit double Word computation. When Enable = FALSE, there is no computation.
  • Page 283: Any_To_Int

    Chapter 12 Data conversion instructions ANY_TO_INT converts a value to a 16-bit Integer value. ANY_TO_INT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 16-bit Integer computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 284: Any_To_Lint

    Chapter 12 Data conversion instructions ANY_TO_LINT converts a value to a 64-bit Long Integer value. ANY_TO_LINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 64-bit Long Integer computation. When Enable = FALSE, there is no computation.
  • Page 285: Any_To_Lreal

    Chapter 12 Data conversion instructions ANY_TO_LREAL converts any value to a Long Real value. ANY_TO_LREAL Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the long Real computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 286: Any_To_Lword

    Chapter 12 Data conversion instructions ANY_TO_LWORD converts a value to a 64-bit Long Word value. ANY_TO_LWORD Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 64-bit long Word computation. When Enable = FALSE, there is no computation.
  • Page 287: Any_To_Real

    Chapter 12 Data conversion instructions ANY_TO_REAL converts a value to a Real value. ANY_TO_REAL Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the Real computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 288: Any_To_Sint

    Chapter 12 Data conversion instructions ANY_TO_SINT converts a value to a Short Integer value. ANY_TO_SINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 8-bit Short Integer computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 289: Any_To_String

    Chapter 12 Data conversion instructions ANY_TO_STRING converts a value to a String value. ANY_TO_STRING Arguments Parameter Parameter Type Data Type Description Input BOOL C Function enable. When Enable = TRUE, execute the conversion to String computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 290: Any_To_Time

    Chapter 12 Data conversion instructions ANY_TO_TIME converts a non-Time or non-Date value to a Time value. ANY_TO_TIME Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the Time computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 291: Any_To_Udint

    Chapter 12 Data conversion instructions ANY_TO_UDINT converts a value to a 32-bit Unsigned Double Integer value. ANY_TO_UDINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 32-bit Double Integer computation.
  • Page 292: Any_To_Uint

    Chapter 12 Data conversion instructions ANY_TO_UINT converts a value to an Unsigned Integer value. ANY_TO_UINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 16-bit Unsigned Integer computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 293: Any_To_Ulint

    Chapter 12 Data conversion instructions ANY_TO_ULINT converts a value to a 64-bit Unsigned Long Integer value. ANY_TO_ULINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 64-bit Unsigned Long Integer computation.
  • Page 294: Any_To_Usint

    Chapter 12 Data conversion instructions ANY_TO_USINT converts a value to an Unsigned Short Integer value. ANY_TO_USINT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 8-bit Unsigned Short Integer computation. When Enable = FALSE, there is no computation.
  • Page 295: Any_To_Word

    Chapter 12 Data conversion instructions ANY_TO_WORD converts a value to a 16-bit Word value. ANY_TO_WORD Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When Enable = TRUE, execute the conversion to the 16-bit Word computation. When Enable = FALSE, there is no computation. Applies only to LD programs.
  • Page 297: Data Manipulation Instructions

    Chapter 13 Data manipulation instructions Data manipulation instructions are used to alter the output data to change the status without altering the program. Function block Description AVERAGE page 298 Running average over N samples. page 300 Copy binary data in the Source (Src) to the Destination (Dest). Function Description page 307...
  • Page 298: Average

    Chapter 13 Data manipulation 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. Average function block operation • The number of samples (N) cannot exceed 128. •...
  • Page 299 Chapter 13 Data manipulation instructions AVERAGE function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) (* ST Equivalence: AVERAGE1 an instance of an AVERAGE block *) AVERAGE1((auto_mode & store_cmd), sensor_value, 100); ave_value := AVERAGE1.XOUT; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 300: Cop

    Chapter 13 Data manipulation instructions COP copies the binary data in the Source to the Destination, and leaves the 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.
  • Page 301 Chapter 13 Data manipulation instructions Parameter Parameter type Data type Description Dest Input BOOL DWORD Initial element to be overwritten by the source. SINT REAL USINT TIME BYTE DATE STRING UINT LWORD WORD ULINT DINT LINT UDINT DestOffset Input UINT Destination element offset.
  • Page 302 Chapter 13 Data manipulation instructions COP function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 303 Chapter 13 Data manipulation instructions Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 304: Cop Operation Status Values

    Chapter 13 Data manipulation instructions COP operation status values The following table describes COP operation status values: COP Status value Status description 0x00 No action taken (not enabled). 0x01 COP function block success. 0x02 Destination has spare bytes when copying from String. 0x03 Source data are truncated.
  • Page 305: Min

    Chapter 13 Data manipulation instructions MIN yields the minimum of two integer values. Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, execute the minimum integer value computation When EN = FALSE, there is no computation. Input DINT Any signed integer value.
  • Page 306 Chapter 13 Data manipulation instructions Structured text (* ST Equivalence: *) new_value := MAX (MIN (max_value, value), min_value); (* bounds the value to the [min_value..max_value] set *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 307: Max

    Chapter 13 Data manipulation instructions MAX yields the maximum of two integer values. Arguments Parameter Parameter Data Type Description Type Input BOOL Function enable. When EN = TRUE, execute maximum integer value computation. When EN = FALSE, there is no computation. Input DINT Any signed integer value.
  • Page 308 Chapter 13 Data manipulation instructions Ladder diagram Structured text (* ST Equivalence: *) new_value := MAX (MIN (max_value, value), min_value); (* bounds the value to the [min_value..max_value] set *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 309: High-Speed Counter (Hsc) What Is A High-Speed Counter

    Chapter 14 High-Speed Counter (HSC) instructions High-speed counter instructions are used to monitor and control the high-speed counter. Function block Description page 311 HSC applies high presets, low presets and output source values to the high-speed counter. HSC_SET_STS page 331 HSC_SET_STS manually sets or resets the HSC counting status.
  • Page 310 Micro800 controller support for HSC All Micro830 and Micro850 controllers, except for 2080-LCxx-AWB, support up to six HSC inputs. HSC functionality is implemented in Micro800 controllers using high-speed counter hardware (embedded inputs in the controller), and the HSC instruction in the application. The HSC instruction configures the high- speed counter hardware and updates the image accumulator.
  • Page 311: Hsc

    Chapter 14 High-Speed Counter (HSC) instructions HSC applies high presets, low presets and output source values to the high-speed counter. Arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, execute the HSC operation specified in the HSC command parameter.
  • Page 312 Chapter 14 High-Speed Counter (HSC) instructions HSC function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 313: Hsccmd Values

    Chapter 14 High-Speed Counter (HSC) instructions Structured Text (ST) HSCCmd values The following table describes the HSC commands for each HSC command value. HSC command Command description 0x01 HSC RUN • Start HSC (if HSC is in Idle mode and the rung is enabled). •...
  • Page 314: Hscapp Data Type

    Chapter 14 High-Speed Counter (HSC) instructions HSCAPP data type HSCAppData (data type HSCAPP) is used to configure the HSC application. HSCAppData parameters The following table lists the HSCAppData parameters. Parameter Data type Data format User program Description access PLSEnable BOOL read/write Enable or disable the Programmable Limit Switch (PLS).
  • Page 315 Chapter 14 High-Speed Counter (HSC) instructions HSCID Parameter Data type Data format User program access HSCApp.HSCID UINT word read/write Identifies the High-Speed Counter to be used. The following table lists the values for defining the HSC ID: Output Selection Description First word of HSC Function Data 15-13 Module type of HSC:...
  • Page 316 Chapter 14 High-Speed Counter (HSC) instructions HSCMode Counting mode Up counter. The accumulator is immediately cleared (0) when it reaches the high preset. A low preset cannot be defined in this mode. Up counter with external reset and hold. The accumulator is immediately cleared (0) when it reaches the high preset.
  • Page 317 Chapter 14 High-Speed Counter (HSC) instructions HPSetting Parameter Data type User program access HSCApp.HPSetting DINT read/write 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.
  • Page 318 Chapter 14 High-Speed Counter (HSC) instructions UFSetting Parameter Data type User program access HSCApp.UFSetting DINT read/write Underflow setting that defines the lower count limit for the counter. • If the counter's accumulated value decrements below the value specified in UFSetting, an underflow interrupt is generated. •...
  • Page 319 Chapter 14 High-Speed Counter (HSC) instructions 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 HSCApp.HPOutput UDINT read/write Defines the state (1 = ON or 0 = OFF) of the outputs on the controller when the high preset is reached.
  • Page 320: Hscsts Data Type

    Chapter 14 High-Speed Counter (HSC) instructions HSCAppData parameters example The following image shows the HSCAppData parameters in the Variable Selector. HSCSTS data type HSCSTSInfo (data type HSCSTS) displays the status of the High-Speed Counter. HSCSTSInfo status actions During HSC counting, the following HSC status actions occur. •...
  • Page 321 Chapter 14 High-Speed Counter (HSC) instructions Parameter Data HSC mode User program access Description type CountEnable BOOL 0...9 read only Counting enabled. BOOL 0...9 read/write Underflow is detected. CountDir BOOL 0...9 read only 1: count up; 0: count down. HPReached BOOL 2...9 read/write...
  • Page 322 Chapter 14 High-Speed Counter (HSC) instructions 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).
  • Page 323 Chapter 14 High-Speed Counter (HSC) instructions 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.
  • Page 324 Chapter 14 High-Speed Counter (HSC) instructions 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).
  • Page 325 Chapter 14 High-Speed Counter (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.
  • Page 326 Chapter 14 High-Speed Counter (HSC) instructions LPCauseInter Parameter Data type HSC mode User program access HSCSTS.LPCauseInter BOOL 2...9 read/write 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.
  • Page 327 Chapter 14 High-Speed Counter (HSC) instructions ErrorCode Parameter Data type HSC mode User program access HSCSTS.ErrorCode BOOL 0...9 read only Displays the error codes detected by the HSC sub-system. Error code sub-element HSC counting error Error description code Bit 15-8 (high byte) 0-255 The non-zero value for the high byte indicates that the HSC error is due to the PLS data setting.
  • Page 328 Chapter 14 High-Speed Counter (HSC) instructions 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.
  • Page 329 Chapter 14 High-Speed Counter (HSC) instructions LPOutput Parameter Data type User program access HSCApp.LPOutput UDINT read/write LPOutput (HSCApp.LPOutput) defines the state (1 = "on", 0 = "off ") of the outputs on the controller when the low preset is reached. For more information on how to directly turn outputs on or off based on the low preset, see OutputMask.
  • Page 330: Pls Data Type

    Chapter 14 High-Speed Counter (HSC) instructions PLS data type PLSData (data type PLS) is used to configure the programmable limit switch. PLSData structure elements The PLS data structure is a flexible array with the following elements. Element Element order Data type Element description HSCHP Word 0...1...
  • Page 331: Hsc Status Codes (Sts)

    Chapter 14 High-Speed Counter (HSC) instructions HSCApp settings versus PLSData settings When the PLS function is enabled, relevant HSCApp settings are superseded by the corresponding PLSData settings as shown in the following table. HSCApp setting PLSData setting HSCAPP.HpSetting HSCHP HSCAPP.LpSetting HSCLP HSCAPP.HPOutput HSCHPOutput...
  • Page 332: Hsc_Set_Sts

    Chapter 14 High-Speed Counter (HSC) instructions HSC_SET_STS manually sets or resets the HSC counting status. HSC_SET_STS HSC_SET_STS function block operation The HSC function block must be stopped (not counting) for the HSC_SET_STC function block to set or reset its HTS status. If the HSC function block is not stopped, the input parameters will continue to update and any changes made using the HSC_SET_STS function block will be ignored.
  • Page 333 Chapter 14 High-Speed Counter (HSC) instructions HSC_SET_STS function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 334 Chapter 14 High-Speed Counter (HSC) instructions Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 335: Using The High-Speed Counter Instructions

    Chapter 14 High-Speed Counter (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 page 335 Configuring a High-Speed Counter (HSC) user interrupt page 337 Configuring a Programmable Limit Switch (PLS) page 341...
  • Page 336: High-Speed Counter (Hsc) User Interrupt Dialog Box

    Chapter 14 High-Speed Counter (HSC) instructions High-Speed Counter (HSC) User Interrupt dialog box Use the HSC interrupt dialog box to: • Configure the interrupt properties, such as ID and the program to use it in. • Configure the interrupt parameters. How do I open the High-Speed Counter (HSC) User Interrupt dialog box? •...
  • Page 337: Configuring High-Speed Counter (Hsc) User Interrupts

    Chapter 14 High-Speed Counter (HSC) instructions Configuring High-Speed Counter (HSC) user interrupts A user interrupt causes the controller to suspend the task it is currently performing, perform a different task, and then return to the suspended task at the point where the task was suspended. 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.
  • Page 338 Chapter 14 High-Speed Counter (HSC) instructions To configure an HSC interrupt 1. In Interrupt Type, select High-Speed Counter (HSC) User Interrupt. 2. Select the properties: HSC Interrupt properties page 338 3. Select the parameters: HSC Interrupt parameters page 339. HSC Interrupt properties The HSC Interrupt properties status bits indicate the enabled/disabled status, the execution status, and whether or not the interrupt condition is lost.
  • Page 339 Chapter 14 High-Speed Counter (HSC) instructions User Interrupt Pending (HSC0.PE) Parameter Data format HSC modes User program access HSCO.PE 0...9 read only 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.
  • Page 340 Chapter 14 High-Speed Counter (HSC) instructions 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. Underflow Mask (HSC0.MN) Parameter Data format HSC modes User program access HSCO.MN 2...9...
  • Page 341: Configuring A Programmable Limit Switch (Pls)

    Enabling PLS in the HSC The PLS mode only operates in tandem with the HSC of the Micro800 controller, and must be enabled in the HSC by setting the HSCAppData.PLSEnable parameter to True.
  • Page 342: Example: How To Create A High-Speed Counter (Hsc) Program

    Chapter 14 High-Speed Counter (HSC) instructions Example: How to create a High-Speed Counter (HSC) program This example shows you how to create a High-Speed Counter (HSC) program that uses a quadrature encoder and includes a Programmable Limit Switch (PLS) function. Quadrature encoder used in the example The High Speed Counter program example uses an HSC function block and a quadrature counter with phased inputs A and B.
  • Page 343 Chapter 14 High-Speed Counter (HSC) instructions Creating a High-Speed Counter (HSC) program Perform the following tasks for to create, build, and test the HSC program, and then add a PLS function. Task Create a ladder diagram and add variables page 343 Assign values to the HSC variables page 347 Assign variables and build the program...
  • Page 344 Chapter 14 High-Speed Counter (HSC) instructions To create a ladder diagram and add variables 1. In the Device Toolbox, expand the Catalog tab to view the device folders. 2. Expand the Controllers folder and the Micro830 folder to view all Micro830 controllers.
  • Page 345 High-Speed Counter (HSC) instructions Chapter 14 5. In the Toolbox: • Double-click Direct Contact to add it to the rung, or • Drag and drop a Direct Contact onto the rung. 6. Assign a variable to the direct contact: • Double-click on the direct contact to display the Variable Selector, and then click the I/O - Micro830 tab.
  • Page 346 Chapter 14 High-Speed Counter (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. 8. Double-click the function block to display the Block Selector. 9.
  • Page 347 Chapter 14 High-Speed Counter (HSC) instructions Result The Variables page should look similar to the following image. Assign values to the HSC variables After you add variables, follow these steps to add values to the variables using the Initial Value column in the Variable Selector. A standard program usually uses a routine to assign values to the variables.
  • Page 348 Chapter 14 High-Speed Counter (HSC) instructions 3. Assign the rest of the values to the MyAppData variables as shown in the following figure. • In the Initial Value field, enter the value. • HSCAPP data type page 314 for more information on the description for each value 4.
  • Page 349 Chapter 14 High-Speed Counter (HSC) instructions Assign variables and build the program After you enter values in the HSC variables, follow these steps to assign the variables to the function block, and build the program. 1. From the ladder diagram, assign each variable to its HSC function block element as shown in the following figure.
  • Page 350 Chapter 14 High-Speed Counter (HSC) instructions 3. From the controller tree, click Embedded I/O, and select input filters for your encoder. 4. Verify the encoder is connected to the Micro830 controller. 5. Start the Micro830 controller and connect it to your computer. 6.
  • Page 351 Chapter 14 High-Speed Counter (HSC) instructions 5. Select Lock and Logical Value to force the input to the ON position. To view results 1. Click the Local Variables tab to view variable changes. 2. Expand MyAppData and MyInfo variable list. 3.
  • Page 352 Chapter 14 High-Speed Counter (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.
  • Page 353: Add A Programmable Limit Switch (Pls) Function

    Chapter 14 High-Speed Counter (HSC) instructions Add a Programmable Limit Switch (PLS) function This example shows you how to add a Programmable Limit Switch (PLS) function to the HSC program. Variable values for the counter settings • MyAppData.PlsEnable is used to enable or disable the PLS settings. It should be set to FALSE (disabled) if the MyAppData variable is used.
  • Page 354 Chapter 14 High-Speed Counter (HSC) instructions 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. • High Presets should always be set lower than the OFSetting and the Low Preset should always be greater than the UFSetting.
  • Page 355: Example: Programmable Limit Switch (Pls) Enabled

    Chapter 14 High-Speed Counter (HSC) instructions Example: Programmable Limit Switch (PLS) enabled This topic describes the results when PLS is enabled using specific HSC and PLSData parameter values. HSC parameter values This example assumes the following HSC parameters use these values. •...
  • Page 356 Chapter 14 High-Speed Counter (HSC) instructions PLS enabled results For this example, the following events will occur. • When the ladder logic first runs: HSCSTS.Accumulator = 1, which means all the outputs are turned off. • When HSCSTS.Accumulator = 250, HSC_PLS[1].HSCHPOutput is sent through the HSCAPP.OutputMask, and energizes outputs 0 and 1.
  • Page 357: Chapter 15

    Read real-time clock (RTC) module information RTC_SET page 410 Set real-time clock data to real-time clock module SYS_INFO page 413 Read Micro800™ system status TRIMPOT_READ page 416 Read the trimpot value from a specific trimpot Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 358: Lcd

    Chapter 15 Input/Output instructions LCD displays a string or a number on the optional LCD module. LCD function operation The LCD function is only supported by the Micro810 controller. Arguments Parameter Parameter Type Data Type Description Enable Input BOOL Function enable. When Enable = TRUE, the LCD switches to the user-defined screen (strings displayed on the LCD) from the I/O status screen.
  • Page 359 Chapter 15 Input/Output instructions LCD function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 360 Chapter 15 Input/Output instructions Structured text (* ST Equivalence: *) TESTOUTPUT := LCD(LCDENABLE, LINE1, LINE2, LINE3, LINE4) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 361: Lcd_Bklt_Rem

    Chapter 15 Input/Output instructions LCD_BKLT_REM sets the Remote LCD backlight parameters in a user LCD_BKLT_REM program. LCD_BKLT_REM function block can be used in a user program to set the Remote LCD backlight parameters. The function is only supported by Micro 820. LCD_BKLT_REM is only effective when Remote LCD is displaying either the User defined screen (by using LCD_REM FB) or default IO Status screen.
  • Page 362 Chapter 15 Input/Output instructions LCD_BKLT_REM arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, execute REM_LCD_BKLT function, overwriting any current backlight settings. When Enable = FALSE, REM_LCD_BKLT will be disabled. Color Input UINT Backlight Color Code •...
  • Page 363: Lcd_Bklt_Rem Status Codes

    Chapter 15 Input/Output instructions Ladder Diagram (LD) Structured Text (ST) LCD_BKLT_REM status codes Status code Description Enable input is false. Success. Remote LCD not detected. May occur when: • Remote LCD is not physically connected to the controller (or the wiring is incorrect). •...
  • Page 364: Lcd_Rem

    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.
  • Page 365 Chapter 15 Input/Output instructions LCD_REM arguments Parameter Parameter type Data Description type Enable Input BOOL Function block enable. When Enable = TRUE, remote LCD switches to user-defined screen from I/O status screen. When Enable = FALSE, remote LCD switches back to I/O status screen. Font Input UDINT...
  • Page 366 Chapter 15 Input/Output instructions LCD_REM function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 367 Chapter 15 Input/Output instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 368: Lcd_Rem Status Codes

    Chapter 15 Input/Output instructions LCD_REM status codes Status code Description Enable input is false. User Message displayed successfully. Remote LCD not detected. May occur when: • Remote LCD is not physically connected to the controller (or the wiring is incorrect). •...
  • Page 369: Rhc

    Chapter 15 Input/Output instructions RHC reads a high-speed clock value in the Micro800™ controller. Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, replace parts of strings with new characters. When EN = FALSE, no operation.
  • Page 370 Chapter 15 Input/Output instructions RHC function language examples Function block diagram Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT2 := RHC() ; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 371: Rpc

    Data Type Description MemMod Input BOOL If true, the value is taken from the memory module. If false, the value is taken from the Micro800 controller. Output BOOL Enable out. Output UDINT The checksum value of the specified user program.
  • Page 372 Chapter 15 Input/Output instructions RPC function language examples Function block diagram Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT2 := RPC(TESTINPUT) ; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 373: Dlg

    Chapter 15 Input/Output instructions The Data Logging Function Block can be used to write variable values from the 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 •...
  • Page 374 Chapter 15 Input/Output instructions DLG function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 375: Dlg Status Codes

    Chapter 15 Input/Output instructions DLG status codes Status code Description Data logging "Idle" status. Data logging "Doing" status. Data logging Complete - "Succeed" status. Data logging Complete "Error" status. DLG error codes The following table describes DLG error codes. Error code Error Name Comments DLG_ERR_NONE...
  • Page 376: Iim

    Chapter 15 Input/Output instructions IIM executes an immediate input instruction to update the input data without having to wait until the beginning of the next input scan. Arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, execute function.
  • Page 377 Chapter 15 Input/Output instructions IIM function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 378: Iim Status Codes

    Chapter 15 Input/Output instructions Structured Text (ST) Results IIM status codes The following table describes the codes that are used to indicate the input scan status of the IIM function block. Status code Description 0x00 Not enabled (no action taken). 0x01 Input/output scan success.
  • Page 379: Iom

    Chapter 15 Input/Output instructions IOM executes an immediate embedded output data update without waiting for the automatic output scan. Arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, execute function. When Enable = FALSE, do not execute function. OutputType Input USINT...
  • Page 380 Chapter 15 Input/Output instructions IOM function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 381: Iom Status Codes

    Chapter 15 Input/Output instructions Structured Text (ST) Results IOM status codes The following table describes the codes that are used to indicate the output scan status of the IOM function block. Status code Description 0x00 Not enabled (no action taken). 0x01 Input/output scan success.
  • Page 382: Key_Read

    Chapter 15 Input/Output instructions KEY_READ checks Key status on the optional LCD module when the user KEY_READ display is active. This is only available for the Micro810. KEY_READ operation The KEY_READ function block is available for Micro810 controllers only. Arguments Parameter Parameter type Data type...
  • Page 383 Chapter 15 Input/Output instructions KEY_READ function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 384 Chapter 15 Input/Output instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 385 Chapter 15 Input/Output instructions Structured Text (ST) (* 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 ; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 386: Key_Read_Rem

    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).
  • Page 387: Key_Read_Rem Operation

    Chapter 15 Input/Output instructions KEY_READ_REM function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 388: Key_Read_Rem Status Codes

    Chapter 15 Input/Output instructions KEY_READ_REM status codes Status code Description Enable Input is False. Key data read successfully. Remote LCD not detected. May occur when: • Remote LCD is not physically connected to the controller (or the wiring is incorrect). •...
  • Page 389: Keydata Bitfields Table

    Chapter 15 Input/Output instructions KeyData bitfields table Bit No. in KeyData Name Parameter Description TRUE = Up key pressed. TRUE = Down key pressed. TRUE = Left key pressed. TRUE = Right key pressed. F1KY TRUE = F1 key pressed. F2KY TRUE = F2 key pressed.
  • Page 390: Mm_Info

    Chapter 15 Input/Output instructions MM_INFO checks Memory Module information. When a Memory Module is MM_INFO not present, all values return zero (0). Arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, read Memory Module header information. When Enable = FALSE, there is no read operation, and the output Memory Module information is invalid.
  • Page 391 Chapter 15 Input/Output instructions Structured Text (ST) Results For controllers using 2080-MEMBAK-RTC: Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 392: Mminfo Data Type

    Chapter 15 Input/Output instructions For controllers using an SD card: MMINFO data type The following table describes the MMINFO data type parameters. Parameter Data type Description MMCatalog MMCATNUM The catalog number of the Memory Module. Note: When using the MM_INFO instruction on controllers with an SD card, the MMCatalog is "SD CARD".
  • Page 393: Plugin_Info

    Chapter 15 Input/Output instructions 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 Parameter Parameter type Data Description type...
  • Page 394 Chapter 15 Input/Output instructions PLUGIN_INFO function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 395 Chapter 15 Input/Output instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 396: Plugin_Read

    Chapter 15 Input/Output instructions PLUGIN_READ reads a block of data from any Plug-in Generic Module PLUGIN_READ hardware except for 2080-MEMBAK-RTC modules. When a Plug-in Generic Module is not present, all values return to zero (0). Arguments Parameter Parameter type Data type Description Enable Input...
  • Page 397 Chapter 15 Input/Output instructions PLUGIN_READ function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 398: Plugin_Read Status Codes

    Chapter 15 Input/Output instructions PLUGIN_READ status codes The following table describes status codes for the PLUGIN_READ function block. Status code Status description 0x00 Function block not enabled (no operation). 0x01 Plug-in operation success. 0x02 Plug-in operation fails due to an invalid Slot ID. 0x03 Plug-in operation fails since it is not a valid Plug-in Generic module.
  • Page 399: Plugin_Reset

    Chapter 15 Input/Output instructions PLUGIN_RESET resets any Plug-in Generic Module hardware except 2080- PLUGIN_RESET MEMBAK-RTC modules. After the hardware reset, the Plug-in Generic Module is ready for configuration and operation. Arguments Parameter Parameter Data type Description type Enable Input BOOL Function block enable.
  • Page 400 Chapter 15 Input/Output instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 401: Plugin_Write

    Chapter 15 Input/Output instructions PLUGIN_WRITE PLUGIN_WRITE writes a block of data to any Plug-in Generic Module hardware except 2080-MEMBAK-RTC modules. Arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, execute Plug-in write. When Enable = FALSE, there is no data write operation.
  • Page 402 Chapter 15 Input/Output instructions PLUGIN_WRITE function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 403: Rcp

    Chapter 15 Input/Output instructions Recipe C Function Block can be used to read a variable’s data value from the 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.
  • Page 404 Chapter 15 Input/Output instructions RCP function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 405: Rcp Status Codes

    Chapter 15 Input/Output instructions Structured Text (ST) RCP status codes Status code Description Recipe "Idle" status. Recipe "Doing" status. Recipe Complete - "Succeed" status. Recipe Complete - "Error" status. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 406: Rcp Error Codes

    Chapter 15 Input/Output instructions RCP error codes The following table describes RCP error codes. Error code Error Name RCP_ERR_NONE RCP_ERR_NO_SDCARD RCP_ERR_DATAFILE_FULL RCP_ERR_DATAFILE_ACCESS SD card may be identified as a) broken; b) full; or c) read only. RCP_ERR_CFG_ABSENT RCP_ERR_CFG_ID RCP_ERR_RESOURCE_BUSY RCP_ERR_CFG_FORMAT RCP_ERR_RESERVED Reserved for future possible expansion.
  • Page 407: Rtc_Read

    Chapter 15 Input/Output instructions RTC_READ reads the RTC preset and RTC information. RTC_READ RTC_READ operation When used with a Micro810 or Micro820 controller with embedded RTC: • RTCBatLow is always set to zero (0). • RTCEnabled is always set to one (1). When the embedded RTC has lost its charge/memory due to loss of power: •...
  • Page 408 Chapter 15 Input/Output instructions RTC_READ function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 409: Rtc Data Type

    Chapter 15 Input/Output instructions RTC data type The following table describes the RTC data type. Parameter Data type Description Year UINT The year setting for the RTC. 16-bit value, and the valid range is from 2000 (Jan 01, 00:00:00) to 2098 (Dec.
  • Page 410: Rtc_Set

    Chapter 15 Input/Output instructions RTC_SET sets RTC status or write RTC information. RTC_SET Arguments Parameter Parameter Data type Description type Enable Input BOOL Function block enable. When Enable = TRUE, execute RTC set with the RTC info from input. When Enable = FALSE, there is no read operation and output RTC data is invalid. RTCEnable Input BOOL...
  • Page 411 Chapter 15 Input/Output instructions RTC_SET function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 412: Rtc Set Status Values

    Chapter 15 Input/Output instructions RTC Set status values The following table describes RTCSet values: Status value Status description 0x00 Function block not enabled (no operation). 0x01 RTC set operation success. 0x02 RTC set operation fails. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 413: Sys_Info

    Chapter 15 Input/Output instructions SYS_INFO reads the status data block. SYS_INFO Arguments Parameter Parameter type Data type Description Enable Input BOOL Function block enable. When Enable = TRUE, execute function. When Enable = FALSE, do not execute function. Output SYSINFO System status data block.
  • Page 414 Chapter 15 Input/Output instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 415: Sys_Info Data Type

    Chapter 15 Input/Output instructions SYS_INFO data type The following table describes the SYSINFO data type. Parameter Data type Description BootMajRev UINT Boot Major Revision. BootMinRev UINT Boot Minor Revision. Operating System Series UINT Operating System Series: 0 indicates a series A device 1 indicates a series B device OSMajRev UINT...
  • Page 416: Trimpot_Read

    Chapter 15 Input/Output instructions TRIMPOT_READ reads one Trimpot current value. TRIMPOT_READ Arguments Parameter Data type Description Parameter type Enable Input BOOL Function block enable. When Enable = TRUE, execute Trimpot read. When Enable = FALSE, there is no read operation and output Trimpot value is invalid. TrimPotID Input UINT...
  • Page 417 Chapter 15 Input/Output instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 418: Trimpot Id Definition

    Chapter 15 Input/Output instructions Trimpot ID definition The following table describes the Trimpot ID definition. Output selection Description Trimpot ID definition 15 - 13 Module type of trimpot: • 0x00 - Embedded. • 0x01 - Expansion. • 0x02 - Plug-in Port. 12 - 8 Slot ID of the module: •...
  • Page 419: Chapter 16

    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 page 420 Start the STI timer from the control program rather than starting automatically page 422...
  • Page 420: Interrupt Instructions

    Chapter 16 Interrupt instructions STIS starts a selectable timed (timer) user interrupt. STIS Arguments Parameter Parameter Type Data Type Description Enable Input BOOL Function enable. When Enable = TRUE, perform function. When Enable = FALSE, do not perform function. IRQType Input UDINT Use the STI defined words.
  • Page 421 Chapter 16 Interrupt instructions Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := STIS(TESTENABLE, 2, 1000) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 422: Uic

    Chapter 16 Interrupt instructions UIC clears Interrupt Lost bit for the selected User Interrupt(s). Arguments Parameter Parameter Type Data Type Description Enable Input BOOL Function enable. When Enable = TRUE, perform function. When Enable = FALSE, do not perform function. IRQType Input UDINT...
  • Page 423 Chapter 16 Interrupt instructions Ladder diagram Structure text Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 424: Uid

    Chapter 16 Interrupt instructions UID disables selected user interrupt(s). Arguments Parameter Parameter Type Data Type Description Enable Input BOOL Function enable. When Enable = TRUE, perform function. When Enable = FALSE, do not perform function. IRQType Input UDINT Use the STI defined words. - IRQ_HSC3 - IRQ_EII0 - IRQ_HSC4...
  • Page 425 Chapter 16 Interrupt instructions Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := UID(TESTENABLE, 2) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 426: Uie

    Chapter 16 Interrupt instructions UIE enables a user interrupt. Arguments Parameter Parameter Type Data Type Description Enable Input BOOL Function enable. When Enable = TRUE, perform function. When Enable = FALSE, do not perform function. IRQType Input UDINT Use the STI defined words. - IRQ_HSC3 - IRQ_HSC4 - IRQ_EII0...
  • Page 427 Chapter 16 Interrupt instructions Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := UIE(TESTENABLE, 2) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 428: Uif

    Chapter 16 Interrupt instructions UIF flushes (removes) a pending user interrupt for selected user interrupt(s). Arguments Parameter Parameter Type Data Type Description Enable Input BOOL Function enable. When Enable = TRUE, perform function. When Enable = FALSE, do not perform function. IRQType Input UDINT...
  • Page 429 Chapter 16 Interrupt instructions Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := UIF(TESTENABLE, 2) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 431 Chapter 17 Motion control instructions Connected Components Workbench 2.0 and later includes a set of instructions for programming and designing the motion of a particular axis using motion control function blocks. Tip: Administrative function blocks support both PTO motion and Feedback motion. The Motion control function blocks that support an FBAxis are: MC_ReadActualPosition and MC_ReadActualVelocity.
  • Page 432: Motion Control Instructions General Rules For Motion Control Function Blocks

    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.
  • Page 433 Chapter 17 Motion control instructions Rule applies to Rule • Deceleration or Acceleration inputs should have a positive value. If Deceleration or Acceleration is set to a non-positive value, Acceleration, Deceleration and Jerk inputs the function block reports an error (Error ID: MC_FB_ERR_RANGE). •...
  • Page 434 Chapter 17 Motion control instructions Rule applies to Rule Output Active The Active output is required on buffered function blocks, and is set at the moment the function block takes control of the motion of the according axis. For unbuffered mode, the Active and Busy outputs can have the same value. Enable and Valid status The Enable input is coupled to a Valid output.
  • Page 435: Motion Control Function Block Parameter Details

    Chapter 17 Motion control instructions 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 page 435 Motion control function block parameter numbers page 438 Motion control function block error IDs page 440...
  • Page 436 Chapter 17 Motion control instructions Motion control axis state diagram The axis is always in one of the defined states as shown in the following diagram. Motion control axis state behavior The following table describes motion control axis states and parameters. Note In the ErrorStop and Stopping states, all function blocks (except MC_Reset), can be called although they will not be executed.
  • Page 437 Chapter 17 Motion control instructions Motion control axis state code values You can monitor the axis state using the Axis Monitor feature. The following table identifies the values used to define each of the predefined axis states. State value State name 0x00 Disabled 0x01...
  • Page 438: Motion Control Function Block Parameter Numbers

    Chapter 17 Motion control instructions For example, on a moving axis on a Ladder POU (state of a rung=true), an MC_MoveRelative function block in the rung is scanned and the axis starts to move. Before MC_MoveRelative completes, the state of the rung becomes False, and MC_MoveRelative is no longer scanned.
  • Page 439 Chapter 17 Motion control instructions Parameter number identification Parameter numbers between 0 and 999 are reserved for standard parameters. Extensions by a supplier or user are also allowed, although using them can affect portability between different platforms. If the parameter number is greater than 999, the parameter is supplier-specific.
  • Page 440: Motion Control Function Block Error Ids

    Chapter 17 Motion control instructions Motion control function block error IDs When a motion control function block ends with an error, and the axis state is ErrorStop, in most cases, MC_Reset function block (or, MC_Power Off/On and MC_Reset) can be used to recover the axis. The axis can be reset to normal motion operation without stopping the controller operation.
  • Page 441 Chapter 17 Motion control instructions Value MACRO ID Description MC_FB_ERR_ The function block cannot execute because the motion profile requested in the function block cannot be achieved due to current VELOCITY axis velocity. Examples: • The function block requests the axis to reverse the direction while the axis is moving. •...
  • Page 442: Axis Error Scenarios

    Chapter 17 Motion control instructions Axis error scenarios In most cases, when a movement function block instruction issued to an axis results in a function block error, the axis is also flagged as being in an Error state, and the corresponding ErrorID element is set on the AXIS_REF data for the axis. However, in the following situations, an axis error may not always be flagged, and it is still possible for the user application to issue a successful movement function block to the axis after the axis state changes.
  • Page 443: Axis_Ref Data Type

    Chapter 17 Motion control instructions AXIS_REF data type The AXIS_REF data type is a data structure that contains information for a motion axis. It is used as an input and output variable in all motion control function blocks. An instance of an AXIS_REF data type is automatically created when you add a motion axis to the configuration.
  • Page 444 Chapter 17 Motion control instructions FB_AXIS_REF data type The FB_AXIS_REF data type is a data structure that contains information for a Motion Feedback Axis. It is used as an input and output variable in motion control function blocks. An instance of an FB_AXIS_REF data type is automatically created when you add a HSC module and the mode is configured as Feedback Axis mode.
  • Page 445: Axis Variables

    Chapter 17 Motion control instructions Axis variables Axis variables are used to control position, speed, acceleration, and error for a given motion control axis. Assigning a variable to an Axis output parameter In a Function Block Diagram You can graphically connect the Axis output parameter of a motion control function block to the AxisIn input parameter of another motion control function block for convenience.
  • Page 446: Mc_Aborttrigger

    Chapter 17 Motion control instructions MC_AbortTrigger aborts other function blocks that are connected to trigger MC_AbortTrigger events. For example, MC_TouchProbe. MC_AbortTrigger operation • The MC_AbortTrigger function block only executes when it is assigned to an axis that is controlled by MC_TouchProbe. Arguments Parameter Parameter type...
  • Page 447 Chapter 17 Motion control instructions MC_AbortTrigger function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 448 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 449: Mc_Halt

    Chapter 17 Motion control 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.
  • Page 450 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute current MC_Halt computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 451 Chapter 17 Motion control instructions MC_Halt function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 452 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 453: Mc_Home

    Chapter 17 Motion control instructions MC_Home MC_Power commands the axis to perform the <search home> sequence. The details of this sequence are manufacturer dependent and can be set by the axis parameters. The "Position" input is used to set the absolute position when a reference signal is detected, and the configured Home offset is reached.
  • Page 454 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute current MC_Home computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 455 Chapter 17 Motion control instructions MC_Home function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 456 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 457: Homing Modes

    Chapter 17 Motion control instructions Homing modes Value Name Description 0x00 MC_HOME_ABS_SWITCH Homing process by searching Home Absolute switch 0x01 MC_HOME_LIMIT_SWITCH Homing process by searching limit switch 0x02 MC_HOME_REF_WITH_ABS Homing process by searching Home Absolute switch plus using encoder reference pulse 0x03 MC_HOME_REF_PULSE Homing process by searching limit switch plus using encoder reference pulse...
  • Page 458 MC_ MoveAbsolute position. 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. • For a Micro800 controller, the input Direction for a MC_MoveAbsolute function block is ignored because there is only one mathematical solution to reach the Target position.
  • Page 459 Chapter 17 Motion control instructions Arguments Parameter Parameter Data type Description type Input BOOL Function block enable. When EN = TRUE, execute current MC_MoveAbsolute computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 460: Mc_Moveabsolute

    Chapter 17 Motion control instructions Parameter Parameter Data type Description type Busy Output BOOL When TRUE, the function block is not finished. Active Output BOOL When TRUE, indicates that the function block has control of the axis CommandAborted Output BOOL When TRUE, the Command was aborted by another command, or error stop.
  • Page 461 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 462 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 463: Mc_Moverelative

    Done. • For a Micro800 controller, the sign of the input Velocity for a MC_MoveRelative function block is ignored because the motion direction is determined by the Current position and the Target position.
  • Page 464 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description 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...
  • Page 465 Chapter 17 Motion control instructions MC_MoveRelative function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 466 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 467 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 468: Mc_Movevelocity

    Chapter 17 Motion control instructions MC_MoveVelocity commands a never ending controlled motion at a specified MC_MoveVelocity velocity. 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.
  • Page 469 Chapter 17 Motion control instructions • The sign of (Velocity * Direction) determines the motion direction for a MC_MoveVelocity function block. If the Velocity sign and the Direction sign are the same, positive motion is issued. If the Velocity sign and the Direction sign are different, negative motion is issued.
  • Page 470 Chapter 17 Motion control instructions MC_MoveVelocity function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 471 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 472 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 473: Mc_Power

    Chapter 17 Motion control instructions MC_Power controls the power stage (ON or OFF). MC_Power MC_Power operation • After axis power On completes, the axis Homed status is reset to 0 (not homed). • The Enable_Positive input and the Enable_Negative input of the MC_Power function block are both level triggered;...
  • Page 474 Chapter 17 Motion control instructions Tip: If you import a project created in CCW 7 into CCW 8 the Mc_Power new input parameter __DTI_AxisIn shows. If a Build error occurs, reselect the instruction and rebuild. Arguments Parameter Parameter Data type Description type Input...
  • Page 475 Chapter 17 Motion control instructions MC_Power function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 476 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 477: Mc_Readactualposition

    Chapter 17 Motion control instructions MC_ReadActualPosition MC_ReadActualPosition returns the actual position of the axis. Tip: MC_ReadActualPosition is only applicable to feedback motion. MC_ReadActualPosition operation Before executing the MC_ReadActualPosition function block, verify the axis is in one of the following Axis States: •...
  • Page 478 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description AxisIn Input FB_AXIS_REF See also FB_AXIS_REF data type page 434. Enable Input BOOL Get the value of the parameter continuously while enabled. Axis Output FB_AXIS_REF Axis output is read-only in LD programs. See also FB_AXIS_REF data type page...
  • Page 479 Chapter 17 Motion control instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 480 Chapter 17 Motion control instructions Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 481: Mc_Readactualvelocity

    Chapter 17 Motion control instructions MC_ReadActualVelocity returns the actual velocity of the axis. MC_ReadActualVelocity Tip: MC_ReadActualVelocity is only applicable to feedback motion. MC_ReadActualVelocity operations The MC_ReadActualVelocity function block returns the value of the actual velocity as long as Enable is set to True. If Enable is reset the data is no longer valid, all outputs are reset to 0, Valid is set to False.
  • Page 482 Chapter 17 Motion control instructions Arguments Parameter Parameter Data type Description type Input BOOL Function block enable. When EN = TRUE, execute current MC_ReadParameter computation. When EN = FALSE, the Value output is reset to 0. Applies only to LD programs. AxisIn Input AXIS_REF...
  • Page 483 Chapter 17 Motion control instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 484 Chapter 17 Motion control instructions Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 485: Mc_Readaxiserror

    Chapter 17 Motion control instructions MC_ReadAxisError describes general axis errors not related to the Motion MC_ReadAxisError control function blocks. 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.
  • Page 486 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute current MC_ReadAxisError computation. When EN = FALSE, Error, ErrorID, and AxisErrorID are reset to False(or 0). Applies only to LD programs. AxisIn Input AXIS_REF...
  • Page 487 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 488 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 489: Axiserrorid Error Codes

    Chapter 17 Motion control instructions AxisErrorID error codes The following table describes the Axis error codes identified in the AxisErrorID for the MC_ReadAxis Error. Value MACRO ID Description MC_FB_ERR_ The axis is in an operational state (nothing to display). MC_FB_ERR_ The axis is not operational because an incorrect axis state was detected during a function block WRONG_STATE execution.
  • Page 490 Chapter 17 Motion control instructions Value MACRO ID Description MC_FB_ERR_ The axis is not operational because the motion profile requested in a function block conflicts with the VELOCITY current axis velocity. Possible causes: • The function block requests the axis to reverse the direction while the axis is moving. •...
  • Page 491: Mc_Readboolparameter

    Chapter 17 Motion control instructions MC_ReadBoolParameter MC_ReadBoolParameter returns the value of a vendor specific parameter with data type BOOL. MC_ReadBoolParameter operation When the MC_ReadBoolParameter function block Enable input is set to False, the Value output is reset to 0. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 492 Chapter 17 Motion control instructions Arguments Parameter Parameter Data type Description type Input BOOL Function block enable. When EN = TRUE, execute current MC_ReadBoolParameter computation. When EN = FALSE, the Value output is reset to 0. Applies only to LD programs. AxisIn Input AXIS_REF...
  • Page 493 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 494 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 495: Mc_Readparameter

    Chapter 17 Motion control instructions MC_ReadParameter returns the value of a vendor specific parameter. MC_ReadParameter MC_ReadParameter operation • When the MC_ReadParameter function block Enable input is set to False, the Value output is reset to 0. • Only supports the REAL data type. Arguments Parameter Data type...
  • Page 496 Chapter 17 Motion control instructions MC_ReadParameter function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 497 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 498: Mc_Readstatus

    Chapter 17 Motion control instructions 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. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 499 See Motion control axis state values and names. SynchronizedMotion Output BOOL This output is always FALSE. Synchronized motion is not supported in Micro800 controllers. Homing Output BOOL When TRUE, the axis state is Homing. See Motion control axis state values and names.
  • Page 500 Chapter 17 Motion control instructions MC_ReadStatus function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 501 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 502 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 503: Mc_Reset

    Chapter 17 Motion control instructions MC_Reset MC_Reset transitions the axis state from ErrorStop to StandStill by resetting all internal axis-related errors. The outputs of the function block instances are not changed. MC_Reset operation The MC_Reset function block only resets the axis state from ErrorStop to StandStill.
  • Page 504 Chapter 17 Motion control instructions MC_Reset function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 505 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 506: Mc_Setposition

    Chapter 17 Motion control instructions MC_SetPostion shifts the coordinate system of an axis by manipulating the actual MC_SetPosition position of an axis with the same value without causing any movement. 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).
  • Page 507 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute current MC_SetPosition computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 508 Chapter 17 Motion control instructions MC_SetPosition function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 509 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 510: Mc_Stop

    Chapter 17 Motion control instructions 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 •...
  • Page 511 Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute current MC_Stop computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 512 Chapter 17 Motion control instructions MC_Stop function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 513 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 514: Mc_Touchprobe

    Chapter 17 Motion control instructions MC_TouchProbe records an axis position at a trigger event. MC_TouchProbe 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.
  • Page 515 Chapter 17 Motion control instructions Arguments Parameter Parameter Data type Description type Input BOOL Function block enable. When EN = TRUE, execute current MC_TouchProbe computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 516 Chapter 17 Motion control instructions Motion fixed input/output Motion Signals PTO0 PTO1 PTO2 PTO pulse Output_0 Output_1 Output2 PTO direction Output_3 Output_4 Output_5 Lower (Negative) Limit switch Input_0 Input_4 Input_8 Upper (Positive) Limit switch Input_1 Input_5 Input_9 Absolute Home switch Input_2 Input_6 Input_10...
  • Page 517 Chapter 17 Motion control instructions Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 518: Motion Fixed Input/Output

    Chapter 17 Motion control instructions Structured Text (ST) Results Motion fixed input/output Motion Signals PTO0 PTO1 PTO2 PTO pulse Output_0 Output_1 Output2 PTO direction Output_3 Output_4 Output_5 Lower (Negative) Limit switch Input_0 Input_4 Input_8 Upper (Positive) Limit switch Input_1 Input_5 Input_9 Absolute Home switch Input_2...
  • Page 519: Mc_Writeboolparameter

    Chapter 17 Motion control instructions MC_WriteBoolParameter modifies the value of a vendor specific parameter of MC_WriteBoolParameter type BOOL. 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.
  • Page 520 Chapter 17 Motion control instructions Arguments Parameter Parameter Data type Description type Input BOOL Function block enable. When EN = TRUE, execute current MC_WriteBoolParameter computation. When EN = FALSE, the Value output is reset to 0. Applies only to LD programs. AxisIn Input AXIS_REF...
  • Page 521 Chapter 17 Motion control instructions MC_WriteBoolParameter function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 522 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 523: Mc_Writeparameter

    Chapter 17 Motion control instructions MC_WriteParameter modifies the value of a vendor specific parameter. MC_WriteParameter 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.
  • Page 524: Rockwell Automation Publication 2080-Rm001D-En-E - February

    Chapter 17 Motion control instructions Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute current MC_WriteParameter computation. When EN = FALSE, there is no computation. Applies only to LD programs. AxisIn Input AXIS_REF See also AXIS_REF data type...
  • Page 525 Chapter 17 Motion control instructions MC_WriteParameter function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 526 Chapter 17 Motion control instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 527 Chapter 18 Process control instructions 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. Function block Description DERIVATE...
  • Page 528: Process Control Instructions

    Chapter 18 Process control 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).
  • Page 529 Chapter 18 Process control instructions Ladder Diagram (LD) Structured Text (ST) (* ST Equivalence: DERIVATE1 is an instance of a DERIVATE block *) DERIVATE1(manual_mode, sensor_value, t#100ms); derivated_value := DERIVATE1.XOUT; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 530: Hyster

    Chapter 18 Process control instructions HYSTER performs hysteresis on a Real value for a high limit. HYSTER Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute function. When EN = FALSE, do not execute function. Applies only to LD programs.
  • Page 531 Chapter 18 Process control instructions HYSTER function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 532: Integral

    Chapter 18 Process control instructions INTEGRAL integrates a real value. INTEGRAL 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. •...
  • Page 533 Chapter 18 Process control instructions • 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 Parameter Parameter type...
  • Page 534 Chapter 18 Process control instructions Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 535 Chapter 18 Process control instructions Example: XIN not in sync with function block execution The following pictures show an example in which an error is introduced in the XOUT value of an Integral function block: Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 536 Chapter 18 Process control instructions INTEGRAL function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 537 Chapter 18 Process control instructions Ladder Diagram (LD) Structured Text (ST) (* ST Equivalence: INTEGRAL1 is an instance of a INTEGRAL block *) INTEGRAL1(manual_mode, NOT(manual_mode), sensor_value, init_value, t#100ms); controlled_value := INTEGRAL1.XOUT; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 538 Chapter 18 Process control instructions Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 539: Pwm

    Chapter 18 Process control instructions PWM (Pulse Width Modulation) turns the PWM output for a configured PWM channel on or off. This instruction block is used with Micro820 2080-LC20- 20QBB controllers and supports one PWM channel (using the embedded output channel 6).
  • Page 540 Chapter 18 Process control instructions PWM arguments Parameter Parameter type Data Description type Input BOOL Function block enable. This level is FB triggered. When EN = TRUE, Sts is updated. PWM is made active or inactive depending on the On input parameter and valid configuration.
  • Page 541 Chapter 18 Process control instructions PWM function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 542: Pwm Status Codes

    Chapter 18 Process control instructions Structured Text (ST) PWM status codes Status code Description Function block not enabled (no operation). PWM configuration successful. Invalid Duty cycle. Invalid Frequency. Invalid Channel Type. Invalid Channel Slot. Invalid Channel Number. Invalid Catalog. PWM feature is not supported in the catalog being used. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 543: Scaler

    Chapter 18 Process control instructions SCALER scales the input value according to the output range. SCALER Arguments Parameter Parameter type Data type Description Input BOOL Function block enable. When EN = TRUE, execute the scaling equation. When EN = FALSE, there is no scaling equation. Applies only to LD programs.
  • Page 544 Chapter 18 Process control instructions SCALER function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 545 Chapter 18 Process control instructions Structured Text (ST) (* ST equivalence: SCALER1 is an instance of SCALER block *) SCALER1(Signal_In, 4.0, 20.0 , 0.0 , 150.0 ) ; Out_Temp := SCALER1.Output ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 546: Stackint

    Chapter 18 Process control instructions STACKINT manages a stack of integer values. STACKINT 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).
  • Page 547 Chapter 18 Process control instructions STACKINT function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 548 Chapter 18 Process control instructions Structured Text (ST) (* ST Equivalence: STACKINT1 is an instance of a STACKINT block *) STACKINT1(err_detect, acknowledge, manual_mode, err_code, max_err); appli_alarm := auto_mode AND NOT(STACKINT1.EMPTY); err_alarm := STACKINT1.OFLO; last_error := STACKINT1.OUT; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 549: Tnd

    Chapter 18 Process control instructions TND stops the current cycle of user program scan. Then, after the output scan, input scan, and housekeeping, the user program will be re-executed from the start of the first routine. Arguments Parameter Parameter Type Data Type Description Enable...
  • Page 550 Chapter 18 Process control instructions Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := TND(TESTENABLE) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 551: Limit

    Chapter 18 Process control instructions LIMIT LIMIT restricts integer values to a given interval. Integer values between the minimum and maximum are unchanged. Integer values greater than the maximum are replaced with the maximum value. Integer values less than the minimum are replaced with the minimum value.
  • Page 552 Chapter 18 Process control instructions LIMIT function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 553 Chapter 18 Process control instructions Structured text (* ST Equivalence: *) new_value := LIMIT (min_value, value, max_value); (* bounds the value to the [min_value..max_value] set *) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 554 Chapter 18 Process control instructions Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 555: Program Control Instruction

    Chapter 19 Program control instruction Program control instructions are used to control instructions simultaneously from a user program and from an operator interface device. Function block Description page 556 Suspend the execution of the application. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 556: Sus

    Chapter 19 Program control instruction SUS suspends the execution of the Micro800 controller. The controller remains in RUN mode but execution is suspended indefinitely. Suspend catches User Program errors and aids in User Program monitoring. Place the SUS instruction in User Program sections where you want to trap unusual conditions. In suspend mode, RUN LED is set to OFF to indicate the program scan is Idle.
  • Page 557 Chapter 19 Program control instruction Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 559: Chapter 20

    Chapter 20 Proportional Integral Derivative (PID) instruction The Proportional-Integral-Derivative (PID) instruction is used to control the process more accurately using PID functionality. Function block Description IPIDCONTROLLER page 562 Proportional Integral Derivative Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 560: Proportional Integral

    Chapter 20 Proportional Integral Derivative (PID) instruction Proportional-Integral-Derivative (PID) control allows the process control to What is Proportional accurately maintain the setpoint by adjusting the control outputs. A PID function Integral Derivative (PID) block combines all of the necessary logic to perform control? proportional/integral/derivative (PID) control.
  • Page 561 Chapter 20 Proportional Integral Derivative (PID) instruction IPIDController function block description The IPIDController function block uses the following function block components: • A: Acting (+/- 1) • PG: Proportional Gain • DG: Derivative Gain • td: ãD • ti: ãI Preventing integral windup If the difference between the setpoint value and the process value is great, the output value will increase significantly, and during the time it takes to decrease,...
  • Page 562: Ipidcontroller

    Chapter 20 Proportional Integral Derivative (PID) instruction IPIDCONTROLLER is used for proportional integral-derivative (PID) logic, IPIDCONTROLLER which controls physical properties such as temperature, pressure, liquid level, or flow rate using process loops. Arguments Parameter Parameter type Data type Description Input BOOL Function block enable.
  • Page 563 Chapter 20 Proportional Integral Derivative (PID) instruction Parameter Parameter type Data type Description Output Output REAL Output value from the controller. AbsoluteError Output REAL Absolute error (Process – SetPoint) from the controller. ATWarnings Output DINT (ATWarning) Warning for the Auto Tune sequence. Possible values are: •...
  • Page 564 Chapter 20 Proportional Integral Derivative (PID) instruction Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 565 Chapter 20 Proportional Integral Derivative (PID) instruction Structured Text (ST) (* ST equivalence: IPIDController1 is an instance of IPIDController block *) IPIDController1(Proc, FBK, Auto, Init, G_In, A_Tune, A_TunePar, Err ); Out_process := IPIDController1.Output ; A_Tune_Warn := IPIDController1.ATWarning ; Gain_Out := IPIDController1.OutGains ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 566: Gain_Pid Data Type

    Chapter 20 Proportional Integral Derivative (PID) instruction GAIN_PID data type The following table describes the GAIN_PID data type. Parameter Data type Description DirectActing BOOL The type of acting: • TRUE - direct acting (output moves same direction as 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).
  • Page 567: Ipidcontroller Function Block Operation

    Chapter 20 Proportional Integral Derivative (PID) instruction Input Auto IPIDController function 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.
  • Page 568 Chapter 20 Proportional Integral Derivative (PID) instruction To run an AutoTune sequence To run an AutoTune sequence, the input ATParameters must be completed. The Input Gain and DirectActing parameters must be set according to the process and DerivativeGain set, (typically 0.1). The AutoTune sequence is started with the following sequence: 1.
  • Page 569: Using The Proportional Integral Derivative Instruction

    Chapter 20 Proportional Integral Derivative (PID) instruction Using the Proportional This section provides specific details and examples for using the proportional integral derivative instruction, including the following: Integral Derivative instruction Example: How to create a feedback loop for the manipulated value page Example: How to implement auto-tuning in a IPIDController function block page 569...
  • Page 570 Chapter 20 Proportional Integral Derivative (PID) instruction Auto-tune in first and second order systems Auto-tune can be used in first order system, which uses a single element, or in a second order system, which uses two independent elements. Auto-tune a first order system A first order system uses a single independent energy storage element.
  • Page 571 Chapter 20 Proportional Integral Derivative (PID) instruction Configure auto-tuning Following are the general steps for implementing auto-tuning using the IPIDController function. Step Example Reset setpoint to zero. Switch Auto mode to False Set Gains parameters. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 572 Chapter 20 Proportional Integral Derivative (PID) instruction Step Example Set Auto-Tune parameters. Set auto-tune parameters including an initial load value, step change for the output, an estimated time to complete the auto tuning, and the auto-tune reset. Set Initialize and AutoTune to True. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 573 Chapter 20 Proportional Integral Derivative (PID) instruction Step Example Notice the Output changes to the value of Load when you set AutoTune to True. Observe the process value rises quickly until it gets closer to its saturation point. Observe the stabilization of the process value and its fluctuation.
  • Page 574 Chapter 20 Proportional Integral Derivative (PID) instruction Step Example Set Initialize to False. Controller starts auto-tuning. Wait for ATWarning to become 2. Set AutoTune to False. Observe the tuned values appear in OutGains. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 575 Chapter 20 Proportional Integral Derivative (PID) instruction Step Example Transfer parameter from OutGain to My_Gains. Observe the controller is updated with the with the tuned gain parameter. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 576: Example: Ipidcontroller With Auto-Tune

    Chapter 20 Proportional Integral Derivative (PID) instruction Using a Structured Timing Interrupt (STI) with auto-tuning Although a PID instruction works if it is not controlled by a Structured Timing Interrupt (STI), using an STI increases the auto-tune success rate because the auto-tune will operate on a fixed cycle.
  • Page 577 Chapter 20 Proportional Integral Derivative (PID) instruction Auto-tune parameters The following table describes the variables that are used with each parameter in the example to configure auto-tuning. Input parameters Variable Parameter Description AutoMode Auto The operation mode of the PID controller: TRUE - controller runs in normal mode.
  • Page 578: Example: How To Create A Feedback Loop For The Manipulated Value

    Chapter 20 Proportional Integral Derivative (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.
  • Page 579: Example: How To Add A Udfb To A Pid Program

    Chapter 20 Proportional Integral Derivative (PID) instruction IPIDController with a feedback loop The following function block diagram includes a feedback loop for the manipulated value that prevents excessive overshooting by providing a minimum and maximum value for the MV. Example: How to add a UDFB to a PID program You can add UDFBs outside the main program to perform specialized functions such as converting units or transferring values.
  • Page 580: Example: How To Create An Ipidcontroller Program To Control Temperature

    Chapter 20 Proportional Integral Derivative (PID) instruction Convert a manipulated value to a digital output This UDFB converts a manipulated value (MV) to a digital output (DO) so it can be used to control a digital input n(DI). Converting a manipulated value to an analog output This UDFB converts a manipulated value (MV) to an analog output (AO) so it can be used to control an analog input (AI).
  • Page 581 Chapter 20 Proportional Integral Derivative (PID) instruction Temperature control system The following diagram shows the components in the temperature control system that are controlled by the temperature control program. The table following the diagram describes the events that occur when the control program runs. Sequence of events for temperature control program The following table identifies the components in the temperature control system and describes, in sequence, the events that occur in the system when the...
  • Page 582: Example: How To Create An Ipidcontroller Program To Control Water Supply Level

    Chapter 20 Proportional Integral Derivative (PID) instruction Example: Function block diagram to control temperature This function block diagram shows the predefined and user-defined function blocks used in the application to control temperature in a control zone. Example: How to create an IPIDController program to control water supply level The water supply level control program example maintains sufficient water in a water supply tank that has an outflow.
  • Page 583 Chapter 20 Proportional Integral Derivative (PID) instruction Program example information The water supply level program example includes the following information. • The sequence of events that occur in the control process • How the setpoint, process and manipulated values are used in the control program •...
  • Page 584 Chapter 20 Proportional Integral Derivative (PID) instruction Sequence of events in water supply level system The following table identifies the components in the water supply system and describes, in sequence, the events that occur in the system when the water supply level program runs.
  • Page 585 Chapter 20 Proportional Integral Derivative (PID) instruction Example: Function block diagram to control water supply level The following function block diagram shows the predefined and user-defined function blocks for the program to control the water supply level. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 586 Chapter 20 Proportional Integral Derivative (PID) instruction Function blocks and UDFBs used in the water level FBD This application, developed in the Function Block Diagram (FBD) language, uses the function blocks described in the following table. Function block Description IPIDController function block Provides PID process control PID_OutputRegulator UDFB Regulates the output of the IPIDCONTROLLER within a safe range to ensure the hardware used in the process is not...
  • Page 587: Chapter 21

    Chapter 21 Real Time Clock (RTC) instructions Real Time Clock instructions are used to configure the calendar and the clock. Function block Description RTC_READ page 407 RTC_READ reads the RTC preset and RTC information. RTC_SET page 410 RTC_SET sets RTC status or write RTC information. Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 588: Rtc_Read

    Chapter 21 Real Time Clock (RTC) instructions RTC_READ reads the RTC preset and RTC information. RTC_READ RTC_READ operation When used with a Micro810 or Micro820 controller with embedded RTC: • RTCBatLow is always set to zero (0). • RTCEnabled is always set to one (1). When the embedded RTC has lost its charge/memory due to loss of power: •...
  • Page 589 Chapter 21 Real Time Clock (RTC) instructions RTC_READ function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 590: Rtc_Set

    Chapter 21 Real Time Clock (RTC) instructions RTC_SET sets RTC status or write RTC information. RTC_SET Arguments Parameter Parameter Data type Description type Enable Input BOOL Function block enable. When Enable = TRUE, execute RTC set with the RTC info from input. When Enable = FALSE, there is no read operation and output RTC data is invalid.
  • Page 591 Chapter 21 Real Time Clock (RTC) instructions RTC_SET function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 592: Rtc Data Type

    Chapter 21 Real Time Clock (RTC) instructions RTC data type The following table describes the RTC data type. Parameter Data type Description Year UINT The year setting for the RTC. 16-bit value, and the valid range is from 2000 (Jan 01, 00:00:00) to 2098 (Dec.
  • Page 593 Chapter 22 String manipulation instructions String manipulation instructions are used to alter a sequence of symbols that are chosen from a set or alphabet to change the output status. Tip: 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...
  • Page 594: Ascii

    Chapter 22 String manipulation instructions ASCII yields the ASCII code for characters in strings. ASCII Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, display the ASCII code for characters. When EN = FALSE, no display operation. Input STRING Any non-empty string.
  • Page 595 Chapter 22 String manipulation instructions Structured text (* ST Equivalence: *) FirstChr := ASCII (message, 1); (* FirstChr is the ASCII code of the first character of the string *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 596: Char

    Chapter 22 String manipulation instructions For a given ASCII code, CHAR provides a string containing one character. CHAR Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, provide a single character string. When EN = FALSE, no operation. Code Input DINT...
  • Page 597 Chapter 22 String manipulation instructions Structured text (* ST Equivalence: *) Display := CHAR ( value + 48 ); (* value is in set [0..9] *) (* 48 is the ascii code of '0' *) (* result is one character string from '0' to '9' *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 598: Delete

    Chapter 22 String manipulation instructions DELETE deletes part of a string. DELETE Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, delete specified part of a string. When EN = FALSE, no operation. Input STRING Any non-empty string.
  • Page 599 Chapter 22 String manipulation instructions 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 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 600: Find

    Chapter 22 String manipulation instructions FIND locates and provides the position of sub-strings within strings. FIND Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, locate position within strings. When EN = FALSE, no locate operation. Input STRING Any non-empty string.
  • Page 601 Chapter 22 String manipulation instructions Ladder diagram Structured text (* ST Equivalence: *) complete_string := 'ABCD' + 'EFGH'; (* complete_string is 'ABCDEFGH ' *) found := FIND (complete_string, 'CDEF'); (* found is 3 *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 602: Insert

    Chapter 22 String manipulation instructions INSERT inserts sub-strings at user-defined positions within strings. INSERT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, insert sub-strings in a string. When EN = FALSE, no operation. Input STRING Initial string.
  • Page 603 Chapter 22 String manipulation instructions Ladder diagram Structured text (* ST Equivalence: *) MyName := INSERT ('Mr JONES', 'Frank ', 4); (* MyName is 'Mr Frank JONES' *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 604: Left

    Chapter 22 String manipulation instructions From the left end of strings, LEFT yields the number of characters defined. Left Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, yield number of characters from left side of string. When EN = FALSE, no operation.
  • Page 605 Chapter 22 String manipulation instructions 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 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 606: Mid

    Chapter 22 String manipulation instructions Using the position and number of characters provided, MID yields required parts of strings. Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, generate portion of a string. When EN = FALSE, no generate operation. Input STRING Any non-empty string.
  • Page 607 Chapter 22 String manipulation instructions Ladder diagram Structured text (* ST Equivalence: *) sub_string := MID ('abcdefgh', 2, 4); (* sub_string is 'de' *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 608: Mlen

    Chapter 22 String manipulation instructions MLEN yields the length of strings. MLEN Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, yield length of strings. When EN = FALSE, no operation. Input STRING Any string. MLEN Output DINT...
  • Page 609 Chapter 22 String manipulation instructions Structured text (* ST Equivalence: *) nbchar := MLEN (complete_string); If (nbchar < 3) Then Return; End_if; prefix := LEFT (complete_string, 3); (* this program extracts the 3 characters on the left of the string and puts the result in the prefix string variable.
  • Page 610: Right

    Chapter 22 String manipulation instructions From the right ends of strings, RIGHT yields the number of characters defined. RIGHT Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, yield specified number of characters from the right end of the string.
  • Page 611 Chapter 22 String manipulation instructions RIGHT function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 612 Chapter 22 String manipulation instructions 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 Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 613: Replace

    Chapter 22 String manipulation instructions REPLACE replaces parts of a string with new sets of characters. REPLACE Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, replace parts of strings with new characters. When EN = FALSE, no operation. Input STRING Any string.
  • Page 614 Chapter 22 String manipulation instructions REPLACE function language examples Function block diagram Ladder diagram Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 615 Chapter 22 String manipulation instructions Structured text Replacing a part of a string with a new set of characters. (* ST Equivalence: *) MyName := REPLACE ('Mr X JONES, 'Frank', 1, 4); (* MyName is 'Mr Frank JONES' *) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 617: Timer Instructions

    Chapter 23 Timer instructions Timer instructions are used to control operations based on time. Function block Description page 619 Off-delay timing page 622 On-delay timing TONOFF page 625 Delay turning on an output on a true rung, and then delay turning off the output on the false rung page 628 Pulse timing page 631...
  • Page 618 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: •...
  • Page 619: Tof

    Chapter 23 Timer instructions TOF increases an internal timer up to a given value. Arguments Parameter Parameter type Data type Description Input BOOL If falling edge, starts increasing internal timer. If rising edge, stops and resets internal timer. Input TIME Maximum programmed time.
  • Page 620 Chapter 23 Timer instructions TOF function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 621 Chapter 23 Timer instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 622: Ton

    Chapter 23 Timer instructions TON increases an internal timer up to a given value. 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. •...
  • Page 623 Chapter 23 Timer instructions TON function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 624 Chapter 23 Timer instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 625: Tonoff

    Chapter 23 Timer instructions TONOFF delays turning on an output on a true rung, then delays turning off the TONOFF output on the false rung. Arguments Parameter Parameter type Data type Description Input BOOL If Rising Edge (IN) turns from 0 to 1, the On-delay timer starts. If the Programmed On-delay time is elapsed and the Falling Edge (IN) turns from 1 to 0, the Off-delay timer starts and resets the elapsed time (ET).
  • Page 626 Chapter 23 Timer instructions TONOFF function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 627 Chapter 23 Timer instructions Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 628 Chapter 23 Timer instructions On a rising edge, TP increases an internal timer up to a given value. If the timer is elapsed, it resets the internal timer. Arguments Parameter Parameter type Data type Description Input BOOL If rising edge, starts increasing internal timer (if not already increasing). If FALSE and only if timer is elapsed, resets the internal timer.
  • Page 629 Chapter 23 Timer instructions TP function block language examples Function Block Diagram (FBD) Ladder Diagram (LD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 630 Chapter 23 Timer instructions Structured Text (ST) Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 631: Rto

    Chapter 23 Timer instructions RTO increases an internal timer when its input is active, but does not reset its internal timer when its input changes to inactive. If using a Micro810 or Micro820 controller, the RTO internal timer does not persist through a power cycle by default.
  • Page 632 Chapter 23 Timer instructions RTO timing diagram RTO function block language examples Function Block Diagram (FBD) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 633 Chapter 23 Timer instructions Ladder Diagram (LD) Structured Text (ST) Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 634: Doy

    Chapter 23 Timer instructions The DOY function has four channel inputs; it turns on an output if the value of 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.
  • Page 635 Chapter 23 Timer instructions DOY instruction language examples Function block diagram Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := DOY(TIMEA1, TIMEB1, TIMEC1, TIMED1) ; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 636: Doydata Data Type

    Chapter 23 Timer instructions DOYDATA data type The following table describes the DOYDATA data type. Parameter Data Type Description Enable BOOL TRUE:Enable; FALSE:Disable YearlyCenturial BOOL Type of timer (0:Yearly timer; 1:Centurial timer). YearOn UINT Year On value (must be in set [2000...2098]). MonthOn USINT Month On value (must be in set [1...12]).
  • Page 637: Tdf

    Chapter 23 Timer instructions TDF computes time difference. Arguments Parameter Parameter Type Data Type Description Input BOOL Function enable. When EN = TRUE, perform current computation. When EN = FALSE, there is no computation. TimeA Input TIME The start time for time difference computation. TimeB Input TIME...
  • Page 638 Chapter 23 Timer instructions Ladder diagram Structured text (* ST Equivalence: *) TESTTIMEDIFF := TDF(TESTTIME1, TESTTIME2) ; Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 639: Tow

    Chapter 23 Timer instructions The TOW function has four channel inputs; it turns on an output if the value of 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. Tip: Make sure you configure any TimeX input parameter with valid ranges as specified in the TOWDATA Data Type table.
  • Page 640 Chapter 23 Timer instructions TOW function language examples Function block diagram Ladder diagram Structured text (* ST Equivalence: *) TESTOUTPUT := TOW(TIMEA, TIMEB, TIMEC, TIMED) ; Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 641 Chapter 23 Timer instructions Results Rockwell Automation Publication 2080-RM001D-EN-E - February 2015...
  • Page 642: Towdata Data Type

    Chapter 23 Timer instructions TOWDATA Data Type The following table describes the TOWDATA data type: Parameter Data Type Description Enable BOOL TRUE: Enable; FALSE: Disable. DailyWeekly BOOL Type of Timer (0:daily timer; 1:weekly timer). DayOn USINT Day of Week On value (must be in set [0...6]). HourOn USINT Hour On value (must be in set [0...23]).
  • Page 643: Index

    Index AHL function block 116 alarms LIM_ALRM function block 58 - operator 101 AND operator 157 AND_MASK function 132 ANY_TO_BOOL operator 270 * operator 89 ANY_TO_BYTE operator 271 ANY_TO_DATE operator 272 ANY_TO_DINT operator 273 ANY_TO_DWORD operator 274 / operator 81 ANY_TO_INT operator 275 ANY_TO_LINT operator 276 ANY_TO_LREAL operator 277...
  • Page 644 Index SIN_LREAL instruction 97 SQRT function 99 calling subtraction operator 101 function blocks 18 TAN function 102 CHAR function 584 TAN_LREAL function 104 coils TRUNC function 106 changing types of 39 arithmetic operations changing types of in FBD 39 1Gain operator 88 direct type 41 ARL function block 121 direct type in FBD 41...
  • Page 645 Index direct 46 MAX function 299 direct in FBD 46 MIN function 297 inserting 44 DERIVATE function block 516 parallel, inserting 44 direct pulse falling edge (positive) 47 coils 41 pulse rising edge (positive) 47 coils in FBD 41 pulse rising edge (positive) in FBD 47 contacts 46 reverse 46 contacts in FBD 46...
  • Page 646 Index CTD 261 SR 160 CTU 263 STACKINT 534 CTUD 266 SUS 544 DERIVATE 516 SYS_INFO 401 F_TRIG 150 TOF 607 HSC 303 TON 610 HSC_SET_STS 323 TONOFF 613 HYSTER 518 TP 616 IIM 365 TRIMPOT_READ 404 inserting in Function Block Diagrams 35 functions INTEGRAL 520 ABS 62...
  • Page 647 Index ROR 140 PLUGIN_READ function block 385 RPC 361 PLUGIN_RESET function block 388 SHL 142 PLUGIN_WRITE function block 390 SHR 144 RHC function 359 SIN 95 RPC function 361 SIN_LREAL 97 RTC_READ function block 395 SQRT 99 RTC_SET function block 398 STIS 408 SYS_INFO function block 401 TAN 102...
  • Page 648 Index MC_MoveVelocity 456 INTEGRAL function block 520 MC_Power 461 interrupt MC_ReadAxisError 473 STIS function 408 MC_ReadBoolParameter 479 UIC function 410 MC_ReadParameter 482 UID function 412 MC_ReadStatus 485 UIE function 414 MC_Reset 490 UIF function 416 MC_SetPosition 493 IOM function block 368 MC_Stop 497 IPIDCONTROLLER function block 551 MC_TouchProbe 501...
  • Page 649 Index reset coils 44 MC_ReadAxisError function block 473 return statements 48 MC_ReadBoolParameter function block 479 reverse coils 41 MC_ReadParameter function block 482 reverse contacts 46 MC_ReadStatus function block 485 rungs, inserting 31 MC_Reset function block 490 set coils 43 MC_SetPosition function block 493 LD language MC_Stop function block 497 keyboard shortcuts 54...
  • Page 650 Index ANY_TO_STRING 281 STACKINT function block 534 ANY_TO_TIME 282 program control ANY_TO_UDINT 283 SUS function block 544 ANY_TO_UINT 284 TND function 537 ANY_TO_ULINT 285 pulse falling edge (negative) ANY_TO_USINT 286 coils 42 ANY_TO_WORD 287 contacts 47 division 81 pulse rising edge (positive) equal 253 coils 42 greater than 256...
  • Page 651 Index TOF function block 607 TON function block 610 SCALER function block 531 TONOFF function block 613 SHL function 142 TOW function 627 SHR function 144 TP function block 616 SIN function 95 TRIMPOT_READ function block 404 SIN_LREAL function 97 TRUNC function 106 SQRT function 99 TTABLE function 162...
  • Page 652 Rockwell Automation support Rockwell Automation provides technical information on the web to assist you in using its products. At http://www.rockwellautomation.com/support you can find technical and application notes, sample code, and links to software service packs. You can also visit our Support Center at https://rockwellautomation.custhelp.com for software updates, support chats and forums, technical information, FAQs, and to sign up for product notification updates.

Table of Contents