FactoryTalk Logix 5000 Controllers Reference Manual
FactoryTalk Logix 5000 Controllers are a powerful and flexible platform for industrial automation. They offer a wide range of capabilities, including: Programmable logic controllers (PLCs), Human machine interfaces (HMIs), and Motion control systems. These controllers can be used to control a wide range of industrial processes and equipment.
Advertisement
Advertisement
Logix 5000 Controllers General Instructions 1756 ControlLogix, 1756 GuardLogix, 1769 CompactLogix, 1769 Compact GuardLogix, 1789 SoftLogix, 5069 CompactLogix, Emulate 5570 Reference Guide Original Instructions Important User Information Read this document and the documents listed in the additional resources section about installation, configuration, and operation of this equipment before you install, configure, operate, or maintain this product. Users are required to familiarize themselves with installation and wiring instructions in addition to requirements of all applicable codes, laws, and standards. Activities including installation, adjustments, putting into service, use, assembly, disassembly, and maintenance are required to be carried out by suitably trained personnel in accordance with applicable code of practice. If this equipment is used in a manner not specified by the manufacturer, the protection provided by the equipment may be impaired. In no event will Rockwell Automation, Inc. be responsible or liable for indirect or consequential damages resulting from the use or application of this equipment. The examples and diagrams in this manual are included solely for illustrative purposes. Because of the many variables and requirements associated with any particular installation, Rockwell Automation, Inc. cannot assume responsibility or liability for actual use based on the examples and diagrams. No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, circuits, equipment, or software described in this manual. Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation, Inc., is prohibited. Throughout this manual, when necessary, we use notes to make you aware of safety considerations. WARNING: Identifies information about practices or circumstances that can cause an explosion in a hazardous environment, which may lead to personal injury or death, property damage, or economic loss. ATTENTION: Identifies information about practices or circumstances that can lead to personal injury or death, property damage, or economic loss. Attentions help you identify a hazard, avoid a hazard, and recognize the consequence. IMPORTANT: Identifies information that is critical for successful application and understanding of the product. These labels may also be on or inside the equipment to provide specific precautions. SHOCK HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that dangerous voltage may be present. BURN HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that surfaces may reach dangerous temperatures. ARC FLASH HAZARD: Labels may be on or inside the equipment, for example, a motor control center, to alert people to potential Arc Flash. Arc Flash will cause severe injury or death. Wear proper Personal Protective Equipment (PPE). Follow ALL Regulatory requirements for safe work practices and for Personal Protective Equipment (PPE). The following icon may appear in the text of this document. Tip: Identifies information that is useful and can help to make a process easier to do or easier to understand. Rockwell Automation recognizes that some of the terms that are currently used in our industry and in this publication are not in alignment with the movement toward inclusive language in technology. We are proactively collaborating with industry peers to find alternatives to such terms and making changes to our products and content. Please excuse the use of such terms in our content while we implement these changes. 2 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Summary of changes This manual includes new and updated information. Use these reference tables to locate changed information. Global changes None for this release. New or enhanced features Subject Reason Access the TimeSynchronize object on page 252 Anomaly resolution; corrected link to the Deploying Scalable Time Distribution within a Converged Plantwide Ethernet Architecture Design Guide. File Search and Compare (FSC) on page 536 Anomaly resolution; in the Ladder diagram table, removed BOOL from the list of data types supported for 5x80 controllers. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 3 4 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Contents Alarm Instructions....................................................................................................................................................................................................................................................19 Alarm Set Operation (ASO).........................................................................................................................................................................................................................................................................19 Analog Alarm (ALMA).................................................................................................................................................................................................................................................................................. 22 Digital Alarm (ALMD).................................................................................................................................................................................................................................................................................. 50 Bit Instructions........................................................................................................................................................................................................................................................ 65 One Shot (ONS)............................................................................................................................................................................................................................................................................................65 One Shot Falling (OSF)............................................................................................................................................................................................................................................................................... 67 One Shot Falling with Input (OSFI).......................................................................................................................................................................................................................................................... 69 One Shot Rising (OSR)................................................................................................................................................................................................................................................................................72 One Shot Rising with Input (OSRI)...........................................................................................................................................................................................................................................................74 Output Energize (OTE)................................................................................................................................................................................................................................................................................76 Output Latch (OTL)..................................................................................................................................................................................................................................................................................... 77 Output Unlatch (OTU)................................................................................................................................................................................................................................................................................. 79 Examine if Closed (XIC)............................................................................................................................................................................................................................................................................ 80 Examine if Closed (XIC).............................................................................................................................................................................................................................................................................82 Examine If Open (XIO)............................................................................................................................................................................................................................................................................... 84 Timer and Counter Instructions.............................................................................................................................................................................................................................. 87 Count Down (CTD).......................................................................................................................................................................................................................................................................................87 Count Up (CTU)........................................................................................................................................................................................................................................................................................... 92 Count Up/Down (CTUD)..............................................................................................................................................................................................................................................................................97 Reset (RES)..................................................................................................................................................................................................................................................................................................101 Retentive Timer On (RTO)........................................................................................................................................................................................................................................................................103 Retentive Timer On with Reset (RTOR)................................................................................................................................................................................................................................................. 106 Timer Off Delay (TOF)................................................................................................................................................................................................................................................................................ 111 Timer Off Delay with Reset (TOFR).........................................................................................................................................................................................................................................................115 Timer On Delay (TON)................................................................................................................................................................................................................................................................................119 Timer On Delay with Reset (TONR)........................................................................................................................................................................................................................................................ 123 Input/Output Instructions.......................................................................................................................................................................................................................................127 Message (MSG)............................................................................................................................................................................................................................................................................................127 MSG Configuration Examples..................................................................................................................................................................................................................................................................145 Major fault types and codes...................................................................................................................................................................................................................................................................145 Minor fault types and codes...................................................................................................................................................................................................................................................................145 Extended Error Codes.............................................................................................................................................................................................................................................................................. 147 Specify the Communication Details...................................................................................................................................................................................................................................................... 153 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 5 Specify SLC Messages.............................................................................................................................................................................................................................................................................. 162 Specify Block Transfer Messages.......................................................................................................................................................................................................................................................... 162 Get System Value (GSV) and Set System Value (SSV).........................................................................................................................................................................................................................162 Immediate Output (IOT)........................................................................................................................................................................................................................................................................... 189 Reference (REF).........................................................................................................................................................................................................................................................................................194 Access System Values..............................................................................................................................................................................................................................................................................196 Access the AddOnInstructionDefinition Object....................................................................................................................................................................................................................................196 Access the ALARMBUFFER object...........................................................................................................................................................................................................................................................197 Access the Axis object............................................................................................................................................................................................................................................................................200 Access the Controller object...................................................................................................................................................................................................................................................................212 Access the ControllerDevice object.......................................................................................................................................................................................................................................................215 Access the CoordinateSystem object....................................................................................................................................................................................................................................................219 Access the CST object............................................................................................................................................................................................................................................................................ 224 Access the DF1 object............................................................................................................................................................................................................................................................................. 226 Access the FaultLog object....................................................................................................................................................................................................................................................................230 Access the HardwareStatus object........................................................................................................................................................................................................................................................231 Access the Message object....................................................................................................................................................................................................................................................................234 Access the Module object.......................................................................................................................................................................................................................................................................235 Access the Routine object......................................................................................................................................................................................................................................................................239 Access the Redundancy object............................................................................................................................................................................................................................................................. 240 Access the Program object....................................................................................................................................................................................................................................................................244 Access the MotionGroup object.............................................................................................................................................................................................................................................................245 Access the Message object.................................................................................................................................................................................................................................................................... 247 Access the Safety object........................................................................................................................................................................................................................................................................248 Access the Task object...........................................................................................................................................................................................................................................................................250 Access the TimeSynchronize object.....................................................................................................................................................................................................................................................252 Access the WallClockTime object..........................................................................................................................................................................................................................................................257 Determine Controller Memory Information..........................................................................................................................................................................................................................................259 DeviceNet Status Codes..........................................................................................................................................................................................................................................................................262 Get and Set System Data........................................................................................................................................................................................................................................................................267 GSV/SSV Programming Example........................................................................................................................................................................................................................................................... 268 GSV/SSV Objects........................................................................................................................................................................................................................................................................................271 GSV/SSV Safety Objects.......................................................................................................................................................................................................................................................................... 272 Monitor Status Flags................................................................................................................................................................................................................................................................................ 281 Select the Message Type........................................................................................................................................................................................................................................................................ 282 Module Faults: 16#0000 - 16#00ff.......................................................................................................................................................................................................................................................283 6 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Module Faults: 16#0100 - 16#01ff.........................................................................................................................................................................................................................................................287 Module Faults: 16#0200 - 16#02ff....................................................................................................................................................................................................................................................... 295 Module Faults: 16#0300 - 16#03ff....................................................................................................................................................................................................................................................... 298 Module Faults: 16#0800 - 16#08ff.......................................................................................................................................................................................................................................................303 Module Faults: 16#fd00 - 16#fdff.........................................................................................................................................................................................................................................................303 Module Faults: 16#fe00 - 16#feff.........................................................................................................................................................................................................................................................305 Module Faults: 16#ff00 - 16#ffff.......................................................................................................................................................................................................................................................... 309 Specify CIP Messages.............................................................................................................................................................................................................................................................................. 310 Specify PLC-3 Messages.......................................................................................................................................................................................................................................................................... 315 Specify PLC-5 Messages.......................................................................................................................................................................................................................................................................... 316 Specify PLC-2 Messages...........................................................................................................................................................................................................................................................................317 Compare Instructions.............................................................................................................................................................................................................................................319 Equal To (EQ)..............................................................................................................................................................................................................................................................................................319 Compare (CMP)..........................................................................................................................................................................................................................................................................................327 Greater Than (GT).....................................................................................................................................................................................................................................................................................330 GT Flow Chart (True)................................................................................................................................................................................................................................................................................338 Greater Than or Equal To (GE)...............................................................................................................................................................................................................................................................338 Is Infinity (IsINF).......................................................................................................................................................................................................................................................................................345 Is Not a Number (IsNAN).........................................................................................................................................................................................................................................................................347 Less Than (LT).......................................................................................................................................................................................................................................................................................... 348 Less Than or Equal To (LE).................................................................................................................................................................................................................................................................... 356 Limit (LIMIT)...............................................................................................................................................................................................................................................................................................363 Mask Equal To (MEQ)................................................................................................................................................................................................................................................................................372 Not Equal To (NE)..................................................................................................................................................................................................................................................................................... 379 Valid operators......................................................................................................................................................................................................................................................................................... 386 What is zero fill?......................................................................................................................................................................................................................................................................................388 Compute/Math Instructions...................................................................................................................................................................................................................................389 Absolute Value (ABS)................................................................................................................................................................................................................................................................................390 Add (ADD)................................................................................................................................................................................................................................................................................................... 395 Compute (CPT)...........................................................................................................................................................................................................................................................................................401 Divide (DIV)................................................................................................................................................................................................................................................................................................405 Modulo (MOD).............................................................................................................................................................................................................................................................................................. 411 Multiply (MUL)............................................................................................................................................................................................................................................................................................. 417 Negate (NEG)............................................................................................................................................................................................................................................................................................. 422 Square Root (SQRT)..................................................................................................................................................................................................................................................................................427 Subtract (SUB)...........................................................................................................................................................................................................................................................................................433 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 7 FBD Functions...........................................................................................................................................................................................................................................................................................440 Function Overloading.............................................................................................................................................................................................................................................................................. 440 Move/Logical Instructions.................................................................................................................................................................................................................................... 443 Bit Field Distribute (BTD)........................................................................................................................................................................................................................................................................444 Bit Field Distribute with Target (BTDT)................................................................................................................................................................................................................................................ 447 Bitwise And (AND)..................................................................................................................................................................................................................................................................................... 451 Bitwise Exclusive Or (XOR)......................................................................................................................................................................................................................................................................457 Bitwise Not (NOT)..................................................................................................................................................................................................................................................................................... 462 Bitwise Inclusive Or (OR).........................................................................................................................................................................................................................................................................467 Clear (CLR)................................................................................................................................................................................................................................................................................................. 473 Masked Move (MVM)..................................................................................................................................................................................................................................................................................476 Masked Move with Target (MVMT)......................................................................................................................................................................................................................................................... 478 Move (MOVE).............................................................................................................................................................................................................................................................................................. 482 Swap Byte (SWPB)....................................................................................................................................................................................................................................................................................486 Boolean AND (BAND).................................................................................................................................................................................................................................................................................489 Boolean Exclusive OR (BXOR)................................................................................................................................................................................................................................................................. 493 Boolean NOT (BNOT).................................................................................................................................................................................................................................................................................497 Boolean OR (BOR)..................................................................................................................................................................................................................................................................................... 500 Array File-Misc Instructions..................................................................................................................................................................................................................................505 Copy (COP) - Synchronous Copy (CPS).................................................................................................................................................................................................................................................506 File Arithmetic and Logic (FAL)..............................................................................................................................................................................................................................................................514 File Average (AVE).................................................................................................................................................................................................................................................................................... 529 File Fill (FLL)..............................................................................................................................................................................................................................................................................................533 File Search and Compare (FSC).............................................................................................................................................................................................................................................................536 File Sort (SRT)...........................................................................................................................................................................................................................................................................................548 File Standard Deviation (STD)................................................................................................................................................................................................................................................................ 553 Size In Elements (SIZE)........................................................................................................................................................................................................................................................................... 557 All Mode Flow Chart-FSC.........................................................................................................................................................................................................................................................................562 Numerical Mode........................................................................................................................................................................................................................................................................................562 Numeric Mode Flow Chart-FSC..............................................................................................................................................................................................................................................................564 Incremental Mode.....................................................................................................................................................................................................................................................................................564 Incremental Mode Flow Chart-FSC........................................................................................................................................................................................................................................................566 Array Tag................................................................................................................................................................................................................................................................................................... 566 Standard Deviation.................................................................................................................................................................................................................................................................................. 566 Array (File)/Shift Instructions.............................................................................................................................................................................................................................. 569 Bit Shift Left (BSL)................................................................................................................................................................................................................................................................................... 569 8 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Bit Shift Right (BSR).................................................................................................................................................................................................................................................................................572 FIFO Load (FFL).........................................................................................................................................................................................................................................................................................576 FIFO Unload (FFU).....................................................................................................................................................................................................................................................................................582 LIFO Load (LFL).........................................................................................................................................................................................................................................................................................588 LIFO Unload (LFU).....................................................................................................................................................................................................................................................................................594 Sequencer Instructions.......................................................................................................................................................................................................................................... 601 Sequencer Input (SQI).............................................................................................................................................................................................................................................................................. 601 Sequencer Load (SQL).............................................................................................................................................................................................................................................................................604 Sequencer Output (SQO)......................................................................................................................................................................................................................................................................... 608 Program Control Instructions.................................................................................................................................................................................................................................613 Always False (AFI)..................................................................................................................................................................................................................................................................................... 614 End of Transition (EOT)............................................................................................................................................................................................................................................................................615 Jump to External Routine (JXR).............................................................................................................................................................................................................................................................616 Jump to Label (JMP) and Label (LBL)..................................................................................................................................................................................................................................................620 Jump to Subroutine (JSR), Subroutine (SBR), and Return (RET)..................................................................................................................................................................................................... 622 Add Input Parameter command................................................................................................................................................................................................................................................. 630 Master Control Reset (MCR)....................................................................................................................................................................................................................................................................630 MCR Flow Chart (False)........................................................................................................................................................................................................................................................................... 633 No Operation (NOP)..................................................................................................................................................................................................................................................................................633 Pause SFC (SFP)....................................................................................................................................................................................................................................................................................... 635 Reset SFC (SFR)........................................................................................................................................................................................................................................................................................ 637 Temporary End (TND).............................................................................................................................................................................................................................................................................. 639 Trigger Event Task (EVENT)................................................................................................................................................................................................................................................................... 640 User Interrupt Disable (UID)/User Interrupt Enable (UIE).................................................................................................................................................................................................................644 Unknown Instruction (UNK).................................................................................................................................................................................................................................................................... 647 For/Break Instructions.......................................................................................................................................................................................................................................... 649 Break (BRK)................................................................................................................................................................................................................................................................................................649 For (FOR).................................................................................................................................................................................................................................................................................................... 650 Special Instructions...............................................................................................................................................................................................................................................655 Data Transition (DTR).............................................................................................................................................................................................................................................................................. 655 Diagnostic Detect (DDT)..........................................................................................................................................................................................................................................................................658 File Bit Comparison (FBC).......................................................................................................................................................................................................................................................................665 Proportional Integral Derivative (PID)...................................................................................................................................................................................................................................................673 Using PID Instructions.................................................................................................................................................................................................................................................................. 678 Anti-reset Windup and Bumpless Transfer From Manual To Auto (PID).............................................................................................................................................................................. 682 Bumpless Restart (PID).................................................................................................................................................................................................................................................................683 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 9 Cascading Loops (PID)..................................................................................................................................................................................................................................................................684 Controlling a Ratio (PID)...............................................................................................................................................................................................................................................................684 Derivative Smoothing (PID)..........................................................................................................................................................................................................................................................685 Feedforward or Output Biasing (PID).........................................................................................................................................................................................................................................685 PID Instruction Timing..................................................................................................................................................................................................................................................................686 Setting the Deadband (PID)......................................................................................................................................................................................................................................................... 689 Using Output Limiting (PID).........................................................................................................................................................................................................................................................690 Trigonometric Instructions.................................................................................................................................................................................................................................... 691 Arc Cosine (ACOS)......................................................................................................................................................................................................................................................................................691 Arc Sine (ASIN).......................................................................................................................................................................................................................................................................................... 697 Arc Tangent (ATAN).................................................................................................................................................................................................................................................................................. 702 Two-Argument Arctangent (ATAN2)....................................................................................................................................................................................................................................................... 707 Cosine (COS)................................................................................................................................................................................................................................................................................................711 Sine (SIN).................................................................................................................................................................................................................................................................................................... 716 Tangent (TAN).............................................................................................................................................................................................................................................................................................721 Advanced Math Instructions.................................................................................................................................................................................................................................. 727 Log Base 10 (LOG).....................................................................................................................................................................................................................................................................................727 Natural Log (LN)........................................................................................................................................................................................................................................................................................732 X to the Power of Y (EXPT).................................................................................................................................................................................................................................................................... 737 Math Conversion Instructions............................................................................................................................................................................................................................... 745 Convert to BCD (TO_BCD)........................................................................................................................................................................................................................................................................ 745 Convert to Integer (BCD_TO)...................................................................................................................................................................................................................................................................749 Degrees (DEG)............................................................................................................................................................................................................................................................................................753 Radian (RAD)..............................................................................................................................................................................................................................................................................................758 Truncate (TRUNC)..................................................................................................................................................................................................................................................................................... 763 ASCII Serial Port Instructions................................................................................................................................................................................................................................769 ASCII Chars in Buffer (ACB)..................................................................................................................................................................................................................................................................... 771 ASCII Clear Buffer (ACL)...........................................................................................................................................................................................................................................................................774 ASCII Handshake Lines (AHL)..................................................................................................................................................................................................................................................................776 ASCII Read (ARD)........................................................................................................................................................................................................................................................................................781 ASCII Read Line (ARL).............................................................................................................................................................................................................................................................................. 785 ASCII Test for Buffer Line (ABL)............................................................................................................................................................................................................................................................ 790 ASCII Write (AWT)......................................................................................................................................................................................................................................................................................793 ASCII Write Append (AWA)....................................................................................................................................................................................................................................................................... 798 String Types.............................................................................................................................................................................................................................................................................................. 803 ASCII Error Codes.....................................................................................................................................................................................................................................................................................804 10 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. ASCII String Instructions....................................................................................................................................................................................................................................... 807 Find String (FIND).....................................................................................................................................................................................................................................................................................808 Insert String (INSERT).............................................................................................................................................................................................................................................................................. 810 Middle String (MID)....................................................................................................................................................................................................................................................................................812 String Concatenate (CONCAT)................................................................................................................................................................................................................................................................. 815 String Delete (DELETE).............................................................................................................................................................................................................................................................................819 ASCII Conversion Instructions............................................................................................................................................................................................................................... 823 DINT to String-DTOS................................................................................................................................................................................................................................................................................ 824 Lower Case-LOWER..................................................................................................................................................................................................................................................................................826 REAL to String (RTOS)..............................................................................................................................................................................................................................................................................828 String to DINT (STOD).............................................................................................................................................................................................................................................................................. 830 String to REAL (STOR)..............................................................................................................................................................................................................................................................................833 Upper Case (UPPER)................................................................................................................................................................................................................................................................................ 835 Debug Instructions.................................................................................................................................................................................................................................................839 Breakpoints (BPT).....................................................................................................................................................................................................................................................................................839 Tracepoints (TPT).....................................................................................................................................................................................................................................................................................842 License Instructions.............................................................................................................................................................................................................................................. 847 License Validation (LV)............................................................................................................................................................................................................................................................................847 Common Attributes for General Instructions....................................................................................................................................................................................................... 849 Math status flags..................................................................................................................................................................................................................................................................................... 849 Immediate values.....................................................................................................................................................................................................................................................................................850 Data conversions...................................................................................................................................................................................................................................................................................... 851 Elementary data types............................................................................................................................................................................................................................................................................854 Pseudo-operand initialization................................................................................................................................................................................................................................................................856 Time and date data types......................................................................................................................................................................................................................................................................858 GSV and SSV objects that support time and date data types........................................................................................................................................................................................................ 860 Floating Point Values............................................................................................................................................................................................................................................................................... 861 FBD Functions...........................................................................................................................................................................................................................................................................................862 Index through arrays...............................................................................................................................................................................................................................................................................863 Bit Addressing...........................................................................................................................................................................................................................................................................................864 Major fault types and codes..................................................................................................................................................................................................................................................................865 Minor fault types and codes..................................................................................................................................................................................................................................................................865 Function Block Attributes......................................................................................................................................................................................................................................867 Choose the Function Block Elements...................................................................................................................................................................................................................................................867 Latching Data........................................................................................................................................................................................................................................................................................... 868 Order of Execution...................................................................................................................................................................................................................................................................................869 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 11 Function Block Responses to Overflow Conditions............................................................................................................................................................................................................................872 Timing Modes............................................................................................................................................................................................................................................................................................873 Program/Operator Control...................................................................................................................................................................................................................................................................... 877 Structured Text Programming............................................................................................................................................................................................................................... 879 Structured Text Syntax............................................................................................................................................................................................................................................................................879 Structured Text Components: Comments............................................................................................................................................................................................................................................ 881 Structured Text Components: Assignments......................................................................................................................................................................................................................................... 881 Specify a non-retentive assignment....................................................................................................................................................................................................................................................883 Assign an ASCII character to a string data member........................................................................................................................................................................................................................ 883 Structured Text Components: Expressions......................................................................................................................................................................................................................................... 884 Use arithmetic operators and functions.............................................................................................................................................................................................................................................885 Use bitwise operators.............................................................................................................................................................................................................................................................................886 Use logical operators..............................................................................................................................................................................................................................................................................886 Use relational operators......................................................................................................................................................................................................................................................................... 887 Structured Text Components: Instructions......................................................................................................................................................................................................................................... 889 Structured Text Components: Constructs........................................................................................................................................................................................................................................... 890 Character string literals......................................................................................................................................................................................................................................................................... 890 String Types.............................................................................................................................................................................................................................................................................................. 892 CASE_OF..................................................................................................................................................................................................................................................................................................... 892 FOR_DO....................................................................................................................................................................................................................................................................................................... 894 IF_THEN...................................................................................................................................................................................................................................................................................................... 897 REPEAT_UNTIL...........................................................................................................................................................................................................................................................................................899 WHILE_DO...................................................................................................................................................................................................................................................................................................902 12 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Preface This manual provides a programmer with details about the available General, Motion, Process, and Drives instruction set for a Logix-based controller. If you design, program, or troubleshoot safety applications that use GuardLogix controllers, refer to the GuardLogix Safety Application Instruction Set Safety Reference Manual, publication 1756-RM095. This manual is one of a set of related manuals that show common procedures for programming and operating Logix 5000 controllers. For a complete list of common procedures manuals, refer to the Logix 5000 Controllers Common Procedures Programming Manual, publication 1756-PM001. The term Logix 5000 controller refers to any controller based on the Logix 5000 operating system. Rockwell Automation recognizes that some of the terms that are currently used in our industry and in this publication are not in alignment with the movement toward inclusive language in technology. We are proactively collaborating with industry peers to find alternatives to such terms and making changes to our products and content. Please excuse the use of such terms in our content while we implement these changes. Studio 5000 environment The Studio 5000 Automation Engineering & Design Environment® combines engineering and design elements into a common environment. The first element is the Studio 5000 Logix Designer® application. The Logix Designer application is the rebranding of RSLogix 5000® software and will continue to be the product to program Logix 5000™ controllers for discrete, process, batch, motion, safety, and drive-based solutions. The Studio 5000® environment is the foundation for the future of Rockwell Automation® engineering design tools and capabilities. The Studio 5000 environment is the one place for design engineers to develop all elements of their control system. Instruction Locator Use this locator to find the applicable Logix5000 controllers instruction manual for each instruction. Logix5000 Controllers General Instructions Reference Manual 1756-RM003 Logix5000 Controllers Advanced Process Control and Drives and Equipment Phase and Sequence Instructions Reference Manual 1756-RM006 Logix5000 Controllers Motion Instructions Reference Manual MOTION-RM002 PlantPAx Process Control Instructions PROCES-RM215 Absolute Value (ABS) Alarm (ALM) Master Driven Coordinated Control (MDCC) Process Analog HART (PAH) Add (ADD) Attach to Equipment Phase (PATT) Motion Apply Axis Tuning (MAAT) Process Analog Input (PAI) Analog Alarm (ALMA) Attach to Equipment Sequence (SATT) Motion Apply Hookup Diagnostics (MAHD) Process Dual Sensor Analog Input (PAID) Always False (AFI) Coordinated Control (CC) Motion Arm Output Cam (MAOC) Process Multi Sensor Analog Input (PAIM) Arc Cosine (ACOS) D Flip-Flop (DFF) Motion Arm Registration (MAR) Process Analog Output (PAO) Arc Sine (ASIN) Deadtime (DEDT) Motion Arm Watch (MAW) Process Boolean Logic (PBL) Arc Tangent (ATAN) Derivative (DERV) Motion Axis Fault Reset (MAFR) Process Command Source (PCMDSRC) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 13 Logix5000 Controllers General Instructions Reference Manual 1756-RM003 Logix5000 Controllers Advanced Process Control and Drives and Equipment Phase and Sequence Instructions Reference Manual 1756-RM006 Logix5000 Controllers Motion Instructions Reference Manual MOTION-RM002 PlantPAx Process Control Instructions PROCES-RM215 ASCII Chars in Buffer (ACB) Detach from Equipment Phase (PDET) Motion Axis Gear (MAG) Process Discrete 2-, 3-, or 4-State Device (PD4SD) ASCII Clear Buffer (ACL) Detach from Equipment Sequence (SDET) Motion Axis Home (MAH) Process Deadband Controller (PDBC) ASCII Handshake Lines (AHL) Discrete 3-State Device (D3SD) Motion Axis Jog (MAJ) Process Discrete Input (PDI) ASCII Read (ARD) Discrete 2-State Device (D2SD) Motion Axis Move (MAM) Process Discrete Output (PDO) ASCII Read Line (ARL) Enhanced PID (PIDE) Motion Axis Position Cam (MAPC) Process Dosing (PDOSE) ASCII Test for Buffer Line (ABL) Enhanced Select (ESEL) Motion Axis Stop (MAS) Process Analog Fanout (PFO) ASCII Write (AWT) Equipment Phase Clear Failure (PCLF) Motion Axis Time Cam (MATC) Process High or Low Selector (PHLS) ASCII Write Append (AWA) Equipment Phase Command (PCMD) Motion Axis Shutdown (MASD) Process Interlocks (PINTLK) Bit Field Distribute (BTD) Equipment Phase External Request (PXRQ) Motion Axis Shutdown Reset (MASR) Process Lead Lag Standby Motor Group (PLLS) Bit Field Distribute with Target (BTDT) Equipment Phase Failure (PFL) Motion Calculate Cam Profile (MCCP) Process Motor (PMTR) Bit Shift Left (BSL) Equipment Phase New Parameters (PRNP) Motion Coordinated Path Move (MCPM) Process Permissives (PPERM) Bit Shift Right (BSR) Equipment Phase Override Command (POVR) Motion Calculate Slave Values (MCSV) Process Proportional + Integral + Derivative (PPID) Bitwise And (AND) Equipment Phase Paused (PPD) Motion Coordinated Transform with Orientation (MCTO) Process Pressure/Temperature Compensated Flow (PPTC) Bitwise (NOT) Equipment Sequence Assign Sequence Identifier (SASI) Motion Calculate Transform Position (MCTP) Process Restart Inhibit (PRI) Bitwise (OR) Equipment Sequence Clear Failure (SCLF) Motion Calculate Transform Position with Orientation (MCTPO) Process Run Time and Start Counter (PRT) Boolean AND (BAND) Equipment Sequence command (SCMD) Motion Change Dynamics (MCD) Process Tank Strapping Table (PTST) Boolean Exclusive OR (BXOR) Equipment Sequence Override (SOVR) Motion Coordinated Change Dynamics (MCCD) Process Valve (PVLV) Boolean NOT (BNOT) Function Generator (FGEN) Motion Coordinated Circular Move (MCCM) Process Valve Statistics (PVLVS) Boolean OR (BOR) High Pass Filter (HPF) Motion Coordinated Linear Move (MCLM) Break (BRK) High/Low Limit (HLL) Motion Coordinated Shutdown (MCSD) Breakpoints (BPT) HMI Button Control (HMIBC) Motion Coordinated Shutdown Reset (MCSR) Clear (CLR) Integrator (INTG) Motion Coordinated Stop (MCS) Compare (CMP) Internal Model Control (IMC) Motion Coordinated Transform (MCT) Convert to BCD (TO_BCD) JK Flip-Flop (JKFF) Motion Direct Drive Off (MDF) Convert to Integer (BCD_TO) Lead-Lag (LDLG) Motion Direct Drive On (MDO) Copy File (COP), Synchronous Copy File (CPS) Low Pass Filter (LPF) Motion Direct Start (MDS) Cosine (COS) Maximum Capture (MAXC) Motion Disarm Output Cam (MDOC) Compute (CPT) Minimum Capture (MINC) Motion Disarm Registration (MDR) Count down (CTD) Modular Multivariable Control (MMC) Motion Disarm Watch (MDW) Count up (CTU) Moving Average (MAVE) Motion Group Shutdown (MGSD) Count up/down CTUD Moving Standard Deviation (MSTD) Motion Group Shutdown Reset (MGSR) Data Transition (DTR) Multiplexer (MUX) Motion Group Stop (MGS) Degrees (DEG) Notch Filter (NTCH) Motion Group Strobe Position (MGSP) Diagnostic Detect (DDT) Phase State Complete (PSC) Motion Redefine Position (MRP) Digital Alarm (ALMD) Position Proportional (POSP) Motion Run Axis Tuning (MRAT) DINT To String (DTOS) Proportional + Integral (PI) Motion Run Hookup Diagnostics (MRHD) Divide (DIV) Pulse Multiplier (PMUL) Motion Servo Off (MSF) End of Transition (EOT) Ramp/Soak (RMPS) Motion Servo On (MSO) Equal to (EQ) Rate Limiter (RLIM) File Arithmetic (FAL) Reset Dominant (RESD) File Bit Comparison (FBC) Scale (SCL) FIFO Load (FFL) S-Curve (SCRV) FIFO Unload (FFU) Second-Order Controller (SOC) File Average (AVE) Second-Order Lead Lag (LDL2) File Standard Deviation (STD) Select (SEL) File Fill (FLL) Selected Negate (SNEG) File Sort (SRT) Selected Summer (SSUM) Find String (FIND) Set Dominant (SETD) For (FOR) Split Range Time Proportional (SRTP) File Search and Compare (FSC) Totalizer (TOT) 14 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Logix5000 Controllers General Instructions Reference Manual 1756-RM003 Logix5000 Controllers Advanced Process Control and Drives and Equipment Phase and Sequence Instructions Reference Manual 1756-RM006 Get System Value (GSV) and Set System Value (SST) Up/Down Accumulator (UPDN) Logix5000 Controllers Motion Instructions Reference Manual MOTION-RM002 PlantPAx Process Control Instructions PROCES-RM215 Greater Than or Equal to (GE) Greater than (GT) Insert String (INSERT) Immediate Output (IOT) Is Infinity (IsINF) Is Not a Number (IsNAN) Jump to Label (JMP) and Label (LBL) Jump to Subroutine (JSR), Subroutine (SBR), and Return (RET) Jump to External Routine (JXR) Less Than (LT) Less Than or Equal to (LE) LIFO Load (LFL) LIFO Unload (LFU) License Validation (LV) Limit (LIMIT) Log Base (LOG) Lower to Case (LOWER) Masked Move (MVM) Masked Move with Target (MVMT) Master Control Reset (MCR) Masked Equal to (MEQ) Message (MSG) Middle String (MID) Modulo (MOD) Move (MOVE) Multiply (MUL) Natural Log (LN) Negate (NEG) Not Equal to (NE) No Operation (NOP) One Shot (ONS) One Shot Falling (OSF) One Shot Falling with Input (OSFI) One Shot Rising (OSR) One Shot Rising with Input (OSRI) Output Energize (OTE) Output Latch (OTL) Output Unlatch (OTU) Proportional Integral Derivative (PID) Radian (RAD) Real to String (RTOS) Reset (RES) Reset SFC (SFR) Return (RET) Retentive Timer On (RTO) Retentive Timer On with Reset (RTOR) Pause SFC (SFP) Size In Elements (SIZE) Sequencer Input (SQI) Sequencer Load (SQL) Sequencer Output (SQO) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 15 Logix5000 Controllers General Instructions Reference Manual 1756-RM003 Logix5000 Controllers Advanced Process Control and Drives and Equipment Phase and Sequence Instructions Reference Manual 1756-RM006 Logix5000 Controllers Motion Instructions Reference Manual MOTION-RM002 PlantPAx Process Control Instructions PROCES-RM215 Sine (SIN) Square Roost (SQRT) String Concatenate (CONCAT) String Delete (DELETE) String to DINT (STOD) String to REAL (STOR) Swap Byte (SWPB) Subtract (SUB) Tangent (TAN) Timer Off Delay (TOF) Timer Off Delay with Reset (TOFR) Timer On Delay (TON) Timer On Delay with Reset (TONR) Temporary End (TND) Tracepoints (TPT) Trigger Event Task (EVENT) Truncate (TRUNC) Unknown Instruction (UNK) Upper Case (UPPER) User Interrupt Disable (UID)/User Interrupt Enable (UIE) X to the Power of Y (EXPT) Examine if Closed (XIC) Examine If Open (XIO) Bitwise Exclusive (XOR) Additional resources These documents contain additional information concerning related Rockwell Automation products. Resource Description Industrial Automation Wiring and Grounding Guidelines, publication, 1770-4.1 Provides general guidelines for installing a Rockwell Automation industrial system. Rockwell Automation product certifications Provides declarations of conformity, certificates, and other certification details. View or download publications at https://www.rockwellautomation.com/en-us/support/documentation/literature-library.html. To order paper copies of technical documentation, contact a local Rockwell Automation distributor or sales representative. Legal notices Rockwell Automation publishes legal notices, such as privacy policies, license agreements, trademark disclosures, and other terms and conditions on the Legal Notices page of the Rockwell Automation website. Software and Cloud Services Agreement Review the Rockwell Automation Software and Cloud Services Agreement here. Open Source Software Licenses The software included in this product contains copyrighted software that is licensed under one or more open source licenses. You can view a full list of all open source software used in this product and their corresponding licenses at this URL: Studio 5000 Logix Designer Open Source Attribution List 16 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. You may obtain Corresponding Source code for open source packages included in this product from their respective project web site(s). Alternatively, you may obtain complete Corresponding Source code by contacting Rockwell Automation via the Contact form on the Rockwell Automation website: http://www.rockwellautomation.com/global/aboutus/contact/contact.page. Please include "Open Source" as part of the request text. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 17 18 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions Use the alarm instructions to monitor and control alarm conditions. The Logix-based alarm instructions instructions integrate alarming between the RSView® SE applications and Logix 5000 controllers. Available Instructions Ladder Diagram ALMD on page 50 ALMA on page 22 ASO on page 19 ALMA on page 22 ASO on page 19 Function Block ALMD on page 50 Structured Text ALMD on page 50 If: Use the: Providing alarming for any discrete Boolean value for a ladder Digital Alarm (ALMD) instruction diagram, function block, or structured text Providing level and rate-of-change alarming for any analog Analog Alarm (ALMA) instruction signal for ladder diagram, function block, diagram and structured text Issuing a specified operation to all alarm conditions of the Alarm Set Operation (ASO) instruction specified alarm set Alarm Set Operation (ASO) This information applies to the Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Alarm Set Operation (ASO) instruction issues a specified operation to all alarm conditions of the specified alarm set. The Alarm Set Operation instruction is used to initiate asynchronous execution of an alarm operation for all alarm conditions of the specified alarm set. The instruction iterates through alarm conditions of the specified alarm set and sets an internal flag requesting the operation execution for each of the conditions. The internal flags have the same purpose and priority as the existing user accessible Progxxx bits and will be processed for all the alarm conditions of the specified alarm set during the next periodic evaluation of each particular alarm condition from the set. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 19 Chapter 1 Alarm Instructions Ladder Diagram Function Block Diagram This instruction is not available in Function Block Diagram. Structured Text ASO (Alarm Set, Alarm Set Control, Operation)Operands IMPORTANT: Unexpected operation may occur if: • The same tag (ALARM_SET_CONTROL) is used as a parameter for more than one instruction invocation. • The .LastState structure member is modified by a user application program. WARNING: The Alarm Set Control structure contains internal state information. If any of the configuration operands are changed while in run mode, accept the pending edits and cycle the controller mode from Program to Run for the changes to take effect. The following table provides operands used for configuring the instruction. Operand Data Type Format Description Alarm Set ALARM_SET AlarmSet The ALARM_SET structure represents alarm conditions that are operated on by this instruction. Alarm Set Control ALARM_SET_CONTROL tag This data type contains three BOOL flags: • EnableIn • EnableOut • LastState The instruction reacts to the edge (transition of .EnableIn from false to true) instead of the level. EnableOut is always set to .EnableIn. The request to perform the instruction operation have the same priority as ProgXXX flags. 20 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Operand Data Type Operation Alarm Instructions Format Description immediate This operand can be selected from the list or entered as an integer value: 0 - Acknowledge 1 - Reset 2 - Enable 3 - Disable 4- Unshelve 5 - Suppress 6 - Unsuppress 7 - ResetAlarmCount Affects Math Status FlagsNoMajor/Minor FaultsNone specific to this instruction. See Index through arrays on page 863 for array-indexing faults.Execution Condition/State Action Taken Prescan The instruction clears all ALARM_SET structure members. Rung-condition -in is false The instruction clears .EnableOut and .LastState structure members. Rung-condition-in is true If .LastState is false then the instruction initiates the operation and sets .LastState structure member to true. The .EnableOut structure member is always set to true. Postscan The instruction clears all ALARM_SET structure members. OperationThe Alarm Set Operation instruction initiates asynchronous execution of one of the following alarm operations on the specified alarm set: • Acknowledge • Reset • Enable • Disable • Unshelve • Suppress • Unsuppress • ResetAlarmCount The instruction iterates through all alarm conditions which are included in the specified alarm set or in the nested alarm sets to set an internal flag representing the request to perform the required operation on a particular alarm condition. The operation is initiated for all alarm conditions which are iterated by the instruction with the following exceptions: • Alarm Conditions which are configured not to support alarm operations • Alarm Conditions which are configured as not used When an alarm operation is initiated for a particular alarm condition by the instruction, the operation is performed during the next alarm periodic evaluation of the alarm condition.When the instruction is called multiple times for the same Alarm Set to initiate contradictory alarm operations, the last requested operation is always applied to all alarm conditions in the Alarm Set. The alarm operations initiated for the Alarm Set may be applied to the conditions before Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 21 Chapter 1 Alarm Instructions the last requested operation is performed.When an Alarm Condition is periodically evaluated, the requests to perform particular alarm operations have the same priority as the requests to perform alarm operations initiated via user accessible Progxxx flags. It means that if a request to perform an alarm operation is generated by the instruction, then it is handled as if the corresponding Progxxx flag is set and the same rules used to resolve conflicting requests specified for ProgXXX flags are used to resolve conflicts between the instruction requests and requests made via Progxxx flags.The Alarm Set Operation instruction initiates the required alarm operation only when it detects the transition of .EnableIn value from false to true. In order to detect the transition, .LastState structure member is used to store .EnableIn value from the previous instruction execution. See the Execution section above. Tip: If the Alarm set provided as the instruction parameter contains an excessive number of alarm conditions, then the execution time of the ASO instruction can increase significantly. Analog Alarm (ALMA) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The Analog Alarm (ALMA) instruction provides level and rate-of-change alarming for any analog signal. Ladder Diagram 22 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions Function Block Structured Text ALMA (ALMA,In,ProgAckAll,ProgDisable,ProgEnable) Operands Ladder Diagram Operand Type Format Description ALMA ALARM_ANALOG Structure ALMA structure In REAL Tag The alarm input value, which is DINT Immediate compared with alarm limits to detect the alarm condition. INT SINT ProgAckAll BOOL Tag Immediate On transition from False to True, acknowledges all alarm conditions that require acknowledgement. ProgDisable BOOL Tag Immediate Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 When True, disables alarm (does not override Enable Commands). 23 Chapter 1 Alarm Instructions ProgEnable BOOL Tag Immediate When True, enables alarm (takes precedence over Disable commands). Function Block Operand Type Format Description ALMA tag ALARM_ANALOG structure ALMA structure Operand Type Format Description ALMA ALARM_ANALOG Structure ALMA structure In REAL Tag The alarm input value, which is DINT Immediate Structured Text compared with alarm limits to detect the alarm condition. INT SINT ProgAckAll BOOL Tag Immediate On transition from False to True, acknowledges all alarm conditions that require acknowledgement. ProgDisable BOOL Tag Immediate ProgEnable BOOL Tag Immediate When True, disables alarm (does not override Enable Commands). When True, enables alarm (takes precedence over Disable commands). See Structured Text Syntax on page 879 for more information on the syntax of expressions within the structured text. ALMA Structure Input Parameters Input Parameter Data Type Description EnableIn BOOL Ladder Diagram: Corresponds to the rung state. If false, the instruction does not execute and outputs are not updated. Structured Text: If false, the instruction does not execute and outputs are not updated. Default is set. 24 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description Function Block: If false, the instruction does not execute and outputs are not updated. Default is set. In REAL The alarm input value, which is compared with alarm limits to detect the alarm condition. Default = 0.0. Ladder Diagram: Copied from instruction operand. Structured Text: Copied from instruction operand. InFault BOOL Bad health indicator for the input. The user application may set InFault to indicate the input signal has an error. When set, the instruction sets InFaulted (Status.1). When cleared to false, the instruction clears InFaulted to false (Status.1). In either case, the instruction continues to evaluate In for alarm conditions. Default is false (good health). HHEnabled BOOL High High alarm condition detection. Set to true to enable detection of the High High alarm condition. Clear to false to make detection unavailable for the High High alarm condition. Default is set. HEnabled BOOL High alarm condition detection. Set to true to enable detection of the High alarm condition. Clear to false to make detection unavailable for the High alarm condition. Default is set. LEnabled BOOL Low alarm condition detection. Set to true to enable detection of the Low alarm condition. Clear to false to make detection unavailable for the Low alarm condition. Default is set. LLEnabled BOOL Low Low alarm condition detection. Set to true to enable detection of the Low Low alarm condition. Clear to false to make Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 25 Chapter 1 Alarm Instructions Input Parameter Data Type Description detection unavailable for the Low Low alarm condition. Default is set. AckRequired BOOL Specifies whether alarm acknowledgment is required. When set to true, acknowledgment is required. When cleared to false, acknowledgment is not required and HHAcked, HAcked, LAcked, LLAcked, ROCPosAcked, and ROCNegAcked are always set to true Default is true. ProgAckAll BOOL Set to true by the user program to acknowledge all alarm conditions. Takes effect only if any alarm condition is unacknowledged. Requires a false-to-true transition. Default is false. Ladder Diagram: Copied from the instruction operand. Structured Text: Copied from the instruction operand. OperAckAll BOOL Set to true by the operator interface to acknowledge all alarm conditions. Takes effect only if any alarm condition is unacknowledged. The alarm instruction clears this parameter to false. Default is false. HHProgAck BOOL High High program acknowledge. Set to true by the user program to acknowledge a High High condition. Takes effect only if the alarm condition is unacknowledged. Requires a false -to-true transition. Default is false. HHOperAck BOOL High High operator acknowledge. Set to true by the operator interface to acknowledge a High High condition. Takes effect only if the alarm condition is unacknowledged. The alarm instruction clears this parameter to false. Default is false. HProgAck BOOL High program acknowledge. Set to true by the user program to acknowledge a High condition. Takes effect only if the alarm 26 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description condition is unacknowledged. Requires a false-to-true transition. Default is false. HOperAck BOOL High operator acknowledge. Set to true by the operator interface to acknowledge a High condition. Takes effect only if the alarm condition is unacknowledged. The alarm instruction clears this parameter to false. Default is false. LProgAck BOOL Low program acknowledge. Set to true by the user program to acknowledge a Low condition. Takes effect only if the alarm condition is unacknowledged. Requires a false-to-true transition. Default is false. LOperAck BOOL Low operator acknowledge. Set to true by the operator interface to acknowledge a Low condition. Takes effect only if the alarm condition is unacknowledged. The alarm instruction clears this parameter to false. Default is false. LLProgAck BOOL Low Low program acknowledge. Set to true by the user program to acknowledge a Low Low condition. Takes effect only if the alarm condition is unacknowledged. Requires a false-to-true transition. Default is false. LLOperAck BOOL Low Low operator acknowledge. Set to true by the operator interface to acknowledge a Low Low condition. Takes effect only if the alarm condition is unacknowledged. The alarm instruction clears this parameter false. Default is false. ROCPosProgAck BOOL Positive rate of change program acknowledge. Set to true by the user program to acknowledge a positive rate-of-change condition. Requires a false-to-true transition while the alarm condition is unacknowledged. Default is false. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 27 Chapter 1 Alarm Instructions Input Parameter Data Type Description ROCPosOperAck BOOL Positive rate of change operator acknowledge. Set to true by the operator interface to acknowledge a positive rate-of-change condition. Requires a false-to-true transition while the alarm condition is unacknowledged. The alarm instruction sets this parameter to false. Default is false. ROCNegProgAck BOOL Negative rate of change program acknowledge. Set to true by the user program to acknowledge a negative rate-of-change condition. Requires a false-to-true transition while the alarm condition is unacknowledged. Default is false. ROCNegOperAck BOOL Negative rate of change operator acknowledge. Set to true by the operator interface to acknowledge a negative rate-of-change condition. Requires a false-to-true transition while the alarm condition is unacknowledged. The alarm instruction clears this parameter to false. Default is false. ProgSuppress BOOL Set to true by the user program to suppress the alarm. Default is cleared. OperSuppress BOOL Set to true by the operator interface to suppress the alarm. The alarm instruction clears this parameter to false. Default is false. ProgUnsuppress BOOL Set to true by the user program to unsuppress the alarm. Takes precedence over Suppress commands. Default is false. OperUnsuppress BOOL Set to true by the operator interface to unsuppress the alarm. Takes precedence over Suppress commands. The alarm instruction sets this parameter to false. Default is false. HHOperShelve BOOL High-high operator shelve. Set to true by the operator interface to shelve or reshelve a high-high condition. Requires 28 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description a false-to-true transition. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. Shelving an alarm postpones alarm processing. It is like suppressing an alarm, except that shelving is time limited. If an alarm is acknowledged while it is shelved, it remains acknowledged even if it becomes active again. It becomes unacknowledged when the shelve duration ends. HOperShelve BOOL High operator shelve. Set to true by the operator interface to shelve or reshelve a high condition. Requires a transition from false in one program scan to true in the next program scan. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. LOperShelve BOOL Low operator shelve. Set to true by the operator interface to shelve or reshelve a low condition. Requires a transition false in one program scan to true in the next program scan. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. LLOperShelve BOOL Low-low operator shelve. Set to true by the operator interface to shelve or reshelve a low-low condition. Requires a transition from false in one program scan to true in the next program scan. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. ROCPosOperShelve BOOL Positive rate-of-change operator shelve. Set to true by the operator Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 29 Chapter 1 Alarm Instructions Input Parameter Data Type Description interface to shelve or reshelve a positive rate-of-change condition. Requires a transition from false in one program scan to true in the next program scan. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. ROCNegOperShelve BOOL Negative rate-of-change operator shelve. Set to true by the operator interface to shelve or reshelve a negative rate-of-change condition. Requires a transition from false in one program scan to true in the next program scan. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. ProgUnshelveAll BOOL Set to true by the user program to unshelve all conditions on this alarm. If both shelve and unshelve are true, unshelve commands take precedence over shelve commands. Default is false. HHOperUnshelve BOOL High-high operator unshelve. Set to true by the operator interface to unshelve a high-high condition. The alarm instruction clears this parameter to false. If both shelve and unshelve are true, unshelve commands take precedence over shelve commands. Default is false. HOperUnshelve BOOL High operator unshelve. Set to true by the operator interface to unshelve a high condition. The alarm instruction clears this parameter to false. If both shelve and unshelve are true, unshelve commands take precedence over shelve commands. Default is false. LOperUnshelve BOOL Low operator unshelve. Set to true by the operator interface to unshelve a low condition. The alarm instruction clears 30 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description this parameter to false. If both shelve and unshelve are true, unshelve commands take precedence over shelve commands. Default is false. LLOperUnshelve BOOL Low-low operator unshelve. Set to true by the operator interface to unshelve a low-low condition. The alarm instruction clears this parameter to false. If both shelve and unshelve are true, unshelve commands take precedence over shelve commands. Default is false. ROCPosOperUnshelve BOOL Positive rate-of-change operator unshelve. Set to true by the operator interface to unshelve a positive rate-of-change condition. The alarm instruction clears this parameter to false. If both shelve and unshelve are set, unshelve commands take precedence over shelve commands. Default is false. ROCNegOperUnshelve BOOL Negative rate-of-change operator unshelve. Set to true by the operator interface to unshelve a negative rate-of-change condition. The alarm instruction clears this parameter to false. If both shelve and unshelve are true, unshelve commands take precedence over shelve commands. Default is false. ProgDisable BOOL Copied from the instruction operand. OperDisable BOOL Set to true by the operator interface to disable the alarm. The alarm instruction clears this parameter to false. Default is false. ProgEnable BOOL Copied from the instruction operand. OperEnable BOOL Set to true by the operator interface to enable the alarm. Takes precedence over Disable command. The alarm instruction clears this parameter false. Default is false. AlarmCountReset BOOL Set to true by the operator interface to reset the alarm counts for all conditions. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 31 Chapter 1 Alarm Instructions Input Parameter Data Type Description The alarm instruction clears this parameter to false. Default is false. HHMinDurationEnable BOOL High-high minimum duration enable. Set to true to enable minimum duration timer when detecting the high-high condition. Default is true. HMinDurationEnable BOOL High minimum duration enable. Set to true to enable minimum duration timer when detecting the high condition. Default is true. LMinDurationEnable BOOL Low minimum duration enable. Set to true to enable minimum duration timer when detecting the low condition. Default is true. LLMinDurationEnable BOOL Low-low minimum duration enable. Set to true to enable minimum duration timer when detecting the low-low condition. Default is true. HHLimit REAL High High alarm limit. Valid = HLimit < HHLimit < maximum positive float. Default = 0.0. HHSeverity DINT Severity of the High High alarm condition. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. HLimit REAL High alarm limit. Valid = LLimit < HLimit < HHLimit. Default = 0.0. HSeverity DINT Severity of the High alarm condition. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. 32 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Description LLimit REAL Low alarm limit. Alarm Instructions Valid = LLLimit < LLimit < HLimit. Default = 0.0. LSeverity DINT Severity of the Low alarm condition. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. LLLimit REAL Low Low alarm limit. Valid = maximum negative float < LLLimit < LLimit. Default = 0.0. LLSeverity DINT Severity of the Low Low alarm condition. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. MinDurationPRE DINT Minimum duration preset (milliseconds) for an alarm level condition to remain true before the condition is marked as InAlarm and alarm notification is sent to clients. The controller collects alarm data as soon as the alarm condition is detected; so no data is lost while waiting to meet the minimum duration. Does not apply to rate-of-change conditions or to conditions for which minimum duration detection is disabled. MinDurationPRE only applies to the first excursion from normal in either direction. For example, once the High condition times out, the High High condition becomes active immediately, while a Low condition waits for the timeout period. Valid = 0...2147483647. Default = 0. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 33 Chapter 1 Alarm Instructions Input Parameter Data Type Description ShelveDuration DINT Time duration (in minutes) for which a shelved alarm will be shelved. Minimum time is one minute. Maximum time is defined by MaxShelveDuration. MaxShelveDuration DINT Maximum time duration (in minutes) for which an alarm can be shelved. Deadband REAL Deadband for detecting that High High, High, Low, and Low Low alarm levels have returned to normal. A non-zero Deadband can reduce alarm condition chattering if the In value is continually changing but remaining near the level condition threshold. The Deadband value does not affect the transition to the InAlarm (active) state. Once a level condition is active, but before the condition returns to the inactive (normal) state, the In value must either: drop below the threshold minus the deadband (for High and High High conditions). OR rise above the threshold plus the deadband (for Low and Low Low conditions). The Deadband is not used to condition the Minimum Duration time measurement. Valid = 0 = Deadband < Span from first enabled Low alarm to the first enabled High alarm. Default = 0.0. ROCPosLimit REAL Limit for an increasing rate-of-change in units per second. Detection is enabled for any value > 0.0 if ROCPeriod is also > 0.0. Valid = 0.0...maximum possible float. Default = 0.0. ROCPosSeverity DINT Severity of the increasing rate-of-change condition. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. 34 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. ROCNegLimit REAL Limit for a decreasing rate-of-change in units per second. Detection is enabled for any value > 0.0 if ROCPeriod is also > 0.0. Valid = 0.0...maximum possible float. Default = 0.0. ROCNegSeverity DINT Severity of the decreasing rate-of-change condition. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. ROCPeriod REAL Time period in seconds for calculation (sampling interval) of the rate of change value. Each time the sampling interval expires, a new sample of In is stored, and ROC is re-calculated. Instead of an enable bit like other conditions in the analog alarm, the rate-of-change detection is enabled by putting any non-zero value in the ROCPeriod. Valid = 0.0...32767.0 Default = 0.0. Output Parameters These output parameters are common to ladder logic. Output Parameter Data Type Description AnyInAlarmUnack BOOL Combined alarm active and acknowledged status. Set to true when any alarm condition is detected and unacknowledged. Cleared to false when all alarm conditions are inactive, acknowledged, or both. HHInAlarm BOOL High High alarm condition status. Set to true when a High High condition is Active. Cleared to false when no High High condition exists. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 35 Chapter 1 Alarm Instructions Output Parameter Data Type Description HInAlarm BOOL High alarm condition status. Set to true when a High condition is Active. Cleared to false when no High condition exists. LInAlarm BOOL Low alarm condition status. Set to true when a Low condition is Active. Cleared to false when no Low condition exists. LLInAlarm BOOL Low Low alarm condition status. Set to true when a Low Low condition is Active. Cleared to false when no Low Low condition exists. ROCPosInAlarm BOOL Positive rate-of-change alarm condition status. Set to true when a positive rate-of-change condition exists. Cleared to false when no positive rate-of-change condition exists. ROCNegInAlarm BOOL Negative rate-of-change alarm condition status. Set to true when a negative rate-of-change condition exists. Cleared to False when no negative rate-of-change condition exists. ROC REAL Calculated rate-of-change of the In value. This value is updated when the instruction is scanned following each elapsed ROCPeriod. The ROC value is used to evaluate the ROCPosInAlarm and ROCNegInAlarm conditions. ROC = (current sample of In – previous sample of In) / ROCPeriod HHAcked BOOL High High condition acknowledged status. Set to true when a High High condition is acknowledged. Always set to true when AckRequired is cleared to false. Cleared to false when a High High condition is not acknowledged. HAcked BOOL High condition acknowledged status. Set to true when a High condition is acknowledged. Always set to true when AckRequired is cleared to false. Cleared to false when a High condition is not acknowledged. LAcked BOOL Low condition acknowledged status. Set to true when a Low condition is acknowledged. Always set to true when 36 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Output Parameter Data Type Alarm Instructions Description AckRequired is cleared to false. Cleared to false when a Low condition is not acknowledged. LLAcked BOOL Low Low condition acknowledged status. Set to true when a Low Low condition is acknowledged. Always true when AckRequired is cleared to false. Cleared to false when a Low Low condition is not acknowledged. ROCPosAcked BOOL Positive rate-of-change condition acknowledged status. Set to true when a positive rate-of-change condition is acknowledged. Always true when AckRequired is cleared to false. Cleared to false when a positive rate-of-change condition is not acknowledged. ROCNegAcked BOOL Negative rate-of-change condition acknowledged status. Set to true when a negative rate-of-change condition is acknowledged. Always set to true when AckRequired is cleared to false. Cleared to false when a negative rate-of-change condition is not acknowledged. HHInAlarmUnack BOOL Combined High High condition active and unacknowledged status. Set to true when the High High condition is active (HHInAlarm is true) and unacknowledged. Cleared to false when the High High condition is inactive, acknowledged, or both. HInAlarmUnack BOOL Combined High condition active and unacknowledged status. Set to true when the High condition is active (HInAlarm is true) and unacknowledged. Cleared to false when the High condition is inactive, acknowledged, or both. LInAlarmUnack BOOL Combined Low condition active and unacknowledged status. Set to true when the Low condition is active (LInAlarm is true) and unacknowledged. Cleared to false when the Low condition is inactive, acknowledged, or both. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 37 Chapter 1 Alarm Instructions Output Parameter Data Type Description LLInAlarmUnack BOOL Combined Low Low condition active and unacknowledged status. Set to true when the Low Low condition is active (LLInAlarm is true) and unacknowledged. Cleared to false when the Low Low condition is inactive, acknowledged, or both. ROCPosInAlarmUnack BOOL Combined positive rate-of-change condition active and unacknowledged status. Set to true when the positive rate-of-change condition is active (ROCPosInAlarm is true) and unacknowledged. Cleared to false when the positive rate-of-change condition is inactive, acknowledged, or both. ROCNegInAlarmUnack BOOL Combined negative rate-of-change condition active and unacknowledged status. Set to true when the negative rate-of-change condition is active (ROCNegInAlarm is true) and unacknowledged. Cleared to false when the negative rate-of-change condition is inactive, acknowledged, or both. Suppressed BOOL Suppressed status of the alarm. Set to true when the alarm is suppressed. Cleared to false when the alarm is not suppressed. HHShelved BOOL High-high condition shelved status. Set to true when a high-high condition is shelved. Cleared to false when high-high condition is unshelved. HShelved BOOL High condition shelved status. Set to true when a high condition is shelved. Cleared to false when high condition is unshelved. LShelved BOOL Low condition shelved status. Set to true when a low condition is shelved. Cleared to false when low condition is unshelved. LLShelved BOOL Low-low condition shelved status. Set to true when a low-low condition is shelved. Cleared to false when low-low condition is unshelved. ROCPosShelved BOOL Positive rate-of-change condition shelved status. Set to true when a 38 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Output Parameter Data Type Alarm Instructions Description positive rate-of-change condition is shelved. Cleared to false when positive rate-of-change condition is unshelved. ROCNegShelved BOOL Negative rate-of-change condition shelved status. Set to true when a negative rate-of-change condition is shelved. Cleared to false when negative rate-of-change condition is unshelved. Disabled BOOL Disabled status of the alarm. Set to true when the alarm is unavailable (disabled). Cleared to false when the alarm is enabled. Commissioned BOOL The commissioned bit is not used. MinDurationACC DINT Not Used. Value is always 0. HHInAlarmTime LINT Timestamp when the ALMA instruction detected that the In value exceeded the High High condition limit for the most recent transition to the active state. HHAlarmCount DINT The number of times the High High condition has been activated. If the maximum value is reached, the counter leaves the value at the maximum count value. HInAlarmTime LINT Timestamp when the ALMA instruction detected that the In value exceeded the High condition limit for the most recent transition to the active state. HAlarmCount DINT The number of times the High condition has been activated. If the maximum value is reached, the counter leaves the value at the maximum count value. LInAlarmTime LINT Timestamp when the ALMA instruction detected that the In value exceeded the Low condition limit for the most recent transition to the active state. LAlarmCount DINT The number of times the Low condition has been activated. If the maximum value is reached, the counter leaves the value at the maximum count value. LLInAlarmTime LINT Timestamp when the ALMA instruction detected that the In value exceeded the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 39 Chapter 1 Alarm Instructions Output Parameter Data Type Description Low Low condition limit for the most recent transition to the active state. LLAlarmCount DINT The number of times the Low Low condition has been activated. If the maximum value is reached, the counter leaves the value at the maximum count value. ROCPosInAlarmTime LINT Timestamp when the ALMA instruction detected that the In value exceeded the positive-rate-of-change condition limit for the most recent transition to the active state. ROCPosInAlarmCount DINT The number of times the positive rate-of-change condition has been activated. If the maximum value is reached, the counter leaves the value at the maximum count value. ROCNegInAlarmTime LINT Timestamp when the ALMA instruction detected that the In value exceeded the negative-rate-of-change condition limit for the most recent transition to the active state. ROCNegAlarmCount DINT The number of times the negative rate-of-change condition has been activated. If the maximum value is reached, the counter leaves the value at the maximum count value. AckTime LINT Timestamp of most recent condition acknowledgment. If the alarm does not require acknowledgment, this timestamp is equal to most recent condition alarm time. RetToNormalTime LINT Timestamp of alarm returning to a normal state. AlarmCountResetTime LINT Timestamp indicating when the alarm count was reset. ShelveTime LINT Timestamp indicates when an alarm condition was shelved the last time. Set by controller when alarm condition is shelved. Alarm conditions can be shelved and unshelved many times. Each time 40 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Output Parameter Data Type Alarm Instructions Description alarm condition is shelved the timestamp is set to current time. UnshelveTime LINT Timestamp indicating when all alarm conditions are going to be unshelved. Value is set only when no alarm condition is shelved yet. The timestamp is determined as sum of the ShelveDuration time period and current time. If an alarm condition is unshelved programmatically or by an operator and no other alarm condition is shelved, then value is set to the current time. Status DINT Combined status indicators: Status Flag CompactLo CompactLo gix 5370, gix 5380, ControlLo CompactLo gix 5570, gix 5480, Compact ControlLo GuardLogix gix 5580, 5370, and Compact GuardLogix GuardLogix 5570 5380, and controllers GuardLogix 5580 controllers Status.0 = X X X X X X X X X X X X InstructFa ult Status.1 = InFaulted Status.2 = SeverityInv Status.3 = AlarmLimits Inv Status.4 = Deadband Inv Status.5 = ROCPosLimi tInv Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 41 Chapter 1 Alarm Instructions Output Parameter Data Type Description Status.6 = X X X X - X ROCNegLim itInv Status.7 = ROCPeriod Inv Status.8 = Overflow InstructFault (Status.0) BOOL Instruction error conditions exist. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. InFaulted (Status.1) BOOL User program has set InFault to indicate bad quality input data. Alarm continues to evaluate In for alarm conditions. SeverityInv (Status.2) BOOL Alarm severity configuration is invalid. If severity <1, the instruction uses Severity = 1. If severity >1000, the instruction uses Severity = 1000. AlarmLimitsInv (Status.3) BOOL Alarm Limit configuration is invalid (for example, LLimit < LLLimit). If invalid, the instruction clears all level conditions active bits. Until the fault is cleared, no new level conditions can be detected. DeadbandInv (Status.4) BOOL Deadband configuration is invalid. If invalid, the instruction uses Deadband = 0.0. Valid = 0 = Deadband < Span from first enabled low alarm to the first enabled high alarm. ROCPosLimitInv (Status.5) BOOL Positive rate-of-change limit invalid. If invalid, the instruction uses ROCPosLimit = 0.0, which makes positive rate-of-change detection unavailable. ROCNegLimitInv (Status.6) BOOL Negative rate-of-change limit invalid. If invalid, the instruction uses ROCNegLimit = 0.0, which makes negative rate-of-change detection unavailable. 42 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions Output Parameter Data Type Description ROCPeriodInv (Status.7) BOOL Rate-of-change period invalid. If invalid, the instruction uses ROCPeriod = 0.0, which makes rate-of-change detection unavailable. Overflow BOOL The Overflow bit is set to true when (Status.8) an overflow condition is detected. The overflow bit is cleared to false when the overflow condition has been corrected. Applies toL8 controllers for tables in topics on page only. Connect a button to the OperShelve tag The alarm instruction only processes the OperShelve tag on transition from cleared to set to prevent unwanted reshelving of the alarm. For example, if an operator presses a push button to shelve the alarm while the ProgUnshelve tag is set, the alarm is not shelved because the ProgUnshelve tag takes precedence. To shelve the alarm, the operator can release and press the push button again once ProgUnshelve is cleared. Affects Math Status Flags Controllers Affected Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers A minor fault will occur if: Fault Type Fault Code The input value is INF or NAN for 4 4 CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers only. See Math status flags on page 849. Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Analog Alarm State Diagrams Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 43 Chapter 1 Alarm Instructions These illustrations show the manner in which an analog alarm responds to changing alarm conditions and operator commands. 44 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions Analog Alarm Timing Diagrams These timing diagrams show the sequence of analog alarm operations. Level Conditions Behavior Acknowledge Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 45 Chapter 1 Alarm Instructions Level Conditions Behavior No Acknowledge 46 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions ROC Conditions Behavior Acknowledge ROC Conditions Behavior No Acknowledge Execution Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 47 Chapter 1 Alarm Instructions Ladder Diagram Condition/State Action Taken Prescan Rung-condition-out is cleared to false. All of the ALMA structure parameters are cleared All alarm conditions are acknowledged. All operator requests are cleared All timestamps are cleared All delivery flags are cleared. Rung-condition-in is false Rung-condition-out is cleared to false. Rung-condition-in is true Rung-condition-out is set to true The instruction executes Postscan Rung-condition-out is cleared to false Function Block Condition/State Action Taken Prescan Tag.EnableOut is cleared to false. All of the ALMA structure parameters are cleared All alarm conditions are acknowledged. All operator requests are cleared All timestamps are cleared All delivery flags are cleared. Tag.EnableIn is false Tag.EnableOut is cleared to false Tag.EnableIn is true The instruction executes Tag.EnableOut is set to true Instruction first run N/A Instruction first scan N/A Postscan Tag.EnableOut is cleared to false Structured Text In Structured Text, EnableIn is always true during normal scan. Therefore, if the instruction is in the control path activated by the logic it will execute. Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table. Normal Execution See Rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. Examples 48 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions Ladder Diagram Function Block An example of an ALMA instruction in Function Block is shown below. In this example, the Tank 32 Level Transmitter (Tank32LT) is monitored for alarm conditions. The Tank32LevelAck tag can be used to acknowledge all conditions of this alarm. Structured Text In this example, the Tank 32 Level Transmitter (Tank32LT) is monitored for alarm conditions. The Tank32LevelAck tag can be used to acknowledge all conditions of this alarm. ALMA(Tank32Level,Tank32LT,Tank32LevelAck,0, 0); Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 49 Chapter 1 Alarm Instructions Digital Alarm (ALMD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The Digital Alarm (ALMD) instruction provides alarming for any discrete Boolean value. Available Languages Ladder Diagram Function Block Structured Text ALMD (ALMD,In,ProgAck,ProgReset,ProgDisable,ProgEnable) Operands Ladder Diagram Operand Type Format Description ALMD tag ALARM_DIGITAL Structure ALMD structure ProgAck BOOL Tag On transition from false to Immediate 50 Publication 1756-RM003Z-EN-P - September 2024 true, acknowledges alarm (if acknowledgment is required). Rockwell Automation, Inc. Chapter 1 Alarm Instructions Operand Type Format Description ProgReset BOOL Tag On transition from false to Immediate ProgDisable BOOL Tag Immediate ProgEnable BOOL Tag Immediate MinDurationPRE DINT Immediate true, resets alarm (if resetting is required). When True, disables alarm (does not override Enable Commands). When True, enables alarm (takes precedence over Disable commands). Specifies how long the alarm condition must be met before it is reported (milliseconds). MinDurationACC DINT Immediate Indicates the current accumulator value for the alarm’s MinDuration timer. This value is not used in versions 29 and later of the Logix Designer application. The value is always 0. Function Block Operand Type Format Description ALMD tag ALARM_DIGITAL structure ALMD structure Operand Type Format Description ALMD tag ALARM_DIGITAL Structure ALMD structure ProgAck BOOL Tag On transition from false to Structured Text Immediate ProgReset BOOL Tag Immediate ProgDisable BOOL Tag Immediate ProgEnable BOOL Tag Immediate Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 true, acknowledges alarm (if acknowledgment is required). On transition from false to true, resets alarm (if resetting is required). When True, disables alarm (does not override Enable Commands). When True, enables alarm (takes precedence over Disable commands). 51 Chapter 1 Alarm Instructions Operand Type Format Description MinDurationPRE DINT Immediate Specifies how long the alarm condition must be met before it is reported (milliseconds). MinDurationACC DINT Immediate Indicates the current accumulator value for the alarm’s MinDuration timer. This value is not used in versions 29 and later of the Logix Designer application. The value is always 0. See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. ALMD Structure Input Parameters Input Parameter Data Type Description EnableIn BOOL Ladder Diagram: Corresponds to the rung state. Does not affect processing. Function Block: If cleared to false, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is true. Structured Text: No effect. The instruction always executes. In BOOL The digital signal input to the instruction. Default is false. Ladder Diagram: Follows the rung condition. Set to true if the rung condition is true. Cleared to false if the rung condition is false. Structured Text: Copied from instruction operand. InFault BOOL Bad health indicator for the input. The user application may set InFault to indicate the input signal has an error. When set, the instruction sets InFaulted (Status.1). When cleared to false, the instruction clears the InFaulted (Status.1) to false. In either case, the instruction 52 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description continues to evaluate In for alarm conditions. Default is false (good health). Condition BOOL Specifies how alarm is activated. When Condition is set to true, the alarm condition is activated when In is set to true. When Condition is cleared to false, the alarm condition is activated when In is Cleared to false. Default is true. AckRequired BOOL Specifies whether alarm acknowledgment is required. When set to true, acknowledgment is required. When cleared to false, acknowledgment is not required and Acked is always set to true. Default is true. Latched BOOL Specifies whether the alarm is latched. Latched alarms remain InAlarm when the alarm condition becomes false, until a Reset command is received. When set to true, the alarm is latched. When cleared to false, the alarm is unlatched. Default is false. A latched alarm can only be reset when the alarm condition is false. ProgAck BOOL Set to true by the user program to acknowledge the alarm. Takes effect only if the alarm is unacknowledged. Requires a false-to-true transition. Default is false. Ladder Diagram: Copied from the instruction operand. Structured Text: Copied from the instruction operand. OperAck BOOL Set to true by the operator interface to acknowledge the alarm. Takes effect only if the alarm is unacknowledged. The instruction clears this parameter. Default is false. ProgReset BOOL Set to true by the user program to reset the latched alarm. Takes effect only if the latched alarm is InAlarm and the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 53 Chapter 1 Alarm Instructions Input Parameter Data Type Description alarm condition is false. Requires a false-to-true transition. Default is false. Ladder Diagram: Copied from the instruction operand. Structured Text: Copied from the instruction operand. OperReset BOOL Set to true by the operator interface to reset the latched alarm. Takes effect only if the latched alarm is InAlarm and the alarm condition is false. The alarm instruction clears this parameter to false. Default is false. ProgSuppress BOOL Set to true by the user program to suppress the alarm. Default is false. OperSuppress BOOL Set to true by the operator interface to suppress the alarm. The alarm instruction clears this parameter to false. Default is false. ProgUnsuppress BOOL Set to true by the user program to unsuppress the alarm. Takes precedence over Suppress commands. Default is false. OperUnsuppress BOOL Set to true by the operator interface to unsuppress the alarm. Takes precedence over Suppress commands. The alarm instruction clears this parameter to false. Default is false. OperShelve BOOL Set to true by the operator interface to shelve or reshelve the alarm. Requires a transition from false in one program scan to true in the next program scan. The alarm instruction clears this parameter to false. Default is false. Unshelve commands take precedence over Shelve commands. Shelving an alarm postpones alarm processing. It is like suppressing an alarm, except that shelving is time limited. If an alarm is acknowledged while it is shelved, it remains acknowledged 54 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description even if it becomes active again. It becomes unacknowledged when the shelve duration ends provided the alarm is still active at that moment. ProgUnshelve BOOL Set to true by the user program to unshelve the alarm. Takes precedence over Shelve commands. Default is false. For more information on shelving an alarm, see the description for the OperShelve parameter. OperUnshelve BOOL Set to true by the operator interface to unshelve the alarm. The alarm instruction clears this parameter to false. Takes precedence over Shelve commands. Default is cleared. For more information on shelving an alarm, see the description for the OperShelve parameter. ProgDisable BOOL Set to true by the user program to disable the alarm. Default is false. Ladder Diagram: Copied from the instruction operand. Structured Text: Copied from the instruction operand. OperDisable BOOL Set to true by the operator interface to disable the alarm. The alarm instruction clears this parameter to true. Default is false. ProgEnable BOOL Set to true by the user program to enable the alarm. Takes precedence over a Disable command. Default is false. Ladder Diagram: Copied from the instruction operand. Structured Text: Copied from the instruction operand. OperEnable BOOL Set to true by the operator interface to enable the alarm. Takes precedence over Disable command. The alarm instruction clears this parameter to false. Default is false. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 55 Chapter 1 Alarm Instructions Input Parameter Data Type Description AlarmCountReset BOOL Set to true by the operator interface to reset the alarm count to zero. The alarm instruction clears this parameter to false. Default is false. UseProgTime BOOL Specifies whether to use the controller’s clock or the ProgTime value to timestamp alarm state change events. When set to true, the ProgTime value provides timestamp. When cleared to false, the controller’s clock provides timestamp. Default is false. ProgTime LINT If UseProgTime is set to true, this value is used to provide the timestamp value for all events. This lets the application apply timestamps obtained from the alarm source, such as a sequence-of-events input module. Severity DINT Severity of the alarm. This does not affect processing of alarms by the controller, but can be used for sorting and filtering functions at the alarm subscriber. Valid = 1...1000 (1000 = most severe; 1 = least severe). Default = 500. MinDurationPRE DINT Minimum duration preset (milliseconds) for the alarm condition to remain true before the alarm is marked as InAlarm and alarm notification is sent to clients. The controller collects alarm data as soon as the alarm condition is detected; so no data is lost while waiting to meet the minimum duration. Valid = 0...2147483647. Default = 0. ShelveDuration DINT Length of time in minutes to shelve an alarm. Shelving an alarm postpones alarm processing. It is like suppressing an alarm, except that shelving is time limited. If an alarm is acknowledged while it is shelved, it remains acknowledged even if it becomes active again. It becomes unacknowledged when the 56 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Input Parameter Data Type Alarm Instructions Description shelve duration ends (provided the alarm is still active at that time). Minimum time is one minute. Maximum time is defined by MaxShelveDuration. MaxShelveDuration DINT Maximum time duration in minutes for which an alarm can be shelved. For more information on shelving an alarm, see the description for the ShelveDuration parameter. Output Parameters Output Parameter Data Type Description EnableOut BOOL Enable output. InAlarm BOOL Alarm active status. Set to true when the alarm is active. Cleared to false when the alarm is not active (normal status). Acked BOOL Alarm acknowledged status. Set to true when the alarm is acknowledged. Cleared to false when the alarm is not acknowledged. Acked is always set to true when AckRequired is cleared to false. InAlarmUnack BOOL Combined alarm active and acknowledged status. Set to true when the alarm is active (InAlarm is true) and unacknowledged (Acked is false). Cleared to false when the alarm is inactive, acknowledged, or both. Suppressed BOOL Suppressed status of the alarm. Set to true when the alarm is suppressed. Cleared to falsewhen the alarm is not suppressed. Shelved BOOL Shelved status of the alarm. Set to true when alarm is shelved. Cleared to false when alarm is unshelved. Shelving an alarm postpones alarm processing. It is like suppressing an alarm, except that shelving is time limited. If an alarm is acknowledged while it is shelved, it remains acknowledged even if it becomes active again. It Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 57 Chapter 1 Alarm Instructions Output Parameter Data Type Description becomes unacknowledged when the shelve duration ends. Disabled BOOL Disabled status of the alarm. Set to true when the alarm is not enabled. Cleared to false when the alarm is enabled. Commissioned BOOL Commissioned status of the alarm. Set to true when the alarm is commissioned. Cleared to false when the alarm is decommissioned. Currently always set to true. MinDurationACC DINT Indicates the current accumulator value for the alarm’s MinDuration timer. This value is not used in versions 29 and later of the Logix Designer application. The value is always 0. AlarmCount DINT Number of times the alarm has been activated (InAlarm is set). If the maximum value is reached, the counter leaves the value at the maximum count value. InAlarmTime LINT Timestamp of alarm detection. AckTime LINT Timestamp of alarm acknowledgment. If the alarm does not require acknowledgment, this timestamp is equal to alarm time. RetToNormalTime LINT Timestamp of alarm returning to a normal state. AlarmCountResetTime LINT Timestamp indicating when the alarm count was reset. ShelveTime LINT Timestamp indicating when the alarm was shelved the last time. This value is set by controller when alarm is shelved. Alarm can be shelved and unshelved many times. Each time the alarm is shelved, the timestamp is set to the current time. For more information on shelving an alarm, see the description for the Shelved parameter. UnshelveTime LIN Timestamp indicating when the alarm is going to be unshelved. This value is set every time the alarm is shelved (even if 58 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Output Parameter Data Type Alarm Instructions Description the alarm has already been shelved). The timestamp is determined by adding the ShelveDuration to the current time. If the alarm is unshelved programmatically or by an operator, then the value is set to the current time. For more information on shelving an alarm see the description for the Shelved parameter. Status DINT Combined status indicators: Status.0 = InstructFault Status.1= InFaulted Status.2 = SeverityInv InstructFault (Status.0) BOOL Instruction error conditions exist. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. InFaulted BOOL (Status.1) User program has set InFault to indicate bad quality input data. Alarm continues to evaluate In for alarm condition. SeverityInv BOOL (Status.2) Alarm severity configuration. If severity <1, the instruction uses Severity = 1. If severity >1000, the instruction uses Severity = 1000. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 59 Chapter 1 Alarm Instructions Digital Alarms State Diagrams Digital Alarm Timing Diagrams 60 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions ALMD Alarm Acknowledge Required and Latched ALMD Alarm Acknowledge Required and Not Latched ALMD Alarm Acknowledge Not Required and Latched Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 61 Chapter 1 Alarm Instructions ALMD Alarm Acknowledge Not Required and Not Latched Connect a button to the OperShelve tag To prevent unwanted reshelving of the alarm, the alarm instruction only processes the OperShelve tag if it transitions from false to true between one program scan and the next. If an operator presses a push button to shelve the alarm while the ProgUnshelve tag is true, the alarm is not shelved because the ProgUnshelve tag takes precedence. However, because program scans complete in milliseconds, the operator may still be holding down the push button so that the OperShelve tag remains true over several program scans even though the ProgUnshelve tag has been cleared to false. This means that the alarm is not shelved. To shelve the alarm, the operator can release and press the button again Affects Math Status Flags No Major/Minor Faults 62 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 1 Alarm Instructions None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan EnableOut is cleared to false to false The InAlarm output is cleared to false The Shelved output is cleared to false The Acked ouput is set to true. All alarm conditions are acknowledged. All operator requests are cleared All timestamps are cleared Rung-condition-in is false Rung is cleared to false. The In parameter is cleared to false The instruction executes. Rung-condition-in is true Rung is set to true. The In parameter is set to true The instruction executes. Postscan Rung bit is cleared to false. Function Block Condition/State Action Taken Prescan Tag.EnableOut is cleared to false. The InAlarm output is cleared to false The Shelved output is cleared to false The Acked ouput is set to true All operator requests are cleared All timestamps are cleared Tag.EnableIn is false Tag.EnableOut is cleared to false Tag.EnableIn is true The instruction executes Tag.EnableOut is set to true Instruction first run N/A Instruction first scan N/A Postscan Tag.EnableOut is cleared to false. Structured Text Rockwell Automation, Inc. Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table. Normal Execution See Rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. Publication 1756-RM003Z-EN-P - September 2024 63 Chapter 1 Alarm Instructions Example Ladder Diagram Function Block Structured Text An example of an ALMD instruction in Structured Text is shown below. In this example, two motor failure signals are combined such that if either one occurs, a motor fault alarm is activated. The Motor101Ack tag can be used to acknowledge the alarm. Motor101FaultConditions := Motor101Overtemp OR Motor101FailToStart; ALMD(Motor101Fault,Motor101FaultConditions,Motor101Ack,0,0,0 ); 64 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions Use the bit (relay-type) instructions to monitor and control the status of bits, such as input bits or timer-control word bits. Available Instructions Ladder Diagram If you want to: Use this instruction: Enable outputs when a bit is set XIC on page 80 Enable outputs when a bit is cleared XIO on page 84 set a bit OTE on page 76 set a bit (retentive) OTL on page 77 clear bit (retentive) Output Latch (OTL) on page 77 Enable outputs for one scan each time a rung goes true ONS on page 65 set a bit for one scan each time a rung goes true OSR on page 72 set a bit for one scan each time the rung goes false OSF on page 67 set a bit for one scan each time the input is set in function One Shot Rising with Input (OSRI) on page 74 block set a bit for one scan each time the input is cleared in funciton One Shot Falling with Input (OSFI) on page 69 block One Shot (ONS) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The One Shot (ONS) instruction makes the remainder of the rung true each time rung-condition-in transitions from false to true. Available Languages Ladder Diagram Operands IMPORTANT: Unexpected operation may occur if: Rockwell Automation, Inc. • Output tag operands are overwritten • Members of a structure operand are overwritten • Except when specified, structure operands are shared by multiple instructions. Publication 1756-RM003Z-EN-P - September 2024 65 Chapter 2 Bit Instructions Ladder Diagram Operand Data Type Format Description Storage bit BOOL tag Internal storage bit. Retains the rung-condition-in from the last time the instruction was executed. There are various operand addressing modes possible for the storage bit, see Bit Addressing on page 864 for examples. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The storage bit is set to true to prevent an invalid trigger during the first scan. Rung-condition-in is false The storage bit is cleared to false, rung-condition-out is cleared to false. 66 Rung-condition-in is true See ONS Flow Chart (True). Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions ONS Flow Chart (True) Example Ladder Diagram In this example, the sum increments each time limit_switch_1 goes from false to true. One Shot Falling (OSF) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The One Shot Falling (OSF) instruction sets the output bit for one scan when rung-condition-in transitions from true to false. Available Languages Ladder Diagram Operands Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 67 Chapter 2 Bit Instructions IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten • Members of a structure operand are overwritten • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Storage Bit BOOL tag Stores the rung-condition-in from when the instruction was last executed. There are various operand addressing modes possible for the storage bit, see Bit Addressing on page 864 for examples. Output Bit BOOL tag Bit to be modified. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The storage bit is cleared to false to prevent an invalid trigger during the first program scan. The output bit is cleared to false. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. See OSF Flow Chart (False). Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The storage bit is set to true. The output bit is cleared to false. Postscan 68 Publication 1756-RM003Z-EN-P - September 2024 N/A Rockwell Automation, Inc. Chapter 2 Bit Instructions OSF Flow Chart (False) Example Ladder Diagram This example shows how an OSF can be used to make one or more instructions edge-triggered. Each time Limit_Switch_01 transitions from true to false the OSF will set Output_bit_02 to true. Any instruction conditioned by Output_bit_02 will be enabled and, since Output_bit_02 is only true for one scan, will execute once per transition. One Shot Falling with Input (OSFI) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The One Shot Falling with Input (OSFI) instruction sets the OutputBit for one execution cycle when the InputBit toggles from false to true. Available Languages Ladder Diagram This instruction is not available in ladder diagram. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 69 Chapter 2 Bit Instructions Function Block Structured Text OSFI(OSFI_tag) Operands Structured Text Operand Type Format Description OSFI tag FBD_ONESHOT Structure OSFI structure See Structured Text Syntax on page 879 for operand-related faults Function Block Operand Type Format Description OSFI tag FBD_ONESHOT Structure OSFI structure FBD_ONESHOT Structure Input Parameter Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. Default is set. InputBit BOOL Input bit. Output Parameter Data Type Description EnableOut BOOL Indicates if instruction is enabled. OutputBit BOOL Output bit Description If InputBit is false, and it was true the last time the instruction was scanned then OutputBit will be set, otherwise OutputBit will be cleared. Affects Math Status Flags No 70 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 Common Attributes for General Instructions on page 849 for operand-related faults. Execution Function Block Condition / State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes Instruction first run N/A Instruction first scan Previous InputBit history is cleared to require a True to False transition of InputBit. Postscan EnableIn and EnableOut bits are cleared to false. Structured Text Condition / State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Example When limit_switch1 goes from set to cleared, the OSFI instruction sets OutputBit for one scan. Function Block Structured Text OSFI_01.InputBit := limit_switch1; OSFI(OSFI_01); Output_state := OSFI_01.OutputBit; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 71 Chapter 2 Bit Instructions One Shot Rising (OSR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The One Shot Rising (OSR) instruction sets the output bit for one scan when rung-condition-in transitions from false to true. Available Languages Ladder Diagram Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten • Members of a structure operand are overwritten • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Storage Bit BOOL tag Stores the rung-condition-in from when the instruction was last executed. There are various operand addressing modes possible for the storage bit, see Bit 72 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Operand Data Type Format Bit Instructions Description Addressing on page 864 for examples. Output Bit BOOL tag Bit to be modified. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The storage bit is set to true to prevent an invalid trigger during the first program scan. The output bit is cleared to false. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in The storage bit is cleared to false. The output bit is cleared to false. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in See OSR Flow Chart (True). Postscan N/A OSR Flow Chart (True) Example Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 73 Chapter 2 Bit Instructions Ladder Diagram This example shows how an OSR can be used to make one or more instructions edge-triggered. Each time Limit_Switch_01 transitions from false to true the OSR will set Output_bit_02 to true. Any instruction conditioned by Output_bit_02 will be enabled and, since Output_bit_02 is only true for one scan, will execute once per transition. One Shot Rising with Input (OSRI) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The One Shot Rising with Input (OSRI) instruction sets the output bit for one execution cycle when the input bit toggles from cleared to set. Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Structured Text OSRI(OSRI_tag); Operands Structured Text Operand Type Format Description OSRI tag FBD_ONESHOT Structure OSRI structure Function Block 74 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions Operand Type Format Description OSRI tag FBD_ONESHOT Structure OSRI structure FBD_ONESHOT Structure Input Parameter Data Type Description EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is set. InputBit BOOL Input bit. Default is cleared. Output Parameter Data Type Description EnableOut BOOL Indicates if instruction is enabled. OutputBit BOOL Output bit Description If InputBit is true, and it was false the last time the instruction was scanned then OutputBit will be set, otherwise OutputBit will be cleared. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.Enable-in is false EnableIn and EnableOut bits are cleared to false. Tag.Enable-in is true EnableIn and EnableOut bits are set to true. The instruction executes. Instruction first run N/A Instruction first scan Previous InputBit history is set to require a False to True transition of InputBit. Postscan Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 EnableIn and EnableOut bits are cleared to false. 75 Chapter 2 Bit Instructions Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table Examples Function Block When limit_switch1 goes from cleared to set, the OSRI instruction sets OutputBit for one scan. Structured Text OSRI_01.InputBit := limit_switch1; OSRI(OSRI_01); State := OSRI_O1.OutputBit; Output Energize (OTE) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Output Energize (OTE) instruction sets or clears the data bit based on rung condition. Available Languages Ladder Diagram Operands IMPORTANT: Unexpected operation may occur if: 76 • Output tag operands are overwritten • Members of a structure operand are overwritten • Except when specified, structure operands are shared by multiple instructions. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions Ladder Diagram Operand Data Type Format Description Data bit BOOL tag Bit to be modified. There are various operand addressing modes possible for the data bit, see Bit Addressing on page 864 for examples. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The data bit is cleared to false Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. The data bit is cleared to false Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The data bit is set to true. Postscan The data bit is cleared to false. Example Ladder Diagram When switch is true, the OTE instruction sets Light_01 to true. When switch is false, the OTE instruction clears Light_01 to false. Output Latch (OTL) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Output Latch (OTL) instruction sets (latches) the data bit. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 77 Chapter 2 Bit Instructions When the rung condition is true, the OTL instruction sets the data bit to true. The data bit remains true until it is cleared, typically by an OTU instruction. When the rung condition is changed to false, the OTL instruction does not change the status of the data bit. Available Languages Ladder Diagram Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten • Members of a structure operand are overwritten • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Data bit BOOL tag Bit to be modified. There are various operand addressing modes possible for the data bit, see Bit Addressing on page 864 for examples. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. If the operand is an indirect array reference and the subscript is out of range, then the controller does not generate a major fault when the OTL instruction is false. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The data bit is set to true. Postscan 78 Publication 1756-RM003Z-EN-P - September 2024 N/A Rockwell Automation, Inc. Chapter 2 Bit Instructions Example Ladder Diagram When enabled, the OTL instruction turns the light on. Output Unlatch (OTU) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Output Unlatch (OTU) instruction clears (unlatches) the data bit. Available Languages Ladder Diagram Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten • Members of a structure operand are overwritten • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Data bit BOOL tag Bit to be modified. There are various operand addressing modes possible for the data bit, see Bit Addressing on page 864 for examples. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. If the operand is an indirect array reference and the subscript is out of range, then the controller does not generate a major fault when the OTL instruction is false. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 79 Chapter 2 Bit Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The data bit is set to true. Postscan N/A Example Ladder Diagram When enabled, the OTL instruction clears Light_02. Examine if Closed (XIC) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Examine if Closed (XIC) instruction examines the data bit to set or clear the rung condition. Available Languages Ladder Diagram Operands Ladder Diagram Operand Data Type Format Description Data bit BOOL tag Bit to be tested. There are various operand addressing modes possible for the data bit, see Bit Addressing on page 864 for examples. Affects Math Status Flags 80 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true If DataBit is true, rung-condition-out is set to true. If DataBit is false, rung-condition-out is cleared to false. Postscan N/A Example 1 Ladder Diagram If Limit_Switch_1 is true, the next instruction is enabled. Example 2 Ladder Diagram If S:V is true (generated by MOV), the next instruction is enabled. Example 3 Ladder Diagram XIC Access LINT Number Axis_04 is an AXIS_CIP_DRIVE tag. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 81 Chapter 2 Bit Instructions Test_Axis_00 is an Alias for Axis_04. The AXIS_CIP_DRIVE type has a LINT member called CIPAxisFaults. BusUndervoltageULFault is a bit member of CIPAxisFaults. Test_Axis_00.BusUndervoltageULFault is bit 34 of CIPAxisFaults. The bit 34 value is 0x400000000. If Test_Axis_00.BusUndervoltageULFault is true, this enables the next instruction. Examine if Closed (XIC) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Examine if Closed (XIC) instruction examines the data bit to set or clear the rung condition. Available Languages Ladder Diagram Operands Ladder Diagram Operand Data Type Format Description Data bit BOOL tag Bit to be tested. There are various operand addressing modes possible for the data bit, see Bit Addressing on page 864 for examples. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram 82 Condition/State Action Taken Prescan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions Condition/State Action Taken Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true If DataBit is true, rung-condition-out is set to true. If DataBit is false, rung-condition-out is cleared to false. Postscan N/A Example 1 Ladder Diagram If Limit_Switch_1 is true, the next instruction is enabled. Example 2 Ladder Diagram If S:V is true (generated by MOV), the next instruction is enabled. Example 3 Ladder Diagram XIC Access LINT Number Axis_04 is an AXIS_CIP_DRIVE tag. Test_Axis_00 is an Alias for Axis_04. The AXIS_CIP_DRIVE type has a LINT member called CIPAxisFaults. BusUndervoltageULFault is a bit member of CIPAxisFaults. Test_Axis_00.BusUndervoltageULFault is bit 34 of CIPAxisFaults. The bit 34 value is 0x400000000. If Test_Axis_00.BusUndervoltageULFault is true, this enables the next instruction. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 83 Chapter 2 Bit Instructions Examine If Open (XIO) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Examine If Open (XIO) instruction examines the data bit to set or clear the rung condition. Available Languages Ladder Diagram Operands Ladder Diagram Operand Data Type Format Description Data bit BOOL tag Bit to be tested. There are various operand addressing modes possible for the data bit, see Bit Addressing on page 864for examples. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true If Data Bit is true, rung-condition-out is cleared to false. If Data Bit is false, rung-condition-out is set to true. Postscan N/A Examples Example 1 84 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 2 Bit Instructions Ladder Diagram If Limit_Switch_01 is false, the next instruction is enabled. Example 2 Ladder Diagram If S:V is false, this enables the next instruction. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 85 86 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions Timers and counters control operations based on time or the number of events. Available Instructions Ladder Diagram TON on page 119 TOF on page 111 RTO on page 103 CTU on page 92 CTD on page 87 RES on page 101 Function Block and Structured Text TONR on page 123 TOFR on page 115 RTOR on page 106 If you want to Use this instruction time how long a timer is enabled TON time how long a timer is disabled TOF accumulate time RTO time how long a timer is enabled with built-in reset in function TONR CTUD on page 97 block time how long a timer is disabled with built-in reset in function TOFR block accumulate time with built-in reset in function block RTOR count up CTU count down CTD count up and count down in function block CTUD reset a timer or counter RES The time base is 1 msec for all timers. For example, a 2 second timer’s .PRE value should be 2000. Count Down (CTD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The CTD instruction counts downward each time the rung-condition-in transitions from false to true. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 87 Chapter 3 Timer and Counter Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Counter COUNTER tag Counter structure Preset DINT immediate Value of Counter.PRE. Accum DINT immediate Value of Counter.ACC. Preset and Accum (corresponding to .PRE and .ACC in the counter tag) are pseudo-operands. For details, see Pseudooperand initialization on page 856. COUNTER Structure Mnemonic Data Type Description .CD BOOL The countdown enable bit contains rung-condition-in when the instruction was last executed. .DN BOOL The done bit when clear indicates the counting operation is complete. .OV BOOL The overflow bit when set indicates the counter incremented past the upper limit of 2,147,483,647. .UN BOOL The underflow when set indicates the counter decremented past the lower limit of -2,147,483,648. 88 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions Mnemonic Data Type Description .PRE DINT The preset value specifies the value which the accumulated value must reach before the instruction indicates it is done. .ACC DINT The accumulated value specifies the number of transitions the instruction has counted. Description The CTD instruction is typically used with a CTU instruction that references the same counter structure. When rung-condition-in is set to true and .CD is false, .ACC will be decremented by one. When rung-condition-in is false, .CD will be cleared to false. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .CD bit is set to true to prevent invalid decrements during the first program scan. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in See CTD Flow Chart (False) Rung-condition-in is true Set Rung-condition-out to Rung-condition-in See CTD Flow Chart (True) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 89 Chapter 3 Timer and Counter Instructions Condition/State Action Taken Postscan N/A CTD Flow Chart (False) 90 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions CTD Flow Chart (True) Example Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 91 Chapter 3 Timer and Counter Instructions Ladder Diagram A conveyor brings parts into a buffer zone. Each time a part enters, limit_switch_3 is enabled and counter_2 increments by 1. Each time a part leaves, limit_switch_4 is enabled and counter_2 decrements by 1. If there are 100 parts in the buffer zone (counter_2.dn is true), conveyor_A turns on and stops the conveyor from bringing in any more parts until the buffer has room for more parts. Count Up (CTU) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The CTU instruction counts upward each time the rung-condition-in transitions from false to true. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands 92 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Counter COUNTER tag Counter structure Preset DINT immediate Value of Counter.PRE. Accum DINT immediate Value of Counter.ACC. Length (corresponding to .LEN in the control tag) is a pseudo-operand. For details, see Pseudo-operand initialization on page 856. COUNTER Structure Mnemonic Data Type Description .CU BOOL The count up enable contains rung-condition-in when the instruction was last executed. .DN BOOL The done bit when set indicates the counting operation is complete. .OV BOOL The overflow bit when set indicates the counter incremented past the upper limit of 2,147,483,647. .UN BOOL The underflow when set indicates the counter decremented past the lower limit of -2,147,483,648. .PRE DINT The preset value specifies the value which the accumulated value must reach before the instruction indicates it is done. .ACC DINT The accumulated value specifies the number of transitions the instruction has counted. Description Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 93 Chapter 3 Timer and Counter Instructions When rung-condition-in is set to true and .CU is false, ACC will be incremented by one. When rung-condition-in is false, .CU will be cleared to false. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .CU bit is set to true to prevent invalid increments during the first program scan. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in See CTU Flow Chart (False) Rung-condition-in is true Set Rung-condition-out to Rung-condition-in See CTU Flow Chart (True) Postscan 94 Publication 1756-RM003Z-EN-P - September 2024 N/A Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions CTU Flow Chart (False) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 95 Chapter 3 Timer and Counter Instructions CTU Flow Chart (True) Example Ladder Diagram 96 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions After limit_switch_1 goes from disabled to enabled 10 times, the .DN bit is set to true and light_1 turns on. If limit_switch_1 continues to go from disabled to enabled, counter_1 continues to increment its count and the .DN bit remains set. When limit_switch_2 is enabled, the RES instruction resets counter_1 (clears the status bits and the .ACC value) and light_1 turns off. Count Up/Down (CTUD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The CTUD instruction counts up by one when CUEnable transitions from clear to set. The instruction counts down by one when CDEnable transitions from clear to set. Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Structured Text CTUD(CTUD_tag) Operands Structured Text Variable Type Format Description CTUD tag FBD_COUNTER Structure CTUD structure See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Function Block Rockwell Automation, Inc. Operand Type Format Description CTUD tag FBD_COUNTER Structure CTUD structure Publication 1756-RM003Z-EN-P - September 2024 97 Chapter 3 Timer and Counter Instructions FBD_COUNTER Structure Input Parameter Data Type Description EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is set. CUEnable BOOL Enable up count. When input toggles from clear to set, accumulator counts up by one. Default is cleared CDEnable BOOL Enable down count. When input toggles from clear to set, accumulator counts down by one. Default is cleared PRE DINT Counter preset value. This is the value the accumulated value must reach before DN is set. Valid = any integer Default is 0 Reset BOOL Request to reset the timer. When set, the counter resets. Default is cleared Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result. ACC DINT Accumulated value. CU BOOL Count up enabled. CD BOOL Count down enabled. DN BOOL Counting done. Set when accumulated value is greater than or equal to preset. OV BOOL Counter overflow. Indicates the counter exceeded the upper limit of 2,147,483,647. The counter then rolls over to -2,147,483,648 and begins counting down again. UN BOOL Counter underflow. Indicates the counter exceeded the lower limit of -2,147,483,648. The counter then rolls 98 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Output Parameter Data Type Timer and Counter Instructions Description over to 2,147,483,647 and begins counting down again. Description When true and CUEnable is true, the CTUD instructions increments the counter by one. When true and CDEnable is true, the CTUD instruction decrements the counter by one. Both the CUEnable and CDEnable input parameters can be toggled during the same scan. The instruction executes the count up prior to the count down. Count Up Count Down When disabled, the CTUD instruction retains its accumulated value. Set the Reset input parameter to reset the instruction. Affects Math Status Flags No Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 99 Chapter 3 Timer and Counter Instructions Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Initialize data to require a "zero to one" transition of CuEnable or CdEnable to effect ACC. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes. Instruction first run Initialize data to require a "zero to one" transition of CuEnable or CdEnable to effect ACC. Instruction first scan Initialize data to require a "zero to one" transition of CuEnable or CdEnable to effect ACC. Postscan EnableIn and EnableOut bits are cleared to false. Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Example Function Block Structured Text CTUD_01.PRE := 500; 100 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions CTUD_01.Reset := Reset; CTUD_01.CUEnable := Input; CTUD(CTUD_01); counter_state := CTUD_01.DN; Reset (RES) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The RES instruction resets a TIMER, COUNTER, or CONTROL structure. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Structure TIMER Tag Structure to reset CONTROL COUNTER Description When true, the RES instruction clears these elements: When using a RES instruction for a: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 The instruction clears: 101 Chapter 3 Timer and Counter Instructions TIMER .ACC value to 0 control status bits to false COUNTER .ACC value to 0 control status bits to false CONTROL .POS value to 0 control status bits to false Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Reset the specified structure. Postscan N/A Example 102 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions Ladder Diagram Reset Example In the preceding example: when limit_switch_8 is enabled, reset counter_4 when limit_switch_5 is enabled, reset Timer_1 when limit_switch_6 is enabled, reset control_1 Retentive Timer On (RTO) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The RTO instruction is a retentive timer that accumulates time when the instruction is enabled. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 103 Chapter 3 Timer and Counter Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Timer TIMER tag Timer structure Preset DINT immediate Value of Timer.PRE. Accum DINT immediate Value of Timer.ACC. Preset and Accum (corresponding to .PRE and .ACC in the timer tag) are pseudo-operands. For details, see Pseudooperand initialization on page 856. TIMER Structure Mnemonic Data Type Description .EN BOOL The enable bit contains rung-condition-in when the instruction was last executed. .TT BOOL The timing bit when set indicates the timing operation is in process. .DN BOOL The done bit when set indicates the timing operation is complete (or paused). .PRE DINT The preset value specifies the value (1 millisecond units) which the accumulated value must reach before the instruction indicates it is done. 104 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 .ACC DINT Timer and Counter Instructions The accumulated value specifies the number of milliseconds that have elapsed since the RTO instruction was enabled. Description The RTO instruction accumulates time until: • The timer is disabled. • The timer completes. The time base is always 1 millisecond. For example, for a 2 second timer, enter 2000 for the .PRE value. The timer will set the .DN bit to true when the timer completes. When enabled, timing can be paused by setting the .DN bit to true and resumed by clearing the .DN bit to false. How a Timer Runs A timer runs by subtracting the time of its last scan from the current time: ACC = ACC + (current_time - last_time_scanned) After it updates the ACC, the timer sets last_time_scanned = current_time. This gets the timer ready for the next scan. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault type Fault code .PRE < 0 4 34 .ACC < 0 4 34 See Index through arrays on page 863 for array-indexing faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 105 Chapter 3 Timer and Counter Instructions Execution Ladder Diagram Condition/State Action Taken Prescan The .EN bit is cleared to false. The .TT bit is cleared to false. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in The .EN bit is cleared to false. The .TT bit is cleared to false. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in See RTO Flow Chart (True). Postscan N/A RTO Flow Chart (True) Example Ladder Diagram When limit_switch_7 is set, light_2 is on for 180 milliseconds (timer_3 is timing). When timer_3.acc reaches 180, light_2 goes off and light_3 goes on. Light_3 remains on until timer_3 is reset. If limit_switch_7 is cleared while timer_3 is timing, light_2 goes off. When limit_switch_8 is set, the RES instruction resets timer_3 (clears status bits and .ACC value). Retentive Timer On with Reset (RTOR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The RTOR instruction is a retentive timer that accumulates time when TimerEnable is set. 106 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Structured Text RTOR(RTOR_tag) Operands Structured Text Variable Type Format Description RTOR tag FBD_TIMER Structure RTOR structure See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Function Block Operand Type Format Description RTOR tag FBD_TIMER Structure RTOR structure FBD_TIMER Structure Input Parameter Data Type Description EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is set. TimerEnable BOOL If set, this enables the timer to run and accumulate time. Default is cleared. PRE DINT Timer preset value. This is the value in 1 msec units that ACC must reach before timing is finished. If invalid, the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 107 Chapter 3 Timer and Counter Instructions Input Parameter Data Type Description instruction sets the appropriate bit in Status and the timer does not execute. Valid = 0 to maximum positive integer Reset BOOL Request to reset the timer. When set, the timer resets. When the Reset input parameter is set, the instruction clears EN, TT and DN and sets ACC = 0. Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result. ACC DINT Accumulated time in milliseconds. This value is retained even while the TimerEnable input is cleared. EN BOOL Timer enabled output. Indicates the timer instruction is enabled. TT BOOL Timer timing output. When set, a timing operation is in progress. DN BOOL Timing done output. Indicates when accumulated time is greater than or equal to preset. Status DINT Status of the function block. InstructFault (Status.0) BOOL The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. PresetInv (Status.1) BOOL The preset value is invalid. Description The RTOR instruction accumulates time until it is false. When the RTOR instruction is false, it retains its ACC value. You must clear the .ACC value using the Reset input. 108 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions The time base is always 1 msec. For example, for a 2-second timer, enter 2000 for the PRE value. Set the Reset input parameter to reset the instruction. If TimerEnable is set when Reset is set, the RTOR instruction begins timing again when Reset is cleared. How a Timer Runs A timer runs by subtracting the time of its last scan from the current time: • ACC = ACC + (current_time - last_time_scanned) • After it updates the ACC, the timer sets last_time_scanned= current_time. This gets the timer ready for the next scan. IMPORTANT: Be sure to scan the timer at least every 69 minutes while it runs. Otherwise, the ACC value won’t be correct. The last_time_scanned value has a range of up to 69 minutes. The timer’s calculation rolls over if you don’t scan the timer within 69 minutes. The ACC value won’t be correct if this happens. While a timer runs, scan it within 69 minutes if you put it in a: • Subroutine • Section of code that is between JMP and LBL instructions • Sequential function chart (SFC) • Event or periodic task • State routine of a phase Affects Math Status Flags No Major/Minor Faults Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 109 Chapter 3 Timer and Counter Instructions None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes. When the Reset input parameter is set, the instruction clears EN, TT and DN and sets ACC = 0. Instruction first run EN, TT and DN are cleared to false. The instruction executes. Instruction first scan N/A Postscan EnableIn and EnableOut are cleared to false. Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Example Function Block Structured Text RTOR_01.PRE := 500; RTOR_01.Reset := Reset; RTOR_01.TimerEnable := Input; RTOR(RTOR_01); 110 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions timer_state := RTOR_01.DN; Timer Off Delay (TOF) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The TOF instruction is a non-retentive timer that accumulates time when the instruction is enabled (rung-conditionin is false). Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Timer TIMER tag Timer structure Preset DINT immediate Value of Timer.PRE. Accum DINT immediate Value of Timer.ACC. Preset and Accum (corresponding to .PRE and .ACC in the timer tag) are pseudo-operands. For details, see Pseudooperand initialization on page 856. TIMER Structure Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 111 Chapter 3 Timer and Counter Instructions Mnemonic Data Type Description .EN BOOL The enable bit contains rung-condition-in when the instruction was last executed. .TT BOOL The timing bit when set indicates the timing operation is in process. .DN BOOL The done bit when cleared indicates the timing operation is complete (or paused). .PRE DINT The preset value specifies the value (1 millisecond units) which the accumulated value must reach before the instruction indicates it is done. .ACC DINT The accumulated value specifies the number of milliseconds that have elapsed since the TOF instruction was enabled. Description The TOF instruction accumulates time until: • The timer is disabled • The timer completes The time base is always 1 millisecond. For example, for a 2 second timer, enter 2000 for the .PRE value. The timer will clear the .DN bit to false when the timer completes. When enabled, timing can be paused by clearing the .DN bit to false and resumed by setting the .DN bit to true. How a Timer Runs A timer runs by subtracting the time of its last scan from the current time: 112 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions ACC = ACC + (current_time - last_time_scanned) After it updates the ACC, the timer sets last_time_scanned = current_time. This gets the timer ready for the next scan. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault type Fault code .PRE < 0 4 34 .ACC < 0 4 34 See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EN bit is cleared to false. The .TT bit is cleared to false. The .DN bit is cleared to false. The .ACC value is set to equal the .PRE value. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in See TOF Flow Chart (False). Rung-condition-in is true Set Rung-condition-out to Rung-condition-in The .EN bit is set to true. The .TT bit is cleared to false. The .DN bit is set to true. The .ACC value is cleared to zero. Postscan The .EN bit is cleared to false. The .TT bit is cleared to false. The .DN bit is cleared to false. The .ACC value is set to equal the .PRE value. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 113 Chapter 3 Timer and Counter Instructions TOF Flow Chart (False) Example Ladder Diagram 114 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions When limit_switch_9 is cleared, light_8 is on for 180 milliseconds (timer_2 is timing). When timer_2.acc reaches 180, light_8 goes off and light_4 goes on. Light_4 remains on until the TOF instruction is enabled. If limit_switch_9 is true while timer_2 is timing, light_8 goes off. Timer Off Delay with Reset (TOFR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The TOFR instruction is a non-retentive timer that accumulates time when TimerEnable is cleared. Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Structured Text TOFR(TOFR_tag) Operands Structured Text Variable Type Format Description TOFR tag FBD_TIMER Structure TOFR structure See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Function Block Operand Type Format Description TOFR tag FBD_TIMER Structure TOFR structure FBD_TIMER Structure Input Parameters Data Type Description EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 115 Chapter 3 Timer and Counter Instructions Input Parameters Data Type Description Default is set. TimerEnable BOOL If cleared, this enables the timer to run and accumulate time. Default is cleared. PRE DINT Timer preset value. This is the value in 1 msec units that ACC must reach before timing is finished. If invalid, the instruction sets the appropriate bit in Status and the timer does not execute. Valid = 0 to maximum positive integer Reset BOOL Request to reset the timer. When set, the timer resets. Default is cleared. When the Reset input parameter is set, the instruction clears EN, TT and DN and sets ACC = PRE. Note that this is different than using a RES instruction on a TOF instruction. Output Parameters Data Type Description EnableOut BOOL The instruction produced a valid result. ACC BOOL Accumulated time in milliseconds. EN BOOL Timer enabled output. Indicates the timer instruction is enabled. TT BOOL Timer timing output. When set, a timing operation is in progress. DN BOOL Timing done output. Indicates when accumulated time is greater than or equal to preset. Status DINT Status of the function block. InstructFault (Status.0) BOOL The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. PresetInv (Status.1) BOOL The preset value is invalid. Description 116 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions When true, the TOFR instruction accumulates time until the: • TOFR instruction is disabled ◦ ACC is greater than or equal to PRE The time base is always 1 msec. For example, for a 2-second timer, enter 2000 for the PRE value. Set the Reset input parameter to reset the instruction. If TimerEnable is false when Reset is true, the TOFR instruction does not begin timing again when Reset is false. How a Timer Runs A timer runs by subtracting the time of its last scan from the current time: ACC = ACC + (current_time - last_time_scanned) After it updates the ACC, the timer sets last_time_scanned= current_time. This gets the timer ready for the next scan. IMPORTANT: Be sure to scan the timer at least every 69 minutes while it runs. Otherwise, the ACC value won’t be correct. The last_time_scanned value has a range of up to 69 minutes. The timer’s calculation rolls over if you don’t scan the timer within 69 minutes. The ACC value won’t be correct if this happens. While a timer runs, scan it within 69 minutes if you put it in a: • Subroutine • Section of code that is between JMP and LBL instructions • Sequential function chart (SFC) • Event or periodic task • State routine of a phase Affects Math Status Flags No Major/Minor Faults Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 117 Chapter 3 Timer and Counter Instructions None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag. EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag. EnableIn is true EnableIn and EnableOut bits are set to true. The main algorithm of the instruction will be executed and outputs will be updated. Instruction first run N/A Instruction first scan EN, TT and DN are cleared ACC value is not modified. Postscan EnableIn and EnableOut bits are cleared to false. Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Example Each scan after limit_switch1 is cleared, the TOFR instruction increments the ACC value by elapsed time until the ACC value reaches the PRE value. When ACC PRE, the DN parameter is cleared, and timer_state2 is set. Function Block Structured Text TOFR_01.PRE := 500; TOFR_01.Reset := Reset; TOFR_01.TimerEnable := Input; 118 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions TOFR(TOFR_01); timer_state := TOFR_01.DN; Timer On Delay (TON) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The TON instruction is a non-retentive timer that accumulates time when the instruction is enabled. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description Timer TIMER tag Timer structure Preset DINT immediate Value of Timer.PRE. Accum DINT immediate Value of Timer.ACC. Preset and Accum (corresponding to .PRE and .ACC in the timer tag) are pseudo-operands. For details, see Pseudooperand initialization on page 856. TIMER Structure Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 119 Chapter 3 Timer and Counter Instructions Mnemonic Data Type Description .EN BOOL The enable bit contains rung-condition-in when the instruction was last executed. .TT BOOL The timing bit when set indicates the timing operation is in process. .DN BOOL The done bit when set indicates the timing operation is complete (or paused). .PRE DINT The preset value specifies the value (1 millisecond units) which the accumulated value must reach before the instruction indicates it is done. .ACC DINT The accumulated value specifies the number of milliseconds that have elapsed since the TON instruction was enabled. Description The TON instruction accumulates time from the time it is enabled until: • The timer is disabled • The timer completes The time base is always 1 millisecond. For example, for a 2 second timer, enter 2000 for the .PRE value. The timer will set the .DN bit to true when the timer completes. When enabled, timing can be paused by setting the .DN bit to true and resumed by clearing the .DN bit to false. How a Timer Runs A timer runs by subtracting the time of its last scan from the current time: ACC = ACC + (current_time - last_time_scanned) After it updates the ACC, the timer sets last_time_scanned = current_time. This gets the timer ready for the next scan. Affects Math Status Flags 120 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions No Major/Minor Faults A major fault will occur if: Fault type Fault code .PRE < 0 4 34 .ACC < 0 4 34 See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EN bit is cleared to false. The .TT bit is cleared to false. The .DN bit is cleared to false. The .ACC value is cleared to zero. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in The .EN bit is cleared to false. The .TT bit is cleared to false. The .DN bit is cleared to false. The .ACC value is cleared to zero. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in See TON Flow Chart (True) Postscan The .EN bit is cleared to false. The .TT bit is cleared to false. The .DN bit is cleared to false. The .ACC value is cleared to zero. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 121 Chapter 3 Timer and Counter Instructions TON Flow Chart (True) Example Ladder Diagram 122 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions When limit_switch_10 is set to true, light_6 is on for 20000 milliseconds (Timer_4 is timing). When Timer_4.acc reaches 20000, light_6 goes off and light_7 goes on. If limit_switch_10 is cleared to false while Timer_4 is timing, light_6 goes off. When limit_switch_10 is cleared to false, Timer_4 status bits and .ACC value are reset. Timer On Delay with Reset (TONR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The TONR instruction is a non-retentive timer that accumulates time when TimerEnable is set. Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Structured Text TONR(TONR_tag); Operands Structured Text Operand Type Format Description TONR tag FBD_TIMER Structure TONR structure See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Function Block Operand Type Format Description TONR tag FBD_TIMER Structure TONR structure FBD_TIMER Structure Input Parameter Rockwell Automation, Inc. Data Type Publication 1756-RM003Z-EN-P - September 2024 Description 123 Chapter 3 Timer and Counter Instructions EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is set. TimerEnable BOOL If set, this enables the timer to run and accumulate time. Default is cleared. PRE DINT Timer preset value. This is the value in 1 msec units that ACC must reach before timing is finished. If invalid, the instruction sets the appropriate bit in Status and the timer does not execute. Valid = 0 to maximum positive integer Reset BOOL Request to reset the timer. When set, the timer resets. Default is cleared. When the Reset input parameter is set, the instruction clears EN, TT and DN and sets ACC = 0. Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result. ACC BOOL Accumulated time in milliseconds. ENF BOOL Timer enabled output. Indicates the timer instruction is enabled. TT BOOL Timer timing output. When set, a timing operation is in progress. DN BOOL Timing done output. Indicates when accumulated time is greater than or equal to preset. Status DINT Status of the function block. InstructFault (Status.0) BOOL The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. PresetInv (Status.1) BOOL The preset value is invalid. Description 124 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 3 Timer and Counter Instructions When true, the TONR instruction accumulates time until the: • TONR instruction is disabled • ACC PRE The time base is always 1 msec. For example, for a 2-second timer, enter 2000 for the PRE value. Set the Reset input parameter to reset the instruction. If TimerEnable is set when Reset is true, the TONR instruction begins timing again when Reset is false. How a Timer Runs A timer runs by subtracting the time of its last scan from the current time: • ACC = ACC + (current_time - last_time_scanned) After it updates the ACC, the timer sets last_time_scanned= current_time. This gets the timer ready for the next scan. IMPORTANT: Be sure to scan the timer at least every 69 minutes while it runs. Otherwise, the ACC value will not be correct. The last_time_scanned value has a range of up to 69 minutes. The timer’s calculation rolls over if you don’t scan the timer within 69 minutes. The ACC value won’t be correct if this happens. While a timer runs, scan it within 69 minutes if you put it in a: • Subroutine • Section of code that is between JMP and LBL instructions • Sequential function chart (SFC) • Event or periodic task • State routine of a phase Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 125 Chapter 3 Timer and Counter Instructions Execution Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The main algorithm of the instruction is executed and outputs are updated. Instruction first run N/A Instruction first scan EN, TT and DN are cleared ACC value is set to 0. Postscan EnableIn and EnableOut bits are cleared to false. Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Example Function Block Structured Text TONR_01.PRE := 500; TONR_01.Reset := Reset; TONR_01.TimerEnable := Input; TONR(TONR_01); timer_state := TONR_01.DN; 126 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions The input/output instructions read or write data to or from the controller or a block of data to or from another module on another network. Available Instructions Ladder Diagram and Structured Text MSG on page 127 GSV on page 162 SSV on page 162 IOT on page 189 Function Block Not available If you want to: Use this instruction: Send data to or from another module MSG Get controller status information GSV Set controller status information SSV Send output values to an I/O module or consuming controller at IOT a specific point in your logic Trigger an event task in another controller Message (MSG) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The MSG instruction asynchronously reads or writes a block of data to another module on a network. This is a transitional instruction. Follow these steps when using it: • In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute. • In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 127 Chapter 4 Input/Output Instructions Structured Text MSG(MessageControl); Operands Ladder Diagram Operand Type Format Description Message MSG tag Message structure Operand Type Format Description Message MSG tag Message structure Structured Text See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. MESSAGE Structure IMPORTANT: If you check the status bits more than once: Use a copy of the bits if you check them in more than one place in your logic. Otherwise, the bits may change during the scan and your logic won’t work as you expect it. One way to make a copy is to use the FLAGS word. Copy the FLAGS word to another tag and check the bits in the copy. IMPORTANT: Do not change the following bits of a MSG instruction: • DN • EN • ER • EW • ST Do not change these bits either by themselves or as part of the FLAGS word. If you do, the controller may have a nonrecoverable fault. The controller clears the project from its memory when it has a non-recoverable fault. Mnemonic Data Type Description .FLAGS INT The .FLAGS member provides access to the status members (bits) in one, 16-bit word. 128 Publication 1756-RM003Z-EN-P - September 2024 This bit Is this member 2 .EW 4 .ER 5 .DN Rockwell Automation, Inc. Chapter 4 Mnemonic Data Type Input/Output Instructions Description 6 .ST 7 .EN 8 .TO 9 .EN_CC Important: Do not change the EW, ER, DN, or ST bits of the FLAGS member. For example, do not clear the entire FLAGS word. The controller ignores the change and uses the internally-stored values of the bits. .ERR INT If the .ER bit is set, the error code word identifies error codes for the MSG instruction. .EXERR INT The extended error code word specifies additional error code information for some error codes. .REQ_LEN INT The requested length specifies how many words the message instruction will attempt to transfer. .DN_LEN INT The done length identifies how many words actually transferred. .EW BOOL The enable waiting bit is set when the controller detects that a message request has entered the queue. The controller resets the.EW bit when the.ST bit is set. Important: Do not change the EW bit. The controller ignores the change and uses the internally-stored value of the bit. .ER BOOL The error bit is set when the controller detects that a transfer failed. The .ER bit is reset the next time the EnableIn goes from false to true. Important: Do not change the ER bit. The controller ignores the change and uses the internally-stored value of the bit. .DN BOOL The done bit is set when the last packet of the message is successfully transferred. The .DN bit is reset the next time the EnableIn goes from false to true. Important: Do not change the DN bit. The controller ignores the change and uses the internally-stored value of the bit. .ST BOOL The start bit is set when the controller begins executing the MSG instruction. The .ST bit is reset when the .DN bit or the .ER bit is set. Important: Do not change the ST bit. The controller ignores the change and uses the internally-stored value of the bit. .EN BOOL The enable bit is set when the EnableIn goes true and remains set until either the .DN bit or the .ER bit is set and the EnableIn is false. If the EnableIn goes false, but the .DN bit and the .ER bit are cleared, the .EN bit remains set. Important: Do not change the EN bit. The controller ignores the change and uses the internally-stored value of the bit. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 129 Chapter 4 Input/Output Instructions Mnemonic Data Type Description .TO BOOL If you manually set the .TO bit, the controller stops processing the message and sets the .ER bit. .EN_CC BOOL The enable cache bit determines how to manage the MSG connection. If you want the controller to maintain the connection (such as when you repeat the same MSG instruction many times), set the .EN_CC bit. If you rarely execute the MSG instruction and have other needs for a controller connection, clear the .EN_CC bit. Connections for MSG instructions going out the serial port are not cached, even if the .EN_CC bit is set. .ERR_SRC SINT Shows the error path in the Message Configuration dialog. .DestinationLink INT To change the Destination Link of a DH+ or CIP with Source ID message, set this member to the required value. .DestinationNode INT To change the Destination Node of a DH+ or CIP with Source ID message, set this member to the required value. .SourceLink INT To change the Source Link of a DH+ or CIP with Source ID message, set this member to the required value. .Class INT To change the Class parameter of a CIP Generic message, set this member to the required value. .Attribute INT To change the Attribute parameter of a CIP Generic message, set this member to the required value. .Instance DINT To change the Instance parameter of a CIP Generic message, set this member to the required value. .LocalIndex DINT If you use an asterisk [*] to designate the element number of the local array, the LocalIndex provides the element number. To change the element number, set this member to the required value. .Channel SINT If the message: Then the local array is the: Reads data Destination element Writes data Source element To send the message out a different channel of the 1756-DHRIO module, set this member to the required value. Use either the ASCII character A or B. .Rack SINT To change the rack number for a block transfer message, set this member to the required rack number (octal). .Group SINT To change the group number for a block transfer message, set this member to the required group number (octal). .Slot SINT To change the slot number for a block transfer message, set this member to the required slot number. 130 Publication 1756-RM003Z-EN-P - September 2024 If the message goes over Then specify the slot number this network: in: Rockwell Automation, Inc. Chapter 4 Mnemonic .Path Data Type STRING Input/Output Instructions Description Universal remote I/O octal ControlNet decimal (0-15) To send the message to a different controller, set this member to the new path. Enter the path as hexadecimal values. Omit commas [,] For example, for a path of 1, 0, 2, 42, 1, 3, enter $01$00$02$2A$01$03. To browse to a device and automatically create a portion or all of the new string, right-click a string tag and choose Go to Message Path Editor. .RemoteIndex DINT If you use an asterisk [*] to designate the element number of the remote array, the RemoteIndex provides the element number. To change the element number, set this member to the required value. .RemoteElement STRING If the message Then the remote array is the Reads data Source element Writes data Destination element To specify a different tag or address in the controller to which the message is sent, set this member to the required value. Enter the tag or address as ASCII characters. .UnconnectedTimeout DINT If the message Then the remote array is the Reads data Source element Writes data Destination element The time out for an unconnected message or for making a connection. The default value is 30 seconds. If the message is unconnected, the ER bit turns on if the controller doesn’t get a response within the UnconnectedTimeout time. If the message is connected, the ER bit turns on if the controller doesn’t get a response for making the connection within the UnconnectedTimeout time. .ConnectionRate DINT Time out for a connected message once it has a connection. .TimeoutMultiplier SINT This time out is for the response from the other device. This time out applies only after the connection is made. The time out = ConnectionRate x TimeoutMultiplier The default ConnectionRate is 7.5 seconds. The default TimeoutMultiplier is 0 (which equates to a multiplication factor of 4). The default time out for connected messages is 30 seconds (7.5 seconds x 4 = 30 seconds). Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 131 Chapter 4 Input/Output Instructions Mnemonic Data Type Description To change the time out, change the ConnectionRate and leave the TimeoutMultiplier at the default value. Description The MSG instruction transfers elements of data. This is a transitional instruction: • In ladder diagram, toggle the EnableIn from cleared to set each time the instruction executes. • The size of each element depends on the data types you specify and the type of message command you use. Where Description 1 EnableIn is true .EN is set .EW is set connection is opened 2 message is sent .ST is set .EW is cleared 3 message is done or errored EnableIn is false .DN or .ER is set .ST is cleared connection is closed (if .EN_CC = 0) .EN is cleared (because the EnableIn is false) 4 EnableIn is true and .DN or .ER was previously set .EN is set .EW is set connection is opened 132 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Where Input/Output Instructions Description .DN or .ER is cleared 5 message is sent .ST is set .EW is cleared 6 message is done or errored and EnableIn is still true .DN or .ER is set .ST is cleared connection is closed (if .EN_CC = 0) 7 EnableIn goes false and .DN or .ER is set .EN is cleared Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EWS, .ST, .DN, and .ER bits are cleared. Rung-condition-in is false See MSG Flow Chart (False) Rung-condition-in is true See MSG Flow Chart (True) Postscan N/A Structured Text Rockwell Automation, Inc. Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table Normal execution See MSG Flow Chart (True) Postscan See Postscan in the Ladder Diagram table Publication 1756-RM003Z-EN-P - September 2024 133 Chapter 4 Input/Output Instructions MSG Flow Chart (False) 134 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions MSG Flow Chart (True) Example Ladder Diagram Structured Text MSG (MessageControl); Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 135 Chapter 4 Input/Output Instructions Message (MSG) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The MSG instruction asynchronously reads or writes a block of data to another module on a network. This is a transitional instruction. Follow these steps when using it: • In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute. • In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text MSG(MessageControl); Operands Ladder Diagram Operand Type Format Description Message MSG tag Message structure Operand Type Format Description Message MSG tag Message structure Structured Text See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. MESSAGE Structure 136 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions IMPORTANT: If you check the status bits more than once: Use a copy of the bits if you check them in more than one place in your logic. Otherwise, the bits may change during the scan and your logic won’t work as you expect it. One way to make a copy is to use the FLAGS word. Copy the FLAGS word to another tag and check the bits in the copy. IMPORTANT: Do not change the following bits of a MSG instruction: • DN • EN • ER • EW • ST Do not change these bits either by themselves or as part of the FLAGS word. If you do, the controller may have a nonrecoverable fault. The controller clears the project from its memory when it has a non-recoverable fault. Mnemonic Data Type Description .FLAGS INT The .FLAGS member provides access to the status members (bits) in one, 16-bit word. This bit Is this member 2 .EW 4 .ER 5 .DN 6 .ST 7 .EN 8 .TO 9 .EN_CC Important: Do not change the EW, ER, DN, or ST bits of the FLAGS member. For example, do not clear the entire FLAGS word. The controller ignores the change and uses the internally-stored values of the bits. .ERR INT If the .ER bit is set, the error code word identifies error codes for the MSG instruction. .EXERR INT The extended error code word specifies additional error code information for some error codes. .REQ_LEN INT The requested length specifies how many words the message instruction will attempt to transfer. .DN_LEN Rockwell Automation, Inc. INT Publication 1756-RM003Z-EN-P - September 2024 The done length identifies how many words actually transferred. 137 Chapter 4 Input/Output Instructions Mnemonic Data Type Description .EW BOOL The enable waiting bit is set when the controller detects that a message request has entered the queue. The controller resets the.EW bit when the.ST bit is set. Important: Do not change the EW bit. The controller ignores the change and uses the internally-stored value of the bit. .ER BOOL The error bit is set when the controller detects that a transfer failed. The .ER bit is reset the next time the EnableIn goes from false to true. Important: Do not change the ER bit. The controller ignores the change and uses the internally-stored value of the bit. .DN BOOL The done bit is set when the last packet of the message is successfully transferred. The .DN bit is reset the next time the EnableIn goes from false to true. Important: Do not change the DN bit. The controller ignores the change and uses the internally-stored value of the bit. .ST BOOL The start bit is set when the controller begins executing the MSG instruction. The .ST bit is reset when the .DN bit or the .ER bit is set. Important: Do not change the ST bit. The controller ignores the change and uses the internally-stored value of the bit. .EN BOOL The enable bit is set when the EnableIn goes true and remains set until either the .DN bit or the .ER bit is set and the EnableIn is false. If the EnableIn goes false, but the .DN bit and the .ER bit are cleared, the .EN bit remains set. Important: Do not change the EN bit. The controller ignores the change and uses the internally-stored value of the bit. .TO BOOL If you manually set the .TO bit, the controller stops processing the message and sets the .ER bit. .EN_CC BOOL The enable cache bit determines how to manage the MSG connection. If you want the controller to maintain the connection (such as when you repeat the same MSG instruction many times), set the .EN_CC bit. If you rarely execute the MSG instruction and have other needs for a controller connection, clear the .EN_CC bit. Connections for MSG instructions going out the serial port are not cached, even if the .EN_CC bit is set. .ERR_SRC SINT Shows the error path in the Message Configuration dialog. .DestinationLink INT To change the Destination Link of a DH+ or CIP with Source ID message, set this member to the required value. .DestinationNode INT To change the Destination Node of a DH+ or CIP with Source ID message, set this member to the required value. 138 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Mnemonic Data Type Description .SourceLink INT To change the Source Link of a DH+ or CIP with Source ID message, set this member to the required value. .Class INT To change the Class parameter of a CIP Generic message, set this member to the required value. .Attribute INT To change the Attribute parameter of a CIP Generic message, set this member to the required value. .Instance DINT To change the Instance parameter of a CIP Generic message, set this member to the required value. .LocalIndex DINT If you use an asterisk [*] to designate the element number of the local array, the LocalIndex provides the element number. To change the element number, set this member to the required value. .Channel SINT If the message: Then the local array is the: Reads data Destination element Writes data Source element To send the message out a different channel of the 1756-DHRIO module, set this member to the required value. Use either the ASCII character A or B. .Rack SINT To change the rack number for a block transfer message, set this member to the required rack number (octal). .Group SINT To change the group number for a block transfer message, set this member to the required group number (octal). .Slot SINT To change the slot number for a block transfer message, set this member to the required slot number. .Path STRING If the message goes over Then specify the slot number this network: in: Universal remote I/O octal ControlNet decimal (0-15) To send the message to a different controller, set this member to the new path. Enter the path as hexadecimal values. Omit commas [,] For example, for a path of 1, 0, 2, 42, 1, 3, enter $01$00$02$2A$01$03. To browse to a device and automatically create a portion or all of the new string, right-click a string tag and choose Go to Message Path Editor. .RemoteIndex DINT If you use an asterisk [*] to designate the element number of the remote array, the RemoteIndex provides the element number. To change the element number, set this member to the required value. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 139 Chapter 4 Input/Output Instructions Mnemonic .RemoteElement Data Type STRING Description If the message Then the remote array is the Reads data Source element Writes data Destination element To specify a different tag or address in the controller to which the message is sent, set this member to the required value. Enter the tag or address as ASCII characters. .UnconnectedTimeout DINT If the message Then the remote array is the Reads data Source element Writes data Destination element The time out for an unconnected message or for making a connection. The default value is 30 seconds. If the message is unconnected, the ER bit turns on if the controller doesn’t get a response within the UnconnectedTimeout time. If the message is connected, the ER bit turns on if the controller doesn’t get a response for making the connection within the UnconnectedTimeout time. .ConnectionRate DINT Time out for a connected message once it has a connection. .TimeoutMultiplier SINT This time out is for the response from the other device. This time out applies only after the connection is made. The time out = ConnectionRate x TimeoutMultiplier The default ConnectionRate is 7.5 seconds. The default TimeoutMultiplier is 0 (which equates to a multiplication factor of 4). The default time out for connected messages is 30 seconds (7.5 seconds x 4 = 30 seconds). To change the time out, change the ConnectionRate and leave the TimeoutMultiplier at the default value. Description The MSG instruction transfers elements of data. This is a transitional instruction: 140 • In ladder diagram, toggle the EnableIn from cleared to set each time the instruction executes. • The size of each element depends on the data types you specify and the type of message command you use. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Where Description 1 EnableIn is true Input/Output Instructions .EN is set .EW is set connection is opened 2 message is sent .ST is set .EW is cleared 3 message is done or errored EnableIn is false .DN or .ER is set .ST is cleared connection is closed (if .EN_CC = 0) .EN is cleared (because the EnableIn is false) 4 EnableIn is true and .DN or .ER was previously set .EN is set .EW is set connection is opened .DN or .ER is cleared 5 message is sent .ST is set .EW is cleared 6 message is done or errored and EnableIn is still true .DN or .ER is set .ST is cleared connection is closed (if .EN_CC = 0) 7 Rockwell Automation, Inc. EnableIn goes false and .DN or .ER is set Publication 1756-RM003Z-EN-P - September 2024 141 Chapter 4 Input/Output Instructions Where Description .EN is cleared Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EWS, .ST, .DN, and .ER bits are cleared. Rung-condition-in is false See MSG Flow Chart (False) Rung-condition-in is true See MSG Flow Chart (True) Postscan N/A Structured Text 142 Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table Normal execution See MSG Flow Chart (True) Postscan See Postscan in the Ladder Diagram table Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions MSG Flow Chart (False) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 143 Chapter 4 Input/Output Instructions MSG Flow Chart (True) Example Ladder Diagram Structured Text MSG (MessageControl); 144 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions MSG Configuration Examples The following examples show source and destination tags and elements for different controller combinations. The table explains the path for MSG instructions originating from a Logix 5000 controller and being written to another controller. Message Path Example Source and Destination Logix 5000 -> Logix 5000 Source tag array_1[0] Destination tag array_2[0] You can use an alias tag for the source tag in the originating Logix 5000 controller. You cannot use an alias for the destination tag. The destination must be a base tag. Logix 5000 -> PLC-5 Source tag array_1[0] Logix 5000 -> SLC Destination element N7:10 You can use an alias tag for the source tag, in the originating Logix 5000 controller. Logix 5000 -> PLC-2 Source tag array_1[0] Destination element 010 The table explains the path for MSG instructions originating from a Logix 5000 controller and reading from another controller. Message Path Example Source and Destination Logix 5000 -> Logix 5000 Source tag array_1[0] Destination tag array_2[0] You cannot use an alias tag for the source tag. The source must be a base tag. You can use an alias tag for the destination tag, in the originating Logix 5000 controller. Logix 5000 -> PLC-5 Source element N7:10 Logix 5000 -> SLC Destination tag array_1[0] You can use an alias tag for the destination tag, in the originating Logix 5000 controller. Logix 5000 -> PLC-2 Source element 010 Destination tag array_1[0] Major fault types and codes Refer to the Logix 5000 Controller Fault Codes spreadsheet for a complete list of fault codes. You might be asked to log in to your Rockwell Automation web account or create an account if you do not have one. You do not need a support contract to access the article. Minor fault types and codes The following are the minor fault types and codes. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 145 Chapter 4 Input/Output Instructions Refer to the Logix 5000 Controller Fault Codes spreadsheet for a complete list of fault codes. You might be asked to log in to your Rockwell Automation web account or create an account if you do not have one. You do not need a support contract to access the article. Message Error Codes Error codes depend on the type of MSG instruction. Error Codes The Logix Designer application does not always display the full description. Error Code (Hex) Description Display In Software 0001 Connection failure (extended error codes) Same as description 0002 Insufficient resource 0003 Invalid value 0004 IOI syntax error (see extended error codes) 0005 Destination unknown, class unsupported, instance undefined or structure element undefined (see extended error codes) 0006 Insufficient packet space 0007 Connection lost 0008 Service unsupported 0009 Error in data segment or invalid attribute value 146 000A Attribute list error 000B State already exists 000C Object model conflict 000D Object already exists 000E Attribute cannot be set 000F Permission denied 0010 Device state conflict 0011 Reply will not fit 0012 Fragment primitive 0013 Insufficient command data 0014 Attribute not supported 0015 Too much data 001A Bridge request too large 001B Bridge response too large Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Error Code (Hex) Description 001C Attribute list shortage 001D Invalid attribute list 001E Embedded service error 001F Connection related failure (see extended Input/Output Instructions Display In Software Same as description error codes) 0022 Invalid reply received 0025 Key segment error 0026 Invalid IOI error 0027 Unexpected attribute in list 0028 DeviceNet error - invalid member ID 0029 DeviceNet error - member not settable 00D1 Module not in run state 00FB Message port not supported 00FC Message unsupported data type 00FD Message uninitialized 00FE Message timeout 00FF General error (see extended error codes) Unknown error Extended Error Codes The Logix Designer application does not display any text for the extended error codes. The table lists extended error codes for error code 0001. Rockwell Automation, Inc. Extended Error Code (Hex) Description 0100 Connection in use 0103 Transport not supported 0106 Ownership conflict 0107 Connection not found 0108 Invalid connection type 0109 Invalid connection size 0110 Module not configured 0111 EPR not supported 0113 MSG write failed 0114 Wrong module 0115 Wrong device type 0116 Wrong revision 0118 Invalid configuration format 011A Application out of connections Publication 1756-RM003Z-EN-P - September 2024 147 Chapter 4 Input/Output Instructions Extended Error Code (Hex) Description 0203 Connection timeout 0204 Unconnected message timeout 0205 Unconnected send parameter error 0206 Message too large 0301 No buffer memory 0302 Bandwidth not available 0303 No screens available 0305 Signature mismatch 0311 Port not available 0312 Link address not available 0315 Invalid segment type 0317 Connection not scheduled The table lists the extended error codes for error code 001F. Extended Error Code (Hex) Description 0203 Connection timeout The table lists the extended error codes for error code 0004 and 0005. Extended Error Code (Hex) Description 0000 extended status out of memory 0001 extended status out of instances The table lists the extended error codes for error code 00FF. 148 Extended Error Code (Hex) Description 2001 Excessive IOI 2002 Bad parameter value 2018 Semaphore reject 201B Size too small 201C Invalid size 2100 Privilege failure 2101 Invalid keyswitch position 2102 Password invalid 2103 No password issued 2104 Address out of range 2105 Address and how many out of range 2106 Data in use 2107 Type is invalid or not supported Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Extended Error Code (Hex) Description 2108 Controller in upload or download mode 2109 Attempt to change number of array dimensions 210A Invalid symbol name 210B Symbol does not exist 210E Search failed 210F Task cannot start 2110 Unable to write 2111 Unable to read 2112 Shared routine not editable 2113 Controller in faulted mode 2114 Run mode inhibited PLC and SLC Error Codes (.ERR) Logix firmware revision 10.x and later provides new error codes for errors that are associated with PLC and SLC™ message types (PCCC messages). This change lets RSLogix 5000 software display a more meaningful description for many of the errors. Previously the software did not give a description for any of the errors associated with the 00F0 error code. The change also makes the error codes more consistent with errors returned by other controllers, such as PLC-5® controllers. The table shows the change in the error codes from R9.x and earlier to R10.x and later. As a result of the change, the .ERR member returns a unique value for each PCCC error. The .EXERR is no longer required for these errors. PLC and SLC Error Codes (hex) R9.x And Earlier .ERR 0010 R10.x And Later .EXERR .ERR 1000 Description .EXERR Illegal command or format from local processor 0020 2000 Communication module not working 0030 3000 Remote node is missing, disconnected, or shut down 0040 4000 Processor connected but faulted (hardware) 0050 Rockwell Automation, Inc. 5000 Publication 1756-RM003Z-EN-P - September 2024 Wrong station number 149 Chapter 4 Input/Output Instructions R9.x And Earlier R10.x And Later Description 0060 6000 Requested function is not available 0070 7000 Processor is in Program mode 0080 8000 Compatibility file of processor does not exist 0090 9000 Remote node cannot buffer command 00B0 B000 Processor is downloading so it is not accessible 00F0 0001 F001 Processor incorrectly converted the address 00F0 0002 F002 Incomplete address 00F0 0003 F003 Incorrect address 00F0 0004 F004 Illegal address format symbol not found 00F0 0005 F005 Illegal address format symbol has 0 or greater than the maximum number of characters supported by the device 00F0 0006 F006 Address file does not exist in target processor 00F0 0007 F007 Destination file is too small for the number of words requested 00F0 0008 F008 Cannot complete request Situation changed during multipacket operation 00F0 0009 F009 Data or file is too large Memory unavailable 00F0 000A F00A Target processor cannot put requested information in packets 00F0 000B F00B Privilege error; access denied 00F0 000C F00C Requested function is not available 150 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 R9.x And Earlier Input/Output Instructions R10.x And Later Description 00F0 000D F00D Request is redundant 00F0 000E F00E Command cannot be executed 00F0 000F F00F Overflow; histogram overflow 00F0 0010 F010 No access 00F0 0011 F011 Data type requested does not match data ava ilable 00F0 0012 F012 Incorrect command parameters 00F0 0013 F013 Address reference exists to deleted area 00F0 0014 F014 Command execution failure for unknown reason PLC-3® histogram overflow 00F0 0015 F015 Data conversion error 00F0 0016 F016 The scanner is not available to communicate with a 1771 rack adapter 00F0 0017 F017 The adapter is no available to communicate with the module 00F0 0018 F018 The 1771 module response was not valid 00F0 0019 F019 Duplicate label 00F0 001A F01A File owner active - the file is being used 00F0 001B F01B Program owner active someone is downloading or editing online 00F0 001C F01C Disk file is write protected or otherwise not accessible (offline only) 00F0 001D F01D Disk file is being used by another application Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 151 Chapter 4 Input/Output Instructions R9.x And Earlier R10.x And Later Description Update not performed (offline only) Block Transfer Error Codes These are the Logix5000 block-transfer specific error codes. Error Code (Hex) Description Display In Software 00D0 The scanner did not receive a Unknown error block-transfer response from the block-transfer module within 3.5 seconds of the request. 00D1 The checksum from the read response did not match the checksum of the data stream. 00D2 The scanner requested either a read or write but the block-transfer module responded with the opposite. 00D3 The scanner requested a length and the block-transfer module responded with a different length. 00D6 The scanner received a response from the block-transfer module indicating the write request failed. 00EA The scanner was not configured to communicate with the rack that would contain this block-transfer module. 00EB The logical slot specified is not available for the given rack size. 00EC There is currently a block-transfer request in progress and a response is required before another request can begin. 00ED The size of the block-transfer request is not consistent with valid block-transfer size requests. 00EE The type of block-transfer request is not consistent with the expected BT_READ or BT_WRITE. 00EF The scanner was unable to find an available slot in the block-transfer table 152 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Error Code (Hex) Description Input/Output Instructions Display In Software to accommodate the block-transfer request. 00F0 The scanner received a request to reset the remote I/O channels while there were outstanding block-transfers. 00F3 Queues for remote block-transfers are full. 00F5 No communication channels are configured for the requested rack or slot. 00F6 No communication channels are configured for remote I/O. 00F7 The block-transfer timeout, set in the instruction, timed out before completion. 00F8 Error in block-transfer protocol unsolicited block-transfer. 00F9 Block-transfer data was lost due to a bad communication channel. 00FA The block-transfer module requested a different length than the associated block-transfer instruction. 00FB The checksum of the block-transfer read data was wrong. 00FC There was an invalid transfer of block-transfer write data between the adapter and the block-transfer module. 00FD The size of the block-transfer plus the size of the index in the block-transfer data table was greater than the size of the block-transfer data table file. Specify the Communication Details Set up a broadcast in ladder logic or structured text programs. In ladder logic, add a rung and click on the MSG property to access the Message Configuration dialog box and set up a new message. In structured text, type MSG (aMsg ) and then right-click the aMsg to open the Message Configuration dialog box and configure the message. NOTE: Logix Designer versions 37 and later do not support controllers with serial ports. The Broadcast button appears only in Logix Designer versions 36 and earlier for controllers with a serial port. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 153 Chapter 4 Input/Output Instructions To configure a MSG instruction, specify the following on the Communication tab: Specify a Path The path shows the route that the message takes to get to the destination. It uses names from the I/O configuration of the controller, numbers that you type, or both. You can default the path by using the broadcast button, which must be enabled with the system protocol and message type. If Then The I/O configuration of the controller has the module that gets Browse to select the module. the message. The I/O configuration of the controller has only the local Browse to select the local communication module and type the communication module. rest of the path. The I/O configuration of the controller does not have any of the Type the path. modules required for the message. Tip: Also supported is THIS, which indicates a path to self. THIS is used to send an unconnected message to the controller. Examples The I/O configuration of the controller has only the local communication module: To type a path, use the format: port, next_address, port, next_address, 154 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Is Where Port For this network Type Backplane 1 DF1 (serial, serial channel 0) 2 ControlNet EtherNet/IP DH+ channel A DH+ channel B 3 DF1 channel 1 (serial channel 1) Next_address Backplane Slot number of the module DF1 (serial) Station address (0-254) ControlNet Node number (1-99 decimal) DH+ 8# followed by the node number (1-77 octal) For example, to specify the octal node address of 37, type 8#37. EtherNet/IP Specify a module on an EtherNet/IP network by using any of these formats: • IP address. For example, 10.10.10.10 • IP address:Port. For example, 10.10.10.10:24 • DNS name. For example, tanks • DNS name:Port. For example, tanks:24 Broadcast Button The Broadcast button is used with the serial port. • This functionality for RSLogix 5000 software, beginning with version 18, enhances the ability to define the route and message type that are required to send a message to its destination. The Broadcast button, when enabled, allows you to default the path by selecting an available channel(s) in a combo box. The number of channels listed in the combo box depends on the current controller. By default, the Path button on the Communication tab is active. Perform these steps to enable the Broadcast button and select a channel to default a path for the message. 1. On the Controller Organizer, right-click Controller, and select Properties. The Controller Properties dialog box appears. 2. Click the System Protocol tab. 3. Select DF1 Master in the Protocol box. The Polling mode defaults ‘Message Based’ (slave can initiate messages). 4. Rockwell Automation, Inc. Click OK. Publication 1756-RM003Z-EN-P - September 2024 155 Chapter 4 Input/Output Instructions 5. In ladder logic, click the box inside the MSG tag. The Message Configuration dialog box appears with the Configuration tab open. 6. In the Message Type box, select CIP Data Table Write. 7. Click OK.You have enabled the Broadcast button on the Communication tab. 8. Click the Communication tab. 9. Next to the Broadcast button, select a channel in the combo box. The number of channels in the combo box depends on the controller. When you select channel 0 or 1, the corresponding message path on the Message Configuration dialog box defaults to 2,255 (channel 0) or 3,255 (channel 1). The Path grays out to not allow you to manually enter a path value. 10. Click OK. System Protocol Tab Configuration NOTE: Logix Designer versions 37 and later do not support controllers with serial ports. The System Protocol tab appears only in Logix Designer versions 36 and earlier for controllers with a serial port. To run broadcast in ControlLogix controllers in the Logix Designer application, you must configure the System Protocol tab in the Controller Properties dialog box. The protocol must be compatible with the message type of ‘write’ on the Message Configuration dialog box. Follow these steps to set up the system protocol to be compatible with the broadcast feature. 1. Create or open an existing controller in the application. 2. On the Controller Organizer, right-click the controller name, and select Properties.The Controller Properties dialog box appears. 156 3. If you controller has a serial port, click System Protocol tab. 4. In the Protocol box, select a protocol. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions IMPORTANT: The Message Type box on the Message Configuration Tab dialog box must be write-typed to be compatible with the system protocol. Otherwise, the Broadcast button is disabled. 5. Enter the information on the System Protocol tab for each protocol outlined in the following tables. Topic Description Protocol DF-1 Master Station Address Type controller station address number Transmit Retries 3 ACK Timeout 50 Reply Message Wait 5 Polling Mode Select from the following modes: ◦ Message Based Poll the slave using message instruction ◦ Slave can initiate message for slave to slave broadcast ◦ 6. Standard. to have the schedule poll for the slave Error Detection BCC Duplicate Detection Enabled (checked) Topic Description Protocol DF-1 Slave Station Address Type controller station address number Transmit Retries 3 Slave Poll Timeout 3000 EOT Suppression Disable (unchecked) Error Detection BCC Duplicate Detection Enabled (checked) Topic Description Protocol DF-1 Slave Station Address Type controller station address number Enable Store and Forward Enable box (checkmark) to use store and forward tag Error Detection BCC Click OK. For Block Transfers For block transfer messages, add the following modules to the I/O configuration of the controller: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 157 Chapter 4 Input/Output Instructions For block-transfers over this network: Add these modules to the I/O configuration: ControlNet Local communication module (for example, 1756-CNB module) Remote adapter module (for example, 1771-ACN module) Universal remote I/O Local communication module (for example, 1756-DHRIO module) One remote adapter module (for example, 1771-ASB module) for each rack, or portion of a rack, in the chassis Block-transfer module (optional) Specify a Communication Method or Module Address Use the following table to select a communication method or module address for the message: If the destination device is Select And specify Logix 5000 controller CIP No other specifications required. DH+ Channel PLC-5 controller over an EtherNet/IP network PLC-5 controller over a ControlNet network SLC 5/05 controller PLC-5 controller over a DH+ network Channel A or B of the 1756-DHRIO module that is connected to the DH+ network. SLC controller over a DH+ Source Link network Link ID assigned to the backplane of the controller in the routing table of the 1756-DHRIO module. The source node in the routing table is automatically the slot number of the controller. PLC-3 processor Destination Link Link ID of the remote DH+ link where the target device resides. PLC-2 processor Destination Node Station address of the target device, in octal. If there is only one DH+ link and you did not use the RSLinx Classic software to configure the DH/RIO module for remote links, specify 0 for both the Source Link and the Destination Link. Application on a workstation CIP with Source ID that is receiving an unsolicited This lets the application message routed over an receive data from a controller. Source Link Remote ID of the topic in RSLinx Classic software, or the shortcut in FactoryTalk Linx. EtherNet/IP or ControlNet network through RSLinx 158 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 If the destination device is Select Input/Output Instructions And specify Classic or FactoryTalk Linx Destination Link Virtual Link ID set up in RSLinx software Classic or FactoryTalk Linx software (0…65535). Destination Node Destination ID (0…77 octal) provided by the application to RSLinx Classic or FactoryTalk Linx. For a DDE topic in RSLinx Classic , use 77. The slot number of the ControlLogix controller is used as the Source Node. Block transfer module over a RIO Channel Channel A or B of the universal remote I/O network 1756-DHRIO module that is connected to the RIO network. Rack Rack number (octal) of the module. Block transfer module over a ControlNet Group Group number of the module. Slot Slot number of the module. Slot Slot number of the module. ControlNet network Choose a Cache Option Depending on the configuration of an MSG instruction, it may use a connection to send or receive data. Message type: Communication method: CIP data table read or write PLC-2, PLC-3, PLC-5, or SLC (all types) Uses a connection: Your option(1) CIP CIP with Source ID DH+ X CIP generic Your option(2) Block-transfer read or write X 1. CIP data table read or write messages can be connected or unconnected. For most applications, Rockwell Automation recommends that you leave CIP data table read or write messages connected. 2. CIP generic messages can be connected or unconnected. But, for most applications, we recommend you leave CIP generic messages unconnected. If a MSG instruction uses a connection, you have the option to leave the connection open (cache) or close the connection when the message is done transmitting. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 159 Chapter 4 Input/Output Instructions If you: Then: Cache the connection The connection stays open after the MSG instruction is done. This optimizes execution time. Opening a connection each time the message executes increases execution time. Do not cache the connection The connection closes after the MSG instruction is done. This frees up that connection for other uses. The controller has the following limits on the number of connections that you can cache. If you have this controller: Then you can cache: CompactLogix 5370 or ControlLogix 5570 Up to 32 connections. ControlLogix 5580 Up to 256 connections. If several messages go to the same device, the messages may be able to share a connection. If the MSG instructions are to: And they are: Then: Different devices Same device Each MSG instruction uses 1 connection. Enabled at the same time Each MSG instruction uses 1 connection. NOT enabled at the same time The MSG instruction uses 1 connection and 1 cached buffer. They share the connection and the buffer. Tip: To share a connection, if the controller alternates between sending a block-transfer read message and a block-transfer write message to the same module, both messages count as one connection. Caching both messages counts as one on the cache list. Guidelines As you plan and program your MSG instructions, follow these guidelines: Guideline Details For each MSG instruction, create a control tag. Each MSG instruction requires its own control tag. Data type = MESSAGE Scope = controller The tag cannot be part of an array or a user-defined data type. Keep the source and/or destination data at the controller scope. A MSG instruction can access only tags that are in the Controller Tags folder (controller scope). If your MSG is to a device that uses 16-bit integers, use a buffer If your message is to a device that uses 16-bit integers, such as of INTs in the MSG and DINTs throughout the project. a PLC-5 or SLC 500 controller, and it transfers integers (not REALs), use a buffer of INTs in the message and DINTs throughout the project. 160 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Guideline Input/Output Instructions Details This increases the efficiency of your project because Logix controllers execute more efficiently and use less memory when working with 32-bit integers (DINTs). To convert between INTs and DINTs, see the Logix 5000 Controllers Common Procedures Programming Manual, publication 1756-PM001. Cache the connected MSGs that execute most frequently. Cache the connection for those MSG instructions that execute most frequently, up to the maximum number permissible for your controller revision. This optimizes execution time because the controller does not have to open a connection each time the message executes. For the CompactLogix 5370 or ControlLogix 5570 controllers , For the CompactLogix 5370 or ControlLogix 5570 controllers, if you want to enable more than 16 MSGs at one time, use some if you enable more than 16 MSGs at one time, some MSG type of management strategy. instructions may experience delays in entering the queue. For the ControlLogix 5580 controllers, if you want to enable more than 256 MSGs at one time, use some type of management strategy. For the ControlLogix 5580 controllers, if you enable more than 256 MSGs at one time, some MSG instructions may experience delays in entering the queue. To help make sure that each message executes, use one of these options: Enable each message in sequence. Enable the messages in groups. Program a message to communicate with multiple devices. For more information, see the Logix 5000 Controllers Common Procedures Programming Manual, publication 1756-PM001. Program logic to coordinate the execution of messages. For more information, see the Logix 5000 Controllers Common Procedures Programming Manual, publication 1756-PM001. (For the CompactLogix 5370 or ControlLogix 5570 controllers The controller can have 10…40 unconnected buffers. The only) Keep the number of unconnected and uncached MSGs less default number is 10 for the CompactLogix 5370 or ControlLogix than the number of unconnected buffers. 5570 controllers. If all the unconnected buffers are in use when an instruction leaves the message queue, the instruction errors and does not transfer the data. You can increase the number of unconnected buffers (40 max), but continue to follow guideline 5. To increase the number of unconnected buffers, see the Logix 5000 Controllers Common Procedures Programming Manual, publication 1756-PM001. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 161 Chapter 4 Input/Output Instructions Specify SLC Messages Use the SLC message types to communicate with SLC and MicroLogix controllers. The following table specifies which data types the instruction allows you access. The table also shows the corresponding Logix 5000 data type. For this SLC or MicroLogix data type: Use this Logix 5000 data type: F REAL L (MicroLogix 1200 and 1500 controllers) DINT N INT Specify Block Transfer Messages The block-transfer message types are used to communicate with block-transfer modules over a Universal Remote I/O network. To: Select this command: Read data from a block-transfer module Block-Transfer Read This message type replaces the BTR instruction Write data to a block-transfer module Block-Transfer Write This message type replaces the BTW instruction To configure a block-transfer message, follow these guidelines: • The source (for BTW ) and destination (for BTR) tags must be large enough to accept the requested data, except for MESSAGE, AXIS, and MODULE structures. • Specify how many 16-bit integers (INT) to send or receive. You can specify from 0 to 64 integers. Tip: To have the block-transfer module determine how many 16-bit integers to send (BTR), or to have the controller send 64 integers (BTW), type 0 for the number of elements. Get System Value (GSV) and Set System Value (SSV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. he GSV/SSV instructions get and set controller system data that is stored in objects. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. Available Languages 162 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Ladder Diagram Function Block These instructions are not available in function block. Structured Text GSV(ClassName,InstanceName,AttributeName,Dest) SSV(ClassName,InstanceName,AttributeName,Source) Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram and Structured Text Operand Type Format Description Class name name The name of object class Instance name name The name of specific object, when object requires name Attribute name name The attribute of object The data type depends on the attribute you select Destination (GSV) SINT INT tag The destination for attribute data DINT REAL structure TIME32 TIME DT LDT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 163 Chapter 4 Input/Output Instructions Operand Type Format Description Source (SSV) SINT tag The tag that contains data you INT want to copy to the attribute DINT REAL structure TIME32 TIME LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Tip: When you use the GSV Instruction with the WallClock class and the CSTOffset attribute with the TIME32 data type, you must create the TIME32 data type tag a TIME32[2] array tag. Description The GSV/SSV instructions get and set controller status data that is stored in objects. The controller stores status data in objects. There is no status file, as in the PLC-5 processor. When true, the GSV instruction retrieves the specified information and places it in the destination. When true, the SSV instruction sets the specified attribute with data from the source. When you enter a GSV/SSV instruction, the programming software displays the valid object classes, object names, and attribute names for each instruction. For the GSV instruction, you can get values for all the attributes. For the SSV instruction, the software displays only those attributes you can set (SSV). 164 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions NOTE: CAUTION: Use the SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. You must test and confirm that the instructions do not change data that you do not want to change. The SSV instructions write and the GSV instructions read past a member into other members of a tag. If the tag is too small, the instructions do not write or read the data. They log a minor fault instead. Example 1 Member_A is too small for the attribute. So the GSV instruction writes the last value to Member_B. Example 2 My_Tag is too small for the attribute. So the GSV instruction stops and logs a minor fault. The Destination tag remains unchanged. GSV/SSV Objects define each object’s attributes and their associated data types. For example, the MajorFaultRecord attribute of the Program object requires a DINT[11] data type. Affects Math Status Flags No. Major/Minor Faults Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 165 Chapter 4 Input/Output Instructions A minor fault will occur if: Fault Type Fault Code There is an invalid object address 4 5 The specified object that does not 4 6 There is an invalid attribute 4 6 There was not enough information 4 6 The GSV destination was not large enough 4 7 support GSV/SSV supplied for an SSV instruction to hold the requested data See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Taken Prescan See Prescan in the Ladder Diagrams table. Normal Execution See rung-condition-in is true in the Ladder Diagrams table. Postscan See Postscan in the Ladder Diagrams table. Example Ladder Diagrams 166 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Structured Text GSV (Program,THIS,LASTSCANTIME,dest1); SSV (Program, THIS, MinorFaultRecord, src[0]); Get System Value (GSV) and Set System Value (SSV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. he GSV/SSV instructions get and set controller system data that is stored in objects. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. Available Languages Ladder Diagram Function Block These instructions are not available in function block. Structured Text GSV(ClassName,InstanceName,AttributeName,Dest) SSV(ClassName,InstanceName,AttributeName,Source) Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram and Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 167 Chapter 4 Input/Output Instructions Operand Type Format Description Class name name The name of object class Instance name name The name of specific object, when object requires name Attribute name name The attribute of object The data type depends on the attribute you select Destination (GSV) SINT tag INT The destination for attribute data DINT REAL structure TIME32 TIME DT LDT Source (SSV) SINT tag INT The tag that contains data you want to copy to the attribute DINT REAL structure TIME32 TIME LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Tip: When you use the GSV Instruction with the WallClock class and the CSTOffset attribute with the TIME32 data type, you must create the TIME32 data type tag a TIME32[2] array tag. Description The GSV/SSV instructions get and set controller status data that is stored in objects. The controller stores status data in objects. There is no status file, as in the PLC-5 processor. When true, the GSV instruction retrieves the specified information and places it in the destination. When true, the SSV instruction sets the specified attribute with data from the source. 168 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions When you enter a GSV/SSV instruction, the programming software displays the valid object classes, object names, and attribute names for each instruction. For the GSV instruction, you can get values for all the attributes. For the SSV instruction, the software displays only those attributes you can set (SSV). NOTE: CAUTION: Use the SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. You must test and confirm that the instructions do not change data that you do not want to change. The SSV instructions write and the GSV instructions read past a member into other members of a tag. If the tag is too small, the instructions do not write or read the data. They log a minor fault instead. Example 1 Member_A is too small for the attribute. So the GSV instruction writes the last value to Member_B. Example 2 My_Tag is too small for the attribute. So the GSV instruction stops and logs a minor fault. The Destination tag remains unchanged. GSV/SSV Objects define each object’s attributes and their associated data types. For example, the MajorFaultRecord attribute of the Program object requires a DINT[11] data type. Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 169 Chapter 4 Input/Output Instructions No. Major/Minor Faults A minor fault will occur if: Fault Type Fault Code There is an invalid object address 4 5 The specified object that does not 4 6 There is an invalid attribute 4 6 There was not enough information 4 6 The GSV destination was not large enough 4 7 support GSV/SSV supplied for an SSV instruction to hold the requested data See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Taken Prescan See Prescan in the Ladder Diagrams table. Normal Execution See rung-condition-in is true in the Ladder Diagrams table. Postscan See Postscan in the Ladder Diagrams table. Example 170 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Ladder Diagrams Structured Text GSV (Program,THIS,LASTSCANTIME,dest1); SSV (Program, THIS, MinorFaultRecord, src[0]); Get System Value (GSV) and Set System Value (SSV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. he GSV/SSV instructions get and set controller system data that is stored in objects. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. Available Languages Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 171 Chapter 4 Input/Output Instructions Function Block These instructions are not available in function block. Structured Text GSV(ClassName,InstanceName,AttributeName,Dest) SSV(ClassName,InstanceName,AttributeName,Source) Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram and Structured Text Operand Type Format Description Class name name The name of object class Instance name name The name of specific object, when object requires name Attribute name name The attribute of object The data type depends on the attribute you select Destination (GSV) SINT tag INT The destination for attribute data DINT REAL structure TIME32 TIME DT LDT Source (SSV) SINT tag INT The tag that contains data you want to copy to the attribute DINT REAL structure TIME32 TIME LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. 172 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Tip: When you use the GSV Instruction with the WallClock class and the CSTOffset attribute with the TIME32 data type, you must create the TIME32 data type tag a TIME32[2] array tag. Description The GSV/SSV instructions get and set controller status data that is stored in objects. The controller stores status data in objects. There is no status file, as in the PLC-5 processor. When true, the GSV instruction retrieves the specified information and places it in the destination. When true, the SSV instruction sets the specified attribute with data from the source. When you enter a GSV/SSV instruction, the programming software displays the valid object classes, object names, and attribute names for each instruction. For the GSV instruction, you can get values for all the attributes. For the SSV instruction, the software displays only those attributes you can set (SSV). Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 173 Chapter 4 Input/Output Instructions NOTE: CAUTION: Use the SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. You must test and confirm that the instructions do not change data that you do not want to change. The SSV instructions write and the GSV instructions read past a member into other members of a tag. If the tag is too small, the instructions do not write or read the data. They log a minor fault instead. Example 1 Member_A is too small for the attribute. So the GSV instruction writes the last value to Member_B. Example 2 My_Tag is too small for the attribute. So the GSV instruction stops and logs a minor fault. The Destination tag remains unchanged. GSV/SSV Objects define each object’s attributes and their associated data types. For example, the MajorFaultRecord attribute of the Program object requires a DINT[11] data type. Affects Math Status Flags No. Major/Minor Faults 174 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 A minor fault will occur if: Fault Type Fault Code There is an invalid object address 4 5 The specified object that does not 4 6 There is an invalid attribute 4 6 There was not enough information 4 6 The GSV destination was not large enough 4 7 Input/Output Instructions support GSV/SSV supplied for an SSV instruction to hold the requested data See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Taken Prescan See Prescan in the Ladder Diagrams table. Normal Execution See rung-condition-in is true in the Ladder Diagrams table. Postscan See Postscan in the Ladder Diagrams table. Example Ladder Diagrams Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 175 Chapter 4 Input/Output Instructions Structured Text GSV (Program,THIS,LASTSCANTIME,dest1); SSV (Program, THIS, MinorFaultRecord, src[0]); Get System Value (GSV) and Set System Value (SSV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. he GSV/SSV instructions get and set controller system data that is stored in objects. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. Available Languages Ladder Diagram Function Block These instructions are not available in function block. Structured Text GSV(ClassName,InstanceName,AttributeName,Dest) SSV(ClassName,InstanceName,AttributeName,Source) Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram and Structured Text 176 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Operand Type Input/Output Instructions Format Description Class name name The name of object class Instance name name The name of specific object, when object requires name Attribute name name The attribute of object The data type depends on the attribute you select Destination (GSV) SINT tag INT The destination for attribute data DINT REAL structure TIME32 TIME DT LDT Source (SSV) SINT tag INT The tag that contains data you want to copy to the attribute DINT REAL structure TIME32 TIME LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Tip: When you use the GSV Instruction with the WallClock class and the CSTOffset attribute with the TIME32 data type, you must create the TIME32 data type tag a TIME32[2] array tag. Description The GSV/SSV instructions get and set controller status data that is stored in objects. The controller stores status data in objects. There is no status file, as in the PLC-5 processor. When true, the GSV instruction retrieves the specified information and places it in the destination. When true, the SSV instruction sets the specified attribute with data from the source. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 177 Chapter 4 Input/Output Instructions When you enter a GSV/SSV instruction, the programming software displays the valid object classes, object names, and attribute names for each instruction. For the GSV instruction, you can get values for all the attributes. For the SSV instruction, the software displays only those attributes you can set (SSV). NOTE: CAUTION: Use the SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. You must test and confirm that the instructions do not change data that you do not want to change. The SSV instructions write and the GSV instructions read past a member into other members of a tag. If the tag is too small, the instructions do not write or read the data. They log a minor fault instead. Example 1 Member_A is too small for the attribute. So the GSV instruction writes the last value to Member_B. Example 2 My_Tag is too small for the attribute. So the GSV instruction stops and logs a minor fault. The Destination tag remains unchanged. GSV/SSV Objects define each object’s attributes and their associated data types. For example, the MajorFaultRecord attribute of the Program object requires a DINT[11] data type. Affects Math Status Flags 178 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions No. Major/Minor Faults A minor fault will occur if: Fault Type Fault Code There is an invalid object address 4 5 The specified object that does not 4 6 There is an invalid attribute 4 6 There was not enough information 4 6 The GSV destination was not large enough 4 7 support GSV/SSV supplied for an SSV instruction to hold the requested data See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Taken Prescan See Prescan in the Ladder Diagrams table. Normal Execution See rung-condition-in is true in the Ladder Diagrams table. Postscan See Postscan in the Ladder Diagrams table. Example Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 179 Chapter 4 Input/Output Instructions Ladder Diagrams Structured Text GSV (Program,THIS,LASTSCANTIME,dest1); SSV (Program, THIS, MinorFaultRecord, src[0]); Get System Value (GSV) and Set System Value (SSV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. he GSV/SSV instructions get and set controller system data that is stored in objects. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. Available Languages Ladder Diagram 180 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Function Block These instructions are not available in function block. Structured Text GSV(ClassName,InstanceName,AttributeName,Dest) SSV(ClassName,InstanceName,AttributeName,Source) Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram and Structured Text Operand Type Format Description Class name name The name of object class Instance name name The name of specific object, when object requires name Attribute name name The attribute of object The data type depends on the attribute you select Destination (GSV) SINT tag INT The destination for attribute data DINT REAL structure TIME32 TIME DT LDT Source (SSV) SINT tag INT The tag that contains data you want to copy to the attribute DINT REAL structure TIME32 TIME LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 181 Chapter 4 Input/Output Instructions Tip: When you use the GSV Instruction with the WallClock class and the CSTOffset attribute with the TIME32 data type, you must create the TIME32 data type tag a TIME32[2] array tag. Description The GSV/SSV instructions get and set controller status data that is stored in objects. The controller stores status data in objects. There is no status file, as in the PLC-5 processor. When true, the GSV instruction retrieves the specified information and places it in the destination. When true, the SSV instruction sets the specified attribute with data from the source. When you enter a GSV/SSV instruction, the programming software displays the valid object classes, object names, and attribute names for each instruction. For the GSV instruction, you can get values for all the attributes. For the SSV instruction, the software displays only those attributes you can set (SSV). 182 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions NOTE: CAUTION: Use the SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. You must test and confirm that the instructions do not change data that you do not want to change. The SSV instructions write and the GSV instructions read past a member into other members of a tag. If the tag is too small, the instructions do not write or read the data. They log a minor fault instead. Example 1 Member_A is too small for the attribute. So the GSV instruction writes the last value to Member_B. Example 2 My_Tag is too small for the attribute. So the GSV instruction stops and logs a minor fault. The Destination tag remains unchanged. GSV/SSV Objects define each object’s attributes and their associated data types. For example, the MajorFaultRecord attribute of the Program object requires a DINT[11] data type. Affects Math Status Flags No. Major/Minor Faults Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 183 Chapter 4 Input/Output Instructions A minor fault will occur if: Fault Type Fault Code There is an invalid object address 4 5 The specified object that does not 4 6 There is an invalid attribute 4 6 There was not enough information 4 6 The GSV destination was not large enough 4 7 support GSV/SSV supplied for an SSV instruction to hold the requested data See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Taken Prescan See Prescan in the Ladder Diagrams table. Normal Execution See rung-condition-in is true in the Ladder Diagrams table. Postscan See Postscan in the Ladder Diagrams table. Example Ladder Diagrams 184 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Structured Text GSV (Program,THIS,LASTSCANTIME,dest1); SSV (Program, THIS, MinorFaultRecord, src[0]); Get System Value (GSV) and Set System Value (SSV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. he GSV/SSV instructions get and set controller system data that is stored in objects. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. Available Languages Ladder Diagram Function Block These instructions are not available in function block. Structured Text GSV(ClassName,InstanceName,AttributeName,Dest) SSV(ClassName,InstanceName,AttributeName,Source) Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram and Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 185 Chapter 4 Input/Output Instructions Operand Type Format Description Class name name The name of object class Instance name name The name of specific object, when object requires name Attribute name name The attribute of object The data type depends on the attribute you select Destination (GSV) SINT tag INT The destination for attribute data DINT REAL structure TIME32 TIME DT LDT Source (SSV) SINT tag INT The tag that contains data you want to copy to the attribute DINT REAL structure TIME32 TIME LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Tip: When you use the GSV Instruction with the WallClock class and the CSTOffset attribute with the TIME32 data type, you must create the TIME32 data type tag a TIME32[2] array tag. Description The GSV/SSV instructions get and set controller status data that is stored in objects. The controller stores status data in objects. There is no status file, as in the PLC-5 processor. When true, the GSV instruction retrieves the specified information and places it in the destination. When true, the SSV instruction sets the specified attribute with data from the source. 186 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions When you enter a GSV/SSV instruction, the programming software displays the valid object classes, object names, and attribute names for each instruction. For the GSV instruction, you can get values for all the attributes. For the SSV instruction, the software displays only those attributes you can set (SSV). NOTE: CAUTION: Use the SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. You must test and confirm that the instructions do not change data that you do not want to change. The SSV instructions write and the GSV instructions read past a member into other members of a tag. If the tag is too small, the instructions do not write or read the data. They log a minor fault instead. Example 1 Member_A is too small for the attribute. So the GSV instruction writes the last value to Member_B. Example 2 My_Tag is too small for the attribute. So the GSV instruction stops and logs a minor fault. The Destination tag remains unchanged. GSV/SSV Objects define each object’s attributes and their associated data types. For example, the MajorFaultRecord attribute of the Program object requires a DINT[11] data type. Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 187 Chapter 4 Input/Output Instructions No. Major/Minor Faults A minor fault will occur if: Fault Type Fault Code There is an invalid object address 4 5 The specified object that does not 4 6 There is an invalid attribute 4 6 There was not enough information 4 6 The GSV destination was not large enough 4 7 support GSV/SSV supplied for an SSV instruction to hold the requested data See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Taken Prescan See Prescan in the Ladder Diagrams table. Normal Execution See rung-condition-in is true in the Ladder Diagrams table. Postscan See Postscan in the Ladder Diagrams table. Example 188 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Ladder Diagrams Structured Text GSV (Program,THIS,LASTSCANTIME,dest1); SSV (Program, THIS, MinorFaultRecord, src[0]); Immediate Output (IOT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The IOT instruction immediately updates the specified output data (output tag of an I/O module or produced tag). The connection to the module must be open to enable the IOT instruction to execute. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text IOT (output_tag) Operands Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 189 Chapter 4 Input/Output Instructions Operand TYPE Update Tag FORMAT DESCRIPTION Tag Tag that contains data you want to copy to the attribute tag that you want to update; either: Output tag of an I/O module or Produced tag Structured Text The operands are the same as those for the ladder diagram IOT instruction. See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description The IOT instruction overrides the requested packet interval (RPI) of an output connection and sends fresh data over the connection. An output connection is a connection that is associated with the output tag of an I/O module or with a produced tag. If the connection is for a produced tag, the IOT instruction also sends the event trigger to the consuming controller. This allows the IOT instruction to trigger an event task in the consuming controller. To use an IOT instruction and a produced tag to trigger an event task in a consumer controller, check the Programmatically (IOT Instruction) Send Event Trigger to Consumer checkbox on the Connection tab of the Tag Properties dialog box. Tip: For CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers , when controlling 5069 I/O over a remote network, an optimization is used to group module connections configured with the same RPI rate into one packet for sending over the network. If the IOT is used on one of these tags, the IOT may cause immediate update of some data tags for other modules that are configured at the same RPI and in the same backplane and are being grouped together with that tag. If this is not desirable, it can be avoided by making the RPI not exactly equal to the RPI other module connections. Tip: When using this instruction with a ControlLogix Redundancy system, outputs controlled by this instruction may not be bumpless during a redundancy switchover. The type of network between the controllers determines when the consuming controller receives the new data and event trigger via the IOT instruction. Over this network The consuming device receives the data and event trigger Backplane Immediately EtherNet/IP Immediately ControlNet Within the actual packet interval (API) of the consumed tag (connection) 190 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions The following diagrams compare the receipt of data via an IOT instruction over EtherNet/IP and ControlNet networks. Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction updates the connection of the specified tag resets the RPI timer of the connection. Postscan N/A Structured Text Condition/State Action Taken Prescan N/A Normal execution See rung-condition-in is true in the Ladder Diagram Postscan N/A Example When the IOT instruction executes, it immediately sends the values of the Local:5:0 tag to the output module. Ladder Diagram Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 191 Chapter 4 Input/Output Instructions IOT (Local:5:0); Immediate Output (IOT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The IOT instruction immediately updates the specified output data (output tag of an I/O module or produced tag). The connection to the module must be open to enable the IOT instruction to execute. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text IOT (output_tag) Operands Ladder Diagram Operand TYPE Update Tag FORMAT DESCRIPTION Tag Tag that contains data you want to copy to the attribute tag that you want to update; either: Output tag of an I/O module or Produced tag Structured Text The operands are the same as those for the ladder diagram IOT instruction. See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description The IOT instruction overrides the requested packet interval (RPI) of an output connection and sends fresh data over the connection. 192 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions An output connection is a connection that is associated with the output tag of an I/O module or with a produced tag. If the connection is for a produced tag, the IOT instruction also sends the event trigger to the consuming controller. This allows the IOT instruction to trigger an event task in the consuming controller. To use an IOT instruction and a produced tag to trigger an event task in a consumer controller, check the Programmatically (IOT Instruction) Send Event Trigger to Consumer checkbox on the Connection tab of the Tag Properties dialog box. Tip: For CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers , when controlling 5069 I/O over a remote network, an optimization is used to group module connections configured with the same RPI rate into one packet for sending over the network. If the IOT is used on one of these tags, the IOT may cause immediate update of some data tags for other modules that are configured at the same RPI and in the same backplane and are being grouped together with that tag. If this is not desirable, it can be avoided by making the RPI not exactly equal to the RPI other module connections. Tip: When using this instruction with a ControlLogix Redundancy system, outputs controlled by this instruction may not be bumpless during a redundancy switchover. The type of network between the controllers determines when the consuming controller receives the new data and event trigger via the IOT instruction. Over this network The consuming device receives the data and event trigger Backplane Immediately EtherNet/IP Immediately ControlNet Within the actual packet interval (API) of the consumed tag (connection) The following diagrams compare the receipt of data via an IOT instruction over EtherNet/IP and ControlNet networks. Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 193 Chapter 4 Input/Output Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction updates the connection of the specified tag resets the RPI timer of the connection. Postscan N/A Structured Text Condition/State Action Taken Prescan N/A Normal execution See rung-condition-in is true in the Ladder Diagram Postscan N/A Example When the IOT instruction executes, it immediately sends the values of the Local:5:0 tag to the output module. Ladder Diagram Structured Text IOT (Local:5:0); Reference (REF) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The Reference (REF) Instruction associates a reference with the address of an axis or coordinate system concrete tag. This is a transitional instruction. Follow these steps when using it: • ◦ In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute. ◦ ▪ In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition. Available Instructions 194 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text REF(Source, Reference); Operands Operand Type Format Description Source AXIS_CIP_DRIVE Immediate Tag Name of the axis or coordinate AXIS_CONSUMED system to reference. AXIS_GENERIC_DRIVE AXIS_SERVO AXIS_SERVO_DRIVE AXIS_VIRTUAL COORDINATE_SYSTEM Reference REF_TO_AXIS_CIP_DRIVE Tag REF_TO_AXIS_CONSUMED Name of the reference to be populated. REF_TO_AXIS_GENERIC_DRIVE REF_TO_AXIS_SERVO REF_TO_AXIS_SERVO_DRIVE REF_TO_AXIS_VIRTUAL REF_TO_COORDINATE_SYSTEM Affects Math Status Flags No Major/Minor Faults None specific to this instruction. Execution Condition/State Action Taken Prescan The instruction uses the Source address to populate the Reference. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 195 Chapter 4 Input/Output Instructions Condition/State Action Taken Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. The instruction uses the Source address to populate the Reference. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The instruction uses the Source address to populate the Reference. Postscan The instruction uses the Source address to populate the Reference. Error Codes None specific to this instruction. Example Relay Ladder Structured Text REF(AxisCip, Ref_AxisCip); Access System Values This procedure will help you to get or use status information about your Logix 5000 controller. If you want to: Refer to this help topic: use specific key words in your logic to monitor specific events Monitor Status Flags on page 281 get or set system values Get and Set System Data on page 267 get information about the memory of the controller Determine Controller Memory Information on page 259 Access the AddOnInstructionDefinition Object The AddOnInstructionDefinition object lets you customize instructions for sets of commonly-used logic, provides a common interface to this logic, and provides documentation for the instruction. For details, see the Controllers Add-On Instructions Programming Manual, publication 1756-PM010. Attribute Data Type LastEditDate LINT Instruction within Instruction within Standard Task Safety Task GSV None Description Timestamp of the last edit to an Add-On Instruction. 196 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type MajorRevision DINT Instruction within Instruction within Standard Task Safety Task GSV None Input/Output Instructions Description Major revision number of the Add-On Instruction. MinorRevision DINT GSV None Minor revision number of the Add-On Instruction. Name String GSV GSV Name of the Add-On Instruction. RevisionExtendedText String GSV None Text describing the revision of the Add-On Instruction. SafetySignature DINT GSV None ID In a safety project, the ID number, date, and timestamp of an Add-On Instruction definition. SignatureID DINT GSV None 32-bit identification number of an Add-On Instruction definition. Vendor String GSV None Vendor that created the Add-On Instruction. Access the ALARMBUFFER object The ALARMBUFFER object is part of the Publisher/Subscriber infrastructure. The Publisher/Subscriber infrastructure is part of the Logix controller communication subsystem. The Logix controller communication subsystem implements Publisher/Subscriber messaging patterns for CIP, which lets other devices receive messages sent by the controller subsystem. Currently, Digital and Analog Alarms and Batch Equipment Phase subsystems use the Publisher/ Subscriber Infrastructure to deliver messages through CIP to subscribing applications. Use the ALARMBUFFER object to help you determine the existence of connections to the Publisher/Subscriber subsystem and their status. An AlarmBuffer object instance exists for every subscribing application. This means that an AlarmBuffer object may exist at one point in time, but not exist at another time. For this reason, a Get System Value (GSV) instruction returns a status as part of the destination tag (INT[0].0). When the status bit is zero, this most likely means that the AlarmBuffer object no longer exists. Attribute Data Type Instruction Description AlarmBufferInstance DINT[n] GSV Returns the AlarmBuffer object IDs. DINT[0] Number of AlarmBuffer objects. DINT[1...(n-1) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 AlarmBuffer object IDs. 197 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description If the number of AlarmBuffer objects is greater than n-1, only the IDs of the first (n-1) objects are returned. You do not have to specify an AlarmBuffer Instance ID for this attribute. AlarmBufferStatus INT[2] GSV Returns the status of the specified AlarmBuffer object. You have to specify the AlarmBuffer Instance ID to get the status of that individual instance. INT[0].0 1-AlarmBufferStatus Attribute is valid. 0-AlarmBufferStatus Attribute is invalid. INT[1] AlarmBuffer Status Attribute value. The Status attribute contains the following: INT[1].0 1-Multi-message packets enabled. 0-Multi-message packets disabled. INT[1].1 1-Buffer is enabled. 0-Buffer is disabled. INT[1].2 1-Data stored in the buffer. 0-Buffer is empty. INT[1].3 1-Buffer is full. 0-Buffer is not full. INT[1].4 1-Initialization Status messages WILL NOT be sent (at subscription time and on Redundancy switchover). 0-Initialization Status messages WILL be sent. All other bits are reserved and are set to 0. BufferSize INT[2] GSV Returns the buffer size (in kB) of the specified AlarmBuffer Object. You have to specify the Alarm Buffer Instance ID to get the buffer size of that individual instance. INT[0].0 1-BufferSize Attribute is valid. 198 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description 0-BufferSize Attribute is invalid. INT[1] Buffer Size Attribute value. BufferUsage INT[2] GSV Returns the percentage of buffer space used by the specified AlarmBuffer Object. You have to specify the AlarmBuffer Instance ID to get the buffer usage value of that individual instance. INT[0].1 1-BufferUsage Attribute is valid. 0-BufferUsage Attribute is invalid. INT[1] BufferUsage Attribute value. SubscriberName STRING GSV Returns the subscriber name of the specified AlarmBuffer object. You have to specify the AlarmBuffer Instance ID to get the subscriber name of that individual instance. Any string type can be referenced as a destination tag. If the Subscriber Name cannot fit into the provided destination tag string, then only the part of the name that can fit in the destination tag is provided by the instruction. If the AlarmBuffer object instance specified by the instance ID does not exist when the instruction is called, then the string length (.LEN member) is set to zero. Note that if no subscriber name is provided when AlarmBuffer object is created by a subscriber, then the subscriber name attribute is set to a device serial number associated with a connection through which the Create service on the AlarmBuffer object was called. GSV Instruction Example Your program can contain a GSV instruction to obtain the list of current AlarmBufferInstances in the controller. This instruction will return the total count of alarm buffer objects currently present in the controller (DINT[0]) along with the associated AlarmBuffer object Instance ID (DINT[1] – DINT[n-1]) for each AlarmBuffer object that is present in the controller. The GSV instruction displays the value of the number of AlarmBuffer objects (DINT[0]) under the Dest (destination) tag name. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 199 Chapter 4 Input/Output Instructions Your program can use the AlarmBuffer object Instance ID to obtain information related to a specific instance of the AlarmBuffer object that is present in the controller. A status word (INT[0]), indicating valid or invalid data, is returned in the destination tag for the AlarmBufferStatus, BufferSize, and BufferUsage attributes, as the alarm buffer objects can be created and deleted at any time. The returned value is in (INT[1]) when the Attribute Name equals AlarmBufferStatue, BufferSize, or BufferUsage. The returned value is the subscriber name when the Attribute Name is SubscriberName. No status is returned for the SubsriberName attribute. Ladder Diagram Following is an example of the GSV instruction retrieving the AlarmBuffer object IDs. Although the GSV of the AlarmBufferInstances returns the values into an array, you cannot use the array address to get attribute values for that instance. You must copy or move the value in myAlarmBufferInstances[x], (where x = 1, 2, 3,...) to a direct (unindexed) tag like the myAlarmBufferID shown in the following illustration. Following is an example of the GSV instruction retrieving the buffer size of the AlarmBuffer object. The number that is displayed under the Dest (destination) tag name is the valid or invalid bit value when the Attribute Name is AlarmBufferStatus, BufferSize or BufferUsage. Structured Text Following is an example of the GSV instruction retrieving the AlarmBuffer object IDs. GSV(AlarmBuffer, AlarmBufferInstances, myAlarmBufferInstances[0]); Following is an example of the GSV instruction retrieving the AlarmBuffer Object. GSV(AlarmBuffer, myAlarmBufferID, BufferSize, myBufferSize[0]); Access the Axis object The AXIS object provides status information about an axis. Specify the axis tag name to determine which AXIS object you want. For more information about the AXIS object, see the SERCOS and Analog Motion Configuration and Startup User Manual, publication MOTION-UM001. 200 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions When an attribute is marked with an asterisk (*), it means that the attribute is located in both the controller and in the motion module.When you use an SSV instruction to write one of these values, the controller automatically updates the copy in the module. However, this process is not immediate. The axis status tag, ConfigUpdateInProcess is provided to indicate when this process is complete. For example, if you perform an SSV to the PositionLockTolerance, ConfigUpdateInProcess of the Axis tag is set until an update to the module is successful. Therefore, the logic following the SSV could wait on this bit resetting before continuing in the program. Attribute Data Type Instruction Description * REAL GSV The torque command output % necessary to SSV generate the commanded acceleration. GSV The type of stop to perform your axis SSV • 0 = fast stop • 1 = fast shutdown • 2 = hard shutdown AccelerationF eedForwardG ain ACStopMode SINT ActualPosition REAL GSV The actual position in position units of your axis. ActualVelocity REAL GSV The actual velocity of your axis in position units/second. AnalogInput1 REAL GSV This attribute applies only to an axis associated SSV Analog Input 2, a Kinetix7000 Drive. This attribute with an interger range of +/-16384, represents the analog value of an analog device connected to the Kinetix7000 drive's analog input(s). These inputs are useful for web/converting applications with load cell (measuring web force on a roller) or dancer (measuring web force/position directly), which can be directly connected to the drive controlling the web. AverageVeloc REAL GSV ity The average velocity of your axis in position units/second. AverageVeloci REAL GSV The timebase in seconds of the average tyTimebase SSV velocity of your axis. AxisConfigurat SINT GSV The state of the axis configuration ionState • 0 - 126 = not yet configured • 127 = invalid consumed axis data due to incompatible revisions between produced and consumer • Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 128 = configured 201 Chapter 4 Input/Output Instructions Attribute Bandwidth Data Type REAL Instruction Description • 3 = waiting on reply • 4 = configured GSV The unity gain bandwidth (Hz) that the SSV controller uses to calculate the gains for a Motion Apply Axis Tuning (MAAT) instruction. C2CConnectio DINT GSV nInstance The connection instance of the controller producing the axis data. C2CMapTableI DINT GSV nstance The map instance of the controller producing the axis data. CommandPosi REAL GSV tion The command position of your axis in position units. CommandVelo REAL GSV city The command velocity of your axis in position units. ConversionCo REAL GSV The conversion factor used to convert nstant SSV from your units to feedback counts in counts/position unit. DampingFac REAL tor GSV The value used in calculating the maximum SSV position servo bandwidth during the execution of the Motion Run Axis Tuning (MRAT) instruction. *DriveFaultAct SINT GSV The operation performed when a drive fault ion SSV occurs. • 0 = shutdown the axis • 1 = disable the drive • 2 = stop the commanded motion • 3 = change the status bit only DynamicsConf DINT GSV Revision 16 improved how the controller igurationBits SSV handles changes to an S-curve profile. Do you want to return to revision 15 or earlier behavior for S-curves? NO — Leave these bits ON (default). YES — Turn OFF one or more of these bits: To turn off Turn off this bit this change Reduced 0 S-curve Stop Delay This change applies to the Motion Axis Stop (MAS) instruction. 202 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description It lets you use a higher deceleration jerk to stop an accelerating axis more quickly. The controller uses the deceleration jerk of the stopping instruction if it is more than the current acceleration jerk. Reduced 1 S-curve Velocity Reversals Before revision 16, you could cause an axis to momentarily reverse direction if you decreased the deceleration jerk while the axis was decelerating. This typically happened if you tried to restart a jog or move with a lower deceleration rate while the axis was Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 203 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description stopping. This change prevents the axis from reversing in those situations. Reduced 2 S-curve Velocity Overshoots You can cause an axis to overshoot its programmed speed if you decrease the acceleration jerk while the axis is accelerating. This change keeps to overshoot to no more than 50% of the programmed speed. 204 *FeedbackFau SINT GSV The operation performed when an encoder loss ltAction SSV fault occurs. • 0 = shutdown the axis • 1 = disable the drive • 2 = stop the commanded motion • 3 = change the status bit only *FeedbackNoi SINT GSV The operation performed when an encoder seFaultAction SSV noise fault occurs. • 0 = shutdown the axis • 1 = disable the drive • 2 = stop the commanded motion • 3 = change the status bit only *FrictionComp REAL GSV The fixed output level in volts used to ensation SSV compensate for static friction. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Input/Output Instructions Instruction Description GSV The instance number of the motion group that SSV contains your axis. HardOvertrave SINT GSV • 0 = shutdown lFaultAction SSV • 1= disable the drive • 2 = stop motion • 3 = status only GroupInstance DINT HomeConfigur DINT GSV The motion configuration bits for your axis. ationBits SSV • 0 = home direction • 1 = home switch normally closes • 2 = home marker edge negative HomeMode SINT HomePosition REAL HomeReturnS REAL peed HomeSeque SINT nce HomeSpeed REAL GSV The homing mode for your axis. SSV • 0 = passive homing • 1 = active homing (default) • 2 = absolute GSV The homing position of your axis in position SSV units. GSV The homing return speed of your axis in SSV position units/second. GSV The homing sequence type for your axis. SSV • 0 = immediate homing • 1 = switch homing • 2 = marker homing • 3 = switch-marker homing (default) GSV The homing speed of your axis in position units/second. Instance DINT GSV The instance number of the axis. InterpolatedAc REAL GSV For time-based position captures, this attribute tualPosition provides the interpolated actual axis position. The position is specified in position units, and is based on the value of the InterpolationTime attribute. To interpolate an actual axis position, use an SSV instruction to set the InterpolationTime attribute. InterpolatedCo REAL GSV For time-based position captures, this attribute mmandPosit provides the interpolated command axis ion position. The position is specified in position units, and is based on the value of the InterpolationTime attribute. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 205 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description To interpolate a command axis position, use an SSV instruction to set the InterpolationTime attribute. InterpolationT DINT GSV Use this attribute to provide a reference for ime SSV time-based position captures. To interpolate a position, use an SSV instruction to set the InterpolationTime attribute. The controller then updates the following attributes: • InterpolatedActualPosition • InterpolatedCommandPosition To supply a value for InterpolationTime, you can use any event that produces a CST timestamp, such as: • RegistrationTime attribute • timestamp of a digital output The InterpolationTime attribute uses only the lower 32 bits of a CST timestamp. MapTableInsta DINT GSV The I/O map instance of the servo module. GSV Position offset that is currently applied to the nce MasterOffset REAL master of a position cam. Specified in position units of the master axis. MaximumAcce REAL GSV The maximum acceleration of your axis in leration SSV position units/second . MaximumDece REAL GSV The maximum deceleration of your axis in leration SSV position units/second . *MaximumNeg REAL GSV The maximum negative travel limit in position ativeTravel SSV units. *MaximumPos REAL GSV The maximum positive travel limit in position itiveTravel SSV units. GSV The maximum speed of your axis in position SSV units/second. SINT GSV The channel of your servo module. MotionStatusB DINT GSV The motion status bits for your axis. (In MaximumSp REAL eed ModuleChan 2 2 nel the AXIS structure, this is the MotionStatus its member. 206 Publication 1756-RM003Z-EN-P - September 2024 Bit Bit name Meaning 0 AccelStatus acceleration 1 DecelStatus deceleration 2 MoveStatus move Rockwell Automation, Inc. Attribute Data Type Instruction Chapter 4 Input/Output Instructions 3 JogStatus jog 4 GearingStatus gear 5 HomingStatus home 6 StoppingSta Description stop tus 7 AxisHomedSta homed status tus 8 PositionCamSt position cam atus 9 TimeCamSta time cam tus 10 PositionCamP position cam endingStatus 11 TimeCamPend time cam ingStatus 12 pending pending GearingLockSt gearing lock atus 13 PositionCamL position cam ockStatus 14 MasterOffsetM master offset oveStatus 15 motion TransformStat transform eStatus 17 move CoordinatedM coordinate otionStatus 16 lock state ControlledByTr control by ansformSta transform tus *OutputLPFilte REAL GSV rBandwidth SSV *OutputLimit REAL *OutputOffset REAL The bandwidth (Hz) of the servo low-pass digital output filter. GSV The value in volts of the maximum servo output voltage of your SSV axis. GSV The value in volts used to offset the effects of the cumulative SSV offsets of the servo module DAC output and the servo drive input. PositionError REAL GSV The difference between the actual and command position of an axis. Rockwell Automation, Inc. *PositionError REAL GSV The amount of position error in position units that the servo Tolerance SSV tolerates before issuing a position error fault. Publication 1756-RM003Z-EN-P - September 2024 207 Chapter 4 Input/Output Instructions Attribute Data Type PositionIntegr REAL Instruction Description GSV The sum of the position error for an axis in position units. *PositionInteg REAL GSV The value (1/msec ) used to achieve accurate axis positioning ralGain SSV despite disturbances such as static friction and gravity. *PositionLock REAL GSV The amount of position error in position units that the servo Tolerance SSV module tolerates when giving a true position locked status atorError 2 indication. *PositionProp REAL GSV The value (1/msec) the controller multiples with the position ortionalGain SSV error to correct for the position error. PositionServo REAL GSV The unity gain bandwidth that the controller uses to calculate Bandwidth SSV the gains for a Motion Apply Axis Tuning (MAAT) instruction. *PositionUnw GSV The value used to perform the automatic unwind of the rotary ind DINT SSV axis in counts/revolution. ProcessStatus INT GSV The status of the last Motion Run Hookup Diagnostic (MRHD) instruction. ProgrammedS SINT GSV topMode SSV Registration1P REAL Value Meaning 0 test process successful 1 test in progress 2 test process aborted by the user 3 test exceeded 2-second timeout 4 test process failed due to servo fault 5 insufficient test increment The type of stop to perform on your axis. Value Meaning 0 fast stop 1 fast shutdown 2 hard shutdown GSV The registration position for your axis in position units. GSV You can use this attribute to supply a timestamp for time-based osition RegistrationT ime DINT position captures: • the RegistrationTime attribute contains the lower 32 bits of the CST timestamp of an axis registration event • 208 The CST timestamp is measured in microseconds Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description • To interpolate a position based on an axis registration event: ◦ Use a GSV instruction to get the value of the RegistrationTime attribute. ◦ Use an SSV instruction to set the InterpolationTime attribute to the value of the RegistrationTime attribute. RotaryAxis SINT GSV 0 = Linear Tag 1 = Rotary When the Rotary Axis attribute is set true (1), it lets the axis unwind. This gives infinite position range by unwinding the axis position whenever the axis moves through a complete physical revolution. The number of encoder counts per physical revolution of the axis is specified by the Position Unwind attribute. For Linear operation, the counts don’t roll over. They are limited to +/- 2 billion. ServoFaultBits DINT GSV The servo fault bits for your servo loop. (In the AXIS structure, this is the AxisEvent member.) Bit Bit name 0 PosSoftOvertr positive overtravel fault Meaning avelFault 1 NegSoftOvertr negative overtravel fault avelFault 2 NegSoftOvertr position error fault avelFault 3 FeedbackFault encoder channel A loss fault 4 FeedbackFault encoder channel B loss fault 5 FeedbackFault encoder channel Z loss fault 6 FeedbackNois encoder noise fault eFault 7 DriveFault drive fault 8 ModuleSyncFa synchronous connection fault ult 9 ModuleHardwa servo hardware fault reFault ServoOutputLe REAL GSV The output voltage level in volts for your axis servo loop. GSV The status bits for your servo loop. (In the AXIS structure, this is vel ServoStatusB its DINT the ServoStatus member.) Bit Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 Bit name Meaning 209 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description 0 ServoActionSt servo action atus 1 DriveEnableSt drive enable atus 2 OutputLimitSt output limit atus 3 PositionLockS position lock tatus 13 TuneStatus 14 ProcessStatus test diagnostic 15 ShutdownSta tuning process axis shutdown tus *SoftOvertrave SINT GSV The operation performed when a soft overtravel fault occurs. lFaultAction SSV 0 = shutdown the axis 1 = disable the drive 2 = stop the commanded motion 3 = change the status bit only StartActualPos REAL GSV ition The actual position in position units of your axis when new commanded motion starts for the axis. StartComman REAL GSV dPosition StartMasterOff REAL The command position in position units of your axis when new commanded motion starts for the axis. GSV set The master offset when the last Motion Axis Move (MAM) instruction executed either of these types of moves: • AbsoluteMasterOffset • IncrementalMasterOffset Specified in position units of the master axis. StrobeActualP REAL GSV osition The actual position in position units of an axis when the Motion Group Strobe Position (MGSP) instruction executes. StrobeComma REAL GSV ndPosition StrobeMasterO REAL The command position in position units of an axis when the Motion Group Strobe Position (MGSP) instruction executes. GSV ffset The master offset when the Motion Group Strobe Position (MGSP) instruction executes. Specified in position units of the master axis. TestDirectionF SINT GSV The direction of axis travel during the Motion Run Hookup Diagnostic (MRHD) instruction as seen by the servo module. orward 0 = negative (reverse) direction 1 = positive (forward) direction TuneAccelerat REAL GSV ion the last Motion Run Axis Tuning (MRAT) instruction. TuneAccelerat REAL ionTime 210 2 The acceleration value in position units/sec measured during GSV The acceleration time in seconds measured during the last Motion Run Axis Tuning (MRAT) instruction. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type TuneDecelerat REAL Instruction GSV ion Input/Output Instructions Description The deceleration value in position units/sec measured during the last Motion Run Axis Tuning (MRAT) instruction. TuneDecelerat REAL GSV ionTime The deceleration time in seconds measured during the last Motion Run Axis Tuning (MRAT) instruction. TuneInertia REAL GSV The inertia value in mV/Kcounts/second for the axis as calculated from the measurements the controller made during the last Motion Run Axis Tuning (MRAT) instruction. TuneRiseTime REAL GSV The axis rise time in seconds measured during the last Motion Run Axis Tuning (MRAT) instruction. TuneSpeedSca REAL GSV ling The axis drive scaling factor in mV/Kcounts/sec measured during the last Motion Run Axis Tuning (MRAT) instruction. TuneStatus INT GSV The status of the last Motion Run Axis Tuning (MRAT) instruction. • 0 = tune process successful • 1 = tuning in progress • 2 = tune process aborted by the user • 3 = tune exceeded 2-second timeout • 4 = tune process failed due to servo fault • 5 = axis reached tuning travel limit • 6 = axis polarity set incorrectly • 7 = tune speed is too small to make measurements TuningConfigu DINT GSV The tuning configuration bits for your axis. rationBits SSV • 0 = turning direction (0=forward, 1=reverse) • 1 = tune position error integrator • 2 = tune velocity error integrator • 3 = tune velocity feedforward bit • 4 = acceleration feedforward • 5 = tune velocity low-pass filter TuningSpeed REAL GSV The maximum speed in position units/second initiated by the SSV Motion Run Axis Tuning (MRAT) instruction. TuningTravelLi REAL GSV The travel limit used by the Motion Run Axis Tuning (MRAT) mit SSV instruction to limit the action during tuning. VelocityComm REAL GSV The current velocity reference in position units/second to the and velocity servo loop for an axis. VelocityError REAL GSV The difference in position units/second between the commanded and actual velocity of a servo axis. VelocityFeedb REAL GSV ack Rockwell Automation, Inc. The actual velocity in position units/second of your axis as estimated by the servo module. *VelocityFeedf REAL GSV The velocity command output % necessary to generate the orwardGain SSV commanded velocity. *VelocityInteg REAL GSV The value (1/msec) that the controller multiplies with the ralGain SSV VelocityIError value to correct the velocity error. Publication 1756-RM003Z-EN-P - September 2024 211 Chapter 4 Input/Output Instructions Attribute Data Type VelocityIntegr REAL Instruction Description GSV The sum of the velocity error for a specified axis. GSV The value (1/msec) that the controller multiplies with the SSV VelocityError to correct the velocity error. GSV The value used to convert the output of the servo loop into the SSV equivalent voltage to the drive. GSV The bandwidth (Hz) of the drive as calculated from the SSV measurements made during the last Motion Run Axis Tuning atorError *VelocityProp REAL ortionalGain *VelocityScal REAL ing VelocityServo REAL Bandwidth (MRAT) instruction. WatchPosition REAL GSV The watch position in position units of your axis. Access the Controller object The Controller object provides status information about controller execution. Attribute Data Type Instruction Description Audit Value DINT[2], LINT GSV The audit value is a unique value that is generated when a project is downloaded to the controller or loaded from removable storage. When a change is detected, this value is updated. To specify which changes are monitored, use the ChangesToDetect attribute. ChangesToDetect DINT[2], LINT GSV, SSV Used to specify which changes are monitored. When a monitored change occurs, the Audit Value is updated. CanUseRPIFrom DINT GSV Producer Identifies whether to use the RPI specified by the producer. • 0. Do not use the RPI specified by the producer. • 1. Use the RPI specified by the producer. ControllerLog Execution DINT Modification Count GSV SSV Number of controller log entries that originate from a program/task properties 212 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description change, an online edit, or a controller timeslice change. It can also be configured to include log entries originating from forces. The number is reset if RAM enters a bad state. The number is not capped at the largest DINT, and a rollover can occur. ControllerLog DINT GSV SSV TotalEntryCount Number of controller log entries since the last firmware upgrade. The number is reset if RAM enters a bad state. The number is capped at the largest DINT. DataTablePad INT GSV Percentage IgnoreArrayFaultsDuringPostS Percentage (0...100) of free data table memory set aside. SINT can GSV SSV Used to configure the suppression of selected faults encountered when an SFC action is postscanned. Only valid when SFCs are configured for automatic reset. • 0. This value does not not suppress faults during postscan execution. This is the default and recommended behavior. • 1. This value automatically suppresses major faults 4/20 (Array subscript too large) and 4/83 (Value out of range) while postscanning SFC actions. When a fault is suppressed, the controller uses an internal fault handler to automatically clear the fault. This causes the faulted instruction to be skipped, with execution resuming at the following instruction. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 213 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Because the fault handler is internal, you do not have to configure a fault handler to get this behavior. In fact, even if a fault handler is configured, a suppressed fault will not trigger it. InhibitAutomatic BOOL GSV SSV FirmwareUpdate Identifies whether to enable the firmware supervisor. • 0. This value executes the firmware supervisor. • 1. This value does not execute the firmware supervisor. KeepTestEditsOnSwitch over SINT GSV Identifies whether to maintain test edits on controller switchover. • 0. This value automatically untests edits at switchover, • 1. This value continues testing edits at switchover. Name String GSV Name of the controller. Redundancy SINT GSV Identifies whether the Enabled controller is configured for redundancy. • 0. This value indicates the controller is not configured for redundancy. • 1. This value indicates the controller is configured for redundancy. ShareUnused INT TimeSlice GSV SSV Identifies how the continuous task and the background tasks shared any unused timeslice. • 0. This value indicates that the operating system does not give control to the continuous task even if background is complete. 214 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description • 1. This value indicates that a continuous task runs even if the background tasks are complete. This is the default value. • 2. This value or greater logs a minor fault and leaves the setting unchanged. TimeSlice INT GSV SSV Percentage of available CPU (10-90) that is assigned to communications. This value cannot change when the keyswitch is in the Run position. Access the ControllerDevice object The ControllerDevice object identifies the physical hardware of the controller. Attribute Data Type Instruction Description DeviceName SINT[33] GSV ASCII string that identifies the marketing description of the controller. The first byte contains a count of the number of ASCII characters returned in the array string. ProductCode INT GSV Each value identifies the type of controller: 15 SoftLogix5800 40 1756-L1 43 1769-L20 44 1769-L30 49 PowerFlex® with DriveLogix5725 50 1756-L53 51 1756-L55 52 PowerFlex with DriveLogix5730 53 Studio 5000 Logix Emulate 54 1756-L61 55 1756-L62 56 1756-L63 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 215 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description 57 1756-L64 64 1769-L31 65 1769-L35E 67 1756-L61S 68 1756-L62S 69 1756-LSP 72 1768-L43 74 1768-L45 76 1769-L32C 77 1769-L32E 78 1769-L35C 79 1756-L60M03SE 80 1769-L35CR 85 1756-L65 86 1756-L63S 87 1769-L23E-QB1 88 1769-L23-QBFC1 89 1769-L23E-QBFC1 92 1756-L71 93 1756-L72 94 1756-L73 95 1756-L74 96 1756-L75 101 1768-L43S 102 1768-L45S 106 1769-L30ER 107 1769-L33ER 108 1769-L36ERM 109 1769-L30ER-NSE 110 1769-L33ERM 146 1756-L7SP 147 1756-L72S 148 1756-L73S 149 1769-L24ER-QB1B 150 1769-L24ER-QBFC1B 151 1769-L27ERM-QBFC1B 152 1769-L19ER-BB1B 153 1769-L16ER-BB1B 154 1769-L18ER-BB1B 155 1769-L18ERM-BB1B 156 1769-L30ERM 158 1756-L71S 164 1756-L81E 165 1756-L82E 216 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description 166 1756-L83E 167 1756-L84E 168 1756-L85E 171 1756-L8SP 176 1769-L30ERMS 177 1769-L33ERMS 178 1769-L36ERMS 186 5069-L46ERMW 188 5069-L310ER_NSE 189 5069-L306ERM 190 5069-L310ERM 191 1756-MPC 192 5069-L320ERM 193 5069-L330ERM 194 5069-L340ERM 195 5069-L350ERM 196 5069-L306ER 201 1756-L81ENSE 202 1756-L82ENSE 203 1756-L83ENSE 204 1756-L84ENSE 205 1756-L85ENSE 211 1756-L81ES 212 1756-L82ES 213 1756-L83ES 214 1756-L84ES 216 5069-L310ER 217 5069-L320ER 218 5059-L330ER 219 5069-L340ER 220 5069-L350ER 221 5069-L310ERMS2 222 5069-L320ERMS2 223 5069-L330ERMS2 224 5069-L340ERMS2 225 5069-L350ERMS2 226 5069-L306ERMS2 228 5069-L380ERM 229 5069-L380ERMS2 230 5069-L3100ERM 231 5069-L3100ERMS2 233 1769-L37ERMO 234 1769-L37ERMOS Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 217 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description 235 5069-L306ERS2 236 5069-L310ERS2 237 5069-L320ERS2 238 5069-L330ERS2 239 5069-L340ERS2 240 5069-L350ERS2 241 5069-L380ERS2 242 5069-L3100ERS2 243 5069-L306ERMS3 244 5069-L310ERMS3 245 5069-L320ERMS3 246 5069-L330ERMS3 247 5069-L340ERMS3 248 5069-L350ERMS3 249 5069-L380ERMS3 250 5069-L3100ERMS3 255 1769-L38ERM 256 1769-L38ERMS 257 1769-L37ERM 258 1769-L37ERMS 282 1756-L81EP 283 1756-L83EP 284 1756-L85EP 285 5069-L320ERP 286 5069-L340ERP 290 5069-L4100ERMW 291 5069-L450ERMW 292 5069-L4200ERMW 293 5069-L430ERMW 330 5015-AENFT *The product code list may not be complete. ProductRev INT GSV Identifies the current product revision. Display should be hexadecimal. The low byte contains the major revision; the high byte contains the minor revision. SerialNumber DINT GSV Serial number of the device. The serial number is assigned when the device is built. 218 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Status INT GSV Device Status Bits 7...4 Meaning 0000 Reserved 0001 Flash update in progress 0010 Reserved 0011 Reserved 0100 Flash is bad 0101 Faulted modes 0110 Run 0111 Program Fault Status Bits 11...8 Meaning 0001 Recoverable minor fault 0010 Unrecoverable minor fault 0100 Recoverable major fault 1000 Unrecoverable major fault Controller Status Bits 13...12 Meaning 01 Keyswitch in run 10 Keyswitch in program 11 Keyswitch in remote 15...14 Meaning 01 Controller is changing modes 10 Debug mode if controller in run mode Type INT GSV Identifies the device as a controller. Controller = 14. Vendor INT GSV Identifies the vendor of the device. Allen-Bradley = 0001. Access the CoordinateSystem object The COORDINATESYSTEM object provides status information about motion coordinate system execution. Attribute Data Type Instruction Meaning CoordinateMotionStatus DINT GSV Set when an axis lock is SSV requested for an MCLM or MCCM instruction and the axis has crossed the Lock Position. Cleared when an MCLM or MCCM is initiated. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 219 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Meaning AccelStatus BOOL GSV Sets when vector is SSV accelerating. Clears when a blend is in process or when vector move is at speed or decelerating. DecelStatus BOOL GSV Sets when vector is SSV decelerating. Clears when a blend is in process or when vector move is accelerating or when move completes. ActualPosToleranceStatus BOOL GSV Sets for Actual Tolerance SSV termination type only. The bit is set after the following two conditions have been met. 1) Interpolation is complete. 2) The actual distance to the programmed endpoint is less than the configured coordinate system’s Actual Tolerance value. It remains set after the instruction completes. It is reset when a new instruction is started. CommandPosToleranceStatus BOOL GSV Sets for all termination types SSV whenever the distance to the programmed endpoint is less than the configured coordinate system’s Command Tolerance value and remains set after the instruction completes. It is reset when a new instruction is started. RobotJointsDirectionSenseBits DINT GSV Set of bits that define the SSV Joints direction sense. By default, the Joints direction sense bits are zero. This indicates that the user convention is the same as the Rockwell Kinematics convention. If any of the Joints have the opposite convention to the Rockwell convention, 220 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Meaning set the corresponding Joints direction sense bit to 1. StoppingStatus BOOL GSV The Stopping Status bit is SSV cleared when the MCCM instruction executes. MoveStatus BOOL GSV Sets when MCCM begins axis SSV motion. Clears on the .PC bit of the last motion instruction or a motion instruction executes which causes a stop. MoveTransitionStatus BOOL GSV Sets when No Decel or SSV Command Tolerance termination type is satisfied. When blending collinear moves the bit is not set because the machine is always on path. It clears when a blend completes, the motion of a pending instruction starts, or a motion instruction executes which causes a stop. Indicates not on path. MovePendingStatus BOOL GSV The move pending bit is SSV set once a coordinated motion instruction is queued. Once the instruction has begun executing, the bit will be cleared, provided no subsequent coordinated motion instructions have been queued in the mean time.In the case of a single coordinated motion instruction, the status bit may not be detected by the user in the Logix Designer application since the transition from queued to executing is faster than the coarse update. The real value of the bit comes in the case of multiple instructions. As long as an instruction is in the instruction queue, the pending bit will Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 221 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Meaning be set. This provides the Logix Designer application programmer a means of stream-lining the execution of multiple coordinated motion instructions. Ladder logic containing coordinated motion instructions can be made to execute faster when the programmer allows instructions to be queued while a preceding instruction is executing. When the MovePendingStatus bit is clear, the next coordinated motion instruction can be executed (that is, setup in the queue). MovePendingQueueFullStatus BOOL GSV Sets when the instruction SSV queue is full. It clears when the queue has room to hold another new coordinated move instruction. TransformSourceStatus TransformTargetStatus CoorMotionLockStatus BOOL BOOL BOOL GSV The coordinate system is the SSV source of an active transform. GSV The coordinate system is the SSV target of an active transform. GSV Set when an axis lock is SSV requested for an MCLM or MCCM instruction and the axis has crossed the Lock Position. Cleared when an MCLM or MCCM is initiated. For the enumerations Immediate Forward Only and Immediate Reverse Only, the bit is set immediately when the MCLM or MCCM is initiated. When the enumeration is Position Forward Only or Position Reverse Only, the bit is set when the Master Axis crosses the Lock Position in the specified direction. The bit 222 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Meaning is never set if the enumeration is NONE. The CoordMotionLockStatus bit is cleared when the Master Axis reverses direction and the Slave Axis stops following the Master Axis. The CoordMotionLockStatus bit is set again when the Slave Coordinate System resumes following the Master Axis. The CoordMotionLockStatus bit is also cleared when an MCS is initiated. coordinateDefinition DINT GSV Coordinate Definition for the coordinates in geometry zeroAngleOffset4 REAL GSV/SSV Zero Angle Orientation for the fourth axis of non-Cartesian geometries. zeroAngleOffset5 REAL GSV/SSV Zero Angle Orientation for the fifth axis of non-Cartesian geometries. zeroAngleOffset6 REAL GSV/SSV Zero Angle Orientation for the sixth axis of non-Cartesian geometries. linkLength3 REAL GSV/SSV Linear length of the wrist link of a robot. ballScrewPitch REAL GSV/SSV Pitch of SCARA Independent Coupled Screw. ActiveToolFrameID DINT GSV/tag Active Tool Identifier specified by user in the MCTO instruction. MaxOrientationSpeed REAL GSV/SSV Maximum speed of the orientation axes of the coordinate system. MaxOrientationAccel REAL GSV/SSV Maximum acceleration of the orientation axes of the coordinate system. MaxOrientationDecel REAL GSV/SSV Maximum deceleration of the orientation axes of the coordinate system. ActiveWorkFrameID Rockwell Automation, Inc. REAL Publication 1756-RM003Z-EN-P - September 2024 GSV/Tag Active work frame 223 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Meaning SwingArmOffsetA3 REAL GSV/SSV The offset along the X-axis from the center of the bottom base plate to the Joint 4 frame for 5-axis Delta geometry. SwingArmOffsetD3 REAL GSV/SSV The offset along the Z axis from the center of the bottom base plate to the Joint 4 frame for 5-Axis Delta geometry. SwingArmOffsetA4 REAL GSV/SSV The offset along the X-axis J4 frame to the Joint 5 frame for 5-Axis Delta geometry. SwingArmOffsetD4 REAL GSV/SSV The offset along the Z-axis J4 frame to the Joint 5 frame for 5-axis Delta geometry. SwingArmOffsetD5 REAL GSV/SSV The offset along the Z-axis J5 frame to the EOA frame for 5-axis Delta geometry. SwingArmCouplingRatioNumer INT, DINT GSV/SSV ator The ratio of the rotation axis to the tilt axis. SwingArmCouplingRatioDenom INT, DINT GSV/SSV inator The ratio of the rotation axis to the tilt axis. SwingArmCouplingDirection INT, DINT GSV/SSV Relative direction of the coupled J4 rotational axis to the J5 tilt axis for Delta J1J2J3J4J5 Robot geometry. Access the CST object The coordinated system time (CST) object provides coordinated system time for the devices in one chassis. Attribute Data Type Instruction Description CurrentStatus INT GSV Current status of the coordinated system time. Each bit has a specific meaning: • 0. Timer hardware faulted. The internal timer hardware of the device is in a faulted state. • 1. Ramping enabled. The current value of the timer’s lower 16+ bits 224 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description ramp up to the requested value, rather than snap to the lower value. • 2. System time master. The CST object is a master time source in the ControlLogix system. • 3. Synchronized. The CST object’s 64-bit CurrentValue is synchronized by master CST object via a system time update. • 4. Local network master. The CST object is the local network master time source. • 5. Relay mode. The CST object is acting in a time relay mode. • 6. Duplicate master detected. A duplicate local network time master is detected. This bit is always 0 for time-dependent nodes. • 7. Unused. • 8-9. 00. Time dependent node. CurrentValue DINT[2] GSV • 01. Time master node. • 10. Time relay node. • 11. Unused. • 10-15. Unused. Current value of the timer. TIME32[2] DINT[0] contains the lower TIME 32; DINT[1] contains the upper 32 bits. The timer source is adjusted to match the value supplied in update services and from local communication network synchronization. The adjustment is either a ramping to the requested value or an immediate setting to the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 225 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description request value, as reported in the CurrentStatus attribute. Access the DF1 object The DF1 object provides an interface to the DF1 communication driver. Attribute Data Type Instruction Description ACKTimeout DINT GSV The amount of time to wait for an acknowledgment to a message transmission (point-to-point and master only). Valid value 0-32,767. Delay in counts of 20 msec periods. Default is 50 (1 second). Diagnostic INT[19] GSV Array of diagnostic counters Counters for the DF1 communication driver. Word offset 0 Signature (0x0043) DF1 point-to-point DF1 slaveMaster Signature (0x0042) Signature (0x0044) 1 Modem bits Modem bits Modem bits 2 Packets sent Packets sent Packets sent 3 Packets received Packets received Packets received 4 Undelivered packets Undelivered packets Undelivered packets 5 Unused Messages retried Messages retried 6 NAKs received NAKs received Unused 7 ENQs received Poll packets received Unused 8 Bad packets NAKed Bad packets not ACKed Bad packets not ACKed 9 No memory sent NAK No memory not ACKed Unused 10 Duplicate packets received Duplicate packets received Duplicate packets received 11 Bad characters received Unused Unused 12 DCD recoveries count DCD recoveries count DCD recoveries count 226 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Word offset 13 Lost modem count Chapter 4 Input/Output Instructions DF1 point-to-point DF1 slaveMaster Lost modem count Lost modem count 14 Unused Unused Priority scan time maximum 15 Unused Unused Priority scan time last 16 Unused Unused Normal scan time maximum 17 Unused Normal scant Unused time last ENQs sent 18 Duplicate Unused SINT GSV Detection Unused Enables duplicate message detection. Each value has a specific meaning: • 0. Duplicate message detection disabled. • Non zero. Duplicate message detection enabled. Embedded SINT GSV ResponseEnable Enables embedded response functionality (point-to-point only). Each value has a specific meaning: • 0. Initiated only after one is received. This is the default. • EnableStoreFwd SINT GSV 1. Enabled unconditionally. Enables the store and forward behavior when receiving a message. Each value has a specific meaning: • 0. Do not forward message • Non zero. See the store and forward table when receiving a message. This is the default. ENQTransmit SINT GSV Limit The number of inquiries (ENQs) to send after an ACK timeout (point-to-point only). Valid value 0-127. Default setting is 3. EOTSuppression SINT GSV Enable suppressing EOT transmissions in response to poll Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 227 Chapter 4 Input/Output Instructions Word offset DF1 point-to-point DF1 slaveMaster packets (slave only). Each value has a specific meaning: • 0. EOT suppression disabled (disabled). • Non zero. EOT suppression enabled. ErrorDetection SINT GSV Specifies the error-detection scheme. Each value has a specific meaning: MasterMessageTransmit SINT GSV • 0. BCC. This is the default. • 1. CRC. Current value of the master message transmission (master only). Each value has a specific meaning: • 0. Between station polls. This is the default. • 1. In poll sequence. This take the place of the station number of the master. MaxStation SINT GSV Address Current value (0 to 31) of the maximum node address on a DH-485 network. Default is 31. NAKReceiveLimit SINT GSV The number of NAKs received in response to a message before stopping transmission (point-to-point communication only). Valid value 0 to 127. Default is 3. NormalPollGroupSize INT GSV Number of stations to poll in the normal poll node array after polling all the stations in the priority poll node array (master only). Valid value 0 to 255. Default is 0. 228 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Word offset PollingMode SINT GSV Chapter 4 Input/Output Instructions DF1 point-to-point DF1 slaveMaster Current polling mode (master only). Default setting is 1. Each value has a specific meaning: • 0. Message-based, but don’t allow slaves to initiate messages. • 1. Message-based, but allow slaves to initiate messages. This is the default. • 2. Standard, single-message transfer per node scan. • 3. Standard, multiple-message transfer per node scan. ReplyMessage DINT GSV Wait The time (acting as a master) to wait after receiving an ACK before polling the slave for a response (master only). Valid value 0 to 65,535. Delay in counts of 20 msec periods. The default is 5 periods (100 msec). SlavePollTimeout DINT GSV The amount of time in msecs that the slave waits for the master to poll before the slave declares that it is unable to transmit because the master is inactive (slave only). Valid value 0 to 32,767. Delay in counts of 20 msec periods. The default is 3000 periods (1 minute). StationAddress INT GSV Current station address of the port. Valid value 0 to 254. Default is 0. TokenHoldFactor SINT GSV Current value (1 to 4) of the maximum number of messages sent by this node before passing the token on a DH-485 network. Default is 1. TransmitRetries SINT GSV Number of times to resend a message without getting an acknowledgment (master and slave only). Valid value 0 to 127. Default is 3. PendingACK Timeout DINT SSV Pending value for the ACKTimeout attribute. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 229 Chapter 4 Input/Output Instructions Word offset DF1 point-to-point Pending Duplicate Detection SINT SSV DF1 slaveMaster Pending value for the DuplicateDetection attribute. Pending Embedded SINT SSV Pending value for the ResponseEnable EmbeddedResponse attribute. PendingEnable SINT SSV Pending value for the StoreFwd EnableStoreFwd attribute. PendingENQ TransmitLimit SINT SSV Pending value for the ENQTransmitLimit attribute. SINT PendingEOT Suppression SSV Pending value for the EOTSuppression attribute. PendingError SINT SSV Pending value for the Detection ErrorDetection attribute. PendingMaster Message Transmit SINT SSV Pending value for the MasterMessageTransmit attribute. PendingMax SINT SSV Pending value for the StationAddress MaxStationAddress attribute. PendingNAK ReceiveLimit SINT SSV Pending value for the NAKReceiveLimit attribute. PendingNormal INT SSV Pending value for the PollGroupSize NormalPollGroupSize attribute. PendingPolling SINT SSV Pending value for the PollingMode Mode attribute. PendingReply DINT SSV Pending value for the MessageWait ReplyMessageWait attribute. PendingSlavePollTimeout DINT SSV Pending value for the SlavePollTimeout attribute. PendingStation INT SSV Pending value for the Address StationAddress attribute. PendingToken SINT SSV Pending value for the HoldFactory TokenHoldFactor attribute. SINT PendingTransmitRetries SSV Pending value for the TransmitRetries attribute. Access the FaultLog object The FaultLog object provides fault information about the controller. Attribute Data Type Instruction Description MajorEvents INT GSV SSV The number of major faults that occurred since this counter was reset. 230 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description MajorFaultBits DINT GSV SSV Individual bits indicate the reason for the current major fault. Each bit has a specific meaning: 1 Power loss 3 I/O 4 Instruction execution (program) 5 Fault Handler 6 Watchdog 7 Stack 8 Mode change 11 Motion MinorEvents INT GSV SSV The number of minor faults that occurred since this counter was reset. MinorFaultBits DINT GSV SSV Individual bits indicate the reason for the current minor fault. Each bit has a specific meaning: 4 - Instruction execution (program) 6 - Watchdog 9 - Serial port 10 - Energy Storage Module (ESM), or Uninterruptable Power Supply (UPS) 20 - License/a required CodeMeter license is missing or missing. Access the HardwareStatus object The HardwareStatus object is used to obtain status information about the UPS, fans, and temperatures with GSV instructions for the CompactLogix 5480 controller projects. This object is supported in Ladder Diagram and Structured Text routines and in Add-On Instructions. Attribute Data Type Instruction Description FanSpeeds Array of: GSV Speed of the fans. Number of Fans SINT If the number of fans supported by the product is zero, then the device does not support fans. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 231 Chapter 4 Input/Output Instructions Attribute Data Type Fan Speed Instruction SINT[9] for 2 fans: Description RPM SINT[0] = Number of fans SINT[1-4] = Fan #1 speed SINT[5-8] = Fan #2 speed FanStatus Array of: GSV Indicates whether the fan is faulted. Number of Fan Status SINT If the number of fans Indicators supported by the product is zero, then the device does not support fan status. Fan Status SINT[3] for 2 fans: • SINT[0] = Number of 0. Fan is not faulted fans • 1. Fan is faulted SINT[1] = Fan #1 status SINT[2] = Fan #2 status TemperatureFaultLevels Array of: GSV The fault level in degrees Celsius Number of Temperature SINT If the number of Fault Level temperature fault level is zero, then the device does not support temperature fault levels. Temperature Fault Level SINT[3] for 1 Temperature in degrees temperature sensor: Celsius SINT[0] = Number Temperature Fault Levels SINT[1-2] = Temperature Fault Level #1 Temperatures Array of: GSV Temperature values in degrees Celsius Number of SINT Temperatures If the number of temperatures supported by product is zero, then the device does not support temperatures. 232 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Temperature Instruction Input/Output Instructions Description SINT[3] for 1 Temperature in degrees temperature sensor: Celsius SINT[0] = Number of Temperatures SINT[1-2] = Temperature #1 UPSBatteryFailure SINT GSV Indicates whether the UPS battery has failed. • 0. The connected UPS battery has detected no faults. • 1. The connected UPS detected an issue with the connected battery. UPSBuffering SINT GSV Indicates whether the UPS is providing power from the battery. • 0. UPS is not providing power from the battery. • 1. UPS is providing power from the battery. UPSInhibited SINT GSV Requests UPS to remove power. • 0. The controller does not want power to be removed at this time. • 1. UPS is to stop providing power. UPSReady SINT GSV Indicates whether the UPS is ready based on: charged >= 85%, no wiring failure, input voltage sufficient, and inhibit signal is inactive. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 • 0. UPS not ready • 1. UPS ready 233 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description UPSSupported SINT GSV Indicates whether the UPS is supported. • 0. Not supported • 1. Supported Access the Message object Access the Message object through the GSV/SSV instructions. Specify the message tag name to determine which Message object you want. The Message object provides an interface to setup and trigger peer-to-peer communications. This object replaces the MG data type of the PLC-5 processor. Attribute Data Type Instruction Description ConnectionPath SINT[82] GSV SSV Data to setup the connection path. The first two bytes (low byte and high byte) are the length in bytes of the connection path. ConnectionRate DINT GSV SSV TIME32 MessageType SINT Requested packet rate of the connection. GSV SSV Specifies the type of message. The value has a specific meaning: • Port SINT GSV SSV 0. Not initialized Indicates which port the message should be sent on. Each value has a specific meaning: Timeout SINT Multiplier GSV SSV • 1. Backplane. • 2. Serial port. Determines when a connection should be considered timed out and closed. Each value has a specific meaning: • 0. Connection times out in four times the update rate. This is the default. • 1. Connection times out in eight times the update rate. • 2. Connection times out in 16 times the update rate. 234 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Unconnected DINT GSV SSV Timeout in microseconds for Timeout TIME32 all unconnected messages. The default is 30,000,000 microseconds (30 s). Access the Module object The Module object provides status information about a module. To select a particular Module object, set the Object Name operand of the GSV/SSV instruction to the module name. The specified module must be present in the I/O Configuration section of the controller organizer and must have a device name. Attribute Data Type Instruction Description EntryStatus INT GSV Specifies the current state of the specified map entry. The lower 12 bits should be masked when performing a comparison operation. Only bits 12...15 are valid. Each value has a specific meaning: • 16#0000. Standby. The controller is powering up. • 16#1000. Faulted. Any of the Module object’s connections to the associated module fail. This value should not be used to determine if the module failed because the Module object leaves this state periodically when trying to reconnect to the module. Instead, test for Running state (16#4000). Check for FaultCode not equal to 0 to determine if a module is faulted. When Faulted, the FaultCode and FaultInfo attributes are valid until the fault condition is corrected. • 16#2000. Validating. The Module object is verifying Module object integrity prior to Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 235 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description establishing connections to the module. • 16#3000. Connecting. The Module object is initiating connections to the module. • 16#4000. Running. All connections to the module are established and data is transferring. • 16#5000. Shutting down. The Module object is in the process of shutting down all connections to the module. • 16#6000. Inhibited. The Module object is inhibited (the inhibit bit in the Mode attribute is set). • 16#7000. Waiting. The parent object upon which this Module object depends is not running. • 16#9000. Firmware Updating. Firmware supervisor is attempting to flash the module. • 16#A000. Configuring. Controller is downloading configuration to the module. FaultCode INT GSV A number that identifies a module fault, if one occurs. FaultInfo DINT GSV Provides specific information about the Module object fault code. Firmware INT SupervisorStatus 236 Publication 1756-RM003Z-EN-P - September 2024 GSV Identifies current operating state of the firmware Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description supervisor feature. Each value has specific meaning: • 0. Module updates are not being executed. • 1. Module updates are being executed. ForceStatus INT GSV Specifies the status of forces. Each bit has specific meaning: • 0. Forces installed (1=yes, 0-no). • 1. Forces enabled (1=yes, 0=no). Instance DINT GSV Provides the instance number of this module object. LEDStatus INT GSV Specifies the current state of the I/O status indicator on the front of the controller.(1) Each value has a specific meaning: • 0. Status indicator off: No Module objects are configured for the controller. (There are no modules in the I/O Configuration section of the controller organizer.) • 1. Flashing red: None of the Module objects are Running. • 2. Flashing green: At least one Module object is not Running. • 3. Solid green: All the Module objects are Running. You do not enter an object name with this attribute because this attribute applies to the entire collection of modules. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 237 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Mode INT GSV SSV Specifies the current mode of the Module object. Each bit has a specific meaning: • 0. If set, causes a major fault to be generated if any of the Module object connections fault while the controller is in Run mode. • 2. If set, causes the Module object to enter Inhibited state after shutting down all the connections to the module. Path SINT Array GSV Specifies the path to the module being referenced. This is a new attribute starting in version 24 software. Each byte has a specific meaning: • 0-1. Length of the path in bytes. If 0, length of the SINT array is insufficient to hold the returned module path. If SINT array length is insufficient to hold the path, the array is zeroed out, and a minor fault is logged. (1) The 1756-L7x controllers do not have a status indicator display on the front of the controller, but do use this functionality. Related information Module Faults: 16#0000 - 16#00ff on page 283 Module Faults: 16#0100 - 16#01ff on page 287 Module Faults: 16#0200 - 16#02ff on page 295 Module Faults: 16#0300 - 16#03ff on page 298 Module Faults: 16#0800 - 16#08ff on page 303 Module Faults: 16#fd00 - 16#fdff on page 303 238 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Module Faults: 16#fe00 - 16#feff on page 305 Module Faults: 16#ff00 - 16#ffff on page 309 Access the Routine object The Routine object provides status information about a routine. Specify the routine name to determine which Routine object that you want. Attribute Data Type Instance DINT Instruction within Instruction within Standard Task Safety Task GSV GSV Description Provides the instance number for this routine object. Valid values are 0 through 65,535. Name String GSV GSV Name of the routine. SFCPaused INT GSV None In an SFC routine, indicates whether the SFC is paused. Each value has a specific meaning: • 0. SFC is not paused. • SFCResuming INT GSV SSV None 1. SFC is paused. In an SFC routine, indicates whether the SFC is resuming execution. Each value has a specific meaning: • 0. SFC is not executing. This attribute is automatically set to 0 at the end of a scan in which the chart was executed. • 1. SFC is executing. Step and action timers will retain their previous value if configured to do so. This attribute is automatically set to 1 on the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 239 Chapter 4 Input/Output Instructions Attribute Data Type Instruction within Instruction within Standard Task Safety Task Description first scan after a chart is no longer paused. Access the Redundancy object The REDUNDANCY object provides status information about the redundancy system. For This Information Get This Attribute Data Type Redundancy status ChassisRedundancy INT of the entire State GSV/ SSV Description GSV If Then 16#2 Primary with chassis synchronized secondary 16#3 Primary with disqualified secondary 16#4 Primary with no secondary 16#10 Primary that's locked for update Redundancy state PartnerChassis of the partner RedundancyState INT GSV If Then 16#8 Synchronized chassis secondary 16#9 Disqualified secondary with primary 16#E No partner 16#12 Secondary that's locked for update Redundancy status ModuleRedundancy INT of the controller State GSV If Then 16#2 Primary with synchronized secondary 16#3 Primary with disqualified secondary 16#4 Primary with no secondary 240 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 For This Information Get This Attribute Data Type GSV/ SSV Input/Output Instructions Description 16#6 Primary with synchronizing secondary 16#F Primary that's locking for update 16#10 Primary that's locked for update Redundancy state PartnerModule of the partner RedundancyState INT GSV If Then 16#7 Synchronizing secondary 16#8 Synchronized secondary 16#9 Disqualified secondary with primary 16#E No partner 16#11 Secondary that is locking for update 16#12 Secondary that is locked for update Results of the CompatibilityResu compatibility lts INT GSV checks with the partner controller If Then 0 Undetermined 1 No compatible partner 2 Fully compatible partner Status of the Qualification synchronization InProgress INT GSV If Then -1 Synchronization (qualification) (qualification) is not process in progress 0 Unsupported 1...999 For modules that can measure their completion percentage, the percent of synchronization (qualification) that is complete Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 241 Chapter 4 Input/Output Instructions For This Information Get This Attribute Data Type GSV/ SSV Description 50 For modules that cannot measure their completion percentage, synchronization (qualification) is in progress 100 Synchronization (qualification) is complete Keyswitch settings KeyswitchAlarm DINT GSV of the controller If Then 0 One of the following and its partner is true: match or do not The keyswitches match match No partner is present 1 keyswitches do not match Position of the PartnerKeyswitch DINT GSV keyswitch of the partner Status of the PartnerMinorFaults DINT minor faults of GSV If Then 0 Unknown 1 RUN 2 PROG 3 REM This bit Means this minor fault 1 Power-up fault ModuleRedundancy 3 I/O fault State indicates a 4 Problem with the partner (if the partner is present) an instruction (program) 6 Periodic task overlap (watchdog) 9 Problem with the serial port (not available for 1756-L7x projects) 10 Low battery or issue with the 242 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 For This Information Get This Attribute Data Type GSV/ SSV Input/Output Instructions Description energy storage module Mode of the partner PartnerMode In a pair of PhysicalChassisID DINT INT GSV GSV redundant chassis, identification of a specific chassis without regard to If Then 16#0 Power up 16#1 Program 16#2 Run 16#3 Test 16#4 Faulted 16#5 Run-to-program 16#6 Test-to-program 16#7 Program-to-run 16#8 Test-to-run 16#9 Run-to-test 16#A Program-to-test 16#B Into faulted 16#C Faulted-to-program If Then 0 Unknown 1 Chassis A 2 Chassis B the state of the chassis Slot number of the SRMSlotNumber INT GSV Size of the last LastDataTransferS DINT GSV crossload ize Redundancy module (for example, 1756-RM, 1756-RM2) in the chassis This attribute gives the size of data that was or would have been crossloaded in Size of the last the last scan. crossload if you The size in DINTs (4-byte words). had a secondary You must configure the controller for chassis redundancy. You don't need a secondary chassis. Is there a synchronized secondary chassis YES This gives the number of Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 243 Chapter 4 Input/Output Instructions For This Information Get This Attribute Data Type GSV/ SSV Description DINTs that was crossloaded in the last scan. NO This gives the number of DINTs that would have been crossloaded in the last scan Size of the biggest MaxDataTransferS crossload ize DINT GSV The size in DINTs (4-byte words). SSV You must configure the controller for Size of the biggest redundancy. crossload if you You don't need a secondary chassis. had a secondary To reset this value, use an SSV instruction chassis with a Source value of 0. Is there a synchronized secondary chassis? YES This gives the biggest number of DINTS that was crossloaded. NO This gives the biggest number of DINTs that would have been crossloaded. Access the Program object The Program object provides status information about a program. Specify the program name to determine the Program object you want. Attribute Data Type DisableFlag SINT Instruction within Instruction within Standard Task Safety Task GSV SSV None Description Controls this program’s execution. Each value has a specific meaning: • 0. Execution enabled. • Non zero. Execution disabled. 244 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type DINT Instruction within Instruction within Standard Task Safety Task GSV GSV Input/Output Instructions Description A non-zero value disables. LastScanTime DINT GSV SSV None Time to execute TIME32 program the last time it was executed. Time is in microseconds. MaxScanTime DINT GSV SSV None Maximum recorded TIME32 execution time for this program. Time is in microseconds. MajorFault DINT[11] GSV SSV GSV SSV Records major faults for Record this program. MinorFault DINT[11] GSV SSV GSV SSV Records minor faults for Record this program. Name String GSV GSV Name of the program. Tip: Rockwell Automation recommends creating a user-defined structure to simplify access to either Fault Record attribute: Name Data Type Style Description Timestamp LINT Decimal The time at which the fault occurred. Units are microseconds since Jan 1, 1970. Type INT Decimal Fault type (program, I/O, and so forth) Code INT Decimal Unique code for the fault (depends on fault type) Info DINT[8] Hexadecimal Fault specific information (depends on fault type and code) Access the MotionGroup object The MOTIONGROUP object provides status information about a group of axes for the servo module. Specify the motion-group tag name to determine which MOTIONGROUP object you want. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 245 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Alternate1UpdateMultiplier SINT, INT, or DINT GSV The update period for axes that are associated with the Alternate 1 Update Schedule. Alternate1UpdatePeriod DINT GSV The update period for axes that are associated with the Alternate 1 Update Schedule. Value is product of Alternate 1 Update Period and Coarse Update Period. Alternate2UpdateMultiplier SINT, INT, or DINT GSV The update period for axes that are associated with the Alternate 2 Update Schedule. Alternate2UpdatePeriod DINT GSV The update period for axes that are associated with the Alternate 2 Update Schedule. The value is product of Alternate 1 Update Period and Coarse Update Period. AutoTagUpdate SINT, INT, or DINT GSV Controls the automatic SSV conversion and update of Motion Status attributes. CoarseUpdatePeriod DINT GSV The Coarse Update Period commonly referred to as the Base Update Period. Cycle Start Time DINT[2] GSV This 64-bit value (ms) DT corresponds to the Timer LINT Event that starts the update cycle. INSTANCE DINT GSV The instance number of this MOTION_GROUP object MaximumInterval DINT[2] GSV The maximum interval TIME32[2] SSV between successive TIME MinimumInterval StartTime TaskAverageIOTime DINT[2] executions of this task. GSV The minimum interval between TIME32[2] successive executions of this TIME task. DINT[2] GSV The value of Wall Clock Time DT when the last execution of the LINT task was started DINT GSV The Average motion task input TIME32 SSV to output time, that is, the elapsed time from motion task 246 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description start to send of connection data. (Time Constant = 250 CUP) TaskAverageScanTime DINT GSV The average motion task scan TIME32 SSV time. (Time Constant = 250 CUP) TaskLastIOTime DINT GSV TIME32 The last motion task input to output time, that is, the elapsed time from motion task start to send of connection data. TaskLastScanTime DINT GSV TIME32 TaskMaximumIOTime The last motion task scan time. (Elapsed Time) DINT GSV The maximum motion task TIME32 SSV input to output time, that is, the elapsed time from motion task start to send of connection data. TaskMaximumScanTime Time Offset DINT GSV The maximum motion task TIME32 SSV scan time. (Elapsed Time) DINT[2] GSV The time offset value between TIME32[2] Wall Clock Time and the local TIME timer value for the controller associated with the current Cycle Start Time value. Access the Message object Access the Message object through the GSV/SSV instructions. Specify the message tag name to determine which Message object you want. The Message object provides an interface to setup and trigger peer-to-peer communications. This object replaces the MG data type of the PLC-5 processor. Attribute Data Type Instruction Description ConnectionPath SINT[82] GSV SSV Data to setup the connection path. The first two bytes (low byte and high byte) are the length in bytes of the connection path. ConnectionRate DINT TIME32 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 GSV SSV Requested packet rate of the connection. 247 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description MessageType SINT GSV SSV Specifies the type of message. The value has a specific meaning: • Port SINT GSV SSV 0. Not initialized Indicates which port the message should be sent on. Each value has a specific meaning: Timeout SINT GSV SSV • 1. Backplane. • 2. Serial port. Determines when a connection Multiplier should be considered timed out and closed. Each value has a specific meaning: • 0. Connection times out in four times the update rate. This is the default. • 1. Connection times out in eight times the update rate. • 2. Connection times out in 16 times the update rate. Unconnected DINT Timeout TIME32 GSV SSV Timeout in microseconds for all unconnected messages. The default is 30,000,000 microseconds (30 s). Access the Safety object This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The Safety Controller object provides safety status and safety signature information. The SafetyTask and SafetyFaultRecord attributes can capture information about non-recoverable faults. See the GuardLogix Controllers User Manual, publication 1756-UM020. Attribute SafetyLockedState Data Type SINT Instruction within Instruction within Standard Task Safety Task GSV None Description Indicates whether the controller is safety locked or unlocked. 248 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 SafetySILConfiguration SINT GSV None Input/Output Instructions Specifies the safety SIL configuration. SafetyStatus INT GSV None • 2 -- SIL2/PLd • 3 -- SIL3/PLe Specifies the safety status. Each value has a specific meaning: : • 1000000000000 000 -- Safety task OK. • 1000000000000 001 -- Safety task inoperable. • 00000000000000 000 -- Partner missing. • 00000000000000 001 -- Partner unavailable. • 00000000000000 010 -- Hardware incompatible. • 00000000000000 011 -- Firmware incompatible. SafetySignature SINT GSV GSV Exists Indicates whether the safety task signature is present. SafetySignature SINT GSV None ID 32-bit identification number. (Applicable to Compact GuardLogix 5370, and GuardLogix 5570 controllers only) SafetySignature String GSV None 32-bit identification (Applicable to Compact number includes ID GuardLogix 5370, number plus date and and GuardLogix 5570 time stamp. controllers only) SafetyTaskFault DINT[11] GSV None Record faults. SafetySignatureIDLong Rockwell Automation, Inc. Records safety task SINT[33] GSV None 32 byte Safety signature (Applicable to Compact ID in byte array. The 1st GuardLogix 5380 and byte is the size of of the Publication 1756-RM003Z-EN-P - September 2024 249 Chapter 4 Input/Output Instructions GuardLogix 5580 safety signature ID in controllers only) bytes and remaining 31 bytes is the signature ID. SafetySignatureIDHex String GSV None 64 character (Applicable to Compact Hexadecimal string GuardLogix 5380 and representation of GuardLogix 5580 signature ID controllers only) SafetySignatureDateT String GSV None 27 character date ime time of a safety (Applicable to Compact signature in the GuardLogix 5380 and format of mm/dd/yyyy, GuardLogix 5580 hh:mm:ss.iii<AM or PM> controllers only). Access the Task object The TASK object provides status information about a task. Specify the task name to determine which TASK object you want. Attribute Data Type DisableUpdateOutp DINT uts Instruction within Instruction within Standard Task Safety Task GSV None Description Enables or disables the processing of outputs at the end of a task. SSV • Set the attribute to 0 to enable the processing of outputs at the end of the task. • Set the attribute to 1 (or any non-zero value) to disable the processing of outputs at the end of the task. EnableTimeOut DINT GSV None Enables or disables the timeout function of an event task. SSV • Set the attribute to 0 to disable the timeout function. • Set the attribute to 1 (or any non-zero value) to enable the timeout function. InhibitTask DINT GSV SSV 250 Publication 1756-RM003Z-EN-P - September 2024 None Prevents the task from executing. If a task is inhibited, the controller still prescans the task when the controller Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction within Instruction within Standard Task Safety Task Input/Output Instructions Description transitions from Program mode to Run or Test mode. • Set the attribute to 0 to enable the task • Set the attribute to 1 (or any non-zero value) to inhibit (disable) the task Instance DINT GSV GSV Provides the instance number of this TASK object. Valid values are 0...31. LastScanTime DINT TIME32 MaxInterval DINT[2] TIME32[2] TIME GSV None the last time it was executed. Time is in SSV GSV Time it took to execute this program microseconds. None The maximum time interval between successive executions of the task. SSV DINT[0] contains the lower 32 bits of the value; DINT[1] contains the upper 32 bits of the value. A value of 0 indicates 1 or less executions of the task. MaxScanTime DINT TIME32 MinInterval DINT[2] TIME32[2] TIME GSV None this program. Time is in microseconds. SSV GSV Maximum recorded execution time for None The minimum time interval between successive executions of the task. SSV DINT[0] contains the lower 32 bits of the value; DINT[1] contains the upper 32 bits of the value. A value of 0 indicates 1 or less executions of the task. Name String GSV GSV Name of the task. OverlapCount DINT GSV GSV The number of times that the task was SSV SSV triggered while it was still executing. Valid for an event or periodic task. To clear the count, set the attribute to 0. Priority INT GSV GSV to the other tasks. SSV Rate DINT GSV SSV Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 Relative priority of this task as compared Valid values 0...15. GSV The time interval between executions of the task. Time is in microseconds. 251 Chapter 4 Input/Output Instructions Attribute Data Type StartTime DINT[2] DT LINT Instruction within Instruction within Standard Task Safety Task GSV None Description Value of WALLCLOCKTIME when the last execution of the task was started. SSV DINT[0] contains the lower 32 bits of the value; DINT[1] contains the upper 32 bits of the value. Status DINT GSV None Provides status information about the task. Once the controller sets one of these SSV bits, you must manually clear it. To determine if: • an EVENT instruction triggered the task (event task only), examine bit 0 • a timeout triggered the task (event task only), examine bit 1 • an overlap occurred for this task, examine bit 2 SynchronizeRedund DINT GSV Indicates if runtime tag crossloading None for standard tasks is enabled in a ancyDataDisabled redundancy application. • 0 indicates that tag crossloading for the standard tasks is enabled. • 1 indicates that tag crossloading for the standard tasks is disabled. Watchdog DINT GSV GSV Time limit for execution of all programs associated with this task. Time is in SSV microseconds. If you enter 0, these values are assigned: Time: Task Type: 0.5 sec periodic 5.0 sec continuous Access the TimeSynchronize object The TIMESYNCHRONIZE object provides a Common Industrial Protocol (CIP) interface to the IEEE 1588 (IEC 61588) Standard for a precision clock synchronization protocol for networked measurement and control systems. Access the TIMESYNCHRONIZE object through the GSV/SSV instructions. For more information about this object, refer to the Deploying Scalable Time Distribution within a Converged Plantwide Ethernet Architecture Design Guide. Attribute Data Type Instruction Description ClockType INT GSV The type of clock. Bit 252 Publication 1756-RM003Z-EN-P - September 2024 Type of Clock Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description 0 Ordinary Clock 1 Boundary Clock 2 Peer-to-peer transparent clock 3 End-to-end transparent clock 4 Management Node All other bits are reserved. CurrentTimeMicroseco DINT[2] nds DT GSV Current value of System Time in microseconds. GSV Current value of System Time in nanoseconds. GSV The PTP clock domain. The value is between LINT CurrentTimeNanoseco LINT nds LDT DomainNumber SINT 0...255. The default is 0. CurrentTimeMicroseco LINT nds DINT CurrentTimeNanoseco LINT nds LDT DomainNumber SINT GSV Current value of System Time in microseconds. GSV Current value of System Time in nanoseconds. GSV The PTP clock domain. The value is between 0...255. The default is 0. GrandMasterClockInfo Structure GSV Property information about the grandmaster clock. Requires 24 bytes of storage. Grandmaster Clock Information structure: ClockIdentity SINT[8] ClockClass INT TimeAccuracy INT OffsetScaledLogVaria INT nce CurrentUtcOffset INT TimePropertyFlags INT TimeSource INT Priority1 INT Priority2 INT IsSynchronized DINT LocalClockInfo Rockwell Automation, Inc. Structure GSV GSV Publication 1756-RM003Z-EN-P - September 2024 Local clock is synchronized with a master. Value Meaning 0 Not synchronized 1 Synchronized Property information about the local clock. 253 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Requires 20 bytes of storage. Local Clock Information structure: ClockIdentity SINT[8] ClockClass INT TimeAccuracy INT OffsetScaledLogVaria INT nce CurrentUtcOffset INT TimePropertyFlags INT TimeSource INT ManufactureIdentity DINT GSV The IEEE OUI (Organization Unique Identity) for the manufacturer. MaxOffsetFromMaster LINT GSV / SSV Maximum offset from master in nanoseconds. GSV Average path delay from master to local clock in DINT MeanPathDelayToMaster LINT DINT nanoseconds. NumberOfPorts INT GSV The number of ports of this clock. OffsetFromMaster LINT GSV The calculated difference between the local clock DINT and the master clock, based on the most recent Sync message, in nanoseconds. PTPEnable DINT GSV / SSV The enable status for CIP Sync/PTP/Time Synchronization on the device. ParentClockInfo Structure GSV Value Meaning 0 Disable 1 Enable Property information about the parent clock. Requires 16 bytes of storage. Parent Clock Information structure: ClockIdentity SINT[8] PortNumber INT ObservedOffsetScaledLo INT gVariance ObservedPhaseChangeR DINT ate PortEnableInfo Structure GSV The port enable configuration of each port on the device. Size = 2 + (No. of Enabled Ports x 4) Maxsize = 42 bytes 254 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Instruction Input/Output Instructions Description Port Enable status structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT PortEnable INT PortLogAnnounceInterv Structure GSV alInfo The interval between successive "Announce" messages issued by a master clock on each PTP port of the device. Size = 2 + (No. of Enabled Ports x 4) Maxsize = 42 bytes Port Log Announce Interval structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT PortLogAnnounceInter INT val PortLogSyncIntervalInfo Structure GSV The interval between successive Sync messages issued by a master on each PTP port of the device. Size = 2 + (No. of Enabled Ports x 4) Maxsize = 42 bytes Port Log Sync Interval structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT PortLogAnnounceInter INT val PortPhysicalAddressInfo Structure GSV The physical and protocol address of each port of the device. Size = 2 + (No. of Enabled Ports x 36) Maxsize = 362 byts Port Physical Address structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT Protocol SINT[16] SizeOfAddress INT Port Address SINT[16] PortProfileIdentityInfo Structure GSV Profile of each port of the device. Size = 2 + (No. of Enabled Ports x 10) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 255 Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description Maxsize = 102 Port Profile Identity structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT ClockIdentity SINT[8] PortProtocolAddressInfo Structure GSV The network and protocol address of each port of the device. Size = 2 + (No. of Enabled Ports x 22) Maxsize = 222 Port Protocol Address structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT NetworkProtocol INT SizeOfAddress INT PortAddress SINT[16] PortStateInfo Structure GSV The current state of each PTP port on the device. Size = 2 + (No. of Enabled Ports x 4) Maxsize = 42 bytes Port State structure: NumberOfPorts INT Maximum number of ports is 10. Structure repeated for the number of ports: PortNumber INT PortState INT Priority1 SINT GSV / SSV Priority1 (Master Override) value for the local clock. Note: Value is Unsigned. Priority2 SINT GSV / SSV Priority2 (Tie Breaker) value for the local clock. Note: Value is Unsigned. ProductDescription Structure GSV Product description of the device that contains the clock. Requires 68 bytes of storage. Product Description structure: Size DINT Description SINT[64] RevisionData Structure GSV Revision data of the device that contains the clock. Requires 36 bytes of storage. 256 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Attribute Data Type Input/Output Instructions Instruction Description GSV The number of CIP Sync Regions between the local Revision Data structure: Size DINT Revision SINT[32] StepsRemoved INT clock and the grandmaster (that is, the number of boundary clocks +1) SystemTimeAndOffset Structure GSV System time in microseconds and the offset to the local clock value. System Time and Offset structure: SystemTime LINT DINT SystemOffset LINT DINT UserDescription Structure GSV User description of the device that contains the clock. Requires 132 bytes of storage. User Description structure: Size DINT Description SINT[128] Access the WallClockTime object The WallClockTime object provides a timestamp that the controller can use for scheduling. Tip: Setting the WALLCLOCKTIME object is limited to no more than one update every 15 seconds. IMPORTANT: To ensure proper time is read using the GSV instruction, include the WALLCLOCKTIME GSV in only one user task. IMPORTANT: To ensure proper time is read using the GSV instruction, place the UID/UIE instruction pair around the WALLCLOCKTIME GSV instances in user tasks that can be interrupted by WALLCLOCKTIME GSV instances in other tasks. No UID/UIE pair is required when the WALLCLOCKTIME GSV exists in only one user task. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 257 Chapter 4 Input/Output Instructions IMPORTANT: When disabling PTP on a controller, to give the controller time to process the disable, use a twosecond delay before setting the WallClockTime (WCT) in the controller. Otherwise, there is a risk of the grandmaster clock overwriting the WCT. Attribute Data Type Instruction Description ApplyDST SINT GSV SSV Identifies whether to enable daylight savings time. Each value has a specific meaning: • 0. Do not adjust for daylight savings time. • Non zero. Adjust for daylight savings time. CSTOffset DINT[2] GSV SSV Positive offset from the TIME32[2] CurrentValue of the CST object TIME (coordinated system time). Value in microseconds. The default is 0. CurrentValue DINT[2] GSV SSV Current value of the wall DT clock time. The number of LINT microseconds elapsed since 0000 hours 1 January 1970. Note: You can set this value to no later than 12/29/2068. The CST and WALLCLOCKTIME objects are mathematically related in the controller. For example, if adding the CST CurrentValue and the WALLCLOCKTIME CSTOffset, the result is the WALLCLOCKTIME CurrentValue. DateTime DINT[7] DATETIMESTRUCT GSV SSV The date and time. Each value has a specific meaning: • DINT[0]. Year • DINT[1]. Month (1...12) • DINT[2]. Day (1...31) • DINT[3]. Hour (0...23) • DINT[4]. Minute (0...59) • DINT[5]. Seconds (0...59) • DINT[6]. Microseconds (0...999,999) 258 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Attribute Data Type Instruction Description DSTAdjustment INT GSV SSV The number of minutes to adjust for daylight saving time. LocalDateTime DINT[7] GSV SSV DATETIMESTRUCT Current adjusted local time. Each value has a specific meaning: • DINT[0]. Year • DINT[1]. Month (1...12) • DINT[2]. Day (1...31) • DINT[3]. Hour (0...23) • DINT[4]. Minute (0...59) • DINT[5]. Seconds (0...59) • DINT[6]. Microseconds (0...999,999) TimeZoneString INT GSV SSV Time zone for the time value. Determine Controller Memory Information This is information is not applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers. In these controllers, the memory used attributes are not supported or accesible. The memory of the controller is divided into I/O memory and expansion memory. This table shows how the controller uses each type of memory: This Uses memory from I/O tags I/O memory produced tags consumed tags communication via MSG instructions communication with workstations tags other than I/O, produced, or consumed tags expansion memory logic routines communication with polled (OPC/DDE) tags that I/O memory and expansion memory use RSLinx Classic. Note that the controller returns values in the number of 32-bit words. To see a value in bytes, simply multiply by 4.Use this procedure to get the following information about the controller's memory: Rockwell Automation, Inc. • available (free) I/O and expansion memory • total I/O and expansion memory • largest contiguous block of I/O and expansion memory Publication 1756-RM003Z-EN-P - September 2024 259 Chapter 4 Input/Output Instructions Get Memory Information From the ControllerTo get memory information from the controller, execute a Message (MSG) instruction that is configured as follows:From the Message Properties dialog - Configuration tab: 260 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions From the Message Properties dialog - Communication tab: Choose the Memory Information You WantThe MSG instruction returns the following information to INT_array (the destination tag of the MSG instruction). IMPORTANT: For a 1756-L55M16 controller, the MSG instruction returns two values for each expansion memory category. To determine the free or total expansion memory of a 1756-L55M16 controller, add both values for the category. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 261 Chapter 4 Input/Output Instructions Convert INTs to a DINTThe MSG instruction returns each memory value as two separate INTs. • The first INT represents the lower 16 bits of the value. • The second INT represents the upper 16 bits of the value. To convert the separate INTs into one usable value, use a Copy (COP) instruction, where: In this operand: Specify: Which means: Source first INT of the 2 element pair (lower 16 Start with the lower 16 bits bits) Destination DINT tag in which to store the 32-bit value Copy the value to the DINT tag Length 1 Copy 1 times the number of bytes in the Destination data type. In this case, the instruction copies 4 bytes (32 bits), which combines the lower and upper 16 bits into one 32-bit value. DeviceNet Status Codes The following are the DeviceNet Status Codes. Status Code Description of Status Recommended Action 0-63 DeviceNet node address of scanner or None. slave device. 65 The AutoScan option is on and the None. scanner is in idle mode. 67 Scanner is Secondary scanner. None. 68 Primary scanner has detected no Configure another scanner to be the Secondary scanner. Secondary scanner. Primary and Secondary configurations Check configuration of the Secondary are mismatched. scanner. 69 262 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Status Code Description of Status Recommended Action 70 The address of the scanner is already in Change the address of the scanner to an use by another device on the network. unused address. Invalid data in scan list. Use RSNetWorx software to reconfigure 71 the scan list. 72 Slave device stopped communicating. If • communication is not reestablished with the slave device during the next attempt, Verify slave device’s power and network connections. • If slave device is polled, verify that interscan delay time is adequate for status code will change to 78. the device to return data. • Verify that slave device is functioning properly. 73 Slave device’s identity information does • not match electronic key in scanner. Make sure that the correct slave device is connected at this address. • Make sure that the slave device matches the specified electronic key (vendor, product code, product type). • Verify that slave device is functioning properly. 74 Scanner detected data overrun on • DeviceNet communication port. Check network communication traffic. • Verify that slave device is functioning properly. 75 Either or both of the following are Verify that the scanner has the following. present. • A configured scan list. • A properly-wired connection to the • The scanner does not have a scan list. • network. The scanner has not received communication from any other device. 76 No direct network traffic for scanner. None. The scanner hears other network communication but does not hear any directed to it. 77 During initialization, the data size • Use RSNetWorx software to check expected by the slave device does not the slave device and the scan list for match the size in the corresponding scan the correct input and output sizes list entry. for the slave device. • Verify that slave device is functioning properly. 78 Slave device is configured in scan list, but • Verify slave device’s power and is not communicating. network connections. • If the slave device is polled, make sure the interscan delay is long Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 263 Chapter 4 Input/Output Instructions Status Code Description of Status Recommended Action enough for the slave device to return its data. • If needed, use RSNetWorx software to perform the following. ◦ Add the slave device to the DeviceNet network. ◦ Delete the slave device from scanner’s scan list. ◦ Inhibit the slave device in the scanner’s scan list. • Verify that slave device is functioning properly. 79 Scanner has failed to transmit a • message. 80 Scanner is in idle mode. Make sure that the scanner is connected to a valid network. • Check for disconnected cables. • Verify network baud rate. If desired, put scanner in run mode by doing the following. • Putting the controller in run/remote run mode using the keyswitch on the controller or through the Logix Designer application AND • Turning on bit O.CommandRegister.Run for the scanner. 81 264 Controller has set the scanner to faulted Bit O.CommandRegister.Fault for the mode. scanner is on. Correct condition that Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Status Code Description of Status Input/Output Instructions Recommended Action caused controller to set this bit and then turn this bit off. 82 Error detected in sequence of fragmented • Use RSNetWorx software to perform I/O messages from slave device. the following. ◦ Check scan list entry for the slave device to make sure that its input and output data sizes are correct. ◦ Check the configuration of the slave device. • Verify that slave device is functioning properly. 83 Slave device returns error responses • Use RSNetWorx software to perform when the scanner attempts to the following. communicate with it. ◦ Check the accuracy of the scan list. ◦ Check the configuration of the slave device. The slave device may be in another scanner’s scan list. • Cycle power to the slave device. • Verify that slave device is functioning properly. 84 Scanner is initializing the DeviceNet None. This code clears itself once the network. scanner attempts to initialize all the slave devices on the network. 85 86 During runtime, the data size sent by the Since variable length poll data is not slave device does not match the size in supported, verify that the slave device is the corresponding scan list entry. functioning properly. The slave device is in idle mode or not • producing data while the scanner is in run mode. Check the configuration and status of the slave device. • If you set up a master/slave relationship between 2 scanners, make sure both scanners are in run mode. 87 Scanner cannot listen to shared • inputs from slave device because the owning scanner has not established communication with that slave device. 88 Verify the owning scanner connection and configuration. • Slave device may not be producing data. Scanner cannot listen to shared In this scanner, reconfigure the I/O inputs from slave device because I/O parameters for the shared inputs scan parameters (for example, polled or list entry so that they match those same strobed, electronic key, data size) for that parameters in the owning scanner. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 265 Chapter 4 Input/Output Instructions Status Code Description of Status Recommended Action slave device are configured differently between this scanner and the owning scanner. 89 Scanner failed to configure a slave device Make sure that you installed a compatible using the Automatic Device Recovery slave device. (ADR) parameters. 90 Controller has set the scanner to disabled If desired, enable the mode. scanner by turning off bit O.CommandRegister.DisableNetwork for the scanner. 91 Bus-off condition likely due to cable or • signal errors. Cycle power to the scanner, slave device(s), and/or network. • Verify that all devices are set to the same baud rate. • Check DeviceNet cabling to make sure no short circuits exist between CAN (blue and white) wires and power or shield (black, red, and shield) wires. • Check the media system for the following noise sources. ◦ Device located near high-voltage power cable. ◦ Incorrect or no termination resistor used. ◦ • Improper grounding. Device on network producing noise or incorrect data on the network. 92 DeviceNet cable not supplying power to • the scanner’s communication port. Verify the network’s 24V dc power supply is operating properly. • Verify good cable condition. • Check cable connections to the scanner. 95 The scanner’s firmware is being updated None. Do not disconnect the scanner or a configuration is being downloaded. while the update is in process, otherwise, existing data in scanner memory will be lost. 97 The controller has placed the scanner in Bit O.CommandRegister.HaltScanner for halt mode. the scanner is on. Turn this bit off and then cycle scanner power. 266 98 General firmware error. Replace device. 99 System failure. Replace device. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Get and Set System Data The controller stores system data in objects. There is no status file, as in the PLC-5 controller. Use the GSV/SSV instructions get and set controller system data that is stored in objects: • The GSV instruction retrieves the specified information and places it in the destination. • The SSV instruction sets the specified attribute with data from the source. Attention: Use the SSV instruction carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. To get or set a system value: 1. Open the Logix Designer application project. 2. From the Help menu, click Contents. 3. Click Index. 4. Type gsv/ssv objects and click Display. 5. Click the required object. To get or set Click axis of a servo module AXIS system overhead time slice CONTROLLER physical hardware of a controller CONTROLLERDEVICE coordinated system time for the devices in one chassis CST fault history for a controller FAULTLOG attributes of a message instruction MESSAGE status, faults, communication path, and mode of a module MODULE group of axes MOTIONGROUP fault information or scan time for a program PROGRAM instance number of a routine ROUTINE properties or elapsed time of a task TASK wall clock time of a controller WALLCLOCKTIME time synchronization status of a controller TIMESYNCHRONIZE 6. In the list of attributes for the object, identify the attribute that you want to access. 7. Create a tag for the value of the attribute. If the data type of the attribute is Then one element (e.g., DINT) Create a tag for the attribute. more than one element (e.g., DINT[7]) Create a user-defined data type that matches the organization of data used by the attribute. Then create a tag for the attribute and use the data type you created. 8. Rockwell Automation, Inc. In your ladder logic routine, enter the appropriate instruction. Publication 1756-RM003Z-EN-P - September 2024 267 Chapter 4 Input/Output Instructions 9. To Enter this instruction get the value of an attribute GSV set the value of an attribute SSV Assign the required operands to the instruction. Refer to the GSV/SSV instruction for information on these operands. GSV/SSV Programming Example The following examples use GSV instruction to get fault information. Example 1: Getting I/O Fault Information This example gets fault information from the I/O module disc_in_2 and places the data in a user-defined structure disc_in_2_info. Ladder Diagram Structured Text GSV(MODULE,disc_in_2,FaultCode,disc_in_2_info.FaultCode); GSV(MODULE,disc_in_2,FaultInfo,disc_in_2_info.FaultInfo); GSV(MODULE,disc_in_2,Mode,disc_in_2_info.Mode); Example 2: Getting Program Status Information This example gets status information about program discrete and places the data in a user-defined structure discrete_info. 268 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Ladder Diagram Structured Text GSV(PROGRAM,DISCRETE,LASTSCANTIME,discrete_info.LastScanTime); GSV(PROGRAM,DISCRETE,MAXSCANTIME,discrete_info.MaxScanTime); Example 3: Getting Task Status Information This example gets status information about task IO_test and places the data in a user-defined structure io_test_info. Ladder Diagram Structured Text GSV(TASK,IO_TEST,LASTSCANTIME,io_test_info.LastScanTime); GSV(TASK,IO_TEST,MAXSCANTIME,io_test_info.MaxScanTime); GSV(TASK,IO_TEST,WATCHDOG,io_test_info.Watchdog); Setting Enable and Disable Flags The following example uses the SSV instruction to enable or disable a program. You could also use this method to enable or disable an I/O module, which is a program solution similar to using inhibit bits with a PLC-5 processor. Based on the status of SW.1, place the appropriate value in the disable flag attribute of program discrete. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 269 Chapter 4 Input/Output Instructions Ladder Diagram Structured Text IF SW.1 THEN discrete_prog_flag := enable_prog; ELSE discrete_prog_flag := disable_prog; END_IF; SSV(PROGRAM,DISCRETE,DISABLEFLAG,discrete_prog_flag); Inhibiting and Uninhibiting FirmwareSupervisor Automatic Firmware Update The following example uses the GSV/SSV instruction to inhibit or uninhibit the Automatic Firmware Update attribute of the controller. If you write a value of 1, it inhibits the feature. If you write a value of 0, the feature is uninhibited. The status of the attribute can also be read with a GSV. Ladder Diagram 270 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions GSV/SSV Objects When entering a GSV/SSV instruction, specify the object and its attribute to access. In some cases, there will be more than one instance of the same type of object. Be sure to specify the object name. For example, each task has its own TASK object that requires specifying the task name to gain access. IMPORTANT: The SSV attributes must be uploaded to be saved to the project. IMPORTANT: For the GSV instruction, only the specified size of data is copied to the destination. For example, if the attribute is specified as a SINT and the destination is a DINT, only the lower 8 bits of the DINT destination are updated, leaving the remaining 24 bits unchanged. IMPORTANT: The alarm buffer was removed from the subscription functions for alarming in the v21 firmware, and is no longer available. GSV instructions that previously referenced the alarm buffer attribute are invalidated when verifying the project. It is the responsibility of the programmer to correctly change any application code that relied on this attribute. These are the GSV/SSV objects. The objects available for access are dependent on the controller. Rockwell Automation, Inc. • AddOnInstructionDefinition on page 196 • Axis on page 200 Publication 1756-RM003Z-EN-P - September 2024 271 Chapter 4 Input/Output Instructions • Controller on page 212 • ControllerDevice on page 215 • CoordinateSystem on page 219 • CST on page 224 • DF1 on page 226 • FaultLog on page 230 • HardwareStatus on page 231 • Message on page 234 • Module on page 234 • MotionGroup on page 245 • Program on page 244 • Redundancy on page 240 • Routine on page 239 • Safety on page 248 • Task on page 250 • TimeSynchronize on page 252 • WallClockTime on page 257 GSV/SSV Safety Objects For safety tasks, the GSV and SSV instructions are more restricted. Tip: SSV instructions in safety and standard tasks cannot set bit 0 (major fault on error) in the mode attribute of a safety I/O module. For safety objects, the following table shows which attributes you can get values for using the GSV instruction and which attributes you can set using the SSV instruction in safety and standard tasks. WARNING: CAUTION: Use the GSV/SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel. Safety Object Attribute Name Attribute Description Accessible from the Safety Task GSV Safety Task Instance SSV Accessible from the Standard Task GSV SSV Provides instance number of this task object. Valid values are 0...31. MaximumInter The max time val interval between successive 272 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Safety Object Attribute Name Attribute Description Accessible from the Safety Task Input/Output Instructions Accessible from the Standard Task executions of this task. MaximumScanT Max recorded ime execution time (ms) for this task. MinimumInterval The min time interval between successive executions of this task. Priority Relative priority of this task as compared to other tasks. Valid values are 0...15. Rate Period for the task (in ms), or timeout value for the task (in ms). Watchdog Time limit (in ms) for execution of all programs associated with this task. DisableUpdateO Enables or utputs disables the processing of outputs at the end of a task. • Set the attribute to 0 to enable the processing of outputs at the end of the task. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 273 Chapter 4 Input/Output Instructions Safety Object Attribute Name Attribute Description • Accessible from the Safety Task Accessible from the Standard Task Set the attribute to 1 (or any non-zero value) to disable the processing of outputs at the end of the task. EnableTimeOut Enables or disables the timeout function of a task. • Set the attribute to 0 to disable the timeout function. • Set the attribute to 1 (or any non-zero value) to enable the timeout function. InhibitTask Prevents the task from executing. If a task is inhibited, the controller still prescans the task when the controller transitions from Program mode 274 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Safety Object Attribute Name Attribute Description Accessible from the Safety Task Input/Output Instructions Accessible from the Standard Task to Run or Test mode. • Set the attribute to 0 to enable the task • Set the attribute to 1 (or any non-zero value) to inhibit (disable) the task LastScanTime Time it took to execute this program the last time it was executed. Time is in microseconds. Name The name of the task OverlapCount The number of times that the task was triggered while it was still executing. Valid for an event or periodic task. To clear the count, set the attribute to 0. StartTime Value of WALLCLOCKTIME when the last execution of the task was started. DINT[0] contains the lower 32 bits Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 275 Chapter 4 Input/Output Instructions Safety Object Attribute Name Attribute Description Accessible from the Safety Task Accessible from the Standard Task of the value; DINT[1] contains the upper 32 bits of the value. Status Provides status information about the task. Once the controller sets one of these bits, you must manually clear it. To determine if: • an EVENT instruction triggered the task (event task only), examine bit 0 • a timeout triggered the task (event task only), examine bit 1 • an overlap occurred for this task, examine bit 2 Safety Program Instance Provides the instance number of the program object. MajorFaultRec Records major ord faults for this program. 276 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Safety Object Attribute Name Attribute Description MaximumScanT Max recorded ime execution time Accessible from the Safety Task Input/Output Instructions Accessible from the Standard Task (ms) for this program. Disable Flag Controls this program’s execution. Each value has a specific meaning: • 0. Execution enabled. • Non zero. Execution disabled. MaximumScanT Maximum ime recorded execution time (ms) for this program. Minor Fault Records minor Record faults for this program. LastScanTime Time it took to execute this program the last time it was executed. Time is in microseconds. Name The name of the task. Safety Routine Instance Provides the instance number for this routine object. Valid values are 0...65,535. Safety SafetyLockedSt Indicates Controllers ate (SINT) whether the controller is Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 277 Chapter 4 Input/Output Instructions Safety Object Attribute Name Attribute Description Accessible from the Safety Task Accessible from the Standard Task safety-locked or -unlocked. SafetySILConfig Specifies the uration (SINT) safety SIL configuration as: • 2= SIL2/PLd • 3= SIL3/PLe SafetyStatus Applications (INT) configured (Applicable for SIL3/PLe, to Compact specify the GuardLogix safety status as: 5380 and • Safety GuardLogix 5580 task OK. controllers only). (110000000 0000000) • Safety task inoperable. (110000000 0000011) • Partner missing. (01000000 0000000 00) • Partner unavailab le. (01000000 0000000 01) • Hardware incompati ble (01000000 0000000 10) • Firmware incompatib 278 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Safety Object Attribute Name Attribute Description Accessible from the Safety Task Input/Output Instructions Accessible from the Standard Task le. (01000000 000000011) Tip: For applications configured for SIL2/PLd, bits 15, 0, and 1 should be ignored if they can be different values based on the slot +1 of the Primary Controller. See the above status for meaning. Applications configured for SIL2/PLd, specify the safety task as: • Safety task OK (x1000000 000000xx) • Safety task inoperable (x1000000 0000001xx) SafetyStatus Specifies the (INT) safety status as: (Applicable • Safety to Compact task OK. GuardLogix (10000000 5370 and 00000000) GuardLogix 5570 • Safety task controllers only). inoperable. (10000000 00000001) • Partner missing. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 279 Chapter 4 Input/Output Instructions Safety Object Attribute Name Attribute Description Accessible from the Safety Task Accessible from the Standard Task (00000000 00000000) • Partner unavailab le. (00000000 00000001) • Hardware incompati ble (00000000 00000010) • Firmware incompatib le. (00000000 00000011) SafetySignature Indicates Exists (SINT) whether the safety signature is present. SafetySignatur 32-bit eID (DINT) identification (Applicable number. to Compact GuardLogix 5370, and GuardLogix 5570 controllers only) SafetySignature ID number plus (String) date and time (Applicable stamp. to Compact GuardLogix 5370, and GuardLogix 5570 controllers only) SafetyTaskFault Records safety Record (DINT) task faults. SafetySignatureI The first byte is DLong SINT [33] the size of the safety signature 280 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Safety Object Attribute Name Attribute Description (Applicable ID in bytes and to Compact the remaining GuardLogix 32 bytes contain 5380 and the content Accessible from the Safety Task Input/Output Instructions Accessible from the Standard Task GuardLogix 5580 of the 32-byte controllers only) Safety signature ID. SafetySignatureI 64 character DHex(String) Hexadecimal (Applicable sting to Compact representation GuardLogix of signature ID 5380 and GuardLogix 5580 controllers only) SafetySignature 27 character DateTime(String) date time of a (Applicable safety signature to Compact in the format of GuardLogix mm/dd/yyyy, 5380 and hh:mm:ss.iii<AM GuardLogix 5580 or PM> controllers only) Monitor Status Flags The controller supports status keywords you can use in your logic to monitor specific events: • The status keywords are not case sensitive. • Because the status flags can change so quickly, the Logix Designer application does not display the status of the flags (that is, even when a status flag is set, an instruction that references that flag is not highlighted). • You cannot define a tag alias to a keyword. You can use these keywords: To determine if: Use: the value you are storing cannot fit into the destination because S:V it is either: • greater than the maximum value for the destination, or • less than the minimum value for the destination Important: Each time S:V goes from cleared to set, it generates a minor fault (type 4, code 4) Rockwell Automation, Inc. the instruction’s destination value is 0 S:Z the instruction’s destination value is negative S:N Publication 1756-RM003Z-EN-P - September 2024 281 Chapter 4 Input/Output Instructions To determine if: Use: an arithmetic operation causes a carry or borrow that tries to S:C use bits that are outside of the data type For example: • adding 3 + 9 causes a carry of 1 • subtracting 25 - 18 causes a borrow of 10 this is the first, normal scan of the routines in the current S:FS program at least one minor fault has been generated: • S:MINOR The controller sets this bit when a minor fault occurs due to program execution. • The controller does not set this bit for minor faults that are not related to program execution, such as battery low. Select the Message Type After entering the MSG instruction and specifying the MESSAGE structure, select the Configuration tab of the Message Configuration dialog to specify the details of the message. The Configuration tab also includes a check box for setting and clearing the .TO bit. The details you configure depend on the message type you select. If the target device is a: Select one of these message types: Logix 5000 controller CIP data table read CIP data table write I/O module that you configure using the Logix Designer application PLC-5® controller* Module Reconfigure CIP Generic PLC-5 typed read PLC-5 typed write PLC-5 word range read PLC-5 word range write SLC™ controller* SLC typed read MicroLogix™ controller* SLC typed write Block transfer module* block transfer read block transfer write PLC-3® processor* PLC-3 typed read PLC-3 typed write PLC-3 word range read 282 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 If the target device is a: Input/Output Instructions Select one of these message types: PLC-3 word range write PLC-2® processor* PLC-2 unprotected read PLC-2 unprotected write * When redundancy is enabled for ControlLogix 5580 or GuardLogix 5580 controllers, these message types are not supported. Specify this configuration information: In this field: Specify: Source Element If you select a read message type, the Source Element is the address of the data you want to read in the target device. Use the addressing syntax of the target device. If you select a write message type, the Source Tag is the first element of the tag that you want to send to the target device. I/O structure tags and Booleans are not supported. All other data types, for example INT, DINT, can be used. Number of Elements The number of elements you read/write depends on the message type and on the type of data you are using. For "word range" and "unprotected" messages, the size of an element is indicated in the dialog box. For CIP and "typed" messages, an element is a single element of the array that you specify as the source of a write or destination of a read Destination Element If you select a read message type, the Destination Tag is the first element of the tag in the Logix 5000 controller where you want to store the data you read from the target device. If you select a write message type, the Destination Element is the address of the location in the target device where you want to write the data. Module Faults: 16#0000 - 16#00ff These are the module faults: 16#0000 - 16#00ff Code String Explanation and Possible Causes/Solutions 16#0001 Connection Error. A connection to a module failed. 16#0002 Resource unavailable. Either: • there are not enough connections available either for the controller or for the communication module being used to connect through. Check the connection use of the controller or communication Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 283 Chapter 4 Input/Output Instructions module. If all of the connections are used, try to free some of the used connections or add another module to route the errant connection through. • the I/O memory limits of the controller are exceeded. Check the I/O memory available and make program or tag changes if needed. • the I/O module targeted does not have enough connections available. Check the number of controllers making a connection to this I/O module and verify that the number of connections is within the limits of the I/O module. 16#0005 Connection Request Error: Bad Class The controller is attempting to make a connection to the module and has received an error. Either: • the configured address for the connection to the module is incorrect. • the module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. 284 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. If you are using a 1756-DHRIO module, verify that the Channel type selected in the software (DH+ or remote I/O network) matches the module’s rotary switch settings. 16#0006 Connection Request Error: Bad Class. Either: • the response buffer is too small to handle the response data. • the module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#0007 Connection Request Error: Bad Class. A service request is unconnected, but should be connected. 16#0008 Service Request Error: Unsupported The controller is attempting to request Service a service from the module that is not supported by the module. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 285 Chapter 4 Input/Output Instructions 16#0009 Module Configuration Invalid: parameter The configuration for the module is error. invalid. The module configuration may Tip: Additional Fault Information for this have been changed in the Data Monitor or fault will be displayed as a hex code on programmatically. the Connection Tab. If available for the module, access the Connections tab of the Module Properties dialog box for the additional fault code. The additional fault code indicates the configuration parameter that is causing the fault. You may have to correct multiple parameters before this fault is cleared and connection is properly established. 16#000A An attribute in the Get_Attributes_List or Either: Set_Attributes_List has a non-zero status. • a connection is being created where the connection type is invalid. • an object attribute or tag value is invalid. If an object attribute or tag is invalid, export the Logix Designer file, then re-import it. Reschedule the ControlNet network after re-importing if applicable. 16#000C Service Request Error: Invalid mode/state The controller is attempting to request a for service request. service from the module and has received an error. First, verify that the module is not faulted. For an I/O module, this may indicate that the module has one of these conditions: • Limited communication, but has a Major Fault • A firmware update needs to be completed or is currently being completed. Refer to the Module Info tab to determine the exact cause. 16#000D Object already exists. An I/O map instance is created where the instance is already in use. 16#000E Attribute value cannot be set. A MSG instruction is configured to change an attribute value that cannot be changed. 16#000F Access permission denied for requested A MSG instruction has been configured service. to delete a map object that cannot be deleted. 286 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 16#0010 16#0011 Input/Output Instructions Mode or state of module does not allow The state of the device prevents a service object to perform requested service. request from being handled. Reply data too large. The reply to a message has a data size that is too large for the destination. Change the destination to a tag that can handle the data size and type being returned. 16#0013 Module Configuration Rejected: Data size The configuration for the module is too small. invalid - not enough configuration data was sent. Verify that the correct module is being targeted. 16#0014 Undefined or unsupported attribute. A MSG instruction is configured to change an attribute that does not exist. 16#0015 Module Configuration Rejected: Data size The configuration for the module is too large. invalid - too much configuration data was sent. Verify that the correct module is being targeted. Module Faults: 16#0100 - 16#01ff These are the module faults: 16#0100 - 16#01ff Code String 16#0100 Connection Request Error: Module in Use. Explanation and Possible Causes/Solutions • The connection being accessed is already in use. Either: • The controller is attempting to make a specific connection to a module and the module cannot support more than one of these connections. • The target of a connection recognizes that the owner is attempting to remake a connection that is already running. 16#0103 Service Request Error: CIP transport class Either: not supported. • The controller is requesting services not supported by the module. • The module in use (that is, the physical module) is different than the module specified in the I/O Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 287 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#0106 Connection Request Error: Module owned An ownership conflict occurred for the and configured by another controller. connection. Module may accept only one connection if One of these conditions exists: Unicast is used. • The Connection Request to this module has been rejected due to an Ownership conflict with another Owner (for example, another Controller). This may occur with modules such as output modules that only allow a single Owner to configure and control its outputs. This fault may also occur if the module is configured as Listen Only and supports only one connection. • If the Owner is connected to the module using a Unicast connection over EtherNet/IP, other connections to the module fail since the Owner controls the one connection. 288 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions If the Owner is connected to the module using a Multicast connection over EtherNet/IP, Unicast connections to the module fail since the Owner controls the one connection. Configure both the Owner and the Listen-Only connection as Multicast. 16#0107 Connection Request Error: Unknown type. A connection being accessed was not found. 16#0108 Connection Request Error: Connection The controller is requesting a connection type (Multicast/Unicast) not supported. type not supported by the module. One of these conditions exists: • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. • The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Keying options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. • You may have configured a consumed tag to use a Unicast Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 289 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions connection, but the producing controller does not support Unicast connections. 16#0109 Connection Request Error: Invalid The connection size is inconsistent with connection size. that expected. Tip: Additional Error Information for this Either: fault will be displayed as the tag name • the controller is attempting to set up associated with the connection instance a connection with the module and number that has the fault. cannot - the size of the connection is invalid. • the controller may be attempting to connect to a tag in a producing controller whose size does not match the tag in this controller. • the module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. • the fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Keying options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. If the module is a 1756 ControlNet module, verify that the chassis size is correct. 290 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions For remote I/O adapters, verify that the rack size and/or rack density is correct. 16#0110 Connection Request Error: Module not The controller is attempting to set up a configured. Listen Only connection with the module and cannot - the module has not been configured and connected to by an Owner (for example, another Controller). This controller is not an Owner of this module because it is attempting to establish a Listen Only connection, which requires no module configuration. It cannot connect until an Owner configures and connects to the module first. 16#0111 Requested Packet Interval (RPI) out of Either: range. • the Requested Packet Interval (RPI) specified is invalid for this module or for a module in the path to this module. See the Advanced tab to enable the RPI from the producer. • the module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 291 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions configuration tree of the Logix Designer application. • for Listen Only connections: the RPI set by the owner of this module is slower than the one requested. Either increase the requested RPI or decrease the RPI the owner controller is using. See the Connection tab in the Module Properties dialog box for valid RPI values. 16#0113 Connection Request Error: Module The number of connections is greater connection limit exceeded. than what is available on the module. The number of connections must be reduced or the hardware must be upgraded. To reduce the number of connections: • Change the Flex I/O communication adapter Comm Format from Input or Output configuration to Rack Optimization. When the Comm Format changes, the adapter must be removed and recreated in the I/O configuration tree. • If the configuration uses messaging over ControlNet, sequence the messages to reduce the number that are executing at the same time, or reduce the number of messages. Messages (MSG instructions) also use connections. 16#0114 Electronic Keying Mismatch: Electronic The Product Code of the actual module keying product code and/or vendor ID hardware does not match the Product mismatch. Code of the module created in the software. Electronic Keying failed for this module. You may have a mismatch between the module created in the software and the actual module hardware. 16#0115 Electronic Keying Mismatch: Electronic The Product Type of the actual module Keying product type mismatch. hardware does not match the Product Type of the module created in the software. 292 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions Electronic Keying failed for this module. You may have a mismatch between the module created in the software and the actual module hardware. 16#0116 Electronic Keying Mismatch: Major and/or The Major and/or Minor revisions of the Minor revision invalid or incorrect. module do not match the Major and/or Minor revisions of the module created in the software. Verify that you have specified the correct Major and Minor Revision if you have chosen Compatible Module or Exact Match keying. Electronic Keying failed for this module. You may have a mismatch between the module created in the software and the actual module hardware. 16#0117 Connection Request Error: Invalid The connection is to an invalid port or Connection Point. port that is already in use. Tip: Additional Error Information for this One of these conditions exists: fault appears as the tag name associated • Another controller owns this with the controller to controller (C2C) that module and has connected has the fault. with a Communications Format different than the one chosen by this controller. Verify that the Communications Format chosen is identical to that chosen by the first owner controller of the module. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 293 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. • The controller may be attempting to connect to a nonexistent tag in a producing controller. 16#0118 Module Configuration Rejected: Format An invalid configuration format is used. error. One of these conditions exists: • The configuration class specified does not match the class supported by the module. • The connection instance is not recognized by the module. • The path specified for the connection is inconsistent. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. 294 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#0119 Connection Request Error: Module not The controlling connection is not open. owned. Where a Listen Only connection is requested, the controlling connection is not open. 16#011A Connection Request Error: Out of The controller is attempting to set up a Connection Resources connection with the module and cannot resources required are unavailable. If the module is a 1756 ControlNet module, up to five controllers can make Rack Optimization connections to the module. Verify that this number has not been exceeded. If the module is a 1794-ACN15, 1794-ACNR15, or 1797-ACNR15 adapter, only one controller can make a Rack Optimization connection to the module. Verify that this number has not been exceeded. Module Faults: 16#0200 - 16#02ff These are the module faults: 16#0200 - 16#02ff. Code String 16#0203 Connection timed out. Explanation and Possible Causes/Solutions The owner or originator recognizes that the target device is on the network or backplane, however, I/O data and messages are not being responded to. In other words, the target can be reached, but its response is not as expected. For example, this fault may be indicated where multicast Ethernet packets are not returned. When this fault occurs, the controller usually attempts to continuously remove and remake the connection. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 295 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions If you are using FLEX I/O modules, verify that you are using the correct terminal device. 16#0204 Connection Request Error: Connection The controller is attempting to make a request timed out. connection, however, the target module is not responding. The device also appears to be missing from the backplane or network. To recover, take these actions: • Verify that the module has not been removed and is still functioning and receiving power. • Verify that the correct slot number has been specified. • Verify that the module is properly connected to the network. If you are using FLEX I/O modules, verify that the correct terminal block is in use. 16#0205 Connection Request Error: Invalid Either: parameter. • The controller is attempting to set up a connection with the module and has received an error - a parameter is in error. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not 296 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#0206 Connection Request Error: Requested size Either: too large. • The controller is attempting to set up a connection with the module and has received an error - the request size is too large. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 297 Chapter 4 Input/Output Instructions Module Faults: 16#0300 - 16#03ff These are the module faults: 16#0300 - 16#03ff Explanation and Possible Code String 16#0301 Connection Request Error: Out of buffer One of these conditions may exist: memory. • Causes/Solutions The controller is attempting to set up a connection with the module and has received an error - a module in the path is out of memory. • The controller may be attempting to connect to a tag in a producing controller that is not marked as being produced. • The controller may be attempting to connect to a tag in a producing controller. That tag may not be configured to allow enough consumers. • Reduce the size or number of connections through this module. • One of the network modules between the module and the controller may be out of memory. Check network configuration of the system. • The module may be out of memory. Check system configuration and capabilities of module. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being 298 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#0302 Connection Request Error: Out of The controller is attempting to set up communication bandwidth. a connection with the module and has received an error - a module in the path has exceeded its communication bandwidth capacity. Increase the Requested Packet Interval (RPI) and reconfigure your network with RSNetWorx. Distribute the load on another bridge module. 16#0303 Connection Request Error: No bridge The controller is attempting to set up available. a connection with the module and has received an error - a module in the path has exceeded its communication bandwidth capacity. Distribute the load on another bridge module. 16#0304 Not configured to send scheduled data. The ControlNet module is not scheduled to send data. Use RSNetWorx software to schedule or reschedule the ControlNet network. 16#0305 Connection Request Error: ControlNet The ControlNet configuration in configuration in controller does not the controller does not match the match configuration in bridge. configuration in the bridge module. This may occur because a ControlNet module was changed after the network was scheduled, or because a new control program has been loaded into the controller. Use RSNetWorx software to reschedule the connections. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 299 Chapter 4 Input/Output Instructions Explanation and Possible Code String 16#0306 No ControlNet Configuration Master (CCM) The ControlNet Configuration Master available. Causes/Solutions (CCM) cannot be found. The 1756-CNB and PLC-5C modules are the only modules capable of being a CCM and the CCM must be node number 1. Verify that a 1756-CNB or PLC-5C module is at node number 1 and is functioning properly. This fault may temporarily occur when the system is powered up and will be cleared when the CCM is located. 16#0311 Connection Request Error: Invalid port. The controller is attempting to set up a connection with the module and has received an error. Verify that all modules in the I/O Configuration tree are the correct modules. 16#0312 Connection Request Error: Invalid link The controller is attempting to set up address. a connection with the module and has received an error - an invalid link address has been specified. A link address can be a slot number, a network address, or the remote I/O chassis number and starting group. Verify that the chosen slot number for this module is not greater than the size of the rack. Verify that the ControlNet node number is not greater than the maximum node number configured for the network in RSNetWorx software. 16#0315 Connection Request Error: Invalid The segment type or route is invalid. segment type. Either: • the controller is attempting to set up a connection with the module and has received an error - the connection request is invalid • the module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. 300 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#0317 Connection Request Error: Connection not The controller is attempting to set up a scheduled. ControlNet connection with the module and has received an error. Use RSNetWorx software to schedule or reschedule the connection to this module. 16#0318 Connection Request Error: Invalid link The controller is attempting to set up address - cannot route to self. a connection with the module and has received an error - the link address is invalid. Verify that the associated ControlNet module has the correct slot and/or node number selected. 16#0319 Connection Request Error: No secondary The controller is attempting to set up resources available in redundant chassis. a connection with the module and has received an error - the redundant module does not have the necessary resources to support the connection. Reduce the size or number of connections through this module or add another controller or ControlNet module to the system. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 301 Chapter 4 Input/Output Instructions Explanation and Possible Code String 16#031a Connection Request Error: Rack The controller is attempting to set up a Connection Refused. Direct connection with the module and Causes/Solutions has received an error. A Rack Optimized connection has already been established to this module through the 1756-CNB/R in the same chassis. • Connect to this module via the 1756-CNB/R in the same chassis. • Connect to this module via a different 1756-CNB/R in order to use a Direct connection. • Change the first connection from Rack Optimized to Direct, and then reestablish the second direct connection. • Connect to this module from a controller in the same chassis as the module (do not connect via 1756-CNB/R. 16#031e Connection Request Error: Cannot • consume tag. The controller is attempting to connect to a tag in a producing controller and has received an error. • The controller is attempting to connect to a tag in a producing controller and that tag has already been used by too many consumers. Increase the maximum number of consumers on the tag. 16#031f Connection Request Error: Cannot No SC (servicing controller) connection consume tag. object was found that corresponds to a symbol instance. 16#0322 Connection Request Error: Connection A connection point mismatch has point mismatch occurred. Either: • a new connection requested does not match the existing connection. Check the controllers that are using the connection and verify that all the configurations are identical. • the connection requested is not a listener or a controlling connection type. 302 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Module Faults: 16#0800 - 16#08ff These are the module faults: 16#0800 - 16#08ff Explanation and Possible Code String 16#0800 Network link in path to module is offline. No interpretation available. 16#0801 Incompatible multi-cast RPI. No interpretation available. 16#0810 No target application data available. The controlling application has not Causes/Solutions initialized the data to be produced by the target device. This may be caused when "Send Data" connections are configured in a target device and the controlling application for that target device has not initialized the data to be produced. For the target device associated with the "Send Data" connection reporting this connection error, start the controlling application and perform at least one write of data. Refer to the documentation for the target device and its controlling application for information on how to do this. 16#0814 Connection Request Error: Data Type Invalid connection status information was Mismatch. found. Module Faults: 16#fd00 - 16#fdff The module faults: 16#fd00 - 16#fdff. Explanation and Possible Code String 16#fd03 Connection Request Error: Required The controller is attempting to set up Connection missing a connection with the module and has Causes/Solutions received an error - this module requires a particular set of connections and connection types, and one of those connection types is missing. • Contact Rockwell Automation technical support at Rockwellautomation.com. 16#fd04 Rockwell Automation, Inc. Connection Request Error: No CST Master The controller is attempting to set up Detected a connection with the module and has Publication 1756-RM003Z-EN-P - September 2024 303 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions received an error - this module requires a CST master in the chassis. • Configure a module (typically a controller) in this chassis to be the CST master. • Contact Rockwell Automation technical support at Rockwellautomation.com. 16#fd05 Connection Request Error: No Axis or The controller is attempting to set up Group Assigned. a connection with the module and has received an error - this module requires an axis or group table assigned. • Assign a Group or Axis. • Contact Rockwell Automation technical support at Rockwellautomation.com. 16#fd06 Transition Fault The controller command to transition the SERCOS ring to a new phase returned an error from the module. Check for duplicate Drive Nodes. 16#fd07 Incorrect SERCOS Data Rate An attempt to configure the SERCOS ring failed. The baud rate for all devices must be the same and supported by the drives and the SERCOS module. 16#fd08 SERCOS Comm Fault Mainly two sets of faults may cause a Comm. Fault - Physical and interface faults. A possible source of physical faults is: • Broken ring • Loose connector • Fiber optics not clean • Electrical noise due to improper drive grounding • Too many nodes on the ring Interface errors are encountered when you are configuring third party drives. A possible source of interface errors is: • No SERCOS MST (Protocol Error) • Missed AT (drive did not send data when expected) 304 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String Input/Output Instructions Explanation and Possible Causes/Solutions • SERCOS timing error in phase 3 • Error in drive data returned to SERCOS module 16#fd09 Node Initialization Fault An attempt by the controller to configure the node for cyclic operation returned an error. 16#fd0a Axis Attribute Error A bad response was received from a motion module. 16#fd0c Error Different Grandmaster Fault The end device has a different grandmaster than the controller. 16#fd1f Bad Safety Protocol Format An error occurred adding the safety network segment to a route. 16#fd20 No Safety Task No safety task appears to be running. 16#fd22 Chassis Size Mismatch Verify the number of physical expansion I/O modules configured for the controller and then update the number of modules selected from the Expansion I/O list on the General page in the Controller Properties dialog. 16#fd23 Chassis Size Exceeded To verify the number of physical expansion I/O the controller supports, open the Controller Properties dialog and expand the Expansion I/O list on the General page. Configure the number of physical expansion I/O modules to match the selection in the Expansion I/O list. Module Faults: 16#fe00 - 16#feff The module faults: 16#fe00 - 16#feff. Code String 16#fe01 Explanation and Possible Causes/Solutions An invalid configuration format was encountered. 16#fe02 Requested Packet Interval (RPI) out of The Requested Packet Interval (RPI) range. specified is invalid for this module. • See the Connection tab for valid RPI values. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 305 Chapter 4 Input/Output Instructions Code String 16#fe03 Explanation and Possible Causes/Solutions The input connection point has not been set. 16#fe04 Connection Request Error: Invalid input The controller is attempting to set up data pointer. a connection with the module and has received an error. 16#fe05 Connection Request Error: Invalid input Either: data size. • The controller is attempting to set up a connection with the module and has received an error. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#fe06 The input force point has not been set. 16#fe07 The output connection point has not been set. 16#fe08 Connection Request Error: Invalid output The controller is attempting to set up data pointer. a connection with the module and has received an error. 306 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Explanation and Possible Code String 16#fe09 Connection Request Error: Invalid output Either: data size. • Causes/Solutions The controller is attempting to set up a connection with the module and has received an error. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#fe0a 16#fe0b The output force pointer has not been set. Invalid symbol string. Either: • The tag to be consumed on this module is invalid. Verify that the tag is marked as being produced. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 307 Chapter 4 Input/Output Instructions Code String Explanation and Possible Causes/Solutions keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#fe0c Invalid PLC-5 instance number. The controller is attempting to set up a connection with the PLC-5 and has received an error. Verify that the instance number specified has been properly specified in the PLC-5. 16#fe0d Tag does not exist in peer controller. The symbol instance number was found to not be set. 16#fe0e Automatic Firmware Update in progress. The module is currently being updated. 16#fe0f Automatic Firmware Update Failed: Firmware supervisor has attempted to Firmware file incompatible with the update an unsupported module. module. 16#fe10 16#fe11 Automatic Firmware Update Failed: The firmware file to update the module Firmware file not found. cannot be found. Automatic Firmware Update Failed: The firmware file is corrupted. Firmware file invalid. 16#fe12 Automatic Firmware Update Failed. An error has occurred while updating the module. 16#fe13 16#fe14 Automatic Firmware Update Failed: An active connection could not be made Detected Active Connections. to the target module. Automatic Firmware Update pending: The firmware file is currently being read. Searching NVS file for appropriate module identity. 308 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Code String 16#fe22 Input/Output Instructions Explanation and Possible Causes/Solutions The target-to-originator netparams connection type is invalid. 16#fe23 The target-to-originator netparams connection does not specify whether unicast is allowed. Module Faults: 16#ff00 - 16#ffff These are the module faults: 16#ff00 - 16#ffff. Explanation and Possible Code String 16#ff00 Connection Request Error: No connection The controller is attempting to set up instance. Causes/Solutions a connection with the module and has received an error. Verify that the physical module is the same module type (or is a compatible module) as created in the software. If the module is a 1756-DHRIO module in a remote chassis (connected via a ControlNet network), verify that the network has been scheduled with RSNetWorx software. Even after the network has been scheduled with RSNetWorx for ControlNet software, if you are online and if the 1756-DHRIO module is configured for DH + network only, a #ff00 Module Fault (no connection instance) may occur. The module is properly communicating even though Faulted is displayed as its Status on the Module Properties dialog box. Disregard the error message and fault status and continue. 16#ff01 Connection Request Error: Path to module The controller is attempting to set up too long. a connection with the module and has received an error. Verify that the path to this module is a valid length. 16#ff04 The remote controller’s map instance attempted to access a connection while being in an invalid state. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 309 Chapter 4 Input/Output Instructions Explanation and Possible Code String 16#ff08 Connection Request Error: Invalid path to The controller is attempting to set up module. a connection with the module and has Causes/Solutions received an error. Verify that the path to this module is a valid length. 16#ff0b Module Configuration Invalid: bad format. Either: • The configuration for the module is invalid. • The module in use (that is, the physical module) is different than the module specified in the I/O configuration tree and is therefore causing the connection or service to fail. The fault may occur even when the module passed the electronic keying test. This may result when Disable Keying or Compatible Module options were used in the module configuration instead of the Exact Match option. Despite passing the electronic keying test, the module being connected to does not have the same features or settings as the module specified in the I/O configuration tree and does not support the connection or service being attempted. Check the module in use and verify that it exactly matches the module specified in the I/O configuration tree of the Logix Designer application. 16#ff0e Connection Request Error: No The controller is attempting to set up connections accepted to bridge. a connection with the module and has received an error. Specify CIP Messages The CIP Data Table Read and Write message types transfer data between Logix 5000 controllers. 310 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Select this command If you want to CIP Data Table Read Read data from another controller. The Source and Destination types must match. CIP Data Table Write Write data to another controller. The Source and Destination types must match. Reconfigure an I/O Module Use the Module Reconfigure message to send new configuration information to an I/O module. During the reconfiguration, the following occurs: • Input modules continue to send input data to the controller. • Output modules continue to control their output devices. A Module Reconfigure message requires this configuration properties. In this property Select Message Type Module Reconfigure Example Follow these steps to reconfigure an I/O module. 1. Set the required member of the configuration tag of the module to the new value. 2. Send a Module Reconfigure message to the module. When reconfigure[5] is set, set the high alarm to 60 for the local module in slot 4. The Module Reconfigure message then sends the new alarm value to the module. The one shot instruction prevents the rung from sending multiple messages to the module while the reconfigure[5] is on. Tip: We recommend that you always include an XIO of the MSG.EN bit as an in-series MSG rung precondition. Relay Ladder Structured Text IF reconfigure[5] AND NOT reconfigure[6]THEN Local:4:C.Ch0Config.HAlarmLimit := 60; IF NOT change_Halarm.EN THEN MSG(change_Halarm); END_IF; END_IF; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 311 Chapter 4 Input/Output Instructions reconfigure[6] := reconfigure[5]; Specify CIP Generic Messages IMPORTANT: ControlLogix modules have services that can be invoked by using a MSG instruction and choosing the CIP Generic message type. If you want to In this property Type or select Perform a pulse test on a Message Type CIP Generic digital output module Service Type Pulse Test Source tag_name of type INT [5] This array contains Description tag_name[0] Bit mask of points to test (test only one point at a time) tag_name[1] Reserved, leave 0 tag_name[2] Pulse width (hundreds of , usually 20) tag_name[3] Zero cross delay for ControlLogix I/O (hundreds of , usually 40) tag_name[4] Get audit value Verify delay Destination Blank Message Type CIP Generic Service Type Audit Value Get Source Element Cannot change this field, blank Source Length Cannot change this field, set to 0 bytes Destination Element This array contains Description tag_name of type DINT[2] or This tag contains the Audit LINT Value for the controller. Important: Rockwell Automation recommends using the DINT[2] data type to avoid limitations when working with LINT data types in Allen-Bradley® controllers. 312 Get controller events Message Type CIP Generic monitored for changes Service Type Changes to Detect Get Source Element Cannot change this field, blank Source Length Cannot change this field, set to 0 bytes Destination Element This array contains Publication 1756-RM003Z-EN-P - September 2024 Description Rockwell Automation, Inc. If you want to In this property Chapter 4 Input/Output Instructions tag_name of type DINT[2] or This tag represents a bit mask LINT of the changes monitored for Type or select the controller. Important: Rockwell Automation recommends using the DINT[2] data type to avoid limitations when working with LINT data types in Allen-Bradley controllers. Set controller events Message Type CIP Generic monitored for changes Service Type Changes to Detect Set Source Element This array contains Description tag_name of type DINT[2] or This tag represents a bit mask LINT of the changes monitored for the controller. Important: Rockwell Automation recommends using the DINT[2] data type to avoid limitations when working with LINT data types in Allen-Bradley controllers. Source Length Cannot change this field, set to 8 bytes Destination Element Cannot change this field, blank Reset electronic fuses on a Message Type CIP Generic digital output module Service Type Reset Electronic Fuse Source tag name of type DINT This tag represents a bit mask of the points to reset fuses on. Destination Leave blank Reset latched diagnostics on a Message Type CIP Generic digital input module Service Type Reset Latched Diagnostics (I) Source tag_name of type DINT This tag represents a bit mask of the points to reset diagnostics on. Reset latched diagnostics on a Message Type CIP Generic digital output module Service Type Reset Latched Diagnostics (O) Source tag_name of type DINT This tag represents a bit mask of the points to reset diagnostics on. Rockwell Automation, Inc. Unlatch the alarm of an analog Message Type CIP Generic input module Select which alarm that you want to unlatch. Service Type Publication 1756-RM003Z-EN-P - September 2024 313 Chapter 4 Input/Output Instructions If you want to In this property Type or select • Unlatch All Alarms (I) • Unlatch Analog High Alarm (I) • Unlatch Analog High High Alarm (I) • Unlatch Analog Low Alarm (I) • Unlatch Analog Low Low Alarm (I) • Unlatch Rate Alarm (I) Instance Channel of the alarm to unlatch. Unlatch the alarm of an analog Message Type CIP Generic output module Select which alarm that you want to unlatch. Service Type • Unlatch All Alarms (O) • Unlatch High Alarm (O) • Unlatch Low Alarm (O) • Unlatch Ramp Alarm (O) Instance Channel of the alarm to unlatch. Get/Set Controller Events Monitored for Changes Bit Definitions Tag Names Data Type Bit Definition Get Controller Events Monitored for DINT[0] Each bit has a specific meaning: Changes 0 Store to removable media through Logix Set Controller Events Monitored for Designer application Changes 1 Online edits were accepted, tested, or assembled 2 Partial import online transaction completed 3 SFC Forces were enabled 4 SFC Forces were disabled 5 SFC Forces were removed 6 SFC Forces were modified 7 I/O Forces were enabled 8 I/O Forces were disabled 9 I/O Forces were removed 10 I/O Forces were changed 11 Firmware update from unconnected source 12 Firmware update via removable media 13 Mode change via workstation 14 Mode change via mode switch 15 A major fault occurred 16 Major faults were cleared 7 Major faults were cleared via mode switch 118 Task properties were modified 314 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Tag Names Data Type Input/Output Instructions Bit Definition 19 Program properties were modified 20 Controller timeslice options were modified 21 Removable media was removed 22 Removable media was inserted 23 Safety signature created 24 Safety signature deleted 25 Safety lock 26 Safety unlock 27 Constant tag value changed 28 Constant tag multiple values changed 29 Constant tag attribute cleared 30 Tag set as constant 31 Custom log entry added DINT[1] 32 Change that affects correlation 33 Helps protect signature in Run mode attribute set 34 Helps protect signature in Run mode attribute cleared 35…63 Unused Tip: • Selecting the CIP Generic message type enables the Large Connection option on the Communication tab. Use large CIP Generic connections when a message is greater than 480 bytes. 500 bytes is typical, but there are headers at the front of the message. Large CIP connections are for messages up to 3980 bytes. • The Large Connection box is enabled only when the Connected box is checked and CIP Generic is selected as the message type on the Configuration tab. • The Large Connection option is available only in Logix Designer application, version 21.00.00 or later and RSLogix 5000 software, version 20.00.00 or later. Specify PLC-3 Messages The PLC-3 message types are designed for PLC-3 processors. Select this command: To: PLC3 Typed Read Read integer or REAL type data. For integers, this command reads 16-bit integers from the PLC-3 processor and stores them in SINT, INT, or DINT data arrays in the Logix 5000 controller and maintains data integrity. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 315 Chapter 4 Input/Output Instructions Select this command: To: This command also reads floating-point data from the PLC-3 and stores it in a REAL data type tag in the Logix 5000 controller. PLC3 Typed Write Write integer or REAL type data. This command writes SINT or INT data, to the PLC-3 integer file and maintains data integrity. You can write DINT data as long as it fits within an INT data type (−32,768 ≥ data ≤ 32,767). This command also writes REAL type data from the Logix 5000 controller to a PLC-3 floating-point file. PLC3 Word Range Read Read a contiguous range of 16-bit words in PLC-3 memory regardless of data type. This command starts at the address specified as the Source Element and reads sequentially the number of 16-bit words requested. The data from the Source Element is stored, starting at the address specified as the Destination Tag. PLC3 Word Range Write Write a contiguous range of 16-bit words from Logix 5000 memory regardless of data type to PLC-3 memory. This command starts at the address specified as the Source Tag and reads sequentially the number of 16-bit words requested. The data from the Source Tag is stored, starting at the address specified as the Destination Element in the PLC-3 processor. The following diagrams show how the typed and word-range commands differ. The example uses read commands from a PLC-3 processor to a Logix 5000 controller. Specify PLC-5 Messages Use the PLC-5 message types to communicate with PLC-5 controllers. 316 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 4 Input/Output Instructions Select this command: To: PLC-5 Typed Read Read 16-bit integer, floating-point, or string type data and maintain data integrity. PLC-5 Typed Write Write 16-bit integer, floating-point, or string type data and maintain data integrity. PLC-5 Word Range Read Read a contiguous range of 16-bit words in PLC-5 memory regardless of data type. This command starts at the address specified as the Source Element and reads sequentially the number of 16-bit words requested. The data from the Source Element is stored, starting at the address specified as the Destination Tag. PLC-5 Word Range Write Write a contiguous range of 16-bit words from Logix 5000 memory regardless of data type to PLC-5 memory. This command starts at the address specified as the Source Tag and reads sequentially the number of 16-bit words requested. The data from the Source Tag is stored, starting at the address specified as the Destination Element in the PLC-5 processor. Data types for PLC-5 Typed Read and Typed Write messages The following table shows the data types to use with PLC-5 Typed Read and PLC-5 Typed Write messages. For this PLC-5 data type: Use this Logix 5000 data type: B INT F REAL N INT DINT (Only write DINT values to a PLC-5 controller if the value is ≥− 32,768 and ≤ 32,767.) S INT ST STRING The Typed Read and Typed Write commands also work with SLC 5/03 processors (OS303 and above), SLC 5/04 processors (OS402 and above), and SLC 5/05 processors. Specify PLC-2 Messages The PLC-2 message types are designed for PLC-2 processors. Select this command: To: PLC2 Unprotected Read Read 16-bit words from any area of the PLC-2 data table or the PLC-2 compatibility file of another processor. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 317 Chapter 4 Input/Output Instructions Select this command: To: PLC2 Unprotected Write Write 16-bit words to any area of the PLC-2 data table or the PLC-2 compatibility file of another processor. The message transfer uses 16-bit words, so make sure the Logix 5000 tag appropriately stores the transferred data, typically as an INT array. L8 controllers for tables--not bold CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers 318 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions The compare instructions let you compare values by using an expression or a specific compare instruction. Available Instructions Ladder Diagram CMP on EQ on GE on GT on IsINF IsNAN LE on LT on LIMIT MEQ on NE on page 327 page page page on page on page page page on page page page 379 319 338 330 345 347 356 348 363 372 Function Block Diagram FBD Block EQ on page GE on page GT on page LE on page LT on page LIMIT on page MEQ on page NE on page 319 338 330 356 348 363 379 372 Structured Text Not available If you want to: Use this instruction: compare values based on an expression CMP test whether two values are equal EQ test whether one value is greater than or equal to a second GE value test whether one value is greater than a second value GT test whether the source is infinite IsINF test whether the source is not a number IsNAN test whether one value is less than or equal to a second value LE test whether one value is less than a second value LT test whether one value is between two other values LIMIT pass two values through a mask and test whether they are MEQ equal test whether one value is not equal to a second value NE Compare values of different data types, such as floating point and integer. The bold data types indicate optimal data types. An instruction executes at its fastest and with it lowest memory requirements if all the parameters of the instruction use the same optimal data type, typically DINT or REAL. Equal To (EQ) This table lists the controllers and applications that support this instruction. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 319 Chapter 5 Compare Instructions Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the EQ instruction and the operator = test whether Source A is equal to Source B. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from EQU to EQ. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. 320 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Tip: Use the operator '=' with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Numeric Comparison Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description immediate tag Value to test against Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT Source B USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Source B SINT SINT INT INT DINT DINT REAL LINT immediate tag Source to test against Source A USINT UINT UDINT ULINT REAL LREAL TIME Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 321 Chapter 5 Compare Instructions Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. String Comparison Tip: Immediate string literals are only applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers. Operand Data Type Format Description Source A String type immediate literal value String to test against Source B tag Source B String type immediate literal value String to test against Source A tag Function Block Diagram FBD Block Operand Data Type Format Description EQU FBD_COMPARE tag EQ structure FBD_COMPARE Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. 322 SourceA REAL Value to test against SourceB SourceB REAL Value to test against SourceA Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true when SourceA is equal to SourceB. Cleared to false when SourceA is not equal to SourceB. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operands (Left Pins) Data Type Description SourceA (top) SINT Value to test against SourceB. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL SourceB (bottom) SINT Value to test against SourceA INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description Dest BOOL Set to true when SourceA is equal to SourceB. Cleared to false when SourceA is not equal to SourceB. See FBD Functions on page 862. Affects Math Status Flags No Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 323 Chapter 5 Compare Instructions Major/Minor Faults See EQ String Compare Flow Chart for faults. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Numeric compare: If Source A and Source B are not NANs and Source A is equal to Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. String compare: See EQU String Compare Flow Chart. If output is false Clear Rung-condition-out to false else Set Rung-condition-out to true Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Numeric compare: Set EnableOut to EnableIn If SourceA and SourceB are not NANs and SourceA is equal to SourceB. Set Dest to true else Clear Dest to false. 324 Instruction first run N/A Instruction first scan N/A Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Numeric compare: If SourceA and SourceB are not NANs and SourceA is equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A EQ String Compare Flow Chart Examples Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 325 Chapter 5 Compare Instructions Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text if value_1 = value_2 then light_a := 1; else light_a := 0; end_if; if value_3 = ’I am EQUAL’ then light_b := 1; else light_b := 0; end_if; 326 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Compare (CMP) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. Define the CMP expression using operators, tags, and immediate values. Use parentheses ( ) to define sections of more complex expressions. The advantage of the CMP instruction is that it allows complex expressions in one instruction. When evaluating the expression all non-REAL operands will be converted to REAL before the calculations are performed if any of the following conditions is true. • Any operand in the expression is REAL. • The expression contains SIN, COS, TAN, ASIN, ACOS, ATAN, LN, LOG, DEG or RAD. There are rules for allowable operators in safety applications. See Valid Operators. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands These are the operands for the CMP instruction. IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram The following is the Ladder Diagram operand. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 327 Chapter 5 Compare Instructions Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Expression CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description immediate tag An expression Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT consisting of tags DINT DINT and/or immediate REAL LINT values separated by String type USINT operators UINT UDINT ULINT REAL LREAL String type Formatting expressions For each operator used in an expression, one or two operands (tags or immediate values) must be provided. Use the following table to format operators and operands within an expression. For operators that operate on: Use this format: Example One operand operator(operand) ABS(tag) Two operands operand_a operator operand_b tag_b + 5 tag_c AND tag_d (tag_e**2) MOD (tag_f / tag_g) Determine the order of operation The instructions performs operations in the expression are in a prescribed order, not necessarily the order they appear. The order of operation can be specified by grouping terms within parentheses, forcing the instruction to perform an operation within the parentheses ahead of their operations. Operations of equal order are performed from left to right. Order Operation 1 () 2 ABS, ACOS, ASIN, ATAN, COS, DEG, BCD_TO, IsINF, IsNAN, LN, LOG, RAD, SIN, SQRT, TAN, TO_BCD, TRUNC 328 3 ** 4 - (negate), NOT, ! 5 *, /, MOD Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Order Operation 6 - (subtract), + 7 AND 8 XOR 9 OR 10 <, <=, >, >=, =, <> 11 && 12 ^^ 13 || Compare Instructions Using strings in an expression To use strings of ASCII characters in an expression, follow these guidelines: • An expression can compare two string tags. • ASCII characters cannot be entered directly into the expression. • The following operands are permitted: Operator Description = Equal < Less than <= Less than or equal > Greater than >= Greater than or equal <> Not equal • Strings are equal if their characters match. • ASCII characters are case-sensitive. Uppercase A ($41) is not equal to lowercase a ($61). • The hexadecimal values of the characters determine if one string is less than or greater than another string. • When the two strings are sorted as in a telephone directory, the order of the strings determine which one is greater. Affects Math Status Flags Controllers Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 Affects Math Status Flags 329 Chapter 5 Compare Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, No Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix The CMP instruction affects the math status flags if the 5370, and GuardLogix 5570 controllers expression contains an operator (for example, +, −, *, /) that affects the math status flags. See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in if expression evaluates to false Rung-condition-out is cleared to false Postscan N/A Example Ladder Diagram If value_1 is equal to value_2, light_a is set to true. If value_1 is not equal to value_2, light_a is cleared to false. Greater Than (GT) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Greater Than (GT) instruction and the operator > tests whether Source A is greater than Source B. 330 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Tip: In Logix Designer version 36, the mnemonic for this instruction changed from GRT to GT. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use the operator > with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Numeric Comparison Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 331 Chapter 5 Compare Instructions Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to test against INT INT tag Source B DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Source B SINT SINT immediate Value to test against INT INT tag Source A DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. String Comparison 332 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Tip: Immediate string literals are only applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers. Operand Data Type Format Description Source A String type immediate literal value String to test against Source B tag Source B String type immediate literal value String to test against Source A tag Function Block Diagram FBD Block Operand Data Type Format Description GT FBD_COMPARE tag GT structure FBD_COMPARE Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value to test against SourceB SourceB REAL Value to test against SourceA Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true when SourceA is greater than SourceB. Cleared to false when SourceA is not greater than SourceB. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 333 Chapter 5 Compare Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA (top) SINT Value to test against SourceB INT DINT LINT USINT UINT UDINT ULINT REAL LREAL SourceB (bottom) SINT Value to test against SourceA INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest BOOL Set to true when SourceA is greater than SourceB. Cleared to false when SourceA is not greater than SourceB. See FBD Functions on page 862. Affects Math Status Flags No Major/Minor Faults See GT String Compare Flow Chart on page 338 for faults. See Index Through Arrays on page 863 for array-indexing faults. 334 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Numeric compare: If Source A and Source B are not NANs and Source A is greater than Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. String compare: See GT String Compare Flow Chart on page 338 If output is false Clear Rung-condition-out to false else Set Rung-condition-out to true Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Numeric compare: Set EnableOut to EnableIn If SourceA and SourceB are not NANs and SourceA is greater than SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 335 Chapter 5 Compare Instructions Condition/State Action Taken Prescan N/A Normal Scan Numeric compare: If SourceA and SourceB are not NANs and SourceA is greater than SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A GT String Compare Flow Chart SourceA.LEN and SourceB.LEN are handled as unsigned values. Example 336 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text if value_1 > value_2 then light_1 := 1; else light_1 := 0; end_if; if value_3 > ’I am EQUAL’ then light_2 := 1; else light_2 := 0; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 337 Chapter 5 Compare Instructions end_if; GT Flow Chart (True) Greater Than or Equal To (GE) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Greater Than or Equal To (GE) instruction and the operator test whether Source A is greater than or equal to Source B. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from GEQ to GE. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: 338 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use the operator with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. on page 851. Ladder Diagram Numeric Comparison Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description immediate tag Value to test against Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT Source B USINT UINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 339 Chapter 5 Compare Instructions Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description immediate Value to test against Compact GuardLogix 5380, and GuardLogix 5580 controllers UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Source B SINT SINT INT INT DINT DINT REAL LINT Source A tag USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. String Comparison Tip: Immediate string literals are only applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers. 340 Operand Data Type Format Description Source A String type immediate literal value String to test against Source B Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Operand Data Type Format Compare Instructions Description tag Source B String type immediate literal value String to test against Source A tag Function Block Diagram FBD Block Operand Data Type Format Description GE FBD_COMPARE tag GE structure FBD_COMPARE Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value to test against SourceB SourceB REAL Value to test against SourceA Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true when SourceA is greater than or equal to SourceB. Cleared to false when SourceA is less than SourceB. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operands (Left Pins) Data Type Description SourceA (top) SINT Value to test against SourceB. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 341 Chapter 5 Compare Instructions Input Operands (Left Pins) Data Type Description SourceB (bottom) SINT Value to test against SourceA. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description Dest BOOL Set to true when SourceA is greater than or equal to SourceB. Cleared to false when SourceA is less than SourceB. See FBD Functions on page 862 . Affects Math Status Flags No Major/Minor Faults See GE String Compare Flow Chart below for faults. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Numeric compare: If Source A and Source B are not NANs and Source A is greater than or equal to Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. String compare: See GEQ String Compare Flow Chart. If output is false Clear Rung-condition-out to false 342 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Condition/State Compare Instructions Action Taken else Set Rung-condition-out to true Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Numeric compare: Set EnableOut to EnableIn If SourceA and SourceB are not NANs and SourceA is greater than or equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Numeric compare: If SourceA and SourceB are not NANs and SourceA is greater than or equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A GE String Compare Flow Chart Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 343 Chapter 5 Compare Instructions SourceA.LEN and SourceB.LEN are handled as unsigned values. Example Ladder Diagram Function Block Diagram 344 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions FBD Block FBD Function Structured Text if value_1 >= value_2 then light_b := 1; else light_b := 0; end_if; if value_3 >= ’I am EQUAL’ then light_c := 1; else light_c := 0; end_if; Is Infinity (IsINF) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5380, CompactLogix 5480, Yes Yes ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Is Infinity (IsINF) instruction tests whether the Source is infinity. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 345 Chapter 5 Compare Instructions Ladder Diagram Function Block Diagram This instruction is not available in Function Block Diagram. Structured Text This instruction is not available in structured text. Operands Ladder Diagram CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Operand GuardLogix 5380, and Format Description tag Value to test against Infinity. GuardLogix 5580 controllers Data Type Source REAL LREAL Affects Math Status Flags No Major/Minor Faults This instruction does not generate any major/minor faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true If Source is +INF or -INF. Set Rung-condition-out to true else Clear Rung-condition-out to false. Postscan 346 Publication 1756-RM003Z-EN-P - September 2024 N/A Rockwell Automation, Inc. Chapter 5 Compare Instructions Examples Ladder Diagram Is Not a Number (IsNAN) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5380, CompactLogix 5480, Yes Yes ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Is Not a Number (IsNAN) instruction tests whether the source is not a number. Available Languages Ladder Diagram Function Block Diagram This instruction is not available in Function Block Diagram. Structured Text This instruction is not available in structured text. Operands Ladder Diagram CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Operand GuardLogix 5380, and Format Description tag Value to test against Infinity GuardLogix 5580 controllers Data Type Source REAL LREAL Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 347 Chapter 5 Compare Instructions Affects Math Status Flags No Major/Minor Faults This instruction does not generate any major/minor faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true If Source is NAN. Set Rung-condition-out to true else Clear Rung-condition-out to false. Postscan N/A Examples Ladder Diagram Less Than (LT) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Less Than (LT) instruction and the operator < tests Source A is less than Source B. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from LES to LT. Available Languages 348 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use the operator < with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. on page 851 Ladder Diagram Numeric Comparison Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 349 Chapter 5 Compare Instructions Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to test against INT INT tag Source B DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Source B SINT SINT immediate Value to test against INT INT tag Source A DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. String Comparison 350 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Tip: Immediate string literals are applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Format Description Source A String type immediate literal value String to test against Source B tag Source B String type immediate literal value String to test against Source A tag Function Block Diagram FBD Block Operand Data Type Format Description LT FBD_COMPARE tag LT structure FBD_COMPARE Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value to test against SourceB SourceB REAL Value to test against SourceA Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true when SourceA is less than SourceB. Cleared to false when SourceA is not less than SourceB. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA (top) Rockwell Automation, Inc. SINT Publication 1756-RM003Z-EN-P - September 2024 Value to test against SourceB. 351 Chapter 5 Compare Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers INT DINT LINT USINT UINT UDINT ULINT REAL LREAL SourceB (bottom) SINT Value to test against SourceA. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description Dest BOOL Set to true when SourceA is less than SourceB. Cleared to false when SourceA is not less than SourceB. See FBD Functions on page 862. Affects Math Status Flags No Major/Minor Faults See LES String Compare Flow Chart below for faults. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram 352 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Numeric compare: If Source A and Source B are not NANs and Source A is less than Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. String compare: See LES String Compare Flow Chart. If output is false Clear Rung-condition-out to false else Set Rung-condition-out to true Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Numeric compare: If SourceA and SourceB are not NANs and SourceA is less than SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Numeric compare: Set EnableOut to EnableIn Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 353 Chapter 5 Compare Instructions Condition/State Action Taken If SourceA and SourceB are not NANs and SourceA is less than SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A LT String Compare Flow Chart SourceA.LEN and SourceB.LEN are handled as unsigned values. Example 354 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text if value_1 < value_2 then light_3 := 1; else light_3 := 0; end_if; if value_3 < ’I am EQUAL’ then light_4 := 1; else light_4 := 0; end_if; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 355 Chapter 5 Compare Instructions Less Than or Equal To (LE) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Less Than or Equal To (LE) instruction and the operator tests whether Source A is less than or equal to Source B. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from LES to LE. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 356 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Structured Text This instruction is not available in structured text. Tip: Use the operator with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Numeric Comparison Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to test against INT INT tag Source B DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Source B SINT SINT immediate Value to test against INT INT tag Source A DINT DINT REAL LINT USINT UINT UDINT ULINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 357 Chapter 5 Compare Instructions Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers REAL LREAL TIME TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. String Comparison Tip: Immediate string literals are only applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers. Operand Data Type Format Description Source A String type immediate literal value String to test against Source B tag Source B String type immediate literal value String to test against Source A tag Function Block Diagram FBD Block Operand Data Type Format Description LE FBD_COMPARE tag LE structure FBD_COMPARE Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. 358 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Input Members Data Type Description SourceA REAL Value to test against SourceB SourceB REAL Value to test against SourceA Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true when SourceA is less than or equal to SourceB. Cleared to false when SourceA is greater than SourceB. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA (top) SINT Value to test against SourceB. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL SourceB (bottom) SINT Value to test against SourceA. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 359 Chapter 5 Compare Instructions Output Operand (Right Pin) Data Type Description Dest BOOL Set to true when SourceA is less than or equal to SourceB. Cleared to false when SourceA is greater than SourceB. See FBD Functions on page 862. Affects Math Status Flags No Major/Minor Faults See LE String Compare Flow Chart for faults. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Numeric compare: If Source A and Source B are not NANs and Source A is less than or equal to Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. String compare: See LE String Compare Flow Chart. If output is false Clear Rung-condition-out to false else Set Rung-condition-out to true Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Numeric compare: Set EnableOut to EnableIn 360 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Condition/State Compare Instructions Action Taken If SourceA and SourceB are not NANs and SourceA is less than or equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Numeric compare: If SourceA and SourceB are not NANs and SourceA is less than or equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A LE String Compare Flow Chart Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 361 Chapter 5 Compare Instructions SourceA.LEN and SourceB.LEN are handled as unsigned values. Example Ladder Diagram Function Block Diagram 362 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions FBD Block FBD Function Structured Text if value_1 <= value_2 then light_2 := 1; else light_2 := 0; end_if; if value_3 <= ’I am EQUAL’ then light_3 := 1; else light_3 := 0; end_if; Limit (LIMIT) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The LIMIT instruction tests if the Test value is within the range of the Low and High Limits as indicated in the LIMIT Flow Chart (True). Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 363 Chapter 5 Compare Instructions Tip: In Logix Designer version 36, the mnemonic for this instruction changed from LIM to LIMIT. If any operand is Not A Number (NAN), the .EnableOut is cleared to false. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. 364 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Low Limit Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Value of lower limit. Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Test SINT SINT immediate Value to test against INT INT tag limits. DINT DINT REAL LINT Value of upper limit. USINT UINT UDINT ULINT REAL LREAL High Limit SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 365 Chapter 5 Compare Instructions Operand Data Type Format Description LIMIT FBD_LIMIT tag LIMIT structure FBD_LIMIT Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. LowLimit REAL Value of lower limit. Test REAL Value to test against limits. HighLimit REAL Value of upper limit. Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true if Limit test is true. Cleared to false if Limit test is false. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Low Limit SINT Value of lower limit INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Test SINT Value to test against limits. INT DINT LINT 366 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers USINT UINT UDINT ULINT REAL LREAL High Limit SINT Value of upper limit. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description Dest BOOL Set to true if Limit test is true. Cleared to false if Limit test is false. See FBD Functions on page 862. Operation This section illustrates the operation for the LIMIT instruction. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 367 Chapter 5 Compare Instructions If Low Limit: And if the test value is: Then the EnableOut is: < or = to High Limit equal to or between limits true not equal to or outside limits false equal to or outside limits true not equal to or inside limits false > High Limit Signed integers transition from the maximum positive number to the maximum negative number when the most significant bit is true. For example, in 16-bit integers (INT type), the maximum positive integer is 32,767, which is represented in hexadecimal as 16#7FFF (bits 0 through 14 are all true). If that number increments by one, the result is 16#8000 (bit 15 is true). For signed integers, hexadecimal 16#8000 is equal to -32,768 decimal. Incrementing from this point on until all 16 bits are set ends up at 16#FFFF, which is equal to -1 decimal. This can be shown as a circular number line. The LIMIT instruction starts at the Low Limit and increments clockwise until it reaches the High Limit. Any Test value in the clockwise range from the Low Limit to the High Limit sets the EnableOut to true. Any Test value in the clockwise range from the High Limit to the Low Limit clears the EnableOut to false. If any operand is Not A Number (NAN), the .EnableOut is cleared to false. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true See LIMIT Flow Chart (True) If output is true Set Rung-condition-out to true. else Clear Rung-condition-out to false. Postscan N/A Function Block Diagram FBD Block 368 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Set EnableOut to EnableIn. Compare Instructions See LIM Flow Chart (True) Dest = output Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan See LIMIT Flow Chart (True) Dest = output Rockwell Automation, Inc. Instruction first run N/A Instruction first scan N/A Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 369 Chapter 5 Compare Instructions LIMIT Flow Chart (True) Examples Example 1: Low Limit <= High Limit When Test value is equal to or greater than Low Limit, and Test value is less than or equal to High Limit, light_1 is set. Ladder Diagram Function Block Diagram 370 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions FBD Block FBD Function Example 2: Low Limit > High Limit When value > or = to 0 or value < or = to -100, set light_1 to true. If value < 0 and value > -100, clear light_1 to false. Ladder Diagram Function Block Diagram FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 371 Chapter 5 Compare Instructions FBD Function Mask Equal To (MEQ) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The MEQ instruction passes the Source and Compare values through a Mask and compares the results. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 372 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Structured Text This instruction is not available in structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to test against INT INT tag Compare. DINT DINT LINT USINT UINT UDINT ULINT Mask SINT SINT immediate Which bits to block or INT INT tag pass. DINT DINT LINT USINT UINT UDINT ULINT Compare SINT SINT immediate Value to test against INT INT tag Source. DINT DINT LINT USINT UINT UDINT ULINT Function Block Diagram FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 373 Chapter 5 Compare Instructions Operand Data Type Format Description MEQ FBD_MASK_EQUAL tag MEQ structure FBD_MASK_EQUAL Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source DINT Value to test against Compare. Mask DINT Defines which bits to block, such as mask. Compare DINT Value to test against Source. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest BOOL Set to true when result is true. Cleared to false when result is false. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to test against Compare. INT DINT LINT USINT UINT UDINT ULINT Mask SINT Which bits to block or pass. INT DINT LINT 374 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers USINT UINT UDINT ULINT Compare SINT Value to test against Source. INT DINT LINT USINT UINT UDINT ULINT A SINT or INT tag is converted to a DINT value by zero-fill. Output Operand (Right Pin) Data Type Description Dest BOOL Set to true when result is true. Cleared to false when result is false. See FBD Functions on page 862. Operation A "1" in the mask means the data bit is passed. A "0" in the mask means the data bit is blocked. Typically, the Source, Mask, and Compare values are all the same data type. If using SINT or INT data type, the instruction fills the upper bits of that value with 0s so that it is the same size as the DINT data type. Enter an immediate mask value When entering a mask, the programming software defaults to decimal values. To enter a mask using another format, precede the value with the correct prefix. Prefix Description 16# hexadecimal, such as 16#0F0F 8# octal, such as 8#16 2# binary, such as 2#00110011 Affects Math Status Flags No Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 375 Chapter 5 Compare Instructions Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Refer to MEQ Flow Chart (True). If output is true Set Rung-condition-out to true else Clear Rung-condition-out to false Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Set EnableOut to EnableIn. Refer to MEQ Flow Chart (True). If output is true Set Dest to true else Clear Dest to false Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Refer to MEQ Flow Chart (True). If output is true 376 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Condition/State Compare Instructions Action Taken Set Dest to true else Clear Dest to false Instruction first run N/A Instruction first scan N/A Postscan N/A MEQ Flow Chart (True) Examples Example 1 If the masked value_1 is equal to the masked value_2, set light_1 to true. If the masked value_1 is not equal to the masked value_2, clear light_1 to false. This example shows that the masked values are equal. A 0 in the mask restrains the instruction from comparing that bit (indicated by an x in the example). Ladder Diagram Function Block Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 377 Chapter 5 Compare Instructions FBD Block FBD Function Example 2 If the masked value_1 is equal to the masked value_2, set light_1 to true. If the masked value_1 is not equal to the masked value_2, clear light_1 to false. This example shows that the masked values are not equal. A 0 in the mask restrains the instruction from comparing that bit (indicated by an x in the example). Ladder Diagram Function Block Diagram 378 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions FBD Block FBD Function Not Equal To (NE) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Not Equal To (NE) instruction and the <> operator tests whether Source A is not equal to Source B. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from NEQ to NE. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 379 Chapter 5 Compare Instructions FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use the <> operator with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. Ladder Diagram Numeric Comparison Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to test against INT INT tag Source B DINT DINT REAL LINT USINT UINT UDINT 380 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Compare Instructions Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers ULINT REAL LREAL TIME TIME32 LTIME DT LDT Source B SINT SINT immediate Value to test against INT INT tag Source A DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. String Comparison Tip: Immediate string literals are only applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers. Operand Data Type Format Description Source A String type immediate literal value String to test against Source B tag Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 381 Chapter 5 Compare Instructions Operand Data Type Format Description Source B String type immediate literal value String to test against Source A tag Function Block Diagram FBD Block Operand Data Type Format Description NEQ FBD_COMPARE tag NE structure FBD_COMPARE Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value to test against SourceB. SourceB REAL Value to test against SourceA. Output Members Data Type Description EnableOut BOOL Indicates if the instruction is enabled. Dest BOOL Set to true when SourceA is not equal to SourceB. Cleared to false when SourceA is equal to SourceB. FBD Function Tip: FBD Function is applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operands (Left Pins) Data Type Description SourceA (top) SINT Value to test against SourceB INT DINT LINT USINT UINT UDINT ULINT REAL LREAL SourceB (bottom) 382 SINT Publication 1756-RM003Z-EN-P - September 2024 Value to test against SourceA. Rockwell Automation, Inc. Chapter 5 Input Operands (Left Pins) Data Type Compare Instructions Description INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description Dest BOOL Set to true when SourceA is not equal to SourceB. Cleared to false when SourceA is equal to SourceB. SeeFBD Functions on page 862FBD Functions Affects Math Status Flags No Major/Minor Faults See NE String Compare Flow Chart for faults. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Numeric compare: If Source A or Source B is NAN or Source A is not equal to Source B. Set Rung-condition-out to true else Clear Rung-condition-out to false. String compare: See NE String Compare Flow Chart. If output is false Clear Rung-condition-out to false else Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 383 Chapter 5 Compare Instructions Condition/State Action Taken Set Rung-condition-out to true Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Numeric compare: Set EnableOut to EnableIn If SourceA or SourceB is NAN or SourceA is not equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Numeric compare: If SourceA or SourceB is NAN or SourceA is not equal to SourceB. Set Dest to true else Clear Dest to false. Instruction first run N/A Instruction first scan N/A Postscan N/A NE String Compare Flow Chart 384 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Compare Instructions SourceA.LEN and SourceB.LEN are handled as unsigned values. Examples Ladder Diagram Function Block Diagram FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 385 Chapter 5 Compare Instructions FBD Function Structured Text if value_1 <> value_2 then light_4 := 1; else light_4 := 0; end_if; if value_3 <> ’I am EQUAL’ then light_5 := 1; else light_5 := 0; end_if; Valid operators This table lists the valid operators. Operator Description + - Allowed in Array Index FSC CMP CMP CPT Safety add X X X X X X subtract/neg X X X X X X ate * multiply X X X X X X / divide X X X X X X = equal X X X < less than X X X <= less than or X X X equal > greater than X X X >= greater than X X X X X X or equal <> 386 not equal Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 5 Operator Description ** exponent (x Compare Instructions Allowed in Array Index FSC CMP CMP CPT X X X X Safety to y) && Logical AND X X X || Logical OR X X X ^^ Logical XOR X X X ! Logical NOT X X X ABS absolute value X X X X X ACOS arc cosine X X X X X AND bitwise AND X X X X X ASIN arc sine X X X X X ATAN arc tangent X X X X X ATAN2 two-argument X X X X X X X arctangent COS cosine X X X X DEG radians to X X X X X X degrees BCD_TO BCD to integer X X X IsINF Is infinity X X X IsNAN Is not a X X X number LN natural log X X X X LOG log base 10 X X X X MOD modulo-divide X X X X X NOT bitwise NOT X X X X X X OR bitwise OR X X X X X X RAD degrees to X X X X X X X X X X X X radians SIN sine SQRT square root TAN tangent X X X X TOD integer to BCD X X X X X TRUNC truncate X X X X XOR bitwise X X X X X X X X X exclusive OR Expressions Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 387 Chapter 5 Compare Instructions Expressions are implemented in the Logix Designer application to be passed in as an operand expression to an instruction, or to specify a variable index, as a subscript expression, in an array. These sections describe the differences between the two. The maximum length for an operand expression is 4096 characters. Operand Expressions Operand expressions are provided as an operand to the following instructions: CPT, FAL, FSC, and CMP. Each of these instructions documents which operators are allowed in the expression and their precedence. CPT and FAL have identical operators and precedence. CMP and FSC have a slightly expanded operator list and therefore a different precedence list of operators. Subscript Expressions You can also use a subscript expression to compute an array subscript. Subscripts are processed differently than operands. See the Array Index column in the table above for a list of operators that function as subscript expressions. What is zero fill? There are two ways a smaller integer type can be converted to a larger one: • Zero fill • Sign extension The method employed depends on the instruction that is using the operand. For zero-fill, all bits above the range of the smaller type are filled with 0. For example, SINT: 16#87 = -121 converted to a DINT yields 16#00000087 = 135 For sign-extension, all bits above the range of the smaller type are filled with the sign bit of the smaller type. For example:SINT: 16#87 = -121 converted to a DINT yields 16#FFFFFF87 = -121 388 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions The compute/math instructions evaluate arithmetic operations using an expression or a specific arithmetic instruction. Available Instructions Ladder Diagram CPT on page ADD on page SUB on page MUL on page DIV on page MOD on SQRT on NEG on page ABS on page 401 page 427 422 395 433 417 405 page 411 390 Function Block Diagram FBD Block ADD on page SUB on page MUL on page DIV on page MOD on page SQRT on page NEG on page ABS on page 395 433 417 405 411 427 422 390 FBD Function ADD on page SUB on page DIV on page MOD on page SQRT on page NEG on page ABS on page 395 433 405 411 427 422 390 Structured Text SQRT on page 427 ABS on page 390 If you want to: Use this instruction: evaluate an expression CPT add two values ADD subtract two values SUB multiply two values MUL divide two values DIV determine the remainder after one value is divided by another MOD calculate the square root of a value SQRT take the opposite sign of a value NEG take the absolute value of a value ABS You can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to execute. Check the S:V bit to see whether the result was truncated. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 389 Chapter 6 Compute/Math Instructions A compute/math instruction executes once each time the instruction is scanned as long as the rung-condition-in is true. If you want the expression evaluated only once, use any one-shot instruction to trigger the instruction. Absolute Value (ABS) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the ABS instruction and operator take the absolute value of Source. The instruction stores the result in Dest while the operator simply returns the result. An overflow is indicated if the result is the maximum negative integer value, e.g. -128 for SINT, -32,768 for INT and -2,147,483,648 for DINT. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. 390 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Tip: Use ABS as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value of which to take INT INT tag the absolute value. DINT DINT REAL LINT tag Tag to store result of USINT UINT UDINT ULINT REAL LREAL Dest SINT SINT INT INT DINT DINT REAL LINT the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 391 Chapter 6 Compute/Math Instructions FBD Block Operand Data Type Format Description ABS FBD_MATH_ADVANCED tag ABS structure FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Value of which to take the absolute value. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operand (Left Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value of which to take the absolute value. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL 392 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest SINT Result of the function. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = absolute value of Source. Postscan N/A Function Block Diagram FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 393 Chapter 6 Compute/Math Instructions Condition/State Action Taken Prescan N/A EnableIn is false. Set EnableOut to EnableIn. EnableIn is true Dest = absolute value of Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = absolute value of Source Instruction first run N/A Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block Diagram FBD Block 394 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions FBD Function Structured Text DINT_dest := ABS(DINT_src); Add (ADD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the ADD instruction and the operator '+' adds Source A to Source B. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 395 Chapter 6 Compute/Math Instructions Structured Text This instruction is not available in structured text. Tip: Use the operator '+' in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers SourceA Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description immediate tag Value to add to Source B Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL LTIME* TIME* TIME32* LDT* DT* 396 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers SourceB Compute/Math Instructions Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description immediate tag Value to add to Source A tag Tag to store result of Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL LTIME* TIME* TIME32* LDT* DT* Dest SINT SINT INT INT DINT DINT REAL LINT the instruction USINT UINT UDINT ULINT REAL LREAL LTIME* TIME* TIME32* LDT* DT* Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 397 Chapter 6 Compute/Math Instructions NOTE: *Keep these considerations in mind when using relative time (LTIME, TIME32, TIME) and absolute time (LDT, DT) data types in ADD instructions: • If both Source A and Source B are relative time, the Dest must be relative time. • If Source A is relative time and Source B is absolute time or vice versa, the Dest must be absolute time. • In ADD instructions, Source A and Source B cannot both be absolute time. See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Function Block Diagram FBD Block Operand Data Type Format Description ADD FBD_MATH tag ADD structure FBD_MATH Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value to add to SourceB. SourceB REAL Value to add to SourceA. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 398 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers only SourceA (top) SINT Value to add to SourceB. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value to add to SourceA. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type Output Operand CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact (Right Pin) Description GuardLogix 5380, and GuardLogix 5580 controllers only Dest DINT Result of the function. UDINT LINT ULINT REAL LREAL See FBD Functions on page 440. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 399 Chapter 6 Compute/Math Instructions Controllers Affects Math Status Flags CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest = Source A + Source B Postscan N/A Function Block Diagram Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Dest = SourceA + SourceB If overflow occurs Clear EnableOut to false else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram 400 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Function Block Diagram FBD Block FBD Function Structured Text DINT_dest := DINT_srcA + DINT_srcB; Compute (CPT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the CPT instruction evaluates the expression and places the result in the Dest. The CPT instruction enables complex expressions in one instruction. When evaluating the expression, all non-LREAL operands convert to LREAL before performing calculations if either of these conditions are true: • Any operand in the expression is LREAL. • The Dest is LREAL. When evaluating the expression, all non-REAL operands will be converted to REAL before performing calculations if any operand or Dest in the expression is NOT LREAL, and any of these conditions are true: • Any operand in the expression is REAL. • The expression contains SIN, COS, TAN, ASN, ACS, ATN, LN, LOG, DEG or RAD. • The Dest is REAL. There are rules for allowable operators in safety applications. See Valid Operators. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 401 Chapter 6 Compute/Math Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Dest Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description tag Tag to store the result. Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Expression 402 SINT SINT immediate An expression INT INT tag consisting of tags DINT DINT Publication 1756-RM003Z-EN-P - September 2024 and/or immediate Rockwell Automation, Inc. Chapter 6 Data Type Data Type CompactLogix 5370, Operand Compute/Math Instructions ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers REAL LINT values separated by USINT operators. UINT UDINT ULINT REAL LREAL Formatting expressions For each operator used in an expression, one or two operands (tags or immediate values) must be provided. Use the following table to format operators and operands within an expression. For operators that operate on: Use this format: Example One operand operator(operand) ABS(tag) Two operands operand_a operator operand_b tag_b + 5 tag_c AND tag_d (tag_e**2) MOD (tag_f / tag_g) Determine the order of operation The instruction performs the operations in the expressions in a prescribed order. Specify the order of operation by grouping terms within parentheses. This forces the instruction to perform an operation within the parentheses ahead of the other operations. Operations of equal order are performed from left to right. Order Operation 1 () 2 ABS, ACOS, ASIN, ATAN, COS, DEG, BCD_TO, LN, LOG, RAD, SIN, SQRT, TAN, TO_BCD, TRUNC Rockwell Automation, Inc. 3 ** 4 - (negate), NOT 5 *, /, MOD 6 - (subtract), + 7 AND 8 XOR 9 OR Publication 1756-RM003Z-EN-P - September 2024 403 Chapter 6 Compute/Math Instructions Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The instruction evaluates the expression and places the result in the Dest. Postscan N/A Examples Ladder Diagram Example 1 When enabled, the CPT instruction evaluates value_1 multiplied by 5 and divides that result by the result of value_2 divided by 7 and places the final result in result_1. Example 2 When enabled, the CPT instruction truncates float_value_1 and float_value_2 to the power of two and divides the truncated float_value_1 by that result, and then stores the remainder after the division in float_value_result_cpt. 404 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Ladder Diagram Divide (DIV) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the DIV instruction and the operator '/' divides Source A by Source B. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 405 Chapter 6 Compute/Math Instructions Structured Text This instruction is not available in structured text. Tip: Use the operator '/' in an expression to compute the same result. Refer to Structured Text Syntax for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers SourceA Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Value of the dividend Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL SourceB SINT SINT immediate INT INT tag DINT DINT REAL LINT Value of the divisor USINT UINT UDINT 406 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Data Type Data Type CompactLogix 5370, Operand Compute/Math Instructions ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description tag Tag to store the result Compact GuardLogix 5380, and GuardLogix 5580 controllers ULINT REAL LREAL Dest SINT SINT INT INT DINT DINT REAL LINT of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description DIV FBD_MATH tag DIV structure FBD_MATH Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source A REAL Value of the dividend. Source B REAL Value of the divisor. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 407 Chapter 6 Compute/Math Instructions Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Input Operands (Left Pins) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type SourceA (top) SINT Value of the dividend. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value of the divisor USINT INT UINT DINT UDINT LINT ULINT REAL LREAL CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Output Operands (Right Pin) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type Dest DINT Result of the function UDINT LINT ULINT REAL LREAL See FBD Functions. Affects Math Status Flags 408 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compute/Math Instructions Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults A minor fault will occur if: Fault Type Fault Code Source_B = 0 4 4 See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest = Source A / Source B Postscan 1,2 N/A Function Block Diagram Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Dest = SourceA / SourceB 1,2 If overflow occurs Clear EnableOut to false else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 409 Chapter 6 Compute/Math Instructions Condition/State Action Taken Prescan N/A Normal Scan Dest = SourceA / SourceB Instruction first run N/A Instruction first scan N/A Postscan N/A 1 1,2 If SourceB is zero the result will be SourceA for integer divides and 1.$ for floating point divides. This condition can also cause minor overflow faults on page 145. 2 For integer destination and source operands the result is truncated. Examples Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text DINT_dst := DINT_srcA / DINT_srcB; 410 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Modulo (MOD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the MOD instruction and the operator divides Source A by Source B and places the remainder in Dest. This is done using the algorithm: Dest = Source A – (truncate ( Source A / Source B) * Source B) Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 411 Chapter 6 Compute/Math Instructions Tip: Use MOD as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram These are the operands for Ladder Diagram. Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Value of the dividend. Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Source B SINT SINT immediate INT INT tag DINT DINT REAL LINT Value of the divisor. USINT UINT UDINT ULINT REAL LREAL 412 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers Dest Compute/Math Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description tag Tag to store result of Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description MOD FBD_MATH tag MOD structure FBD_MATH Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value of the dividend. SourceB REAL Value of the divisor. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 413 Chapter 6 Compute/Math Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA (top) SINT Value of the dividend. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value of the divisor USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest DINT Result of the function. UDINT LINT ULINT REAL LREAL See FBD Functions on page 862. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers 414 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Controllers Affects Math Status Flags CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes Compute/Math Instructions 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults A minor fault will occur if: Fault Type Fault Code Source B = 0 4 4 See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest is set (to the remainder) as described in the Description section. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Dest is set (to the remainder) as described in the Description section. If an overflow occurs Clear EnableOut to false else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 415 Chapter 6 Compute/Math Instructions Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest is set (to the remainder) as described in the Description section. Instruction first run N/A Instruction first scan N/A Postscan N/A Tip: If Source B is 0, the result is 0 and a minor fault is generated. Examples Ladder Diagram Divide dividend by divisor and place the remainder in remainder. In this example, 3 goes into 10, three times, with a remainder of 1. Function Block Diagram FBD Block FBD Function Structured Text 416 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions remainder := dividend MOD divisor; Multiply (MUL) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the MUL instruction and the operator '*' multiplies Source A with Source B. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 417 Chapter 6 Compute/Math Instructions Tip: Use the operator '*' in an expression to compute the same result. Refer to Structured Text Syntax for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value of the INT INT tag multiplicand. DINT DINT REAL LINT Value of the multiplier. USINT UINT UDINT ULINT REAL LREAL Source B SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Dest 418 SINT SINT INT INT Publication 1756-RM003Z-EN-P - September 2024 tag Tag to store the result of the instruction. Rockwell Automation, Inc. Chapter 6 Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Compute/Math Instructions Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description MUL FBD_MATH tag MUL structure FBD_MATH Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value of the multiplicand. SourceB REAL Value of the multiplier. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 419 Chapter 6 Compute/Math Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Input Operands (Left Pins) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type SourceA (top) SINT Value of the multiplicand. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value of the multiplier. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Output Operand (Right Pin) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type Dest DINT Result of the function. UDINT LINT ULINT REAL LREAL See FBD Functions. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers 420 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Controllers Affects Math Status Flag CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes Compute/Math Instructions 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest = Source A x Source B Postscan N/A Function Block Diagram Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Dest = SourceA x SourceB If overflow occurs Clear EnableOut to false else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Normal Scan Dest = Source A x Source B Instruction first run N/A Publication 1756-RM003Z-EN-P - September 2024 421 Chapter 6 Compute/Math Instructions Condition/State Action Taken Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text REAL_dest := REAL_srcA * REAL_srcB; Negate (NEG) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the NEG instruction and operator subtract the Source value from zero. Available Languages 422 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use operator '-' in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 423 Chapter 6 Compute/Math Instructions Ladder Diagram Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Value to negate Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Dest SINT SINT INT INT DINT DINT REAL LINT tag Tag to store result of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description NEG FBD_MATH_ADVANCED tag NEG structure FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source 424 REAL Publication 1756-RM003Z-EN-P - September 2024 Value to negate. Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operand (Left Pin) Data Type Description Source SINT Value to negate. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description Dest DINT Result of the function. UDINT LINT ULINT REAL LREAL See FBD Functions on page 862. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 425 Chapter 6 Compute/Math Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = 0 - Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = 0 - Source. If overflow occurs Clear EnableOut to false else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = 0 - Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Examples 426 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text DINT_dest := -DINT_src; Square Root (SQRT) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The Square Root (SQRT) instruction and operator computes the square root of the Source and places the result in Dest. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from SQR to SQRT. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 427 Chapter 6 Compute/Math Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use SQRT as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. 428 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Ladder Diagram Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Computes the square INT INT tag root of this value. DINT DINT REAL LINT tag Tag to store the result USINT UINT UDINT ULINT REAL LREAL Dest SINT SINT INT INT DINT DINT REAL LINT of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description SQRT FBD_MATH_ADVANCED tag SQRT structure FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source Rockwell Automation, Inc. REAL Publication 1756-RM003Z-EN-P - September 2024 Find the square root of this value. 429 Chapter 6 Compute/Math Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operand (Left Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA SINT Computes the square root of this value. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest DINT Result of the function. UDINT LINT ULINT REAL LREAL See FBD Functions on page 862. Description If the Dest is not an LREAL/REAL, the instruction handles the fractional portion of the result as follows: 430 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions (For If the Source is: (For CompactLo CompactLo gix 5380, gix 5370, CompactLo ControlLo gix 5480, gix 5570, ControlLo Compact gix 5580, GuardLogix Compact 5370, and Example GuardLogix Example GuardLogix 5380, and 5570 GuardLogix controllers) 5580 The controllers) fractional The portion of fractional the result: portion of the result: any Truncates elementary Source DINT 3 Dest DINT 1 Source REAL 3.0 Dest DINT 2 Rounds Source DINT 3 Dest DINT 2 Source REAL 3.0 Dest DINT 2 integer tag/value any floating Rounds point Rounds tag/value If the Source is negative, the instruction takes the absolute value of the Source before calculating the square root. For the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers, if the Source is an integer data type and the Dest is an integer data type, the instruction truncates the result. For example, if the integer Source value is 3, the result is 1.732, and the Dest value becomes 1. If the Source is a real data type and the Dest is an integer type, the instruction rounds the result. For example, if the real Source value is 3.0, the result is 1.732, and the Dest value becomes 2. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 431 Chapter 6 Compute/Math Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = square root of Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest. = square root of Source. If overflow occurs Clear EnableOut to false else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = square root of Source Instruction first run N/A Instruction first scan N/A Postscan N/A Examples 432 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text REAL_dest := SQRT(INT_src); Subtract (SUB) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. When enabled, the SUB instruction and the operator '-' subtracts Source B from Source A. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 433 Chapter 6 Compute/Math Instructions FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use the operator '-' in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram 434 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Compute/Math Instructions Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value from which to INT INT tag subtract Source B. DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL LTIME* TIME* TIME32* LDT* DT* Source B SINT SINT immediate Value to subtract from INT INT tag Source A. DINT DINT REAL LINT tag Tag to store result of USINT UINT UDINT ULINT REAL LREAL LTIME* TIME* TIME32* LDT* DT* Dest SINT SINT INT INT DINT DINT REAL LINT the instruction. USINT UINT UDINT ULINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 435 Chapter 6 Compute/Math Instructions Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers REAL LREAL LTIME* TIME* TIME32* LDT* DT* Tip: *Keep these considerations in mind when using relative time (LTIME, TIME32, TIME) and absolute time (LDT, DT) data types in SUB instructions: • If both Source A and Source B are relative time, the Dest must be relative time. • If Source A is relative time and Source B is absolute time or vice versa, the Dest must be absolute time. • In ADD instructions, Source A and Source B cannot both be absolute time. See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Function Block Diagram FBD Block Operand Data Type Format Description SUB FBD_MATH tag SUB structure FBD_MATH Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. 436 SourceA REAL Value from which to subtract SourceB. SourceB REAL Value to subtract from SourceA. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Input Operands (Left Pins) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type SourceA (top) SINT Value from which to subtract SourceB. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value to subtract from SourceA. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL CompactLogix 5380, CompactLogix Output Operand 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 Description (Right Pin) controllers Data Type Dest DINT Result of the function. UDINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 437 Chapter 6 Compute/Math Instructions CompactLogix 5380, CompactLogix Output Operand 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 Description (Right Pin) controllers Data Type LINT ULINT REAL LREAL See FBD Functions on page 862. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest = Source A - Source B Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Dest = SourceA - SourceB If overflow occurs Clear EnableOut to false 438 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Condition/State Compute/Math Instructions Action Taken else Set EnableOut to true Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = SourceA - SourceB Instruction first run N/A Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block Diagram FBD Block FBD Function Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 439 Chapter 6 Compute/Math Instructions Structured Text DINT_dest := DINT_srcA - DINT_srcB; FBD Functions This information applies to the Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. FBD Functions are implemented in accordance with IEC 61131-3 Edition 3. Arithmetic and Numeric functions are provided in the Function Block Diagram language. Ladder Diagram and Structured Text languages include Arithmetic and Numeric as operators and functions. FBD Functions have one or more inputs and one output. FBD Functions are implemented for efficiency, have smaller footprints and use less system resources to operate than FBD Function Blocks. FBD Functions • Require all inputs and outputs. All inputs must be of a supported data type. • Do not have backing tags or predefined data types. Connected input values do not convert to predefined data types. • Do not have EnableIn bits and are always executed. Example: Add Function Function Overloading This information applies to the Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Function overloading defines two or more functions with the same name but different signature, such as argument or return type. FBD Functions that support overloading take a range of input data types. The output data types depend on the input data types. FBD Functions follow these rules: • Input type promotion ◦ Input type promotion ▪ Data types rankings from highest to lowest priority: LREAL, REAL, ULINT, LINT, UDINT, DINT, UINT, INT, USINT, SINT ◦ ▪ All inputs promote to the data type of the input with the highest rank before execution ▪ If all inputs have a rnak value of DINT or lower, all inputs promote to DINT type before execution Output type depends on the input type The function's output type is the promoted input type 440 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 6 Compute/Math Instructions For example, Add function, Rockwell Automation, Inc. • SINT + UINT inputs promote to DINT + DINT inputs. Outputs are DINT • USINT + LINT inputs promote to LInt + LINT inputs. Outputs are LINT • UNIT + LREAL inputs promote to LREAL + LREAL inputs. Outputs are LREAL Publication 1756-RM003Z-EN-P - September 2024 441 442 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions The Move instructions modify and move bits. Available Instructions Ladder Diagram MOVE on MVM on AND on page OR on page XOR on page NOT on page SWPB on CLR on page BTD on page page 482 page 476 451 457 462 473 467 page 486 444 Function Block Diagram FBD Block MVMT on page AND on page OR on page XOR on page NOT on page BTDT on page BAND on page BXOR on page 478 451 467 457 462 447 BOR on page BNOT on page 500 497 489 493 FBD Function BNOT on page 497 AND on page 451 BOR on page 500 NOT on page 462 BAND on page 489 OR on page 467 BXOR on page 493 XOR on page 457 Structured Text MVMT on page 478 SWPB on page 486 BTDT on page 447 If you want to: Use this instruction: Copy a value or move strings MOVE Copy a specific part of an integer MVM Copy a specific part of an integer in a function block MVMT Move bits within an integer or between integers BTD Move bits within an integer or between integers in a function BTDT block Rockwell Automation, Inc. Clear a value CLR Rearrange the bytes of an INT, DINT, or REAL tag SWPB Publication 1756-RM003Z-EN-P - September 2024 443 Chapter 7 Move/Logical Instructions The logical instructions perform logical operations on bits. If you want to: Use this instruction: Perform a bitwise AND operation AND Perform a bitwise OR operation OR Perform a bitwise, exclusive OR operation XOR Perform a bitwise NOT operation NOT You can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to execute. Check the S:V bit to see whether the result was truncated. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. A move/logic instruction executes once each time the instruction is scanned as long as the rung-condition-in is true. If you want the expression evaluated only once, use any one-shot instruction to trigger the move/logic instruction. Bit Field Distribute (BTD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The BTD instruction copies the specified bits from the Source, shifts the bits to the appropriate position, and writes the bits into the Destination. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. 444 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Ladder Diagram Operand Type Format Description Source SINT immediate Tag that contains the bits to INT tag move immediate (0-31) Number of the bit (lowest bit DINT Source bit DINT number) from where to start the move Must be within the valid range for the Source data type Destination SINT tag Tag where to move the bits immediate (0-31) The number of the bit to which INT DINT Destination bit DINT the data should be moved must be within the valid range for the Destination data type. Length DINT immediate (1-32) Number of bits to move Description When enabled, the BTD instruction copies a group of bits from the Source to the Destination. The group of bits is identified by the Source bit (lowest bit number of the Source) and the Length (number of bits to copy). The Destination bit identifies the lowest bit number to start with in the Destination. The Source remains unchanged. If the length of the bit field extends beyond the Destination, the instruction does not save the extra bits. Any extra bits do not wrap to the next word. A SINT or INT tag is converted to a DINT value by zero-fill. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Rung-condition-in is false. N/A Publication 1756-RM003Z-EN-P - September 2024 445 Chapter 7 Move/Logical Instructions Condition/State Action Taken Rung-condition-in is true. The instruction copies and shifts the Source bits to the Destination. Postscan N/A Examples Example 1 Ladder Diagram When enabled, the BTD instruction moves bits within value_1. Example 2 446 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions When enabled, the BTD instruction moves 10 bits from value_1 to value_2. Bit Field Distribute with Target (BTDT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The BTDT instruction first copies the Target to the Destination. Then the instruction copies the specified bits from the Source, shifts the bits to the appropriate position, and writes the bits into the Destination. The Target and Source remain unchanged. Available Languages Ladder Diagram This instruction is not available in a ladder diagram. Function Block Structured Text BTDT(BTDT_tag); Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 447 Chapter 7 Move/Logical Instructions Operands Function Block Operand Type Format Description BTDT tag FBD_BIT_FIELD_DISTRIBUTE structure BTDT structure Structured Text Input Parameter Data Type Description EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is set. Source DINT Input value containing the bits to move to Destination. Valid = any integer SourceBit DINT The bit position in Source (lowest bit number from where to start the move). Valid = 0-31 Length DINT Number of bits to move. Valid = 1-32 DestBit DINT The bit position in Dest (lowest bit number to start copying bits into). Valid = 0-31 Target DINT Input value to move to Dest prior to moving bits from the Source. Valid = any integer Output Parameter Data Type Description EnableOut BOOL Indicates if instruction is enabled. Dest DINT Result of the bit move operation. See Structured Text Syntax for information on the syntax of expressions within structured text. Description When true, the BTDT instruction first copies the Target to the Destination, and copies a group of bits from the Source to the Destination. The group of bits is identified by the Source bit (lowest bit number of the group) and the Length (number of bits to copy). The Destination bit identifies the lowest bit number bit to start with in the Destination. The Source and Target remains unchanged. 448 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions If the length of the bit field extends beyond the Destination, the instruction does not save the extra bits. Any extra bits do not wrap to the next word. Affects Math Status Flags Controllers Affected Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Yes Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix No 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes. Instruction first run N/A Instruction first scan N/A Postscan EnableIn and EnableOut bits are cleared to false. Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal Execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Example Step 1 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 449 Chapter 7 Move/Logical Instructions The controller copies Target into Dest. Step 2 The SourceBit and the Length specify which bits in Source to copy into Dest. Starting at DestBit, Source and Target remain unchanged. Function Block Structured Text BTDT_01.Source := sourceSTX; BTDT_01.SourceBit := source_bitSTX; 450 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions BTDT_01.Length := LengthSTX; BTDT_01.DestBit := dest_bitSTX; BTDT_01.Target := TargetSTX; BTDT(BTDT_01); distributed_value := BTDT_01.Dest; Bitwise And (AND) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The AND instruction performs a bitwise AND operation using the bits in Source A and Source B and places the result in Dest. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Function Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 451 Chapter 7 Move/Logical Instructions Structured Text This instruction is not available in structured text. Tip: Use the operator AND (or &) in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to AND with INT INT tag Source B. //Float DINT DINT includes REAL and REAL LINT LREAL data types. USINT Tip: Float inputs are UINT converted to integer UDINT which may cause an ULINT overflow. REAL LREAL Source B 452 SINT SINT immediate Value to AND with INT INT tag Source A. DINT DINT Tip: Float inputs are REAL LINT converted to integer Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Move/Logical Instructions Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers USINT which may cause an UINT overflow. UDINT ULINT REAL LREAL Dest SINT SINT tag Tag to store result of INT INT the instruction. DINT DINT Tip: If the destination REAL LINT type is Float, the USINT resultant value will be UINT converted to Float. UDINT ULINT REAL LREAL Tip: When integer promotion is required for the inputs, the smaller type is converted to the larger type using zero extension. Function Block Operand Data Type Format Description AND FBD_LOGICAL tag AND structure FBD_LOGICAL Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Rockwell Automation, Inc. SourceA DINT Value to AND with SourceB. SourceB DINT Value to AND with SourceA. Publication 1756-RM003Z-EN-P - September 2024 453 Chapter 7 Move/Logical Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fail when it was enabled. Dest DINT Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA (top) SINT Value to AND with Source B. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value to AND with Source A. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Output Operand (Right Pin) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type Dest DINT Result of the function. UDINT 454 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Output Operand (Right Pin) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type LINT ULINT See FBD Functions on page 862. Description When enabled, the instruction evaluates the bitwise AND operation: Dest = A AND B If the bit in And the bit in The bit in the Source A is: Source B is: Dest is: 0 0 0 0 1 0 1 0 0 1 1 1 Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest is set as described in the Description section. Postscan Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 N/A 455 Chapter 7 Move/Logical Instructions Function Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Set EnableOut to EnableIn Dest is set as described in the Description section. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Condition/State Action Taken Prescan N/A Normal Scan Dest = SourceA AND SourceB Instruction first run N/A Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block 456 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions FBD Function Structured Text value_result_and := value_1 AND value_2; Bitwise Exclusive Or (XOR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The XOR instruction performs a bitwise XOR operation using the bits in Source A and Source B and places the result in Dest. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Function Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 457 Chapter 7 Move/Logical Instructions Structured Text This instruction is not available in structured text. Tip: Use XOR as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to XOR with INT INT tag Source B. //Float DINT DINT includes REAL and REAL LINT LREAL data types. USINT Tip: Float inputs are UINT converted to integer UDINT which may cause an ULINT overflow. REAL LREAL Source B 458 SINT SINT immediate Value to XOR with INT INT tag Source A. DINT DINT Tip: Float inputs are REAL LINT converted to integer Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Data Type Data Type CompactLogix 5370, ControlLogix 5570, Operand Move/Logical Instructions Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers USINT which may cause an UINT overflow. UDINT ULINT REAL LREAL Dest SINT SINT tag Tag to store result of INT INT the instruction. DINT DINT Tip: If the destination REAL LINT type is Float, the USINT resultant value will be UINT converted to Float. UDINT ULINT REAL LREAL Tip: When integer promotion is required for the inputs, the smaller type is converted to the larger type using zero extension. Function Block Operand Data Type Format Description XOR FBD_LOGICAL tag XOR structure FBD_LOGICAL Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Rockwell Automation, Inc. SourceA DINT Value to XOR with SourceB. SourceB DINT Value to XOR with SourceA. Publication 1756-RM003Z-EN-P - September 2024 459 Chapter 7 Move/Logical Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest DINT Result of the instruction. FBD Function CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Input Operands (Left Pins) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type SourceA (top) SINT Value to OR with Source B. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL SourceB (bottom) SINT Value to OR with Source A. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Output Operand (Right Pin) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type Dest DINT Result of the function. UDINT LINT ULINT Description 460 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions When enabled, the instruction evaluates the bitwise XOR operation: Dest = Source A XOR Source B If the bit in And the bit in The bit in Source A is: Source B is: Dest is: 0 0 0 0 1 1 1 0 1 1 1 0 Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest is set as described in the Description section. Postscan N/A Function Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Set EnableOut to EnableIn Dest is set as described in the Description section. Rockwell Automation, Inc. Instruction first run N/A Instruction first scan N/A Publication 1756-RM003Z-EN-P - September 2024 461 Chapter 7 Move/Logical Instructions Condition/State Action Taken Postscan N/A Examples Ladder Diagram Function Block FBD Function Structured Text value_result_XOR := value_1 XOR value_2; Bitwise Not (NOT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The NOT instruction performs a bitwise inversion of the Source and places the result in Dest. Available Languages 462 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Function Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use NOT as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 463 Chapter 7 Move/Logical Instructions CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Operand 5370, and GuardLogix 5570 controllers CompactLogix 5480, ControlLogix 5580, Compact GuardLogix Format Description 5380, and GuardLogix 5580 controllers Data Type Source CompactLogix 5380, Data Type SINT SINT immediate Value to NOT INT INT tag //FLOAT includes REAL DINT DINT and LREAL data types. REAL LINT Tip: Floating point USINT inputs are converted UINT to integer which may UDINT cause an overflow. ULINT REAL LREAL Dest SINT SINT INT INT tag Tag to store result of the instruction. DINT DINT Tip: If the destination REAL LINT type is FLOAT, the USINT resultant value will be UINT converted to floating UDINT point. ULINT REAL LREAL Tip: When integer promotion is required for the inputs, the smaller type is converted to the larger type using zero extension. Function Block Operand Data Type Format Description NOT FBD_CONVERT tag NOT structure FBD_CONVERT Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source 464 DINT Publication 1756-RM003Z-EN-P - September 2024 Value to NOT. Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest DINT Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Source (top) SINT Value to NOT. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest DINT Result of the function. UDINT LINT ULINT See FBD Functions on page 862. Description When enabled, the instruction evaluates the bitwise NOT operation: Dest = NOT Source Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 465 Chapter 7 Move/Logical Instructions If the bit in the Source is: The bit in the Dest is: 0 1 1 0 Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest is set as described in the Description section. Postscan N/A Function Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Set EnableOut to EnableIn Dest is set as described in the Description section. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 466 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Condition/State Action Taken Prescan N/A Normal Scan Dest = NOT Source Instruction first run N/A Instruction first scan N/A Postscan N/A Move/Logical Instructions Examples Ladder Diagram Function Block FBD Function Structured Text value_result_NOT := NOT value_1; Bitwise Inclusive Or (OR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The OR instruction performs a bitwise OR operation using the bits in Source A and Source B and places the result in Dest. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 467 Chapter 7 Move/Logical Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use OR as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: 468 • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions There are data conversion rules for mixing numeric data types within an instruction. See Data Conversion on page 851s. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate Value to OR with Source INT INT tag B. //Float includes REAL DINT DINT and LREAL data types. REAL LINT Tip: Float inputs are USINT converted to integer UINT which may cause an UDINT overflow. ULINT REAL LREAL Source B SINT SINT immediate Value to OR with Source INT INT tag A. DINT DINT Tip: Float inputs are REAL LINT converted to integer USINT which may cause an UINT overflow. UDINT ULINT REAL LREAL Dest SINT SINT tag Tag to store result of INT INT the instruction. DINT DINT Tip: If the destination REAL LINT type is Float, the USINT resultant value will be UINT converted to Float. UDINT ULINT REAL LREAL Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 469 Chapter 7 Move/Logical Instructions Tip: When integer promotion is required for the inputs, the smaller type is converted to the larger type using zero extension. Function Block Operand Type Format Description OR FBD_LOGICAL tag OR structure FBD_LOGICAL Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA DINT Value to OR with SourceB. SourceB DINT Value to OR with SourceA. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed successfully when it was enabled. Dest DINT Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceA (top) SINT Value to OR with Source B. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL 470 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers SourceB (bottom) SINT Value to OR with Source A. USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest DINT Result of the function. UDINT LINT ULINT See FBD Functions. Description When enabled, the instruction evaluates the bitwise OR operation: Dest = Source A OR Source B If the bit in And the bit in The bit in Source A is: Source B is: Dest is: 0 0 0 0 1 1 1 0 1 1 1 1 Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 471 Chapter 7 Move/Logical Instructions Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in Rung-condition-in is true Set Rung-condition-out to Rung-condition-in Dest is set as described in the Description section. Postscan N/A Function Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn EnableIn is true Set EnableOut to EnableIn Dest is set as described in the Description section. Instruction first run N/A Instruction first scan N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 472 Condition/State Action Taken Prescan N/A Normal Scan Dest = SourceA OR SourceB Instruction first run N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Condition/State Action Taken Instruction first scan N/A Postscan N/A Move/Logical Instructions Examples Ladder Diagram Function Block FBD Function Structured Text value_result_or := value_1 OR value_2; Clear (CLR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The CLR instruction clears all the bits of the Dest. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 473 Chapter 7 Move/Logical Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. The CLR instruction supports elementary data types. See Elementary Data Types. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Dest Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description tag Tag to clear. Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL LTIME TIME TIME32 LDT 474 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Data Type CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers Move/Logical Instructions Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers DT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Clear Dest to 0. Postscan N/A Example Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 475 Chapter 7 Move/Logical Instructions Masked Move (MVM) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The MVM instruction copies the Source to a Destination and allows portions of the data to be masked. The MVM instruction uses a Mask to pass or block Source data bits. A "1" in the mask means the data bit is passed; a "0" in the mask means the data bit is blocked. If integer data types are mixed, the instruction fills the upper bits of the smaller integer data types with 0s so that they are the same size as the largest data type. Entering an immediate mask value When mask is entered, the programming software defaults to decimal values. To enter a mask using another format, precede the value with the correct prefix. Prefix Description 16# Hexadecimal (e.g., 16#0F0F) 8# Octal (e.g., 8#16) 2# Binary (e.g., 2#00110011) Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands 476 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixed data types within an instruction. See Data Conversions. Ladder Diagram Operand Data Type Format Description Source SINT immediate Value to move INT tag DINT Mask SINT immediate INT tag Which bits to block or pass DINT Dest SINT tag Tag to store the result INT DINT Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, No Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults Controllers A minor fault will occur if: Fault Type Fault Code CompactLogix 5380, The feature is enabled and 4 4 CompactLogix 5480, overflow is detected N/A N/A ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, N/A ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers See Index Through Arrays on page 863 for array-indexing faults. Execution Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 477 Chapter 7 Move/Logical Instructions Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction passes the Source through the Mask and copies the result into the Destination. Unmasked bits in the Destination remain unchanged. Postscan N/A Example Ladder Diagram Row 1: value_b before MVM Row 2: value_a Row 3: mask_2 Row 4: value_b after MVM Copy data from value_a to value_b, while allowing data to be masked (a 0 masks the data in value_a). Masked Move with Target (MVMT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The MVMT instruction copies the Source to a Destination and allows portions of the data to be masked. 478 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Available Languages Ladder Diagram This instruction is not available in Ladder Diagram. Function Block Structured Text MVMT(MVMT_tag); Operands Structured Text Variable Type Format Description MVMT tag FBD_MASKED_MOVE Structure MVMT structure See Structured Text Syntax on page 879 for information on the syntax of expressions within structured text. Function Block Operand Type Format Description MVMT tag FBD_MASKED_MOVE Structure MVMT structure FBD_MASKED_MOVE Structure Input Parameter Data Type Description EnableIn BOOL If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes. Default is set. Source DINT Input value to move to Destination based on value of Mask. Valid = any integer Mask DINT Mask of bits to move from Source to Dest. All bits set to one cause the corresponding bits to move from Source Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 479 Chapter 7 Move/Logical Instructions Input Parameter Data Type Description to Dest. All bits that are set to zero cause the corresponding bits not to move from Source to Dest. Valid = any integer Target DINT Input value to move to Dest prior to moving Source bits through the Mask. Valid = any integer Output Parameter Data Type Description EnableOut BOOL Indicates if instruction is enabled. Dest DINT Result of the masked move operation. Description When enabled, the MVMT instruction uses a Mask to pass or block Source data bits. A "1" in the mask means the data bit is passed. A "0" in the mask means the data bit is blocked. If you mix integer data types, the instruction fills the upper bits of the smaller integer data types with 0s so that they are the same size as the largest data type. Entering an immediate mask value using an Input Reference When you enter a mask, the programming software defaults to decimal values. If you want to enter a mask using another format, precede the value with the correct prefix. Prefix Description 16# hexadecimal (e.g., 16#0F0F) 8# octal (e.g., 8#16) 2# binary (e.g., 2#00110011) Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, No Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes for the output 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Common Attributes for operand-related faults. Execution 480 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Function Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes. Instruction first run N/A Instruction first scan N/A Postscan EnableIn and EnableOut bits are cleared to false. Structured Text Condition/State Action Taken Prescan See Prescan in the Function Block table. Normal execution See Tag.EnableIn is true in the Function Block table. Postscan See Postscan in the Function Block table. Examples Step 1 The controller copies Target into Dest. Step 2 The instruction masks Source and compares it to Dest. Any required changes are made in Dest, which becomes and input parameter to value_masked. Source and Target remain unchanged. A 0 in the mask restrains the instruction from comparing that bit. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 481 Chapter 7 Move/Logical Instructions Function Block Structured Text MVMT_01.Source := value_1; MVMT_01.Mask := mask_1; MVMT_01.Target := target; MVMT(MVMT_01); value_masked := MVMT_01.Dest; Move (MOVE) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The MOVE instruction moves a copy of the Source to the Dest. The Source remains unchanged. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from MOV to MOVE. Available Languages Ladder Diagram 482 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Tip: Use an assignment ":=" with an expression to achieve the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions on page 851. Ladder Diagram Numeric Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Value to move Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 483 Chapter 7 Move/Logical Instructions Data Type CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description tag Tag to store the result Compact GuardLogix 5380, and GuardLogix 5580 controllers DT LDT Dest SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL TIME TIME32 LTIME DT LDT Tip: See Time and date data types on page 858 for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types. Tip: Keep these restrictions in mind when using Relative Time (LTIME, TIME, TIME32) and Absolute Time (LDT, DT) data types: • A relative time type can move only to or from another relative time type. • And absolute time type can move only to or from another absolute time type. Additionally, you can program an absolute time type with a LINT to accommodate some legacy timestamp practices. String (for CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only) Operand Data Type Format Description Source String type immediate String to move tag Dest 484 String type Publication 1756-RM003Z-EN-P - September 2024 tag Tag to store the result Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math Status Flags on page 849. Major/Minor Faults A minor fault will occur if: Fault type Fault code Overflow detection feature is enabled and 4 4 the Source value is outside the range of Dest type. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The instruction copies the Source into the Dest. String operands: If Source.LEN > SIZE( Dest.DATA) The string is truncated to what will fit S:V is set. Postscan N/A Examples Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 485 Chapter 7 Move/Logical Instructions Ladder Diagram Structured Text value_2 := value_1; value_3 := 'Test PASSED'; Swap Byte (SWPB) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The SWPB instruction rearranges the order of the bytes of the Source. It places the result in the Destination. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text SWPB(Source, Order Mode, Dest); Operands 486 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversion. Ladder Diagram and Structured Text Operand Data Type Format Description Source INT tag Tag that contains the bytes to DINT rearrange. Order Mode list item This operand specifies how to reorder. Refer Order Mode table. Dest INT tag Tag to store the bytes in a new DINT order. Refer Dest table. If selecting the HIGH/LOW order mode, enter it as HIGHLOW (without the slash). See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Order Mode And you want to change the bytes to If the Source is an this pattern(each letter represents a Then select different byte) INT AB => BA Any option DINT ABCD => DCBA REVERSE ABCD =>CDAB WORD ABCD => BADC HIGH/LOW Dest If the Source is an Then the Destination must be an INT INT, DINT If the destination is a DINT, the result is sign extended after bytes swap. DINT DINT Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 487 Chapter 7 Move/Logical Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction rearranges the specified bytes. Postscan N/A Structured Text Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table. Normal Execution See Rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. Examples Example 1 - Swap the bytes of a DINT tag The three SWPB instructions reorder the bytes of DINT_1 according to a different order mode. The display style is ASCII, and each character represents one byte. Every instruction places the bytes, in the new order, in a different Destination. Ladder Diagram Example 2 - Swap the bytes in all elements of an array 488 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Ladder Diagram Example 3: SWPB on Structured Text Structured Text index := 0; SIZE (array[0],0,array_length); REPEAT SWPB(array[index],REVERSE,array_bytes_reverse[index]); index := index + 1; UNTIL(index >= array_length)END_REPEAT; Boolean AND (BAND) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The BAND instruction logically ANDs up to eight Boolean inputs. To perform a bitwise AND, refer to Bitwise And (AND). Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Diagram Function Block Diagram supports these elements: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 489 Chapter 7 Move/Logical Instructions FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Operands Function Block Diagram FBD Block Operand Data Type Format Description BAND tag FBD_BOOLEAN_AND structure BAND structure FBD_BOOLEAN_AND Structure Input Members Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. Default is set. In1 BOOL First Boolean input. Set to 1 on first download. In2 BOOL Second Boolean input. Set to 1 on first download. 490 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Input Members Data Type Description In3 BOOL Third Boolean input. Set to 1 on first download. In4 BOOL Forth Boolean input. Set to 1 on first download. In5 BOOL Fifth Boolean input. Set to 1 on first download. In6 BOOL Sixth Boolean input. Set to 1 on first download. In7 BOOL Seventh Boolean input. Set to 1 on first download. In8 BOOL Eighth Boolean input. Set to 1 on first download. Output Members Data Type Description EnableOut BOOL Indicates if instruction is enabled. Out BOOL The output of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operands (Left Pins) Data Type Description In1 BOOL First Boolean input In2 BOOL Second Boolean input Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Out BOOL The output of the instruction. See FBD Functions. Operation FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 491 Chapter 7 Move/Logical Instructions The BAND instruction ANDs up to eight Boolean inputs. If an input is not used, it defaults to set (1). Out = In1 AND In2 AND In3 AND In4 AND In5 AND In6 AND In7 AND In8 IMPORTANT: When removing an input wire from the BAND instruction during an edit, make sure the input is set (1). FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. The FBD Function ANDs two Boolean inputs. Out = In1 AND In2 Affects Math Status Flags No Major/Minor Faults None specific to this instruction. Execution Function Block Diagram FBD Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes as described in the Operation section. Instruction first run N/A Instruction first scan N/A Postscan EnableIn and EnableOut bits are cleared to false. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 492 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Condition/State Action Taken Prescan N/A Normal Scan Out = In1 AND In2 Instruction first run N/A Instruction first scan N/A Postscan N/A Move/Logical Instructions Example Function Block Diagram FBD Block In this example, bool_in1 is copied into BAND_02.In1, bool_in2 is copied into BAND_02.In2, the result of performing AND of all BAND_02 inputs is placed into BAND_02.Out, and BAND_02.Out is then copied into value_result_and. If bool_in1 is: If bool_in2 is: Then value_result_and is: 0 0 0 0 1 0 1 0 0 1 1 1 FBD Function This example illustrates performing an AND on bool_in1 and bool_in2 and places the result in value_result_and. Boolean Exclusive OR (BXOR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The BXOR instruction performs an exclusive OR on two Boolean inputs. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 493 Chapter 7 Move/Logical Instructions Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Operands Function Block Diagram FBD Block Operand Data Type Format Description BXOR tag FBD_BOOLEAN_XOR Structure BXOR structure FBD_BOOLEAN_XOR Structure Input Members Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. 494 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Input Members Data Type Move/Logical Instructions Description Default is set. In1 BOOL First Boolean input. Default is cleared. In2 BOOL Second Boolean input. Default is cleared. Output Members Data Type Description EnableOut BOOL Indicates if instruction is enabled. Out BOOL The output of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers In1 BOOL First Boolean input. In2 BOOL Second Boolean input. Data Type CompactLogix 5380, CompactLogix Output Operands (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Out BOOL The output of the instruction. SeeFBD Functions on page 862FBD Functions. Operation The BXOR instruction performs an exclusive OR on two Boolean inputs. Out = In1 XOR In2 Affects Math Status Flags No Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 495 Chapter 7 Move/Logical Instructions Major/Minor Faults None specific to this instruction. Execution Function Block Diagram FBD Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes as described in the Operation section. Instruction first run N/A Instruction first scan N/A Postscan EnableIn and EnableOut bits are cleared to false. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Out = In1 XOR In2 Instruction first run N/A Instruction first scan N/A Postscan N/A Example Function Block Diagram In this example, bool_in1 is copied into BXOR_02.In1, bool_in2 is copied into BXOR_02.In2, the result of performing an exclusive OR on BXOR_02.In1 and BXOR_02.In2 is placed into BXOR_02.Out, and BXOR_02.Out is then copied into value_result_xor. 496 If bool_in1 is: If bool_in2 is: Then value_result_xor is: 0 0 0 0 1 1 1 0 1 1 1 0 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions FBD Block This example illustrates performing an exclusive OR on bool_in1 and bool_in2 and places the result in value_result_xor. FBD Function Boolean NOT (BNOT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The BNOT instruction complements a Boolean input. To perform a bitwise NOT, refer to Bitwise Not (NOT). Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 497 Chapter 7 Move/Logical Instructions Structured Text This instruction is not available in structured text. Operands Function Block Diagram FBD Block Operand Data Type Format Description BNOT tag FBD_BOOLEAN_NOT structure BNOT structure FBD_BOOLEAN_NOT Structure Input Members Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. Default is set. In BOOL Input to the instruction. Set to 1 on first download Output Members Data Type Description EnableOut BOOL Indicates if instruction is enabled. Out BOOL The output of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers In 498 BOOL Publication 1756-RM003Z-EN-P - September 2024 Input to the instruction. Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Out BOOL The output of the instruction. See FBD Functions on page 862. Operation The BNOT instruction complements a Boolean input. Out = NOT In Affects Math Status Flags No Major/Minor Faults None specific to this instruction. Execution Function Block Diagram FBD Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes as described in the Operation section. Instruction first run N/A Instruction first scan N/A Postscan EnableIn and EnableOut bits are cleared to false. FBD Functions Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Normal Scan The instruction executes as described in the Operation section. Publication 1756-RM003Z-EN-P - September 2024 499 Chapter 7 Move/Logical Instructions Condition/State Action Taken Instruction first run N/A Instruction first scan N/A Postscan N/A Example Function Block Diagram FBD Block In this example, bool_in1 is copied into BNOT_02.In, the result of the complement of BNOT_02.In is placed into BNOT_02.Out and BNOT_02.Out is copied into value_result_not. If bool_in1 is: Then value_result_not is: 0 1 1 0 FBD Function In this example, the result of the complement of bool_in1 is placed in value_result_not. Boolean OR (BOR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Controller differences are noted where applicable. The BOR instruction logically ORs up to eight Boolean inputs. To perform a bitwise OR, refer to Bitwise Or (OR). Available Languages Ladder Diagram This instruction is not available in ladder diagram. Function Block Diagram Function Block Diagram supports these elements: 500 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions FBD Block FBD Function Tip: FBD Function supports only two inputs and is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Operands Function Block Diagram FBD Block Operand Data Type Format Description BOR tag FBD_BOOLEAN_OR structure BOR structure FBD_BOOLEAN_OR Structure Input Members Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. Set to 0 on first download. In1 BOOL First Boolean input. Set to 0 on first download. In2 BOOL Second Boolean input. Set to 0 on first download. In3 Rockwell Automation, Inc. BOOL Publication 1756-RM003Z-EN-P - September 2024 Third Boolean input. 501 Chapter 7 Move/Logical Instructions Input Members Data Type Description Set to 0 on first download. In4 BOOL Forth Boolean input. Set to 0 on first download. In5 BOOL Fifth Boolean input. Set to 0 on first download. In6 BOOL Sixth Boolean input. Set to 0 on first download. In7 BOOL Seventh Boolean input. Set to 0 on first download. In8 BOOL Eighth Boolean input. Set to 0 on first download. Output Members Data Type Description EnableOut BOOL Indicates if instruction is enabled. Out BOOL The output of the instruction. FBD Function Tip: FBD Function supports only two inputs and is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pins) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers In1 BOOL First Boolean input. In2 BOOL Second Boolean input. Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Out BOOL The output of the instruction. See FBD Functions on page 862. 502 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 7 Move/Logical Instructions Operation FBD Block The BOR instruction ORs up to eight Boolean inputs. If an input is not used, it defaults to cleared (0). Out = In1 OR In2 OR In3 OR In4 OR In5 OR In6 OR In7 OR In8 IMPORTANT: When removing an input wire from the BOR instruction during an edit, make sure the input is cleared (0). FBD Function Tip: FBD Function supports only two inputs and is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. The FBD Function ORs two Boolean inputs. Out = In1 OR In2 Affects Math Status Flags No Major/Minor Faults None specific to this instruction. Execution Function Block Diagram FBD Block Condition/State Action Taken Prescan EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is false EnableIn and EnableOut bits are cleared to false. Tag.EnableIn is true EnableIn and EnableOut bits are set to true. The instruction executes as described in the Operation section. Instruction first run N/A Instruction first scan N/A Postscan EnableIn and EnableOut bits are cleared to false. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 503 Chapter 7 Move/Logical Instructions Condition/State Action Taken Prescan N/A Normal Scan Out = In1 OR In2 Instruction first run N/A Instruction first scan N/A Postscan N/A Example Function Block Diagram FBD Block In this example, bool_in1 is copied into BOR_02.In1, bool_in2 is copied into BOR_02.In2, the result of performing OR of all BOR_02 inputs is placed into BOR_02.Out, and BOR_02.Out is then copied into value_result_or. If bool_in1 is: If bool_in2 is: Then value_result_or is: 0 0 0 0 1 1 1 0 1 1 1 1 FBD Function 504 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions The file/miscellaneous instructions operate on arrays of data. Available Instructions Ladder Diagram AVE on page COP on page CPS on page FAL on page FLL on page FSC on page SIZE on page 529 506 506 514 533 536 557 NOTE: STD on page 553 Function Block Not available Structured Text SIZE on page 557 COP on page 506 CPS on page 506 If you want to: Use this instruction: Perform arithmetic, logic, shift, and function operations on FAL values in arrays Search for and compare values in arrays FSC Copy the contents of one array into another array COP Copy the value(s) in the Source to the Destination CPS Fill an array with specific data FLL Calculate the average of an array of values AVE Sort one dimension of array data into ascending order SRT Calculate the standard deviation of an array of values STD Find the size of a dimension of an array SIZE You can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to execute. Check the S:V bit to see whether the result was truncated. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. Selecting Mode of Operation For FAL and FSC instructions, the mode tells the controller how to distribute the array operation. If you want to: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 Select this mode: 505 Chapter 8 Array File-Misc Instructions operate on all of the specified elements in an array before All Mode continuing on to the next instruction distribute array operation over a number of scans Numerical Mode enter the number of elements to operate on per scan (1-2147483647) manipulate one element of the array each time the Incremental Mode rung-condition-in goes from false to true Copy (COP) - Synchronous Copy (CPS) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, CompactLogix 5380, CompactLogix 5480, and ControlLogix 5580 controllers. Controller differences are noted where applicable. The COP and CPS instructions copy the value(s) in the Source to the values in the Dest. The Source remains unchanged. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text COP(Source,Dest,Length); CPS(Source,Dest,Length); Operands IMPORTANT: Unexpected operation may occur if: 506 • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Ladder Diagram CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers Data Type Source CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix Format Description tag Initial element to copy. 5380, and GuardLogix 5580 controllers Data Type SINT SINT INT INT For controllers that DINT DINT support the REF_TO LINT LINT motion data types, REAL USINT the supported axis String type UINT operand type can structure UDINT be replaced by an ULINT equivalent REF_TO type. REAL The Reference (REF) LREAL Instruction associates a String type reference with an axis structure or coordinate system concrete tag. Dest SINT SINT tag Initial element to be INT INT overwritten by the DINT DINT Source LINT LINT REAL USINT String type UINT structure UDINT ULINT REAL LREAL String type structure Length SINT SINT immediate Number of Destination INT INT tag elements to copy DINT DINT Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 507 Chapter 8 Array File-Misc Instructions CompactLogix 5370, ControlLogix 5570, Operand Compact GuardLogix 5370, and GuardLogix 5570 controllers Data Type Source CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix Format Description tag Initial element to copy tag Initial element to be 5380, and GuardLogix 5580 controllers Data Type SINT SINT INT INT DINT DINT LINT LINT REAL USINT String type UINT structure UDINT ULINT REAL LREAL String type structure REF_TO_AXIS_VIRTUAL REF_TO_AXIS_CONSU MED REF_TO_AXIS_GENERIC_ DRIVE REF_TO_AXIS_SERVO REF_TO_AXIS_SERVO_DR IVE REF_TO_AXIS_CIP_DRIVE Dest SINT SINT INT INT overwritten by the DINT DINT Source LINT LINT REAL USINT String type UINT structure UDINT ULINT REAL LREAL String type structure Length SINT SINT immediate Number of Destination INT INT tag elements to copy DINT DINT See Structured Text Syntax for more information on the syntax of expressions within structured text. 508 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index Through Arrays for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The instruction copies the data. Postscan N/A Structured Text Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table Normal execution See Rung-condition-in is true in Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. During execution of the COP and CPS instructions, other controller actions may try to interrupt the copy operation and change the source: If the source or destination is: And need to: Then select: Notes CPS Tasks that attempt to interrupt • produced tag Prevent the source data from • consumed tag changing during the copy a CPS instruction are delayed • I/O data operation until the instruction is done. • data that another task To estimate the execution time can overwrite of the CPS instruction, refer non-atomic tag that is to the ControlLogix System written to by a remote User Manual, publication device 1756-UM001. • Use interlock application code to ensure a remote client is not updating the source while the CPS instruction is executing. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 509 Chapter 8 Array File-Misc Instructions If the source or destination is: And need to: Then select: Allow the source data to COP Notes change during the copy operation None of the above ---------------> COP The COP and CPS instructions operate on contiguous memory and perform a straight byte-to-byte memory copy. When the Source and Dest are different data types the number of bytes copied equals the smaller of: • Requested amount equals Length x (the number of bytes in a destination element) • The number of bytes in the destination tag • For Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, or GuardLogix 5580 controller s: the number of bytes in the source tag Tip: The end of the destination or source tag is defined as the last byte of the base tag. If the tag is a structure, the end of the tag is the last byte of the last element of the structure. This means the COP and CPS instruction could write past the end of a member array but will never write past the end of the base tag. IMPORTANT: Test and confirm that the instruction does not change data that it should not change. Examples Example 1 Copy an array. When enabled, the COP instruction copies 40 bytes from array_4 to array_5. array_4 is a DINT (4 bytes per element) and contains 10 elements (total size = 40 bytes) array_5 is a DINT (4 bytes per element) and contains 10 elements (total size = 40 bytes). The Length says 10 destination elements should be copied so 40 bytes are copied. Ladder Diagram Structured Text 510 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions COP(array_4[0],array_5[0],10); Example 2 Copy a structure. When enabled, the COP instruction copies the structure timer_1 into element 5 of array_timer. timer_1 is a TIMER (total size = 12 bytes). array_timer is a TIMER (12 bytes per element) and contains 10 elements (total size = 120 bytes). The Length says 1 destination elements so 12 bytes are copied. Ladder Diagram Structured Text COP(timer_1,array_timer[5],1); Example 3 Copy array data while preventing the data from being changed until the copy is complete. The project_data array (100 elements) stores a variety of values that change at different times in the application. To send a complete image of project_data at one instance in time to another controller, the CPS instruction copies project_data to produced_array. While the CPS instruction copies the data, no I/O updates or other tasks can change the data. The produced_array tag produces the data on a ControlNet network for consumption by other controllers. project_data is a DINT (4 bytes per element) and contains 100 elements (total size = 400 bytes) produced_array is a DINT (4 bytes per element) and contains 100 elements (total size = 400 bytes). The Length says 100 destination elements so 400 bytes are copied. Ladder Diagram Structured Text CPS(project_data[0],produced_array[0],100); Example 4 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 511 Chapter 8 Array File-Misc Instructions Copy data to a produced tag while preventing the data from being sent until the copy is complete. Local:0:I.Data stores the input data for the DeviceNet network that is connected to the 1756-DNB module in slot 0. To synchronize the inputs with the application, the CPS instruction copies the input data to input_buffer. While the CPS instruction copies the data, no I/O updates can change the data. As the application executes, it uses for its inputs the input data in input_buffer. Local:O:I.Data is a DINT (4 bytes per element) and contains 2 elements (total size = 8 bytes) input_buffer is a DINT (4 bytes per element) and contains 20 elements (total size = 80 bytes). The Length says 20 destination elements should be copied (4 X 20 = 80 bytes). However the source can only provide 8 bytes so 8 bytes are copied. Ladder Diagram Structured Text CPS(Local:0:I.Data[0], input_buffer[0], 20); Example 5 Initialize an array structure, initialize the first element and the use COP to replicate it to the rest of the array. 512 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions This example initializes an array or timer structures. When enabled, the MOV instructions initialize the .PRE and .ACC values of the first array_timer element. When enabled, the COP instruction copies a contiguous block of bytes, starting at array_timer[0]. The length is nine timer structures. array_timer is a TIMER (12 bytes per element) and contains 15 elements (total size = 180 bytes) The Length says 10 destination elements so 120 bytes are copied. Ladder Diagram Structured Text IF S:FS THEN array_timer[0].pre := 500; array_timer[0].acc := 0; COP(array_timer[0],array_timer[1],10); END_IF; Example 6 Copy different sized arrays. When enabled, the COP instruction copies bytes from SINT array_6 to DNT array_7. array_6 is a SINT (1 byte per element) and contains 5 elements (total size = 5 bytes) array_7 is a DINT (4 bytes per element) and contains 10 elements (total size = 40 bytes). The Length says 20 destination elements should be copied (4 X 20 = 80 bytes). However the dest can only accept 40 bytes and the source can only provide 5 bytes so 5 bytes are copied. Ladder Diagram Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 513 Chapter 8 Array File-Misc Instructions COP(array_4[0],array_5[0],10); File Arithmetic and Logic (FAL) This instruction applies to the Compact GuardLogix 5370 and Compact GuardLogix 5380, CompactLogix 5370, CompactLogix 5380, and CompactLogix 5480, ControlLogix 5570 and ControlLogix 5580, and GuardLogix 5570 and GuardLogix 5580 controllers. The FAL instruction performs copy, arithmetic, logic, and function operations on data stored in an array. When the rung-condition-in of the FAL instruction transitions from false to true, the expression given will be executed over the specified mode of iteration. There are rules for allowable operators in safety applications. See Valid Operators. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. Ladder Diagram 514 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Control CONTROL Array File-Misc Instructions Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Tag Control structure for the Compact GuardLogix 5380, and GuardLogix 5580 controllers CONTROL operation Length DINT DINT Immediate This represents the CONTROL structure .LEN Position DINT DINT Immediate This represents the CONTROL structure .POS Mode DINT DINT Immediate Shows how to distribute the operation. Select INC, ALL, or enter number in the range of 1 to 2147483647 Expression SINT SINT Immediate An expression INT INT Tag consisting of tags DINT DINT and/or immediate REAL LINT values separated by USINT operators. UINT UDINT ULINT REAL LREAL Destination SINT SINT Tag The value of the INT INT Expression will be DINT DINT stored in destination. REAL LINT USINT UINT UDINT ULINT REAL LREAL Length and Position (corresponding to .LEN and .POS in the control tag) are pseudo-operands. For details, see Pseudo-operand initialization on page 856. CONTROL Structure Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 515 Chapter 8 Array File-Misc Instructions Mnemonic Data Type Description .EN BOOL The enable bit indicates the FAL instruction is enabled. .DN BOOL The done bit is set when the instruction has operated on the last element (.POS = .LEN). .ER BOOL When an overflow occurs, both platforms will set .ER and sop executing the instruction. The following controllers will generate an overflow: .LEN DINT • CompactLogix 5370 • ControlLogix 5570 The length specifies the number of elements in the array on which the FAL instruction operates. .POS DINT The position is initialized to 0 when the instruction starts and is incremented each time the loop operates. The value of the expression is stored in the specified destination tag. When an overflow occurs, it will set the ER bit and stop the execution. Once FAL completes all of the configured iterations, the .DN bit will be set. Select Mode of Operation For FAL instructions, the mode tells the controller how to distribute the array operation. If: Select this mode: Operating on all of the specified elements in an array before All continuing to the next instruction. Distributing array operation over a number of scans. Numerical Enter the number of elements to operate on per scan (1-2147483647). Manipulating one element of the array each time the EnableIn Incremental goes from false to true. All Mode In All Mode, the instruction operates on all the specified elements of the array before continuing to the next instruction. The operation begins when the instruction’s EnableIn goes from false to true. The position (.POS) value in the control structure points to the element in the array that the instruction is currently using. Operation stops when 516 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions the .POS value equals or exceeds the .LEN value, and when overflow occurs in the expression and the .ER bit is set to true. The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is true. The .DN bit, the .EN bit, and the .POS value are cleared when the EnableIn is false. Only then can another execution of the instruction be triggered by a false-to-true transition of EnableIn. Numerical Mode Numerical mode distributes the array operation over a number of scans. Use this mode when working with non-timecritical data or large amounts of data. Enter the number of elements to operate on for each scan, which keeps scan time shorter. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 517 Chapter 8 Array File-Misc Instructions Execution is triggered when the EnableIn goes from false to true. Once triggered, the instruction is executed each time it is scanned for the number of scans necessary to complete operating on the entire array. Once triggered, EnableIn can change repeatedly without interrupting execution of the instruction. Avoid using the results of a file instruction operating in numerical mode until the .DN bit is set. The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is set. If the EnableIn is true at completion, the .EN and .DN bit are true until the EnableIn goes false. When the EnableIn goes false, these bits are cleared and the .POS value is cleared. If the EnableIn is false at completion, the .EN bit is cleared immediately. One scan after the .EN bit is cleared, the .DN bit and the .POS value are cleared. Incremental Mode 518 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Incremental mode manipulates one element of the array each time the instruction’s EnableIn goes from false to true. The following timing diagram shows the relationship between status bits and instruction operation. Execution occurs only in a scan in which the EnableIn goes from false to true. Each time this occurs, only one element of the array is manipulated. If the EnableIn remains true for more than one scan, the instruction only executes during the first scan. The .EN bit is set when EnableIn is true. The .DN bit is set when the last element in the array has been manipulated. When the last element has been manipulated and the EnableIn goes false, the .EN bit, the .DN bit, and the .POS value are cleared. The difference between incremental mode and numerical mode at a rate of one element per scan is: Numerical mode with any number of elements per scan requires only one false-to-true transition of the EnableIn to start execution. The instruction continues to execute the specified number of elements each scan until completion regardless of the state of the EnableIn. Incremental mode requires the EnableIn to change from false to true to manipulate one element in the array. Format expressions For each operator that you use in an expression, you must provide one or two operands (tags or immediate values). Use the following table to format operators and operands within an expression. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 519 Chapter 8 Array File-Misc Instructions For operators that operate on: Use this format: Example One operand operator(operand) ABS(tag) Two operands operand_a operator operand_b tag_b + 5 tag_c AND tag_d (tag_e**2) MOD (tag_f / tag_g) Determine the order of operation The operations in the expression are performed by the instruction in a prescribed order, not necessarily the order they appear. The order of operation can be specified by grouping terms within parentheses, forcing the instruction to perform an operation within the parentheses ahead of other operations. Operations of equal order are performed from left to right. Order Operation 1 () 2 ABS, ACOS, ASIN, ATAN, COS, DEG, BCD_TO, LN, LOG, RAD, SIN, SQRT, TAN, TO_BCD, TRUNC 3 ** 4 - (negate), NOT *, /, MOD 6 - (subtract), + 7 AND 8 XOR 9 OR Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, No Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults A major fault will occur if: Fault type Fault code .POS < 0 or .LEN < 0 4 21 See Index Through Arrays for array-indexing faults. Execution Ladder Diagram 520 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Condition / State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. See FAL Flow Chart (Rung-condition-out is False) Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. See FAL Flow Chart (Rung-condition-out is True) Postscan N/A FAL Flow Chart (Rung-condition-out is False) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 521 Chapter 8 Array File-Misc Instructions FAL Flow Chart (Rung-condition-out is True) 522 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions FAL Flow Chart (All Mode) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 523 Chapter 8 Array File-Misc Instructions FAL Flow Chart (Numerical Mode) 524 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions FAL Flow Chart (Incremental Mode) Examples Example 1 Array-to-array. Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 525 Chapter 8 Array File-Misc Instructions When enabled, the FAL instruction copies each element of array_2 into the same position within array_1. Example 2 Element-to-array copy. Ladder Diagram When enabled, the FAL instruction copies value_1 into the first 10 positions of the second dimension of array_2. Example 3: Array-to-element copy. 526 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Each time the FAL instruction is enabled, it copies the current value of array_1 to value_1. The FAL instruction uses incremental mode, so only one array value is copied each time the instruction is enabled. The next time the instruction is enabled, the instruction overwrites value_1 with the next value in array_1. Example 4: Arithmetic operation: array / array to array When enabled, the FAL instruction divides the value in the current position of array_2 with the value in the current position of array_3 and stores the result in the current position of array_1. Example 5: Arithmetic operation: array / array to array Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 527 Chapter 8 Array File-Misc Instructions When enabled, the FAL instruction adds value_1 and value_2 and stores the result in the current position of array_1. Example 6: Arithmetic operation: array + element to array When enabled, the FAL instruction adds the value at the current position in array_1 to value_1 and stores the result in the current position in array_3. The instruction must execute 10 times for the entire array_1 and array_3 to be manipulated. Example 7: Arithmetic operation: (element + array) to element 528 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Each time the FAL instruction is enabled, it adds value_1 to the current value of array_1 and stores the result in value_2. The FAL instruction uses incremental mode, so only one array value is added to value_1 each time the instruction is enabled. The next time the instruction is enabled, the instruction overwrites value_2. Example 8: Arithmetic operation: (array * array) to element When enabled, the FAL instruction multiplies the current value of array_1 by the current value of array_3 and stores the result in value_1. The FAL instruction uses incremental mode, so only one pair of array values is multiplied each time the instruction is enabled. The next time the instruction is enabled, the instruction overwrites value_1. File Average (AVE) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The AVE instruction calculates the mean of a set of values. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 529 Chapter 8 Array File-Misc Instructions Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion. Ladder Diagram Operand Type Format Description Array Tag SINT tag Find the average of the values INT in this array DINT specify the first element of the REAL group of elements to average Do not use CONTROL.POS in the subscript Dimension to vary DINT immediate (0, 1, 2) Which dimension to use the order of the dimensions is: array[0,1,2] Destination SINT tag Result of the operation tag Control structure for the INT DINT REAL Control CONTROL operation Length DINT immediate Number of elements of the array to average Position DINT immediate Offset into the specified array which identifies the current 530 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Operand Type Format Array File-Misc Instructions Description element that the instruction is accessing. initial value is typically 0 Length and Position (corresponding to .LEN and .POS in the control tag) are pseudo-operands. For details, see Pseudo-operand initialization on page 856. Description The AVE instruction calculates the average of a set of values. IMPORTANT: Make sure the Length does not cause the instruction to exceed the specified Dimension to vary. If this happens, the destination will be incorrect. For more information, see Viewing an Array as a Block of Memory. If an overflow occurs during expression evaluation, the instructions reads past the end of an array, the instruction sets the ER bit and stops execution Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Common Attributes for operand related faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EN bit is cleared. The .DN bit is cleared. If .ER bit is zero during prescan, all the control bits (.DN, .EN, .EU, .EM, .UL, .IN and .FD) will be cleared to zero. Rung-condition-in is false. See AVE Flow Chart (False) Rung-condition-in is true. The AVE instruction calculates the average by adding all the specified elements in the array and dividing by the number of elements. Postscan Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 N/A. 531 Chapter 8 Array File-Misc Instructions AVE Flow Chart (False) Example 1 532 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Ladder Diagram Example 2 Ladder Diagram File Fill (FLL) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, CompactLogix 5380, CompactLogix 5480, and ControlLogix 5580 controllers. Controller differences are noted where applicable. The FLL instruction fills a block of memory with the provided source value. The Source remains unchanged. If the destination array is SINT, INT, DINT, or REAL, and the type of source value is different, the source value will be converted to the destination type before it is stored. Smaller integer types will be converted to large ones by signextension. If the destination array is a structure, the source value will be written without conversion. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 533 Chapter 8 Array File-Misc Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. Ladder Diagram Operand Data Type Format Description Source SINT immediate Element to copy INT tag DINT REAL Destination SINT tag INT Initial element to be overwritten by the Source. DINT REAL structure Length DINT immediate Number of destination INT tag elements to fill. SINT 534 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions The number of bytes filled is the smaller of: • Requested amount = Length x (number of bytes in a destination element) • The number of bytes in the destination tag Tip: The end of the destination tag is defined as the last byte of the base tag. If the tag is a structure, the end of the tag is the last byte of the last element of the structure. This means the FLL instruction could write past the end of a member array, but will never write past the end of the base tag. Test and confirm that the FLL instruction does not change data that should not be changed. For best results, the Source and Destination should be the same type. Use FLL to fill a structure with a constant, such as 0s. If initializing a structure, be sure to have one instance containing the initial values, and use COP to replicate it. FLL can be used, for example, zero out the entire structure. If the Source is: And the Destination is: The Source is converted to: SINT, INT, DINT, or REAL SINT SINT SINT, INT, DINT, or REAL INT INT SINT, INT, DINT, or REAL DINT DINT SINT, INT, DINT, or REAL REAL REAL Conversion from larger integers to smaller integers will result in truncation (the high bits are discarded). Once the source is converted, it is written to the destination N times, where N = byte count. Sign extension results when converting from smaller integers to larger integers. REAL numbers will be rounded when converted to integers. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction fills the memory. Postscan N/A Example Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 535 Chapter 8 Array File-Misc Instructions The FLL instruction copies number of destination elements specified by the Length from the DINT_src type source operand into a REAL_dest type destination. Ladder Diagram File Search and Compare (FSC) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, CompactLogix 5380, CompactLogix 5480, and ControlLogix 5580 controllers. Controller differences are noted where applicable. The FSC instruction compares values in an array, element by element. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram 536 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Control Array File-Misc Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Tag Control structure for the Compact GuardLogix 5380, and GuardLogix 5580 controllers CONTROL CONTROL operation Length DINT DINT Immediate This represents the CONTROL structure .LEN Position DINT DINT Immediate This represents the CONTROL structure .POS Mode DINT DINT Immediate Shows how to distribute the operation. Select INC, ALL, or enter number in the range of 1 to 2147483647 Expression SINT SINT Immediate An expression INT INT Tag consisting of tags DINT DINT and/or immediate REAL LINT values separated by STRING USINT operators UINT UDINT ULINT REAL LREAL String type Length and Position (corresponding to .LEN and .POS in the control tag) are pseudo-operands. For details, see Pseudo-operand initialization on page 856. CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the FSC instruction is enabled. .DN BOOL The done bit is set when the instruction has operated on the last element (.POS = .LEN). .ER BOOL The error bit is not modified. .IN BOOL The inhibit bit indicates the FSC instruction detected a true comparison. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 537 Chapter 8 Array File-Misc Instructions Mnemonic Data Type Description You must clear this bit to continue the search operation. .FD BOOL The found bit indicates the FSC instruction detected a true comparison. .LEN DINT The length specifies the number of elements in the array on which the instruction operates. .POS DINT The position contains the position of the current element that the instruction is accessing. Description When the EnableIn of the FSC instruction transitions from false to true, the expression is evaluated over the specified mode of iteration. If the evaluation result is true, the instruction sets the .FD bit, and the .POS value reflects the array position where the instruction found the true comparison. The instruction sets the .IN bit to prevent further iteration. Select Mode of Operation For FSC instructions, the mode tells the controller how to distribute the array operation. If you want to: Select this mode: Operate on all of the specified elements in an array before All continuing on to the next instruction. Distribute array operation over a number of scans. Numerical Enter the number of elements to operate on per scan (1-2147483647). Manipulate one element of the array each time the EnableIn Incremental goes from false to true. All Mode In All mode, all the specified elements in the array are operated on before continuing on to the next instruction. The operation begins when the instruction’s EnableIn goes from false to true. The position (.POS) value in the control 538 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions structure points to the element in the array that the instruction is currently using. Operation stops under two conditions. When the .POS value equals or exceeds the .LEN value, AND when the expression evaluates to true. The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is true. The .DN bit, the .EN bit, and the .POS value are cleared when the EnableIn is false. Only then can another execution of the instruction be triggered by a false-to-true transition of EnableIn. Numerical Mode Numerical mode distributes the array operation over a number of scans. This mode is useful when working with nontime-critical data or large amounts of data. You enter the number of elements to operate on for each scan, which keeps scan time shorter. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 539 Chapter 8 Array File-Misc Instructions Execution is triggered when the EnableIn goes from false to true. Once triggered, the instruction is executed each time it is scanned for the number of scans necessary to complete operating on the entire array. Once triggered, EnableIn can change repeatedly without interrupting execution of the instruction. Avoid using the results of a file instruction operating in numerical mode until the .DN or .IN bit is true. The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is true. If the EnableIn is true at completion, the .EN and .DN bit are true until the EnableIn goes false. When the EnableIn goes false, these bits are cleared and the .POS value is cleared. If the EnableIn is false at completion, the .EN bit is cleared immediately. One scan after the .EN bit is cleared, the .DN bit and the .POS value are cleared. Incremental Mode 540 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Incremental mode manipulates one element of the array each time the instruction’s EnableIn goes from false to true. The following timing diagram shows the relationship between status bits and instruction operation. Execution occurs only in a scan in which the EnableIn goes from false to true. Each time this occurs, only one element of the array is manipulated. If the EnableIn remains true for more than one scan, the instruction only executes during the first scan. The .EN bit is set when rung-condition-in is true. The .DN bit is set when the last element in the array has been manipulated. When the last element has been manipulated and the rung-condition-in goes false, the .EN bit, the .DN bit, and the .POS value are cleared. The difference between incremental mode and numerical mode at a rate of one element per scan is: Numerical mode with any number of elements per scan requires only one false-to-true transition of the EnableIn to start execution. The instruction continues to execute the specified number of elements each scan until completion regardless of the state of the EnableIn. Incremental mode requires the EnableIn to change from false to true to manipulate one element in the array. Format expressions For each operator that you use in an expression, you must provide one or two operands (tags or immediate values). Use the following table to format operators and operands within an expression. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 541 Chapter 8 Array File-Misc Instructions For operators that operate on: Use this format: Example One operand operator(operand) ABS(tag) Two operands operand_a operator operand_b tag_b + 5 tag_c AND tag_d (tag_e**2) MOD (tag_f / tag_g) Determine the order of operation The operations you write into the expression are performed by the instruction in a prescribed order, not necessarily the order you write them. You can override the order of operation by grouping terms within parentheses, forcing the instruction to perform an operation within the parentheses ahead of other operations. Operations of equal order are performed from left to right. Order Operation 1 () 2 ABS, ACOS, ASIN, ATAN, COS, DEG, BCD_TO, LN, LOG, RAD, SIN, SQRT, TAN, TO_BCD, TRUNC 3 ** 4 - (negate), NOT, ! 5 *, /, MOD 6 - (subtract), + 7 AND 8 XOR 9 OR 10 <, <=, >, >=, =, <> 11 && 12 ^^ 13 || Use strings in an expression To use strings of ASCII characters in an expression, follow these guidelines: An expression lets you compare two string tags. You cannot enter ASCII characters directly into the expression. Only the following operands are permitted: 542 Operator Description = Equal < Less than <= Less than or equal > Greater than Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Operator Description >= Greater than or equal <> Not equal Array File-Misc Instructions Strings are equal if their characters match. ASCII characters are case-sensitive. Uppercase A ($41) is not equal to lowercase a ($61). The hexadecimal values of the characters determine if one string is less than or greater than another string. When the two strings are sorted as in a telephone directory, the order of the strings determine which one is greater. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, No Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults A major fault will occur if: Fault type Fault code .POS < 0 or .LEN < 0 4 21 See Common Attributes for operand related faults. See Index Through Arrays for array-indexing faults. Execution Ladder Diagram Rockwell Automation, Inc. Condition / State Action Taken Prescan N/A Rung-condition-in is false See FSC Flow Chart (Rung-condition-out is False) Rung-condition-in is true See FSC Flow Chart (Rung-condition-out is True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 543 Chapter 8 Array File-Misc Instructions FSC Flow Chart (Rung-condition-out is False) 544 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions FSC Flow Chart (Rung-condition-out is True) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 545 Chapter 8 Array File-Misc Instructions FSC Flow Chart (FSC Common Subflow) 546 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions FSC Flow Chart (FSC Common Exception Subflow) Examples Example 1 Search between two DINT arrays for elements that are not equal. Ladder Diagram When enabled, the FSC instruction compares each of the first 10 elements in array_1 to the corresponding elements in array_2. When an element is found that is not equal, the FD and IN bits are set. The POS identifies the location of the not equal elements. Clear the IN bit to search the rest of the array. Example 2 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 547 Chapter 8 Array File-Misc Instructions Search for a string within a STRING array. When enabled, the FSC instruction compares characters in code to 10 elements in code_table. When a string in code_table is found that matches code, the FD and IN bits are set. The POS identifies the location of the matching strings. Clear the IN bit to search the rest of the array. File Sort (SRT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, CompactLogix 5380, CompactLogix 5480, and ControlLogix 5580 controllers. Controller differences are noted where applicable. The SRT instruction sorts a set of values in one dimension (Dim to vary) of the array into ascending order. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text SRT(Array,Dimtovary,Control); Operands Ladder Diagram Operand Type Format Description Array SINT Array tag array to sort INT specify the first element of the DINT group of elements to sort REAL 548 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Operand Type Format Description Dimension to vary DINT Immediate which dimension to use (0, 1, 2) the order of the dimensions is: array[0,1,2] Control CONTROL Tag control structure for the operation Length DINT Immediate number of elements of the array to sort Position DINT Immediate current element in the array initial value is typically 0 Length and Position (corresponding to .LEN and .POS in the control tag) are pseudo-operands. For details, see Pseudo-operand initialization on page 856. Structured Text Operand Type Format Description Array SINT Array tag array to sort INT specify the first element of the DINT group of elements to sort REAL Dimension to vary DINT Immediate which dimension to use (0, 1, 2) the order of the dimensions is: array[0,1,2] Control CONTROL Tag control structure for the operation Length DINT Immediate Number of elements of the array to sort. The specified Length and Position values are accessed from the .LEN and .POS members of the CONTROL structure. Position DINT Immediate current element in the array initial value is typically 0 The specified Length and Position values are accessed from the .LEN and .POS members of the CONTROL structure. See Structured Text Syntax for more information on the syntax of expressions within structured text. CONTROL Structure Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 549 Chapter 8 Array File-Misc Instructions Mnemonic Data Type Description .EN BOOL The enable bit indicates the SRT instruction is enabled. .DN BOOL The done bit is set when the instruction has operated on the last element in the Array. .ER BOOL The error bit is set when either .LEN < 0 or .POS < 0. Either of these conditions also generates a major fault. When .ER bit is set, the instruction does not execute. .LEN DINT The length word specifies the number of elements in the array on which the instruction operates. .POS DINT The position word identifies the current element that the instruction is accessing. Description The SRT instruction sorts a set of values in one dimension (Dim to vary) of the Array into ascending order. IMPORTANT: You must test and confirm that the instruction does not change data that you don’t want it to change. The SRT instruction operates on contiguous data memory. For the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers only, the scope of the instruction is constrained by the base tag. The SRT instruction will not write data outside of the base tag but can cross member boundaries. If you specify an array that is a member of a structure, and the length exceeds the size of that array you must test and confirm that the SRT instruction does not change data you do not want changed. In the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers , the data is constrained by the specified member. In this transitional instruction, the relay ladder toggles the rung-condition-in from false to true for the instruction to execute. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, No Compact GuardLogix 5380, and GuardLogix 5580 controllers 550 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Controllers Affects Math Status Flags CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes Array File-Misc Instructions 5370, and GuardLogix 5570 controllers Major/Minor Faults A major fault will occur if: Fault type Fault code .POS < 0 or .LEN < 0 4 21 Dimension to vary > number of 4 20 4 20 dimensions Length > end of array See Common Attributes for operand related faults. Execution Ladder Diagram Condition / State Action Taken Prescan N/A. Rung-condition-in is false .EN bit is cleared to false .EN bit is cleared to false .DN bit is cleared to false Rung-condition-in is true The instruction executes Postscan N/A. Structured Text Condition / State Action Taken Prescan See Prescan in the Ladder Diagram table Normal execution Since this instruction requires a transition to execute it is executed false and then true. See the Ladder Diagram table for details. Postscan See Postscan in the Ladder Diagram table. Examples Example 1 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 551 Chapter 8 Array File-Misc Instructions Sort DINT_array, which is DINT[4,5]. Ladder Diagram Structured Text IF sort1 then control_1.LEN := 4; control_1.POS := 0; SRT(DINT_array[0,2],0, control_1); END_IF; Example 2 Sort DINT_array, which is DINT[4,5]. Ladder Diagram 552 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Structured Text ctrl.LEN := 4; ctrl.POS := 0; SRT(DINT_array[0,2],0, ctrl); File Standard Deviation (STD) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The STD instruction calculates the standard deviation of a set of values in one dimension of the Array and stores the result in the Destination. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion. Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 553 Chapter 8 Array File-Misc Instructions Operand Type Format Description Array SINT array tag Find the standard deviation of INT the values in this array DINT specify the first element of REAL the group of elements to use in calculating the standard deviation Dimension to vary DINT immediate which dimension to use (0, 1, 2) the order of the dimensions is: array[0,1,2] Destination REAL tag result of the operation Control CONTROL tag Control structure for the operation Length DINT immediate number of elements of the array to use in calculating the standard deviation Position DINT immediate Offset into the specified array which identifies the current element that the instruction is accessing. initial value is typically 0 Length and Position (corresponding to .LEN and .POS in the control tag) are pseudo-operands. For details, see Pseudo-operand initialization on page 856. CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the STD instruction is enabled. .DN BOOL The done bit is set when the instruction has operated on the last element in the Array. .ER BOOL The error bit is set when the instruction generates an overflow. The instruction stops executing until the program clears the .ER bit. The .POS value stores the position of the element that caused the overflow. .LEN DINT The length word specifies the number of elements in the array on which the instruction operates. 554 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Mnemonic Data Type Description .POS DINT The position word is an offset into the specified array which identifies the current element that the instruction is accessing. Description The standard deviation is calculated according to this formula: Where: start = dimension-to-vary subscript of the array operand xi = variable element in the array N = number of specified elements in the array AVE = IMPORTANT: Make sure the Length does not cause the instruction to exceed the specified Dimension to vary. If this happens, the Destination will be incorrect. If an overflow occurs during expression evaluation or if the instructions reads past the end of an array, the instruction sets the ER bit and stops execution. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, based on programming language. See Math Status Compact GuardLogix 5380, and GuardLogix 5580 controllers Flags. CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults Rockwell Automation, Inc. A major fault will occur if: Fault type Fault code .POS < 0 or .LEN < 0 4 21 Publication 1756-RM003Z-EN-P - September 2024 555 Chapter 8 Array File-Misc Instructions A major fault will occur if: Fault type Fault code Dimension to vary > number of 4 20 dimensions See Common Attributes for operand-related faults. Execution Ladder Diagram Condition / State Action Taken Prescan The .EN bit is cleared. The .DN bit is cleared. The .ER bit is cleared. Rung-condition-in is false The .EN bit is cleared. The .ER bit is cleared. The .DN bit is cleared. The .POS value is cleared. The rung-condition-out is false. Rung-condition-in is true Internally, the instruction uses a FAL instruction to calculate the average: Expression = standard deviation calculation Mode = ALL Postscan N/A. Examples Example 1 Calculate the standard deviation of arrayDint, which is DINT[4,5]. 556 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Ladder Diagram Example 2 Calculate the standard deviation of dint_array, which is DINT[4,5]. Ladder Diagram Size In Elements (SIZE) This information applies to the Compact GuardLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, Compact GuardLogix 5480, and ControlLogix 5580 controllers. The SIZE instruction finds the number of elements (size) in the designated dimension of the Source array or string operand and places the result in the Size operand. The instruction finds the size of one dimension of an array. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 557 Chapter 8 Array File-Misc Instructions The instruction operates on: • Arrays • Arrays in a structure • Arrays that are part of a larger array • String tags Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text SIZE(Source,Dimtovary,Size); Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions. Ladder Diagram Operand Data Type Format Description Source SINT Array tag First element of the array on which the instruction INT is to operate DINT Tags that are not array are not accepted during REAL verification structure String type Dimension to Vary DINT immediate (0, 1, 2) 558 Publication 1756-RM003Z-EN-P - September 2024 Dimension to use: For the size of: Enter: first dimension 0 second dimension 1 Rockwell Automation, Inc. Chapter 8 Operand Data Type Format Description third dimension Size SINT Array File-Misc Instructions tag 2 Tag to store the number of elements in the INT specified dimension of the array DINT REAL See Structured Text Syntax for more information on the syntax of expressions within structured text. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index Through Arrays for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. The instruction executes. Postscan N/A Structured Text Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table Normal execution See rung-condition-in is true in Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. Examples Example 1 Find the number of elements in dimension 0 (first dimension) of array_a. Store the size in array_a_size. In this example, dimension 0 of array_a has 10 elements. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 559 Chapter 8 Array File-Misc Instructions Ladder Diagram Structured Text SIZE(array_a,0,array_a_size); Example 2 Find the number of elements in the DATA member of string_1, which is a string. Stores the size in string_1_size. In this example, the DATA member of string_1 has 82 elements. The string uses the default STRING data type. Since each element holds one character, string_1 can contain up to 82 characters. Ladder Diagram Structured Text SIZE(string_1.DATA[0],0,string_1_size); Example 3 String_a is an array of string structures. The SIZE instruction finds the number of elements in the DATA member of the string structure and stores the size in data_size_a. In this example, the DATA member has 24 elements. The string structure has a user-specified length of 24. Ladder Diagram Structured Text SIZE(string_a.[0].DATA[0],0,data_size_a); 560 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions All Mode In All mode, all the specified elements in the array are operated on before continuing on to the next instruction. The operation begins when the instruction’s rung-condition-in goes from false to true. The position (.POS) value in the control structure points to the element in the array that the instruction is currently using. Operation stops when the .POS value equals the .LEN value. The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is set. The .DN bit, the .EN bit, and the .POS value are cleared when the rung-condition-in is false. Only then can another execution of the instruction be triggered by a false-to-true transition of rung-condition-in Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 561 Chapter 8 Array File-Misc Instructions All Mode Flow Chart-FSC Numerical Mode Numerical mode distributes the array operation over a number of scans. This mode is useful when working with nontime-critical data or large amounts of data. You enter the number of elements to operate on for each scan, which keeps scan time shorter. Execution is triggered when the rung-condition-in goes from false to true. Once triggered, the instruction is executed each time it is scanned for the number of scans necessary to complete operating on the entire array. Once triggered, rung-condition-in can change repeatedly without interrupting execution of the instruction. 562 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Avoid using the results of a file instruction operating in numerical mode until the .DN bit is set. The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is set. If the rung-condition-in is true at completion, the .EN and .DN bit are set until the rung-condition-in goes false. When the rung-condition-in goes false, these bits are cleared and the .POS value is cleared. If the rung-condition-in is false at completion, the .EN bit is cleared immediately. One scan after the .EN bit is cleared, the .DN bit and the .POS value are cleared. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 563 Chapter 8 Array File-Misc Instructions Numeric Mode Flow Chart-FSC Incremental Mode Incremental mode manipulates one element of the array each time the instruction’s rung-condition-in goes from false to true. 564 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions The following timing diagram shows the relationship between status bits and instruction operation. Execution occurs only in a scan in which the rung-condition-in goes from false to true. Each time this occurs, only one element of the array is manipulated. If the rung-condition-in remains true for more than one scan, the instruction only executes during the first scan The .EN bit is set when rung-condition-in is true. The .DN bit is set when the last element in the array has been manipulated. When the last element has been manipulated and the rung-condition-in goes false, the .EN bit, the .DN bit, and the .POS value are cleared. The difference between incremental mode and numerical mode at a rate of one element per scan is: • Numerical mode with any number of elements per scan requires only one false-to-true transition of the rungcondition-in to start execution. The instruction continues to execute the specified number of elements each scan until completion regardless of the state of the rung-condition-in. • Incremental mode requires the rung-condition-in to change from false to true to manipulate one element in the array. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 565 Chapter 8 Array File-Misc Instructions Incremental Mode Flow Chart-FSC Array Tag When you enter an array tag, make sure to specify the first element of the array to manipulate. Do not use CONTROL.POS to identify the beginning element because the instruction modifies the .POS value as it operates, which could corrupt the result. Standard Deviation The standard deviation is calculated according to this formula: 566 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 8 Array File-Misc Instructions Where: Rockwell Automation, Inc. • start = dimension-to-vary subscript of the array operand • xi = variable element in the array • N = number of specified elements in the array • AVE = Publication 1756-RM003Z-EN-P - September 2024 567 568 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions Use the array (file)/shift instructions to modify the location of data within arrays. Available Instructions Ladder Diagram If you want to: Use this instruction: Load bits into, shift bits through, and unload bits from a bit BSL on page 569 array one bit at a time. BSR on page 572 Load and unload values in the same order. FFL on page 576 FFU on page 582 Load and unload values in reverse order. LFL on page 588 LFU on page 594 You can mix data types, but loss of accuracy and rounding error might occur. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. Bit Shift Left (BSL) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The BSL instruction shifts the specified bits within the Array one position left. When enabled, the instruction unloads the uppermost bit of the specified bits to the .UL bit, shifts the remaining bits one position left, and loads Bit address into bit 0 of Array. IMPORTANT: You must test and confirm that the instruction does not change data that you do not want it to change. The BSL instruction operates on contiguous data memory. The data is constrained by the specified member. In this transitional instruction, the relay ladder toggles the rung-condition-in from false to true for the instruction to execute. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 569 Chapter 9 Array (File)/Shift Instructions Ladder Diagram Operands Ladder Diagram Operand Type Format Description Array DINT ARRAY tag Array to modify specify the first element where to begin the shift Control CONTROL tag Control structure for the operation Source Bit BOOL tag Bit to shift into the vacated position. Length DINT immediate Number of bits in the array to shift CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the BSL instruction is enabled. .DN BOOL The done bit is set to indicate that bits shifted one position to the left. .UL BOOL The unload bit is the instruction’s output. The .UL bit stores the status of the bit that was shifted out of the range of bits. .ER BOOL The error bit is set when .LEN < 0. .LEN DINT The length specifies the number of array bits to shift. Affects Math Status Flags No Major/Minor Faults 570 A Major Fault Occurs If Fault Type Fault Code The LEN exceeds the size of the array 4 20 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions See Common Attributes for General Instructions on page 849 for operand related faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EN bit is cleared to false. The .DN bit is cleared to false. The .ER bit is cleared to false. The .POS value is cleared Rung-condition-in is false The .EN bit is cleared to false. The .DN bit is cleared to false. The .ER bit is cleared to false. The .POS value is cleared. Rung-condition-in is true See BSL Flow Chart (True). Postscan N/A BSL Flow Chart (True) Examples Example 1 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 571 Chapter 9 Array (File)/Shift Instructions When enabled, the BSL instruction starts at bit 0 in array_dint[0]. The instruction unloads array_dint[0].9 into the .UL bit, shifts the remaining bits, and loads input_1 into array_dint[0].0. The remaining bits (10-31) are invalid. Ladder Diagram Example 2: When enabled, the BSL instruction starts at bit 0 in array_dint[0]. The instruction unloads array_dint[1].25 into the .UL bit, shifts the remaining bits, and loads input_1 into array_dint[0].0. The remaining bits (31-26 in array_dint[1]) are invalid. Bit Shift Right (BSR) This table lists the controllers and applications that support this instruction. 572 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The BSR instruction shifts the specified bits within the Array one position right. When enabled, the instruction unloads the value at bit 0 of Array to the .UL bit, shifts the remaining bits one position right, and loads the bit from the Bit address. IMPORTANT: Test and confirm that the instruction changed the correct data. The BSR instruction operates on continuous memory. If an Array is a member array, the instruction may shift beyond the boundary of the array into other members following it. Be sure to carefully select a length that does cause this scenario to occur. The BSR instruction operates on contiguous data memory. If the instruction tries to read past the end of an array (the LEN is too big), the instruction sets the .ER bit and generates a major fault. Available Languages Ladder Diagram Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram Operand Data Type Format Description Array DINT ARRAY tag Array to modify specify the first element to be shifted. Control CONTROL tag Control structure for the operation Source Bit BOOL tag Bit to load into the vacated position. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 573 Chapter 9 Array (File)/Shift Instructions Operand Data Type Format Description Length DINT immediate Number of bits in the array to shift CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the BSR instruction is enabled. .DN BOOL The done bit is set to indicate that bits shifted one position to the right. .UL BOOL The unload bit is the instruction’s output. The .UL bit stores the status of the bit that was shifted out of the range of bits. .ER BOOL The error bit is set when .LEN < 0. .LEN DINT The length specifies the number of array bits to shift. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan The .EN bit is cleared to false. The .DN bit is cleared to false. The .ER bit is cleared to false. The .POS value is cleared. Rung-condition-in is false The .EN bit is cleared to false. The .DN bit is cleared to false. The .ER bit is cleared to false. The .POS value is cleared. Rung-condition-in is true See the following BSR Flow Chart (True) Postscan N/A BSR Flow Chart (True) 574 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions Examples Example 1 When enabled, the BSR instruction copies array_dint[0].0 to the .UL bit, shifts 0-9 to the right, and loads the input_1 into array_dint[0].9. The remaining bits (10-31) are invalid, which indicates the bits may not be modified. Ladder Diagram Example 2 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 575 Chapter 9 Array (File)/Shift Instructions When enabled, the BSR instruction copies array_dint[0].0 to the .UL bit, shifts 0-9 to the right, and loads the input_1 into array_dint[1].25.. The remaining bits (31-26 in dint_array[1]) are invalid, which indicates that the bits may not be modified. Note how array_dint[1].0 shifts across words into array_dint[0].31. Ladder Diagram FIFO Load (FFL) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The FFL instruction copies the Source value to the FIFO. Use the FFL instruction with the FFU instruction to store and retrieve data in a first-in/first-out order. When used in pairs, the FFL and FFU instructions establish an asynchronous shift register. Typically, the Source and the FIFO are the same data type. When enabled, the FFL instruction loads the Source value into the position in the FIFO identified by the .POS value. The instruction loads one value each time the instruction is enabled, until the FIFO is full. IMPORTANT: You must test and confirm that the instruction does not change data that you don’t want it to change. The FFL instruction operates on contiguous memory. 576 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions The data is constrained by the specified member. If the instruction tries to read past the end of an array, the instruction generates a major fault. Typically, the Source and the FIFO are the same data type. If Source and FIFO data types mismatch, the instruction converts the Source value to the data type of the FIFO tag. A smaller integer converts to a larger integer by sign-extension. Available Languages Ladder Diagram Operands Conversion only occurs if the type of the source operand does not match the type of the FIFO. Ladder Diagram Operand Type Format Description Source SINT immediate Data to be stored in the FIFO INT tag DINT REAL String type structure FIFO SINT array tag FIFO to modify INT Specify the first element of the DINT FIFO REAL String type structure Control CONTROL tag Control structure for the operation Typically use the same CONTROL as the associated FFU Length DINT immediate Maximum number of elements the FIFO can hold at one time Position DINT immediate Next location in the FIFO where the instruction loads data Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 577 Chapter 9 Array (File)/Shift Instructions Operand Type Format Description initial value is typically 0 CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the FFL instruction is enabled. .DN BOOL The done bit is set to indicate that the FIFO is full. The .DN bit inhibits loading the FIFO until .POS < .LEN. .EM BOOL The empty bit indicates the FIFO is empty. If .LEN is < or = to 0 or .POS < 0, the .EM bit and .DN bits are set. .LEN DINT The length word specifies the maximum number of elements in the FIFO. .POS DINT The position word identifies the location in the FIFO where the instruction loads the next value. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault Type Fault Code The (starting element + .POS) is past the 4 20 end of FIFO array See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram 578 Condition/State Action Taken Prescan See the FFL Flow Chart (Prescan). Rung-condition-in is false See FFL Flow Chart (False) Rung-condition-in is true See FFL Flow Chart (True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions FFL Flow Chart (Prescan) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 579 Chapter 9 Array (File)/Shift Instructions FFL Flow Chart (False) 580 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions FFL Flow Chart (True) Examples Example 1 Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 581 Chapter 9 Array (File)/Shift Instructions Example 2 Source array is STRING array or Structure array. Ladder Diagram Example 3 Data type of source mismatch data type of FIFO array. Ladder Diagram FIFO Unload (FFU) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The FFU instruction unloads the value from position 0 (first position) of the FIFO and stores that value in the Destination. The remaining data in the FIFO shifts down one position. Use the FFU instruction with the FFL instruction to store and retrieve data in a first-in/first-out order. When enabled, the FFU instruction unloads data from the first element of the FIFO and places that value in the Destination. The instruction unloads one value each time the instruction is enabled, until the FIFO is empty. If the FIFO is empty, the FFU returns 0 to the Destination. Typically, the destination and the FIFO are the same data type. If the types differ, the instruction converts the unloaded value to the type of the destination tag. A smaller integer converts to a larger integer by sign-extension. Available Languages 582 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions Ladder Diagram Operands There are data conversion rules for mixed data types within an instruction. Ladder Diagram Operand Type Format Description FIFO SINT array tag FIFO to modify INT Specify the first element of the DINT FIFO REAL Do Not use CONTROL.POS in String type the subscript structure Destination SINT tag Value unloaded from the FIFO. tag Control structure for the INT DINT REAL String type structure Control CONTROL operation typically use the same CONTROL as the associated FFL Length DINT immediate Maximum number of elements the FIFO can hold at one time Position DINT immediate Next location in the FIFO where the instruction loads data initial value is typically 0 CONTROL Structure Mnemonic Data Type Description .EU BOOL The enable unload bit indicates the FFU instruction is enabled. The .EU bit is set to prevent a false unload when the prescan begins. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 583 Chapter 9 Array (File)/Shift Instructions Mnemonic Data Type Description .DN BOOL The done bit is set to indicate that the FIFO is full (.POS = .LEN). .EM BOOL The empty bit indicates the FIFO is empty. If .LEN is , or = to 0 or .POS < 0, the .EM bit and .DN bits are set. .LEN DINT The length specifies the maximum number of elements in the FIFO. .POS DINT The position identifies the end of the data that has been loaded into the FIFO. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault Type Fault Code The specified Length is past the end of 4 20 FIFO array See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram 584 Condition / State Action Taken Prescan See FFU Flow Chart (Prescan). Rung-condition-in is false See FFL Flow Chart (False). Rung-condition-in is true See FFU Flow Chart (True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions FFU Flow Chart (Prescan) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 585 Chapter 9 Array (File)/Shift Instructions FFL Flow Chart (False) 586 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions FFU Flow Chart (True) Examples Example 1 Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 587 Chapter 9 Array (File)/Shift Instructions Example 2 Destination array is STRING array or Structure array Ladder Diagram Example 3 Data type of FIFO source array mismatch data type of destination array Ladder Diagram LIFO Load (LFL) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The LFL instruction copies the Source value to the LIFO. Use the LFL instruction with the LFU instruction to store and retrieve data in a last-in/first-out order. When used in pairs, the LFL and LFU instructions establish an asynchronous shift register. Typically, the Source and the LIFO are the same data type. When enabled, the LFL instruction loads the Source value into the position in the LIFO identified by the .POS value. The instruction loads one value each time the instruction is enabled, until the LIFO is full. IMPORTANT: You must test and confirm that the instruction does not change data that you don’t want it to change. The LFL instruction operates on contiguous data memory. Available Languages 588 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions Ladder Diagram Operands There are data conversion rules for mixed data types within an instruction. Ladder Diagram Operand Type Format Description Source SINT immediate Data to be stored in the LIFO. INT tag DINT REAL String type structure LIFO SINT array tag LIFO to modify INT Specify the first element of the DINT LIFO REAL String type structure Control CONTROL tag Control structure for the operation Typically use the same CONTROL as the associated LFU Length DINT immediate Maximum number of elements the LIFO can hold at one time Position DINT immediate Next location in the LIFO where the instruction loads data Initial value is typically 0 CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the LFL instruction is enabled. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 589 Chapter 9 Array (File)/Shift Instructions Mnemonic Data Type Description .DN BOOL The done bit is set to indicate that the LIFO is full (.POS = .LEN). The .DN bit inhibits loading the LIFO until .POS < .LEN. .EM BOOL The empty bit indicates the LIFO is empty. If .LEN < or = to 0 or .POS < 0, the .EM bit and .DN bits are set. .LEN DINT The length specifies the maximum number of elements the LIFO can hold at one time. .POS DINT The position identifies the location in the LIFO where the instruction will load the next value. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault Type Fault Code If (starting element + .POS) is past the end 4 20 of LIFO array See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram 590 Condition/State Action Taken Prescan See LFL Flow Chart (Prescan) Rung-condition-in is false See LFL Flow Chart (False) Rung-condition-in is true See LFL Flow Chart (True) Postscan N/A. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions LFL Flow Chart (Prescan) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 591 Chapter 9 Array (File)/Shift Instructions LFL Flow Chart (False) 592 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions LFL Flow Chart (True) Examples Example 1 Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 593 Chapter 9 Array (File)/Shift Instructions Example 2 Source array is STRING array or Structure array. Ladder Diagram Example 3 Data type of source mismatch data type of LIFO array. Ladder Diagram LIFO Unload (LFU) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The LFU instruction unloads the value at .POS of the LIFO and stores 0 in that location. Use the LFU instruction with the LFL instruction to store and retrieve data in a last-in/first-out order. When enabled, the LFU instruction unloads the value at .POS of the LIFO and places that value in the Destination. The instruction unloads one value and replaces it with 0 each time the instruction is enabled, until the LIFO is empty. If the LIFO is empty, the LFU returns 0 to the Destination. IMPORTANT: You must test and confirm that the instruction does not change data that you don’t want it to change. The LFU instruction operates on contiguous memory. The scope of the instruction is constrained by the base tag. The LFL instruction will not write data outside of the base tag but can cross member boundaries. If you specify an array that is a member of a structure, and the length exceeds the size of that array you must test and confirm that the LFL instruction does not change data you do not want changed. 594 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions The data is constrained by the specified member. If the instruction tries to read past the end of an array, the instruction sets the .ER bit and generates a major fault. Typically, the Source and the LIFO are the same data type. If Source and LIFO data types mismatch, the instruction converts the Source value to the data type of the FIFO tag. A smaller integer converts to a larger integer by sign-extension. Available Languages Ladder Diagram Operands There are data conversion rules for mixed data types within an instruction. Ladder Diagram Operand Type Format Description LIFO SINT array tag LIFO to modify INT Specify the first element of the DINT LIFO REAL Not use CONTROL.POS in the String type subscript structure Destination SINT tag Value unloaded from the LIFO. tag Control structure for the INT DINT REAL String type structure Control CONTROL operation Typically use the same CONTROL as the associated LFL. Length DINT immediate Maximum number of elements the LIFO can hold at one time Position DINT immediate Next location in the LIFO where the instruction unloads data Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 595 Chapter 9 Array (File)/Shift Instructions Operand Type Format Description Initial value is typically 0 CONTROL Structure Mnemonic Data Type Description .EU BOOL The enable bit indicates the LFU instruction is enabled. .DN BOOL The done bit is set to indicate that the LIFO is full (.POS = .LEN). .EM BOOL The empty bit indicates the LIFO is empty. If .LEN < or = to 0 or .POS < 0, both the .EM bit and .DN bit are set. .LEN DINT The length specifies the maximum number of elements the LIFO can hold at one time. .POS DINT The position identifies the end of the data that has been loaded into the LIFO. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault Type Fault Code If the specified Length is past the end of 4 20 LIFO array See Common Attributes for General Instructions on page 849 for operand-related faults. Execution All conditions occur only during Normal Scan mode Ladder Diagram 596 Condition/State Action Taken Prescan See LFU Flow Chart (Prescan) Rung-condition-in is false See LFU Flow Chart (False) Rung-condition-in is true See LFU Flow Chart (True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions LFU Flow Chart (Prescan) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 597 Chapter 9 Array (File)/Shift Instructions LFU Flow Chart (False) 598 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 9 Array (File)/Shift Instructions LFU Flow Chart (True) Examples Example 1 Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 599 Chapter 9 Array (File)/Shift Instructions Example 2 Destination array is STRING array or Structure array Ladder Diagram Example 3 Data type of LIFO source array mismatch data type of destination array Ladder Diagram 600 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 10 Sequencer Instructions Sequencer instructions monitor consistent and repeatable operations. Available Instructions Ladder Diagram If you want to Use this instruction Detect when a step is complete. SQI on page 601 Set output conditions for the next step. SQO on page 608 Load reference conditions into sequencer arrays SQL on page 604 The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. Sequencer Input (SQI) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The SQI instruction detects when a step is complete in a sequence pair of SQO/SQI instructions. When true, the SQI instruction passes the Source and current Array element through the Mask. The results of these masking operations are compared and if they are equal, rung-condition-out is set to true, otherwise rung-conditionout is cleared to false. Typically use the same CONTROL structure as the SQO and SQL instructions. Available Languages Ladder Diagram Operands The data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Operand Type Format Description Array DINT array tag Sequencer array Specify the first element of the sequencer array Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 601 Chapter 10 Sequencer Instructions Operand Type Format Description do not use CONTROL.POS in the subscript Mask SINT tag This operand is used to INT immediate determine which bits to block DINT (0) or pass (1) when applied to the Source and the Array element referenced by .POS. INT and SINT types are zero extended to the size of a DINT type. Source SINT tag The input data used to INT immediate compare with an array DINT Control element referenced by .POS.. CONTROL tag Control structure for the operation The same control tag should be used in the SQO and SQL instructions Length DINT immediate This represents the CONTROL structure .LEN. Position DINT immediate This represents the CONTROL structure .POS. CONTROL Structure Mnemonic Data Type Description .ER (Error) BOOL The instruction encountered an error. .LEN (Length) DINT The length specifies the number of sequencer steps in the sequencer array .POS (Position) DINT The position identifies the Array element that the instruction is currently comparing with the Source. The initial value is typically 0 Using SQI without SQO 602 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 10 Sequencer Instructions When the SQI instruction determines a step is complete, the ADD instruction increments the sequencer array. The GRT determines whether another value is available to check in the sequencer array. The MOV instruction resets the position value after completely stepping through the sequencer array one time. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true See Flow Chart (True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 603 Chapter 10 Sequencer Instructions Flow Chart (True) Example Ladder Diagram If you use the SQI instruction without a paired SQO instruction, you have to externally increment the sequencer array. The rung-condition-in will be set to true when the instructions enableOut will be true when the result of ANDing the array value specified by the Position e.g. Array[Position] with the Mask value is equal to the result of ANDing the Source value with the Mask value, otherwise the rung-condition-out will be cleared to false. Sequencer Load (SQL) 604 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 10 Sequencer Instructions This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The SQL instruction loads the source operand value into the sequencer array. When .EN transitions from false to true, the .POS is incremented. The .POS is reset to 1 when the .POS becomes > or = to .LEN. The SQL instruction loads the Source value into the Array at the new position. When .EN is true the SQL instruction loads the Source value into the Array at the current position. Typically use the same CONTROL structure as the SQI and SQO instructions. IMPORTANT: You must test and confirm that the instruction does create unwanted changes. Available Languages Ladder Diagram Operands The data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Operand Type Format Description Array DINT array tag Sequencer array Specify the first element of the sequencer array do not use CONTROL.POS in the subscript Source SINT tag Data to load into the INT immediate sequencer array at a location DINT Control CONTROL specified by .POS. tag Control structure for the operation The same control tag should be used in the SQI and SQO instructions Length DINT immediate This represents the CONTROL structure .LEN. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 605 Chapter 10 Sequencer Instructions Position DINT immediate This represents the CONTROL structure .POS. CONTROL Structure Mnemonic Data Type Description .EN (Enable) BOOL The enable bit indicates the SQL instruction is enabled. .DN (Done) BOOL The done bit is set when all the specified elements have been loaded into Array. .ER (Error) BOOL The error bit is set when .LEN < or = to 0, .POS < 0, or .POS > .LEN. .LEN (Length) DINT The length specifies the number of sequencer steps in the sequencer array. .POS (Position) DINT The position identifies where in the Array the Source value will be stored. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault Type Fault Code position > size of Array 4 20 Execution 606 Condition/State Action Taken Prescan The .EN is set to true. Rung-condition-in is false The .EN is cleared to false Rung-condition-in is true See Flow Chart (True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 10 Sequencer Instructions Flow Chart - True Example Ladder Diagram When enabled, the SQL instruction loads value_3 into the next position in the sequencer array, which is array_dint[5] in this example. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 607 Chapter 10 Sequencer Instructions Sequencer Output (SQO) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The SQO instruction sets output conditions for the next step of a sequence pair of SQO/SQI instructions. When .EN transitions from false to true, the .POS is incremented. The .POS is reset to 1 when the .POS becomes greater than or equal to .LEN When .EN is true the SQO instruction moves the Array data at the .POS through the Mask and then moves the current Destination value through the complemented Mask. The results of those operations are ORed together and the result is stored in the Destination. Typically, you should use the same CONTROL structure as the SQI on page 601 and SQL on page 604 instructions. Available Languages Ladder Diagram Operands The data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Operand Type Format Description Array DINT array tag Sequencer array Specify the first element of the sequencer array do not use CONTROL.POS in the subscript Mask SINT tag Used to determine which bits INT immediate to block (0) or pass (1) and DINT applied during the output masking operation. 608 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 10 Sequencer Instructions Operand Type Format Description Destination DINT tag Output data from the sequencer array. This value is used in the output masking operation. Control CONTROL tag Control structure for the operation The same control tag should be used in the SQI and SQL instructions Length DINT immediate Number of elements in the Array (sequencer table) to the output Position DINT immediate Current position in the array Initial value is typically 0. CONTROL Structure Mnemonic Data Type Description .EN (Enable) BOOL The enable bit indicates the SQO instruction is enabled. .DN (Done) BOOL The done bit is set when .POS = .LEN .ER (Error) BOOL Indicates the instruction encountered an error. .LEN (Length) DINT The length specifies the number of sequencer steps in the sequencer array. .POS (Position) DINT The position identifies the Array element that the instruction is currently using in the output masking operation. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram Rockwell Automation, Inc. Condition/State Action Taken Prescan The .EN is set to true. Publication 1756-RM003Z-EN-P - September 2024 609 Chapter 10 Sequencer Instructions Condition/State Action Taken Rung-condition-in is false The .EN is cleared to false Rung-condition-in is true See the following Flow Chart (True) Postscan N/A Flow Chart (True) Example The Mask value is AND’d with the array value e.g. Array[SqoControl.POS]. The complement of the Mask value is AND’d with the current Dest value. The results of these two operations are then OR’d together and the result is stored to the Dest. 610 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 10 Sequencer Instructions To reset .POS to the initial value (.POS = 0), us'e a RES instruction to clear the control structure. This example uses the status of the first-scan bit to clear the .POS value. Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 611 612 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Use the program control instructions to change the flow of logic. Available Instructions Ladder Diagram JMP on page LBL on page JSR on page JXR on page SBR on page RET on page TND on page MCR on page 620 620 622 616 622 622 639 630 UID on page UIE on page SFR on page SFP on page EVENT on AFI on page EOT on page NOP on page 644 644 637 635 page 640 614 615 633 Function Block JSR on page 622 RET on page 622 SBR on page 622 Structured Text JSR on page RET on page SBR on page TND on page EVENT on UID on page EOT on page SFR on page 622 622 622 639 page 640 644 615 637 NOTE: SFP on page 635 If you want to: Use this instruction: Jump over a section of logic that does not always need to be JMP executed. LBL Jump to a separate routine, pass data to the routine, execute JSR the routine, and return results. SBR RET Rockwell Automation, Inc. Jump to an external routine JXR Mark a temporary end that halts routine execution. TND Disable all the rungs in a section of logic MCR Disable user tasks. UID Enable user tasks. UIE Pause a sequential function chart SFP Reset a sequential function chart SFR End a transition for a sequential function chart EOT Trigger the execution of an event task EVENT Disable a rung AFI Insert a placeholder in the logic. NOP Publication 1756-RM003Z-EN-P - September 2024 613 Chapter 11 Program Control Instructions Always False (AFI) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The AFI instruction sets the EnableOut to false. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands Ladder Diagram None Description The AFI instruction sets its EnableOut to false. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults Execution All conditions below the thick solid line can only occur during Normal Scan mode. 614 Condition Action Prescan N/A Rung-condition-in is false Clear EnableOut to false. Rung-condition-in is true Clear EnableOut to false. Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Examples Ladder Diagram Use the AFI instruction to temporarily disable a rung while you are debugging a program. AFI disables all the instructions on this rung. End of Transition (EOT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The EOT instruction is used to set the state of a transition. It typically occurs in a subroutine called from a transition (JSR). The state bit parameter used in EOT determines the state of the Transition. If the state bit is set to true, the SFC transitions to next state else EOT acts as NOP. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text EOT(StateBit); Operands Ladder Diagram Operand Type Format Description State Bit BOOL tag state of the transition (0=executing, 1=completed) Structured Text Operand Type Format Description State Bit BOOL tag state of the transition (0=executing, 1=completed) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 615 Chapter 11 Program Control Instructions See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description Because the EOT instruction returns a boolean state, multiple SFC routines can share the same routine that contains the EOT instruction. If the calling routine is not a transition, the EOT instruction acts as a NOP instruction. In a Logix controller, the return parameter returns the transition state, since rung condition is not available in all Logix programming languages. Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction returns the data bit value to the calling routine. Postscan N/A Structured Text Condition/State Action Taken Prescan N/A Normal execution The instruction returns the data bit value to the calling routine. Postscan N/A Example Jump to External Routine (JXR) This information applies to the SoftLogix 5800 controller only. The JXR instruction executes an external routine. 616 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Available Languages Ladder Diagram Function Block This instruction is not available for function block. Structured Text This instruction is not available for structured text. Operands Ladder Diagram Operand Type Format Description External routine name ROUTINE Name External routine to execute External routine control EXT_ROUTINE_CONTROL Tag Control structure Parameter BOOL Immediate Data from this routine that you SINT Tag want to copy to a variable in INT Array tag the external routine DINT Parameters are optional. REAL Enter multiple parameters, if structure needed. You can have as many as 10 parameters. Return parameter BOOL Tag Tag in this routine to which SINT you want to copy a result of INT the external routine DINT The return parameter is REAL optional. You can have only one return parameter EXT_ROUTINE_CONTROL Structure Mnemonic Data Type Description Implementation ErrorCode SINT If an error occurs, this value There are no predefined error identifies the error. Valid codes. The developer of the values are from 0-255. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 617 Chapter 11 Program Control Instructions external routine must provide the error codes. NumParams SINT This value indicates the Display only - this information number of parameters is derived from the instruction associated with this entry. instruction. ParameterDefs EXT_ROUTINE_ This array contains definitions Display only - this information PARAMETERS[10] of the parameters to pass is derived from the instruction to the external routine. The entry. instruction can pass as many as 10 parameters. ReturnParamDef EXT_ROUTIN_ PARAMETERS This value contains definitions Display only - this information of the return parameter from is derived from the instruction the external routine. There is entry. only one return parameter. EN BOOL When set, the enable bit The external routine sets this indicates that the JXR bit. instruction is enabled. ReturnsValue BOOL If set, this bit indicates that a Display only - this information return parameter was entered is derived from the instruction for the instruction. If cleared, entry. this bit indicates that no return parameter was entered for the instruction. DN BOOL The done bit is set when the The external routine sets this external routine has executed bit. once to completion. ER BOOL The error bit is set if an error The external routine sets this occurs. The instruction stops bit. executing until the program clears the error bit. FirstScan BOOL This bit identifies whether The controller sets this bit to this is the first scan after reflect scan status. switching the controller to Run mode. Use FirstScan to initialize the external routine, if needed. EnableOut BOOL Enable output. The external routine sets this bit. EnableIn BOOL Enable input. The controller sets this bit to reflect rung-condition-in. The instruction executes regardless of rung condition. 618 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions The developer of the external routine should monitor this status and act accordingly. User1 BOOL These bits are available for the Either the external routine User0 BOOL user. The controller does not or the user program can set initialize these bits. these bits. ScanType1 BOOL These bits identify the current The controller sets these bits ScanType0 BOOL scan type: to reflect scan status. Bit Values Scan Type 00 Normal 01 Pre Scan 10 Post Scan (not applicable to relay ladder programs) Description Use the Jump to External Routine (JXR) instruction to call the external routine from a ladder routine in your project. The JXR instruction supports multiple parameters so you can pass values between the ladder routine and the external routine. The JXR instruction is similar to the Jump to Subroutine ( JSR) instruction. The JXR instruction initiates the execution of the specified external routine: • The external routine executes one time. • After the external routine executes, logic execution returns to the routine that contains the JXR instruction. Affects Math Status Flags No Major/Minor Faults A major fault will occur if Fault Type Fault Code: An exception occurs in the external 4 88 routine DLL. The DLL could not be loaded. The entry point was not found in the DLL. Execution The JXR can be synchronous or asynchronous depending on the implementation of the DLL. The code in the DLL also determines how to respond to scan status, rung-condition-in status, and rung-condition-out status. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 619 Chapter 11 Program Control Instructions For more information on using the JXR instruction and creating external routines, see thehttps:// literature.rockwellautomation.com/idc/groups/literature/documents/um/1789-um002_-en-p.pdf. Jump to Label (JMP) and Label (LBL) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The JMP and LBL instructions skip portions of ladder logic. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands Ladder Diagram Operand Format Description label name Enter the name for associated LBL JMP instruction Label name instruction LBL instruction Label name label name Execution jumps to the references LBL instruction Description When true, the JMP instruction skips to the referenced LBL instruction and the controller continues executing from there. When false, the JMP instruction does not affect ladder execution. The JMP and LBL it references must be in the same routine. The JMP instruction can move ladder execution forward or backward. Jumping forward to a label saves program scan time by omitting a logic segment until it is needed. Jumping backward lets the controller repeat iterations of logic. 620 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions IMPORTANT: Be careful not to jump backward an excessive number of times. The watchdog timer could time out because the scan does not complete in time. IMPORTANT: Jumped logic is not scanned. Place critical logic outside the jumped zone. A JMP instruction requires the associated label to exist before you: • Download when working offline • Accept edits when working online The LBL instruction must be the first instruction on the rung. A label name must be unique within a routine. The name can: • Have as many as 40 characters • Contain letters, numbers, and underscores (_) Affects Math Status Flags No. Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true (For JMP) Execution jumps to the rung that contains the LBL instruction with the referenced label name. (For LBL) no action taken Postscan N/A Example Ladder Diagram JMP Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 621 Chapter 11 Program Control Instructions When the JMP instruction is enabled, execution jumps over successive rungs of logic until it reaches the rung that contains the LBL instruction with label_20. LBL Jump to Subroutine (JSR), Subroutine (SBR), and Return (RET) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The JSR instruction invokes another routine. When that routine completes, the execution returns to the JSR instruction. The SBR instruction receives the input parameters passed by the JSR. The RET instruction passes return parameters back to the JSR and ends the scan of the subroutine. Available Languages Ladder Diagram 622 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Function Block Sequential Function Chart Structured Text JSR(RoutineName,InputCount,InputPar,ReturnPar); SBR(InputPar); RET(ReturnPar); Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. WARNING: For each parameter in an SBR or RET instruction, use the same data type (including any array dimensions) as the corresponding parameter in the JSR instruction. Using different data types may yield unexpected results. Ladder Diagram JSR Instruction Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 623 Chapter 11 Program Control Instructions Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers Routine Name ROUTINE ROUTINE name Subroutine to execute Input Par BOOL BOOL immediate Data from this routine SINT SINT tag to copy to a tag in the INT INT array tag subroutine. DINT DINT REAL LINT structure USINT • Input parameters are optional • Enter a maximum UINT of 40 input UDINT parameters, if ULINT needed. REAL LREAL structure Return Par BOOL BOOL tag Tag in this routine SINT SINT array tag to copy result from INT INT subroutine. DINT DINT • REAL LINT structure USINT Return parameters are optional • Enter a maximum UINT of 40 return UDINT parameters, if ULINT needed REAL LREAL structure SBR Instruction 624 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Input Par Program Control Instructions Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description • Compact GuardLogix 5380, and GuardLogix 5580 controllers BOOL BOOL tag SINT SINT array tag Tag in this routine INT INT the corresponding DINT DINT input parameter REAL LINT (maximum 40) structure USINT from the JSR UINT instruction. into which to copy UDINT ULINT REAL LREAL structure RET Instruction Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Return Par Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers BOOL BOOL immediate tag Data from this SINT SINT array tag routine to copy to INT INT the corresponding DINT DINT return parameter REAL LINT (maximum 40) in the structure USINT JSR instruction. UINT UDINT ULINT REAL LREAL structure Affects Math Status Flags No Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 625 Chapter 11 Program Control Instructions Major/Minor Faults A major fault will occur if: Fault type Fault code JSR instruction has fewer input 4 31 JSR instruction jumps to a fault routine 4 990 or user-supplied RET instruction has fewer return 4 31 4 31 parameters than SBR instruction parameters than JSR instruction Main routine contains a RET instruction Operation IMPORTANT: Any routine may contain a JSR instruction but a JSR instruction cannot call (execute) the main routine. The JSR instruction initiates the execution of the specified routine, which is referred to as a subroutine: • The subroutine executes each time it is scanned. • After the subroutine executes, logic execution returns to the routine that contains the JSR instruction and continues with the instruction following the JSR. To program a jump to a subroutine, follow these guidelines. JSR • To copy data to a tag in the subroutine enter an input parameter. • To copy a result of the subroutine to a tag in this routine, enter a return parameter. • Enter up to 40 inputs and enter up to 40 return parameters as needed. SBR 626 • If the JSR instruction has an input parameter enter an SBR instruction. • Place SBR instruction as the first instruction in the routine. • For each input Parameter in the JSR Instruction, enter the tag into which you want to copy the data. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions RET • If the JSR instruction has a return parameter, enter an RET instruction. • Place the RET instruction as the last instruction in the routine. • For each return parameter in the JSR instruction, enter a return parameter to send to the JSR instruction. • In a ladder routine, place additional RET instructions to exit the subroutine based on different input conditions, if required (Function block routines only permit one RET instruction). Invoke up to 25 nested subroutines, with a maximum of 40 parameters passed into a subroutine, and a maximum of 40 parameters returned from a subroutine. Tip: Select the Edit > Edit Ladder Element menu to add and remove variable operands. For the JSR and SBR instructions, add Input Parameter. For JSR and RET instructions, add Output Parameter. For all three instructions, remove Instruction Parameter. Execution Ladder Diagram Condition/State Action Taken Prescan The rung is set to false. The controller executes all subroutines. To ensure that all rungs in the subroutine are prescanned, the controller ignores RET instructions (that is, RET instructions do not exit the subroutine). Input and return parameters are not passed. If the same subroutine is invoked multiple times, it will only be prescanned once. Rung-condition-in is false (to the JSR instruction) N/A Rung-condition-in is true Parameters are passed and the subroutine is executed. Postscan Same action as Prescan Function Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 627 Chapter 11 Program Control Instructions Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table. EnableIn is false N/A EnableIn is true Parameters are passed and the subroutine is executed Instruction first run N/A Instruction first scan N/A Postscan See Postscan in the Ladder Diagram table. Structured Text Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table. Normal Execution Parameters are passed and the subroutine is executed. Postscan See Postscan in the Ladder Diagram table. Examples Example 1 Ladder Diagram Structured Text Routine Program Main routine JSR(routine_1,2,value_1,value_2,float_value_1); Subroutine SBR(value_a,value_b); <statements>; RET(float_a); 628 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Example 2 Ladder Diagram Main routine subroutine_1 Example 3 Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 629 Chapter 11 Program Control Instructions Function Block Add Input Parameter command Choose this command to add an input operand to a JSR or SBR instruction. Master Control Reset (MCR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The MCR instruction simulates a master control relay (a mandatory hard-wired relay that can be de-energized by any series-connected emergency stop switch). Whenever the relay is de-energized, its contacts open to de-energize all application I/O devices. The MCR instruction can selectively disable a section of rungs. Available Languages Ladder Diagram Function Block 630 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands Description The MCR instruction is able to override the normal behavior of rungs; forcing every instruction to execute as if rungcondition-in is false. Typically, false execution of an instruction is faster than true so, selectively disabling unneeded sections of code could result in an overall improvement in scan time. Each time the MCR instruction is executed with rung-condition-in false, the override behavior is toggled. Consequently, two MCR instructions are normally required: one to start the "zone" and a second to terminate it. The starting MCR is typically conditioned by one or more input instructions. When the input conditions are false, the zone will be disabled. When the input conditions are true, the zone will operate normally. The terminating MCR is normally unconditional. If the zone is enabled, the terminating MCR will be true so it will do nothing. If the zone is disabled, however, the terminating MCR will be false so it will toggle the override, re-enabling the rungs that follow it. When you program an MCR zone, note that: MCR instruction must be the last instruction of a rung. • You should end the zone with an unconditional MCR instruction. If the terminating MCR is false, and the zone is enabled, the terminating MCR will disable all of the rungs that follow it. • You cannot nest one MCR zone within another. There is only one override bit in each program. Each MCR instruction has the ability to toggle this override. Attempting to nest MCR zones will actually result in multiple smaller zones to be created. • Do not jump into an MCR zone. If the starting MCR is not executed, the zone will not be disabled. • The override bit is automatically reset at the end of the routine. If an MCR zone continues to the end of the routine, you do not have to program an MCR instruction to end the zone, however, to avoid confusion when online editing, it is recommended that the terminating MCR always be used. If the MCR is disabled in a subroutine or an AOI, the override bit will be reset when the subroutine/AOI returns. AOIs have their own override bit which is initialized when the AOI is invoked. If an AOI is invoked from within a disabled MCR zone, the false scan mode routine will execute normally. After the AOI returns, the state of the zone will be restored to what it was before the AOI was invoked. IMPORTANT: The MCR instruction is not a substitute for a hard-wired master control relay that provides emergency-stop capability. You should still install a hard-wired master control relay to provide emergency I/O power shutdown. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 631 Chapter 11 Program Control Instructions IMPORTANT: Do not overlap or nest MCR zones. Each MCR zone must be separate and complete. If they overlap or nest, unpredictable machine operation could occur with possible damage to equipment or injury to personnel. Place critical operations outside the MCR zone. If you start instructions such as timers in a MCR zone, instruction execution becomes false when the zone is disabled and the timer will be cleared. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false The override behavior is toggled enabling or disabling the rungs that follow. Rung-condition-in is true N/A Postscan N/A Example Ladder Diagram When the first MCR instruction is enabled (input_1, input_2, and input_3 are set), the controller executes the rungs in the MCR zone (between the two MCR instructions) and sets or clears outputs, depending on input conditions. 632 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions When the first MCR instruction is disabled (input_1, input_2, and input_3 are not all set), the controller executes the rungs in the MCR zone (between the two MCR instructions) and the EnableIn goes false for all the rungs in the MCR zone, regardless of input conditions. MCR Flow Chart (False) No Operation (NOP) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The NOP instruction functions as a placeholder. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 633 Chapter 11 Program Control Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands Ladder Diagram None Description You can place the NOP instruction anywhere on a rung. When enabled the NOP instruction performs no operation. When disabled, the NOP instruction performs no operation. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true N/A Postscan N/A Examples Ladder Diagram 634 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Pause SFC (SFP) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The SFP instruction pauses an SFC routine. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text SFP(SFCRoutineName,TargetState); Operands Ladder Diagram Operand Type Format Description SFCRoutineName ROUTINE name SFC routine to pause TargetState DINT immediate Select one: • Executing (or enter 0) • Paused (or enter 1) Structured Text Operand Type Format Description SFCRoutineName ROUTINE name SFC routine to pause TargetState DINT immediate Select one: • Executing (or enter 0) • Paused (or enter 1) See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description The SFP instruction lets you pause an executing SFC routine. Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 635 Chapter 11 Program Control Instructions No Fault Conditions A major fault will occur if: Fault Type Fault Code The routine type is not an SFC routine 4 85 See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false. N/A Rung-condition-in is true The instruction pauses or resumes execution of the specified SFC routine. Postscan N/A Structured Text Condition/State Action Taken Prescan N/A Normal execution The instruction pauses or resumes execution of the specified SFC routine. Postscan N/A Example Ladder Diagram 636 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Reset SFC (SFR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The SFR instruction resets the execution of an SFC routine at a specified step. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text SFR(SFCRoutineName,StepName); Operands Ladder Diagram Operand Type Format Description SFCRoutineName ROUTINE name SFC routine to reset StepName SFC_STEP tag Target step where to resume execution Structured Text Operand Type Format Description SFCRoutineName ROUTINE name SFC routine to reset StepName SFC_STEP tag Target step where to resume execution See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description When the SFR instruction is enabled: Rockwell Automation, Inc. • In the specified SFC routine, all stored actions stop executing (reset). • The SFC begins executing at the specified step. • If the target step is 0, the chart will be reset to is initial step. Publication 1756-RM003Z-EN-P - September 2024 637 Chapter 11 Program Control Instructions The Logix implementation of the SFR instruction differs from that in the PLC-5 controller. In the PLC-5 controller, the SFR executes when the rung condition is true. After reset, the SFC would remain paused until the rung containing the SFR became false. This allowed the execution following a reset to be delayed. This pause/un-pause feature of the PLC-5 SFR instruction was decoupled from the rung condition and moved into the SFP instruction. Affects Math Status Flags No Fault Conditions A major fault will occur if: Fault Type Fault Code The routine type is not an SFC routine 4 85 Specified target step does not exist in the 4 89 SFC routine See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-inis false N/A Rung-condition-in is true The instruction reset the specified SFC routine execution to a particular step. Postscan N/A Structured Text Condition/State Action Taken Prescan N/A Normal execution The instruction reset the specified SFC routine execution to a particular step. Postscan N/A Example 638 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Ladder Diagram Temporary End (TND) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The TND instruction conditionally ends a routine. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text TND(); Operands Ladder Diagram None Structured Text None Description Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 639 Chapter 11 Program Control Instructions When enabled, the TND instruction acts as the end of the routine. If the TND instruction is in a subroutine, control returns to the calling routine. If the TND instruction is in a main routine, control returns to the next program within the current task. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true. The routine ends Postscan N/A Structured Text Condition/State Action Taken Prescan See Prescan in the Ladder Diagram table. Normal execution See rung-condition-in is true in the Ladder Diagram table Postscan See Postscan in the Ladder Digram table. Structured Text InputA[:=] OutputB; IF (InputA) THEN TND(); END_IF; InputE [:=] OutputF; Trigger Event Task (EVENT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The EVENT instruction triggers one execution of an event task. 640 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text EVENT(task_name); Operands Ladder Diagram Operand Type Format Description Task TASK name Event task to execute. If a task is specified that is not the Event task, the specified task will not be executed. Structured Text Operand Type Format Description Task TASK name Event task to execute. If a task is specified that is not the Event task, the specified task will not be executed. See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description Use the EVENT instruction to programmatically execute an event task. Each time the instruction executes, it trigger the specified event task. Make sure that you give the event task enough time to complete its execution before you trigger it again. If not, an overlap occurs. If you execute an EVENT instruction while the event task is already executing, the controller increments the overlap counter, but it does not trigger the event task. EVENT instruction can be used to trigger Event Task with all the trigger types. Programmatically Determine if an EVENT Instruction Triggered a Task Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 641 Chapter 11 Program Control Instructions To determine if an EVENT instruction triggered an event task, use a Get System Value (GSV) instruction to monitor the Status attribute of the task. Attribute Data Type Instruction Description Status DINT GSV Provides status information about the task. Once the controller sets a bit, you must manually clear SSV the bit to determine if another fault of that type occurred. To determine if Examine this bit An EVENT instruction 0 triggered the task (event task only) A timeout triggered the 1 task (event task only) An overlap occurred for 2 this task The controller does not clear the bits of the Status attribute once they are set. To use a bit for new status information, you must manually clear the bit. Use a Set System Value (SSV) instruction to set the attribute to a different value. Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text 642 Condition Action Taken Prescan N/A Normal execution The instruction executes. Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions Examples Example 1 A controller uses multiple programs, but a common shut down procedure. Each program uses a program-scoped tag named Shut_Down_Line that turns on if the program detects a condition that requires a shut down. The logic in each program executes as follows. If Shut_Down_Line = on (conditions require a shut down) then Execute the Shut_Down task one time Ladder Diagram Program A Program B Structured Text Program A IF Shut_Down_Line AND NOT Shut_Down_Line_One_Shot THEN EVENT (Shut_Down); END_IF; Shut_Down_Line_One_Shot:=Shut_Down_Line; Program B IF Shut_Down_Line AND NOT Shut_Down_Line_One_Shot THEN EVENT (Shut_Down); END_IF; Shut_Down_Line_One_Shot:=Shut_Down_Line; Example 2 The following example uses an EVENT instruction to initialize an event task. Another type of event normally triggers the event task. Continuous Task Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 643 Chapter 11 Program Control Instructions IF Initialize_Task_1 = 1 THEN The ONS instruction limits the execution of the EVENT instruction to 1 scan. The EVENT instruction triggers an execution of Task_1 (event task). Task_1 (event task) The GSV instruction sets Task_Status (DINT tag) = Status attribute for the event task. In the Instance Name attribute, THIS means the TASK object for the task that the instruction is in (e.g., Task_1). If Task_Status.0=1 then an EVENT instruction triggered the event task (i.e., when the continuous task executes its EVENT instruction to initialize the event task). The RES instruction resets a counter the event task uses. The controller does not clear the bits of the Status attribute once they are set. To use a bit for new status information, you must manually clear the bit. If Task_Status.0 = 1 then clear that bit. The OTU instruction sets Task_Status.0 = 0. The SSV instruction sets the Status attribute of THIS task (Task_1) = Task_Status. This includes the cleared bit. User Interrupt Disable (UID)/User Interrupt Enable (UIE) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The UID instruction and the UIE instruction work together to prevent a small number of critical rungs from being interrupted by other tasks. 644 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions vailable Languages Ladder Diagrams Function Block This instruction is not available in function block. Structured Text UID(); UIE(); Operands Ladder Diagram This instruction is not available in ladder diagram. Structured Text This instruction is not available in structured text. You must enter the parentheses () after the instruction mnemonic, even though there are no operands. Description When the rung-condition-in is true, the: • UID instruction prevents higher-priority tasks from interrupting the current task, but does not disable execution of a fault routine or the Controller Fault Handler. • UIE instruction enables other tasks to interrupt the current task. To prevent a series of rungs from being interrupted: 1. Limit the number of rungs that you do not want interrupted to as few as possible. Disabling interrupts for a prolonged period of time can produce communication loss. 2. Above the first rung that you do not want interrupted, enter a rung and a UID instruction. 3. After the last rung in the series that you do not want interrupted, enter a rung and a UIE instruction. 4. If required, you can nest pairs of UID/UIE instructions. When the UID is called for the first time, it bumps priority, saves the old priority, and increments a nesting counter. Each subsequent call increments the count. The UIE will decrement the nesting counter. If the new value is 0, it will restore the saved priority. Affects Math Status Flags No. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 645 Chapter 11 Program Control Instructions Fault Conditions None specific to this instruction. See Common Attributes on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The UID instruction prevents the containing user task from being Interrupted. The UIE instruction enables the containing user task to be interrupted as is normally in the case. Postscan N/A Structured Text Condition/State Action Prescan N/A Normal execution The UID instruction prevents the containing user task from being Interrupted. The UIE instruction enables the containing user task to be interrupted as is normally in the case. Postscan N/A Example Ladder Diagram Structured Text 646 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 11 Program Control Instructions UID(); <statements> UIE(); Unknown Instruction (UNK) The UNK instruction functions as an indication that you have entered an instruction type that is not defined within the Logix Designer instruction set. Available Languages Ladder Diagram Function Block This instruction is not available in function block Structured Text This instruction is not available in function block. Operands Ladder Diagram Rockwell Automation, Inc. Operand Type Format Unknown immediate immediate Publication 1756-RM003Z-EN-P - September 2024 Description 647 648 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 12 For/Break Instructions Use the FOR instruction to repeatedly call a subroutine. Use the BRK instruction to interrupt the execution of a subroutine. Available Instructions Ladder Diagram Use the FOR instruction to repeatedly call a subroutine. Use the BRK instruction to interrupt the execution of the subroutine. If you want to: Use this instruction: Repeatedly execute a routine. For (FOR) on page 650 Terminate the repeated execution of a routine. Break (BRK) on page 649 Break (BRK) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The BRK instruction interrupts the execution of a routine that was called by a FOR instruction. When enabled, the BRK instruction exits the routine and returns control to the routine containing the most recently executed FOR instruction, resuming execution following that instruction. If no FOR instruction preceded this BRK instruction in its execution during this scan then BRK does not initiate. If there are nested FOR instructions, a BRK instruction returns control to the innermost FOR instruction. Available Languages Ladder Diagram Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 649 Chapter 12 For/Break Instructions Condition/State Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Example When enabled, the BRK instruction stops executing the current routine and returns to the instruction that follows the calling FOR instruction. Ladder Diagram This is the routine2: For (FOR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The FOR instruction executes a routine repeatedly. When enabled, the FOR instruction repeatedly executes the Routine until the Index value exceeds the Terminal value. This instruction does not pass parameters to the routine. The step value can be positive or negative. If it is negative, the loop ends when the index is less than the terminal value. If it is positive, the loop ends when the index is greater than the terminal value. Each time the FOR instruction executes the routine, it adds the Step size to the Index. Be careful not to loop too many times in a single scan. An excessive number of repetitions can cause the controller’s watchdog to timeout, which causes a major fault. Available Languages 650 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 12 For/Break Instructions Ladder Diagram Operands Ladder Diagram Operand Type Format Description Routine name ROUTINE tag Subroutine that is invoked each time the FOR loop executes. Index DINT tag Counts how many times the routine has been executed Initial value SINT immediate Value at which to start the INT tag index SINT immediate Value at which to stop INT tag executing the routine SINT immediate Amount to add to the index INT tag each time the FOR instruction DINT Terminal value DINT Step size DINT executes the routine Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault type Fault code The nesting level limit > 25 4 94 the subroutine is an SFC and it is already 4 82 executing (recursive call) See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Condition/State Action Prescan The instruction will prescan the named subroutine if it has never been prescanned before. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 651 Chapter 12 For/Break Instructions Condition/State Action Tip: If recursive FOR instruction exist to the same subroutine, or multiple FOR instruction exist (non-recursive) to the same subroutine, the subroutine is pre-scanned only once. This is also true if the subordinate was prescanned by a JSR. Rung-condition-in is false N/A Rung-condition-in is true See the following FOR Flow Chart (True). Postscan The instruction will postscan the named subroutine exactly once. FOR Flow Chart (True) Examples 652 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 12 For/Break Instructions When enabled, the FOR instruction repeatedly executes routine_2 and increments value_2 by 1 each time. When value_2 is > 50000 or a BRK instruction is enabled, the FOR instruction no longer executes routine_2. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 653 654 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions The special instructions perform application-specific operations. Available Instructions If you want to: Use this instruction: Compare data against a known, good reference and record any FBC on page 665 mismatches. Compare data against a known, good reference, record any DDT on page 658 mismatches, and update the reference to match the source. Pass the source data through a mask and compare the result to DTR on page 655 reference data. Then write the source into the reference for the next comparison. Control a PID loop. PI on page 673 Data Transition (DTR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The DTR instruction passes the Source value through a Mask and compares the result with the Reference value. The DTR instruction also writes the masked Source value into the Reference value for the next comparison. The Source remains unchanged. A "1" in the mask means the data bit is passed. A "0" in the mask means the data bit is blocked. When enabled, the Mask passes data when the Mask bits are set; the Mask blocks data when the Mask bits are cleared. When the masked Source differs from the Reference, the EnableOut goes true for one scan. When the masked Source is the same as the Reference, the EnableOut is false. IMPORTANT: Online programming with this instruction can be dangerous. If the Reference value is different than the Source value, the EnableOut goes true. Use caution if you insert this instruction when the processor is in Run or Remote Run mode. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 655 Chapter 13 Special Instructions Ladder Diagram Operands Ladder Diagram Operand Type Format Description Source DINT immediate array to compare to the tag reference immediate which bits to block or pass Mask DINT tag Reference DINT tag array to compare to the source Entering an immediate mask value When you enter a mask, the programming software defaults to decimal values. If you want to enter a mask using another format, precede the value with the correct prefix. Prefix Description 16# hexadecimal (e.g., 16#0F0F) 8# octal (e.g., 8#16) 2# binary (e.g., 2#00110011) Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram 656 Condition Action Prescan The Reference = Source AND Mask. Rung-condition-in is false The Reference = Source AND Mask. Rung-condition-in is true See DTR Flow Chart (True) Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Condition Action Postscan N/A Special Instructions DTR Flow Chart (True) Example Ladder Diagram When enabled, the DTR instruction masks value_1. If there is a difference in the two masked values, the EnableOut is set to true. In example 1, since reference value is equal to sourcevalue_1 AND mask, so the EnableOut will always set to false. In example 2, for some reason, the source value is changed, then reference_value is not equal to source_value AND mask, so in case of this, the EnableOut will be set to TRUE and the referencevalue will be updated based on the sourceValue and mask. That’s why you see in previous scan the reference value is 183, but in current scan it is 187. The rung remains true only for one scan when a change is detected because in the next scan as long as source is not changed, the rung will remains false because the reference value will be equal to source value AND mask again. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 657 Chapter 13 Special Instructions Diagnostic Detect (DDT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The DDT instruction compares bits in a Source array with bits in a Reference array to find mismatch bit. The mismatch bit location is then recorded and the mismatch Reference bit is changed to match Source bit. When enabled, the DDT instruction compares the bits in the Source array with the bits in the Reference array, records the bit number of each mismatch in the Result array, and changes the value of the Reference bit to match the value of the corresponding Source bit. IMPORTANT: The DDT instruction operates on contiguous memory. You must test and confirm that the instruction does not change data that you don’t want it to change. The difference between the DDT and FBC instructions is that each time the DDT instruction finds a mismatch, the DDT instruction changes the reference bit to match the source bit. The FBC instruction does not change the reference bit. If the instruction tries to read past the end of an array, the instruction sets the .ER bit and generates a major fault. Available Languages Ladder Diagram Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram Operand Type Format Description Source DINT array tag Array to compare to the reference do not use CONTROL.POS in the subscript Reference DINT array tag Array to compare to the source do not use CONTROL.POS in the subscript 658 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Operand Type Format Description Result DINT array tag Array to store the results do not use CONTROL.POS in the subscript Cmp. Control CONTROL structure Control structure for the compare Length DINT immediate Number of bits to compare Position DINT immediate Current position in the source initial value typically 0 Result control CONTROL structure Control structure for the results Length DINT immediate Number of storage locations in the result Position DINT immediate Current position in the result initial value typically 0 IMPORTANT: Use different tags for the compare control structure and the result control structure. Using the same tag for both could result in unpredictable operation, possibly causing equipment damage and/or injury to personnel. COMPARE Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the DDT instruction is enabled. .DN BOOL The done bit is set when the DDT instruction compares the last bit in the Source and Reference arrays. .FD BOOL The found bit is set each time the DDT instruction records a mismatch (one-at-a-time operation) or after recording all mismatches (all-per-scan operation). .IN BOOL The inhibit bit indicates the DDT search mode. 0 = all mode 1 = one mismatch at a time mode .ER BOOL The error bit is either POS or LEN are invalid. .LEN DINT The length value identifies the number of bits to compare. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 659 Chapter 13 Special Instructions Mnemonic Data Type Description .POS DINT The position value identifies the current bit. RESULT Structure Mnemonic Data Type Description .DN BOOL The done bit is set when the Result array is full. .LEN DINT The length value identifies the number of storage locations in the Result array. .POS DINT The position value identifies the current position in the Result array. Select the search mode If you want to detect: Select this mode: One mismatch at a time Set the .IN bit in the compare CONTROL structure. Each time the EnableIn goes from false to true, the DDT instruction searches for the next mismatch between the Source and Reference arrays. Upon finding a mismatch, the instruction stops, sets the .FD bit, and records the position of the mismatch. All mismatches Clear the .IN bit in the compare CONTROL structure. Each time the EnableIn goes from false to true, the DDT instruction searches for all mismatches between the Source and Reference arrays. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault type Fault code result.POS > size of result array 4 20 See Common Attributes for General Instructions on page 849 for operand related faults. Execution Ladder Diagram 660 Condition/State Action Taken Prescan See DDT Flow Chart (Prescan) Rung-condition-in is false See DDT Flow Chart (False) Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Condition/State Action Taken Rung-condition-in is true See DDT Flow Chart (True) Postscan N/A Special Instructions DDT Flow Chart (Prescan) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 661 Chapter 13 Special Instructions DDT Flow Chart (False) 662 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions DDT Flow Chart (True) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 663 Chapter 13 Special Instructions DDT Flow Chart (True) – Continued Examples 664 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Ladder Diagram File Bit Comparison (FBC) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The FBC instruction compares bits in a Source array with bits in a Reference array. When enabled, the FBC instruction compares the bits in the Source array with the bits in the Reference array and records the bit number of each mismatch in the Result array. IMPORTANT: The FBC instruction operates on contiguous memory. You must test and confirm that the instruction doesn’t change data that you don’t want it to change. The difference between the DDT and FBC instructions is that each time the DDT instruction finds a mismatch, the instruction changes the reference bit to match the source bit. The FBC instruction does not change the reference bit. If the instruction tries to read past the end of an array, the instruction sets the .ER bit and generates a major fault. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 665 Chapter 13 Special Instructions Ladder Diagram Operands There are data conversion rules for mixed data types within an instruction. See Data Conversion on page 851. Ladder Diagram Operand Type Format Description Source DINT array tag Array to compare to the reference do not use CONTROL.POS in the subscript Reference DINT array tag Array to compare to the source do not use CONTROL.POS in the subscript Result DINT array tag Array to store the result do not use CONTROL.POS in the subscripts Cmp. Control CONTROL structure Control structure for the compare Length DINT immediate Number of bits to compare Position DINT immediate Current position in the source initial value is typically 0 Result control CONTROL structure Control structure for the results Length DINT immediate number of storage locations in the result Position DINT immediate Current position in the result initial value is typically 0 CAUTION: Use different tags for the compare control structure and the result control structure. Using the same tag for both could result in unpredictable operation, possibly causing equipment damage and injury to personnel. COMPARE Structure 666 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Mnemonic Data Type Description .EN BOOL The enable bit indicates the FBC instruction is enabled. .DN BOOL The done bit is set when the FBC instruction compares the last bit in the Source and Reference arrays. .FD BOOL The found bit is set each time the FBC instruction records a mismatch (one-at-a-time operation) or after recording all mismatches (all-per-scan operation). .IN BOOL The inhibit bit indicates the FBC search mode. 0 = all mode 1 = one mismatch at a time mode .ER BOOL The error bit is set either POS or LEN are invalid. .LEN DINT The length value identifies the number of bits to compare. .POS DINT The position value identifies the current bit. RESULT Structure Mnemonic Data Type Description .DN BOOL The done bit is set when the Result array is full. .LEN DINT The length value identifies the number of storage locations in the Result array. .POS DINT The position value identifies the current position in the Result array. Select the search mode If you want to detect: Select this mode: One mismatch at a time Set the .IN bit in the compare CONTROL structure. Each time the EnableIn goes from false to true, the FBC instruction searches for the next mismatch between the Source and Reference arrays. Upon finding a mismatch, the instruction sets the .FD bit, records the position of the mismatch, and stops executing. All mismatches Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 Clear the .IN bit in the compare CONTROL structure. 667 Chapter 13 Special Instructions If you want to detect: Select this mode: Each time EnableIn goes from false to true, the FBC instruction searches for all mismatches between the Source and Reference arrays. Affects Math Status Flags No Major/Minor Faults A major fault will occur if: Fault type Fault code result.POS > size of result array 4 20 See Common Attributes for General Instructions on page 849 for operand related faults. Execution Ladder Diagram 668 Condition/State Action Taken Prescan See FBC Flow Chart (Prescan) Rung-condition-in is false See FBC Flow Chart (False) Rung-condition-in is true See FBC Flow Chart (True) Postscan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions FBC Flow Chart (Prescan) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 669 Chapter 13 Special Instructions FBC Flow Chart (False) 670 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions FBC Flow Chart (True) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 671 Chapter 13 Special Instructions FBC Flow Chart (True) - continued Example 672 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Ladder Diagram Proportional Integral Derivative (PID) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The PID instruction controls a process variable such as flow, pressure, temperature, or level. The PID instruction typically receives the process variable (PV) from an analog input module and modulates a control variable output (CV) on an analog output module in order to maintain the process variable at the desired setpoint. The .EN bit indicates execution status. The .EN bit is set when the EnableIn transitions from false to true. The .EN bit is cleared when the EnableIn becomes false. The PID instruction does not use a .DN bit. The PID instruction executes every scan as long as the EnableIn is true. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 673 Chapter 13 Special Instructions Ladder Diagram Structured Text PID(PID,ProcessVariable,Tieback,ControlVariable,PIDMasterLoop,InHoldBit,InHoldValue); Operands There are data conversion rules for mixed data types within an instruction. See Data conversions on page 851. Ladder Diagram Operand Type Format Description PID PID structure PID structure Process variable SINT tag Value you want to control SINT immediate (optional) INT tag INT DINT REAL Tieback DINT Output of a hardware hand/auto station which is bypassing the output of the controller. Enter 0 if you don’t want to use this parameter REAL Control variable SINT tag Value which goes to the final control device (valve, damper, etc.) INT DINT If you are using the deadband, the Control variable must be REAL or it will be forced to 0 674 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Operand Type Format Special Instructions Description when the error is within the deadband. REAL PID master loop PID Structure Optional PID tag for the master PID If you are performing cascade control and this PID is a slave loop, enter the name of the master PID Enter 0 if you do not want to use this parameter Inhold bit BOOL tag Optional Current status of the inhold bit from a 1756 analog Output channel to support bumpless restart Inhold value SINT tag INT Optional Data readback value from a 1756 analog output DINT Channel to support bumpless restart REAL Enter 0 if you don’t want to use this parameter Setpoint Display only Current value of the setpoint Process variable Display only Current value of the scaled Process_Variable Output % Display only Current output percentage value PID structure Specify a unique PID structure for each PID instruction. Mnemonic Data Type Description .CTL DINT The .CTL member provides access to the status members (bits) in one, 32-bit word. Bits 07-15 are set by the PID instruction. See .CTL member. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 675 Chapter 13 Special Instructions Mnemonic Data Type Description .SP REAL setpoint .KP REAL Independent - proportional gain (unitless) Dependent - controller gain (unitless) .KI REAL Independent - integral gain (1/sec) Dependent - reset time (minutes per repeat) .KD REAL Independent - derivative gain (seconds) Dependent - rate time (minutes) .BIAS REAL feedforward or bias % .MAXS REAL maximum engineering unit scaling value .MINS REAL minimum engineering unit scaling value .DB REAL deadband engineering units .SO REAL set .MAXO REAL maximum output limit (% of output) .MINO REAL minimum output limit (% of output) .UPD REAL loop update time (seconds) .PV REAL scaled PV value .ERR REAL scaled error value .OUT REAL output % .PVH REAL process variable high alarm limit .PVL REAL process variable low alarm limit .DVP REAL positive deviation alarm limit .DVN REAL negative deviation alarm limit .PVDB REAL process variable alarm deadband .DVDB REAL deviation alarm deadband .MAXI REAL maximum PV value (unscaled input) .MINI REAL minimum PV value (unscaled input) .TIE REAL tieback value for manual control .MAXCV REAL maximum CV value (corresponding to 100%) .MINCV REAL minimum CV value (corresponding to 0%) .MINITIE REAL minimum tieback value (corresponding to 100%) .MAXTIE REAL maximum tieback value (corresponding to 0%) 676 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Mnemonic Data Type Description .DATA[17] REAL The .DATA member stores: • .DATA[0] - integral accumulation • .DATA[1] - derivative smoothing temporary value • .DATA[2] - previous .PV value • .DATA[3] - previous .ERR value • .DATA[4] - previous valid .SP value • .DATA[5] - percent scaling constant • .DATA[6] - .PV scaling constant • .DATA[7] - derivative scaling constant • .DATA[8] - previous .KP value • .DATA[9] - previous .KI value • .DATA[10] - previous .KD value • .DATA[11] - dependend gain .KP • .DATA[12] - dependend gain .KI • .DATA[13] - dependend gain .KD • .DATA[14] - previous .CV value • .DATA[15] - .CV descaling constant • .DATA[16] - tieback descaling constant The .CTL member Bit Number Description .EN 31 .CT 30 cascade type (0=slave; 1=master) .CL 29 cascade loop (0=no; 1=yes) .PVT 28 process variable tracking (0=no; 1=yes) .DOE 27 derivative of (0=PV; 1=error) .SWM 26 software mode (0=no-auto); 1=yes- sw manual) .CA 25 control action (0=reverse (SP-PV); 1=direct (PV- SP)) .MO 24 station mode (0=automatic; 1=manual) .PE 23 PID equation (0=independent; 1=dependent) Rockwell Automation, Inc. .NDF 22 derivative smoothing (0=no; 1=yes) .NOBC 21 bias calculation (0=no; 1=yes) .NOZC 20 zero crossing (0=no; 1=for deadband) .INI 15 PID initialized (0=no; 1=yes) Publication 1756-RM003Z-EN-P - September 2024 677 Chapter 13 Special Instructions .SPOR 14 setpoint out of range (0=no; 1=yes) .OLL 13 CV is below minimum output value (0=no; 1=yes) .OLH 12 CV is above maximum output value (0=no; 1=yes) .EWD 11 error is within deadband (0=no; 1=yes) .DVNA 10 error is alarmed low (0=no; 1=yes) .DVPA 9 error is alarmed high (0=no; 1=yes) .PVLA 8 PV is alarmed low (0=no; 1=yes) .PVHA 7 PV is alarmed high (0=no; 1=yes) A minor fault will occur if: Fault Type Fault Code UPD ≥ 0 4 35 setpoint out of range 4 36 Affects Math Status Flags No Major/Minor Faults See Common Attributes for General Instructions on page 849 for operand-related faults. Using PID Instructions After entering the PID instruction and specifying the PID structure, use the configuration tabs to specify how the PID instruction should function. Specify Tuning Select the Tuning tab. Changes take effect as soon as you select another field, select OK, select Apply, or press Enter. In this field: Do the following: Setpoint (SP) Enter a setpoint value (.SP). Set output % Enter a set output percentage (.SO). In software manual mode, this value is used for the output. In auto mode, this value displays the output %. Output bias Enter an output bias percentage (.BIAS). Proportional gain (Kp) Enter the proportional gain (.KP). For independent gains, it’s the proportional gain (unitless). For dependent gains, it’s the controller gain (unitless). Integral gain (Ki) Enter the integral gain (.KI). For independent gains, it’s the integral gain (1/sec). For dependent gains, it’s the reset time (minutes per repeat). 678 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 In this field: Do the following: Derivative time (Kd) Enter the derivative gain (.KD). Special Instructions For independent gains, it’s the derivative gain (seconds). For dependent gains, it’s the rate time minutes). Manual mode Select either manual (.MO) or software manual (.SWM). Manual mode overrides software manual mode if both are selected. Specify Configuration Select the Configuration tab. You must select OK or Apply for any changes to take effect. In this field: Do the following: PID equation Select independent gains or dependent gains (.PE). Use independent when you want the three gains (P, I, and D) to operate independently. Use dependent when you want an overall controller gain that affects all three terms (P, I, and D). Control action Select either E=PV-SP or E=SP-PV for the control action (.CA). Derivative of Select PV or error (.DOE). Use the derivative of PV to reduce the risk of output spikes resulting from setpoint changes. Use the derivative of error for fast responses to setpoint changes when the algorithm can tolerate overshoots. Loop update time Enter the update time (.UPD) for the instruction. CV high limit Enter a high limit for the control variable (.MAXO).(1) CV low limit Enter a low limit for the control variable (.MINO).(1) Deadband value Enter a deadband value (.DB). No derivative smoothing Enable or disable this selection (.NDF). No bias calculation Enable or disable this selection (.NOBC). No zero crossing in deadband Enable or disable this selection (.NOZC). PV tracking Enable or disable this selection (.PVT). Cascade loop Enable or disable this selection (.CL). Cascade type If cascade loop is enabled, select either slave or master (.CT). (1) When using the ladder-based PID instruction, if you set MAXO = MINO, the PID instruction resets these values to default. MAXO = 100.0 and MINO = 0.0 Specify Alarms Select the Alarms tab. Select OK or Apply for any changes to take effect. Rockwell Automation, Inc. In this field: Do the following: PV high Enter a PV high alarm value (.PVH). PV low Enter a PV low alarm value (.PVL). Publication 1756-RM003Z-EN-P - September 2024 679 Chapter 13 Special Instructions In this field: Do the following: PV deadband Enter a PV alarm deadband value (.PVDB). Positive deviation Enter a positive deviation value (.DVP). Negative deviation Enter a negative deviation value (.DVN). Deviation deadband Enter a deviation alarm deadband value (.DVDB). Specify Scaling Select the Scaling tab. You must select OK or Apply for any changes to take effect. In this field: Do the following: PV unscaled maximum Enter a maximum PV value (.MAXI) that equals the maximum unscaled value received from the analog input channel for the PV value. PV unscaled minimum Enter a minimum PV value (.MINI) that equals the minimum unscaled value received from the analog input channel for the PV value. PV engineering units maximum Enter the maximum engineering units corresponding to .MAXI (.MAXS) PV engineering units minimum Enter the minimum engineering units corresponding to .MINI (.MINS) CV maximum Enter a maximum CV value corresponding to 100% (.MAXCV). CV minimum Enter a minimum CV value corresponding to 0% (.MINCV). Tieback maximum Enter a maximum tieback value (.MAXTIE) that equals the maximum unscaled value received from the analog input channel for the tieback value. Tieback minimum Enter a minimum tieback value (.MINTIE) that equals the minimum unscaled value received from the analog input channel for the tieback value. PID Initialized If you change scaling constants during Run mode, turn this off to reinitialize internal descaling values (.INI). Tip: When using the ladder-based PID instruction, if you set MAXO = MINO, the PID instruction resets these values to default. MAXO = 100.0 and MINO = 0.0. Use PID Instructions 680 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions PID closed-loop control holds a process variable at a desired set point. The illustration shows an example of a flowrate/fluid level. In the above example, the level in the tank is compared against the setpoint. If the level is higher than the setpoint, the PID equation increases the control variable and causes the outlet valve from the tank to open; thereby decreasing the level in the tank. The PID equation used in the PID instruction is a positional form equation with the option of using either independent gains or dependent gains. When using independent gains, the proportional, integral, and derivative gains affect only their specific proportional, integral, or derivative terms respectively. When using dependent gains, the proportional gain is replaced with a controller gain that affects all three terms. You can use either form of equation to perform the same type of control. The two equation types are merely provided to let you use the equation type with which you are most familiar. Gains Option Derivative Of Dependent gains Error (E) (ISA standard) Process variable (PV) Independent gains Error (E) Process variable (PV) Where: Variable Description KP Proportional gain (unitless) Kp = Kc unitless Ki Integral gain (seconds -1) To convert between Ki (integral gain) and Ti (reset time), see Conversion Formula: Kd Derivative gain (seconds) To convert between Kd (derivative gain) and Td (rate time), use: Kd = Kc (Td) 60 Rockwell Automation, Inc. KC Controller gain (unitless) Ti Reset time (minutes/repeat) Publication 1756-RM003Z-EN-P - September 2024 681 Chapter 13 Special Instructions Variable Description Td Rate time (minutes) SP Setpoint PV Process variable E Error [(SP-PV) or (PV-SP)] BIAS Feedforward or bias CV Control variable dt Loop update time Conversion Formula If you do not want to use a particular term of the PID equation, just set its gain to zero. For example if you want no derivative action, set Kd or Td equal to zero. Anti-reset Windup and Bumpless Transfer From Manual To Auto (PID) The PID instruction automatically avoids reset windup by preventing the integral term from accumulating whenever the CV output reaches its maximum or minimum values, as set by .MAXO and .MINO. The accumulated integral term remains frozen until the CV output drops below its maximum limit or rises above its minimum limit. Then normal integral accumulation automatically resumes. The PID instruction supports two manual modes of control. Manual Mode of Control Description Software manual (.SWM) This mode is also known as set output mode and allows the user to set the output % from the software. The set output (.SO) value is used as the output of the loop. The set output value typically comes from an operator input from an operator interface device. Manual (.MO) This mode takes the tieback value, as an input, and adjusts its internal variables to generate the same value at the output The tieback input to the PID instruction is scaled to 0-100% according to the values of .MINTIE and .MAXTIE and is used as the output of the loop. The tieback input typically comes from the output of a hardware hand/auto station that is bypassing the output from the controller. Important: Manual mode overrides software manual mode if both mode bits are set on. The PID instruction automatically provides bumpless transfers from software manual mode to auto mode or from manual to auto mode. The PID instruction back-calculates the value of the integral accumulation term required to make the CV output track either the set output (.SO) value in software manual mode or the tieback input in manual 682 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions mode. In this manner, when the loop switches to auto mode, the CV output starts off from the set output or tieback value and no ‘bump’ in output value occurs. The PID instruction can also automatically provide a bumpless transfer from manual to auto even if integral control is not used (that is Ki = 0). In this case, the instruction modifies the .BIAS term to make the CV output track either the set output or tieback values. When automatic control is resumed, the .BIAS term maintains its last value. Disable back-calculation of the .BIAS term by setting the .NOBC bit in the PID data structure. If you set .NOBC true, the PID instruction no longer provides a bumpless transfer from manual to auto when integral control is not used. Bumpless Restart (PID) The PID instruction can interact with the 1756 analog output modules to support a bumpless restart when the controller changes from Program to Run mode or when the controller powers up. When a 1756 analog output module loses communications with the controller or senses that the controller is in Program mode, the analog output module sets its outputs to the fault condition values you specified when you configured the module. When the controller then returns to Run mode or re-establishes communications with the analog output module, you can have the PID instruction automatically reset its control variable output equal to the analog output by using the Inhold bit and Inhold Value parameters on the PID instruction. Instructions for setting a bumpless restart Do this Details Configure the channel of the 1756 analog output module that Select the Hold for initialization box on the properties page for receives the control variable from the PID instruction the specific channel of the module. This tells the analog output module that when the controller returns to Run mode or re-establishes communications with the module, the module should hold the analog output at its current value until the value sent from the controller matches (within 0.1% of span) the current value used by the output channel. The output of of the channel ramps to the currently held output value by making use of the .BIAS term. This ramping is similar to auto bumpless transfer. Enter the Inhold bit tag and Inhold Value tag in the PID The 1756 analog output module returns two values for each instruction channel in its input data structure. The InHold status bit (.Ch2InHold, for example), when true, indicates that the analog output channel is holding its value. The Data readback value (.Ch2Data, for example) shows the current output value in engineering units. Enter the tag of the InHold status bit as the InHold bit parameter of the PID instruction. Enter the tag of the Data readback value as the Inhold Value parameter. When he Inhold bit is true, the PID instruction moves the Inhold Value into the Control variable output and re-initializes to support a bumpless restart at that value. When the analog output module receives this value back from the controller, it Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 683 Chapter 13 Special Instructions Do this Details turns off the InHold status bit, which allows the PID instruction to start controlling normally. Cascading Loops (PID) The PID cascades two loops by assigning the output in percent of the master loop to the setpoint of the slave loop. The slave loop automatically converts the output of the master loop into the correct engineering units for the setpoint of the slave loop, based on the slave loop’s values for .MAXS and .MINS. Ladder Diagram Controlling a Ratio (PID) You can maintain two values in a ratio by using these parameters: • Uncontrolled value • Controlled value (the resultant setpoint to be used by the PID instruction) • Ratio between these two values Ladder Diagram 684 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Tip: Tip: To avoid locking up the PID with invalid internal floating point values, ensure the PV is not INF or NAN before invoking the instruction such as: XIC (PC_timer.DN) MOV(Local:0:1.Ch0Data, Local:0:1.Ch0Data) XIO(S:V) PID(...) Structured Text pid_2.sp := uncontrolled_flow * ratio PID(pid_2,pv_2,tieback_2,cv_2,0,0,0); Tip: Tip: To avoid locking up the PID with invalid internal floating point values, ensure the PV is not INF or NAN before invoking the instruction such as: XIC (PC_timer.DN) MOV(Local:0:1.Ch0Data, Local:0:1.Ch0Data) XIO(S:V) PID(...) For this multiplication Enter this value Destination Controlled value Source A Uncontrolled value Source B Ratio Derivative Smoothing (PID) The derivative calculation is enhanced by a derivative smoothing filter. This first order, low pass, digital filter minimizes large derivative term spikes caused by noise in the PV. This smoothing becomes more aggressive with larger values of derivative gain. You can disable derivative smoothing if your process requires very large values of derivative gain (Kd > 10, for example). To disable derivative smoothing: • Select No derivative smoothing on the Configuration tab, or set the .NDF bit in the PID structure. Feedforward or Output Biasing (PID) Feedforward a disturbance from the system by feeding the .BIAS value into the PID instruction’s feedforward/bias value. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 685 Chapter 13 Special Instructions The feedforward value represents a disturbance fed into the PID instruction before the disturbance has a chance to change the process variable. Feedforward is often used to control processes with a transportation lag. For example, a feedforward value representing ‘cold water poured into a warm mix’ could boost the output value faster than waiting for the process variable to change as a result of the mixing. A bias value is typically used when no integral control is used. In this case, the bias value can be adjusted to maintain the output in the range required to keep the PV near the setpoint. PID Instruction Timing The PID instruction and the sampling of the process variable need to be updated at a periodic rate. This update time is related to the physical process you are controlling. For very slow loops, such as temperature loops, an update time of once per second or even longer is usually sufficient to obtain good control. Somewhat faster loops, such as pressure or flow loops, may require an update time such as once every 250 ms. Only rare cases, such as tension control on an unwinder spool, require loop updates as fast as every 10 ms or faster. Because the PID instruction uses a time base in its calculation, you need to synchronize execution of this instruction with sampling of the process variable (PV ). The easiest way to execute the PID instruction is to put the PID instruction in a periodic task. Set the loop update time (.UPD) equal to the periodic task rate and make sure that the PID instruction is executed every scan of the periodic task. The easiest way to execute the PID instruction is to put the PID instruction in a periodic task. Set the loop update time (.UPD) equal to the periodic task rate and make sure that the PID instruction is executed every scan of the periodic task. Relay Ladder Tip: To avoid locking up the PID with invalid internal floating point values, ensure the PV is not INF or NAN before invoking the instruction such as: XIC (PC_timer.DN) MOV(Local:0:1.Ch0Data, Local:0:1.Ch0Data) XIO(S:V) PID(...) Structured Text 686 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions PID(TIC101,Local:0:I.Ch0Data,Local:0:I.Ch1Data, Local:1:O.Ch4Data,0,Local:1:I.Ch4InHold, Local:1:I.Ch4Data); When using a periodic task, make sure that the analog input used for the process variable is updated to the processor at a rate that is significantly faster than the rate of the periodic task. Ideally, the process variable should be sent to the processor at least five to 10 times faster than the periodic task rate. This minimizes the time difference between actual samples of the process variable and execution of the PID loop. For example, if the PID loop is in a 250 ms periodic task, use a loop update time of 250 ms (.UPD = .25), and configure the analog input module to produce data at least about every 25 to 50 ms. Another, somewhat less accurate, method of executing a PID instruction is to place the instruction in a continuous task and use a timer done bit to trigger execution of the PID instruction. Relay Ladder Tip: To avoid locking up the PID with invalid internal floating point values, ensure the PV is not INF or NAN before invoking the instruction such as: XIC (PC_timer.DN) MOV(Local:0:1.Ch0Data, Local:0:1.Ch0Data) XIO(S:V) PID(...) Structured Text PID_timer.pre := 1000 TONR(PID_timer); IF PID_timer.DN THEN PID(TIC101,Local:0:I.Ch0Data,Local:0:I.Ch1Data, Local:1:O.Ch0Data,0,Local:1:I.Ch0InHold, Local:1:I.Ch0Data); END_IF; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 687 Chapter 13 Special Instructions Tip: To avoid locking up the PID with invalid internal floating point values, ensure the PV is not INF or NAN before invoking the instruction such as: XIC (PC_timer.DN) MOV(Local:0:1.Ch0Data, Local:0:1.Ch0Data) XIO(S:V) PID(...) In this method, the loop update time of the PID instruction should be set equal to the timer preset. As in the case of using a periodic task, you should set the analog input module to produce the process variable at a significantly faster rate than the loop update time. You should only use the timer method of PID execution for loops with loop update times that are at least several times longer than the worst-case execution time for your continuous task. The most accurate way to execute a PID instruction is to use the real time sampling (RTS) feature of the 1756 analog input modules. The analog input module samples its inputs at the real time sampling rate you configure when you set up the module. When the real time sample period of the module expires, it updates its inputs and updates a rolling timestamp (represented by the .RollingTimestamp member of the analog input data structure) produced by the module. The timestamp ranges from 0 to 32,767 ms. Monitor the timestamp. When it changes, a new process variable sample has been received. Every time a timestamp changes, execute the PID instruction once. Because the process variable sample is driven by the analog input module, the input sample time is very accurate, and the loop update time used by the PID instruction should be set equal to the RTS time of the analog input module. To make sure that you do not miss samples of the process variable, execute your logic at a rate faster than the RTS time. For example, if the RTS time is 250 ms, you could put the PID logic in a periodic task that runs every100 ms to make sure that you never miss a sample. You could even place the PID logic in a continuous task, as long as you make sure that the logic would be updated more frequently than once every 250 ms. An example of the RTS method of execution is shown below. The execution of the PID instruction depends on receiving new analog input data. If the analog input module fails or is removed, the controller stops receiving rolling timestamps and the PID loop stops executing. You should monitor the status bit of the PV analog input and, if it shows bad status, force the loop into software manual mode, and execute the loop every scan. This lets the operator still manually change the output of the PID loop. 688 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 13 Special Instructions Relay Ladder Structured Text IF (Local:0:I.Ch0Fault) THEN TIC101.SWM [:=] 1; ELSE TIC101.SWM := 0; END_IF; IF (Local:0:I.RollingTimestamp<>PreviousTimestamp) OR (Local:0:I.Ch0Fault) THEN PreviousTimestamp := Local:0:I.RollingTimestamp; PID(TIC101,Local:0:I.Ch0Data,Local:0:I.Ch1Data, Local:1:O.Ch0Data,0,Local:1:I.Ch0InHold, Local:1:I.Ch0Data); END_IF; Setting the Deadband (PID) The adjustable deadband lets you select an error range above and below the setpoint where output does not change as long as the error remains within this range. This deadband allows you to control how closely the process variable matches the setpoint without changing the output. The deadband also helps to minimize wear and tear on your final control device. Zero-crossing is deadband control that lets the instruction use the error for computational purposes as the process variable crosses into the deadband until the process variable crosses the setpoint. Once the process variable crosses the setpoint (error crosses zero and changes sign) and as long as the process variable remains in the deadband, the output does not change. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 689 Chapter 13 Special Instructions The deadband extends above and below the setpoint by the value you specify. Enter zero to inhibit the deadband. The deadband has the same scaled units as the setpoint. Use the deadband without the zero-crossing feature by selecting No zero crossing for deadband on the Configuration tab or set the .NOZC bit in the PID structure. If you are using the deadband, the Control variable must be REAL or it is forced to zero when the error is within the deadband. To inhibit the deadband: • Enter zero (0). The deadband has the same scaled units as the setpoint. To use the deadband without the zero-crossing feature: • Select No zero crossing for deadband on the Configuration tab or set the .NOZC bit in the PID structure. If you are using the deadband, the Control variable must be REAL or it is forced to 0 when the error is within the deadband. Using Output Limiting (PID) Set an output limit (percentage of output) on the control output. When the instruction detects that the output has reached a limit, it sets an alarm bit and prevents the output from exceeding either the lower or upper limit. 690 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions The trigonometric instructions evaluate arithmetic operations using trigonometric operations. Available Instructions Ladder Diagram, Function Block, and Structured Text SIN on page 716 ATAN on page 702, COS on page 711 TAN on page 721 ASIN on page 697 ACOS on page 691 ATAN2 on page 702 If you want to: Use this instruction: Take the sine of a value. SIN Take the cosine of a value. COS Take the tangent of a value. TAN Take the arc sine of a value. ASIN Take the arc cosine of a value. ACOS Take the arc tangent of a value. ATAN Take the two-argument arc tangent of a value. ATAN2 You can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to execute. Check the S:V bit to see whether the result was truncated. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. A trigonometric instruction executes once each time the instruction is scanned as long as the rung-condition-in is true. If you want the instruction evaluated only once, use an ONS instruction to trigger the trigonometric instruction. Arc Cosine (ACOS) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the ACOS instruction takes the arc cosine of the Source value and stores the result in the Destination (in radians). Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 691 Chapter 14 Trigonometric Instructions Tip: In Logix Designer version 36, the mnemonic for this instruction changed from ACS to ACOS. Available Languages These are the available languages for Arc Cosine (ACOS). Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use ACOS as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands 692 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structured operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Format Description controllers Source SINT SINT Immediate Value to convert to arc INT INT tag cosine. DINT DINT REAL LINT tag Tag to store result of USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description ACOS FBD_MATH_ADVANCED tag ACS structure FBD_MATH_ADVANCED Structure Input Member Rockwell Automation, Inc. Data Type Publication 1756-RM003Z-EN-P - September 2024 Description 693 Chapter 14 Trigonometric Instructions EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Input to the trigonometric instruction. Output Member Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to arc cosine. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Operator Aspects 694 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions The ACOS operator can be used in various RLL expressions. Similarly, the ACOS function is invoked in Structured Text statements. ACOS returns a floating point result containing the arc cosine of the Source. Depending on the context this value may then be type converted if appropriate. Description The ACOS instruction takes the arc cosine of the Source value and stores the result in the Destination (in radians). The ACOS operator/function computes the arc cosine of the Source and returns the floating point result. The Source must be greater than or equal to -1 and less than or equal to 1. The resulting value in the Destination is greater than or equal to 0 or less than or equal to pi (where pi = 3.141593). If Source is smaller than -1 or greater than 1 then Destination is set to NAN. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = arc cosine value of the Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false. Set EnableOut to EnableIn. EnableIn is true Dest = arc cosine value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 695 Chapter 14 Trigonometric Instructions Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Condition/State Action Taken Prescan N/A Normal Scan Dest = arc cosine value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text 696 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions REAL_dest := ACOS(REAL_src); Arc Sine (ASIN) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the Arc Sine (ASIN) instruction takes the arc sine of the Source value and stores the result in the Destination (in radians). The ASIN operator/function computes the arc sine of the Source and returns the floating point result. The Source must be greater than or equal to -1 and less than or equal to 1. The resulting value in the Destination is greater than or equal to -pi /2 and less than or equal to pi /2 (where pi = 3.141593). If Source is smaller than -1 or greater than 1 then Destination is set to NAN. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from ASN to ASIN. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 697 Chapter 14 Trigonometric Instructions Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use ASIN as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structured operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Format Description controllers Source SINT SINT Immediate Value to convert to arc INT INT tag sine DINT DINT REAL LINT tag Tag to store result of USINT UINT UDINT ULINT REAL LREAL Destination 698 SINT SINT INT INT DINT DINT Publication 1756-RM003Z-EN-P - September 2024 the instruction Rockwell Automation, Inc. Chapter 14 REAL Trigonometric Instructions LINT USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description ASN FBD_MATH_ADVANCED tag ASN structure FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to arc sine. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 699 Chapter 14 Trigonometric Instructions FBD_MATH_ADVANCED Structure Input Member Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Input to the trigonometric instruction Output Member Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. Operator Aspects The ASIN operator can be used in various RLL expressions. Similarly, the ASIN function is invoked in Structured Text statements. ASIN returns a floating point result containing the arc sine of the Source. Depending on the context this value may then be type converted if appropriate. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = arc sine value of the Source. Postscan N/A Function Block Diagram FBD Block 700 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = arc sine value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = arc since value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram Function Block Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 701 Chapter 14 Trigonometric Instructions FBD Block FBD Function Structured Text REAL_dest := ASIN(REAL_src); Arc Tangent (ATAN) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the ATAN instruction computes the arc tangent of the Source value and stores the result in the Destination (in radians). The ATAN operator/function computes the arc tangent of the Source and returns the floating point result. The resulting value in the Destination is greater than or equal to -pi/2 and less than or equal to pi/2 (where pi = 3.141593). Tip: In Logix Designer version 36, the mnemonic for this instruction changed from ATN to ATAN. Available Languages 702 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Structured Text This instruction is not available in structured text. Tip: Use ATAN as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Format Description controllers Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 703 Chapter 14 Trigonometric Instructions Source SINT SINT Immediate Value to convert to arc INT INT tag tangent. DINT DINT REAL LINT tag Tag to store the result USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram Function Block Operand Type Format Description ATAN tag FBD_MATH_ADVANCED tag ATAN structure FBD_MATH_ADVANCED Structure Input Member Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Input to the trigonometric instruction. Output Member Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function 704 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to arc tangent. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Operator Aspects The ATAN operator can be used in various RLL expressions. Similarly, the ATAN function is invoked in Structured Text statements. ATAN returns a floating point result containing the arc tangent of the Source. Depending on the context this value may then be type converted if appropriate. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 705 Chapter 14 Trigonometric Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = arc tangent value of the Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = arc tangent value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = arc tangent value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example 706 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text REAL_dest := ATAN(REAL_src); Two-Argument Arctangent (ATAN2) This information applies to the Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The ATAN2 instruction takes the two-argument arc tangent of the Source values and stores the result in the Destination (in radians). The ATAN2 operator/function computes the arc tangent of the Source and returns the FLOAT result. The resulting value in the Destination is greater than or equal to -p and less than or equal to p (where p = 3.141593). Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 707 Chapter 14 Trigonometric Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports only the FBD function: FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use ATAN2 as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structured operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Ladder Diagram Operand Data Type Format Description immediate Source Y of ATAN2 Input CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source Y 708 SINT Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 INT Trigonometric Instructions tag DINT LINT USINT UINT UDINT ULINT REAL LREAL Source X SINT immediate INT tag Source X of ATAN2 Input DINT LINT USINT UINT UDINT ULINT REAL LREAL Dest REAL tag LREAL Tag to store result of the instruction. Function Block Diagram FBD Function Operand Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source Y SINT Source Y of ATAN2 Input INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Source Y SINT Source X of ATAN2 Input INT DINT LINT USINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 709 Chapter 14 Trigonometric Instructions UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Operator Aspects The ATAN2 operator can be used in various RLL expressions. Similarly, the ATAN2 function is invoked in Structured Text statements. ATAN2 returns a FLOAT result containing the result of two argument arc tangent of the Source Y and Source X. Depending on the context, this value can then be type converted if appropriate. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = ATAN2(Source Y, Source X) Postscan N/A Function Block Diagram FBD Function 710 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Condition/State Action Taken Prescan N/A Normal Scan Dest = ATAN2(Source Y, Source X) Instruction first run N/A Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block Diagram FBD Function Structured Text REAL_dest := ATAN2(REAL_srcY, REAL_srcX); Cosine (COS) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The COS instruction takes the cosine of the Source value (in radians) and stores the result in the Destination. The COS operator/function computes the cosine of Source and returns the floating point result. The resulting value is always greater than or equal to -1 and less than or equal to 1. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 711 Chapter 14 Trigonometric Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use COS as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, ControlLogix 5570, CompactLogix 5480, Compact GuardLogix ControlLogix 5580, 5370, and GuardLogix Compact GuardLogix 5570 controllers 5380, and GuardLogix Format Description 5580 controllers Source 712 SINT SINT Immediate Find the cosine of this INT INT tag value. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 DINT DINT REAL LINT Trigonometric Instructions USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT tag Tag to store the result. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description COS tag FBD_MATH_ADVANCED tag COS structure FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Description Source SINT Value to convert to cosine. INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Rockwell Automation, Inc. Data Type Publication 1756-RM003Z-EN-P - September 2024 Description 713 Chapter 14 Trigonometric Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Operator Aspects The COS operator can be used in various expressions. Similarly, the COS function is invoked in Structured Text statements. Both applications of COS return a floating point result containing the cosine of the Source. Depending on the context this value may then be type converted if appropriate. FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is set. Source REAL Input to the trigonometric instruction. Output Members Data Type Description EnableOut BOOL Indicates if instruction is enabled. Dest REAL Result of the math instruction. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram 714 Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Dest = cosine value of the Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = cosine value of the Source. If overflow occurs Clear EnableOut to false else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = cosine value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram Function Block Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 715 Chapter 14 Trigonometric Instructions FBD Block FBD Function Structured Text REAL_dest := COS(REAL_src); Sine (SIN) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the SIN instruction takes the sine of the Source value (in radians) and stores the result in the Destination. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: 716 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use SIN as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, ControlLogix 5570, CompactLogix 5480, Compact GuardLogix ControlLogix 5580, 5370, and GuardLogix Compact GuardLogix 5570 controllers 5380, and GuardLogix Format Description Value to convert to sine. 5580 controllers Source SINT SINT Immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 717 Chapter 14 Trigonometric Instructions Destination SINT SINT INT INT DINT DINT REAL LINT tag Tag to store the result of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description SIN tag FBD_MATH_ADVANCED tag SIN structure FBD_MATH_ADVANCED Structure Input Parameter Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Input to the trigonometric instruction. Output Parameter Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to sine. INT DINT LINT USINT 718 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Operator Aspects The SIN operator can be used in various expressions. Similarly, the SIN function is invoked in Structured Text statements. Both applications of SIN return a floating point result containing the sine of the Source. Depending on the context, this value may then be type converted if appropriate. Description The SIN instruction takes the sine of the Source value (in radians) and stores the result in the Destination. The SIN operator or function computes the sine of Source and returns the floating point result. The resulting value is always greater than or equal to -1 and less than or equal to 1. Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Publication 1756-RM003Z-EN-P - September 2024 719 Chapter 14 Trigonometric Instructions Dest = sine value of the Source. Postscan N/A Function Block Condition/State Action Taken Prescan N/A Tag.EnableIn is false. Set EnableOut to EnableIn. Tag.EnableIn is true Dest = sine value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = sine value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram Function Block Diagram 720 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions FBD Block FBD Function Structured Text REAL_dest := SIN(REAL_src); Tangent (TAN) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The TAN instruction takes the tangent of the Source value (in radians) and stores the result in the Destination. The TAN operator or function computes the tangent of Source and returns the floating point result. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 721 Chapter 14 Trigonometric Instructions FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use TAN as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, ControlLogix 5570, CompactLogix 5480, Compact GuardLogix ControlLogix 5580, 5370, and GuardLogix Compact GuardLogix 5570 controllers 5380, and GuardLogix Format Description 5580 controllers Source SINT SINT Immediate Value to convert to INT INT tag tangent. DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL 722 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Destination SINT SINT INT INT DINT DINT REAL LINT Trigonometric Instructions tag Tag to store result of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description TAN tag FBD_MATH_ADVANCED Structure TAN structure FBD_MATH_ADVANCED Structure Input Parameter Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Input to the trigonometric instruction. Output Parameter Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Operand Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to tangent. INT DINT LINT USINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 723 Chapter 14 Trigonometric Instructions UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL Operator Aspects The TAN operator can be used in various expressions. Similarly, the TAN function is invoked in Structured Text statements. Both applications of TAN return a floating point result containing the tangent of the Source. Depending on the context, this value may then be type converted if appropriate. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = tangent value of the Source. Postscan N/A Function Block Diagram FBD Block 724 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 14 Trigonometric Instructions Condition/State Action Taken Prescan N/A Tag.EnableIn is false Set EnableOut to EnableIn. Tag.EnableIn is true Dest = tangent value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Condition/State Action Taken Prescan N/A Normal Scan Dest = tangent value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram Function Block Diagram FBD Block Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 725 Chapter 14 Trigonometric Instructions FBD Function Structured Text REAL_dest := TAN(REAL_src); 726 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions The advanced math instructions include these instructions: Ladder Diagram and Function Block Natural Log (LN) on page 732 Log Base 10 (LOG) on page 727 X to the Power of Y (EXPT) on page 737 Log Base 10 (LOG) on page 727 X to the Power of Y (EXPT) on page 737 Structured Text Natural Log (LN) on page 732 If you want to: Use this instruction: Take the natural log of a value LN Take the log base 10 of a value LOG Raise a value to the power of another value EXPT Mixing data types can cause accuracy and rounding errors and cause the instruction to take longer to execute. Check the S:V bit to see whether the result was truncated. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. An advanced math instruction executes once each time the instruction is scanned as long as the rung-condition-in is true. If you want the instruction evaluated only once, use an ONS instruction to trigger the math instruction. Log Base 10 (LOG) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The Log Base 10 (LOG) instruction takes the log base 10 of the Source and stores the result in the Destination. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 727 Chapter 15 Advanced Math Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use LOG as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram 728 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source Advanced Math Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT Immediate Value for which the INT INT tag instruction finds the log. DINT DINT REAL LINT tag Tag to store the result USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description LOG FBD_MATH_ADVANCED tag LOG structure FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Value for which the instruction finds the log. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 729 Chapter 15 Advanced Math Instructions Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value of which to find the log of this value USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL Description The LOG instruction takes the log base 10 of the Source and stores the result in the Destination. The Source must be greater than zero or a minor fault will occur. Affects Math Status Flags Controllers Affects Math Status Flag CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers 730 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Controllers Affects Math Status Flag CompactLogix 5370, ControlLogix 5570, Yes Advanced Math Instructions Compact GuardLogix 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = value of log base 10 of the Source. Postscan N/A. Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false. Set EnableOut to EnableIn. EnableIn is true Dest = value of natural log of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Normal Scan Dest = value of log base 10 of the Source. Publication 1756-RM003Z-EN-P - September 2024 731 Chapter 15 Advanced Math Instructions Condition/State Action Taken Instruction first run N/A Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text result := LOG(value); Natural Log (LN) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers 732 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions The Natural Log (LN) instruction takes the natural log of the Source and stores the result in the Destination. The Source must be greater than zero or a minor fault will occur. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use LN as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: Rockwell Automation, Inc. • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. Publication 1756-RM003Z-EN-P - September 2024 733 Chapter 15 Advanced Math Instructions There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT Immediate Find the natural log of INT INT tag this value. DINT DINT REAL LINT tag Tag to store the result USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description LN FBD_MATH_ADVANCED tag LN structure FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. 734 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions Input Members Data Type Description Source REAL Value for which the instruction finds the natural log. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value of which to find the natural log of USINT this value. INT UINT DINT UDINT LINT ULINT REAL LREAL Data Type CompactLogix 5380, CompactLogix Output Operand (Right Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Dest REAL Result of the function. LREAL See FBD Functions on page 862. Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 735 Chapter 15 Advanced Math Instructions Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers See Math status flags on page 849. Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = value of natural log of the Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = value of natural log of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. 736 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions Condition/State Action Taken Prescan N/A Normal Scan Dest = value of natural log of the Source Instruction first run N/A Instruction first scan N/A Postscan N/A Examples Ladder Diagram Function Block FBD Function Structured Text result := LN(value); X to the Power of Y (EXPT) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 737 Chapter 15 Advanced Math Instructions Architecture Standard applications Safety applications CompactLogix 5380, CompactLogix 5480, Yes Yes ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The X to the Power of Y (EXPT) instruction takes Source A (X) to the power of Source B (Y) and stores the result in the Destination. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from XPY to EXPT. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. 738 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions Tip: Use ** as an operator in an expression to compute the same result. Refer to Structured Text Syntax for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Source A Data Type CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description value to exponentiate Compact GuardLogix 5380, and GuardLogix 5580 controllers SINT SINT immediate INT INT tag DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Source B SINT SINT immediate INT INT tag DINT DINT REAL LINT exponent USINT UINT UDINT ULINT REAL LREAL Dest Rockwell Automation, Inc. SINT SINT INT INT Publication 1756-RM003Z-EN-P - September 2024 tag Tag to store the result of the instruction. 739 Chapter 15 Advanced Math Instructions Data Type Data Type CompactLogix 5370, Operand ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Format Description Compact GuardLogix 5380, and GuardLogix 5580 controllers DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Data Type Format Description EXPT FBD_MATH tag EXPT structure FBD_MATH Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. SourceA REAL Value added to SourceB. SourceB REAL Value added to SourceA. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. FBD Function 740 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions Data Type CompactLogix 5380, CompactLogix Input Operands (Left Pin) 5480, ControlLogix 5580, Compact Description GuardLogix 5380, and GuardLogix 5580 controllers Source A (top) SINT Value to exponentiate USINT INT UINT DINT UDINT LINT ULINT REAL LREAL Source B (bottom) SINT exponent USINT INT UINT DINT UDINT LINT ULINT REAL LREAL CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact Output Operand (Right Pin) GuardLogix 5380, and GuardLogix 5580 Description controllers Data Type Dest DINT Result of the function. UDINT LINT ULINT REAL LREAL Description The XPY instruction takes Source A (X) to the power of Source B (Y) and stores the result in the Destination. If Source A (X) is negative, Source B (Y) must be a non-fractional value or a minor fault will occur. Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 741 Chapter 15 Advanced Math Instructions Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A. Rung-condition-in is false. Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true. Set Rung-condition-out to Rung-condition-in. Dest = value of Source X to the power of Source Y. Postscan N/A. Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = value of Source X to the power of Source Y. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A Examples 742 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 15 Advanced Math Instructions Ladder Diagram Function Block FBD Function Structured Text result := value_1 ** value_2; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 743 744 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions The math conversion instructions convert values. Available Instructions Ladder Diagram and Function Bock DEG on page 753 RAD on page 758 TO_BCD on page 745 BCD_TO on page 749 TRUNC on page 763 Structured Text DEG on page 753 RAD on page 758 TRUNC on page 763 If you want to Use this instruction Convert radians into degrees. DEG Convert degrees into radians. RAD Convert an integer value to a BCD value. TO_BCD Convert a BCD value to an integer value. BCD_TO Remove the fractional part of a value. TRUNC You can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to execute. Check the S:V bit to see whether the result was truncated. The bold data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL. A math conversion instruction executes once each time the instruction is scanned as long as the rung-condition-in is true. If you want the instruction evaluated only once, use an ONS instruction to trigger the conversion instruction. Convert to BCD (TO_BCD) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The TO_BCD instruction converts a decimal value (0 Source 99,999,999) to a BCD value and stores the result in the Destination. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from TOD to TO_BCD. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 745 Chapter 16 Math Conversion Instructions Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block Structured Text This instruction is not available in structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Format Description controllers 746 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Source Chapter 16 Math Conversion Instructions SINT SINT Immediate Value to convert to BCD INT INT tag 0 DINT DINT Source 99,999,999 LINT USINT UINT UDINT ULINT Destination SINT SINT INT INT DINT DINT tag Tag to store the result LINT USINT UINT UDINT ULINT Function Block Diagram FBD Block Operand Type Format Description TO_BCD tag FBD_CONVERT Structure TO_BCD structure FBD_CONVERT Structure Input Member Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. Default is set. Source DINT Input to the conversion instruction. Valid = any integer Output Member Data Type Description EnableOut BOOL Enable output. Dest DINT Result of the conversion instruction. Math status flags are set for this output. Description BCD is the Binary Coded Decimal number system that expresses individual decimal digits (0-9) in a 4-bit binary notation. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 747 Chapter 16 Math Conversion Instructions Source Destination Destination Type Negative source < 0 0 Source > 9,999, 999,999, 999,999 16#9999_9999_9999_9999 ULINT Source > 9,999, 999,999, 999,999 16#9999_9999_9999_9999 LINT Source > 99,999,999 16#9999_9999 UDINT Source > 99,999,999 16#9999_9999 DINT Source > 99,999,999 16#9999 UINT Source > 99,999,999 16#9999 INT Source > 99,999,999 16#99 USINT Source > 99,999,999 16#99 SINT Affects Math Status Flags Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math status flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults See Common Attributes for General Instructions on page 849 for operand related faults. A minor fault will occur if: Fault type Fault code feature is enabled and overflow detected 4 4 4 4 4 4 and Source < 0 feature is enabled and overflow detected and Source > 99,999,999 / 9,999, 999,999, 999,999 feature is enabled and overflow detected Execution Ladder Diagram Condition/State Action Taken Prescan N/A. Rung-condition-in is false N/A. Rung-condition-in is true The controller converts the Source to BCD and places the result in the Destination. Postscan N/A. Function Block Diagram 748 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions FBD Block Condition/State Action Taken Prescan N/A Tag.EnableIn is false. EnableOut is cleared to false Tag.EnableIn is true Dest = the result of computation in BCD value. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A Example Ladder Diagram Function Block Convert to Integer (BCD_TO) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 749 Chapter 16 Math Conversion Instructions Architecture Standard applications Safety applications CompactLogix 5380, CompactLogix 5480, Yes Yes ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers The BCD_TO instruction converts a BCD value (Source) to a decimal value and stores the result in the Destination. Tip: In Logix Designer version 36, the mnemonic for this instruction changed from FRD to BCD_TO. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports this element: FBD Block Structured Text This instruction is not available in structured text. IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram 750 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Math Conversion Instructions Format Description controllers Source SINT SINT Immediate value to convert to INT INT tag decimal DINT DINT tag tag to store the result LINT USINT UINT UDINT ULINT Destination SINT SINT INT INT DINT DINT LINT USINT UINT UDINT ULINT Function Block Diagram FBD Block Operand Type Format Description FRD tag FBD_CONVERT Structure FRD structure FBD_CONVERT Structure Input Parameter Data Type Description EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated. Default is set. Source DINT Input to the conversion instruction. Valid = any integer Rockwell Automation, Inc. Output Parameters Data Type Description EnableOut BOOL Enable output. Publication 1756-RM003Z-EN-P - September 2024 751 Chapter 16 Math Conversion Instructions Dest DINT Result of the conversion instruction. Description The BCD_TO instruction converts a BCD value (Source) to a decimal value and stores the result in the Destination. This formula is used for calculations when source is 32bits: 7 6 5 4 Destination =(16#Source8*10 )+ (16#Source7*10 )+ (16#Source6*10 )+( 16#Source5*10 )+ 3 2 1 0 (16#Source4*10 )+(16#Source3*10 )+ (16#Source2*10 )+( 16#Source1*10 ) For example: Source = 16#1234_567E 7 6 5 4 3 2 1 0 Destination = (1*10 )+(2*10 )+(3*10 )+ (4*10 )+(5*10 )+(6*10 )+(7*10 )+ (14*10 )=12345684 Affects Math Status Flags Major/Minor Faults Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math status flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = decimal value of source with BCD value. Postscan N/A Function Block Diagram FBD Block 752 Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 EnableIn is true Math Conversion Instructions Dest = decimal value of source with BCD value If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A Examples Ladder Diagram Function Block Degrees (DEG) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the DEG instruction converts the Source (in radians) to degrees and stores the result in the Destination. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 753 Chapter 16 Math Conversion Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: Function Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use DEG as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram 754 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Math Conversion Instructions Format Description controllers Source SINT SINT Immediate Value to convert to INT INT tag degrees DINT DINT REAL LINT tag Tag to store the result USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description DEG FBD_MATH_ADVANCED tag DEG structure FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operands (Left Pins) Rockwell Automation, Inc. Data Type Publication 1756-RM003Z-EN-P - September 2024 Description 755 Chapter 16 Math Conversion Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to degrees INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers Dest REAL Result of the function LREAL See FBD Functions on page 862. FBD_MATH_ADVANCED Structure Input Parameter Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is True. Source REAL Input to the conversion instruction. Output Parameter Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. Description The DEG instruction uses this algorithm: Source*180/pi = Source*57.29578 Affects Math Status Flags 756 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions Major/Minor Faults Controllers Affects Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math status flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = degree value of the Source. Postscan N/A Function Block Diagram Function Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = degree value of the Source. If overflow occurs Clear EnableOut to false else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Normal Scan Dest = DEG(Source) Instruction first run N/A Instruction first scan N/A Publication 1756-RM003Z-EN-P - September 2024 757 Chapter 16 Math Conversion Instructions Postscan N/A Examples Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text REAL_dest := DEG(REAL_src); Radian (RAD) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the RAD instruction converts the Source (in degrees) to radians and stores the result in the Destination. Available Languages 758 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use RAD as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 759 Chapter 16 Math Conversion Instructions Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Format Description controllers Source SINT SINT Immediate Value to convert to INT INT tag radians DINT DINT REAL LINT tag Tag to store the result USINT UINT UDINT ULINT REAL LREAL Destination SINT SINT INT INT DINT DINT REAL LINT USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description RAD FBD_MATH_ADVANCED tag RAD structure FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Input Operands (Left Pins) 760 Data Type Publication 1756-RM003Z-EN-P - September 2024 Description Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Source SINT Value to convert to radians INT DINT LINT USINT UINT UDINT ULINT REAL LREAL Output Operand (Right Pin) CompactLogix 5380, CompactLogix 5480, Description ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Data Type Dest REAL Result of the function. LREAL FBD_MATH_ADVANCED Structure Input Members Data Type Description EnableIn BOOL Enable input. If false, the instruction does not execute and outputs are not updated. Default is true. Source REAL Input to the conversion instruction. Output Members Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest REAL Result of the instruction. Description The RAD instruction uses this algorithm: Deg2RadConvFactor=pi/180= 0.017453292 Destination = Source * Deg2RadConvFactor Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 761 Chapter 16 Math Conversion Instructions Controllers Affected Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math Status Flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index Through Arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action taken Prescan N/A Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = radian value of the Source. Postscan N/A Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = radian value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function 762 Condition/State Action Taken Prescan N/A Normal Scan Dest = RAD(Source) Instruction first run N/A Instruction first scan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Postscan Math Conversion Instructions N/A Example Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text REAL_dest := RAD(REAL_src); Truncate (TRUNC) This table lists the controllers and applications that support this instruction. Architecture Standard applications Safety applications CompactLogix 5370, ControlLogix Yes No Yes Yes 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers When enabled, the TRUNC instruction removes (truncates) the fractional part of the Source and stores the result in the Destination. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 763 Chapter 16 Math Conversion Instructions Tip: In Logix Designer version 36, the mnemonic for this instruction changed from TRN to TRUNC. Available Languages Ladder Diagram Function Block Diagram Function Block Diagram supports these elements: FBD Block FBD Function Tip: FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only. Structured Text This instruction is not available in structured text. Tip: Use TRUNC as an operator in an expression to compute the same result. Refer to Structured Text Syntax on page 879 for more information on the syntax of expressions and assignments within structured text. Operands 764 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions IMPORTANT: Unexpected operation may occur if: • Output tag operands are overwritten. • Members of a structure operand are overwritten. • Except when specified, structure operands are shared by multiple instructions. There are data conversion rules for mixing numeric data types within an instruction. See Data conversions on page 851. Ladder Diagram Operand Data Type Data Type CompactLogix 5370, CompactLogix 5380, Co ControlLogix 5570, mpactLogix 5480, Contr Compact GuardLogix olLogix 5580, Compact 5370, and GuardLogix GuardLogix 5380, 5570 controllers and GuardLogix 5580 Format Description Value to truncate. controllers Source SINT REAL immediate INT LREAL tag SINT SINT tag INT INT DINT DINT REAL LINT DINT REAL Destination Tag to store the result of the instruction. USINT UINT UDINT ULINT REAL LREAL Function Block Diagram FBD Block Operand Type Format Description TRUNC FBD_TRUNCATE tag TRN structure FBD Function Input Operands (Left Pins) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 765 Chapter 16 Math Conversion Instructions Source REAL Value to truncate LREAL Output Operand (Right Pin) Data Type Description CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers Dest LINT Result of the function. Input Member Data Type Description EnableIn BOOL Enable input. If false, the instruction does See FBD Functions on page 862. FBD_TRUNCATE Structure not execute and outputs are not updated. Default is true. Source REAL Input to the conversion instruction. Input also takes SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT and LREAL through input tag. But the integer type will be converted to REAL type first. Converting SINT or INT or USINT or UINT to REAL, there is no data precision lost. Converting 32-bit types (DINT, UDINT) to REAL, data precision could be lost. Both data types store data in 32 bits, but the REAL type uses some of its 32 bits to store the exponent value. If precision is lost, the controller takes it from the least-significant portion of the 32 bit types (DINT, UDINT). Converting 64 bit types (LINT, ULINT and LREAL) to REAL, data precision could be lost. Output Member Data Type Description EnableOut BOOL Indicates if the instruction executed without fault when it was enabled. Dest DINT Result of the instruction. Description 766 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 16 Math Conversion Instructions Truncating does not round the value; rather, the non-fractional part remains the same, regardless of the value of the fractional part. Affects Math Status Flags Controllers Affected Math Status Flags CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Conditional, see Math status flags on page 849. Compact GuardLogix 5380, and GuardLogix 5580 controllers CompactLogix 5370, ControlLogix 5570, Compact GuardLogix Yes 5370, and GuardLogix 5570 controllers Major/Minor Faults None specific to this instruction. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A. Rung-condition-in is false Set Rung-condition-out to Rung-condition-in. Rung-condition-in is true Set Rung-condition-out to Rung-condition-in. Dest = Truncated value of the Source. Postscan N/A. Function Block Diagram FBD Block Condition/State Action Taken Prescan N/A EnableIn is false Set EnableOut to EnableIn. EnableIn is true Dest = Truncated value of the Source. If overflow occurs Clear EnableOut to false. else Set EnableOut to true. Instruction first scan N/A Instruction first run N/A Postscan N/A FBD Function Rockwell Automation, Inc. Condition/State Action Taken Prescan N/A Publication 1756-RM003Z-EN-P - September 2024 767 Chapter 16 Math Conversion Instructions Normal Scan Dest = Truncated value of the Source. Instruction first run N/A Instruction first scan N/A Postscan N/A Example Ladder Diagram Function Block Diagram FBD Block FBD Function Structured Text REAL_dest := TRUNC(REAL_src); 768 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions Use the ASCII serial port instructions to read and write ASCII characters. IMPORTANT: The ASCII serial port instructions are included in Logix Designer versions 36 and earlier. They are not included in versions 37 and later. IMPORTANT: To use the ASCII serial port instructions, you must configure the serial port of the controller. Refer to the Logix 5000 Controller Common Procedures manual (publication 1756-PM001) for more information. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for projects using controllers that do not have serial ports. Available Instructions Ladder Diagram and Structured Text ASCII Test for ASCII Chars in ASCII Clear ASCII ASCII Read Buffer Line Buffer (ACB) Buffer (ACL) Handshake (ARD) on page Line (ARL) on (ABL) on page on page 771 on page 774 Lines (AHL) on 781 790 ASCII Read page 785 ASCII Write ASCII Write Append (AWA) (AWT) on page on page 798 793 page 776 Function Block Not available If you want to: Use this instruction: Check for data that contains termination characters ABL Check for the required number of characters before reading the ACB buffer Clear the buffer. For example, remove old data from the buffer ACL at start-up, or synchronize the buffer with a device. Clear out ASCII serial port instructions that are currently executing or are in the queue. Obtain the status of the serial port control lines. For example, AHL cause a modem to hang up. Turn the DTR signal on or off Turn the RTS signal on or off Read a fixed number of characters. For example, read data from ARD a device that sends the same number of characters with every transmission) Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 769 Chapter 17 ASCII Serial Port Instructions Read a varying number of characters, up to and including the ARL first set of termination characters. For example, read data from a device that sends a varying number of characters with every transmission. Send characters and automatically append one or two AWA additional characters to mark the end of the data. For example, send messages that always use the same termination character(s). Send characters. For example, send messages that use a variety AWT of termination characters. ASCII serial port instructions execute asynchronous to the scan of the logic: Each ASCII instruction, except for the ACL instruction, uses a SERIAL_PORT_CONTROL structure. The SerialPort Control operand: • controls the execution of the instruction • provides status information about the instruction ASCII instructions execute asynchronous to the scan of the logic: 770 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions The bits of the SerialPort Control operand provide status information: ASCII Chars in Buffer (ACB) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Chars in Buffer (ACB) instruction counts the characters in the buffer. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 771 Chapter 17 ASCII Serial Port Instructions ACB(Channel,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate tag 0 SerialPort Control SERIAL_PORT_CONTROL tag tag that controls the operation Character Count DINT immediate 0 During execution, displays the number of characters in the buffer, including the first set of termination characters. Structured Text Operand Type Format Description Channel DINT immediate tag 0 SerialPort Control SERIAL_PORT_CONTROL tag tag that controls the operation Character Count DINT immediate 0 During execution, displays the number of characters in the buffer, including the first set of termination characters. You can specify the Character Count value by accessing the .POS member of the SERIAL_PORT_CONTROL structure, rather than by including the value in the operand list. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue indicates the instruction entered the ASCII queue. .DN BOOL The done bit indicates when the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. 772 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 .EM BOOL ASCII Serial Port Instructions The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). .FD BOOL The found bit indicates the instruction found a character. .POS DINT The position determines the number of characters in the buffer, up to and including the first set of termination characters. .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description The ACB instruction counts the characters in the buffer. To program the ACB instruction, follow these guidelines: • Configure the serial port of the controller for User mode. This is a transitional instruction: • In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute. • In structured text, condition the instruction so that it only executes on a transition Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes when EnableIn toggles from cleared to set. Postscan N/A Structured Text Condition Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 Structured Text Action 773 Chapter 17 ASCII Serial Port Instructions Prescan N/A Normal execution The instruction executes when EnableIn toggles from cleared to set. Postscan N/A Example Ladder Diagram Structured Text ACB(0,bar_code_count); ASCII Clear Buffer (ACL) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Clear Buffer (ACL) instruction immediately clears the buffer and ASCII queue. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text ACL(Channel,ClearSerialPortRead,ClearSerialPortWrite); Operands Ladder Diagram 774 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions Operand Type Format Description Channel DINT immediate 0 tag Clear Serial Port Read BOOL immediate tag To empty the buffer and remove ARD and ARL instructions from the queue, enter 1. Clear Serial Port Write BOOL immediate tag To remove AWA and AWT instructions from the queue, enter 1. Structured Text Operand Type Format Description Channel DINT immediate 0 tag Clear Serial Port Read BOOL immediate tag To empty the buffer and remove ARD and ARL instructions from the queue, enter 1. Clear Serial Port Write BOOL immediate tag To remove AWA and AWT instructions from the queue, enter 1. See Structured Text Syntax for more information on the syntax of expressions within structured text. Description The ACL instruction immediately performs one or both of the following actions: • Clears the buffer or characters and clears the ASCII queue of read instructions • Clears the ASCII queue of write instructions To program the ACL instructions, follow these guidelines: Configure the serial port of the controller: If your application: Then: Uses ARD or ARL instruction Select User mode Does not use ARD or ARL instructions Select either System or User mode To determine if an instruction was removed from the queue or cancelled, examine the following of the appropriate instruction: • .ER bit is set • .ERROR member is 16#E Affects Math Status Flags Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 775 Chapter 17 ASCII Serial Port Instructions No Fault Conditions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction clears the specified instruction and buffer(s) Postscan N/A Example Ladder Diagram Structured Text IF (osri_1.OutputBit THEN ACL(0,0,1); END_IF; ASCII Handshake Lines (AHL) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Handshake Lines (AHL) instruction obtains the status of control lines and turns on or off the DTR and RTS signals. 776 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text AHL(Channel,ANDMask,ORMask,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate tag 0 ANDMask DINT immediate tag Refer to the Description ORMask DINT immediate tag SerialPort Control SERIAL_PORT_CONTROL tag Tag that controls the operation Channel Status DINT immediate 0 (Decimal) During execution, displays the status of the control lines. For the status of this Examine this bit: control line: CTS 0 RTS 1 DSR 2 DCD 3 DTR 4 Received the XOFF 5 character Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 777 Chapter 17 ASCII Serial Port Instructions Structured Text Operand Type Format Description Channel DINT immediate tag 0 ANDMask DINT immediate tag Refer to the Description ORMask DINT immediate tag SerialPort Control SERIAL_PORT_CONTROL tag Tag that controls the operation Channel Status DINT immediate 0 During execution, displays the status of the control (Decimal) lines. For the status of this Examine this bit: control line: CTS 0 RTS 1 DSR 2 DCD 3 DTR 4 Received the XOFF 5 character You can specify the Channel Status value by accessing the .POS member of the SERIAL_PORT_CONTROL structure, rather than by including the value in the operand list. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue bit indicates the instruction enter the ASCII queue. .DN BOOL The done bit indicates the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. .EM BOOL The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). 778 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 .FD BOOL ASCII Serial Port Instructions The found bit does not apply to this instruction. .POS DINT The position determines the number of characters in the buffer, up to and including the first set of termination characters. .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description The AHL instruction can: • Obtain the status of the control lines of the serial port • Turn the Data Terminal Ready (DTR) signal on or off • Turn the Request to Send (RTS) signal on or off To program the AHL instruction, follow these guidelines: Configure the serial port of the controller: If your application: Then: Uses ARD or ARL instruction Select User mode Does not use ARD or ARL instructions Select either System or User mode Use the following table to select the correct values for the ANDMask and ORMask operands: To turn DTR: Off And turn RTS: Off On Off Unchanged Off Enter this And enter this ANDMask value: ORMask value: 3 0 on 1 unchanged 1 2 1 on 0 unchanged 0 2 0 on 0 unchanged 0 This is a transitional instruction: • In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute. • In structured text, condition the instruction so that it only executes on a transition Affects Math Status Flags No Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 779 Chapter 17 ASCII Serial Port Instructions Fault Conditions Type Code Cause Recovery Method 4 57 The AHL instruction failed to Change the Control Line execute because the serial setting of the serial port port is set to no handshaking or Delete the AHL instruction Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes when rung condition in toggles from cleared to set. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction executes when rung condition in toggles from cleared to set. Postscan N/A Example Ladder Diagram Structured Text osri_1.InputBit := get_control_line_status; OSRI(osri_1); IF (osri_1.OutputBit) THEN AHL(0,0,0,serial_port); 780 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions END_IF; ASCII Read (ARD) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Read (ARD) instruction removes characters from the buffer and stores them in the Destination. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text ARD(Channel,Destination,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate 0 Notes tag Destination String type tag SINT INT DINT tag into which the If you want to compare, characters are moved convert, or manipulate (i.e., read): the characters, enter a For a string type, enter string type tag. the name of the tag. String types are: For a SINT, INT, or DINT default STRING data array, enter the first type element of the array. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 781 Chapter 17 ASCII Serial Port Instructions any new string type you create Serial Port Control SERIAL_PORT_CONTROL tag tag that controls the operation Serial Port Control DINT immediate Length number of characters to The Serial Port Control move to the destination Length must be less (read) than or equal to the size of the Destination. If you want to set the Serial Port Control Length equal to the size of the Destination, enter 0. Characters Read DINT immediate 0 During execution, displays the number of characters in the buffer, including the first set of termination characters. Structured Text Operand Type Format Description Channel DINT immediate 0 Notes tag Destination String type tag SINT INT DINT tag into which the If you want to compare, characters are moved convert, or manipulate (i.e., read): the characters, enter a For a string type, enter string type tag. the name of the tag. String types are: For a SINT, INT, or DINT default STRING data array, enter the first type element of the array. any new string type you create Serial Port Control SERIAL_PORT_CONTROL tag tag that controls the operation Serial Port Control DINT immediate Length number of characters to The Serial Port Control move to the destination Length must be less (read) than or equal to the size of the Destination. If you want to set the Serial Port Control Length equal to the size of the Destination, enter 0. 782 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 Characters Read DINT immediate ASCII Serial Port Instructions 0 During execution, displays the number of characters in the buffer, including the first set of termination characters. You can specify the Serial Port Control Length and the Characters Read values by accessing the .LEN and .POS members of the SERIAL_PORT_CONTROL structure, rather than by including the values in the operand list. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue bit indicates the instruction entered the ASCII queue. .DN BOOL The done bit indicates the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. .EM BOOL The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). .FD BOOL The found bit does not apply to this instruction. .LEN DINT The length indicates the number of characters to move to the destination (i.e., read). .POS DINT The position displays the number of characters that were read. .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description The ARD instruction removes the specified number of characters from the buffer and stores them in the Destination. • The ARD instruction continues to execute until it removes the specified number of characters (Serial Port Control Length operand). • Rockwell Automation, Inc. While the ARD instruction is executing, no other ASCII serial port instruction executes. Publication 1756-RM003Z-EN-P - September 2024 783 Chapter 17 ASCII Serial Port Instructions To program the ARD instruction, follow these guidelines: 1. Configure the serial port of the controller for User mode. 2. Use the result of an ACB instruction to trigger the ARD instruction. This prevents the ARD instruction from holding up the queue while it waits for the required number of characters. Refer to the ARD example below for more information. 3. This is a transitional instruction: In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute. In structured text, condition the instruction so that it only executes on a transition 4. To trigger a subsequent action when the instruction is done, examine the .EM bit. Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Examples Ladder Diagram Structured Text 784 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions ACB(o,bar_code_count); IF bar_code_count.POS >= 24 THEN bar_code_read.LEN := 24; ARD(0,bag_bar_code,bar_code_read); END_IF; ASCII Read Line (ARL) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Read Line (ARL) instruction removes characters from the buffer and stores them in the Destination. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text ARL(Channel,Destination,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate 0 Notes tag Destination String type tag SINT Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 tag into which the If you want to compare, characters are moved convert, or manipulate (i.e., read) 785 Chapter 17 ASCII Serial Port Instructions INT DINT For a string type, enter the characters, enter a the name of the tag. string type tag. For a SINT, INT, or DINT String types are: array, enter the first default STRING data element of the array. type any new string type you create SerialPort Control SERIAL_PORT_CONTROL tag tag that controls the operation Serial Port Control DINT immediate Length maximum number of Enter the maximum characters to read if no number of characters termination characters that any message will are found. contain (i.e., when to stop reading if no termination characters are found). For example, if messages range from 3 to 6 characters in length, enter 6. The Serial Port Control Length must be less than or equal to the size of the Destination. If you want to set the Serial Port Control Length equal to the size of the Destination, enter 0. Characters Read DINT immediate 0 During execution, displays the number of characters that were read Structured Text Operand Type Format Description Channel DINT immediate 0 Notes tag Destination String type tag SINT INT DINT 786 Publication 1756-RM003Z-EN-P - September 2024 tag into which the If you want to compare, characters are moved convert, or manipulate (i.e., read) the characters, enter a For a string type, enter string type tag. the name of the tag. String types are: Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions For a SINT, INT, or DINT default STRING data array, enter the first type element of the array. any new string type you create SerialPort Control SERIAL_PORT_CONTROL tag tag that controls the operation Serial Port Control DINT immediate Length maximum number of Enter the maximum characters to read if no number of characters termination characters that any message will are found. contain (i.e., when to stop reading if no termination characters are found). For example, if messages range from 3 to 6 characters in length, enter 6. The Serial Port Control Length must be less than or equal to the size of the Destination. If you want to set the Serial Port Control Length equal to the size of the Destination, enter 0. Characters Read DINT immediate 0 During execution, displays the number of characters that were read However, you specify the Serial Port Control Length and the Characters Read values by accessing the .LEN and .POS members of the SERIAL_PORT_CONTROL structure, rather than by including the values in the operand list. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue bit indicates the instruction entered the ASCII queue. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 787 Chapter 17 ASCII Serial Port Instructions .DN BOOL The done bit indicates the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. .EM BOOL The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). .FD BOOL The found bit does not apply to this instruction. .LEN DINT The length indicates the maximum number of characters to move to the destination (i.e., when to stop reading if no termination characters are found). .POS DINT The position displays the number of characters that were read. .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description The ARL instruction removes characters from the buffer and stores them in the Destination, as follows: • The ARL instruction continues to execute until it removes either the: ◦ First set of termination characters ◦ Secified number of characters (String Length operand) While the ARL instruction is executing, no other ASCII instruction executes. To program the ARL instruction, follow these guidelines: 1. Configure the serial port of the controller for User mode and define the characters that serve as the termination characters. 2. Use the results of an ABL instruction to trigger the ARL instruction. This prevents the ARL instruction from holding up the queue while it waits for the termination characters. Refer to the ARL example below for more information. 3. This is a transitional instruction: In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute.In structured text, condition the instruction so that it only executes on a transition 4. To trigger a subsequent action when the instruction is done, examine the .EM bit. Affects Math Status Flags No Fault Conditions 788 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Example Continuously tests the buffer for a message from the MessageView terminal. Since each message ends in a carriage return ($r), the carriage return is configured as the termination character on the User Protocol tab of the Controller Properties dialog. When the ABL finds a carriage return, it sets the .FD bit. When the ABL instruction finds the carriage return (MV_line.FD is set), the controller has received a complete message. The ARL instruction removes the characters from the buffer, up to and including the carriage return, and places them in the DATA member of the MV_msg tag, which is a string type. Ladder Diagram Structured Text ABL(0,MV_line); osri_1.InputBit :=MVLine.FD OSRI(osri_1); IF osri_1.OutputBit) THEN Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 789 Chapter 17 ASCII Serial Port Instructions mv_read.LEN := 12; ARL(0,MV_msg,MV_read); END_IF; ASCII Test for Buffer Line (ABL) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Test for Buffer Line (ABL) instruction counts the characters in the buffer up to and including the first termination character. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text ABL(Channel,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate 0 SerialPort Control SERIAL_PORT_CONTROL tag tag that controls the operation Character Count DINT immediate 0 During execution, displays the number of characters in the buffer, including the first set of termination characters. Structured Text 790 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions Operand Type Format Description Channel DINT immediate 0 SerialPort Control SERIAL_PORT_CONTROL tag tag that controls the operation Character Count DINT immediate 0 During execution, displays the number of characters in the buffer, including the first set of termination characters. You access the Character Count value via the .POS member of the SERIAL_PORT_CONTROL structure. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue bit indicates the instruction entered the ASCII queue. .DN BOOL The done bit indicates when the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. .EM BOOL The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). .FD BOOL The found bit indicates the instruction found the termination character(s). .POS DINT The position determines the number of characters in the buffer, up to and including the first set of termination characters. The instruction only returns this number after it finds the termination character(s). .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 791 Chapter 17 ASCII Serial Port Instructions The ABL instruction searches the buffer for the first set of termination characters. If the instruction finds the termination characters, it: • sets the .FD bit • counts the characters in the buffer up to and including the first set of termination characters The User Protocol tab of the Controller Properties dialog box defines the ASCII characters that the instruction considers as the termination characters. To program the ABL instruction, follow these guidelines: • Configure the serial port of the controller for User mode and define the characters that serve as the termination characters. This is a transitional instruction: • In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute. • In structured text, condition the instruction so that it only executes on a transition Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Example 792 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions Ladder Diagram Structured Text ABL(0,MV_line); ASCII Write (AWT) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Write (AWT) instruction sends characters of the Source array to a serial device. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text AWT(Channel,Source,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate 0 Notes tag Source Rockwell Automation, Inc. String type tag Publication 1756-RM003Z-EN-P - September 2024 Tag that contains the If you want to compare, characters to send convert, or manipulate 793 Chapter 17 ASCII Serial Port Instructions SINT INT DINT For a string type, enter the characters, enter a the name of the tag. string type tag. For a SINT, INT, or DINT String types are: array, enter the first default STRING data element of the array. type any new string type you create Serial Port Control SERIAL_PORT_CONTROL tag Tag that controls the operation Serial Port Control DINT immediate Length Number of characters The Serial Port Control to send Length must be less than or equal to the size of the Source. If you want to set the Serial Port Control Length equal to the number of characters in the Source, enter 0. Characters Sent DINT immediate 0 During execution, displays the number of characters that were sent Structured Text Operand Type Format Description Channel DINT immediate 0 Notes tag Source String type tag SINT INT DINT Tag that contains the If you want to compare, characters to send convert, or manipulate For a string type, enter the characters, enter a the name of the tag. string type tag. For a SINT, INT, or DINT String types are: array, enter the first default STRING data element of the array. type any new string type you create Serial Port Control SERIAL_PORT_CONTROL tag Tag that controls the operation Serial Port Control DINT immediate Length Number of characters The Serial Port Control to send Length must be less than or equal to the size of the Source. 794 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions If you want to set the Serial Port Control Length equal to the number of characters in the Source, enter 0. Characters Sent DINT immediate 0 During execution, displays the number of characters that were sent You can specify the Serial Port Control Length and the Characters Sent values by accessing the .LEN and .POS members of the SERIAL_PORT_CONTROL structure, rather than by including the values in the operand list. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue bit indicates the instruction entered the ASCII queue. .DN BOOL The done bit indicates the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. .EM BOOL The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). .FD BOOL The found bit does not apply to this instruction. .LEN DINT The length indicates the number of characters to send. .POS DINT The position displays the number of characters that were sent. .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description The AWT instruction sends the specified number of characters (i.e., serial port control length) of the Source tag to the device that is connected to the serial port of the controller. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 795 Chapter 17 ASCII Serial Port Instructions To program the AWT instruction, follow these guidelines: 1. 2. Configure the serial port of the controller: If your application: Then: Uses ARD or ARL instruction Select User mode Does not use ARD or ARL instructions Select System or User mode This is a transitional instruction: In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute. In structured text, condition the instruction so that it only executes on a transition 3. Each time the instruction executes, do you always send the same number of characters? If: Then: Yes In the Serial Port Control Length, enter the number of characters to send. No Before the instruction executes, move the LEN member of the Source tag to the LEN member of the Serial Port Control tag. Refer to example 2 below. Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Examples 796 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions Example 1 When the temperature reaches the low limit (i.e., temp_low is on), the AWT instruction sends a message to the MessageView terminal that is connected to the serial port of the controller. The message nine characters from the DATA member of the string[2] tag, which is a string type. (The $14 counts as one character; it is a hex code for the Ctrl-T character.) The last character is a carriage return ($r), which marks the end of the message. Ladder Diagram Structured Text osri_1.InputBit := temp_low; OSRI(osri_1); IF (osri_1.OutputBit) THEN temp_low_write.LEN := 9; AWT(0.string[2],temp_low_write); END_IF; Example 2 When MV_update is on, the AWT instruction sends the characters in MV_msg. Because the number of characters in MV_msg varies, the rung first moves the length of the string (MV_msg.LEN) to the Serial Port Control Length of the AWT instruction (MV_write.LEN). (In MV_msg, the $16 counts as one character; it is the hex code for the Ctrl-V character.) Ladder Diagram Structured Text osri_1.InputBit := MV_update; OSRI(osri_1); IF (osri_1.OutputBit) THEN Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 797 Chapter 17 ASCII Serial Port Instructions MV_write.LEN := Mv_msg.LEN; AWT(0.MV_msg,MV_write); END_IF; ASCII Write Append (AWA) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. The ASCII Write Append (AWA) instruction sends characters of the Source array to a serial device and appends either one or two predefined characters. Tip: ASCII Serial Port instructions (AWT, AWA, ARD, ARL, ABL, ACB, AHL, ACL) are not available for controllers that do not have serial ports. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text AWA(Channel,Source,SerialPortControl); Operands Ladder Diagram Operand Type Format Description Channel DINT immediate 0 Notes tag Source String type tag SINT INT tag that contains the If you want to compare, characters to send convert, or manipulate For a string type, enter the characters, enter a the name of the tag string type tag. String types are: 798 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 DINT ASCII Serial Port Instructions For a SINT, INT, or DINT default STRING data array, enter the first type element of the array. any new string type you create Serial Port Control SERIAL_PORT_CONTROL tag tag that controls the operation Serial Port Control DINT immediate Length number of characters The Serial Port Control to send Length must be less than or equal to the size of the Source. If you want to set the Serial Port Control Length equal to the number of characters in the Source, enter 0. Characters Sent DINT immediate 0 During execution, displays the number of characters that were sent. Structured Text Operand Type Format Description Channel DINT immediate 0 Notes tag Source String type tag SINT INT DINT tag that contains the If you want to compare, characters to send convert, or manipulate For a string type, enter the characters, enter a the name of the tag string type tag. For a SINT, INT, or DINT String types are: array, enter the first default STRING data element of the array. type any new string type you create Serial Port Control SERIAL_PORT_CONTROL tag tag that controls the operation Serial Port Control DINT immediate Length number of characters The Serial Port Control to send Length must be less than or equal to the size of the Source. If you want to set the Serial Port Control Length equal to the Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 799 Chapter 17 ASCII Serial Port Instructions number of characters in the Source, enter 0. Characters Sent DINT immediate 0 During execution, displays the number of characters that were sent. You can specify the Serial Port Control Length and the Characters Sent values by accessing the .LEN and .POS members of the SERIAL_PORT_CONTROL structure, rather than by including the values in the operand list. See Structured Text Syntax for more information on the syntax of expressions within structured text. SERIAL_PORT_CONTROL Structure Mnemonic Data Type Description .EN BOOL The enable bit indicates the instruction is enabled. .EU BOOL The queue bit indicates the instruction entered the ASCII queue. .DN BOOL The done bit indicates the instruction is done, but it is asynchronous to the logic scan. .RN BOOL The run bit indicates the instruction is executing. .EM BOOL The empty bit indicates the instruction is done, but it is synchronous to the logic scan. .ER BOOL The error bit indicates when the instruction fails (errors). .FD BOOL The found bit does not apply to this instruction. .LEN DINT The length indicates the number of characters to send. .POS DINT The position displays the number of characters that were sent. .ERROR DINT The error contains a hexadecimal value that identifies the cause of an error. Description The AWA instruction: • Sends the specified number of characters (i.e., serial port control length) of the Source tag to the device that is connected to the serial port of the controller • Adds to the end of the characters (i.e., appends) either one or two characters that are defined on the User Protocol tab of the Controller Properties dialog. 800 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions To program the AWA instruction, follow these guidelines: 1. 2. Configure the serial port of the controller: If your application: Then: Uses ARD or ARL instruction Select User mode Does not use ARD or ARL instructions Select either System or User mode This is a transitional instruction: In ladder diagram, toggle the EnableIn from cleared to set each time the instruction should execute. In structured text, condition the instruction so that it only executes on a transition 3. Each time the instruction executes, do you always send the same number of characters? If: Then: Yes In the Serial Port Control Length, enter the number of characters to send. No Before the instruction executes, move the LEN member of the Source tag to the LEN member of the Serial Port Control tag. (Refer to example 2 below.) Affects Math Status Flags No Fault Conditions None specific to this instruction. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Structured Text Condition Structured Text Action Prescan N/A Normal execution The instruction executes. EnableIn toggles from cleared to set. Postscan N/A Examples Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 801 Chapter 17 ASCII Serial Port Instructions Example 1 When the temperature exceeds the high limit (temp_high is on), the AWA instruction sends a message to the MessageView terminal that is connected to the serial port of the controller. The message contains five characters from the DATA member of the string[1] tag, which is a string type. (The $14 counts as one character; it is a hex code for the Ctrl-T character.) The instruction also sends (appends) the characters defined in the controller properties. In this example, the AWA instruction sends a carriage return ($0D), which marks the end of the message. Ladder Diagram Structured Text IF temp_high THEN temp_high_write.LEN := 5; AWA(o,string[1],temp_high_write); temp_high := 0; END_IF; Example 2 When alarms is on, the AWA instruction sends the specified number of characters in alarm_msg and appends a termination character(s). Because the number of characters in alarm_msg varies, the rung first moves the length of the string (alarm_msg.LEN) to the Serial Port Control Length of the AWA instruction (alarm_write.LEN). In alarm_msg, the $14 counts as one character; it is the hex code for the Ctrl-T character. Ladder Diagram Structured Text 802 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 ASCII Serial Port Instructions osri_1.InputBit := alarm; OSRI(osri_1); IF(osri_1.OutputBit) THEN alarm_write.LEN := alarm_msg.LEN; AWA(0,alarm_msg,alarm_write); END_IF; String Types Store ASCII characters in tags that use a string type data type to: • Use the default STRING data type, which stores up to 82 characters • Create a new string type that stores less or more characters To create a new string type, refer to the Logix 5000 Controllers ASCII Strings Programming Manual publication 1756PM013. Each string type contains the following members: Name Data Type Description Notes LEN DINT number of characters in the The LEN automatically updates string to the new count of characters whenever using: • The String Browser to enter characters • Instructions that read, convert, or manipulate a string The LEN shows the length of the current string. The DATA member may contain additional, old characters, which are not included in the LEN count. DATA SINT array ASCII characters of the string To access the characters of the string, address the name of the tag. For example, to access the characters of the string_1 tag, enter string_1. Each element of the DATA array contains one character. Create new string types that store less or more characters. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 803 Chapter 17 ASCII Serial Port Instructions ASCII Error Codes If an ASCII serial port instruction fails to execute, the ERROR member of its SERIAL_PORT_CONTROL structure will contain one of the following hexadecimal error codes: Hex Indicates: code 16#2 The modem went offline. 16#3 The CTS signal was lost during communication. 16#4 The serial port was in System mode. 16#5 Instructions could not be sent or received because the channel configuration has been shutdown via the channel configuration menu. 16#6 Bad Parameters were passed to the ASCII driver. 16#7 Instructions could not be sent or received because the channel configuration has been shut down via the channel configuration menu. 16#8 Transmission already in progress. This will cause the instruction in progress to error. 16#9 The ASCII Communication requested is not supported by the current channel configuration. 16#10 Attempted to execute an AHL instruction while the Channel was in System Mode. 16#A Before the instruction executed, the UL bit was set. This stops the execution of the instruction. 16#B The Port this instruction was requested to operate on does not exist. 16#C The controller changed from Run mode to Program mode. This stops the execution of an ASCII serial port instruction and clears the queue. 16#D On the User Protocol tab of the Controller Properties dialog, the buffer size or echo mode parameters were changed and applied. This stops the execution of an ASCII serial port instruction and clears the queue. 16#E The ACL instruction executed and stopped or removed this type of instruction. 16#F The serial port configuration changed from User mode to System mode. This stops the execution of an ASCII serial port instruction and clears the queue. 804 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 17 16#51 ASCII Serial Port Instructions The LEN value of the string tag is either negative or greater than the DATA size of the string tag. 16#54 The Serial Port Control length is greater than the size of the buffer. 16#55 The Serial Port Control length is either negative or greater than the size of the Source or Destination. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 805 806 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 ASCII String Instructions Use the ASCII string instructions to modify and create strings of ASCII characters. Available Instructions Ladder Diagram and Structured Text FIND on page 808 INSERT on page 810 MID on page 812 CONCAT on page 815 DELETE on page 819 Function Block Not available If you want to: Use this instruction: Add termination characters or delimiters to a string CONCAT Delete characters from a string (e.g., remove header or control DELETE characters from a string) Determine the starting character of a sub-string FIND Insert characters into a string INSERT Extract characters from a string MID You can also use the following instructions to compare or convert ASCII characters: If you want to: Use this instruction: Compare a string to another string CMP See if the characters are equal to specific characters EQ See if the characters are not equal to specific characters NE See if the characters are equal to or greater than specific GE characters See if the characters are greater than specific characters GT See if the characters are equal to or less than specific LE characters See if the characters are less than specific characters LT Rearrange the bytes of an INT, DINT, or REAL tag SWPB Find a string in an array of strings FSC Convert characters to a SINT, INT, DINT, or REAL value STOD Convert characters to a REAL value STOR Convert a SINT, INT, DINT, or REAL value to a string of ASCII DTOS characters Convert a REAL value to a string of ASCII characters Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 RTOS 807 Chapter 18 ASCII String Instructions Find String (FIND) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The FIND instruction locates the starting position of a specified string within another string. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text FIND (Source,Search,Start,Result); Operands There are data conversion rules for mixed data types within an instruction. See Data conversions on page 851. Ladder Diagram and Structured Text Operand Type Format Description Notes Source ANY_STRING Tag The string to search in String types are: Search ANY_STRING Tag The string to find default STRING data type with max 82 length of characters for the string. any new string type you created with configurable length of characters for the string. Start SINT Immediate INT tag The position in Source Enter a number between to start the search 1 and the DATA size of the Source. DINT 808 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 Operand Type Format Description Result DINT Tag The position in Source ASCII String Instructions Notes where search string SINT was found INT See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text.DescriptionThe FIND instruction searches the Source string for the Search string. If the instruction finds the Search string, the Result shows the starting position of the Search string within the Source string. Otherwise the Results is zero.Affects Math Status FlagsNoMajor/Minor Faults A minor fault will occur if: Fault Type Fault Code The LEN value of the string tag is greater 4 51 4 56 than the DATA size of the string tag. The Start value is invalid, or the Source string is empty. None specific to this instruction. See Common Attributes for General Instructions on page 849 for operand related faults. Execution Ladder Diagram Condition Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Prescan See Prescan in the Ladder Diagram table Normal execution See Rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table Example A message from a MessageView terminal contains several pieces of information. The backslash character (\) separates each piece of information. To locate a piece of information, the FIND instruction searches for the backslash character and records its position in find_pos. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 809 Chapter 18 ASCII String Instructions Ladder Diagram Structured Text IF MV_read.EM THEN FIND(MV_msg,find,1,find_pos); MV_read.EM := 0; END_IF; Insert String (INSERT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. Use the INSERT instruction to add ASCII characters to a specified location within a string. Available Languages Ladder Diagram Function Block Structured Text INSERT (SourceA,SourceB,Start,Dest); Operands There are data conversion rules for mixed data types within an instruction. See Data conversions on page 851. The INSERT instruction uses the following operands. 810 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 ASCII String Instructions Ladder Diagram and Structured Text Operand Type Format Description Notes Source A String type Tag String to add the String types are default characters to STRING data types or String containing the any new string types characters to add you create Position in Source A to Enter a number between add the characters 1 and the DATA size of Source B Start String type SINT Tag Immediate tag DINT the Source. Destination String type Tag String to store the result See Structured Text Syntax for more information on the syntax of expressions within structured text. Description The INSERT instruction adds the characters in Source B to a designated position within Source A and places the result in the Destination. • Start defines where in Source A that Source B is added. • Unless Source A and the Destination are the same tag, Source A remains unchanged. Affects Math Status Flags No Major/Minor Faults Type Code Cause Recovery Method 4 51 The LEN value of the string tag 1. Check that no instruction is greater than the DATA size is writing to the LEN of the string tag. member of the string type tag. 2. In the LEN value, enter the number of characters that the string contains. 4 56 The Start or Quantity value is Check that the Start value is invalid. between 1 and the DATA size of the Source. Execution Ladder Diagram Rockwell Automation, Inc. Condition Ladder Diagram Action Prescan The rung-condition-out is set to false. Rung-condition-in is false The rung-condition-out is set to false. Publication 1756-RM003Z-EN-P - September 2024 811 Chapter 18 ASCII String Instructions Condition Ladder Diagram Action Rung-condition-in is true The instruction executes. The rung-condition-out is set to true. Postscan The rung-condition-out is set to false. Execution Structured Text Condition Action Prescan See Prescan in the Ladder Diagram table Normal execution See rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table Example When temp_high is set, the INSERT instruction adds the characters in string_2 to position 2 within string_1 and places the result in string_3. Ladder Diagram Structured Text IF temp_high THEN INSERT(string_1,string_2,2,string_3); temp_high := 0; END_IF; Middle String (MID) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The MID instruction copies a specified number of ASCII characters from a string and stores them in another string. Available Languages 812 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 ASCII String Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text MID(Source,Qty,Start,Dest); Operands There are data conversion rules for mixed data types within an instruction. See Data conversions on page 851. Ladder Diagram and Structured Text Operand Type Format Description Notes Source ANY_STRING Tag The string to copy String types are: characters from default STRING data type with max 82 length of characters for the string. any new string type you created with configurable length of characters for the string. Quantity SINT Immediate INT tag The number of The Start plus the characters to copy Quantity must be less than or equal to the length size of the DINT Source plus 1. Start SINT Immediate INT tag The position of the first Enter a number between character to copy 1 and the DATA size of the Source. DINT Destination ANY_STRING Tag The string to copy the characters to Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 813 Chapter 18 ASCII String Instructions See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description The MID instruction copies a group of characters from the Source and places the result in the Destination. • The Start position and Quantity define the characters to copy. • Unless the Source and the Destination are the same tag, the Source remains unchanged. Affects Math Status Flags No Major/Minor Faults A minor fault will occur if: Fault Type Fault Code The LEN value of the Source string tag is 4 51 4 52 4 56 greater than the DATA size of the Source string tag. The length of output string is larger than the DATA size of the destination string tag. The Start or Quantity value is invalid. Execution Ladder Diagram Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Prescan See Prescan in the Ladder Diagram table Normal execution See rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table Example In the baggage handling conveyor of an airport, each bag gets a bar code. Characters 9 through 17 of the bar code are the flight number and destination airport of the bag. After the bar code is read (bag_read.EM is on), the MID instruction copies the flight number and destination airport to the bag_flt_and_dest string. Subsequent rungs use bag_flt_and_dest to determine where to route the bag. 814 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 ASCII String Instructions Ladder Diagram Structured Text IF bag_read.EM THEN MID(bag_barcode,9,9,bag_flt_and_dest); bag_read.EM := 0; END_IF; String Concatenate (CONCAT) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The CONCAT instruction adds ASCII characters to the end of a string. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text CONCAT(SourceA,SourceB,Dest); Operands There are data conversion rules for mixed data types within an instruction. See Data conversions on page 851 for more information on Data Conversion. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 815 Chapter 18 ASCII String Instructions Ladder Diagram and Structured Text Operand Type Format Description Notes Source A ANY_STRING tag Tag that contains the String types are: initial characters • Source B Destination ANY_STRING tag ANY_STRING tag Default STRING Tag that contains the data type with end characters maximum 82 length of Tag to store the result characters for the string. • Any new string type you created with configurable length of characters for the string. See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description The CONCAT instruction combines the characters in Source A with the characters in Source B and places the result in the Destination. The characters from Source A are first, followed by the characters from Source B. Unless Source A and the Destination are the same tag, Source A remains unchanged. Affects Math Status Flags No Major/Minor Faults A minor fault will occur if: Fault Type Fault Code The LEN value of the string tag is greater 4 51 4 51 than the DATA size of the string tag. The sum length of Source A and Source B is greater than the DATA size of the string tag. See Index through arrays on page 863 for array-indexing faults. Execution Ladder Diagram 816 Condition Action Taken Prescan N/A Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 Condition Action Taken Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A ASCII String Instructions Structured Text Rockwell Automation, Inc. Condition Action Taken Prescan See Prescan in the Ladder Diagram table. Normal execution See rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. Publication 1756-RM003Z-EN-P - September 2024 817 Chapter 18 ASCII String Instructions Concat String flow chart 818 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 ASCII String Instructions Example Ladder Diagram Structured Text CONCAT(string_1,string_2,msg); String Delete (DELETE) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The DELETE instruction removes ASCII characters from a string. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text DELETE(Source,Qty,Start,Dest); Operands There are data conversion rules for mixed data types within an instruction. See Data conversions on page 851. Ladder Diagram and Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 819 Chapter 18 ASCII String Instructions Operand Type Format Description Notes Source ANY_STRING tag The tag that contains String types are: the string from which default STRING data you want to delete type with max 82 length characters of characters for the string. any new string type you created with configurable length of characters for the string. Quantity SINT immediate INT tag The number of The Start plus the characters to delete Quantity must be less than or equal to the length of the Source DINT plus 1. Start SINT immediate INT tag The position of the first Enter a number between character to delete 1 and the DATA size of the Source. DINT Destination String type tag The tag to store the result See Structured Text Syntax on page 879 for more information on the syntax of expressions within structured text. Description The DELETE instruction deletes (removes) one or more characters from the Source and places the remaining characters in the Destination. • The Start position and Quantity define the characters to remove. • Unless Source A and the Destination are the same tag, Source A remains unchanged. Affects Math Status Flags No Major/Minor Faults A minor fault will occur if: Fault Type Fault Code The LEN value of the Source string tag is 4 51 4 52 4 56 greater than the DATA size of the Source string tag. The length of output string is larger than the DATA size of the destination string tag. The Start or Quantity value is invalid. 820 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 18 ASCII String Instructions See Common Attributes for General Instructions on page 849 for operand-related faults. Execution Ladder Diagram Condition/State Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition/State Action Prescan See Prescan in the Ladder Diagram table. Normal execution See rung-condition-in is true in the Ladder Diagram table. Postscan See Postscan in the Ladder Diagram table. Examples ASCII information from a terminal contains a header character. After the controller reads the data (term_read.EM is on), the DELETE instruction removes the header character. The controller can then use the text of the message or pass it on to another device. Ladder Diagram Structured Text IF term_read.EM THEN DELETE(term_input,1,1,term_text); term_read.EM := 0; END_IF; Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 821 822 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 ASCII Conversion Instructions Use the ASCII conversion instructions to convert data to or from strings of ASCII characters. Available Instructions Ladder Diagram and Structured Text STOD on page 830 STOR on page 833 RTOS on page 828 DTOS on page 824 LOWER on page UPPER on page 826 835 Function Block Not available If you want to convert: Use this instruction: ASCII representations of integer values to SINT, INT, DINT, or STOD REAL values (e.g., converting from a weight scale or other ASCII device to an integer so you can use it in your logic). ASCII representations of a floating-point value to a REAL value STOR (e.g., converting a value from a weight scale or other ASCII device to a REAL value so you can use it in your logic). SINT, INT, DINT, or REAL values to a string of ASCII characters DTOS (e.g., converting a variable to an ASCII string so you can send it to a MessageView™ terminal). REAL values to a string of ASCII characters (e.g., converting a RTOS variable to an ASCII string so you can send it to a MessageView terminal). the letters in a string of ASCII characters to upper case (e.g., UPPER converting an entry made by an operator to all upper case so you can search for it in an array). the letters in a string of ASCII characters to lower case (e.g., LOWER converting an entry made by an operator to all lower case so you can search for it in an array). You can also use the following instructions to compare or manipulate ASCII characters. Rockwell Automation, Inc. If you want to: Use this instruction: Add characters to the end of a string CONCAT Delete characters from a string DELETE Determine the starting character of a sub-string FIND Insert characters into a string INSERT Extract characters from a string MID Rearrange the bytes of an INT, DINT, or REAL tag SWPB Publication 1756-RM003Z-EN-P - September 2024 823 Chapter 19 ASCII Conversion Instructions If you want to: Use this instruction: Compare a string to another string CMP See if the characters are equal to specific characters EQ See if the characters are not equal to specific characters NE See if the characters are equal to or greater than specific GE characters See if the characters are greater than specific characters GT See if the characters are equal to or less than specific LE characters See if the characters are less than specific characters LT Find a string in an array of strings FSC DINT to String-DTOS This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The DTOS instruction produces the ASCII representation of a value. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text DTOS(Source,Dest); Operands Ladder Diagram and Structured Text Operand Type Format Description Notes Source SINT Tag The tag that contains If the Source is a REAL, the value the instruction converts INT it to a DINT value. DINT 824 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 Operand Type ASCII Conversion Instructions Format Description Notes Tag The tag to store the String types are: integer value • REAL Destination String type default STRING data type • any new string type you create Description The DTOS instruction converts the Source to a string of ASCII characters and places the result in the Destination. Affects Math Status Flags No Major/Minor Faults Type Code Cause Recovery Method 4 51 The LEN value of the string tag Check that no instruction is is greater than the DATA size writing to the LEN member of of the string tag. the string type tag. In the LEN value, enter the number of characters that the string contains. 4 52 The output string is larger Create a new string type that than the destination. is large enough for the output string. Use the new string type as the data type for the destination. See Common Attributes for operand-related faults. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Rockwell Automation, Inc. Condition Action Prescan See Prescan in the preceding Ladder Diagram table Publication 1756-RM003Z-EN-P - September 2024 825 Chapter 19 ASCII Conversion Instructions Condition Action Normal execution See rung-condition-in is true in the preceding Ladder Diagram table. Postscan See Postscan in the preceding Ladder Diagram table Example When temp_high is set, the DTOS instruction converts the value in msg_num to a string of ASCII characters and places the result in msg_num_ascii. Subsequent rungs insert or concatenate msg_num_ascii with other strings to produce a complete message for a display terminal. Ladder Diagram Structured Text IF temp_high THEN DTOS(msg_num,msg_num_ascii); temp_high := 0; END_IF; Lower Case-LOWER This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The LOWER instruction converts the alphabetical characters in a string to lower case characters. Available Languages Ladder Diagram Function Block This instruction is not available in function block. 826 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 ASCII Conversion Instructions Structured Text LOWER(Source,Dest); Operands Ladder Diagram and Structured Text Operand Type Format Description Source String Tag The tag that contains the characters you want to convert to lower case Destination String Tag The tag to store the characters in lower case See Structured Text for more information on the syntax of expressions within structured text. Description The LOWER instruction converts all the letters in the Source to lower case, and places the result in the Destination. • ASCII characters are case-sensitive. Upper case A ($41) is not equal to lower case a ($61). • If operators directly enter ASCII characters, convert the characters to all upper case or lower case before you compare them. Any characters in the Source string that are not letters remain unchanged. Affects Math Status Flags No Major/Minor Faults Type Code Cause Recovery Method 4 51 The LEN value of the string tag Check that no instruction is is greater than the DATA size writing to the LEN member of of the string tag. the string type tag. In the LEN value, enter the number of characters that the string contains. 4 52 The output string is larger Create a new string type that than the destination is large enough for the output string. Use the new string type as the data type for the destination. Execution Ladder Diagram Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 827 Chapter 19 ASCII Conversion Instructions Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Prescan See Prescan in the preceding Ladder Diagram table Normal execution See rung-condition-in is true in the preceding Ladder Diagram table. Postscan See Postscan in the preceding Ladder Diagram table Examples To find information about a specific item, an operator enters the item number into an ASCII terminal. After the controller reads the input from a terminal (terminal_read is set), the LOWER instruction converts the characters in item_number to all upper case characters and stores the result in item_number_lower_case. A subsequent rung then searches an array for characters that match those in item_number_lower_case. Ladder Diagram Structured Text IF terminal_read THEN LOWER(item_number,item_number_lower_case); terminal_read := 0; END_IF; REAL to String (RTOS) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The REAL to String (RTOS) instruction produces the ASCII representation of a REAL value. Available Languages 828 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 ASCII Conversion Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text RTOS(Source,Dest); Operands Ladder Diagram and Structured Text Operand Type Format Description Notes Source REAL Tag The tag that contains the REAL value Destination String type Tag The tag to store the String types are: ASCII value • Default STRING data type • Any new string type you create See Structured Text Syntax for more information on the syntax of expressions. Description The RTOS instruction converts the Source to a string of ASCII characters and places the result in the Destination. Affects Math Status Flags No Major/Minor Faults Type Code Cause Recovery Method 4 52 The output string is larger Create a new string type that than the destination is large enough for the output string. Use the new string type as the data type for the destination. See Common Attributes for operand-related faults. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 829 Chapter 19 ASCII Conversion Instructions Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Prescan See Prescan in the preceding Ladder Diagram table Normal execution See rung-condition-in is true in the preceding Ladder Diagram table. Postscan See Postscan in the preceding Ladder Diagram table Examples When send_data is set, the RTOS instruction converts the value in data_1 to a string of ASCII characters and places the result in data_1_ascii. Subsequent rungs insert or concatenate data_1_ascii with other strings to produce a complete message for a display terminal. Ladder Diagram Structured Text IF send_data THEN RTOS(data_1,data_1_ascii); send_data:= 0; END_IF; String to DINT (STOD) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The String to DINT (STOD) instruction converts the ASCII representation of an integer to an integer or REAL value. 830 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 ASCII Conversion Instructions Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text STOD(Source,Dest); Operands There are data conversion rules for mixed data types within an instructions. See Data Conversion. Ladder Diagram and Structured Text Operand Type Format Description Notes Source String type Tag The tag that contains String types are: the value in ASCII • Default STRING data type • Any new string type you create Destination SINT Tag INT The tag to store the If the Source value is a integer value floating-point number, DINT the instruction converts only the non-fractional part of the number (regardless of the destination data type). See Structured Text Syntax for more information on the syntax of expressions. Description The STOD instruction converts the Source to an integer and places the result in the Destination. • The instruction converts positive and negative numbers. • If the Source string contains non-numeric characters, the STOD converts the first set of contiguous numbers: The instruction skips any initial control or non-numeric characters, except the minus sign in front of a number. If the string contains multiple groups of numbers that are separated by delimiters (e.g., /), the instruction converts only the first group of numbers. Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 831 Chapter 19 ASCII Conversion Instructions Affects Math Status Flags In Ladder Diagrams only. See Math Status Flags. Major/Minor Faults Type Code Cause Recovery Method 4 51 The LEN value of the string tag Check that no instruction is is greater than the DATA size writing to the LEN member of of the string tag. the string type tag. In the LEN value, enter the number of characters that the string contains. 4 53 The output number is beyond • the limits of the destination data type. Reduce the size of the ASCII value, or • Use a larger data type for the destination See Common Attributes for operand-related faults. Execution Ladder Diagram Condition Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Destination is cleared The instruction converts the Source. Postscan N/A Structured Text Condition Action Prescan See Prescan in the preceding Ladder Diagram table Normal execution See rung-condition-in is true in the preceding Ladder Diagram table. Postscan See Postscan in the preceding Ladder Diagram table Example When MV_read.EM is set, the STOD instruction converts the first set of numeric characters in MV_msg to an integer value. The instruction skips the initial control character ($06) and stops at the delimiter (\). 832 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 ASCII Conversion Instructions Ladder Diagram Structured Text IF MV_read.EM THEN STOD(MV_msg,MV_msg_nmbr); MV_read.EM := 0; END_IF; String to REAL (STOR) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The String to REAL (STOR) instruction converts the ASCII representation of a floating-point value to a REAL value. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text STOR(Source,Dest); Operands There are data conversion rules for mixed data types within an instructions. See Data Conversion. Ladder Diagram and Structured Text Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 833 Chapter 19 ASCII Conversion Instructions Operand Type Format Description Notes Source String type tag The tag that contains String types are: the value in ASCII • Default STRING data type • Any new string type you create Destination REAL tag The tag to store the REAL value Structured Text for more information on the syntax of expressions within structured text. Description The STOR instruction converts the Source to a REAL value and places the result in the Destination. • The instruction converts positive and negative numbers. • If the Source string contains non-numeric characters, the STOR converts the first set of contiguous numbers, including the decimal point [.]. The instruction skips any initial control or non-numeric characters (except the minus sign in front of a number). If the string contains multiple groups of numbers that are separated by delimiters (e.g., /), the instruction converts only the first group of numbers. Affects Math Status Flags Conditional, based on programming language. See Math Status Flags. Major/Minor Faults Type Code Cause Recovery Method 4 51 The LEN value of the string tag Check that no instruction is is greater than the DATA size writing to the LEN member of of the string tag. the string type tag. In the LEN value, enter the number of characters that the string contains. 4 53 The output number is beyond • the limits of the destination data type. Reduce the size of the ASCII value, or • Use a larger data type for the destination See Common Attributes for operand-related faults. Execution Ladder Diagram 834 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 19 Condition Ladder Diagram Action Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A ASCII Conversion Instructions Structured Text Condition Action Prescan See Prescan in the preceding Ladder Diagram table Normal execution See rung-condition-in is true in the preceding Ladder Diagram table. Postscan See Postscan in the preceding Ladder Diagram table Example After reading the weight from a scale (weight_read is set), the STOR instruction converts the numeric characters in weight_ascii to a REAL value. You may see a slight difference between the fractional parts of the Source and Destination. Ladder Diagram Structured Text IF weight_read THEN STOR(weight_ascii,weight); END_IF; Upper Case (UPPER) This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers. The UPPER instruction converts the alphabetical characters in a string to upper case characters. Available Languages Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 835 Chapter 19 ASCII Conversion Instructions Ladder Diagram Function Block This instruction is not available in function block. Structured Text UPPER(Source,Dest); Operands Ladder Diagram and Structured Text Operand Type Format Description Source String tag Tag that contains the characters you want to convert to upper case Destination String tag Tag to store the characters in upper case See Structured Text for more information on the syntax of expressions within structured text. Description The UPPER instruction converts all the letters in the Source to upper case, and places the result in the Destination. • ASCII characters are case-sensitive. Upper case A ($41) is not equal to lower case a ($61). • If operators directly enter ASCII characters, convert the characters to all upper case or lower case before you compare them. Any characters in the Source string that are not letters remain unchanged. Affects Math Status Flags No Major/Minor Faults 836 Type Code Cause 4 51 The LEN value of the string tag Check that no instruction is Publication 1756-RM003Z-EN-P - September 2024 Recovery Method is greater than the DATA size writing to the LEN member of of the string tag. the string type tag. Rockwell Automation, Inc. Chapter 19 Type Code Cause ASCII Conversion Instructions Recovery Method In the LEN value, enter the number of characters that the string contains. 4 52 The output string is larger Create a new string type that than the destination is large enough for the output string. Use the new string type as the data type for the destination. Execution Ladder Diagram Condition/State Action Taken Prescan N/A Rung-condition-in is false N/A Rung-condition-in is true The instruction executes. Postscan N/A Structured Text Condition Action Prescan See Prescan in the preceding Ladder Diagram table Normal execution See rung-condition-in is true in the preceding Ladder Diagram table. Postscan See Postscan in the preceding Ladder Diagram table Example To find information about a specific item, an operator enters the catalog number of the item into an ASCII terminal. After the controller reads the input from a terminal (terminal_read is set), the UPPER instruction converts the characters in catalog_number to all upper case characters and stores the result in catalog_number_upper_case. A subsequent rung then searches an array for characters that match those in catalog_number_upper_case. Ladder Diagram Structured Text IF terminal_read THEN UPPER(catalog_number,catalog_number_upper_case); Rockwell Automation, Inc. Publication 1756-RM003Z-EN-P - September 2024 837 Chapter 19 ASCII Conversion Instructions terminal_read := 0; END_IF; 838 Publication 1756-RM003Z-EN-P - September 2024 Rockwell Automation, Inc. Chapter 20 Debug Instructions These instructions are compatible only with Studio 5000 Logix Emulate software, which enables emulating a Logix 5000 controller on a personal computer. These instructions are not compatible with emulated 5580 controllers. Use the debug instructions to monitor the state of the logic when it is in conditions that you determine. Available Instructions TPT on page 842 BPT on page 839 Function Block Not available Structured Text Not available If you want to: Use this instruction: Stop program emulation when a rung is true BPT Log data you select when a rung is true. TPT Breakpoints (BPT) This instruction is compatible with Studio 5000 Logix Emulate controllers only. This instruction is not compatible with emulated 5580 controllers. Use the debug instructions to monitor the state of your logic when it is in conditions that you determine. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text This instruction is not available in structured text. Operands There are data conversion rules for mixed data types within a">

Download
Advertisement
Key features
Programmable logic controllers
Human machine interfaces
Motion control systems
Scalable architecture
Wide range of communication protocols
Integrated safety features
Advanced diagnostics
Powerful programming tools
Comprehensive documentation
Frequently asked questions
The TimeSynchronize object is used to configure and manage the time synchronization within a network. It is described on page 252 of the viewed document.
Major faults are described in the viewed document. The major fault types and codes are listed on page 145 of the viewed document.
Yes, you can use the MSG instruction to communicate with a PLC-5 controller. The specific details for configuring the MSG instruction to communicate with a PLC-5 controller are provided on page 316 of the viewed document.