Home
Local PDF
Contents
1. EN 1 POS LEN vn Es POS 1 yes no DN bit is set POS POS 1 Y POS value goto rolls over error yes DN bit is set no POS gt LEN Ss yes T Destination Destination AND NOT Mask e Ef bit is set a OR Array control POS AND Mask gt y rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Sequencer Instructions SQI SQO SQL 429 Example When enabled the SQO instruction increments the position passes the data at that position in array dint through the mask and stores the result in value 1 go Sequencer Output N Array array dint D Mask 158OF F N Dest value 1 Control control 1 Lenath 10 Position 0e S00 Operand Example Values Using INTS Displayed In Binary Array XXXXXXXX XXXXXXXX XXXX0101 xxxx1010 Mask 00000000 00000000 00001111 00001111 Destination XXXXXXXX XXXXXXXX XXXx0101 xxxx1010 A 0 in the mask means the bit is not compared designated by xxxx in this example Using SOI with SQO If you pair an SQI instruction with an SQO instruction make sure that both instructions use the same Control Length and Position values Sl Sequencer Input Armay aray dint 0 Mask 16 0F0F Source value 2 Control control 1 Length 10 Position of B
2. Relay Ladder AND Bitwise AMD Source value 1 0000 ann aan aro 1O1 OTCT 1111 1111 Source B value 2 2HO000_O000_0000_1171_1111_0000_0000_0000 Dest value result and 2H0000_0000_0000_0101_0101_0000_0000_0000 e Structured Text value result and value 1 AND value 2 Function Block AND 01 AND Bitwise AND value result and value 2 E Publication 1756 RMOOSI EN P January 2007 308 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Bitwise OR OR The OR instruction performs a bitwise OR operation using the bits in Source A and Source B and places the result in the Destination To perform a logical OR see page 13 322 Operands Relay Ladder OR Bitwise Inclusive OR Source Operand Type Format Description Source B 1 Source A SINT immediate value to OR with Source B Dest E INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Source B SINT immediate value to OR with Source A INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Destination SINT tag stores the result INT DINT E Structured Text dest A OR B s TUE RUE Use OR as an operator within an expression This expression evaluates sourceA OR sourceB See Structured Text Programming for information on the syntax of expressions within struc
3. vaue 111 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 010 0 0 0 0 0 0 0 before BTD instruction vadue 111 1 111 111 1 11 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 after BTD instruction The shaded boxes show the bits that changed in value f Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 295 Example 2 When enabled the BTD instruction moves 10 bits from value 1 to value 2 BTD Bit Field Distribute Source value 1 21111 1111 1111 1111 1111 1000 0000 0000 Source Bit 3 Dest value 2 2 0000_0000_0000_0000_0000_0000_0000_0000 Dest Bit 5 Lenath 10 source bit i 111 1 1 s m m m m m EE mE value 1 destination bit value 2 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 before BTD instruction value 210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 11 1 1 1 1 0 0 0 0 0 after BTD instruction The shaded boxes show the bits that changed in value 2 Publication 1756
4. ifLowLimit AndTestValuels The Rung condition outIs lt High Limit equal to or between limits true not equal to or outside limits false gt High Limit equal to or outside limits true not equal to or inside limits false Publication 1756 RMOOSI EN P January 2007 234 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Signed integers roll over from the maximum positive number to the maximum negative number when the most significant bit is set 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 set If you increment that number by one the result is 16 8000 bit 15 is set 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 see the following diagrams The LIM 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 rung condition out to true Any Test value in the clockwise range from the High Limit to the Low Limit sets the rung condition out to false Low Limit lt High Limit Low Limit 2 High Limit The instruction is true if the test value is equal to or between the low and high limit hie is true
5. Activation Message Activation Message SeqCount 1 SeqCount 4 Time t Time t6 Condition ROCNeg Condition ROCPos AlarmCount 1 AlarmCount 1 Inactivation Message SeqCount 5 Time t6 Inactivation Message SeqCount 2 Time t2 Condition ROCNeg Publication 1756 RMOOSI EN P January 2007 Condition ROCNeg Inactivation Message Activation Message SeqCount 6 SeqCount 3 Time t7 Time t5 a Condition ROCP Condition ROCNeg pa i AlarmCount 2 Chapter J Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Introduction Use the bit relay type instructions to monitor and control the status of bits If You Want To Use This Instruction Available In These Languages See Page enable outputs when a bit is set XIC relay ladder 70 structured text enable outputs when a bit is cleared XIO relay ladder 72 structured text set a bit OTE relay ladder 74 structured text set a hit retentive OTL relay ladder 76 structured text clear bit retentive OTU relay ladder 78 structured text enable outputs for one scan each time a ONS relay ladder 80 rung goes true structured text set a bit for one scan each time a rung OSR relay ladder 83 goes true set a bit for one scan each time the rung OSF relay ladder 86 goes false set a bit for one scan each time the input bit is OSRI structured text 3 89 set in function block function block
6. Example 2 When enabled the FAL instruction copies value_1 into the first 10 positions of the second dimension of array 2 element to array copy FAL File Arith Logical Control control 2 Length 10 ND Position of ALL array_2 0 control_2 pos p Mode Dest Expression Destination Expression value 1 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 3 array to element copy Control Length Position Mode Dest Expression File Arith Logical Control Length 10 N Position 0e Made inc R5 Dest Expression File Arith Logical FAL control 1 value 1 e array_1 control_1 pos Destination Expression Example 4 When enabled the FAL instruction adds value 1 and value 2 and stores the result in the current position of array 1 arithmetic operation element element to array AL control 1 all array l control 1 pos g Expression Destination value 1 value 2 Publication 1756 RMOOSI
7. postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 498 Special Instructions FBC DDT DTR PID Example When enabled the DTR instruction masks value 1 If there is a difference in the two values the rung condition out is set to true TR Data Transition Source Mask example 1 example 2 source current scan current scan previous scan previous scan The rung remains false as long as the input The rung remains true for one scan when a value does not change change is detected 13385 A 0 in the mask leaves the bit unchanged Publication 1756 RMOOSI EN P January 2007 Proportional Integral Derivative PID Operands Special Instructions FBC DDT DTR PID 499 The PID instruction controls a process variable such as flow pressure temperature or level Relay Ladder Proportional Integral Derivati I Process Variable m Tieback Control Variable PID Master Loop Inhold Bit Inhold Value Setpoint Process Variable Output Operand Type Format Description PID PID structure PID structure Process SINT tag value you want to control variable INT DINT REAL Tieback SINT immediate optional output of a hardware hand auto station which is bypassing the output of the controller INT tag Enter 0 if you don t want to use this parameter DINT REAL Control SINT tag value which goes to the final con
8. tier 2 tt light 2 timer 2 dn light 3 Publication 1756 RMOOSI EN P January 2007 Retentive Timer On RTO Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 105 The RTO instruction is a retentive timer that accumulates time when the instruction is enabled This instruction is available in structured text and function block as RTOR see page 118 Operands Relay Ladder RTO lt EUER ERU S Retentive Timer On EN Operand Type Format Description ine DN5 Timer TIMER tag timer structure reset f fccum Preset DINT immediate how long to delay accumulate time Accum DINT immediate number of msec the timer has counted initial value is typically 0 TIMER Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the RTO instruction is enabled AT BOOL The timing bit indicates that a timing operation is in process DN BOOL The done bit indicates that ACC gt PRE PRE DINT The preset value specifies the value 1 msec units which the accumulated value must reach before the instruction sets the DN bit ACC DINT The accumulated value specifies the number of milliseconds that have elapsed since the RTO instruction was enabled Description The RTO instruction accumulates time until it is disabled When the RTO instruction is disabled it retains its ACC value You must clear the ACC value typically with a RES instruction ref
9. Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code JSR instruction has fewer input parameters than SBR instruction 4 31 JSR instruction jumps to a fault routine 4 or user supplied 0 or user supplied RET instruction has fewer return parameters than JSR instruction 4 31 main routine contains a RET instruction 4 31 Execution Condition prescan Relay Ladder and Structured Text Relay Ladder Action Structured Text Action The controller executes all subroutines regardless of rung condition To ensure that all rungs in the subroutine are prescanned the controller ignores RET instructions that is RET instructions do not exit the subroutine e Release 6 x and earlier input and return parameters are passed e Release 7 x and later input and return parameters are not passed If recursive calls exist to the same subroutine the subroutine is prescanned only the first time If multiple calls exist non recursive to the same subroutine the subroutine is prescanned each time The rung condition out is set to false relay ladder only rung condition in is false to the JSR instruction The subroutine does not execute na Outputs in the subroutine remain in their last state The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 444 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR
10. Publication 1756 RMOOSI EN P January 2007 operation 1 jj clears status bits and complete clears POS value 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 e Numerical mode with any number of elements per scan requires only one false to true transition of the rung condition 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 e Incremental mode requires the rung condition in to change from false to true to manipulate one element in the array File Arithmetic and Logic FAL Operands FAL File Arith Logical Control Length Position Mode Dest IATA DI I od Expression Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 337 The FAL instruction performs copy arithmetic logic and function operations on data stored in an array Relay Ladder Operand Type Format Description Control CONTROL tag control structure for the operation Length DINT immediate number of elements in the array to be manipulated Position DINT immediate curr
11. 0Ns Description Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 The ONS instruction enables or disables the remainder of the rung depending on the status of the storage bit Relay Ladder Operand Type Format Description storage bit BOOL tag internal storage bit stores the rung condition in from the last time the instruction was executed Structured Text Structured text does not have an ONS instruction but you can achieve the same results using an IF THEN construct IF BOOL expression AND NOT storage bit THEN statement END IF storage bit BOOL expression See Appendix B for information on the syntax of constructs expressions and expressions within structured text When enabled and the storage bit is cleared the ONS instruction enables the remainder of the rung When disabled or when the storage bit is set the ONS instruction disables the remainder of the rung not affected none Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 81 Execution Condition Relay Ladder Action prescan The storage bit is set to prevent an invalid trigger during the first scan The rung condition out is set to false rung condition in is false The storage bit is cleared The rung condition out is set to false rung condition in is true storage bit 0 storage bit is set p examine storage bit rung condi
12. Controls the speed of the recirculation pump The Speed depends on the temperature in the tank IF tank temp 200 THEN Sugar Inlet 0 close the inlet IF bar code 65 A TH iral Z Gets the number of elements in the Inventory array and stores the value in the Inventory Items tag SIZE Inventory O Inventory Items Publication 1756 RMOOSI EN P January 2007 ASCII Character Codes Character Dec Hex Character Dec Hex Character Dec Hex Character Dec Hex ctrl NUL 0 00 SPACE 32 20 64 40 96 60 ctrl A SOH 1 01 33 21 A 65 41 a 97 61 ctrl B STX 2 02 34 22 B 66 42 b 98 62 ctrl C ETX 3 03 35 23 C 67 43 C 99 63 ctrl D EOT 4 04 36 24 D 68 44 d 100 64 ctrl E ENQ 5 05 37 25 E 69 45 e 101 65 ctrl F ACK 6 06 amp 38 26 F 70 46 102 66 ctrl G BEL 7 07 39 27 G 71 47 g 103 67 ctrl H BS 8 08 40 28 H 72 48 h 104 68 ctrl I HT 9 09 41 29 73 49 i 105 69 ctrl J LF 10 I 0A 42 2A J 74 4A j 106 6A ctrl K VT 11 0B 43 2B K 75 4B k 107 6B ctrl L FF 12 0C 44 2C L 76 4C 108 6C ctrl M CR 13 r 0D 45 2D M 7 4D m 109 6D ctrl N SO 14 0E 46 2E N 78 4E n 110 6E ctrl O SI 15 0F 47 2F 0 79 4F 0 111 6F ctrl P DLE 16 10 0 48 30
13. Y Y EW bit is set ER bit is set ER bit 1 examine ER bit gt Da Y rung condition out is set to false rung condition in is true The instruction executes na The rung condition out is set to true Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 147 Condition Relay Ladder Action Structured Text Action Enableln is set na Enableln is always set The instruction executes instruction execution EN bit 1 EN bit 0 examine EN bit EW bit 1 EW bit 1 examine EW bit examine EW bit EW bit 0 STbitz 1 ST bit 1 examine ST bit examine ST bit ST bit 0 ST bit 0 EW ST TO DN and ER bits are cleared examine DN bit Y DN bit 0 EN bit is set ER bit 1 ER bit 0 yes no 44 examine ER bit oock transfer module path valid no yes module 44 connection Y running EW ST TO DN and ER bits are cleared EN bit is set Y ER bit is set rung condition out is set to false postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 148 Input Output Instructions MSG GSV SSV IOT Arithmetic Status Flags not affected F
14. Use This Format valuel operator value2 Structured Text Programming 669 Use bitwise operators Bitwise operators manipulate the bits within a value based on two values For Use This Operator Optimal Data Type bitwise AND amp AND DINT bitwise OR OR DINT bitwise exclusive OR XOR DINT bitwise complement NOT DINT For example Example For This Situation You d Write If input input2 and result are DINT tags and your result1 inputi AND specification says Calculate the bitwise result of input2 input and input2 Store the result in result Determine the order of execution The operations you write into an expression are performed in a prescribed order not necessarily from left to right e Operations of equal order are performed from left to right e If an expression contains multiple operators or functions group the conditions in parenthesis This ensures the correct order of execution and makes it easier to read the expression Order Operation f 2 function 3 xx 4 negate 5 NOT 6 MOD wh subtract 8 lt lt gt gt 9 lt gt 10 amp AND 11 XOR 12 OR Publication 1756 RMOOSI EN P January 2007 670 Structured Text Programming Instructions lag xic Publication 1756 RMOOSI EN P January 2007 Structured text statements can also be instructions See the Locator Table at the begin
15. Grp SV G et system value Object class MODULE Object name disc_in_2 Attribute name FaultCode Dest disc in 2 info FaukCode 0 GSV Get system value Object class MODULE Object name disc_in_2 Attribute name Faultlnfo Dest disc in 2 info Faultlnfo 0 e Object class MODULE Object name disc_in_2 Attribute name Mode Dest disc_in_2_info Mode 2 0000_0000_0000_0000_0000_0000_0000_0000 Structured Text GSV MODULE disc in 2 FaultCode disc in 2 info FaultCode E GSV MODULE disc in 2 FaultInfo disc in 2 info FaultInfo GSV MODULE disc in 2 Mode disc in 2info Mode Example 2 This example gets status information about program discrete and places the data in a user defined structure discrete info Relay Ladder GSV GSV Get system value H Get system value bject class PROGRAM bject class PROGRAM bject name DISCRETE bject name DISCRETE Attribute name LASTSCANTIME Attribute name M XSCANTIME Dest discrete info LastScanTime Dest discrete info MaxScanTime 49 4500 Structured Text GSV PROGRAM DISCRETE LASTSCANTIME discrete info LastScanTime GSV PROGRAM DISCRETE MAXSCANTIME discrete info MaxScanTime Publication 1756 RMOOSI EN P January 2007 198 Input Output Instructions MSG GSV SSV IOT Example 3 This example gets status information about task JO_test and places the data in a use
16. If The Target Device Is a Select One Of These Message Types See Page Logix5000 controller CIP Data Table Read 156 CIP Data Table Write 1 0 module that you configure using Module Reconfigure 157 RSLogix 5000 software CIP Generic 158 PLC 5 controller LC5 Typed Read 159 LC5 Typed Write LC5 Word Range Read P P P PLC5 Word Range Write S S SLC controller LC Typed Read 161 MicroLogix controller LC Typed Write Block transfer module Block Transfer Read 161 Block Transfer Write PLC 3 processor PLC3 typed read 162 PLC 2 processor PLC3 typed write PLC3 word range read PLC3 word range write PLC2 unprotected read 163 PLC2 unprotected write Publication 1756 RMOOSI EN P January 2007 156 Input Output Instructions MSG GSV SSV IOT You must specify this configuration information For This Property Specify Source Element e f 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 e f 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 Number of Elements The number of elements you read write depends on the type of data you are using An element refers to one chunk of related data For example tag timer is one element that consists of one timer control structure Destination
17. Operator request inputs to an instruction are always cleared by the instruction when it executes This allows operator interfaces to work with these instructions by merely setting the desired mode request bit You don t have to program the operator interface to reset the request bits For example if an operator interface sets the OperAutoReq input to a PIDE instruction when the PIDE instruction executes it determines what the appropriate response should be and clears the OperAutoReq Publication 1756 RMOOSI EN P January 2007 658 Function Block Attributes Program request inputs are not normally cleared by the instruction because these are normally wired as inputs into the instruction If the instruction clears these inputs the input would just get set again by the wired input There might be situations where you want to use other logic to set the Program requests in such a manner that you want the Program requests to be cleared by the instruction In this case you can set the ProgValueReset input and the instruction will always clear the Program mode request inputs when it executes In this example a rung of ladder logic in another routine is used to one shot latch a ProgAutoReq to a PIDE instruction when a pushbutton is pushed Because the PIDE instruction automatically clears the Program mode requests you don t have to write any ladder logic to clear the ProgAutoReq after the routine executes and the PIDE instruction will
18. Tation Link E vation Node o acctal v Connected MV Cache Connections Specify Specify a path Specify a Communication Method Or Module Address e a path Choose a cache option The path shows the route that the message takes to get to the destination It uses either names from the I O configuration of the controller numbers that you type or both If The 1 0 configuration of the controller has Then Use the Browse button to select the module the module that gets the message The 1 0 configuration of the controller has only the local communication module 1 Use the Browse button to select the local communication module 2 Type the rest of the path The 1 0 configuration of the controller doesn t have any of the modules that you Type the path need for the message Publication 1756 RMOOSI EN P January 2007 166 Input Output Instructions MSG GSV SSV IOT Example The 1 0 configuration of the controller has the module that gets the message Click the Browse button and select the module Path Peer Controller Peer Controller The 1 0 configuration of the controller has only the local communication module Go to the local communication module Go out the EtherNet IP port to the address of 10 10 10 10 Go across the backplane to the module in slot 0 Path LocalENB 2 10 10 10 10 1 0 Browse LocalENB 2 10 10 10 10 1
19. Added new chapter 2 Analog Alarm Instruction 47 Remaining chapters 3 20 Renumbered 69 619 Publication 1756 RMOOSI EN P January 2007 16 Summary of Changes Notes Publication 1756 RMOOSI EN P January 2007 Preface Introduction This manual is one of several Logix5000 based instruction manuals Task Goal Documents Program the controller for sequential Logix5000 Controllers General Instructions Reference Manual publication applications 1756 RM003 You are here Program the controller for process or drives Logix5000 Controllers Process Control and Drives Instructions Reference Manual applications publication 1756 RM006 Program the controller for motion Logix5000 Controllers Motion Instruction Set Reference Manual publication applications 1756 RM007 Program the controller to use equipment PhaseManager User Manual publication LOGIX UMOO1 phases Import a text file or tags into a project Logix5000 Controllers Import Export Reference Manual publication 1756 RM084 Export a project or tags to a text file Convert a PLC 5 or SLC 500 application toa Logix5550 Controller Converting PLC 5 or SLC 500 Logic to Logix5550 Logic Reference Logix5000 application Manual publication 1756 6 8 5 Who Should Use This document provides a programmer with details about each This Manual available instruction for a Logix based controller You should already be familiar with how the Logix based controller stores an
20. Operator Description Optimal Operator Description Optimal add DINT REAL DEG radianstodegres DINLREAL subtract negate DINT REAL FRD BCD to integer DINT multiply DINT REAL LN natural log REAL divide DINT REAL LOG log base 10 REAL equal DINT REAL MOD modulo divide DINT REAL lt less than DINT REAL NOT bitwise complement DINT lt less than or equal DINT REAL OR bitwise OR DINT gt greater than DINT REAL RAD degrestoradiaas DINLREAL gt greater than or equal DINT REAL SIN sine REAL o not equal DINT REAL SOR square root DINT REAL ip exponent x to y DINT REAL TAN tangent REAL ABS absolute value DINT REAL TOD integer to BCD DINT ACS arc cosine REAL TRN truncate DINT REAL AND bitwise AND DINT XOR bitwise exclusive OR DINT ASN arc sine REAL ATN arc tangent REAL COS cosine REAL Publication 1756 RMOOSI EN P January 2007 210 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Publication 1756 RMOOSI EN P January 2007 Format Expressions For each operator that you use in an expression you have to provide one or two operands tags or immediate values Use the following table to format operators and operands within an expression For Operators That Use This Format Examples Operate On one operand operator operand ABS tag a two operands operand_a operator operand_b e tag b45 e tag c AND tag d e tag e 2 MOD tag f tag 9 Determine The Orde
21. Structured Text The operands are the same as those for the relay ladder EOT instruction 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 TND instruction see page 452 The Logix implementation of the EOT instruction differs from that in a PLC 5 controller In a PLC 5 controller the EOT instruction has no parameters Instead the PLC 5 EOT instruction returns rung condition as its state In a Logix controller the return parameter returns the transition state since rung condition is not available in all Logix programming languages not affected none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution postscan Publication 1756 RMOOSI EN P The instruction returns the data bit value to the calling routine The rung condition out is set to false No action taken January 2007 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 461 Example Whe
22. TimeoutMultiplier SINT Time out for a connected message once it has a connection This time out is for the response from the other device about the sending of the data e his time out applies only after the connection is made e The time out ConnectionRate x TimeoutMultiplier e The default ConnectionRate is 7 5 seconds e The default TimeoutMultiplier is 0 which is a multiplication factor of 4 e The default time out for connected messages is 30 seconds 7 5 seconds x 4 30 seconds e 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 e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See Appendix B Publication 1756 RMOOSI EN P January 2007 144 Input Output Instructions MSG GSV SSV IOT The size of each element depends on the data types you specify and the type of message command you use connection with EN_CC 1 rung condition in EN bit EW bit connection with EN_CC 0 ST bit DN bit or ER bit 41382 Publication 1756 RMOOSI EN P January 2007 Input Outpu
23. e An expression lets you compare two string tags e You cannot enter ASCII characters directly into the expression e Only the following operators are permitted Operator Description equal lt less than lt less than or equal gt greater than gt greater than or equal o not equal e Strings are equal if their characters match e ASCII characters are case sensitive Upper case A 41 is not equal to lower case a 61 e The hexadecimal values of the characters determine if one string is less than or greater than another string For the hex code of a character see the back cover of this manual e When the two strings are sorted as in a telephone directory the order of the strings determines which one is greater a Onn DO SO 0 Doc oS ASCII Characters Hex Codes 1ab 31 61 62 1b 31 62 A 41 AB 41 42 B 42 a 61 ab 61 62 AB B ue 0 i a B Publication 1756 RMOOSI EN P January 2007 358 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Copy File COP Synchronous Copy File CPS Operands COP i Copy File Source 7 Dest Length CPS Synchronous Copy File Source Dest Length COP Source Dest Length CPS Source Dest Length Publication 1756 RMOOSI EN P January 2007 The COP and CPS instructions copy the value s in the Source to the Destination The Source
24. mgl i Operand Type Format Description Arc Tangent ATN tag FBD MATH ADVANCED structure ATN structure Publication 1756 RMOOSI EN P January 2007 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 541 FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The resulting value in the Destination is always greater than or equal Arithmetic Status Flags Fault Conditions Condition prescan Execution to 7 2 and less than or equal to n 2 where n 3 141593 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller calculates the arc tangent of the Source and places the result in the Destination The rung condition out is set to true postscan Condition prescan The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction f
25. no DN bit is set 88 Y yes DN bit is set 4 mode LEN pe numeric mode page 9 343 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 351 Condition Relay Ladder Action rung condition in is true A LEN 0 or page 9 343 POS lt 0 ER bit 0 numeric examine ER bit mode ER bit 1 DN bit 0 no no no aq examine IN bit ALL mode DN bit 1 v bit 0 yes yes yes DN bit is set INC ALL g examine DN bit mode mode DN bit 1 page 9 341 page 9 342 cud DN bit 2 0 q loop_count 4 loop count 1 oop count 0 29 POS POS 1 yes Y evaluate comparison no lt j Y yes POS POS 1 EN bit is set FD bit is set DN bit is set POS POS 1 y rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 352 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 1 Search for a match between two arrays When enabled the FSC instruction compares each of the first 10 elements in array 1 to the corresponding elements in array 2 FSC File Search Compare N Control control 3 N3
26. Arithmetic functions perform math operations Specify a constant a non boolean tag or an expression for the function For Use This Function Optimal Data Type absolute value ABS numeric_expression DINT REAL arc cosine ACOS numeric expression REAL arc sine ASIN numeric expression REAL arc tangent ATAN numeric expression REAL cosine COS numeric expression REAL radians to degrees DEG numeric expression DINT REAL natural log N numeric expression REAL log base 10 LOG numeric expression REAL degrees to radians RAD numeric expression DINT REAL sine SIN numeric expression REAL square root SORT numeric expression DINT REAL tangent TAN numeric expression REAL truncate TRUNC numeric expression DINT REAL Publication 1756 RMOOSI EN P January 2007 666 Structured Text Programming Use This Format valuel operator value2 operator valuel For example Example For This Situation If gain_4 and gain 4 adj are DINT tags and your specification says Add 15 to gain 4and store the result in gain 4 adj If alarm and high alarm are DINT tags and your specification says Negate high alarm and store the result in alarm You d Write gain 4 adj gain 4 15 alarm high alarm function numeric expression If overtravel and overtravel POS are DINT tags and your specification says Calculate the absolute value of overtravel and store the result in overtra
27. Condition compare POS gt compare LEN Source compare POS eference compare POS no compare POS compare POS 1 Special Instructions FBC DDT DTR PID Relay Ladder Action compare POS compare LEN goto exit compare FD bit is set no page result DN 1 examine result DN bit result DN 0 a result DN bit is cleared result POS 0 yes result POS size of result array result result POS compare POS Y result POS result LEN yes Y result DN bit is set Y compare ER bit is set Y goto exit page postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 487 Example When enabled the FBC instruction compares the source array dint1 to the reference array dint2 and stores the locations of any mismatches in the result array dint3 FBC File Bit Comparison N Source array dintl 0 No Reference array dint2 0 FD Result array_dint3 0 IN 5 Cmp Control control 1 R Lenath 10 Position of Result Control control 3 Lenath 10 Position of source 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 array_dint1 reference 0 0 0 00 0 0 00 0 0 0 0 00 0 0 00 0 0 0 0 0 0 0 1
28. DEDT LDLG RLIM DERV LPF SCRV HPF NTCH SOC INTG PI TOT LDL2 PIDE There are three different timing modes Timing Mode Description periodic Periodic mode is the default mode and is suitable for most control applications We recommend that you place the instructions that use this mode in a routine that executes in a periodic task The delta time DeltaT for the instruction is determined as follows If The Instruction Then DeltaT Equals Executes In a periodic task period of the task event or continuous elapsed time since the previous execution task The controller truncates the elapsed time to whole milliseconds ms For example if the elapsed time 10 5 ms the controller sets DeltaT 10 ms The update of the process input needs to be synchronized with the execution of the task or sampled 5 10 times faster than the task executes in order to minimize the sampling error between the input and the instruction oversample In oversample mode the delta time DeltaT used by the instruction is the value written into the OversampleDT parameter of the instruction If the process input has a time stamp value use the real time sampling mode instead Add logic to your program to control when the instruction executes For example you can use a timer set to the OversampleDeltaT value to control the execution by using the Enableln input of the instruction The process input needs to be sampled 5 10 times faster than the instruction is ex
29. Dest dest NOT source NOT 04 NOT Es Bitwise NOT Source The NOT instruction performs a bitwise NOT operation using the bits in the Source and places the result in the Destination To perform a logical NOT see page 13 328 Relay Ladder Operand Source Type SINT INT DINT Description value to NOT A SINT or INT tag converts to a DINT value by zero fill Destination SINT INT DINT Structured Text stores the result Use NOT as an operator within an expression This expression evaluates NOT source See Structured Text Programming for information on the syntax of expressions within structured text Function Block Operand Type NOT tag FBD LOGICAL Format Description structure NOT structure Publication 1756 RMOOSI EN P January 2007 316 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Input Parameter Data Type FBD LOGICAL Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated default is set Source DINT Value to NOT Output Parameter Data Type valid any integer Description EnableOut BOOL The instruction produced a valid result Dest DINT Result of the instruction Arithmetic status flags are set for this output Description When enabled the instruction evaluates the NOT operation Arithmetic Status Flags Fault Cond
30. If you are using the deadband the Control variable must be REAL or it will be forced to 0 when the error is within the deadband Use output limiting You can 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 Publication 1756 RMOOSI EN P January 2007 518 Special Instructions FBC DDT DTR PID Publication 1756 RMOOSI EN P January 2007 Feedforward or output biasing You can feedforward a disturbance from the system by feeding the BIAS value into the PID instruction s feedforward bias value 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 Cascading loops 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 t
31. Instruction Location Languages Instruction Location Languages D3SD process control structured text FOR 472 elay ladder Discrete 3 State Device function block For DDT 488 relay ladder FRD 565 elay ladder Diagnostic Detect Convert to Integer unction block DEDT process control structured text FSC 349 elay ladder Deadtime function block File Search and Compare DEG 559 relay ladder GEQ 216 elay ladder Degrees structured text Greater than or Equal to structured tex function block unction block DELETE 610 relay ladder GRT 220 elay ladder String Delete structured text Greater Than structured tex unction block DERV process control structured text Dervauve function block GSV 173 elay ladder Get System Value structured tex DFF process control structured text D Flip Flop function block HLL process control structured tex High Low Limit unction block DIV 263 relay ladder Divide structured text HPF process control structured tex function block High Pass Filter unction block DTOS 626 relay ladder ICON 641 unction block DINT to String structured text Input Wire Connector DTR 496 relay ladder INSERT 614 elay ladder Data Transitional Insert String structured text EOT 460 relay ladder INTG process control structured text End of Transition structured text Integrator unction block EQU 207 relay ladder IOT 200 elay ladder Equal to structured text Immediate Output structured text function block IREF 641 unction block ESEL process control struc
32. Length 10 Rye Pasition of Mode ALL Expression atray_1 control_3 pos lt gt array 2 control 3 pos amay 1 array 2 control 3 pos 00000000000000000000000000000000 00000000000000000000000000000000 0 00000000000000000000000000000000 00000000000000000000000000000000 1 00000000000000000000000000000000 00000000000000000000000000000000 2 00000000000000000000000000000000 00000000000000000000000000000000 3 The FSC instruction finds that these EEEGCCUCUEEAGUUIEEMIMIEIRUMEIDAS EINZENZEZESENUETEEESORER UR EET elements are not equal The instruction sets 11111111111111111111111111111111 11111111111111111111111111111111 5 indicates the position of the elements that mamma METTRE TEE TEE TEE FEE EE EEE EE S 6 are not er Ue late sonne coripann te rest of the array clear the IN bit 11111111111111111111111111111111 11111111111111111111111111111111 7 11111111111111111111111111111111 11111111111111111111111111111111 8 11111111111111111111111111111111 11111111111111111111111111111111 g Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 353 Example 2 Search for a match in an array When enabled the FSC instruction compares the MySearchKey to 10 elements in array 1 FSC File Search Compare Control control 1 Lenath 10 Pasition 0 Mode al
33. MV read EM The rung condition out is set to false No action taken 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 Relay Ladder STOD String To DINT Source MV msg 06324 12 1 r Dest MV_msg_nmbr 324 Publication 1756 RMOOSI EN P January 2007 624 String To REAL STOR ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Structured Text IHEN IF MV read EM STOD MV msg MV msg nmbr MV read EM END IF The STOR instruction converts the ASCII representation of a floating point value to a REAL value Operands Relay Ladder Operands STOR String to Real Source 22 Dest Operand Type Format Enter Notes Source string tag tag that contains the value String data types are in ASCII e default STRING data type e any new string data type that you create Destination REAL tag tag to store the REAL value Structured Text STOR Source Dest Description Publication 1756 RMOOSI EN P January 2007 The operands are the same as those for the relay ladder STOR instruction The STOR converts the Source to a REAL value and places the result in the Destination e The instruction converts positive and negative numbers e If the Source string contains non numeric character
34. Operand Type Format Description FRD tag FBD CONVERT structure FRD structure FBD_CONVERT Structure Description Enable input If cleared the instruction does not execute and outputs are not updated Default is set Input to the conversion instruction Valid any integer Description EnableOut BOOL The instruction produced a valid result Dest DINT Result of the conversion instruction Arithmetic status flags are set for this output Description The FRD instruction converts a BCD value Source to a decimal value Arithmetic Status Flags Fault Conditions and stores the result in the Destination Arithmetic status flags are affected none Publication 1756 RMOOSI EN P January 2007 566 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Execution Condition prescan Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller converts the Source to a decimal value and places the result in the Destination The rung condition out is set to true postscan Condition prescan The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes
35. Result of the instruction Arithmetic status flags are set for this output When enabled the instruction evaluates the AND operation If the Bit In And the Bitin The Bit In the Source A Is Source B Is Destination Is 0 0 0 0 1 0 1 0 0 1 1 1 If you mix integer data types the instruction fills the upper bits of the smaller integer data types with Os so that they are the same size as the largest data type Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The instruction performs a bitwise AND operation The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Condition prescan Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 307 Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Example When enabled the AND instruction performs a bitwise AND SourceA SourceB Dest operation on SourceA and SourceB and places the result in the Dest
36. Sequencer Output Array array dint 0 Mask 16 OFOF Dest value 1 Control control 1 Lenath 10 Position 0 Resetting the position of SQ0 Each time the controller goes from Program to Run mode the SQO instruction clears initializes the POS value To reset POS to the initialization value POS 0 use a RES instruction to clear the position value This example uses the status of the first scan bit to clear the POS value S FS control 1 RES Publication 1756 RMOOSI EN P January 2007 430 Sequencer Instructions SQI SQO SQL Sequencer Load SQL The SQL instruction loads reference conditions into a sequencer array Operands Relay Ladder EON E d EN Operand Type Format Description Array nica DNS Array DINT array tag sequencer array pens specify the first element of the sequencer Position array do not use CONTROL POS in the subscript Source SINT tag input data to load into the sequencer array INT immediate DINT A SINT or INT tag converts to a DINT value by sign extension Control CONTROL tag control structure for the operation typically use the same CONTROL as the SQI and SQO instructions Length DINT immediate number of elements in the Array sequencer table to load Position DINT immediate current position in the array initial value is typically 0 CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the SQL instruction is enable
37. T mas EM bit is set 4 Destination 0 no io e yes POS LEN yes n POS gt LEN MW DN bit is set no no POS POS 1 LEN gt size of array Destination LIFO control POS p rung condition out is set to 3 postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Array File Shift Instructions BSL BSR FFL FFU LFL LFU 419 Example When enabled the LFU instruction unloads array dint 5 into value 2 LFU LIFO Unload LIFO array_dint O Dest value 2 Control control 1 Length 10 Position 6 before LIFO unload after LIFO unload array dint 0 00000 00000 11111 11111 22222 22222 33333 33333 44444 44444 array_dint 5 55555 00000 control_1 pos 5 0000 control 1 pos 6 0000 value 2 55555 00000 00000 00000 00000 00000 00000 Publication 1756 RMOOSI EN P January 2007 420 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Notes Publication 1756 RMOOSI EN P January 2007 Chapter 11 Sequencer Instructions SQI S00 SQL Introduction No action taken Sequencer instructions monitor consistent and repeatable operations If You Want To Use This Instruction Available In These Languages See Page Detect when a step is complete sal relay ladder 422 Set output conditio
38. Timer Off Delay TO F The TOF instruction is a non retentive timer that accumulates time when the instruction is enabled rung condition in is false This instruction is available in structured text and function block as TOFR see page 114 Operands Relay Ladder TOF Timer Off Delay EN Operand Type Format Description Timer CDN2 Timer TIMER tag timer structure Preset Accum Preset DINT immediate how long to delay accumulate time Accum DINT immediate total msec the timer has counted initial value is typically 0 TIMER Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the TOF instruction is enabled AT BOOL The timing bit indicates that a timing operation is in process DN BOOL The done bit is cleared when ACC gt PRE PRE DINT The preset value specifies the value 1 msec units which the accumulated value must reach before the instruction clears the DN bit 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 e the TOF instruction is disabled e the ACC PRE The time base is always 1 msec For example for a 2 second timer enter 2000 for the PRE value Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 101 When the TOF instructio
39. all subscribers disconnected Cleared at least one subscriber connected Publication 1756 RMOOSI EN P January 2007 60 Analog Alarm Instruction ALMA Output Parameter CommError Data Type BOOL Description Indicates that there was a communication error when delivering last alarm message to at least one subscriber Set communication errors all retries exhausted Cleared all connected subscribers successfully received alarm message This error means that a subscriber was subscribed and it had a connection opened but the message was not delivered successfully AlarmBuffered BOOL Indicates that the alarm message was buffered when not delivered to subscriber s either due to a CommkError or a lost Connection Set alarm message buffered for at least one subscriber Cleared alarm message is not buffered SubscNotified DINT DINT Indicates number of subscribers for this alarm Indicates number of subscribers successfully notified about the most recent alarm state change Status DINT Indicates the bit mapped status of the instruction execution InstructFault BOOL The instruction detected an execution error This is not a minor or major controller error Check the remaining status bits to determine what occurred InFaulted BOOL User program has set InFault to indicate bad quality input data Severitylnv BOOL Indicates
40. 4 tagl tag2 tagl gt valuel function tagl instruction instruction operand instruction operandi operand2 operand3 Structured Text Programming 661 Term construct see page 28 671 Definition Examples A conditional statement used to trigger structured text code i e other IF THEN statements n n Terminate the construct with a semi colon CASE FOR DO WHILE DO REPEAT UNTIL EXIT comment see page 687 Assignments Text that explains or clarifies what a section of structured text does comment e Use comments to make it easier to interpret the structured text e Comments do not affect the execution of the structured text e Comments can appear anywhere in structured text start of comment end of comment start of comment end of comment Use an assignment to change the value stored within a tag An assignment has this syntax tag expression where Component tag Description represents the tag that is getting the new value the tag must be a BOOL SINT INT DINT or REAL is the assignment symbol expression represents the new value to assign to the tag If tag isthis data type Use this type of expression BOOL BOOL expression SINT numeric expression INT DINT REAL ends the assignment Publication 1756 RMOOSI EN P January 2007 662 Structured Text Programm
41. ABS source Use ABS as a function This expression computes the absolute value of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text ABS 01 Function Block ABS E Absolute Value Operand Type Format Description ABS tag FBD MATH ADVANCED structure ABS structure Dest 3 Publication 1756 RMOOSI EN P January 2007 280 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS FBD_MATH_ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Value of which to take the absolute value Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The ABS instruction takes the absolute value of the Source and places Arithmetic Status Flags Fault Conditions Condition prescan Execution the result in the Destination Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Destination Source The rung condition out is set to true postscan The rung conditi
42. ACC value is set to PRE EN TT and DN are cleared ACC value is set to PRE instruction first run EN TT and DN are cleared ACC value is set to PRE EN TT and DN are cleared ACC value is set to PRE Enableln is cleared EnableOut is cleared the instruction does nothing and the outputs are not updated na Enableln is set When Enableln transitions from cleared to set the instruction initializes as described for instruction first scan The instruction executes EnableOut is set Enableln is always set The instruction executes reset When the Reset input parameter is set the When the Reset input parameter is set the instruction clears EN TT and DN and sets instruction clears EN TT and DN and sets ACC PRE Note that this is different than usinga ACC PRE Note that this is different than using a RES instruction on a TOF instruction RES instruction on a TOF instruction postscan No action taken No action taken Publication 1756 RMOOSI EN P January 2007 Example Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 117 Each scan after limit switcb1 is cleared the TOFR instruction increments the ACC value by elapsed time until the ACC value reaches the PRE value When ACC 2 PRE the DN parameter is cleared and timer state2 is set Structured Text TOFR_01 Prese TOFR_01 Reset t 500 reset OFR Ol Timer Enable
43. Attribute Data Type Instruction CSTOffset DINT 2 GSV SSV Description Positive offset from the CurrentValue of the CST object coordinated system time see page 5 181 DINT 0 contains the lower 32 bits of the value DINT 1 contains the upper 32 bits of the value Value in usecs The default is 0 CurrentValue DINT 2 GSV SSV Current value of the wall clock time DINT 0 contains the lower 32 bits of the value DINT 1 contains the upper 32 bits of the value The value is the number of microseconds that have elapsed since 0000 hrs 1 January 1972 The CST and WALLCLOCKTIME objects are mathematically related in the controller For example if you add the CST CurrentValue and the WALLCLOCKTIME CTSOffset the result is the WALLCLOCKTIME CurrentValue DateTime DINT 7 GSV SSV Publication 1756 RMOOSI EN P January 2007 The date and time in a readable format DINT 0 year DINT 1 integer representation of month 1 12 DINT 2 integer representation of day 1 31 DINT 3 hour 0 23 DINT 4 minute 0 59 DINT 5 seconds 0 59 DINT 6 microseconds 0 999 999 Input Output Instructions MSG GSV SSV IOT 197 GSV SSV Programming Get Fault Information Example The following examples use GSV instructions to get fault information Example 1 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 Relay Ladder
44. DN BOOL The done bit is set to indicate that the FIFO is full POS LEN The DN bit inhibits loading the FIFO until POS LEN EM BOOL The empty bit indicates that the FIFO is empty If LEN lt 0 or POS lt 0 both the EM bit and DN bit are set LEN DINT The length specifies the maximum number of elements the FIFO can hold at one time POS DINT The position identifies the location in the FIFO where the instruction will load the next value Description Use the FFL instruction with the FFU instruction to store and retrieve IMPORTANT Arithmetic Status Flags Fault Conditions 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 You musttest and confirm that the instruction doesn t change data that you don t want it to change The FFL instruction operates on contiguous memory In some cases the instruction loads data past the array into other members of the tag This happens if the length is too big and the tag is a user defined data type not affected A Major Fault Will Occur If Fault Type Fault Code starting element POS gt FIFO array size 4 20 Publication 1756 RMO
45. Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is false EnableOut is cleared Enableln is true The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 231 Example If value_1 is less than value_2 set light_3 If value_1 is greater than or equal to value_2 clear light_3 Relay Ladder LES Less Than A B Source value 1 oe light_3 SourceB value 2 pe Structured Text light 3 value 1 value 2 Function Block LES 01 LS g Less Than A B 0 SourceB light 3 Publication 1756 RMOOSI EN P January 2007 232 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Limit LIM The LIM instruction tests whether the Test value is within the range of the Low Limit to the High Limit Operands Relay Ladder LIM Limit Test CIRC Low Limit E Operand Type Format Description Test 2 Low limit SINT immediate value of lower limit High Limit INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Test SINT immediate value to test INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension High limit SINT immediate value of upper limit INT tag
46. No action taken Publication 1756 RMOOSI EN P January 2007 246 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Example If va ue 1 is not equal to value_2 set light_4 If value 1 is equal to value 2 clear ligbt 4 Relay Ladder EQ light 4 Not Equal Source value 1 De SourceB value 2 De Structured Text light 4 value 1 lt gt value 2 Function Block NEQ 01 Not Equal C SourceB Publication 1756 RMOOSI EN P January 2007 Chapter Introduction If You Want To evaluate an expression Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS The compute math instructions evaluate arithmetic operations using an expression or a specific arithmetic instruction Use This Instruction Available In These Languages See Page CPT relay ladder 249 structured text add two values ADD relay ladder 253 structured text function block subtract two values SUB relay ladder 257 structured text function block multiply two values divide two values MUL relay ladder 260 structured text function block DIV relay ladder 263 structured text function block determine the remainder after one value is divided by another MOD relay ladder 268 structured text function block Publication 1756 RMOOSI EN P January 2007 248 Compute Math Instructions CPT ADD SUB
47. Operand Source A Source B Relay Ladder Type SINT INT DINT REAL string The LES instruction tests whether Source A is less than Source B Format Description immediate value to test against Source B tag Source B SINT INT DINT REAL string immediate value to test against Source A tag e If you enter a SINT or INT tag the value converts to a DINT value by sign extension e String data types are default STRING data type e any new string data type that you create e To test the characters of a string enter a string tag for both Source A and Source B Structured Text amp IF sourceA sourceB THEN Use the less than sign lt as an operator within an expression This expression evaluates whether sourceA is less than sourceB See Appendix for information on the syntax of expressions within structured text statements LES 01 LES ss Less Than A B Operand LES tag O SourceA Dest Q SourceB Publication 1756 RMOOSI EN P January 2007 Function Block Type FBD COMPARE Format Description structure LES structure Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 229 FBD_ COMPARE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to test against SourceB Valid any float Sou
48. Select the Configuration tab You must click OK or Apply for any changes to take effect In this field PID equation Specify 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 eliminate 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 CV low limit Deadband value No derivative smoothing Enter a low limit for the control variable MINO Enter a deadband value DB 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 Specifying Alarms Select the Alarms tab You must click OK or Apply for any cha
49. any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description If Source B the divisor is zero e a minor fault occurs Type 4 program fault Code 4 arithmetic overflow e the destination is set as follows Source B Is Zero And And The Destinationlsa And The Resultis Then The Destination Is Set To all operands are integers SINT INT gt gt Source A or DINT at least one operand is a REAL SINT INT or DINT positive 1 negative 0 REAL positive 1 positive infinity negative 1 negative infinity To detect a possible divide by zero examine the minor fault bit S MINOR See Logix5000 Controllers Common Procedures publication 1756 PMO001 Publication 1756 RMOOSI EN P January 2007 270 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Arithmetic Status Flags Fault Conditions Execution Condition prescan Arithmetic status flags are affected A Minor Fault Occurs If Fault Type Fault Code the divisor is zero 4 4 Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Destination Source A TRN Source A Source B Source B The rung condition out is set to true po
50. array timer 0 acco 0 COP array timer 0 array timer 1 10 END IF Publication 1756 RMOOSI EN P January 2007 364 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE File Fill FLL Operands Fill File Source Dest Lenath Publication 1756 RMOOSI EN P January 2007 The FLL instruction fills elements of an array with the Source value The Source remains unchanged Relay Ladder Operand Type Format Description Source SINT immediate element to copy INT tag Important the Source and Destination operands should be the same data type or DINT unexpected results may occur REAL Destination SINT tag initial element to be overwritten by the Source INT Important the Source and Destination DINT operands should be the same data type or unexpected results may occur REAL The preferred way to initialize a structure is structure to use the COP instruction Length DINT immediate number of elements to fill Structured Text Structured text does not have an FLL instruction but you can achieve the same results using a SIZE instruction and a FOR DO or other loop construct SIZE destination 0 length FOR position 0 TO length 1 DO destination position source END FOR See Appendix B for information on the syntax of constructs within structured text Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 365 Description
51. default STRING data type any new string data type that you create e To test the characters of a string enter a string tag for both Source A and Source B Structured Text Use the greater than sign gt as an operator within an expression This expression evaluates whether sourceA is greater than sourceB See Appendix for information on the syntax of expressions within structured text Function Block Operand Format GRT tag Type FBD COMPARE Description structure GRT structure Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 221 FBD_ COMPARE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to test against SourceB Valid any float SourceB REAL Value to test against SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition out for the relay ladder GRT instruction Description The GRT instruction tests whether Source A is greater than Source B When you compare strings e The hexadecimal values of the characters determine if one string is less than or greater than another string For the hex code of a character see the back cover of this manual e When the two strings are sorted as in a telephone d
52. element number 0 SIZE SINT array 0 SINT array size Repeat Until SINT array element number String tag DATA element number SINT array element number element number element number 1 String tag LEN element number If element number SINT array size then exit end if 13 end repeat Structured Text Programming 687 Comments To make your structured text easier to interpret add comments to it e Comments let you use plain language to describe how your structured text works e Comments do not affect the execution of the structured text To add comments to your structured text To Add A Comment Use One Of These Formats on a single line comment at the end of a line of structured text comment comment within a line of structured text comment comment that spans more than one line start of comment end of comment start of comment end of comment Publication 1756 RMOOSI EN P January 2007 688 Structured Text Programming Format comment For example Example At the beginning of a line comment comment Check conveyor belt direction IF conveyor direction THEN At the end of a line ELSE If conveyor isn t moving set alarm light light 1 END IF Sugar Inlet 1 open the inlet IF Sugar Low low level LS amp Sugar High high level LS THEN
53. limit switchl TOFR TOFR 01 timer state2 Function Block limit switch1 E TOFR_01 DN TOFR 01 TOFR E Timer Off Delay with Reset 0 TimerEnable t timer state2 Publication 1756 RMOOSI EN P January 2007 118 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Retentive Timer On with Reset RTOR Operands RTOR RTOR tag RTOR zz Retentive Timer On with Reset EF TimerEnable ACC Input Parameter Data Type The RTOR instruction is a retentive timer that accumulates time when TimerEnable is set This instruction is available in relay ladder as two separate instructions RTO see page 4 105 and RES see page 136 Structured Text Variable Type Format Description RTOR tag FBD TIMER structure RTOR structure Function Block Operands Operand Type Format Description RTOR tag FBD TIMER structure RTOR structure FBD TIMER Structure Description Enableln BOOL Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes 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 1msec units that ACC must reach before timing is finished If invalid the instruction sets the appropria
54. 0 The 1 0 configuration of the controller doesn t have any of the modules that you need for the message Go across the backplane r to the local communication module on slot 1 r Go out the ControlNet port to node 4 Go across the backplane to the module in slot 0 Path EE 4 1 0 Browse ous CEU To type a path use this format port next address port next address Publication 1756 RMOOSI EN P January 2007 Where port Input Output Instructions MSG GSV SSV IOT 167 next address Is For this network Type backplane 1 DF1 serial serial 2 channel 0 ControlNet EtherNet IP DH channel A DH channel B 3 DF1 channel 1 serial channel 1 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 You can specify a module on an EtherNet IP network using any of these formats IP address IP address Port DNS name DNS name Port for example tanks 24 for example 10 10 10 for example tanks for example 10 10 10 10 10 24 Publication 1756 RMOOSI EN P January 2007 168 Input Output Instructions MSG GSV SSV IOT For Block Transfers For block transfer messages add the following modules to the I O configuration of the controller Fo
55. 1 least severe Default 500 Specifies the limit for a decreasing rate of change in units per second Detection is enabled for any value gt 0 0 if ROCPeriod is also gt 0 0 Valid 0 0 to maximum possible float Default 0 0 Specifies the severity of the negative rate of change alarm condition Valid 1 to 1000 1000 most severe 1 least severe Default 500 ROCPeriod Publication 1756 RMOOSI EN P January 2007 REAL Specifies the time period in seconds for calculation of the ROC value This value specifies the sampling interval for calculating the ROC value Each time the sampling interval expires the difference between the current sample and the previous sample is divided by the time interval Rate of change detection is enabled for any value 0 0 Valid 0 0 to maximum possible float Default 0 0 Output Parameter EnableOut Output Parameters Data Type BOOL Analog Alarm Instruction ALMA 55 Description System defined output parameter Follows the state of Enableln InAlarm BOOL Indicates whether any alarm condition is active Set at least one Alarm condition active InAlarm Cleared all Alarm conditions inactive AnylnAlarmUnack HHInAlarm BOOL BOOL Indicates whether any alarm condition is detected and unacknowledged Set at least one Alarm condition is both active InAlarm and unacknowledged Cleared all Alarm cond
56. 253 Add ADD The ADD instruction adds Source A to Source B and places the result in the Destination Operands Relay Ladder ADD Add Source i Operand Type Format Description Source B 7 Source A SINT immediate value to add to Source B Dest f INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Source B SINT immediate value to add to Source A INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL E Structured Text dest sourceA sourceB Use the plus sign as an operator within an expression This expression adds sourceA to sourceB and stores the result in dest See Appendix for information on the syntax of expressions within structured text ADD 01 Function Block ADD Operand Type Format Description ADD tag FBD MATH structure ADD structure Sources Dest SourceB Publication 1756 RMOOSI EN P January 2007 254 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Input Parameter Data Type FBD_MATH Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to add to SourceB Valid any float SourceB REAL Value to add to SourceA Output Parameter Data Type EnableOut BOOL Dest REAL Description Arithmetic Statu
57. 852 2887 4788 Fax 852 2508 1846 Headquarters for Dodge and Reliance Electric Products Americas Rockwell Automation 6040 Ponders Court Greenville SC 29615 4617 USA Tel 1 864 297 4800 Fax 1 864 281 2433 Europe Middle East Africa Rockwell Automation Herman Heinrich Gossen Strasse 3 50858 K ln Germany Tel 49 0 2234 379410 Fax 49 0 2234 3794164 Asia Pacific Rockwell Automation 55 Newton Road 11 01 02 Revenue House Singapore 307987 Tel 65 6356 9077 Fax 65 6356 9011 Publication 1756 RMOOSI EN P January 2007 PN 953014 68 Supersedes Publication 1756 RM003H EN P May 2005 Copyright 2007 Rockwell Automation Inc All rights reserved Printed in the U S A AB Allen Bradley Logix5000 Controllers General Instructions Reference Manual
58. ARD Channel Destination SerialPortControl Structured Text characters that were read The operands are the same as those for the relay ladder ARD instruction 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 Publication 1756 RMOOSI EN P January 2007 588 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT SERIAL PORT CONTROL Structure Mnemonic DataType Description 00 EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing EM BOOL The empty bit indicates that 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 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 numb
59. Alarm Condition ROCPos Condition In Time t7 Ack Request Alarm Condition ROCNeg Condition In Time t6 l I 4 l i l i 4 I l l l i T ROCPosAcked ROCNegAcked ROCPosinAlarm ROCNeglnAlarm ROCNeginAlarmTime OutOfAlarmTime LastAckTime ROCPosCount ROCNegCount Oo S o oO o o o o Activation M SeqCount 1 Time t1 Condition ROCNeg AlarmCount 1 sage Inactivation Message SeqCount 2 Time t2 Condition ROCNeg v i Activation Message Acknowledged SeqCount 4 Message Time t6 SeqCount 8 Condition ROCNeg Time t9 AlarmCount 2 Condition ROCPos i v Activation Message Acknowledged SeqCount 5 Message Time t7 SeqCount 9 Condition ROCPos Time t11 AlarmCount 1 Condition ROCNeg Inactivation Message SeqCount 6 Time t7 B Acknowledged Message SeqCount 3 Time t5 Condition ROCNeg Condition ROCNeg Y Inactivation Message SeqCount 7 Time t8 Condition ROCPos Publication 1756 RMOOSI EN P January 2007 68 Analog Alarm Instruction ALMA Alarm Rate of Change Acknowledge Not Required Alarm Condition Under this configuration this signal does not have ProgAckAll OperAckAll oe ae any influence on alarm state change ROCPoslnAlarm ROCNegInAlarm ROCPosAcked ROCNegAcked ROCPosCount ROCNegCount
60. If the result is zero then S Z is set postscan The rung condition out is set to false No action taken Example After reading the weight from a scale weight_read EM 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 Publication 1756 RMOOSI EN P January 2007 626 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Relay Ladder STOR String to Real Source weight ascii 428 259 Dest weight 428 259 weight read EM Structured Text IF weight read EM THEN STOR weight ascii weight weight read EM 0 END IF DINT to String DTOS The DTOS instruction produces the ASCII representation of a value Operands Relay Ladder DTOS DINT to String Source Operand Type Format Enter Notes Source SINT tag tag that contains the value If the Source is a REAL the instruction converts itto a DINT value Refer to REAL to an integer INT on page 640 DINT REAL Destination string tag tag to store the ASCII value String data types are e default STRING data type e any new string data type that you create Publication 1756 RMOOSI EN P January 2007 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 627 Enea eue tees Structured Text The operands are the same as those for the relay ladder DTOS instruction Des
61. January 2007 Special Instructions FBC DDT DTR PID 501 PID Structure Mnemonic Data Type Description CTL DINT The CTL member provides access to the status members bits in one 32 bit word The PID instruction sets bits 07 15 This Bit Is This Member 31 EN 30 CT 29 CL 28 PVT 27 DOE 26 SWM 25 CA 24 MO 23 PE 22 NDF 21 NOBC 20 NOZC This Bit Is This Member Which the PID Instruction Sets 15 NI 4 SPOR 13 OLL 2 OLH 11 EWD 10 DVNA 09 DVPA 08 PVLA 07 PVHA SP REAL setpoint KP REAL independent proportional gain unitless dependent controller gain unitless Kl 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 96 MAXS REAL maximum engineering unit scaling value MINS REAL minimum engineering unit scaling value Publication 1756 RMOOSI EN P January 2007 502 Special Instructions FBC DDT DTR PID Mnemonic Data Type Description DB REAL deadband engineering units SO REAL set output MAXO REAL maximum output limit 96 of output MINO REAL minimum output limit 96 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
62. Publication 1756 RMOOSI EN P January 2007 66 Analog Alarm Instruction ALMA Alarm Level Condition Acknowledge Not Required In Under this configuration this signal does not have ProgAckAll OperAckAll any influence on alarm state change T T t i i ise L i i HHInAlarm HinAlarm LinAlarm LLInAlarm HHAcked HAcked LAcked LLAcked HinAlarm LinAlarm LLinAlarm HHAcked HAcked LAcked LLAcked HinAlarmTime LinAlarmTime LLInAlarmTime RetToNormalTime LastAckTime HHInAlarmCount HinAlarmCount LinAlarmCount LLinAlarmCount i M Inactivation Me Inactivation Message Loggen acd SeqCount 5 SeqCount 8 PORC d Time t7 1 Time t10 Condition L Condition HH H Condition H CondCount 1 Inactivation Message Activation Message SeqCount 2 SeqCount 6 Time t3 Time t8 Condition L Condition HH CondCount 2 i Activation Message Inactivation Message SeqCount 3 SeqCount 7 Time t4 Time t9 Condition H Condition HH CondCount 1 Activation Message SeqCount 4 Time t5 Condition HH CondCount 1 Publication 1756 RMOOSI EN P January 2007 Alarm Condition ProgAckAll OperAckAll Alarm Services ROCPosinAlarm ROCNeglnAlarm Analog Alarm Instruction ALMA 67 Alarm Rate of Change Acknowledge Required Ack Request
63. SourceB value_2 o Structured Text light 1 value 1 gt value 2 Function Block GRT 01 GRT m Greater Than A gt B Sources a light 1 SourceB Publication 1756 RMOOSI EN P January 2007 224 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Less Than or Equal to LEQ The LEQ instruction tests whether Source A is less than or equal to Source B Operands Relay Ladder LEQ PA gis sd Operand Type Format Description 7 Source A SINT immediate value to test against Source B Source B INT tag DINT REAL string Source B SINT immediate value to test against Source A INT tag DINT REAL string e If you enter a SINT or INT tag the value converts to a DINT value by sign extension e String data types are default STRING data type any new string data type that you create e To test the characters of a string enter a string tag for both Source A and Source B E Structured Text IF sourceA lt sourceB THEN Use adjacent less than and equal signs lt as an operator within an lt statements gt expression This expression evaluates whether sourceA is less than or equal to sourceB See Appendix for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 SourceA SourceB LEQ 01 LEQ zz Less Than or Eq A B Dest f Compare Instructions CMP
64. Start Dest The operands are the same as those for the relay ladder INSERT instruction Description The INSERT instruction adds the characters in Source B to a designated position within Source A and places the result in the Destination e Start defines where in Source A that Source B is added e Unless SourceA and the Destination are the same tag Source A remains unchanged Publication 1756 RMOOSI EN P January 2007 ASCII String Instructions CONCAT DELETE FIND INSERT MID 615 Arithmetic Status Flags not affected Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is 1 Check that no instruction is writing to the LEN member of the string tag greater than the DATA size of the string tag 2 In the LEN value enter the number of characters that the string contains 4 56 The Start value is invalid Check that the Start value is between 1 and the DATA size of the Source Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction inserts the specified characters postscan The rung condition out is set to false No action ta
65. The number of bytes filled is Byte count Length number of bytes in the Destination data type IMPORTANT You must test and confirm that the instruction doesn t change data that you don t want it to change The FLL instruction operates on contiguous data memory In some cases the instruction writes past the array into other members of the tag This happens if the length is too big and the tag is a user defined data type If the tag is user defined data type Then If the Length is too big the instruction writes past the end of the array into other members of the tag It stops at the end of the tag No major fault is generated NOT user defined data type If the Length is too big the instruction stops at the end of the array No major fault is generated The Length is too big if it is more than the total number of elements in the Destination array For best results the Source and Destination should be the same type If you want to fill a structure use the COP instruction see example 3 on page 9 362 If you mix data types for the Source and Destination the Destination elements are filled with converted Source values 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 SINT structure SINT not converted INT structure INT not converted D
66. if the PID loop is in a 250 millisecond periodic task use a loop update time of 250 milliseconds CUPD 25 and configure the analog input module to produce data at least about every 25 to 50 msecs 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 PID_timer dn PID timer DN Special Instructions FBC DDT DTR PID 513 Relay Ladder TON Timer On Delay Timer PID_timer Preset 1000 Accum of PID Proportional Integral Derivative ES PID TiC101 EE Process variable Local 0 ChOData Tieback Local 0 1 Ch1Data Control variable Local 1 0 Ch0Data PID Master Loop 0 Inhold bit Local 1 1 Ch0lnHold Inhold Value Local 1 l ChOD ata Setpoint 0 0 Process Variable 0 0 Output 0 0 Structured Text PID_timer pre 1000 TONR PID timer IF PID timer DN THEN PID TIC101 Local 0 I ChOData Local 0 I ChlData jocal 1 0 ChOData 0 Local 1 I ChOInHold ijocal 1 I ChO0Data END IF 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
67. one shot rising 83 one shot rising with input 89 ONS instruction 80 operators 209 251 347 355 order of execution structured text 669 OR instruction 308 order of execution 644 structured text expression 669 order of operation 210 252 348 356 OREF 641 OSF instruction 86 Publication 1756 RMOOSI EN P January 2007 OSFI instruction 92 OSR instruction 83 OSRI instruction 89 OTE instruction 74 OTL instruction 76 OTU instruction 78 output enable or disable end of task processing 194 update immediately 200 output biasing 518 output energize 74 output latch 76 output reference 641 output unlatch 78 output wire connector 641 overflow conditions 649 overlap check for task overlap 194 P pause SFC instruction 462 PID instruction alarms 507 configuring 505 deadband 517 feedforward 518 operands 499 output biasing 518 scaling 508 tuning 506 PID structure 501 postscan structured text 662 product codes 177 program control instructions AFI 458 EOT 460 EVENT 466 introduction 435 JMP 436 JSR 438 LBL 436 MCR 454 NOP 459 RET 438 SBR 438 TND 452 UID 456 UIE 456 PROGRAM object 190 program operator control overview 655 proportional integral and derivative 499 RAD instruction 559 radians 559 REAL to String 629 relational operators structured text 666 REPEAT UNTIL 684 RES instruction 136 reset 136 reset SFC instruction 464 RESULT structure 481 489 RET instruction 438 476 retentive timer on 1
68. set a bit for one scan each time the input bit is OSH structured text 92 cleared in function block function block f There is no equivalent structured text instruction Use other structured text programming to achieve the same result See the description for the instruction Publication 1756 RMOOSI EN P January 2007 70 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Examine If Closed XIC Operands Description Arithmetic Status Flags Fault Conditions Execution Condition prescan The XIC instruction examines the data bit to see if it is set Relay Ladder Operand Type Format Description data bit BOOL tag bit to be tested Structured Text Structured text does not have an XIC instruction but you can achieve the same results using an IF THEN construct IF data bit THEN statement END IF See Appendix B for information on the syntax of constructs within structured text The XIC instruction examines the data bit to see if it is set not affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Y examine data bit data bit 1 rung condition out is set data bit 0 rung condition out is set to false to true gt Y postscan Publication 1756 RMOOSI EN P January 2007 The ru
69. 0 0 0 0 1 1 1 1 0 0 0 0 E these bits shift right Publication 1756 RMOOSI EN P January 2007 396 Array File Shift Instructions BSL BSR FFL FFU LFL LFU FIFO Load FFL The FFL instruction copies the Source value to the FIFO Operands Relay Ladder FFL FIFO Load N 5 Operand Type Format Description Source L XDN FIFO L cEMS Source SINT immediate data to be stored in the FIFO Control Length INT tag Position DINT REAL string structure The Source converts to the data type of the array tag A smaller integer converts to a larger integer by sign extension FIFO SINT array tag FIFO to modify INT specify the first element of the FIFO DINT do not use CONTROL POS in the subscript REAL string 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 initial value is typically 0 If you use a user defined structure as the data type for the Source or FIFO operand use the same structure for both operands Publication 1756 RMOOSI EN P January 2007 Array File Shift Instructions BSL BSR FFL FFU LFL LFU 397 CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the FFL instruction is enabled
70. 59 Description Timestamp of most recent condition acknowledgement If the alarm does not require acknowledgement 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 DeliveryER BOOL Indicates alarm notification message delivery error Set delivery error either no alarm subscriber was subscribed or at least one subscriber did not receive the latest alarm change state message Cleared delivery successful or in progress DeliveryDN BOOL Indicates alarm notification message delivery success Set delivery success at least one subscriber was subscribed and all subscribers received the latest alarm change state message successfully Cleared delivery not completed successfully or in progress DeliveryEN BOOL Indicates alarm notification message delivery in process Set delivery in progress Cleared delivery not in progress NoSubscriber BOOL Indicates that the alarm had no subscribers when attempting to deliver the most recent state change message Set no subscribers Cleared At least one subscriber NoConnection BOOL Indicates that all of the alarm s subscribers were disconnected when attempting to deliver the most recent state change message Set
71. 646 3525 Email RADocumentComments ra rockwell com Publication ICCG 5 21 January 7001 PN 955107 62 Other Comments PLEASE FASTEN HERE DO NOT STAPLE PLEASE FOLD HERE BUSINESS REPLY MAIL FIRST CLASS MAIL PERMIT NO 18235 CLEVELAND OH POSTAGE WILL BE PAID BY THE ADDRESSEE Allen Bradley RELIANCE M ELECTRIC ROCKWELL FESS SOFTWARE DO DGE Rockwell Automation 1 ALLEN BRADLEY DR MAYFIELD HEIGHTS OH 44124 9705 NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES PLEASE REMOVE Rockwell Automation Rockwell Automation provides technical information on the web to assist you in using its products At http support rockwellautomation com you can find Support technical manuals a knowledge base of FAQs technical and application notes sample code and links to software service packs and a MySupport feature that you can customize to make the best use of these tools For an additional level of technical phone support for installation configuration and troubleshooting we offer TechConnect Support programs For more information contact your local distributor or Rockwell Automation representative or visit http support rockwellautomation com Installation Assistance If you experience a problem with a hardware module within the first 24 hours of installation please review the information that s contained in this manual You can also contact a special Customer
72. 96 100 105 SUB instruction 257 subroutine 438 subtraction 257 swap byte 301 SWPB instruction 301 synchronous copy 358 T TAN instruction 529 tangent 529 task configure programmatically 194 inhibit 194 monitor 194 trigger event task 466 trigger via consumed tag 200 TASK object 194 temporary end 452 timeout configure for event task 194 timer instructions introduction 95 RES 136 RTO 105 RTOR 118 TOF 100 TOFR 114 TON 96 TONR 110 timer off delay 100 timer off delay with reset 114 timer on delay 96 timer on delay with reset 110 TIMER structure 96 100 105 timing modes 650 TND instruction 452 TOD instruction 562 TOF instruction 100 TOFR instruction 114 TON instruction 96 TONR instruction 110 trigger event task 466 trigger event task instruction 466 trigonometric instructions ACS 536 ASN 532 ATN 540 COS 525 introduction 521 SIN 522 TAN 529 TRN instruction 567 truncate 567 tuning 506 Index 699 U UID instruction 456 UIE instruction 456 unresolved loop function block diagram 645 update output 200 upper case 631 UPPER instruction 631 user interrupt disable 456 user interrupt enable 456 W WALLCLOCKTIME object 196 WHILE DO 681 X Xto the power of Y 552 XIO instruction 72 XOR instruction 311 XPY instruction 552 Publication 1756 RMOOSI EN P January 2007 700 Index Publication 1756 RMOOSI EN P January 2007 How Are We Doing PANE Your comments on our technical publications will hel
73. ALMA Analog Alarm Operands These operands are located on the instruction D e Ladder Logic Operands Operand Type Format Description ALMA tag ALARM ANALOG structure ALMA structure In REAL Tag Value is copied to In when DINT Immediate instruction executes The INT alarm input value which is SINT compared with alarm limits to detect the alarm conditions ProgAckAll BOOL Tag Value is copied to ProgAckAll Immediate when instruction executes On transition from False to True acknowledges all alarm conditions that require acknowledgement ProgDisable BOOL Tag Value is copied to Immediate ProgDisable when instruction executes When True disables alarm does not override Enable Commands ProgEnable BOOL Tag Value is copied to ProgEnable Immediate when instruction executes When True enables alarm takes precedence over Disable commands HHlimit REAL Immediate High High alarm limit HLimit REAL Immediate High alarm limit LLimit REAL Immediate Low alarm limit LLLimit REAL Immediate Low low alarm limit Structured Text Operands Fas ALMA ALMA In ProgAckAl1 ProgDisable ProgEnable Publication 1756 RMOOSI EN P January 2007 Analog Alarm Instruction ALMA 49 Operand Type Format Description ALMA ALARM ANALOG structure ALMA structure In REAL Tag Value is copied to In when DINT Immediate instruction executes The INT alarm input value which is SINT compared w
74. ARS CAS io Ed E EI d I cL 0 A 16650 timer did not reach PRE value Set the Reset input parameter to reset the instruction If TimerEnable is cleared when Reset is set the TOFR instruction does not begin timing again when Reset is cleared How a Timer Runs A timer runs by subtracting the time of its last scan from the time now ACC ACC current_time last time scanned Publication 1756 RMOOSI EN P January 2007 116 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES After it updates the ACC the timer sets last time scanned current time This gets the timer ready for the next scan Make sure to scan the timer at least every 69 minutes while it runs Otherwise the ACC value IMPORTANT i won t be correct The ast 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 wont be correct if this happens While a timer runs scan it within 69 minutes if you put it in a e subroutine e section of code that is between JMP and LBL instructions e sequential function chart SFC e event or periodic task e state routine of a phase Arithmetic Status Flags not affected Condition prescan Fault Conditions none Execution Function Block Action No action taken Structured Text Action No action taken instruction first scan EN TT and DN are cleared
75. B Reset HS Detail Status Ok Function Block Attributes 657 Likewise constantly setting the ProgProgReq can lock the instruction into Program control This is useful for automatic startup sequences when you want the program to control the action of the instruction without worrying about an operator inadvertently taking control of the instruction In this example you have the program set the ProgProgReq input during the startup and then clear the ProgProgReq input once the startup was complete Once the ProgProgReq input is cleared the instruction remains in Program control until it receives a request to change For example the operator could set the OperOperReq input from a faceplate to take over control of that instruction The following example shows how to lock an instruction into Program control FuelFlowController PIDE Enhanced PID g SPProg SPD g SPCascade PVHHAlarm StartupCV ai J RatioProg PVHAlarm 3 CVProg PVLAlarm 3 GFF PVLLAIarm 5 C HandFB PVROCPosAlarm 3 StartupSequenceActive p F ProgProgReq PVROCNegAlarm D E ProgOperReq DevHHAlarm D E ProgCasRatReq DevHAlarm ProgAutoReq DevLAlarm 5 L ProgManualReq DevLLAlarm 3 When StartupSequenceActive ubi pore is set the PIDE instruction is amp ProgHandReq CasRat zi placed in Program control and Auto 3 Manual mode The StartupCV Manual fp value is used as the loop output Gv nide Lh Hand
76. Bridge response too large same as description 001C Attribute list shortage same as description Publication 1756 RMOOSI EN P January 2007 nput Output Instructions MSG GSV SSV IOT 149 Error Code Description Display In Software Hex 001D Invalid attribute list same as description 001E Embedded service error same as description 001F Connection related failure see extended error codes same as description 0022 Invalid reply received same as description 0025 Key segment error same as description 0026 Invalid IOI error same as description 0027 Unexpected attribute in list same as description 0028 DeviceNet error invalid member ID same as description 0029 DeviceNet error member not settable same as description 00D1 Module not in run state unknown error OOFB Message port not supported unknown error OOFC Message unsupported data type unknown error OOFD Message uninitialized unknown error OOFE Message timeout unknown error OOFF General error see extended error codes unknown error Publication 1756 RMOOSI EN P January 2007 150 Input Output Instructions MSG GSV SSV IOT Extended Error Codes RSLogix 5000 software does not display any text for the extended error codes These are the extended error codes for error code 0001 Extended Description Extended Description Error Code Error Code Hex Hex 0100 Connection in use 0203 Connection timeout 01
77. DATA member of the string 1 tag which is a string The 74 counts as one character It is the 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 Relay Ladder AWA ASCII Write Append EN Channel Source string 1 DND 1425 1 SerialPort Control temp_high_write ERD SerialPort Control Length 5 Characters Sent 6 Structured Text IF temp high THEN temp high write LEN 5 AWA 0 string 1 temp high write temp high 0 END IF Example 2 alarm ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 599 When alarm is set 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 Relay Ladder MOV AWA Move ASCII Write Append EN Source alarm msg LEN Channel 0 5 Source alarm msg ND Dest alarm write LEN 1425 1 5 SerialPort Control alarm_write ERD SerialPort Control Length 5 Characters Sent 6 Structured Text osri l InputB
78. Diagrams llle 43 Alarm Acknowledge Required and Latched 43 Alarm Acknowledge Required and Not Latched 44 Alarm Acknowledge Not Required and Latched 45 Alarm Acknowledge Not Required and Not Latched 46 Chapter 2 Introduction a s s dat eX e b dc cab dese Ne 47 About Operator Parameters 2 adco kaw xy ao 47 Using the ALMA Instruction to Subscribe to and Display Alar MS E ao 7h scu olim Noe GAG e at dota Ree on 47 Analog Alarm Operands ad va v ui sieht ached CP LS 48 Ladder Logic Operands 452592 9349220 v3 284 48 Structured Text Operands 6 pony ace Ee pd dd 48 Function Block Operands ri og Eo ER CELO 49 Structure Definition For ALARM ANALOG Tag 50 Input Parameters 7 dos ace oboe Eo TOP d Rotes eS 50 Publication 1756 RMOOSI EN P January 2007 6 Table of Contents Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Input Output Instructions MSG GSV SSV IOT Publication 1756 RMOOSI EN P January 2007 Output Parameters ca Ve genesis roa GPW ee ditte Se 55 EAM NC ies qe fateh Oe aiken e Drac iet Que nde doe Ud 62 l dder LOCI cotes a Box bis Me Rd ado bare ae EO 62 Structured Dext 2d yes tee o eee ees eee cs 28 ese 62 Function Block S os ote deno Rd Ge OR eek Rane 63 I MTOM 3a 1o an vk eave dick ck ho ictal acts des breadth e bd 64 adder LOSC 45 eos Bower
79. EN P January 2007 412 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Condition Relay Ladder Action rung condition in is true EN bit is set p ii no es POS 0 Y EM bit is cleared EM bit is set yes POS 0 DN is cleared no Y EM bit is set EM bit is cleared yes DN bit is set Y no 8 yes mes EM bit is set POS or no LEN gt size of 8 array yes POS gt LEN W DN bit is set yes no POS gt LEN POS POS 1 4 no LIFO POS 1 source m rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Array File Shift Instructions BSL BSR FFL FFU LFL LFU 413 Example When enabled the LFL instruction loads value 1 into the next position in the LIFO which is array dint 5 in this example LFL LIFO Load N Source value 1 IN LIFO atray_dint O EM3 Control control_1 Length 10 Position 5 before LIFO load after LIFO load array_dint O 00000 00000 i di 1111 22222 22222 33333 control 1 pos 5 33333 44444 value 1 55555 44444 array din
80. EN P January 2007 582 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction clears the specified instructions and buffer s postscan The rung condition out is set to false No action taken Example When the controller enters Run mode clear the buffer and the ASCII queue Relay Ladder S FS ACL J E ASCII Clear Buffer Channel 0 Clear Serial Port Read 1 Clear Serial Port Write 1 Structured Text osri l InputBit S FS OSRI osri 1 IF osri l OutputBit THEN ACL 0 0 1 END IF Publication 1756 RMOOSI EN P January 2007 ASCII Handshake Lines AHL ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 583 The AHL instruction obtains the status of control lines and turns on or off the DTR and RTS signals Operands Relay Ladder AHL ASCII Handshake Lines Channel AND Mask OR Mask SerialPort Control Channel Status Decimal Operand Type Format Enter Channel DINT immediate 0 tag ANDMask DINT immediate Refer to t
81. EN P January 2007 Example 5 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 345 When enabled the FAL instruction divides the value in the current position of array 2 with the value in the current position of array 5 and stores the result in the current position of array 1 arithmetic operation array array to array FAL File Arith Logical N Control control 2 Length 10 N Position Mode Dest Expression atray_1 control_2 pos 0 0 array_2 control_2 pos amy 3 control 2 pos Example 6 FAL File Arith Logical Control control 1 Length e Position af Mode 6 Dest array_3 control_1 pos of Expression array_1 control_1 pos value_1 0 e all Destination Expression 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 arithmetic operation array element to array NH lt ER gt Example 7 FAL File Arith Logical Control control 1 Length 10 Position of Mode inc Dest Expression value 1 array 1 control 1 pos Expression Destination Each time the FAL instruction is enabled it adds value 1 to the current value of array 1 and stores the result i
82. Element e f you select a read message type the Destination Element is the first element of the tag in the Logix5000 controller where you want to store the data you read from the target device e f 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 Specify CIP Data Table Read and Write messages The CIP Data Table Read and Write message types transfer data between Logix5000 controllers 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 Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 157 Reconfigure an 1 0 module Use the Module Reconfigure message to send new configuration information to an I O module During the reconfiguration e Input modules continue to send input data to the controller e 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 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 reconfigurel 5 is set set the high alar
83. EnableIn and EnableOut parameters e function block instructions execute normally when EnableIn is set e when EnableIn is cleared the function block instruction either executes prescan logic postscan logic or just skips normal algorithm execution e EnableOut mirrors EnableIn however if function block execution detects an overflow condition EnableOut is also cleared e function block execution resumes where it left off when EnableIn toggles from cleared to set However there are some function block instructions that specify special functionality such as re initialzation when EnableIn toggles from cleared to set For function block instructions with time base parameters whenever the timing mode is Oversample the instruction always resumes were it left off when EnableIn toggles from cleared to set If the EnableIn parameter is not wired the instruction always executes as normal and EnableIn remains set If you clear EnableIn it changes to set the next time the instruction executes Publication 1756 RMOOSI EN P January 2007 22 Preface Notes Publication 1756 RMOOSI EN P January 2007 If the locator lists a page number Instruction Locator Where to Find an Instruction Use this locator to find the reference details about Logix instructions the grayed out instructions are available in other manuals This locator also lists which programming languages are available for the instructions The instruction
84. EnableOut BOOL The instruction produced a valid result Dest DINT Result of masked move instruction Arithmetic status flags are set for this output Description When enabled the MVMT instruction uses a Mask to either 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 Os so that they are the same size as the largest data type Enter 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 162 Description hexadecimal for example 16 0FOF 0f octal for example 8216 2 binary for example 2 00110011 Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions none Execution Condition Function Block Action Structured Text Action prescan No action taken No action taken instruction first scan No action taken No action taken instruction first run No action taken No action taken Enableln is cleared EnableOut is cleared the instruction does nothing na and the outputs are not updated Enableln is set The instruction executes Enableln is always set EnableOut is set The instruction executes postscan No action
85. F Output Master Out PVT Set ips Manual Limiting No Output Manual K oe Sotwae Yes A M Mode Auto Converts Binary to b Converts Units Engineering Units SP K to 96 Manuai T PV minimaxs mins _ Error X 100 Manual mins PV gt 95 iss maxi mini maxs mins Items referenced in this box are parameters units and modes as they pertain to the designated Slave loop AN PV Slave Loop Control Output Action Bias Sat e Software A M m Converts to SP SP PV Mode NM Station Output iViaster Outj Engineering Units oe Converts Units AU Mode X maxs mins F ue gt PD rmt 5 mins gt Error X 100 Calculation Auto Convert to CV Units PV SP maxs mins OX E Output Manual Limiting CV96 maxcv mincv dines gt gt Converts Binary to NS d Manuai 100 Engineering Units But PV mini maxs mins n maxi mini EDS Converts Tieback Units to AN tieback mintie x 100 N maxtie mintie PV Publication 1756 RMOOSI EN P January 2007 Chapter 15 Introduction If You Want To Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN The trigonometric instructions evaluate arithmetic operations using trigonometric operations Use This Instruction Available In These Languages See Page Take the sine of a value SIN relay ladder 522 structured text function block Take the cosine of a value COS relay ladder 525
86. 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 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 rung condition in goes from false to true Important Do not change the ER 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 rung condition in goes from false to true Important Do not change the DN bit ST BOOL Th
87. FLL SINT 16480 128 DINT 16 FFFF FF80 128 DINT 1641234 5678 SINT 16278 SINT 16701 REAL 1 0 REAL 2 0 INT 1620002 SINT 16401 TIMER 1620101 0101 1620101 0101 1620101 0101 INT 1620001 TIMER 1620001 0001 1620001 0001 1620001 0001 DINT 1640000 0001 TIMER 1620000 0001 1620000 0001 1620000 0001 Structured Text dest 1 value 1 Publication 1756 RMOOSI EN P January 2007 368 File Average AVE Operands AVE Average File Array Dim to vary Dest Control Length Position Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE The AVE instruction calculates the average of a set of values Relay Ladder Operand Type Format Description Array SINT array tag find the average of the values in this array INT specify the first element of the group of elements to average DINT do not use CONTROL POS in the subscript REAL Dimension DINT immediate which dimension to use to vary 0 1 2 depending on the number of dimensions the order is array dim 0 dim 1 dim 2 array dim_0 dim_1 array dim 0 Destination SINT tag result of the operation INT DINT REAL Control CONTROL tag control structure for the operation Length DINT immediate number of elements of the array to average Position DINT immediate current element in the array initial value is typically 0 Structured Text Structured text does not have an AVE instr
88. Format Expressions For each operator that you use in an expression you have to provide one or two operands tags or immediate values Use the following table to format operators and operands within an expression For Operators That Use This Format Examples Operate On one operand operator operand ABS tag a two operands operand aoperatoroperand b e tag b45 e tag c AND fag d e tag e 2 MOD tag f tag 9 Publication 1756 RMOOSI EN P January 2007 356 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Publication 1756 RMOOSI EN P January 2007 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 ACS ASN ATN COS DEG FRD LN LOG RAD SIN SOR TAN TOD TRN 3 2 4 negate NOT 5 MOD 6 lt lt gt gt 7 subtract 8 AND 9 XOR 10 OR Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 357 Use Strings In an Expression To use strings of ASCII characters in an expression follow these guidelines
89. IF the ABL instruction will execute every scan that ag xic is set not just when ag x c transitions from cleared to set Structured Text Programming 671 If you want the ABL instruction to execute only when ag x c transitions from cleared to set you have to condition the structured text instruction Use a one shot to trigger execution osri l InputBit tag xic OSRI osri 1 IF osri l OutputBit THEN ABL 0 serial control END IF Constructs Constructs can be programmed singly or nested within other constructs If You Want To Use This Construct Available In These Languages See Page do something if or when specific IF THEN structured text 672 conditions occur select what to do based on a numerical value CASE OF structured text 675 do something a specific number of times before FOR DO structured text 678 doing anything else keep doing something as long as certain WHILE DO structured text 681 conditions are true keep doing something until a condition is true REPEAT UNTIL structured text 684 Some key words are reserved for future use These constructs are not available e GOTO e REPEAT RSLogix 5000 software will not let you use them as tag names or constructs Publication 1756 RMOOSI EN P January 2007 672 Structured Text Programming IF THEN Use IF THEN to do something if or when specific conditions occur Operands Structured Text IF bool_expression THEN go
90. IF THEN construct and an assignment IF BOOL expression THEN data bit 1 END IF See Appendix B for information on the syntax of constructs expressions and assignments within structured text When enabled the OTL instruction sets the data bit The data bit remains set until it is cleared typically by an OTU instruction When disabled the OTL instruction does not change the status of the data bit not affected none Relay Ladder Action The data bit is not modified The rung condition out is set to false rung condition in is false The data bit is not modified The rung condition out is set to false rung condition in is true The data bit is set The rung condition out is set to true postscan Publication 1756 RMOOSI EN P January 2007 The data bit is not modified The rung condition out is set to false Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 71 Example When enabled the OTL instruction sets igbt 2 This bit remains set until it is cleared typically by an OTU instruction Relay Ladder light 2 CL Structured Text IF BOOL expression THEN light_2 1 END IF Publication 1756 RMOOSI EN P January 2007 78 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Output Unlatch OTU Operands Description Arithmetic Status Flags Fault Conditions Execution Condition prescan The OTU
91. Indicates whether the low low alarm condition is acknowledged Set Acknowledged Cleared Not acknowledged Always Set when AckRequired is false ROCPosAcked BOOL Indicates whether the positive rate of change alarm condition is acknowledged Set Acknowledged Cleared Not acknowledged Always Set when AckRequired is false ROCNegAcked Publication 1756 RMOOSI EN P January 2007 BOOL Indicates whether the negative rate of change alarm condition is acknowledged Set Acknowledged Cleared Not acknowledged Always Set when AckRequired is false Output Parameter HHInAlarmUnack HInAlarmUnack Data Type BOOL BOOL Analog Alarm Instruction ALMA 57 Description Indicates whether the high high alarm is active InAlarm and unacknowledged Set Alarm is both active InAlarm and unacknowledged Cleared Alarm is either inactive or acknowledged or both Indicates whether the high alarm is active InAlarm and unacknowledged Set Alarm is both active and unacknowledged Cleared Alarm is either inactive or acknowledged or both LInAlarmUnack BOOL Indicates whether the low alarm condition is active InAlarm and unacknowledged Set Alarm is both active and unacknowledged Cleared Alarm is either inactive or acknowledged or both LLInAlarmUnack BOOL Indicates whether the low low alarm condition is active InAlarm and unackno
92. Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 459 No Operation NOP Operands NOP Description Arithmetic Status Flags The NOP instruction functions as a placeholder Relay Ladder none 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 not affected Fault Conditions none Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The rung condition out is set to true postscan The rung condition out is set to false Example This instruction is useful for locating unconditional branches when you place the NOP instruction on the branch The NOP instruction bypasses the XIC instruction to enable the output limit switch 1 light 1 NOP Publication 1756 RMOOSI EN P January 2007 460 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT End of Transition EOT E LD Operands EOT data bit Arithmetic Status Flags Fault Conditions Description The EOT instruction returns a boolean state to an SFC transition Relay Ladder Operand Type Format Description data bit BOOL tag state of the transition O executing 1 completed
93. January 2007 Chapter 12 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Introduction Use the program control instructions to change the flow of logic If You Want To Use This Instruction Available In These Languages See Page Jump over a section of logic that does not JMP relay ladder 436 always need to be executed LBL Jump to a separate routine pass data to the JSR relay ladder 438 routine execute the routine and return results mm inerat iek structured text Jump to an external routine SoftLogix5800 JXR relay ladder 449 controller only Mark a temporary end that halts TND relay ladder 452 routine execution einander Disable all the rungs in a section of logic MCR relay ladder 454 Disable user tasks UID relay ladder 456 structured text Enable user tasks UIE relay ladder 456 structured text Disable a rung AFI relay ladder 458 Insert a placeholder in the logic NOP relay ladder 459 End a transition for a sequential function chart EOT relay ladder 460 structured text Pause a sequential function chart SFP relay ladder 462 structured text Reset a sequential function chart SFR relay ladder 464 structured text Trigger the execution of an event task EVENT relay ladder 466 structured text Publication 1756 RMOOSI EN P January 2007 436 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR U
94. Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller converts the Source to degrees and places the result in the Destination The rung condition out is set to true postscan Condition prescan The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 558 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Example Convert value to degrees and place the result in result Relay Ladder EG Radians To Degrees Source value 15 0 Dest result 859 43671 Structured Text result DEG value Function Block DEG 01 DEG xj Radians To Degrees value result Publication 1756 RMOOSI EN P January 2007 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 559 Radians RAD The RAD instruction converts the Source in degrees to radians and stores the result in the Destination Operands Relay Ladder RAD Degrees To Radians Operand Type Format Description Source Source SINT immediate value to convert to radians De
95. Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 297 Input Parameter Data Type Description 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 Output Parameter EnableOut Dest Valid any integer Data Type Description BOOL The instruction produced a valid result DINT Result of the bit move operation Arithmetic status flags are set for this output 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 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 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 Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions none Execution Condition Function Block Action Structured Text Action prescan No action taken No action taken instruction first scan No action taken No action taken instruction first run No action taken No action taken Enableln is cleared EnableOut is cleared the instruction does nothing na and the outpu
96. Logix5000 data type B INT F REAL N INT DINT Only write DINT values to a PLC 5 controller if the value is gt 32 768 and lt 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 The following diagrams show how the typed and word range commands differ The example uses read commands from a PLC 5 processor to a Logix5000 controller Typed read command Word range read command 16 bit words in 32 bit words in 16 bit words in 32 bit words in PLC 5 processor Logix5000 controller PLC 5 processor Logix5000 controller T 1 1 1 1 1 2 1 2 p 2 2 p 4 3 3 3 3 4 4 4 The typed commands maintain data structure and value The word range commands fill the destination tag contiguously Data structure and value change depending on the destination data type Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 161 Specify SLC messages Use the SLC message types to communicate with SLC and MicroLogix controllers The following table shows which data types that the instruction lets you access The table also shows the corresponding Logix5000 data type For this SLC or MicroLogix Data Type Use This Logix5000 Data Type F REAL L MicroLogix 1200 and 1500 c
97. MUL DIV MOD SOR SORT NEG ABS If You Want To Use This Instruction Available In These Languages See Page calculate the square root of a value SOR relay ladder 272 SQRT structured text function block take the opposite sign of a value NEG relay ladder 276 structured text function block take the absolute value of a value ABS relay ladder 279 f There is no equivalent structured text instruction 2 There is no equivalent structured text instruction B Structured text only Publication 1756 RMOOSI EN P January 2007 structured text function block Use other structured text programming to achieve the same result See the description for the instruction Use the operator in an expression 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 For relay ladder instructions 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 Compute CPT Operands CPT Compute Dest Expression Description Arithmetic Status Flags Fault Conditions Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 249 The CPT instruction performs the arithmetic operations you define in the expression Relay Ladder Opera
98. My Tag Member A O sto HE My Tag Member A 1 H My Tag Member B Tag is too small Minor fault My Tag is too small for the attribute So the GSV instruction stops and logs a minor fault Input Output Instructions MSG GSV SSV IOT 175 The GSV SSV Objects section shows each object s attributes and their associated data types For example the MajorFaultRecord attribute of the Program object needs a DINT 11 data type Arithmetic Status Flags not affected Fault Conditions A Minor Fault Will Occur If Fault Type Fault Code invalid object address 4 5 specified an object that does not support 4 6 GSV SSV invalid attribute 4 6 did not supply enough information for an SSV 4 6 instruction the GSV destination was not large enough to hold 4 7 the requested data Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction executes Get or set the specified value Get or set the specified value postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 176 X Input Output Instructions MSG GSV SSV I
99. P January 2007 242 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Example 2 If the masked value 1 is equal to the masked value_2 set ligbt 1 If the masked value 1 is not equal to the masked value 2 clear light_1 This example shows that the masked values are not equal A 0 in the mask restrains the instruction from comparing that bit shown by x in the example value 110 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 value 2 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 mask 110 0 0 0 00 0 0 0 0 0 0 1 1 1 1 mask 1 0 0100 0 0 0 00 0 0 0 1 1 1 1 Masked value 1 X X X X X X XIX X IX X x 1 1 1 1 Masked value 2 x X X X X XxX X X X X x x 0 0 0 0 Relay Ladder MEQ light_1 Mask Equal Source value 1 280101 0101 1111 1111 ask mask 1 2 0000_0000_0000_1111 Compare value 2 2 0101_0101_1111_0000 M Structured Text light 1 value 1 AND mask_1 value_2 AND mask 2 Function Block lt a Compare Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 243 Not Equal to NEQ The NEQ instruction tests whether Source A is not equal to Source B Operands Relay Ladder NEQ Not Equal inti aT A Operand Type Format Description Source A SINT immediate value to test aga
100. Port SERIAL PORT tag tag that controls the operation Control CONTROL Serial Port DINT immediate number of characters to e he Serial Port Control Length must be less Control Length send than or equal to the size of the Source e f 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 AWA Channel Source SerialPortControl characters that were sent Structured Text The operands are the same as those for the relay ladder AWA instruction However you 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 Publication 1756 RMOOSI EN P January 2007 596 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT SERIAL PORT CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing EM BOOL The empty bit indicates that the instruction is done but it is synchronous to the logic scan ER BOOL The error bit indicates whe
101. Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 463 Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction pauses or resumes execution of the specified SFC routine postscan The rung condition out is set to false No action taken Example If s c en p is set pause the SFC routine named normal Restart the SFC when sc en e is set Relay Ladder Pause the SFC routine sfp en p SFI SFC Pause SFC Routine Name normal Target State Paused Resume executing the SFC routine SF sfp_en_e SFC Pause SFC Routine Name normal Target State Executing Structured Text Pause the SFC routine IF sfp en p THEN SFP normal paused sfp_en_p 0 END IF Publication 1756 RMOOSI EN P January 2007 464 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Resume executing the SFC routine SFC Reset SFR Operands SFC Reset SFC Routine Name Step Name SFR SFCRoutineName StepName Desc
102. RTO TONR TOFR RTOR CTU CTD CTUD RES Timer On Delay TON The TON instruction is a non retentive timer that accumulates time when the instruction is enabled rung condition in is true This instruction is available in structured text and function block as TONR see page 4 110 Operands Relay Ladder TON nti Timer On Delay cE N5 Operand Type Format Description iw CDN2 Timer TIMER tag timer structure reset Accum Preset DINT immediate how long to delay accumulate time Accum DINT immediate total msec the timer has counted initial value is typically 0 TIMER Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the TON instruction is enabled AT BOOL The timing bit indicates that a timing operation is in process DN BOOL The done bit is set when ACC gt PRE PRE DINT The preset value specifies the value 1 msec units which the accumulated value must reach before the instruction sets the DN bit 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 until Publication 1756 RMOOSI EN P January 2007 e the TON instruction is disabled e the ACC 2 PRE The time base is always 1 msec For example for a 2 second timer enter 2000 for the PRE value Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 97 When the TO
103. S rn UNEP Bd 64 Function Block a esa aang ae eta ke ERE ced E 64 Analog State Timing Diagrams 000005 65 Alarm Level Condition Acknowledge Required 65 Alarm Level Condition Acknowledge Not Required 66 Alarm Rate of Change Acknowledge Required 67 Alarm Rate of Change Acknowledge Not Required 68 Chapter 3 HAthO Gino ex Soak ese BU KS fae E NOE E 69 Examine If Closed XICO uo us oe od oe mI dS REP 70 Examine If Open OO e qas tog dpi ibo a os Gade dod ated 72 Output Energize COTE niin Wei tale oan KOR SIRS 74 Output Latch OTD an at age A dense oe aes e ae DEP C4 76 Ontput Unlateh OTED spr uad cale Gea e Reb Re e vi 78 One Shot CONS x gatur doe CR ERU diea dede 80 One Shot Rising OSR sa ur pitt dep tiene WY pera has woes 83 One Shot Falling OSF ee e dependen 86 One Shot Rising with Input OSRD 4 ente a eec 89 One Shot Falling with Input OSFD 92 Chapter 4 ItEOQUICHODE d a se nome ut e e ee Pe yd T e d 95 Timer On Delay TON nae ied eee Br Rees 96 Tuner Of Delay TOF reens RO SONY amp IE SAC RR 100 Retentive Timer On RTO 96 4 riu ped oor 5 s OS 105 Timer On Delay with Reset TONR 110 Timer Off Delay with Reset TOFR 00 114 Retentive Timer On with Reset RTOR 118 Count Up COTO e ob 4 cache heed auleari dears rere En aeta 123 Count Down CTD s se fa ht c gs e ea Aro ae 127 Count Up Down CTUD ausa ve be
104. SINT SSV Pending value for the EmbeddedResponse attribute Enable PendingENQTransmitLimit SINT SSV Pending value for the ENQTransmitLimit attribute PendingEOTSuppression SINT SSV Pending value for the EOTSuppression attribute PendingErrorDetection SINT SSV Pending value for the ErrorDetection attribute PendingNormalPollGroupSize INT SSV Pending value for the NormalPollGroupSize attribute PendingMasterMessage SINT SSV Pending value for the MasterMessageTransmit attribute Transmit PendingNAkReceiveLimit SINT SSV Pending value for the NAKReceiveLimit attribute PendingPollingMode SINT SSV Pending value for the PollingMode attribute PendingReplyMessageWait DINT SSV Pending value for the ReplyMessageWait attribute PendingStationAddress INT SSV Pending value for the StationAddress attribute PendingSlavePollTimeout DINT SSV Pending value for the SlavePollTimeout attribute PendingTransmitRetries SINT SSV Pending value for the TransmitRetries attribute To apply values for any of the DF1 pending attributes 1 Use an SSV instruction to set the value for the pending attribute You can set as many pending attributes as you want using an SSV instruction for each pending attribute 2 Use a MSG instruction to apply the value The MSG instruction applies every pending attribute you set Configure the MSG instruction as MSG Configuration Tab Field Value Configuration Message Type CIP Generic Service Code Od hex Ob
105. SSV IOT 187 Example The following example changes the ConnectionPath attribute so that the message goes to a different controller When msg patb is on sets the path of the msg 7 message to the value of msg 1 patb This send the message to a different controller Where Is msg 1 message whose attribute you want to change msg 1 type tag that stores the value of the MessageType attribute lag a tag that stores a 0 msg 1 patb array tag that stores the new connection path for the message Relay Ladder SV SSV Get System Value Set System Value Class name MESSAGE Class name MESSAGE Instance name msg_1 Instance name msg_1 Attribute Name MessageType Attribute Name MessageType Dest msg_1_type Source tag_a 2 0 SSV SSV Set System Value Set System Value Class name MESSAGE Class name MESSAGE Instance name msg_1 Instance name msg_1 Attribute Name ConnectionPath Attribute Name MessageType Source msg_1_path 0 Source msg_1_type 6 2 Structured Text IF msg_path THEN Type CIP Data Table Write Message Control msg 1 E MSG GSV MESSAGE msg 1l MessageType msg 1 type SSV MESSAGE msg_1 MessageType tag_a SSV MESSAGE msg_1 ConnectionPath msg_l_path 0 SSV MESSAGE msg 1 MessageType msg 1 type END IF IF NOT msg 1 EN THEN MSG msg 1 END IF Publication 1756 RMOOSI EN P January 2007 188 Input Output Instructions MSG GSV
106. STOR 624 SWPB 301 UPPER 631 string data type 573 607 621 String Delete 610 string manipulation instructions CONCAT 608 DELETE 610 FIND 612 INSERT 614 introduction 605 MID 616 STRING structure 573 607 621 String To DINT 622 String To REAL 624 structured text arithmetic operators 665 assign ASCII character 663 assignment 661 bitwise operators 669 CASE 675 comments 687 components 659 contructs 671 evaluation of strings 667 expression 663 FOR DO 678 functions 665 IF THEN 672 logical operators 668 non retentive assignment 662 numeric expression 663 relational operators 666 REPEAT UNTIL 684 WHILE DO 681 structures COMPARE 481 489 CONTROL 338 349 369 373 378 388 392 397 403 408 409 415 422 426 430 COUNTER 123 127 FBD_BIT_FIELD_DISTRIBUTE 296 FBD_BOOLEAN_AND 319 FBD_BOOLEAN_NOT 328 FBD_BOOLEAN_OR 322 FBD_BOOLEAN_XOR 325 FBD_COMPARE 213 217 221 225 229 244 FBD_CONVERT 562 565 FBD_COUNTER 131 FBD_LIMIT 233 FBD_LOGICAL 306 309 312 316 Publication 1756 RMOOSI EN P January 2007 FBD MASK EQUAL 239 FBD MASKED MOVE 290 FBD MATH 254 258 261 264 269 271 553 FBD MATH ADVANCED 273 280 523 526 530 533 537 541 546 550 557 560 FBD_ONESHOT 89 92 FBD TIMER 110 114 118 FBD_ TRUNCATE 567 MESSAGE 140 PID 501 RES instruction 136 RESULT 481 489 SERIAL PORT CONTROL 572 574 576 578 584 588 592 596 601 STRING 573 607 621 string 573 607 621 TIMER
107. Source must be greater than zero otherwise the overflow status Arithmetic Status Flags Fault Conditions Condition prescan Execution bit S V is set The resulting Destination is greater than or equal to 37 92978 and less than or equal to 38 53184 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true postscan Condition prescan The controller calculates the log of the Source and places the result in the Destination The rung condition out is set to true The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOO3I EN P January 2007 No action taken Advanced Math Instructions LN LOG XPY 551 Example Calculate the log of value and place the result in result Relay Ladder LOG Log Base 10 Source value 3 4000001 Dest result 0 53147888 Structured Text result LOG value Function Block value result Publication 1756 RMOOSI EN P January 2007 552 Advanced Math Instructions LN LOG XPY Xto the Power of Y XPY
108. The number of bytes copied is Byte Count Length number of bytes in the Destination data type If the byte count is greater than the length of the Source unpredictable data is copied for the remaining elements You must test and confirm that the instruction doesn t change data that you don t want it to change The COP and CPS instructions operate on contiguous memory They do a straight byte to byte memory copy In some cases they write past the array into other members of the tag This happens if the length is too big and the tag is a user defined data type If The Tag Is user defined data type Then If the Length is too big the instruction writes past the end of the array into other members of the tag It stops at the end of the tag No major fault is generated NOT user defined data type If the Length is too big the instruction stops at the end of the array No major fault is generated The Length is too big if it is more than the total number of elements in the Destination array Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 360 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Condition prescan Execution Relay Ladder Action The rung condition out is set to false Structured Text Action No action taken rung condition in is false The rung condition out is set to false na
109. The rung condition out is set to true postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Publication 1756 RMOOSI EN P January 2007 564 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Condition Enableln is cleared Action EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Example Publication 1756 RMOOSI EN P January 2007 No action taken The TOD instruction converts value_1 to a BCD value and places the result in result a Relay Ladder TOD To BCD Source value 1 22 Dest result a 1810022 Function Block 0 value 1 JM Source TOD 04 TOD To BCD d result a Convert to Integer FRD Operands FRD From BCD Source Dest FRD_O4 FRD From BCD Input Parameter Data Type Enableln BOOL Source DINT Output Parameter Data Type Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 565 The FRD instruction converts a BCD value Source to a decimal value and stores the result in the Destination Relay Ladder Operand Type Format Description Source SINT immediate value to convert to decimal INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Destination SINT tag stores the result INT DINT Function Block
110. When 0 lt value 100 set light_1 If value lt 0 or value gt 100 clear light_1 Relay Ladder light_1 Structured Text IF value lt 100 AND value gt 0 AND value lt 100 OR value gt 100 AND value lt 0 OR value gt 100 THEN light_1 1 ELSE light 1 0 END IF Function Block LIM 01 LIM gj Limit Test CIRC 0 Dest j light 1 LowLimit HighLimit Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 237 Example 2 Low Limit gt High Limit When value 2 0 or value 100 set light_1 If value lt 0 or value gt 100 clear igbt 1 Relay Ladder LIM Limit Test CIRC Low Limit light 1 Test High Limit 100 Structured Text IF 0 lt 100 AND value gt 0 AND value lt 100 OR 0 gt 100 AND value lt 0 OR value gt 100 THEN light 1 1 ELSE light 1 0 END IF Function Block LIM 01 LIM Limit Test CIRC 0 Det p light 1 LowLimit value HighLimit Publication 1756 RMOOSI EN P January 2007 238 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Mask Equal to MEQ The MEQ instruction passes the Source and Compare values through a Mask and compares the results Operands Relay Ladder MEQ Mask Equal Source Operand Type Format Description Mask E So
111. a string that uses variables INSERT relay ladder 614 structured text extract characters from a string extract information from a bar code MID relay ladder 616 structured text You can also use the following instructions to compare or convert ASCII characters If you want to Use this instruction See page compare a string to another string CMP 207 see if the characters are equal to specific characters EQU 212 see if the characters are not equal to specific characters NEQ 243 see if the characters are equal to or greater than specific characters GEO 212 see if the characters are greater than specific characters GRT 220 see if the characters are equal to or less than specific characters LEQ 224 see if the characters are less than specific characters LES 228 rearrange the bytes of a INT DINT or REAL tag SWPB 301 find a string in an array of strings FSC 349 convert characters to a SINT INT DINT or REAL value STOD 622 Publication 1756 RMOOSI EN P January 2007 606 ASCII String Instructions CONCAT DELETE FIND INSERT MID If you want to Use this instruction See page convert characters to a REAL value STOR 624 convert a SINT INT DINT or REAL value to a string of ASCII characters DTOS 626 convert REAL value to a string of ASCII characters RTOS 629 Publication 1756 RMOOSI EN P January 2007 ASCII String Instructions CONCAT DELETE FIND INSERT MID 607 String Data Types You s
112. 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 Publication 1756 RMOOSI EN P January 2007 The counter then rolls over to 2 147 483 647 and begins counting down again Description When enabled and CUEnable is set the CTUD instructions increments the counter by one When enabled and CDEnable is set the CTUD instruction decrements the counter by one Both the CUEnable and CDEnable input parameters can both be toggled during the same scan The instruction executes the count up prior to the count down Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 133 Counting Up CUEnable count up enable bit CU count up done bit DN Preset Ss meee io Lue ns eee Es counter accumulated value ACC 16636 Counting Down CDEnable count down enable bit CD count down done bit DN counter accumulated value ACC preset b 16637 When disabled the CTUD instruction retains its accumulated value Set the Reset input parameter of the FBD_COUNTER structure to reset the i
113. action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOOSI EN P January 2007 No action taken Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 535 Example Calculate the arc sine of value and place the result in result Relay Ladder ASN Are Sine Source value 02 Dest result 0 20135795 Structured Text result ASIN value Function Block ASN 01 ASN m Arc Sine value result Publication 1756 RMOOSI EN P January 2007 536 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Arc Cosine ACS The ACS instruction takes the arc cosine of the Source value and stores the result in the Destination in radians Operands Relay Ladder AUS Arc Cosine Operand Type Format Description Source SINT immediate find the arc cosine of this value INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest ACOS source Use ACOS as a function This function computes the arc cosine of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text Acs o1 Function Block acs gg A odis Operand Type Format Description ACS tag FBD MATH ADVANCED structure ACS structure Publ
114. are reserved Device Status Bits Bits 7 4 0000 0001 0010 0011 0100 0101 Fault Status Bits Bits 11 8 0001 0010 Meaning reserved flash update in progress reserved reserved flash is bad faulted run program Meaning recoverable minor fault unrecoverable minor fault recoverable major fault unrecoverable major fault Logix5000 Specific Status Bits Bits 13 12 01 10 11 Bits 15 14 01 10 Meaning keyswitch in run keyswitch in program keyswitch in remote Meaning controller is changing modes debug mode if controller is in run mode Publication 1756 RMOOSI EN P January 2007 180 Input Output Instructions MSG GSV SSV IOT Attribute Data Type Instruction Description Type INT GSV Identifies the device as a controller Controller 14 Vendor INT GSV Identifies the vendor of the device Publication 1756 RMOOSI EN P January 2007 Allen Bradley 0001 Input Output Instructions MSG GSV SSV IOT 181 Access the CST object The CST coordinated system time 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 Bits identify Bit Meaning 0 timer hardware faulted the device s internal timer hardware is in a faulted state 1 ramping enabled the current value of the timer s lower 164 bits ramp up to the request
115. be updated more frequently than once every 250 milliseconds 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 operator still manually change the output of the PID loop Relay Ladder PID Proportional Integral Derivative Source Local 0 RollingTimestamp PID ticio jt of Process variable Local 0 ChOData Source B PreviousT imestamp Tieback Local 0 1 Ch1Data Local 0 1 Ch0F ault Publication 1756 RMOOSI EN P January 2007 of Control variable Local 1 0 ChOData PID Master Loop TIC101 5w M Inhold bit Local 1 1 Ch lnHold Inhold Value Local 1 l ChO0D ata Setpoint 0 0 Process Variable 0 0 Output 0 0 Move Source Locat 0 l RolingTimestamp 0 Dest PreviousTimestamp Special Instructions FBC DDT DTR PID 515 Structured Text IF Local 0 I ChO0Fault THEN TIC101 SWM 1 ELSE TIC101 SWM 0 END IF IF Local 0 I RollingTimestamp PreviousTimestamp OR Local 0 1I ChOFault THEN PreviousTimestamp Local 0 I RollingTimestamp PID TIC101 Local 0 I ChOData Local 0 I ChlData ijoc
116. buffers are in use when an instruction leaves the message queue the instruction errors and does not transfer the data e You can increase the number of unconnected buffers 40 max but continue to follow guideline 5 e To increase the number of unconnected buffers see Logix5000 Controllers Common Procedures publication 1756 PM001 Input Output Instructions MSG GSV SSV IOT 173 Get System Value GSV and The d instructions get and set controller system data that is Set System Value SSV SS eem Operands Relay Ladder GSV Sy Get System Value Set System Value Class name Class name Instance name Instance name Attribute Name Attribute Name Dest Source Operand Type Format Description Class name name name of object Instance name name name of specific object when object requires name Attribute Name name attribute of object data type depends on the attribute you select Destination GSV SINT tag destination for attribute data INT DINT REAL structure Source SSV SINT tag tag that contains data you want to copy to the attribute INT DINT REAL structure Structured Text GSV ClassName InstanceName AttributeName Dest SSV ClassName InstanceName AttributeName Source The operands for are the same as those for the relay ladder GSV and SSV instructions Publication 1756 RMOOSI EN P January 2007 174 Input Output Instructions MSG GSV SSV IOT Description The GSV SSV instructions get and set contr
117. cleared ER bit is cleared DN bit is cleared a rung condition out is set to false 315 Structured Text Action The EN bit is cleared The DN bit is cleared The ER bit is cleared na rung condition in is true The instruction executes The rung condition out is set to true na Enableln is set na Enableln is always set The instruction executes instruction execution The instruction sorts the specified elements of the array into ascending order The instruction sorts the specified elements of the array into ascending order postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 376 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 1 Sort int _array which is DINTI4 5 Before After 5 dimension 1 P dimension 1 K KA 0 1 2 3 4 7 0 1 Ze Am A 0 20 0 20 19 9 17 16 1 115 1 115 14 8 12 11 dimension 0 dimension 0 2 10 2 10 9 13 7 6 315 315 1 Sort File CEN Array int array 0 2 f Dim to vary 0 CDN Control control 1 Length e Position e Structured Text control_1 LEN 4 control 1 POS ll o SRT int array 0 2 0 control 1 Publication 1756 RMOOSI EN P January 2007 Before dimension 0 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 3
118. condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Source A Source B rung condition out is set to false rung condition out is set to true Y postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 215 Example If va ue 1 is equal to value_2 set light_a If value_1 is not equal to value_2 clear ligbt a Relay Ladder light_a Equal C2 Source value 1 o SouceB value 2 0e Structured Text light a value 1 value 2 Function Block value 1 value 2 Publication 1756 RMOOSI EN P January 2007 216 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Greater than or Equal to The GEQ instruction tests whether Source A is greater than or equal to G EQ Source B Operands Relay Ladder GEQ Mor iia Fom Operand Type Format Description S Source A SINT immediate value to test against Source B ource B INT tag DINT REAL
119. critical error check FD is on an alarm is annunciated The UID and UIE instructions prevent any other tasks from interrupting the error checking and alarming Relay Ladder UID gt error_bit FSC JE File Search Compare CEND Control error check DN Length 10 ER Position 8 Mode ALL Expression error code error list error check POS error check FD alarm TE an a les C UIE gt Structured Text UID lt statements gt UIE Publication 1756 RMOOSI EN P January 2007 458 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Always False Instruction AFI Operands AFI Description Arithmetic Status Flags Fault Conditions The AFI instruction sets its rung condition out to false Relay Ladder none The AFI instruction sets its rung condition out to false not affected none Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The rung condition out is set to false postscan The rung condition out is set to false Example Use the AFI instruction to temporarily disable a rung while you are Publication 1756 RMOOSI EN P January 2007 debugging a program When enabled the AFI disables all the instructions on this rung H AFI Program Control
120. data e As the application executes it uses for its inputs the input data in input buffer Relay Ladder CPS Synchronous Copy File Source Local 0 l Data 0 Dest input buffer 0 Length 20 Structured Text CPS Local 0 1 Data 0 input_buffer 0 20 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 363 Example 5 This example initializes an array of 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 OJ The length is nine timer structures array timer 0 First the instruction copies timer 0 values to timer 1 Then the instruction copies timer 1 values to timer 2 array timer 1 Then the instruction copies timer 2 values to timer 3 array timer 2 Then the instruction copies timer 3 values to timer 4 array timer 3 array timer 4 Finally the instruction copies timer 9 values to timer 10 array timer 9 wo we array timer 10 Relay Ladder MOV MOV Move Move Source 500 Source 0 Dest aray_timer 0 pre Dest aray_timer 0 acc of 0 CO Copy File Source aray_timer 0 Dest array_timer 1 Length 1 Structured Text IF S FS THEN array timer 0 pre 500
121. defines the specifics of how the instruction operates provides at least one programming example in each available programming language includes a description explaining each example The following icons help identify language specific information This icon Indicates this programming language relay ladder structured text function block Preface 19 Common Information for The Logix5000 instruction set has some common attributes All Instructions For this information common attributes function block attributes Conventions and Set and clear Related Terms See this appendix appendix Common Attributes defines e arithmetic status flags e data types e keywords appendix Function Block Attributes defines e program and operator control e timing modes This manual uses set and clear to define the status of bits booleans and values non booleans This term set Means the bit is set to 1 ON a value is set to any non zero number clear the bit is cleared to 0 OFF all the bits in a value are cleared to 0 If an operand or parameter support more than one data type 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 Publication 1756 RMOOSI EN P January 2007 20 Preface Publication 1756 RMOOSI EN P January 2007 Relay ladder run
122. e default STRING data type e any new string data type that you create Quantity SINT immediate number of characters to The Start plus the Quantity must be less than or delete equal to the DATA size of the Source INT tag DINT Start SINT immediate position of the first Enter a number between 1 and the DATA size of character to delete the Source INT tag DINT Destination string tag tag to store the result Structured Text A b E CE The operands are the same as those for the relay ladder i DELETE instruction Description The DELETE instruction deletes removes a group of characters from Publication 1756 RMOOSI EN P January 2007 the Source and places the remaining characters in the Destination e The Start position and Quantity define the characters to remove e Unless the Source and Destination are the same tag the Source remains unchanged Arithmetic Status Flags not affected Fault Conditions Type Code Cause ASCII String Instructions CONCAT DELETE FIND INSERT MID 611 Recovery Method 4 51 The LEN value of the string tag is 1 Check that no instruction is writing to the LEN member of the string tag greater than the DATA size of the string tag 2 In the LEN value enter the number of characters that the string contains 4 56 The Start or Quantity value is invalid 1 Check that the Start value is between 1 and the DATA size of the Source 2 Check that the Start value plus the Quantity value is less than or e
123. false e A bool expression uses bool tags relational operators and logical operators to compare values or check if conditions are true or false For example tag1 gt 65 e A simple bool expression can be a single BOOL tag e Typically you use bool expressions to condition the execution of other logic Numeric expression An expression that calculates an integer or floating point value e A numeric expression uses arithmetic operators arithmetic functions and bitwise operators For example tag1 5 e Often you nest a numeric expression within a bool expression For example tag1 5 gt 65 Use the following table to choose operators for your expressions If You Want To Then Calculate an arithmetic value Use arithmetic operators and functions on page 665 Compare two values or strings Use relational operators on page 666 Check if conditions are true or false Use logical operators on page 668 Compare the bits within values Use bitwise operators on page 669 Publication 1756 RMOOSI EN P January 2007 Structured Text Programming 665 Use arithmetic operators and functions You can combine multiple operators and functions in arithmetic expressions Arithmetic operators calculate new values To Use This Operator Optimal Data Type add DINT REAL subtract negate DINT REAL multiply i DINT REAL exponent x to the power of y a DINT REAL divide DINT REAL modulo divide MOD DINT REAL
124. gione characters Trends Data Types e You can create a new string data type that stores less or more Cg User Defined characters gt Ca Strings 8 STRING To create a new string data type see Logix5000 Controllers Common H E Predefined Procedures publication 1756 PMO001 Cg Module Defined LI 140 Configuration Publication 1756 RMOOSI EN P January 2007 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 575 Each string data type contains the following members Name Data Type Description Notes LEN DINT number of characters The LEN automatically updates to the new count of characters whenever you in the string e use the String Browser dialog box to enter characters e use 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 e To access the characters of the string address the name of the tag the string ASCII Test For Buffer Line ABL Operands ABL ASCII Test For Buffer Line Channel SerialPort Control Character Count ND F0 ABL Channel SerialPortControl For example to access the characters of the string 1 tag enter string f e Each element of the DATA array contains one character e You can create new string data types that store less or more characters The ABL instructio
125. hese bits shif Publication 1756 RMOOSI EN P January 2007 392 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Bit Shift Right BSR The BSR instruction shifts the specified bits within the Array one position right Operands Relay Ladder BSR Operand Type Format Description Bit Shift Right CENS Array Array DINT array tag array to modify Control DN Source Bit specify the element where to begin the shift Length do not use CONTROL POS in the subscript Control CONTROL tag control structure for the operation Source bit BOOL tag bit to shift Length DINT immediate number of bits in the array to shift CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that 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 Publication 1 Description When enabled the instruction unloads the value at bit 0 of Array to IMPORTANT the UL bit shifts the remaining bits one position right and loads Source bit into the uppermost bit of the specified bits You must test and confirm that the instruction doesn t change data that you don t want it
126. hold at one time Position DINT immediate next location in the LIFO where the instruction loads data initial value is typically 0 If you use a user defined structure as the data type for the Source or LIFO operand use the same structure for both operands Publication 1756 RMOOSI EN P January 2007 Array File Shift Instructions BSL BSR FFL FFU LFL LFU 409 CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the LFL instruction is enabled 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 that the LIFO is empty If LEN lt 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 location in the LIFO where the instruction will load the next value Description 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 You must
127. in Add Input 1 Add Input 2 and Add Input 3 are copied to nput A Input B and Input C respectively 3 The value of Sum A B Cis copied to Add Three Result Function blocks of the Add Three Inputs routine ADD 02 ADD 03 E RET E Subroutine Return Sources Sources C SourceB C SourceB 2 The ADD instructions add nput A Input B and Input C and place the result in Sum A B C Publication 1756 RMOOSI EN P January 2007 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 449 The JXR instruction executes an external routine This instruction is Jump to External Routine only supported by the SoftLogix5800 controllers JXR Operands Relay Ladder JXR Jump To External Routine CEN gt External routine name lt Dh gt External routine control lt ER gt Parameter Return Par Operand Type Format Description External routine ROUTINE name external routine to execute name External routine EXT_ROUTINE_ tag control structure see the next page control CONTROL Parameter BOOL immediate data from this routine that you want to copy to a variable in the external routine SINT tag e Parameters are optional e Enter multiple parameters if needed INT array tag e You can have as many as 10 parameters DINT REAL structure Return BOOL tag tag in this routine to which you want to copy a result of the external routi
128. instruction 220 GSV instruction objects 176 operands 173 ICON 641 IF THEN 672 immediate output instruction 200 immediate values 635 incremental mode 335 inhibit task 194 input reference 641 input wire connector 641 input output instructions GSV 173 introduction 139 IOT 200 MSG 140 SSV 173 INSERT instruction 614 Insert String 614 instructions advanced math 545 analog alarm 47 array ASCII conversion 619 ASCII serial port 571 ASCII string manipulation 605 bit 69 compare 205 compute 247 conversion 555 counter 95 digital alarm 31 for break 471 input output 139 logical 283 math conversion 555 move 283 program control 435 sequencer 421 serial port 571 shift 387 special 479 string conversion 619 string manipulation 605 timer 95 trigonometric 521 IOT instruction 200 IREF 641 J JMP instruction 436 JSR instruction 438 jump 436 jump to subroutine 438 JXR instruction control structure 450 L label 436 latching data 642 LBL instruction 436 LEO instruction 224 LES instruction 228 less than 228 less than or equal to 224 LFL instruction 408 LFU instruction 414 LIFO load 408 LIFO unload 414 LIM instruction 232 limit 232 LN instruction 546 log base 10 549 natural 546 log base 10 549 LOG instruction 549 logical instructions AND 305 introduction 283 NOT 315 OR 308 XOR 311 logical operators structured text 668 lower case 633 LOWER instruction 633 Index 695 masked equal to 238 masked move 2
129. instruction clears unlatches the data bit Relay Ladder Operand Type Format Description data bit BOOL tag bit to be cleared Structured Text Structured text does not have an OTU instruction but you can achieve the same results using an IF THEN construct and an assignment IF BOOL expression THEN data bit 0 END IF See Appendix B for information on the syntax of constructs expressions and assignments within structured text When enabled the OTU instruction clears the data bit When disabled the OTU instruction does not change the status of the data bit not affected none Relay Ladder Action The data bit is not modified The rung condition out is set to false rung condition in is false The data bit is not modified The rung condition out is set to false rung condition in is true The data bit is cleared The rung condition out is set to true postscan Publication 1756 RMOOSI EN P January 2007 The data bit is not modified The rung condition out is set to false Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 79 Example When enabled the OTU instruction clears light_2 Relay Ladder light 2 MT a Structured Text IF BOOL expression THEN light 2 0 END IF Publication 1756 RMOOSI EN P January 2007 80 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI One Shot ONS Operands
130. invalid alarm severity configuration If severity lt 1 the instruction uses Severity 1 If severity gt 1000 the instruction uses Severity 1000 AlarmLimitsInv BOOL Limits invalid for example LLimit lt LLLimit When this condition is detected the instruction clears all level conditions active bit s Until the fault is cleared no new level conditions can be detected Deadbandlnv Subscribers Publication 1756 RMOOSI EN P January 2007 BOOL When this condition is detected the instruction uses Deadband 0 0 Analog Alarm Instruction ALMA 61 Output Parameter Data Type Description ROCPosLimitlnv BOOL When this condition is detected the instruction uses ROCPosLimit 0 0 ROCNegLimitinv BOOL When this condition is detected the instruction uses ROCNegLimit 0 0 ROCPeriodlnv BOOL When this condition is detected the instruction uses ROCPeriod 0 0 Publication 1756 RMOOSI EN P January 2007 62 Analog Alarm Instruction ALMA Example Publication 1756 RMOOSI EN P January 2007 This illustration shows the manner in which an analog alarm executes in a typical system configuration Alarm execution is shown below In these examples level in a tank is monitored and an alarm is activated if the level surpasses a high or high high limit A programmatic acknowledge is sometimes used to acknowledge all the level alarms Ladder Logic ALMA Analog Alarm
131. is cleared i rung condition out is set to rung condition in is true The STD instruction calculates the standard deviation of the specified elements Internally the instruction uses a FAL instruction to calculate the average Expression standard deviation calculation Mode ALL For details on how the FAL instruction executes see page 9 339 postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 382 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 1 Calculate the standard deviation of dint_array which is DINTI4 5 dimension 1 KA 7 0 1 2 3 4 0 20 19 18 17 16 1115 14 13 12 11 dimension 0 AVE IG Ip 63 34 8 5 2 10 9 8 7 6 4 4 3 5 2 1 16285 11 Z 8 5 6285 4 1785 STD oo EH 6 454972 4Z 1 real std 6 454972 Relay Ladder STD Standard Deviation N Array dint_array 0 4 Dim to vary 0 N5 Dest real std o AR Control control 1 Length 4 Position of Structured Text SIZE dint_array 0 length sum 0 FOR position 0 TO length 1 DO sum sum END FOR average sum sum 0 FOR position dint array position length 0 TO length 1 DO sum sum dint array position average 2 END FOR real std SQRT sum l
132. is documented in this manual motion Logix5000 Controllers Motion Instruction Set Reference Manual publication 1756 RM007 PhaseManager PhaseManager User Manual publication LOGIX UM001 process control Logix5000 Controllers Process Control and Drives Instruction Set Reference Manual publication 1756 RMO006 Publication 1756 RMOOSI EN P January 2007 24 Instruction Locator Instruction Location Languages Instruction Location Languages ABL 616 relay ladder BNOT 328 structured text ASCII Test For Buffer Line structured tex Boolean NOT function block ABS 279 relay ladder BOR 322 structured text Absolute Value Mota i Boolean OR function block unction bloc BRK 475 relay ladder ACB 578 relay ladder Break y ASCII Chars in Buffer structured tex BSL 388 relay ladder ACL 581 relay ladder 2 Shift Left ASCII Clear Buffer Structured tex s BSR 392 relay ladder ACS 536 relay a 2 Shift Right Y Arc Cosine structured text function block BTD 296 relay ladder ADD 253 relay ladder Bit Field Distribute Add structured text BTDT 296 structured text function block Bit Field Distribute with function block AFI 458 relay ladder Target Always False Instruction BTR 140 relay ladder AHL 583 relay ladder Message structured text ASCII Handshake Lines structu
133. is on for 180 msec timer 2 is timing When timer 3 acc reaches 180 igbt 1 goes off and igbt 2 goes on Light 2 remains until timer 3 is reset If limit_switch_2 is cleared while timer_3 is timing Jight_1 remains on When limit_switch_2 is set the RES instruction resets timer_3 clears status bits and ACC value limit switch 1 TO Retentive Timer On Timer timer 3 Preset 180 Accum 0 tier 3 tt light 1 timer 3 dn light 2 limit switch 2 timer 3 RES Publication 1756 RMOOSI EN P January 2007 110 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Timer On Delay with Reset TONR Operands TONR TONR tag TONR zz Timer On Delay with Reset El TimerEnable Input Parameter Data Type Enableln BOOL The TONR instruction is a non retentive timer that accumulates time when TimerEnable is set This instruction is available in relay ladder as two separate instructions TON see page 4 96 and RES see page 136 Structured Text Variable Type Format Description TONR tag FBD_TIMER structure TONR structure Function Block Operand Type Format Description TONR tag FBD_TIMER structure TONR structure FBD_TIMER Structure Description Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes TimerEnab
134. is set to false When enabled the FOR instruction repeatedly executes routine 2 and increments value 2 by 1 each time When value 2 is 10 or a BRK instruction is enabled the FOR instruction no longer executes routine 2 FOR For Routine name routine 2 Index value 2 Initial value 0 Terminal value 10 Step size 1 Break BRK Operands CBRK EXIT Description Arithmetic Status Flags Fault Conditions For Break Instructions FOR FOR DO BRK EXIT RET 415 The BRK instruction interrupts the execution of a routine that was called by a FOR instruction Relay Ladder none Structured Text Use the EXIT statement in a loop construct See Appendix B for information on structured text constructs When enabled the BRK instruction exits the routine and returns the controller to the instruction that follows the FOR If there are nested FOR instructions a BRK instruction returns control to the innermost FOR instruction not affected none Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The rung condition out is set to true Execution returns to the instruction that follows the calling FOR instruction postscan The rung condition out is set to false Example When enabled the BRK instruction stops executing the current rout
135. 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 Incremental mode Incremental mode manipulates one element of the array each time the instruction s rung condition in goes from false to true DERE e UI 1st instruction enable 4 4 2nd instruction enable 44 lt 3rd instruction enable 4 4 t last instruction enable 16643 Publication 1756 RMOOSI EN P January 2007 336 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE rung condition in EN bit 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 scan DN bit scan of the instruction i ll 40014
136. most recent state change message Set no subscribers Cleared At least one subscriber NoConnection BOOL Indicates that all of the alarm s subscribers were disconnected when attempting to deliver the most recent state change message Set all subscribers disconnected Cleared at least one subscriber connected CommError AlarmBuffered BOOL BOOL Indicates that there was a communication error when delivering last alarm message to at least one subscriber Set communication errors all retries exhausted Cleared all connected subscribers successfully received alarm message If this error is indicated then it means that a subscriber was subscribed and it had a connection opened but the message was not delivered successfully Indicates that the alarm message was buffered when not delivered to subscriber s either due to a CommError or a lost Connection Set alarm message buffered for at least one subscriber Cleared alarm message is not buffered Subscribers DINT Indicates number of subscribers for this alarm SubscNotified DINT Indicates number of subscribers successfully notified about the most recent alarm state change Status DINT Indicates the bit mapped status of the instruction execution Publication 1756 RMOOSI EN P January 2007 Digital Alarm Instruction ALMD 39 Output Parameter Data Type Description InstructFau
137. not use CONTROL POS in the subscript Control CONTROL tag control structure for the operation Source bit BOOL tag bit to shift Length DINT immediate number of bits in the array to shift CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that 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 Description 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 Source bit into bit O of Array IMPORTANT You must test and confirm that the instruction doesn t change data that you don t want it to change The BSL instruction operates on contiguous memory In some cases the instruction shifts bits past the array into other members of the tag This happens if the length is too big and the tag is a user defined data type Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 Array File Shift Instructions BSL BSR FFL FFU LFL LFU 389 Execution Condition Relay Ladder Action prescan The EN bit is cleared The DN bit
138. operates POS DINT The position contains the position of the current element that the instruction is accessing Description The FAL instruction performs the same operations on arrays as the Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 CPT instruction performs on elements The examples that start on page 9 344 show how to use the POS value to step through an array If a subscript in the expression of the Destination is out of range the FAL instruction generates a major fault type 4 code 20 Arithmetic status flags are affected A Major Fault Will Occur If Fault Type Fault Code subscript is out of range 4 20 POS lt 0 or LEN lt 0 4 21 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 339 Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false I Ls internal bit is cleared DN bit 1 yes no EN bit is cleared EN bit is cleared ALL mode ER bit is cleared yes q POS POS 1 es Y J LEN 0 no yes no no POS POS 1 ves A no DN bit is set q y yes DN bit is set g mode LEN A numeric mode page 9 343 Y rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 340 Array
139. 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 rung condition in transitions from false to true The EN bit is cleared when the rung condition in becomes false The PID instruction does not use a DN bit The PID instruction executes every scan as long as the rung condition in is true EN bit rung state EE execution of the PID instruction not affected IMPORTANT These faults were major faults in the PLC 5 controller A Minor Fault Will Occur If Fault Type Fault Code UPD x 0 4 35 setpoint out of range 4 36 Special Instructions FBC DDT DTR PID 505 Execution Condition Action Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction executes the PID loop The instruction executes the PID loop postscan The rung condition out is set to false No action taken Configure a PID Instruction After you enter the PID instruction and specify the PID structure you use the configuration tabs to specify how the PID instruction should function PID i Integral Derivati Glidehere trrconfigure the Process Variab
140. prescan Fault Conditions none Execution Function Block Action No action taken Structured Text Action No action taken instruction first scan instruction first run EN TT and DN are cleared ACC value is set to 0 EN TT and DN are cleared ACC value is set to 0 EN TT and DN are cleared ACC value is set to 0 EN TT and DN are cleared ACC value is set to 0 Enableln is cleared EnableOut is cleared the instruction does nothing and the outputs are not updated na Enableln is set When Enableln transitions from cleared to set the instruction initializes as described for instruction first scan The instruction executes EnableOut is set Enableln is always set The instruction executes reset When the Reset input parameter is set the When the Reset input parameter is set the instruction clears EN TT and DN and sets instruction clears EN TT and DN and sets ACC zero ACC zero postscan No action taken No action taken Publication 1756 RMOOSI EN P January 2007 Example Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 113 Each scan that imit switcb1 is set the TONR instruction increments the ACC value by elapsed time until the ACC value reaches the PRE value When ACC PRE the DN parameter is set and timer state is set Structured Text TONR_01 Preset 500 TONR_01 Reset reset TONR_O1 TimerE
141. qp dede cef urs mi 663 Use arithmetic operators and functions 665 Use relational Operators o br v gate mo de mx eek BES 666 Use logical operators ars er Einen re xw EE eee 668 Use bitwise operators ast d op pd n debes 669 Determine the order of execution cuve a aet Ra 669 oS COLO Sons 4c Ie Pa e pP RR ER ERN PS 670 EST ENTREPRENEUR 671 Some key words are reserved for future use 671 TES EHEN zz tmr ea kh ete mts hdl eC eP Su ed Ag 672 CASET OE uice iie endret en Gea eee Le Tues 675 POR po 678 WHILE DO raio td bie e d voe S Rd 681 REPEAT UNTIL exEs E pce SB pect Gian T ARREST 684 CODIIBDES ce co me eS oe OP era Rake ie OY Mey ee qo 687 ASCII Character Codes cu i dep Aa p oo Vg ESO 689 Rockwell Automation Support llle 705 Installation Assistance s vs yeso Ra XL LER A 705 New Product Satisfaction Return 705 Publication 1756 RMOOSI EN P January 2007 14 Table of Contents Publication 1756 RMOOSI EN P January 2007 Introduction Updated Information Summary of Changes This release of this document contains new and updated information To find new and updated information look for change bars as shown next to this paragraph This document contains the following changes Change Page Instruction locator table Added the new digital and analog alarm Instruction Locator instructions Chapter 1 Added new chapter 1 Digital Alarm Instruction 31 Chapter 2
142. remains unchanged Structured Text Relay Ladder Type Format Description SINT tag initial element to copy INT Important the Source and Destination operands should be the same data type or DINT unexpected results may occur REAL string structure SINT tag initial element to be overwritten by the Source INT Important the Source and Destination DINT operands should be the same data type or unexpected results may occur REAL string structure DINT immediate number of Destination elements to copy tag The operands are the same as those for the relay ladder COP and CPS instructions If the Source Or Destination Is e produced tag e consumed tag e 0 data Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 359 Description During execution of the COP and CPS instructions other controller actions may try to interrupt the copy operation and change the source or destination data And You Want To prevent the data from changing during the copy operation e data that another task can overwrite Then Select Notes CPS e asks that attempt to interrupt a CPS instruction are delayed until the instruction is done e To estimate the execution time of the CPS instruction see Controll ogix System User Manual publication 1756 UM001 allow the data to change during the copy operation COP none of the above ATTENTION A IMPORTANT COP
143. result Result of the math instruction Arithmetic status flags are set for this output If Source X is negative Source Y must be an integer value or a minor fault will occur The XPY instruction uses this algorithm Destination X Y The controller evaluates x 1 and 0 0 Arithmetic status flags are affected A Minor Fault Will Occur If Fault Type Fault Code Source X is negative and Source Y is not an 4 4 integer value Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller takes Source X to the power of Source Y and places the result in the Destination The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 554 Advanced Math Instructions LN LOG XPY Condition prescan Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Example Publication 1756 RMOOSI EN P January 2007 No action taken The XPY instruction takes value 1 to the power of value 2 and places the result in result Relay Ladder XPY X To Power Of Y Source value 1 33e value 2 Source Y 4 r
144. rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes when rung condition in toggles from cleared to set The rung condition out is set to true na Enableln is set na Enableln is always set The instruction executes instruction execution The instruction counts the characters in the buffer The EN bit is set The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue postscan MV line EN The rung condition out is set to false No action taken Example Continuously test the buffer for the termination characters Relay Ladder Structured Text ABL 0 MV line ABL ASCII Test For Buffer Line EN Channel 0 DND SerialPort Control MV line ERD Character Count 0 Publication 1756 RMOOSI EN P January 2007 578 ASCII Chars in Buffer ACB Operands A ASCII Chars in Buffer Channel SerialPort Control Character Count N ACB Channel SerialPortControl ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT The ACB instruction counts the characters in the buffer Relay Ladder Operand Type Format Enter Channel DINT immediate 0 tag Serial Port SERIAL PORT tag tag that controls the operation Control CONTROL Character DINT immediate 0 Count During execution displays the number of characters
145. rung condition in is true The instruction executes The rung condition out is set to true na Enableln is set na Enableln is always set The instruction executes instruction execution end address start address Length number of bytes in a destination element end address gt end end address end of destination array of destination array Source address Source gt Y destination address YES end address copy data in source addressto destination address rung condition out is set to Y true Source address source address 1 Y destination address destination address 1 postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 361 Example 1 Both array 4 and array 5 are the same data type When enabled the COP instruction copies the first 10 elements of array 4 into the first 10 elements of array 5 Relay Ladder co Copy File Source array 4 0 Dest array 5 0 Length 10 Structured Text COP array 4 0 array 5b 0 10 Example 2 When enabled the COP instruction copies the structure timer_1 into element 5 of array timer The instruction copies only one structure to one array element Relay Ladder co Copy File
146. same tag for both could result in unpredictable operation possibly causing equipment damage and or injury to personnel Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 481 COMPARE Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that 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 JN 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 if the compare POS 0 the compare LEN 0 the result POS 0 or the result LEN 0 The instruction stops executing until the program clears the ER bit 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 Description When enabled the FBC instruction compares the bits in the Source IMPORTANT array with the bits in the Refe
147. 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 module s real time sample period 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 Publication 1756 RMOOSI EN P January 2007 514 Special Instructions FBC DDT DTR PID EQ Not Equal The timestamp ranges from 0 32767 milliseconds 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 msecs you could put the PID logic in a periodic task that runs every 100 msecs 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
148. source B ratio Publication 1756 RMOOSI EN P January 2007 520 PID Theory Special Instructions FBC DDT DTR PID The following figures show the process flow for a PID instructions PID Process SP Error Displayed Displayed as EUs as EUs Software A M or A M Station Mode Control Action Software A M Set T Mode z gt Output Auta Laid Converts Units m A M Station K Error to 96 pp Out Auto Mode SP gt Manual gt Q Error X 100 Calculation z x Auto Convert to CV Units gt PV SP maxs mins Output gt cv PVT Manuai gt Limiting T CV maxcv mincv m No Set Manual PV Output 96 Displayed i Output CV as EUs Displayed as of EU Scale Converts Binary to Converts Tieback Units Engineering Units to PV minilmaxs mins ming tieback mintie maxi mini E anara Saai x100 maxtie mintie ZN PV Master Loo p Software A M Dupa or Control Bias A M Station Mode Action c Software A M gt e Auto SP PV Convers Unis Mode A M Station Output K Or Error to PD Wut 4 Auto Mode rT ee SP L gt Error X 100 Calculation Auto m DH Manual Os sp maxsmins
149. the Array into ascending order IMPORTANT You must test and confirm that the instruction doesn t change data that you don t want it to change The SRT instruction operates on contiguous memory In some cases the instruction changes data in other members of the tag This happens if the length is too big and the tag is a user defined data type IMPORTANT Make sure the Length does not cause the instruction to exceed the specified Dimension to vary If this happens unexpected results will occur This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See Appendix B Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code POS lt 0 or LEN lt 0 4 21 Dimension to vary does not exist for the 4 20 specified array Instruction tries to access data outside of 4 20 the array boundaries Publication 1756 RMOOSI EN P January 2007 Condition prescan rung condition in is false Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Execution Relay Ladder Action The EN bit is cleared The DN bit is cleared The ER bit is cleared The rung condition out is set to false examine DN bit DN otag DN bit 1 EN bit is
150. the PLC 3 and stores it in a REAL data type tag in the Logix5000 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 gt data lt 32 767 This command also writes REAL type data from the Logix5000 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 Publication 1756 RMOOSI EN P January 2007 write a contiguous range of 16 bit words from Logix5000 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 Input Output Instructions MSG GSV SSV IOT 163 The following diagrams show how the typed and word range commands differ The example uses read commands from a PLC 3 processor to a Logix5000 controller Typed read command Word range read command 16 bit
151. the assignment with a semi colon Publication 1756 RMOOSI EN P January 2007 660 Structured Text Programming Term expression see page 28 663 instruction see page 28 670 Definition An expression is part of a complete assignment or construct statement An expression evaluates to a number numerical expression or to a true or false state BOOL expression An expression contains tags A named area of the memory where data is stored BOOL SINT INT DINT REAL string immediates A constant value operators A symbol or mnemonic that specifies an operation within an expression functions When executed a function yields one value Use parentheses to contain the operand of a function Even though their syntax is similar functions differ from instructions in that functions can only be used in expressions Instructions cannot be used in expressions An instruction is a standalone statement An instruction uses parenthesis to contain its operands Depending on the instruction there can be zero one or multiple operands When executed an instruction yields one or more values that are part of a data structure n n Terminate the instruction with a semi colon Even though their syntax is similar instructions differ from functions in that instructions cannot be used in expressions Functions can only be used in expressions Publication 1756 RMOOSI EN P January 2007 Examples valuel
152. the number of characters in String tag so far 7 If element number SINT array size then stop You are at the end of the array and it does not contain a carriage return Structured Text Programming 683 Enter This Structured Text element number 0 SIZE SINT array 0 SINT array size While SINT array element number lt gt 13 do String tag DATA element number SINT array element number element number element number 1 String tag LEN element number If element number SINT array size then exit end if end while 8 Go to 3 Publication 1756 RMOOSI EN P January 2007 684 Structured Text Programming REPEAT UNTIL conditions are true Operands Structured Text REPEAT erand Type Format statement Op yp UNTIL bool expression bool_ BOOL tag expression END REPEAT expression Use the REPEAT UNTIL loop to keep doing something until Enter BOOL tag or expression that evaluates to a BOOL value BOOL expression IMPORTANT Make sure that you do not iterate within the loop too many times in a single scan e The controller does not execute any other statements in the routine until it completes the loop e f the time that it takes to complete the loop is greater than the watchdog timer for the task a major fault occurs e Consider using a different construct such as IF THEN Description The syntax is REPE
153. to trigger other operations Publication 1756 RMOOSI EN P January 2007 88 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI irit switch 1 OSF One Shot Falling Storage Bit storage_bit2 Output Bit output_bit_2 output_bit_2 Add Source Source B Dest Publication 1756 RMOOSI EN P January 2007 One Shot Rising with Input OSRI Operands OSRI OSRI tag OSRI tag OSRI Ed One Shot Rising with Input InputBit OutputBit Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 89 The OSRI instruction sets the output bit for one execution cycle when the input bit toggles from cleared to set This instruction is available in relay ladder as OSR see page 3 83 Structured Text Operand Type Format Description OSRI tag FBD ONESHOT structure OSRI structure Function Block Operand Type Format Description OSRI tag FBD ONESHOT structure OSRI structure FBD ONESHOT Structure Input Parameter Data Type Description Enableln BOOL Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes InputBit BOOL Input bit This is equivalent to rung condition for the relay ladder OSR instruction Default is cleared Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result OutputB
154. to Consume Relay Ladder If New_Data on then the following occurs for one scan The CPS instruction sets Produced Tag Source Tag The IOT instruction updates Produced Tag and sends this update to the consuming controller station 25 When the consuming controller receives this update it triggers the associated event task in that controller PS Synchronous Copy File Source Source Tag Dest Produced Tag Lenath 1 IOT Immediate Output Update Tag Produced_Tag New Data Trigger Consumer Fons Structured Text IF New_Data AND NOT Trigger_Consumer THI Eri zZ CPS Source_Tag Produced_Tag 1 IOT Produced Tag END IF Trigger Consumer New Data Publication 1756 RMOOSI EN P January 2007 204 Input Output Instructions MSG GSV SSV IOT Notes Publication 1756 RMOOSI EN P January 2007 Chapter 6 Compare Instructions CMP EQU GEO GRT LEO LES LIM MEQ NEO Introduction The compare instructions let you compare values by using an expression or a specific compare instruction If You Want To Use This Instruction Available In These Languages See Page compare values based on an expression CMP relay ladder 207 structured text test whether two values are equal EQU relay ladder 212 structured text function block test whether one value is greater than or equal GEO relay ladder 216 to a second value structured text function block test whether one val
155. to change The BSR instruction operates on contiguous memory In some cases the instruction changes bits in other members of the tag This happens if the length is too big and the tag is a user defined data type Arithmetic Status Flags not affected Fault Conditions none 756 RMOOSI EN P January 2007 Execution Condition prescan Array File Shift Instructions BSL BSR FFL FFU LFL LFU 393 Relay Ladder Action The EN bit is cleared The DN bit is cleared The ER bit is cleared The POS value is cleared The rung condition out is set to false rung condition in is false The EN bit is cleared The DN bit is cleared The ER bit is cleared The POS value is cleared The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 394 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Condition Relay Ladder Action rung condition in is true examine EN bit EN bita EN bit is set LEN 0 Jes vU yes shift array left one position left te gt array gt UL bit DN bit is set DN bit is set ER bit is set examine source bit source bit 0 Y Source bit 1 UL bit is set p p UL bit remains set Y rung condition out is set to true e AANA postscan The rung condition o
156. to stop reading if no termination characters are found POS DINT The position displays the number of characters that were read ERROR DNT Theerrorcontains 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 e The ARL instruction continues to execute until it removes either the first set of termination characters specified number of characters Serial Port Control Length e While the ARL instruction is executing no other ASCII serial port instruction executes To program the ARL instruction follow these guidelines 1 Configure the serial port of the controller a Select User mode b 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 ASCII queue while it waits for the termination characters 3 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See Publication 1756 RMOOSI EN P January 2007 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 593 To trigger a subsequent action when the instruction is done examine the EM bit Ari
157. to unsuppress the alarm Takes precedence over Suppress commands The alarm instruction clears this parameter Default is cleared ProgDisable BOOL Program Disable Set by the user program to disable the alarm Default is cleared Publication 1756 RMOOSI EN P January 2007 36 Digital Alarm Instruction ALMD Input Parameter Data Type Description OperDisable BOOL Operator Disable Set by the operator interface to disable the alarm The alarm instruction clears this parameter Default is cleared ProgFnable BOOL Program Enable Set by the user program to enable the alarm Takes precedence over Disable command Ladder Logic Copied from instruction operand Structured Text Copied from instruction operand Default is cleared OperEnable BOOL Operator Enable Set by the operator interface to enable the alarm Takes precedence over Disable command The alarm instruction clears this parameter Default is cleared AlarmCountReset BOOL A False to True transition resets the alarm count to zero Default is cleared UseProgTime BOOL Specifies whether the controller s clock is used to timestamp the InAlarm and ReturnToNormal events or if these events are timestamped by the user program using the Proglime parameter Set ProgTime value provides timestamp Cleared Controller s clock provides timestamp Default is cleared Proglime LINT Specifies a timestamp value for the InAlarm and ReturnToNormal events if Use
158. 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 For relay ladder instructions 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 Publication 1756 RMOOSI EN P January 2007 546 Advanced Math Instructions LN LOG XPY Natural Log LN Operands LN Natural Log Source dest LN source Natural Log Dest The LN instruction takes the natural log of the Source and stores the result in the Destination Relay Ladder Operand Type Format Description Source SINT immediate find the natural log of this value INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text Use LN as a function This function computes the natural log of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text Function Block Operand Format LN tag Type Description FBD MATH ADVANCED structure LN structure FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to math instruction Valid any float
159. within structured text Function Block Operand Type Format Description BOR tag FBD BOOLEAN OR structure BOR structure FBD BOOLEAN OR Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set In1 BOOL First boolean input Default is cleared In2 BOOL Second boolean input Default is cleared In3 BOOL Third boolean input Default is cleared In4 BOOL Fourth boolean input Default is cleared Ind BOOL Fifth boolean input Default is cleared In6 BOOL Sixth boolean input Publication 1756 RMOOSI EN P January 2007 Default is cleared Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 323 Input Parameter Data Type Description In7 BOOL Seventh boolean input Default is cleared In8 BOOL Eighth boolean input Default is cleared Description Output Parameter Data Type EnableOut BOOL Out BOOL Description Arithmetic Status Flags Fault Conditions Execution Condition Enable output The output of the instruction The BOR instruction ORs as many as 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 not affected none Function Block Action prescan No action taken instruction first scan No action taken instructio
160. 007 334 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 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 uM c one scan 4 second scan a tC 4 next scan 4 amp 4 lt 16641 IMPORTANT Avoid using the results ofa 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 rung is true at completion rung is false at completion gt rung condition in multiple scans multiple scans 4 EN bit DN bit LA mE scan of the instruction J operation complete operation complete E 40013 Publication 1756 RMOOSI EN P January 2007 clears status bits and clears status bits and clears POS value clears POS value Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 335 If the rung condition in
161. 01 0 0 0 array_dint2 i result 513 array dint3 Publication 1756 RMOOSI EN P January 2007 488 Special Instructions FBC DDT DTR PID Diagnostic Detect DDT The DDT instruction compares bits in a Source array with bits in a Reference array to determine changes of state Operands Relay Ladder p DbDT IN Diagnostic Detect I END Operand Type Format Description Source m Refe JD oo 2 ENS Source DINT array tag array to compare to the reference Cmp Control LXER2 Length do not use CONTROL POS in the subscript Position perio Reference DINT array tag array to compare to the source Position do not use CONTROL POS in the subscript 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 structure control structure for the results control Length DINT immediate number of storage locations in the result Position DINT immediate current position in the result ATTENTION A Publication 1756 RMOOSI EN P January 2007 initial value typically 0 Use different tags for the compare control structure and the res
162. 03 Transport not supported 0204 Unconnected message timeout 0106 Ownership conflict 0205 Unconnected send parameter error 0107 Connection not found 0206 Message too large 0108 Invalid connection type 0301 No buffer memory 0109 Invalid connection size 0302 Bandwidth not available 0110 Module not configured 0303 No screeners available 0111 EPR not supported 0305 Signature match 0114 Wrong module 0311 Port not available 0115 Wrong device type 0312 Link address not available 0116 Wrong revision 0315 Invalid segment type 0118 Invalid configuration format 0317 Connection not scheduled 011A Application out of connections Publication 1756 RMOOSI EN P January 2007 These are the extended error codes for error code 001F Extended Error Description Code Hex 0203 Connection timeout These are the extended error codes for error code 0004 and 0005 Extended Error Description Code Hex 0000 extended status out of memory 0001 extended status out of instances Input Output Instructions MSG GSV SSV IOT 151 These are the extended error codes for error code OOFF Extended Description Extended Description Error Code Error Code Hex Hex 2001 Excessive IOI 2108 Controller in upload or download mode 2002 Bad parameter value 2109 Attempt to change number of array dimensions 2018 Semaphore reject 210A Invalid symbol name 201B Size too small 210B Symbol does not exist 201C Invalid size 210E S
163. 05 retentive timer on with reset 118 return 438 476 ROUTINE object 192 RTO instruction 105 RTOR instruction 118 RTOS instruction 629 S SBR instruction 438 scaling 508 scan delay function block diagram 648 search mode 492 490 search string 612 sequencer input 422 sequencer instructions introduction 421 SQI 422 SQL 430 SQO 426 sequencer load 430 sequencer output 426 serial port instructions ABL 575 ACB 578 ACL 581 AHL 583 ARD 587 ARL 581 AWA 595 AWT 600 introduction 571 Index 697 SERIAL PORT CONTROL structure 572 574 576 578 584 588 592 596 601 SERIALPORT object 192 set system value 173 SFP instruction 462 SFR instruction 464 shift instructions BSL 388 BSR 392 FFL 396 FFU 402 introduction 387 LFL 408 LFU 414 SIN instruction 522 sine 522 size in elements 384 SIZE instruction 384 sort 373 special instructions DDT 488 DTR 496 FBC 480 introduction 479 PID 499 SFP 462 SFR 464 SQI instruction 422 SQL instruction 430 SQ0 instruction 426 SQR instruction 272 square root 272 SRT instruction 373 SSV instruction objects 176 operands 173 standard deviation 378 status task 194 STD instructions 378 STOD instruction 622 STOR instruction 624 string evaluation in structured text 667 String Concatenate 608 string conversion instructions DTOS 626 introduction 619 LOWER 633 RTOS 629 Publication 1756 RMOOSI EN P January 2007 698 Index STOD 622
164. 07 Example When enabled the FFU instruction unloads array dint 0 into value 2 array dint 0 array dint 5 and shifts the remaining elements in array dint FFU FIFO Unload FIFO array dint D Dest value 2 Control cotro 1 Length 10 Position 5 before FIFO unload after FIFO unload 00000 11111 11111 22222 22222 33333 33333 44444 44444 55555 55555 00000 00000 control 1 pos 6 00000 00000 00000 00000 00000 00000 00000 control 1 pos 5 value 2 00000 Publication 1756 RMOOSI EN P January 2007 408 Array File Shift Instructions BSL BSR FFL FFU LFL LFU LIFO Load LFL The LFL instruction copies the Source value to the LIFO Operands Relay Ladder LFL LIFO Load EN 5 Operand Type Format Description Source DN LIFO 9 EMS Source SINT immediate data to be stored in the LIFO Control Length INT tag Position DINT REAL string structure The Source converts to the data type of the array tag A smaller integer converts to a larger integer by sign extension LIFO SINT array tag LIFO to modify INT specify the first element of the LIFO DINT do not use CONTROL POS in the subscript REAL string 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
165. 1 If You Want This Enter This Structured Text The WHILE DO loop evaluates its conditions first If the conditions are true the controller then executes the statements within the loop This differs from the REPEAT UNTIL loop because the REPEAT UNTIL loop executes the statements in the construct and then determines if the conditions are true before executing the statements again The statements in a REPEAT UNTIL loop are always executed at least once The statements in a WHILE DO loop might never be executed Publication 1756 RMOOSI EN P January 2007 pos 0 While pos 100 targetvalue do amp structarray pos value pos pos 2 String tag DATA pos SINT array pos end while Example 2 If You Want This Move ASCII characters from a SINT array into a string tag In a SINT array each element holds one character Stop when you reach the carriage return 1 Initialize Element number to 0 2 Count the number of elements in S NT array array that contains the ASCII characters and store the result in SINT array size DINT tag 3 If the character at S NT array element number 13 decimal value of the carriage return then stop 4 Set String taglelement number the character at SINT arraylelement number 5 Add 1 to element number This lets the controller check the next character in S NT array 6 Set the Length member of String tag element number This records
166. 1 examine ACC ALEINE P ACC lt PRE DN bit is cleared DN bit is set true rung condition out is set to postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 130 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Example A conveyor brings parts into a buffer zone Each time a part enters limit switcb 1 is enabled and counter 1 increments by 1 Each time a part leaves limit_switch_2 is enabled and counter 1 decrements by 1 If there are 100 parts in the buffer zone counter 1 dn is set conveyor a turns on and stops the conveyor from bringing in any more parts until the buffer has room for more parts restart counter 1 PRES lirnit_switch_1 CTU Count Up Counter counter 1 Preset 100 Accum af CTD Count Down Counter counter 1 Preset 100 Accum of limit_switch_2 counter_1 dn conveyor A m r Publication 1756 RMOOSI EN P January 2007 Count Up Down CTUD Operands CTUD CTUD tag CTUD 041 CTUD Count Up Down ACC j CUEnable CDEnable DN 3 Input Parameter Data Type Enableln BOOL Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 131 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
167. 1 structured text function block bitwise NOT operation Bitwise NOT relay ladder 315 structured text function block logically AND as many as eight boolean inputs Boolean AND BAND structured text 319 function block logically OR as many as eight boolean inputs Boolean OR BOR structured text 322 function block perform an exclusive OR on two boolean inputs Boolean Exclusive OR structured text 325 BXOR function block complement a boolean input Boolean NOT BNOT structured text 328 function block 1 Structured text only 2 In structured text the AND OR XOR and NOT operations can be bitwise or logical Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 285 Move MOV The MOV instruction copies the Source to the Destination The Source remains unchanged Operands l Relay Ladder MOV Source r Operand Type Format Description Dest Source SINT immediate value to move copy INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL E Structured Text dest source Use an assignment with an expression This assignment moves the value in source to dest See Structured Text Programming for information on the syntax of expressions and assignments within structured text Description The MOV instruction copies the S
168. 1 6094378 Structured Text result LN value Function Block LN 01 LN zu Natural Log C Source Publication 1756 RMOOSI EN P January 2007 Advanced Math Instructions LN LOG XPY 549 Log Base 10 LOG The LOG instruction takes the log base 10 of the Source and stores the result in the Destination Operands Relay Ladder LOG Log Base 10 Operand Type Format Description Sourc ARS Source SINT immediate find the log of this value Dest INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest LOG source Use LOG as a function This function computes the log of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text LOG 01 Function Block Loe mg Log Base 10 Operand Type Format Description LOG tag FBD_MATH_ADVANCED structure LOG structure Publication 1756 RMOOSI EN P January 2007 550 Advanced Math Instructions LN LOG XPY FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The
169. 1 connection enabled at the same time Each MSG instruction uses 1 connection NOT enabled at the same time The MSG instructions share the connection that is Together they count as 1 connection EXAMPLE Share a Connection If the controller alternates between sending a block transfer read message and a block transfer write message to the same module then together both messages count as 1 connection Caching both messages counts as 1 on the cache list Publication 1756 RMOOSI EN P January 2007 172 WInput Output Instructions MSG GSV SSV IOT Guidelines As you plan and program your MSG instructions follow these guidelines Guideline 1 For each MSG instruction create a control tag Details Each MSG instruction requires its own control tag e Data type MESSAGE e Scope controller e The tag cannot be part of an array or a user defined data type N 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 ow If your MSG is to a device that uses 16 bit integers use a buffer of INTs in the MSG and DINTs throughout the project If your message is to a device that uses 16 bit integers such as 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 This increases the efficiency of your proje
170. 12 see if the characters are not equal to specific characters NEQ 243 see if the characters are equal to or greater than specific characters GEQ 216 see if the characters are greater than specific characters GRT 220 see if the characters are equal to or less than specific characters LEQ 224 see if the characters are less than specific characters LES 228 find a string in an array of strings FSC 349 Publication 1756 RMOOSI EN P January 2007 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 621 String Data Types You store ASCII characters in tags that use a string data type a e name of controller You can use the default STRING data type It stores up to 82 T vof characters Data Types e You can create a new string data type that stores less or more Er User Defined characters gt 2 38 Strings 8 STRING To create a new string data type see Logix5000 Controllers Common Predefined Procedures publication 1756 PMO01 Ug Module Defined L 1 0 Configuration Each string data type contains the following members Name Data Type Description Notes LEN DINT number of characters The LEN automatically updates to the new count of characters whenever you in the string e use the String Browser dialog box to enter characters e use 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 whi
171. 2 LastAckTime HHInAlarmCount IE z A 2 2 2 a B i amp a 14 HinAlarmCount 1 1 a 3 1 1 2 2 ize qe a Lin AtarmCount 1 1 1 1 1 a 1 7 11 1 1 LLInAlarmCount o 1o o o o o lo Io tg io Activation Message Activation stivati rn tata Activation Message Acknowledged Inactivation Message SeqCount 1 Message Seacount 10 44 SeaCount 18 meri t SeqCount 6 UE TA Time t20 x i ondition Time d ondition CondCount Condition HH i Gondcoun Lg CondCount 4 1 l i i Inactivation Message Inactivation Message inactivation Message Acknowledged Inactivation Message SeaCount 2 SeqCount 7 SeqGount 11 Message SeqCount 19 Time 13 Time t9 Time t13 SeqCount 15 Time t21 Condition L Condition HH n H Time 118 1 Condition HH Acknowledged Condition HH Message i SeqCount 16 H Acknowledge Acknowleagea Acknowledged Time 116 Inactivation Message Message Message Message Condition H SeqCount 3 Seacount 8 SeqCount 12 Time t4 Time tio Time t14 Condition H Condition HH Inactivation Message SeqCount 17 Activation Message Activation Message SeqCount 4 Activation Message SeqCount 9 Time t5 Time t11 SeqCount 13 Time t19 Condition H Condition HH Time t15 Condition HH CondCount 1 CondCount 2 Condition H Activation Message CondCount 2 Seqcount 5 Time t6 Condition HH GCondCount 1
172. 56 RMOOSI EN P January 2007 538 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Condition Enableln is cleared Action EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOOSI EN P January 2007 No action taken Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 539 Example Calculate the arc cosine of value and place the result in result Relay Ladder cs Are Cosine Source value 0 60000002 Dest result 2 2142975 Structured Text result ACOS value Function Block Arc Cosine result value Publication 1756 RMOOSI EN P January 2007 540 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Arc Tangent ATN The ATN instruction takes the arc tangent of the Source value and stores the result in the Destination in radians Operands Relay Ladder ATN Are Tangent Operand Type Format Description Sourc R si Source SINT immediate find the arc tangent of this value Dest INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest ATAN source Use ATAN as a function This function computes the arc tangent of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text ATN 04 Function Block ATN
173. 77 Example 2 Sort int array which is DINTI4 5 After dimension 1 dimension 1 w NO 245 2 3 4 wo a CES g A 0 20 19 18 17 16 0 1 115 14 13 12 11 1 dimension 0 2 110 9 8 7 6 2 315 4 3 2 1 3 Sort File DN 5 Array int array 2 0 Dim to vary 1 Control control 1 Length e Position e Structured Text control_1 LEN 5 control 1 POS ll o SRT int array 2 0 1 control 1 Publication 1756 RMOOSI EN P January 2007 378 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE File Standard Deviation STD 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 Operands Relay Ladder STD E CIC aa aaan a as eo tahdard Deviation EN Operand Type Format Description Array Sree ain UON ITGMETHCREUON DE NN NU ON em Dim ta vary 5 DN Array SINT array tag find the standard deviation of the values in Dest this array 2 LCERS INT Control specify the first element of the group of Length DINT elements to use in calculating the standard REAL do not use CONTROL POS in the subscript A SINT or INT tag converts to a DINT value by sign extension Dimension DINT immediate which dimension to use to vary 0 1 2 depending on the number of dimensions the order is array dim_0 dim
174. 87 masked move with target 290 masks 497 master control reset 454 math conversion instructions DEG 556 FRD 565 introduction 555 RAD 559 TOD 562 TRN 567 math operators structured text 665 MCR instruction 454 MEO instruction 238 message 140 cach connections 170 programming guidelines 172 MESSAGE object 186 MESSAGE structure 140 MID instruction 616 Middle String 616 mixing data types 635 MOD instruction 268 mode of operation 332 MODULE object 188 modulo division 268 MOTIONGROUP object 189 MOV instruction 285 move 285 move instructions BTD 293 BTDT 296 CLR 299 introduction 283 MOV 285 MVM 287 MVMT 290 move logical instructions BAND 319 BNOT 328 BOR 322 BXOR 325 MSG instruction 155 cache connection 170 communication method 169 error codes 148 operands 140 programming guidelines 172 Publication 1756 RMOOSI EN P January 2007 696 Index structure 140 MUL instruction 260 multiplication 260 MVM instruction 287 MVMT instruction 290 natural log 546 NEG instruction 276 negate 276 NEO instruction 243 no operation 459 NOP instruction 459 not equal to 243 NOT instruction 315 numeric expression 663 numerical mode 333 0 objects CONTROLLER 177 CONTROLLERDEVICE 177 CST 181 DF1 182 FAULTLOG 185 GSV SSV instruction 176 MESSAGE 186 MODULE 188 MOTIONGROUP 189 PROGRAM 190 ROUTINE 192 SERIALPORT 192 TASK 194 WALLCLOCKTIME 196 OCON 641 one shot 80 one shot falling 86 one shot falling with input 92
175. 90 This value cannot be changed when the controller 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 catalog number of the controller and memory board The first byte contains a count of the number of ASCII characters returned in the array string ProductCode INT GSV Identifies the type of controller Logix Controller Product Code CompactLogix5320 43 CompactLogix5330 44 CompactLogix5335E 65 ControlLogix5550 3 ControlLogix5553 50 ControlLogix5555 51 ControlLogix5561 54 ControlLogix5562 55 ControlLogix5563 56 DriveLogixb720 48 FlexLogix5433 41 FlexLogix5434 42 SoftLogix5860 15 Publication 1756 RMOOSI EN P January 2007 178 Input Output Instructions MSG GSV SSV IOT Attribute Data Type Instruction Description 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 Publication 1756 RMOOSI EN P January 2007 The serial number is assigned when the device is built Attribute Status Data Type INT Instruction GSV Description Input Output Instructions MSG GSV SSV IOT 179 Bits identify status Bits 3 0
176. 96 FFU 402 file misc 331 FLL 364 FSC 349 LFL 408 LFU 414 mode of operation 332 RES 136 Index sequencer 421 shift 387 SIZE 384 SQI 422 SQL 430 SQ0 426 SRT 373 STD 378 ASCII structured text assignment 663 ASCII chars in buffer 578 ASCII clear buffer 581 ASCII handshake lines 583 ASCII instructions ABL 575 ACB 578 ACL 581 AHL 583 ARD 587 ARL 591 AWA 595 AWT 600 CONCAT 608 DELETE 610 DTOS 626 FIND 612 INSERT 614 LOWER 633 MID 616 RTOS 629 STOD 622 STOR 624 SWPB 301 UPPER 631 ASCII read 587 ASCII read line 591 ASCII test for buffer line 575 ASCII write 600 ASCII write append 595 ASN instruction 532 assignment ASCII character 663 non retentive 662 retentive 661 assume data available 645 647 648 ATN instruction 540 attributes converting data types 635 immediate values 635 AVE instruction 368 average 368 AWA instruction 595 Publication 1756 RMOOSI EN P January 2007 692 Index AWT instruction 600 BAND 319 bit field distribute 293 hit field distribute with target 296 bit instructions introduction 69 ONS 80 OSF 86 OSFI 92 OSR 83 OSRI 89 OTE 74 OTL 76 OTU 78 XIO 72 bit shift left 388 bit shift right 392 bitwise AND 305 bitwise exclusive OR 311 bitwise NOT 315 bitwise operators structured text 669 bitwise OR 308 BNOT 328 BOOL expression structured text 663 Boolean AND 319 Boolean Exclusive OR 325 Boolean NOT 328 Boolean OR 322 BOR 322 b
177. AL MD Boolean Or Digital Alarm InAdarm m oo a o0 Suppressed o Disabled 5 Publication 1756 RMOOSI EN P January 2007 42 Digital Alarm Instruction ALMD Execution Publication 1756 RMOOSI EN P January 2007 Ladder Logic Condition prescan Action The tables below show execution action for Ladder Logic and Function Block programming languages The rung condition out is set to false All operator requests timestamps and delivery flags are cleared The alarm condition is set to OutOfAlarm and Acknowledged rung condition in is false The rung condition out is set to false The In parameter is cleared and the instruction evaluates to determine the alarm rung condition in is true The rung condition out is set to true The In parameter is set a state nd the instruction evaluates to determine the alarm postscan Function Block Condition prescan instruction first scan The rung condition out is set to false Action All operator requests timestamps and delivery flags are cleared The alarm condition is set to OutOfAlarm and Acknowledged No action taken instruction first run No action taken Enableln is cleared The instruction does not execute EnableOut is Cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Digital Alarm Instruction ALMD 43 Digital State Timing These
178. ALMA Tank32Level In Tank32LT 00e ProgAckAll Tank32LevelAck 0e ProgDisable 0 ProgEnable 0 HHLimit 90 0 HLimit 80 0 LLimit 00e LLLimit 00e Structured Text ALMA Tank32Level Tank32LT Tank32LevelAck 0 0 ROCPoslnAlarm ROCNeglnAlarm 5 HHAcked em HAcked eem LAcked em LLAcked em ROCPosAcked em ROCNegAcked em Suppressed Function Block 0 0 TankezLT DO Cj In a E Pro gA dc AI Ta nks2 Le velAck Tank32Le vel Analog Alarm Instruction ALMA 63 ALMA Analog Alam HH Inl a rm LL Inl a rm RO CPoslnA a rm RO CNeginAl arm RO CP osAcke d ROCNegAcked Suppressed HinAlarm LinAlarm 3 3 LB j 3 HH Acke d 5 iJ a 3 ao 3 HAcked LAcked LLAcked G D 4 4 G66 OO 9o Disabled Publication 1756 RMOOSI EN P January 2007 64 Analog Alarm Instruction ALMA Execution Publication 1756 RMOOSI EN P January 2007 The tables below show execution action for Ladder Logic and Function Block programming languages Ladder Logic Condition prescan Action The rung condition out is set to false All operator requests timestamps and delivery flags are cleared All alarm conditions are set to OutOfAlarm and Acknowledged rung condition in is false The rung condition out is set to false rung condition in is true The rung condition out is set to true postscan Function Block Condition p
179. AT statement 448 IF bool expression2 THEN EXIT amp optional END IF UNT IL bool expressionl END REPEAT Publication 1756 RMOOSI EN P January 2007 statements to execute while bool expression is false If there are conditions when you want to exit the loop early use other statements such as an IF THEN construct to condition an EXIT statement Structured Text Programming 685 The following diagrams show how a REPEAT UNTIL loop executes and how an EXIT statement leaves the loop early statement 1 statement 2 statement 3 BOOL expression trug false rest of the routine While the boo1 expression is false the controller executes only the statements within the REPEAT UNTIL loop Arithmetic Status Flags not affected Fault Conditions A Major Fault Will Occur If statement 1 yt statement 2 statement3 yes no v BOOL expression tug Xi false rest of the routine To stop the loop before the conditions are false use an EXIT statement Fault Type Fault Code the construct loops too long 6 1 Example 1 If You Want This The REPEAT UNTIL loop executes the statements in the construct and then determines if the conditions are true before executing the statements again This differs from the WHILE DO loop because the WHILE DO The WHILE DO loop evaluates its conditions first If the conditi
180. Allen Bradley Logix5000 Controllers General Instructions Reference Manual mn e i ar ae Rockwell Automation Important User Information Solid state equipment has operational characteristics differing from those of electromechanical equipment Safety Guidelines for the Application Installation and Maintenance of Solid State Controls publication SGI 1 1 available from your local Rockwell Automation sales office or online at http literature rockwellautomation com describes some important differences between solid state equipment and hard wired electromechanical devices Because of this difference and also because of the wide variety of uses for solid state equipment all persons responsible for applying this equipment must satisfy themselves that each intended application of this equipment is acceptable 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 Re
181. CONCAT DELETE FIND INSERT MID 617 Description The MID instruction copies a group of characters from the Source and places the result in the Destination e The Start position and Quantity define the characters to copy e Unless the Source and Destination are the same tag the Source remains unchanged Arithmetic Status Flags not affected Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is 1 Check that no instruction is writing to the LEN member of the string tag greater than the DATA size of the string tag 2 In the LEN value enter the number of characters that the string contains 4 56 The Start or Quantity value is invalid 1 Check that the Start value is between 1 and the DATA size of the Source 2 Check that the Start value plus the Quantity value is less than or equal to the DATA size of the Source Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction copies the specified characters from a string and stores them in another string postscan The rung condition out is set to false No action taken Example I
182. Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Condition Relay Ladder Action Structured Text Action Enableln is set na Enableln is always set The instruction executes instruction execution The instruction converts the Source to upper case postscan The rung condition out is set to false No action taken 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 Germinal read EM 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 Relay Ladder terminal read EM UPPER Upper Case Source catalog number abed Dest catalog number upper case ABCD Structured Text IF terminal read EM THEN UPPER catalog number catalog number upper case terminal read EM 0 END IF Publication 1756 RMOOSI EN P January 2007 Lower Case LOWER Operands LOWER Lower Case Source LOWER Source Dest Description Arithmetic Status Flags Fault Conditions Execution ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 633 The LOWER instruction converts the alphabetical characters in a string
183. Create a new string data type that is large enough for the output string Use the new string data type as the data type for the destination Publication 1756 RMOOSI EN P January 2007 630 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na Enableln is set The rung condition out is set to true na Enableln is always set The instruction executes instruction execution The instruction converts the Source postscan The rung condition out is set to false send data No action taken Example 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 asc ii with other strings to produce a complete message for a display terminal You may see a slight difference between the fractional parts of the Source and Destination Relay Ladder Structured Text IF send data THI Gl RTOS Real to String Source data_1 15 3001 Dest data_1_ascii 15 3001003 RTOS data_1 data_l_ascii send_data END_IF Publication 1756 RMOOSI EN P January 2007 Upper Case UPPER Operan
184. D CTUD RES 127 The CTD instruction counts downward This instruction is available in structured text and function block as CTUD see page 131 Operands Relay Ladder CTD Operand Type Format Description Count Down CCD 5 p yp p M CON gt Counter COUNTER tag counter structure rese f Accum Preset DINT immediate how low to count Accum DINT immediate number of times the counter has counted initial value is typically 0 COUNTER Structure Mnemonic Data Type Description CD BOOL The count down enable bit indicates that the CTD instruction is enabled DN BOOL The done bit indicates that ACC 2 PRE OV BOOL The overflow bit indicates that the counter exceeded the upper limit of 2 147 483 647 The counter then rolls over to 2 147 483 648 and begins counting up again UN BOOL The underflow bit indicates that the counter exceeded the lower limit of 2 147 483 648 The counter then rolls over to 2 147 483 647 and begins counting down again PRE DINT The preset value specifies the value which the accumulated value must reach before the instruction sets the DN bit ACC DINT The accumulated value specifies the number of transitions the instruction has counted Publication 1756 RMOOSI EN P January 2007 128 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Description The CTD instruction is typically used with a CTU instruction that references the same counter structure When en
185. DINT REAL A SINT or INT tag converts to a DINT value by sign extension Structured Text Structured text does not have a LIM instruction but you can achieve the same results using structured text IF LowLimit lt HighLimit AND Test gt LowLimit AND Test lt HighLimit OR LowLimit gt HighLimit AND Test lt LowLimit OR Test gt HighLimit THEN lt statement gt END_IF Publication 1756 RMOOSI EN P January 2007 LIM 01 LIM fal Limit Test CIRC LowLimit Dest E C HighLimit Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 233 Function Block Operand Type Format Description LIM tag FBD_LIMIT structure LIM structure FBD_LIMIT Structure Input Parameter Data Type Description Enableln BOOL If cleared the instruction does not execute and outputs are not updated If set the instruction executes as described under Execution Default is set LowLimit REAL Value of lower limit Valid any float Test REAL Value to test against limits Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition out for the relay ladder LIM instruction HighLimit REAL Value of upper limit Valid any float Description The LIM instruction tests whether the Test value is within the range of the Low Limit to the High Limit
186. 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 DiagnosticCounters INT 19 GSV Array of diagnostic counters for the DF1 communication driver word offset DF1 point to point DF1 slave master 0 signature 0x0043 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 13 lost modem count 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 unused normal scant time last 18 ENOs sent unused unused DuplicateDetection SINT GSV Enables duplicate message detection Value Meaning 0 duplicate message detection disabled non zero duplicate message detection disabled EmbeddedResponseEnable SINT GSV Ena
187. EAL TRN truncate DINT REAL COS cosine REAL XOR bitwise exclusive OR DINT DEG radians to degrees DINT REAL FRD BCD to integer DINT LN natural log REAL Format Expressions For each operator that you use in an expression you have to provide one or two operands tags or immediate values Use the following table to format operators and operands within an expression For Operators That Use This Format Examples Operate On one operand operator operand ABS tag a two operands operand aoperatoroperand b e tag b45 e tag c AND fag d e tag e 2 MOD tag f tag 9 Publication 1756 RMOOSI EN P January 2007 252 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Publication 1756 RMOOSI EN P January 2007 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 ACS ASN ATN COS DEG FRD LN LOG RAD SIN SQR TAN TOD TRN 3 2 4 negate NOT 5 MOD 6 subtract 7 AND 8 XOR 9 OR Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS
188. EQU GEO GRT LEQ LES LIM MEQ NEQ 225 Function Block Operand Type Format Description LEQ tag FBD_COMPARE structure LEO structure FBD COMPARE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to test against SourceB Valid any float SourceB REAL Value to test against SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition out for the relay ladder LEO instruction Description The LEQ instruction tests whether Source A is less than or equal to Source B When you compare strings e The hexadecimal values of the characters determine if one string is less than or greater than another string For the hex code of a character see the back cover of this manual e When the two strings are sorted as in a telephone directory the order of the strings determines which one is greater ASCII Characters Hex Codes 1ab 31 61 62 LA a stb 31862 e r A 41 S e L IT S a AB 41 42 AB B e t as Eti i B 42 r a 61 a B Y ab 61 62 Publication 1756 RMOOSI EN P January 2007 226 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Arithmetic Status Flags not affected Condition p
189. EnableOut is set postscan Example The FRD instruction converts value a to a decimal value and places Publication 1756 RMOOSI EN P January 2007 No action taken the result in result_1 Relay Ladder FRD From BCD Source value a 1610043 Dest result 1 43 Function Block FRD 01 FRD From BCD 0 value a D Source C result_1 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 567 Truncate TRN The TRN instruction removes truncates the fractional part of the Source and stores the result in the Destination Operands Relay Ladder TRAN Truncate Operand Type Format Description Source Source REAL immediate value to truncate Dest EN tag 7 Destination SINT tag tag to store the result INT DINT REAL Structured Text dest TRUNC source Use TRUNC as a function This function truncates source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text TRN 04 Function Block TRN Ez Viana Operand Type Format Description TRN tag FBD TRUNCATE structure TRN structure FBD TRUNCATE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the conversion instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction pr
190. EnableTimeOut DINT GSV Enables or disables the timeout function of an event task SSV To Set the attribute to disable the timeout function 0 enable the timeout function 1 or any non zero value InhibitTask DINT GSV Prevents the task from executing If a task is inhibited the controller still prescans the task when the controller transitions from program SSV to run or test mode To Set the attribute to enable the task 0 default inhibit disable the task 1 or any non zero value Instance DINT GSV Provides the instance number of this TASK object Valid values are 0 31 LastScanTime DINT GSV Time it took to execute this task the last time it was executed Time is in microseconds SSV Maxlnterval DINT 2 GSV The maximum time interval between successive executions of the task DINT 0 contains the lower 32 bits of the value DINT 1 SSV contains the upper 32 bits of the value A value of 0 indicates 1 or less executions of the task MaxScanTime DINT GSV Maximum recorded execution time for this program Time is in microseconds SSV MinInterval DINT 2 GSV The minimum time interval between successive executions of the task DINT 0 contains the lower 32 bits of the value DINT 1 SSV contains the upper 32 bits of the value A value of 0 indicates 1 or less executions of the task OverlapCount DINT GSV Number of times that the task was triggered while it was still executing Valid for an event or a periodic task SSV Publication 1756 RMOOSI EN
191. Equal Source A remote rack 1 l Data 0 2 1111 1111 1111 1111 Source B int 0 2 1111 1111 1111 1111 42093 EXAMPLE Mixing an INT tag with an immediate value Since remote rack 1 I Data O is an INT tag the value to check it against first moves into int_O also an INT tag The EQU instruction then compares both tags MOV EQU Move Equal Source 271111 1111 1111 1111 Source A remote rack 1 l Data 0 2 111 1111 1111 1111 Dest int 0 Source B int 0 25111 1111 1111 1111 2 111 1111 1111 1111 Joel Common Attributes 639 Integer to REAL The controller stores REAL values in IEEE single precision floating point number format It uses one bit for the sign of the value 23 bits for the base value and eight bits for the exponent 32 bits totaD If you mix an integer tag SINT INT or DINT and a REAL tag as inputs in the same instruction the controller converts the integer value to a REAL value before the instruction executes A SINT or INT value always converts to the same REAL value e A DINT value may not convert to the same REAL value A REAL value uses up to 24 bits for the base value 23 stored bits plus a hidden bit A DINT value uses up to 32 bits for the value Cone for the sign and 31 for the value If the DINT value requires more than 24 significant bits it may not convert to the same REAL value If it will not the controller rounds to the nearest REAL value u
192. FR EVENT 453 Example You can use the TND instruction when debugging or troubleshooting to execute logic up to a certain point Progressively move the TND instruction through the logic as you debug each new section When the TND instruction is enabled the controller stops scanning the current routine Relay Ladder CTND gt Structured Text TND Publication 1756 RMOOSI EN P January 2007 454 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Master Control Reset MCR Operands CMCR gt Description Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 The MCR instruction used in pairs creates a program zone that can disable all rungs within the MCR instructions Relay Ladder none When the MCR zone is enabled the rungs in the MCR zone are scanned for normal true or false conditions When disabled the controller still scans rungs within an MCR zone but scan time is reduced because non retentive outputs in the zone are disabled The rung condition in is false for all the instructions inside of the disabled MCR zone When you program an MCR zone note that e You must end the zone with an unconditional MCR instruction e You cannot nest one MCR zone within another e Do not jump into an MCR zone If the zone is false jumping into the zone activates the zone from the point to which you jumped to th
193. File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Condition Relay Ladder Action rung condition in is true ER bit 0 examine ER bit mode no page 9 343 numeric DN bit is set y POS POS 1 Y ER bit 1 no no examine DN bit ALL mode DN bit 1 yes yes yes a DN bit is set INC ALL mode mode page 9 341 page 9 342 q loop count loop count 1 loop count 0 W ie POS POS 1 yes Y evaluate expression no ii Y yes POS POS 1 ER bit is set Publication 1756 RMOOSI EN P January 2007 rung condition out is set true Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 341 Condition Relay Ladder Action EN bit 1 examine EN bit EN bit 0 examine internal bit POS POS 1 internal bitis set yes yes no no EN bit is set POS POS 1 loop_count 1 Y a DN bit is set Y rung condition out is set to true page 9 340 Publication 1756 RMOOSI EN P January 2007 342 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Condition Relay Ladder Action ALL mode EN bit 2 0 amine bit 1 exa
194. General Connection Maximum Consumers E Check this box MW v Programmatically IOT Instruction Send Event Trigger to Consume This configures the tag to update its event trigger only via an IOT instruction Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 201 The type of network between the controllers determines when the consuming controller receives the new data and event trigger via the IOT instruction With This Controller Over This Network The Consuming Device Receives The Data And Event Trigger ControlLogix backplane immediately EtherNet IP network immediately ControlNet network within the actual packet interval API of the consumed tag connection SoftLogix5800 You can produce and consume tags only over within the actual packet interval API of the a ControlNet network consumed tag connection The following diagrams compare the receipt of data via an IOT instruction over EtherNet IP and ControlNet networks EtherNet IP network ControlNet network values loaded into ger 7 values loaded into a v produced tag produced tag IOT instruction in the JOT instruction in the producing controller i producing controller i H EE NE XI event task in the RPI of the produced tag consuming controller I I event task in the 9 AIRES consuming controller nong Arithmetic Status Flags not affected Fault Conditions none Pub
195. I ESELTOTUEE ITE 635 Immediate Vales y v udi ies sido e De a t ee RR 635 Data CODVOtSJOHS ss Vea o i OE es oes Ee cuta 635 SINT or INT to DINT oa nin IIb Be dene and Y pt petes 637 Ittieger TG BEND s sme Pa eee Guns re pda 639 DINT to SINT or INT 1 ora dcc edet X XI CEN 639 REALAG dB iesu r4 S he iria EGAri POL eee See 640 Appendix B Introduction 4 pd cs ccs Sth ht UB ae tye cal BAe Seon atsethe Sent 641 Choose the Function Block Elements 641 Latehine Data sa iari ewer Ried cu era ed tene itu us 642 Order of Executiofkc 1o cup b Te PORE e pera 644 Besolve d LOOD aS erc drei bet ded aust Ge pde 645 Resolve Data Flow Between Two Blocks 647 Create a One Scan Delay io ss209 eae PIER EE 648 SUMMATY cosh Sond EE OS ETT or Ae RA A asap Be 648 Function Block Responses to Overflow Conditions 649 Tiing M des Ales sea cr he ER E OL OEE EIS 650 Common instruction parameters for timing modes 652 Overview of timing modes 005 654 Program Operator Control eying aaa CORE RE 655 Structured Text Programming Index Back Cover Table of Contents 13 Appendix C TOLFOGIDIGHOE 2 4 odes optata dE cito cete teal at IE NUS 659 Structured Text Syntax X ev ea bo YO ERR 659 PSS IO TNT TAS ic cede de ded pad Puri qoe uico ad o aee qnd 661 Specify a non retentive assignment 662 Assign an ASCII character to a string iiis 663 Expressions Cus tac ine Sane pr aliae d
196. ID UIE AFI NOP EOT SFP SFR EVENT Jump to Label JMP Label LBL Operands MP LBL Description Publication 1756 RMOOSI EN P January 2007 The JMP and LBL instructions skip portions of ladder logic Relay Ladder Operand Type Format Description JMP instruction Label name label name enter name for associated LBL instruction LBL instruction Label name label name execution jumps to LBL instruction with referenced label name When enabled the JMP instruction skips to the referenced LBL instruction and the controller continues executing from there When disabled the JMP instruction does not affect ladder execution 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 s needed Jumping backward lets the controller repeat iterations of logic Be careful not to jump backward an excessive number of times The watchdog timer could time out because the controller never reaches the end of the logic which in turn faults the controller Jumped logic is not scanned Place critical logic outside the jumped zone A The LBL instruction is the target of the JMP instruction that has the same label name Make sure the LBL instruction is the first instruction on its rung A label name must be unique within a routine The name can e have as many as 40 characters e contain letters numbe
197. ING data type e any new string data type that you create Start SINT immediate position in Source to start Enter a number between 1 and the DATA size of the search the Source INT tag DINT Result SINT tag tag that stores the starting position of the string to find INT DINT Structured Text FIND Source Search Start Result Publication 1756 RMOOSI EN P January 2007 The operands are the same as those for the relay ladder FIND instruction described above ASCII String Instructions CONCAT DELETE FIND INSERT MID 613 Description The 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 Arithmetic Status Flags not affected Fault Conditions Type Code Cause Recovery Method greater than the DATA size of the string tag 2 In the LEN value enter the number of characters that the string contains 4 56 The Start value is invalid Check that the Start value is between 1 and the DATA size of the Source Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes ins
198. 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 Locallndex DINT If you use an asterisk to designate the element number of the local array the Locallndex provides the element number To change the element number set this member to the required value If the message Then the local array is the reads data Destination element writes data Source element Channel SINT 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 If the message Then specify the slot number in goes over this network universal remote I O octal ControlNet decimal 0 15 Path STRING To send the message to a different controller set this member to the ne
199. INT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest source Use the minus sign as an operator in an expression This expression changes the sign of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text NEG 01 Function Block NEC gg Negate Operand Type Format Description NEG tag FBD_MATH_ADVANCED structure NEG structure Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS FBD MATH Structure 271 Arithmetic Status Flags Fault Conditions Execution Condition prescan positive value the result is negative Arithmetic status flags are affected none Relay Ladder Action The rung condition o ut is set to false Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated default is set Source REAL Value to negate valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description If you negate a negative value the result is positive If you negate a rung condition in is false The rung condition o ut is set to f
200. INT structure DINT not converted REAL structure REAL not converted Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 366 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true end address start address Length number of bytes in a destination element end address end of destination array end address end of destination array source address Source Y destination address yes end address copy data in source addressto destination address destination address destination address 1 Y rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 367 Example The FLL instruction copies the value in value 1 into dest 1 Relay Ladder Fill File Source Dest Lenath FLL value 1 dest 1 1 Source value 1 Source value 1 Destination Destination Data Type Value dest 1 Data Type dest 7 Value After
201. Instruction Locator 27 Instruction Location Languages MEQ 238 relay ladder Mask Equal to structured text function block MID relay ladder Middle String structured text MOD Modulo MOV Move MSG Message relay ladder structured text MUL Multipl A function block MVM Masked Move Instruction Location Languages MVMT 290 structured text Masked Move with Target function block NEG 276 relay ladder Negate structured text function block NEQ 243 relay ladder Not Equal to structured text function block NOP 459 relay ladder No Operation NOT 315 relay ladder Bitwise NOT structured text function block OCON 641 function block Output Wire Connector ONS 80 relay ladder One Shot OR 308 relay ladder Bitwise OR structured text function block OREF 641 function block Output Reference OSFI 92 structured text One Shot Falling with Input function block OSF 86 relay ladder One Shot Falling OSRI 83 structured text One Shot Rising with Input function block OSR 83 relay ladder One Shot Rising OTE 74 relay ladder Output Energize OTL 76 relay ladder Output Latch OTU 78 relay ladder Output Unlatch Publication 1756 RMOOSI EN P January 2007 28 Instruction Locator Instruction PID Proportional Integral Derivative RAD Radians Location 559 Languages relay ladder structured text function bloc
202. January 2007 Function Block Attributes 655 Program Operator Control Several instructions support the concept of Program Operator control These instructions include e Enhanced Select ESEL e Totalizer TOT e Enhanced PID PIDE e Ramp Soak RMPS e Discrete 2 State Device D2SD e Discrete 3 State Device D3SD Program Operator control lets you control these instructions simultaneously from both your user program and from an operator interface device When in Program control the instruction is controlled by the Program inputs to the instruction when in Operator control the instruction is controlled by the Operator inputs to the instruction Program or Operator control is determined by using these inputs Input Description ProgProgReq A program request to go to Program control ProgOperReq A program request to go to Operator control OperProgReq An operator request to go to Program control OperOperReq An operator request to go to Operator control To determine whether an instruction is in Program or Control control examine the ProgOper output If ProgOper is set the instruction is in Program control if ProgOper is cleared the instruction is in Operator control Operator control takes precedence over Program control if both input request bits are set For example if ProgProgReq and ProgOperReq are both set the instruction goes to Operator control Publication 1756 RMOOSI EN P January 2007 656 Fun
203. L 01 Function Block MUL xj Multiply Operand Type Format Description MUL tag FBD_MATH structure MUL structure Q Sources SourceB Publication 1756 RMOOSI EN P January 2007 Input Parameter Data Type Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 261 FBD MATH Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source A REAL Value of the multiplicand Valid any float Source B REAL Value of the multiplier Output Parameter Data Type EnableOut BOOL Dest REAL Description Arithmetic Status Flags Fault Conditions Execution Condition prescan rung condition in is false Valid any float Description The instruction produced a valid result Result of the math instruction Arithmetic status flags are set for this output The MUL instruction multiplies Source A with Source B and places the result in the Destination Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false The rung condition out is set to false rung condition in is true Destination Source B x Source A The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 262 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Function Bloc
204. L values This expression evaluates whether operand is cleared false See Structured Text Programming for information on the syntax of expressions within structured text Function Block Operand Type Format Description BNOT tag FBD BOOLEAN NOT structure BNOT structure FBD BOOLEAN NOT Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set In BOOL Input to the instruction Default is set Output Parameter Data Type Description EnableOut BOOL Enable output Out BOOL The output of the instruction Description The BNOT instruction complements a boolean input Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 Out NOT In not affected none Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 329 Execution Condition Function Block Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Example 1 This example complements boo in1 and places the result in Example 2 value result not If BOOL IN1 Is Then VALUE RESULT NOT Is 0 1 1 0 Structured Text value result not NOT bool inl Funct
205. M BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 311 Function Block value result or SourceB Bitwise Exclusive OR XOR 7he XOR instruction performs a bitwise XOR operation using the bits in Source A and Source B and places the result in the Destination To perform a logical XOR see page 13 325 Operands Relay Ladder XOR Bitwise Exclusive OR Source Operand Type Format Description Source B k Source A SINT immediate value to XOR with Source B Dest i INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Source B SINT immediate value to XOR with Source A INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Destination SINT tag stores the result INT DINT E Structured Text dest sourceA XOR sourceB g Use XOR as an operator within an expression This expression evaluates sourceA XOR sourceB See Structured Text Programming for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 312 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT XOR 01 Function Block xoR mg Bitwise Exclusive OR Operand Type Format Description XOR tag FBD_LOGICAL structure XOR structure SourceA Dest Q SourceB FBD_LOGICAL Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute a
206. Mask SINT immediate which bits to block or pass INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Destination SINT tag tag to store the result INT DINT Structured Text This instruction is available in structured text as MVMT Or you can combine bitwise logic within an expression and assign the result to the destination This expression performs a masked move on Source See Structured Text Programming for information on the syntax of expressions and assignments within structured text The MVM instruction uses a Mask to either 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 Os so that they are the same size as the largest data type Publication 1756 RMOOSI EN P January 2007 288 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Enter 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 162 hexadecimal for example 16 0FOF 0f octal for example 8216 2 binary for example 2 00110011 Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions none Execut
207. N instruction is disabled the ACC value is cleared rung condition in timer enable bit EN timer timing bit TT timer done bit DN preset timer accumulated value ACC g timer did not reach Eh g PRE value ON delay ru 16649 How a timer runs A timer runs by subtracting the time of its last scan from the time now 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 Make sure to scan the timer at least every 69 minutes while it runs Otherwise the ACC value won t be correct The last_t ime_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 e subroutine sequential function chart SFC e event or periodic task e state routine of a phase Arithmetic Status Flags not affected Fault Conditions section of code that is between JMP and LBL instructions A Major Fault Will Occur If Fault Type Fault Code PRE lt 0 34 ACC lt 0 34 Publication 1756 RMOOSI EN P January 2007 98 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Execution Condition Relay Ladder Action pr
208. NOT Publication 1756 RMOOSI EN P January 2007 Use Strings In an Expression 0 211 BO UAL TO CE apu dic hon d uox dene Qd oec OE xe ichs ie ag 212 Greater than or Equal to GEQ 4 iL Leo ed ob 216 Greater Than GRT vacuo esg kf io aera a 220 Less Than or Equal to EQ ied EE REG TCR 224 Less Than WES sa ato eod e doter Rede dene 228 iit ChDND S usos Ve Pe RNS Pe DEREK Se BUG ON SAS 252 Mask Equal to MEQ c 4 ra stre tone tod m Ein RR het 238 Entering an Immediate Mask Value 239 Not Equal TOXNEGO S cies 55 oem no RS Kor tede scores Fi ee 243 Chapter 7 Introductio 4 e Lu IRE etch ea wemifecs eh esae See 247 Compute COE Do eon Beet pe bed oa densos e 249 Valid operators oe as vuoi aot pe x acie Bop RO qe o o eoe n 25 Format Expressiols s veo kes o ONS ES VN EX GRE Ru 251 Determine the order of operation 252 Add ADD quei ater doa dote RR or ode a ea t AN 253 Subtract COWS tay adum ANE EGRE rop OX OE 257 Multiply MUL co sseuetituu ode Eua biet va pier ri 260 TOTTI coo tesa vbi bebe eh exp dur er pedea sed 263 Modulo MOD i pax qe REDE LA Ye PEE RR 268 Square RoDEESO BONA Wastes Porte sms gestu pats A eus 272 Negate UNEGD E v e ot whl sto S GS Poy ow ein Eee 9s 276 Absolute Value AB9 c oss unam euh xoa ecd 279 Chapter 8 itr OCDHOHORE ru ss eats cuc WX BV ee eee OPES OES 283 Move CIV ia qnd a acr ea hmg e doge d ort i ED EH AED 285 Masked Move MVM i op ocar
209. NR instruction is disabled e ACC 2 PRE The time base is always 1 msec For example for a 2 second timer enter 2000 for the PRE value TimerEnable preset Ps 16649 timer did not v timer accumulated value ACC g T reach PRE value Set the Reset input parameter to reset the instruction If TimerEnable is set when Reset is set the TONR 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 time now ACC ACC current_time last time scanned Publication 1756 RMOOSI EN P January 2007 112 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES After it updates the ACC the timer sets last time scanned current time This gets the timer ready for the next scan Make sure to scan the timer at least every 69 minutes while it runs Otherwise the ACC value IMPORTANT i won t be correct The ast 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 wont be correct if this happens While a timer runs scan it within 69 minutes if you put it in a e subroutine e section of code that is between JMP and LBL instructions e sequential function chart SFC e event or periodic task e state routine of a phase Arithmetic Status Flags not affected Condition
210. NT The position stores the status of the control lines ERROR DINT The error contains a hexadecimal value that identifies the cause of an error Publication 1756 RMOOSI EN P January 2007 Description The AHL instruction can e obtain the status of the control lines of the serial port e turn on or off the data terminal ready DTR signal e turn on or off the request to send signal RTS To program the AHL instruction follow these guidelines 1 Configure the serial port of the controller If Your Application Then uses ARD or ARL instructions Select User mode does not use ARD or ARL Select either System or User mode instructions 2 Use the following table to select the correct values for the ANDMask and ORMask operands ANDMask Value ORMask Value off off 3 0 on 1 2 unchanged 1 0 on off 2 1 on 0 3 unchanged 0 1 unchanged off 2 0 on 0 2 unchanged 0 0 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 585 3 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See Arithmetic Status Flags not affected Fault Conditions Type Code Cause 4 57 The AHL instruction failed to execute because the serial port is set to no handshaking Condition prescan Execution Relay Ladder Act
211. NVERT structure TOD structure FBD CONVERT Structure Input Parameter Data Type Description Enableln 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 Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest DINT Result of the conversion instruction Arithmetic 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 If you enter a negative Source the instruction generates a minor fault and clears the Destination Arithmetic Status Flags Arithmetic status flags are affected Publication 1756 RMOOSI EN P January 2007 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 563 Fault Conditions A Minor Fault Will Occur If Fault Type Fault Code Source 0 4 4 Execution Relay Ladder Condition Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true no source 99 999 999 convert source to BCD yes S V is set to rung condition out is set to true rung condition in is true The controller converts the Source to BCD and places the result in the Destination
212. ORT NEG ABS 265 If Source B the divisor is zero e a minor fault occurs Type 4 program fault Code 4 arithmetic overflow e the destination is set as follows If Source B Is Zero And And The Destination Is a And The Result Is Then The Destination Is Set To all operands are integers SINT INT gt gt Source A or DINT at least one operand is a REAL SINT INT or DINT positive 1 negative 0 REAL positive 1 positive infinity negative 1 negative infinity To detect a possible divide by zero examine the minor fault bit S MINOR See Log x5000 Controllers Common Procedures publication 1756 PM001 Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions A Minor Fault Occurs If Fault Type Fault Code the divisor is zero 4 4 Execution Relay Ladder Condition Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Destination Source A Source B The rung condition out is set to true postscan The rung condition out is set to false Function Block Publication 1756 RMOOSI EN P January 2007 266 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Condition prescan Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is clea
213. OSI EN P January 2007 398 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Execution Condition Relay Ladder Action prescan EN bit is set to prevent a false load when scan begins LEN 0 ye t yes no EM is cleared EM is set yes EM is set no a yes DN is set no m rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Condition rung condition in is false EN bit is cleared LEN 0 yes Relay Ladder Action Array File Shift Instructions BSL BSR FFL FFU LFL LFU 399 v POS 0 yes V EM is cleared yes Y EM is set EM is set yes DN is set rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 no LEN size of array 400 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Condition Relay Ladder Action rung condition in is true EN bit is set p ii no POS 0 e Y EM bit is cleared EM bit is set yes POS 0 DN is cleared no Y EM bit is set EM bit is cleared yes o DN bit is set Y no Al mast EM bit is set POS or 8
214. OT GSV SSV Objects When you enter a GSV SSV instruction you specify the object and its attribute that you want to access In some cases there will be more than one instance of the same type of object so you might also have to specify the object name For example there can be several tasks in your application Each task has its own TASK object that you access by the task name 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 You can access these objects For Information About This Object See This Page Or Publication AXIS ControlLogix Motion Module Setup and Configuration Manual publication 1756 UM006 CONTROLLER 5 177 CONTROLLERDEVICE 5 177 CST 5 181 DFI 5 182 FAULTLOG 5 185 MESSAGE 5 186 MODULE 5 188 MOTIONGROUP 5 189 PROGRAM 5 190 ROUTINE 5 192 SERIALPORT 5 192 TASK 5 194 WALLCLOCKTIME 5 196 Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 177 Access the CONTROLLER object The CONTROLLER object provides status information about a controller s execution Attribute Data Type Instruction Description TimeSlice INT GSV Percentage of available CPU that is assigned to communications SSV Valid values are 10
215. OUTINE name routine to execute that is subroutine name Input BOOL immediate data from this routine that you want to copy parameter to a tag in the subroutine SINT tag e Input parameters are optional INT array tag e Enter multiple input parameters if DINT needed REAL structure Return BOOL tag tag in this routine to which you want to copy parameter a result of the subroutine SINT array tag e Return parameters are optional INT e Enter multiple return parameters if DINT needed REAL structure Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 439 Structured Text JSR RoutineName InputCount Operand Type Format Description E een re Routine ROUTINE name routine to execute that is subroutine name Input count SINT immediate number of input parameters INT DINT REAL Input BOOL immediate data from this routine that you want to copy parameter to a tag in the subroutine SINT tag e nput parameters are optional INT array tag e Enter multiple input parameters if DINT needed REAL structure Return BOOL tag tag in this routine to which you want to copy parameter a result of the subroutine SINT array tag e Return parameters are optional INT e Enter multiple return parameters if DINT needed REAL structure JSR operands continued on next page JSR Operands continued Function Block X SR gg Jump to Subroutine Routine
216. Operands XPY X To Power Of Y Source X Source Y dest sourceX sourceY XPY 04 xPY nf X To Power Of Y 0 0 SourceA Dest D SourceB Publication 1756 RMOOSI EN P January 2007 The XPY instruction takes Source A OO to the power of Source B Y and stores the result in the Destination Relay Ladder Operand Type Format Source X SINT immediate INT tag DINT REAL Description base value Source Y SINT immediate INT tag DINT REAL exponent Destination SINT tag INT DINT REAL Structured Text tag to store the result Use two adjacent multiply signs as an operator within an expression This expression takes sourceX to the power of sourceY and stores the result in dest See Appendix B for information on the syntax of expressions within structured text Function Block Operand Type XPY tag FBD MATH Format Description structure XPY structure Input Parameter Data Type Advanced Math Instructions LN LOG XPY 553 FBD MATH Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source X REAL Base value Valid any float Source Y REAL Exponent Output Parameter Data Type EnableOut BOOL Dest REAL Description Arithmetic Status Flags Fault Conditions Execution Condition prescan Valid any float Description The instruction produced a valid
217. Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Publication 1756 RMOOSI EN P January 2007 Description Arithmetic Status Flags Fault Conditions Execution Condition prescan Advanced Math Instructions LN LOG XPY 547 The Source must be greater than zero otherwise the overflow status bit S V is set The resulting Destination is greater than or equal to 87 33655 and less than or equal to 88 72284 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller calculates the natural log of the Source and places the result in the Destination The rung condition out is set to true postscan Condition prescan The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 548 Advanced Math Instructions LN LOG XPY Example Calculate the natural log of value and place the result in result Relay Ladder Example LN Natural Log Source value 5 0 Dest result
218. P January 2007 To clear the count set the attribute to 0 Input Output Instructions MSG GSV SSV IOT 195 Attribute Data Type Instruction Description Priority INT GSV Relative priority of this task as compared to the other tasks SSV Valid values 0 15 Rate DINT GSV If the task type is Then the Rate attribute specifies the SSV aa T periodic Period for the task Time is in microseconds event The timeout value for the task Time is in microseconds StartTime DINT 2 GSV Value of WALLCLOCKTIME when the last execution of the task was started DINT 0 contains the lower 32 bits of the value SSV DINT 1 contains the upper 32 bits of the value Status DINT GSV Provides status information about the task Once the controller sets one of these bits you must manually clear the bit SSV To determine if Examine this bit An EVNT instruction triggered 0 the task event task only A timeout triggered the task 1 event task only An overlap occurred for this 2 task Watchdog DINT GSV Time limit for execution of all programs associated with this task Time is in microseconds SSV If you enter 0 these values are assigned Time Task Type 0 5 sec periodic or event 5 0 sec continuous Publication 1756 RMOOSI EN P January 2007 196 Input Output Instructions MSG GSV SSV IOT Access The WALLCLOCKTIME Object The WALLCLOCKTIME object provides a timestamp the controller can use for scheduling
219. P 80 50 p 112 70 ctrl Q DC1 17 11 1 49 31 0 81 51 q 113 71 ctrl R DC2 18 12 2 50 32 R 82 52 r 114 72 ctrl S DC3 19 13 3 51 33 S 83 53 S 115 73 ctrl T DC4 20 14 4 52 34 T 84 54 t 116 74 ctrl U NAK 21 15 5 53 35 U 85 55 u 117 75 ctrl V SYN 22 16 6 54 36 V 86 56 V 118 76 ctrl W ETB 23 17 7 55 37 W 87 57 Ww 119 77 ctrl X CAN 24 18 8 56 38 X 88 58 X 120 78 ctrl Y EM 25 19 9 57 39 Y 89 59 y 121 79 ctrl Z SUB 26 1A 58 3A Z 90 5A 2 122 7A ctrl ESC 2 1B 59 3B 91 5B 123 7B ctrl FS 28 1C lt 60 3C 92 5C 124 7C ctrl GS 29 1D B 61 3D 93 5D 125 7D ctrI RS 30 1E gt 62 3E i 94 5E 126 7E ctrl JUS 31 1F 63 3F 95 5F DEL 127 STF A ABL instruction 5 5 ABS instruction 279 absolute value 279 ACB instruction 5 8 ACL instruction 581 ACS instruction 536 ADD instruction 253 addition 253 advanced math instructions introduction 545 LN 546 LOG 549 XPY 552 AFI instruction 458 AHL instruction 583 alarm instruction 31 47 alarms 507 all mode 332 ALMA instruction 47 ALMD instruction 31 always false instruction 458 analog alarm 47 AND instruction 305 arc cosine 536 arc sine 532 arc tangent 540 ARD instruction 587 arithmetic operators structured text 665 arithmetic status flags overflow 649 ARL instruction 591 array instructions AVE 368 BSL 388 BSR 392 COP 358 CPS 358 DDT 488 FAL 337 FBC 480 FFL 3
220. Parameter Data Type The MVMT instruction first copies the Target to the Destination Then the instruction compares the masked Source to the Destination and makes any required changes to the Destination The Target and the Source remain unchanged This instruction is available in relay ladder as MVM see page 13 287 Structured Text Variable Type Format Description MVMT tag FBD MASKED MOVE structure MVMT structure Function Block Operand Type Format Description MVMT tag FBD MASKED MOVE structure MVMT structure FBD MASKED MOVE Structure Description Enableln BOOL Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes 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 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 Publication 1756 RMOOSI EN P January 2007 Input value to move to Dest prior to moving Source bits through the Mask Valid any integer Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 291 Output Parameter Data Type Description
221. ProgTime is Set Severity DINT Specifies the severity of the alarm Valid 1 to 1000 1000 most severe 1 least severe Default is 500 MinDurationPRE DINT Specifies the minimum duration preset for the alarm condition to remain true before the alarm is marked as InAlarm and alarm notification is sent to clients milliseconds Valid 0 to 2147483647 Default is 0 Publication 1756 RMOOSI EN P January 2007 Digital Alarm Instruction ALMD 37 Output Parameters Output Parameter Data Type Description EnableOut BOOL System defined output parameter Follows the state of Enableln InAlarm BOOL Indicates whether the alarm is active Set In alarm Cleared Normal Acked BOOL Indicates whether the alarm is acknowledged Set Alarm acknowledged Cleared Alarm not acknowledged Always set when AckRequired is false InAlarmUnack BOOL Indicates whether an alarm is active InAlarm and unacknowledged Set Alarm is both active InAlarm and unacknowledged Cleared Alarm is either inactive or acknowledged or both Suppressed BOOL Indicates whether the alarm is suppressed Set Alarm suppressed Cleared Alarm unsuppressed Disabled BOOL Indicates whether the alarm is disabled Set Alarm disabled Cleared Alarm enabled MinDurationACC DINT Indicates the elapsed time since the alarm was detected When this value reaches MinDurationPRE the alarm becomes active InAlarm and a notification is s
222. Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 447 Example 2 Relay Ladder MainRoutine When abc is on subroutine 1 executes calculates the number of cookies and places a value in cookies 1 JSR Jump to Subroutine Routine name subroutine 1 Return par cookies 1 abc Adds the value in cookies 1to cookies 2and stores the result in total cookies DD Add Source cookies 2 g Source B cookies 1 g Dest total cookies p Subroutine_1 When defis on the RET instruction returns value_1 to the JSR cookies_1 parameter and the rest of the subroutine is not scanned def RET Return Return par value 1 When defis off previous rung and ghi is on the RET instruction returns value 2to the JSR cookies 1 parameter and the rest of the subroutine is not scanned hi RET Return Return par value 2 When both defand ghi are off previous rungs the RET instruction returns value 3to the JSR cookies 1 parameter RET Return Retumpar value 3 Publication 1756 RMOOSI EN P January 2007 448 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Example 3 Function Block JSR instruction in Routine_A JSR Ea Jump to Subroutine Routine Add Three Inputs Add Input 1 Add Three Result D Add Input 2 Output 1 The values
223. RMOOSI EN P January 2007 296 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Bit Field Distribute with The BTDT instruction first copies the Target to the Destination Then the instruction copies the specified bits from the Source shifts the bits Target BTDT to the appropriate position and writes the bits into the Destination The Target and Source remain unchanged This instruction is available in relay ladder as BTD see page 13 293 Operands BTDT BTIDT tag Structured Text Variable Type Format Description BTDT tag FBD BIT HELD DISTRIBUTE structure BTDT structure BTDT 01 Function Block BTDT d Bit Field Distribute with Target Operand Type Format Description BTDT tag FBD BIT HELD DISTRIBUTE structure BTDT structure Cj Source Dest D SourceBit DestBit FBD BIT FIELD DISTRIBUTE Structure Input Parameter Data Type Description Enableln BOOL Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes 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 Publication 1756 RMOOSI EN P January 2007 Move
224. RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 321 Example 1 This example ANDs bool in1 and bool in2 and places the result in value result and If BOOL IN1is lf BOOL IN2is Then VALUE RESULT AND Is 0 0 0 0 1 0 1 0 0 1 1 1 Structured Text value_result_and bool_inl AND bool_in2 Function Block BAND 01 BAND El Boolean And 0 bool in1 DB g E value result and o bool in2 i E Example 2 If both bool_in1 and bool_in2 are set true light1 is set on Otherwise light1 is cleared off Structured Text IF bool_inl AND bool in2 THEN light1 1 ELSE light1l 0 END_IF Publication 1756 RMOOSI EN P January 2007 322 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Boolean OR BOR Operands IF operandA OR operandB THEN statement END IF BOR 01 BOR Ea Boolean Or Input Parameter Data Type The BOR instruction logically ORs as many as eight boolean inputs To perform a bitwise OR see page 13 308 Structured Text Use OR as an operator within an expression The operands must be BOOL values or expressions that evaluate to BOOL values This expression evaluates whether operandA or operandB or both are set true See Appendix B for information on the syntax of expressions
225. RT STD SIZE 347 Valid operators Operator Description Optima Operator Description Optimal 4 ad DINLRA OG log base 10 REAL subtract negate DINT REAL MOD modulo divide DINT REAL E multiply DINT REAL NOT bitwise complement DINT divide DINT REAL OR bitwise OR DINT ui exponent x to y DINT REAL RAD degrees to radians DINT REAL ABS absolute value DINT REAL SIN sine REAL ACS arc cosine REAL SOR square root DINT REAL AND bitwise AND DINT TAN tangent REAL ASN arc sine REAL TOD integer to BCD DINT ATN arc tangent REAL TRN truncate DINT REAL COS cosine REAL XOR bitwise exclusive OR DINT DEG radians to degrees DINT REAL FRD BCD to integer DINT LN natural log REAL Format Expressions For each operator that you use in an expression you have to provide one or two operands tags or immediate values Use the following table to format operators and operands within an expression For Operators That Use This Format Examples Operate On one operand operator operand ABS tag a two operands operand aoperatoroperand b e tag b45 e tag c AND fag d e tag e 2 MOD tag f tag 9 Publication 1756 RMOOSI EN P January 2007 348 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Publication 1756 RMOOSI EN P January 2007 Determine the order of operation The operations you write into the expression are performed by the instruction in a pre
226. SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 451 Description Arithmetic Status Flags Fault Conditions Execution 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 e The external routine executes one time e After the external routine executes logic execution returns to the routine that contains the JXR instruction Arithmetic status flags are not affected A Major Fault Will Occur If Fault Type Fault code ean exception occurs in the external routine DLL 4 88 ethe DLL could not be loaded ethe entry point was not found in the DLL 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 For more information on using the JXR instruction and creating external routines see the SoftLogix5800 System User Manual publication 1789 UM002 Publication 1756 RMOOSI EN P January 2007 452 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Temporary E
227. SL Bit Shift Left Array array dint 0 Control control 1 N2 Source Bit input 1 Length 10 98768543210 amay dini 1 11111 0 0 0 0 1 1 1 1 00 00 1 1 1 0 010 0 1 1 1 1 0 0 0 0 before shift 0 these bits shift left input d UL bi 98768543210 array dint O 011 1 11 1 0 0 0 0 1 after shift 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 O O The values in the remaining bits 31 26 in array dint 1 are invalid Note how array dint O 31 shifts across words to array dint 1 0 BSL Bit Shift Left N Array array_dint O Control control 1 DN gt Source Bit input_1 Length 58 3 0 amay dint 1 1 1 1101 0 0 0 1 1 1 1 0 0 0 0 1 111 1 0 0 0 0 11 1 1 0 0 0 0 jas utut Lar d Me n dut PEERS ee hese bits shift left input 1 3 0 array_dint 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 UL bi
228. SSV IOT 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 Value 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 1622000 Validating the MODULE object is verifying MODULE object integrity prior to establishing connections to the module 1623000 Connecting the MODULE object is initiating connections to the module 1624000 Running all connections to the module are established and data is successfully transferring 1625000 Shutting down the MODULE object is in the pr
229. SSV Pending value for the RTSOffDelay attribute PendingRTSSendDelay INT SSV Pending value for the RTSSendDelay attribute PendingStopBits SINT SSV Pending value for the StopBits attribute To apply values for any of the SERIALPORT pending attributes 1 Use an SSV instruction to set the value for the pending attribute You can set as many pending attributes as you want using an SSV instruction for each pending attribute 2 Use a MSG instruction to apply the value The MSG instruction applies every pending attribute you set Configure the MSG instructions as MSG Configuration Tab Field Value Configuration Message Type CIP Generic Service Code Od hex Object Type 6f hex Object ID 1 Object Attribute leave blank Source leave blank Number of Elements 0 Destination leave blank Communication Path communication path to self 1 5 where s slot number of controller Publication 1756 RMOOSI EN P January 2007 194 Input Output Instructions MSG GSV SSV IOT 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 Instruction Description DisableUpdateOutputs DINT GSV Enables or disables the processing of outputs at the end of a task SSV To Set the attribute to enable the processing of outputs 0 at the end of the task disable the processing of 1 or any non zero value outputs at the end of the task
230. STOR 624 relay ladder String To REAL structured text SUB 257 relay ladder Subtract structured text function block SWPB 301 relay ladder Swap Byte structured text TAN 529 relay ladder Tangent structured text function block TND 452 relay ladder Temporary End TOD 562 relay ladder Convert to BCD function block TOFR 114 structured text Timer Off Delay with Reset function block TOF 100 relay ladder Timer Off Delay TONR 110 structured text Timer On Delay with Reset function block TON 96 relay ladder Timer On Delay TOT process control structured text Totalizer function block TRN 567 relay ladder Truncate function block TRUNC 567 structured text Truncate UID 456 relay ladder User Interrupt Disable structured text UIE 456 relay ladder User Interrupt Enable structured text UPDN process control structured text Up Down Accumulator function block UPPER 631 relay ladder Upper Case structured text XIC 70 relay ladder Examine If Closed XIO 72 relay ladder Examine If Open Publication 1756 RMOOSI EN P January 2007 30 Instruction Locator Publication 1756 RMOOSI EN P January 2007 Chapter 1 Digital Alarm Instruction a p Introduction Use the ALMD instruction to detect alarms based on Boolean true false conditions You can use the ALMD instruction to provide control of boolean alarms using program or operator interface control Prog or Oper control parameters The ALMD instruction has parameters that app
231. Source timer_1 Dest array timer 5 Lenath 1 Structured Text COP timer 1l array timer 5 1 Publication 1756 RMOOSI EN P January 2007 362 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 3 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 e While the CPS instruction copies the data no I O updates or other tasks can change the data e The produced_array tag produces the data on a ControlNet network for consumption by other controllers e To use the same image of data that is a synchronized copy of the data the consuming controller s uses a CPS instruction to copy the data from the consumed tag to another tag for use in the application Relay Ladder CPS Synchronous Copy File Source project data 0 Dest produced array 0 Length 100 Structured Text CPS project data 0 produced array 0 100 Example 4 Zocal 0 1 Data stores the input data for the DeviceNet network that is Publication 1756 RMOOSI EN P January 2007 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 e While the CPS instruction copies the data no I O updates can change the
232. Support number for initial help in getting your module up and running United States 1 440 646 3223 Monday Friday 8am 5pm EST Outside United Please contact your local Rockwell Automation representative for any States technical support issues New Product Satisfaction Return Rockwell tests all of its products to ensure that they are fully operational when shipped from the manufacturing facility However if your product is not functioning and needs to be returned United States Contact your distributor You must provide a Customer Support case number see phone number above to obtain one to your distributor in order to complete the return process Outside United Please contact your local Rockwell Automation representative for States return procedure www rockwellautomation com Corporate Headquarters Rockwell Automation 777 East Wisconsin Avenue Suite 1400 Milwaukee WI 53202 5302 USA Tel 1 414 212 5200 Fax 1 414 212 5201 Headquarters for Allen Bradley Products Rockwell Software Products and Global Manufacturing Solutions Americas Rockwell Automation 1201 South Second Street Milwaukee WI 53204 2496 USA Tel 1 414 382 2000 Fax 1 414 382 4444 Europe Middle East Africa Rockwell Automation SA NV Vorstlaan Boulevard du Souverain 36 1170 Brussels Belgium Tel 32 2 663 0600 Fax 32 2 663 0640 Asia Pacific Rockwell Automation Level 14 Core F Cyberport 3 100 Cyberport Road Hong Kong Tel
233. T distributed value source_bit 1 L SourceBit 3 length c Length dest bit m DestBit Target target Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 299 Clear CLR The CLR instruction clears all the bits of the Destination Operands Relay Ladder Operand Type Format Description Destination SINT tag tag to clear INT DINT REAL E RET Structured Text Structured text does not have a CLR instruction Instead assign 0 to the tag you want to clear This assignment statement clears dest See Structured Text Programming for information on the syntax of expressions and assignment statements within structured text Description The CLR instruction clears all the bits of the Destination Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions none Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The instruction clears the Destination The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 300 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Example Clear all the bits of value to 0 Publication 1756 RMOOSI EN P January 2007 Rela
234. This instruction is available in relay ladder as three separate instructions CTU see page 4 123 CTD see page 4 127 and RES see page 136 Structured Text Variable Type Format Description CTUD tag FBD_COUNTER structure CTUD structure Function Block Operand Type Format Description CTUD tag FBD_COUNTER structure CTUD structure FBD_COUNTER Structure Description Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes CUEnable BOOL Enable up count When input toggles from clear to set accumulator counts up by one Default is cleared Publication 1756 RMOOSI EN P January 2007 132 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Input Parameter Data Type Description 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
235. UID UIE AFI NOP EOT SFP SFR EVENT Condition Relay Ladder Action rung condition in is true The instruction executes The rung condition out is set to true Structured Text Action na Enableln is set na instruction execution input parameters Enableln is always set The instruction executes JSR copies input parameters to appropriate SBR tags logic execution begins in routine identified by JSR yes p no end of subroutine return parameters no q yes p RET copies retur appropriate JSR n parameters to tags Y rung condition out is set to false rung condition out is set to true postscan Same action as prescan described above Publication 1756 RMOOSI EN P January 2007 Same action as prescan described above Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 445 Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken normal execution 1 If the routine contains an SBR instruction the controller first executes the SBR instruction 2 The controller latches all data values in IREFs 3 The controller executes the other function blocks in the order that is determined by their wiring This includes other JSR inst
236. Use the PLC 5 message types to communicate with PLC 5 controllers If You Want To PLC5 Typed Read PLC5 Typed Write Read 16 bit integer floating point or string type data and maintain data integrity See Data types for PLC5 Typed Read and Typed Write messages on page 160 Write 16 bit integer floating point or string type data and maintain data integrity See Data types for PLC5 Typed Read and Typed Write messages on page 160 PLC5 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 PLC5 Word Range Write Write a contiguous range of 16 bit words from Logixb000 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 Publication 1756 RMOOSI EN P January 2007 160 Input Output Instructions MSG GSV SSV IOT The following table shows the data types to use with PLC5 Typed Read and PLC5 Typed Write messages Data types for PLC5 Typed Read and Typed Write messages For this PLC 5 data type Use this
237. _1 dim_2 array dim_0 dim_1 array dim 0 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 current element in the array initial value is typically 0 CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the STD instruction is enabled DN BOOL The done bit is set when the calculation is complete 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 position of the element that caused the overflow is stored in the POS value 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 Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 379 Structured Text Structured text does not have an STD instruction but you can achieve the same results using a SIZE instruction and a FOR DO or other loop construct SIZE array 0 length sum 0 FOR position 0 TO length 1 DO sum sum array position END FOR average sum length sum 0 FOR position 0 TO length 1 DO sum sum a
238. a oe ea i Enei aike 42S eeteG I 479 File Bit Comparison FBC 0 06 6 cee ee nn 480 Selecting the Search Mode te v wei Soy noe uve iin 482 Diagnostic Detect DIT aae ESQENMEERTERA Sh exe ES 488 Selecting the search mode s ved ped mes 490 Data Transitional DTR ea ou 4 REG RE OR Re Eee eec 496 Enter an immediate mask value sv v wy 497 Proportional Integral Derivative PID 499 Configure a PID Instruction vu sso Rok CROP eo das 505 SDOGID DIDI Puer oe es A e uta dte eae ax 506 Specify configuration ve v gg RH ERACE EHE ARS 507 Specifying Alarms su orae dede Row Spe PE IUE FIER 507 Specifying SCAN v y une e e eat IR e 508 Using PID InSUctlofiS i auo e To CEP Eee A 508 Anti reset Windup And Bumpless Transfer From Manual To AUTO e std eo wie Risin dod opa e aede one ne E ed i oak 510 PID instruction timing 0h jock be te hype BARA hiked dos 511 bunpless testart i te exe ee eee ee he 515 Derivative Smoothing 2x aside REOR RES RERO 516 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Advanced Math Instructions LN LOG XPY Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Table of Contents 11 Set the deadband u c e otra rbi ES eap er s 517 Use output limiting a eue PEA ete ete a Be ea 517 Feedforward or output biasing 518 Cascading IDOpS Nu Reano Pe Pet ES Pa
239. abled and the CD bit is cleared the CTD instruction decrements the counter by one When enabled and the CD bit is set or when disabled the CTD instruction retains its ACC value rung condition in count down enable bit CD count down done bit DN counter accumulated value ACC 16637 The accumulated value continues decrementing even after the DN bit is set To clear the accumulated value use a RES instruction that references the counter structure or write 0 to the accumulated value Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 129 Execution Condition Relay Ladder Action prescan The CD bit is set to prevent invalid decrements during the first program scan The rung condition out is set to false rung condition in is false The CD bit is cleared The rung condition out is set to false rung condition in is true it CD bit is set examine CD bit holed ACC value yes rolls over ACC ACC 1 CD bit 1 Y examine UN bit LUN bit 1 LUN bit 0 OV bit is cleared DN bit is cleared 0V bit 1 examine OV bit examine OV bit ee q UN bit is set OV bit
240. al 1 0 ChOData 0 Local 1 I ChOInHold ijocal 1 I Ch0Data END IF Bumpless restart 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 Publication 1756 RMOOSI EN P January 2007 516 Special Instructions FBC DDT DTR PID To set a bumpless restart Do This Configure the 1756 analog output module s channel Details Select the hold for initialization check box on the properties page for the specific which receives the control variable from the PID instruction 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 196 of span
241. al data type typically DINT or REAL Compare CMP Operands CM Compare Expression Description Arithmetic Status Flags Fault Conditions Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 207 The CMP instruction performs a comparison on the arithmetic operations you specify in the expression Relay Ladder Operand Type Format Description Expression SINT immediate an expression consisting of tags and or immediate values separated by operators INT tag DINT REAL string A SINT or INT tag converts to a DINT value by sign extension Structured Text Structured text does not have a CMP instruction but you can achieve the same results using an IF THEN construct and expression IF BOOL expression THEN statement END IF See Appendix for information on the syntax of constructs and expressions within structured text Define the CMP expression using operators tags and immediate values Use parentheses to define sections of more complex expressions The execution of a CMP instruction is slightly slower and uses more memory than the execution of the other comparison instructions The advantage of the CMP instruction is that it allows you to enter complex expressions in one instruction The CMP instruction only affects the arithmetic status flags if the expression contains an operator for example that affects the arithmetic status flags none Publicatio
242. al to the size of the Destination e f 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 ARL Channel Destination SerialPortControl Structured Text characters that were read The operands are the same as those for the relay ladder ARL instruction However you specify the Serial Port Control Length and the Characters Read values by accessing the LEN and POS Publication 1756 RMOOSI EN P January 2007 592 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT members of the SERIAL PORT CONTROL structure rather than by including the values in the operand list SERIAL PORT CONTROL Structure Mnemonic DataType Description EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing CEM BOO Theemptybitindicates that 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 that is when
243. alse rung condition in is true Destination 0 So The rung condition o urce ut is set to true postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 278 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Example Change the sign of value 1 and place the result in negate result Relay Ladder NEG Negate Source value 1 g Dest negate result p Structured Text negate result value 1 Function Block NEG 01 0 value_1 negate_result Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 279 Absolute Value ABS The ABS instruction takes the absolute value of the Source and places the result in the Destination Operands a3 Relay Ladder Absolute Value Source t Operand Type Format Description Dest Source SINT immediate value of which to take the absolute value DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest
244. an expression This expression divides sourceA by sourceB and stores the result in dest See Appendix B for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 264 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS DIV 01 ov EH Divide CO SourceA Dest D Cj SourceB Function Block Operand DIV tag Type Format FBD_MATH Description structure DIV structure FBD_MATH Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source A REAL Value of the dividend Valid any float Source B REAL Value of the divisor Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Publication 1756 RMOOSI EN P January 2007 Description If the Destination is not a REAL the instruction handles the fractional portion of the result as follows If Source A Then The Fractional Example Portion Of The Result and Source Bare not truncates Source A DINT 5 REALS Source B DINT 3 Destination DINT 1 or Source B isa REAL rounds Source A REAL 5 0 Source B DINT 3 Destination DINT 2 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR S
245. and determine the quantity that is in stock 1 Get the size number of items of the nventory array and store the result in nventory Items DINT tag 2 Initialize the position tag to 0 3 If Barcode matches the ID of an item in the array then a Set the Quantity tag Inventory position Oty This produces the quantity in stock of the item b Stop Barcode is a string tag that stores the bar code of the item for which you are searching For example when position 5 compare Barcode to Inventory 5 ID 4 Add 1 to position 5 If positionis x to Inventory Items 1 repeat 3 and 4 Since element numbers start at 0 the last element is 1 less than the number of elements in the array Otherwise stop Publication 1756 RMOOSI EN P January 2007 Enter This Structured Text SIZE Inventory O Inventory Items For position 0 to Inventory Items 1 do If Barcode Inventory position ID then Quantity Inventory position Qty Exit End if End for Structured Text Programming 681 WHILE DO Use the WHILE DO loop to keep doing something as long as certain conditions are true Operands Structured Text WHILE bool expression DO Operand Type Format Enter statement M e A Ga END WHILE bool BOOL tag BOOL tag or expression that evaluates to nz expression a BOOL value expression IMPORTANT Make sure that you do not iterate withi
246. andard deviation of an array of values STD relay ladder 378 structured text find the size of a dimension of an array SIZE relay ladder 384 structured text f There is no equivalent structured text instruction Use other structured text programming to achieve the same result See the description for the instruction 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 For relay ladder instructions 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 Publication 1756 RMOOSI EN P January 2007 332 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Selecting Mode of Operation Publication 1756 RMOOSI EN P January 2007 For FAL and 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 Incremental rung condition in goes from false to true All mode In All mode all
247. anuary 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 103 Condition Relay Ladder Action prescan The EN TT and DN bits are cleared The ACC value is set to equal the PRE value The rung condition out is set to false rung condition in is false Y examine DN bit DNUS DN bit 1 EN bit is cleared examine EN bit TT bit is set ACC gt PRE TT bit is set examine ACC ACC ACC current time last time Y ACC lt PRE DN is cleared TT bit is cleared no ACC value q rolls over yes rung condition out is set to false Y ACC 2 147 483 647 rung condition in is true The EN TT and DN bits are set The ACC value is cleared The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 104 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Example When imit switcb 2 is cleared light_2 is on for 180 msec timer 2 is timing When timer 2 acc reaches 180 light_2 goes off and light_3 goes on Light_3 remains on until the TOF instruction is enabled If limit_switch_2 is set while timer 2 is timing light_2 goes off limit switch 2 TOF Timer Off Delay Timer timer_2 Preset 180 Accum 0
248. 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 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 Attribute Data Type Instruction Description Instance DINT GSV Provides the instance number of this MOTION GROUP object Publication 1756 RMOOSI EN P January 2007 190 Input Output Instructions MSG GSV SSV IOT Access The PROGRAM Object The PROGRAM object provides status information about a program Specify the program name to determine which PROGRAM object you want Attribute Data Type Instruction Description DisableFlag SINT GSV Controls this program s execution SSV Value Meaning 0 execution enabled 1 execution disabled Instance DINT GSV Provides the instance number of this PROGRAM object LastScanTime DINT GSV Time it took to execute this program the last time it was executed Time is in microseconds SSV MajorFaultRecord DINT 11 GSV Records major faults for this program SSV We recommend that you create a user defined structure to simplify access to the MajorFaultRecord attribute Name Data Type Style Description TimeLow DINT Decimal lower 32 bits of fault timestamp value TimeHigh DINT Decimal upper 32 bits of f
249. aracters The ASCII read and write instructions ARD ARL AWA AWT automatically swap characters as shown below bar code reader ARD ij BA Channel 0 lee E gt Destination bat_code 0 SerialPort Control Lenath 2 j SerialPort Control Characters Read 2 42969 j 42968 ASCII Read bar code read B e JM9 bar code 0 Tag Name AB Arithmetic Status Flags not affected Fault Conditions none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The rung condition out is set to true na Enableln is set na instruction execution The instruction rearranges the specified bytes Enableln is always set The instruction executes The instruction rearranges the specified bytes postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 303 Example 1 The three SWPB instructions each reorder the bytes of DINT 1 according to a different order mode The display style is ASCII and each character represents one byte Each instruction places the bytes in the new order in a different Dest
250. arm condition Ladder Logic copied from instruction operand Structured Text copied from instruction operand Default is 0 0 Input bad health indicator If In is read from an analog input then InFault is normally controlled by the analog input fault status When InFault is set it indicates the input signal has an error Default is cleared good health HHEnabled BOOL Specifies whether a high high alarm condition detection is enabled Set Condition detection enabled Cleared Condition detection disabled Default is set HEnabled BOOL Specifies whether a high alarm condition detection is enabled Set Condition detection enabled Cleared Condition detection disabled Default is set LEnabled BOOL Specifies whether a low alarm condition detection is enabled Set Condition detection enabled Cleared Condition detection disabled Default is set LLEnabled BOOL Specifies whether a low low alarm condition detection is enabled Set Condition detection enabled Cleared Condition detection disabled Default is set AckRequired Publication 1756 RMOOSI EN P January 2007 BOOL Specifies whether alarm acknowledgement is required Set Acknowledgement required Cleared Acknowledgement not required Default is set Analog Alarm Instruction ALMA 51 Input Parameter Data Type Description ProgAckAll BOOL Program Acknowledge All Set by the user program to ackno
251. arm condition Requires a False to True transition while the alarm condition is Unacknowledged The alarm instruction clears this parameter Default is cleared ROCNegProgAck BOOL Rate Of Change Negative Alarm Program Acknowledge Set by the user program to acknowledge a negative rate of change alarm condition Requires a False to True transition while the alarm condition is Unacknowledged Default is cleared ROCNegOperAck BOOL Rate Of Change Negative Alarm Operator Acknowledge Set by the operator interface to acknowledge a negative rate of change alarm condition Requires a False to True transition while the alarm condition is Unacknowledged The alarm instruction clears this parameter Default is cleared Progsuppress BOOL Program Suppress Set by the user program to suppress the alarm Default is cleared OperSuppress BOOL Operator Suppress Set by the operator interface to suppress the alarm The alarm instruction clears this parameter Default is cleared ProgUnsuppress BOOL Program Unsuppress Set by the user program to unsuppress the alarm Takes precedence over Suppress command OperUnsuppress BOOL Operator Unsuppress Set by the operator interface to unsuppress the alarm Takes precedence over Suppress command The alarm instruction clears this parameter Default is cleared ProgDisable BOOL Program Disable Set by the user program to disable the alarm Default is cleared OperDisable BOOL Operator Disable Set by the operator inte
252. ary 2007 Condition rung condition in is false Relay Ladder Action EU bit is cleared Y LEN lt 0 p POS lt 0 P Array File Shift Instructions BSL BSR FFL FFU LFL LFU 405 yes EM is cleared yes EM is set yes DN is set Y EM is set rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 406 Condition rung condition in is true EU 0 examine EU bit Array File Shift Instructions BSL BSR FFL FFU LFL LFU Relay Ladder Action EU bit is set Y yes no yes POS lt 0 iN EM bit is cleared Y EM bit is set EM bit is set EM bit is cleared LEN gt size of array yes yes EM bit is set EM bit is set no q no yes T yes Destination 0 POS gt LEN pe DN bit is set no no 8 POS POS 1 Destination FIFO 0 Y FIFO 7 FIFO B yes no rung condition out is set to true Y postscan Publication 1756 RMOO3I EN P January 2007 The rung condition out is set to false Array File Shift Instructions BSL BSR FFL FFU LFL LFU 4
253. as an operator within an expression This expression evaluates whether sourceA is equal to sourceB See Appendix for information on the syntax of expressions within structured text EQU 01 C SourceA C SourceB Dest Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 213 Function Block Operand Type Format Description EQU tag FBD_COMPARE structure EQU structure FBD COMPARE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to test against SourceB Valid any float SourceB REAL Value to test against SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition out of the relay ladder EQU instruction Description Use the EQU instruction to compare two numbers or two strings of Arithmetic Status Flags Fault Conditions ASCII characters When you compare strings e Strings are equal if their characters match e ASCII characters are case sensitive Upper case A 41 is not equal to lower case a 61 not affected none Publication 1756 RMOOSI EN P January 2007 214 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Condition prescan Execution Relay Ladder Action The rung
254. asition of Result Control control 3 Length 10 Position of source 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 array_dint1 i i reference before compare 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 array_dint2 bo result 53 array dint3 reference after compare 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 array_dint2 Publication 1756 RMOOSI EN P January 2007 496 Special Instructions FBC DDT DTR PID Data Transitional DTR The DTR instruction passes the Source value through a Mask and compares the result with the Reference value Operands Relay Ladder DTR Data Transition Source Operand Type Format Description Mask 1 Source DINT immediate array to compare to the reference Reference tag Mask DINT immediate which bits to block or pass tag Reference DINT tag array to compare to the source Description 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 Sou
255. ask is Periodic task DeltaT elapsed time since previous instruction execution if task is Event or Continuous task Oversample DeltaT OversampleDT Real Time Sampling DeltaT RTSTimeStamp RTSTimeStamp 1 Status DINT Status of the function block TimingModelnv BOOL Invalid TimingMode value Status 27 RTSMissed Status 28 BOOL Only used in real time sampling mode Set when ABS DeltaT RTSTime gt 1 001 second RTSTimelnv BOOL Invalid RTSTime value Status 29 RTSTimeStamplnv BOOL Invalid RTSTimeStamp value Status 30 DeltaTInv Status 31 BOOL Invalid DeltaT value Publication 1756 RMOOSI EN P January 2007 654 Function Block Attributes Overview of timing modes The following diagram shows how an instruction determines the appropriate timing mode Y Determine time base mode TimingMode 0 TimingMode 1 TimingMode 2 v C Periodic timing 2 4 Oversample timing C Real time timing 2 Y Y DeltaT OversampleDT DeltaT RTSTimeStamp RTSTimeStampy4 If DeltaT lt 0 or DeltaT gt 4194 303 secs Y the instruction sets DeltaT 0 0 and sets the appropriate bit in Status If DeltaT gt 0 the instruction executes Determine task type v C Periodic task C Event or Continuous task Y Y DeltaT task scan time DeltaT elapsed time since last execution Publication 1756 RMOOSI EN P
256. ault Conditions none MSG Error Codes The error codes depend on the type of MSG instruction Error Codes RSLogix 5000 software does not always display the full description Error Code Description Display In Software Hex 0001 Connection failure see extended error codes same as description 0002 Insufficient resource same as description 0003 Invalid value same as description 0004 IOI syntax error see extended error codes same as description 0005 Destination unknown class unsupported instance undefined same as description or structure element undefined see extended error codes 0006 Insufficient packet space same as description 0007 Connection lost same as description 0008 Service unsupported same as description 0009 Error in data segment or invalid attribute value same as description 000A Attribute list error same as description 000B State already exists same as description 000C Object model conflict same as description 000D Object already exists same as description 000E Attribute not settable same as description 000F Permission denied same as description 0010 Device state conflict same as description 0011 Reply will not fit same as description 0012 Fragment primitive same as description 0013 Insufficient command data same as description 0014 Attribute not supported same as description 0015 Too much data same as description 001A Bridge request too large same as description 001B
257. ault timestamp value Type INT Decimal fault type program 1 0 etc 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 MaxScanTime DINT GSV Maximum recorded execution time for this program Time is in microseconds SSV Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 191 Attribute Data Type Instruction Description MinorFaultRecord DINT 11 GSV Records minor faults for this program SSV We recommend that you create a user defined structure to simplify access to the MinorFaultRecord attribute Name Data Type Style Description TimeLow DINT Decimal lower 32 bits of fault timestamp value TimeHigh DINT Decimal upper 32 bits of fault timestamp value Type INT Decimal fault type program 1 0 etc 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 SFCRestart INT GSV unused reserved for future use SSV Publication 1756 RMOOSI EN P January 2007 192 Input Output Instructions MSG GSV SSV IOT Access The Routine object The ROUTINE object provides status information about a routine Specify the routine name to determine which ROUTINE object you want Attribute Data Type Instruction Description Instance DINT GSV Provides the instance number of this ROUTINE object Valid values ar
258. ays set The instruction executes instruction execution The instruction sends a specified number of characters The EN bit is set The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue postscan temp low The rung condition out is set to false No action taken Example 1 When the temperature reaches the low limit temp_low is set the AWT instruction sends a message to the MessageView terminal that is connected to the serial port of the controller The message contains nine characters from the DATA member of the string 2 tag which is a string The 74 counts as one character It is the hex code for the Ctrl T character The last character is a carriage return r which marks the end of the message Relay Ladder ASCII Write Channel Source string 2 142224 01 r SerialPort Control temp_low_write SerialPort Control Length 9 Characters Sent 9 Publication 1756 RMOOSI EN P January 2007 MV update Example 2 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 603 Structured Text osri l InputBit temp low OSRI osri 1 IF osri l OutputBit THEN temp low write LEN 9 AWT O0 string 2 temp low write END IF When MV update is set 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 t
259. ber 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 You must test and confirm that the instruction doesn t change data that you don t want it to change The DDT instruction operates on contiguous memory In some cases the instruction searches or writes past the array into other members of the tag This happens if a length is too big and the tag is a user defined data type 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 Publication 1756 RMOOSI EN P January 2007 490 Special Instructions FBC DDT DTR PID Selecting 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 rung condition in 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 sets the FD bit records the position of the mismatch and stops executing All mismatches Clear the IN bit in the compare CONTROL structure Each time the rung condition in goes from false to true the DDT instruction searches for all mismatches between the Source and Reference arrays Arithmetic Status Flags not aff
260. bleln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Example When enabled the XOR instruction performs a bitwise XOR operation on SourceA and SourceB and places the result in the destination tag value 110 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 vaue2 0 0 0 0 0 0 0 0 0 0 0 0 1 1 11 1 1 1 1 0 0 0 00 0 0 000 0 0 value result xar 0 0 0 0 0 0 0 0 0 0 0 0 1 0 110 1 0 1 0 10 1 0 1 1 1 1 1 1 1 1 1 Publication 1756 RMOOSI EN P January 2007 314 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Relay Ladder OR Bitwise Exclusive OF Source value 1 2H0000_0000_0000_0101_0707_0901_1111_1117 Source B value 2 2 O000_0000_0000_1111_1171_0000_0000_0000 Dest value result or 2 0000_0000_0000_1010_1010_0101_1111_1111 Structured Text value result xor value 1 XOR value 2 Function Block XOR 01 XOR Esi Bitwise Exclusive OR a value_1 J SourceA value result xor SourceB X value 2 md i Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 315 Bitwise NOT NOT Operands NOT Bitwise NOT Source
261. bles embedded response functionality point to point only Value Meaning 0 initiated only after one is received default 1 enabled unconditionally ENOTransmitLimit SINT GSV The number of inquiries ENOs 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 packets slave only Value Meaning 0 EOT suppression disabled disabled non zero EOT suppression enabled Publication 1756 RMOOSI EN P January 2007 Attribute ErrorDetection Data Type SINT Instruction GSV Input Output Instructions MSG GSV SSV IOT 183 Description Specifies the error detection scheme Value Meaning 0 BCC default 1 CRC MasterMessageTransmit SINT GSV Current value of the master message transmission master only Value Meaning 0 between station polls 1 in poll sequence in place of master s station number Default is 0 NAKReceiveLimit SINT GSV The number of NAKs received in response to a message before stopping transmission point to point communication only Valid value 0 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 255 Default is 0 PollingMode ReplyMessageWait SINT DINT GSV GSV Current polling
262. cation 1756 RMOOSI EN P January 2007 268 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Modulo MOD The MOD instruction divides Source A by Source B and places the remainder in the Destination Operands oD Relay Ladder Modula Source A Operand Type Format Description Source B SourceA SINT immediate value of the dividend Dent INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Source B SINT immediate value of the divisor INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest sourceA MOD sourceB Use MOD as an operator in an expression This expression divides sourceA by sourceB and stores the remainder in dest See Appendix B for information on the syntax of expressions within structured text MOD 04 Function Block MOD Ez Modulo Operand Type Format Description MOD tag FBD MATH structure MOD structure SourceA SourceB Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 269 FBD MATH Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source A REAL Value of the dividend Valid any float Source B REAL Value of the divisor Valid
263. ccur for a program when e The program becomes scheduled while the controller is running e The program is unscheduled when the controller enters Run mode Possible Condition prescan Preface 21 Function block states IMPORTANT When programming in function block restrict the range of engineering units to 10 15 because internal floating point calculations are done using single precision floating point Engineering units outside of this range may result in a loss of accuracy if results approach the limitations of single precision floating point 4 10 38 The controller evaluates function block instructions based on the state of different conditions Description Prescan for function block routines is the same as for relay ladder routines The only difference is that the Enableln parameter for each function block instruction is cleared during prescan instruction first scan Instruction first scan refers to the first time an instruction is executed after prescan The controller uses instruction first scan to read current inputs and determine the appropriate state to be in instruction first run Instruction first run refers to the first time the instruction executes with a new instance of a data structure The controller uses instruction first run to generate coefficients and other data stores that do not change for a function block after initial download Every function block instruction also includes
264. ce ce ce ce ce ce e Relay Ladder NOT Bitwise NOT Source value 1 2 0000_0000_ 0000 0101_0101_0101_1111_1111 Dest walue result nat 2111 1111 1111 1010 1010 1010 0060 DOD0 Structured Text value result not NOT value 1 Function Block NOT 01 NOT ul Bitwise NOT 0 0 P value 1 J Dest 5 3 1 value result not Publication 1756 RMOOSI EN P January 2007 318 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 319 Boolean AND BAND Operands IF operandA AND operandB THEN statement END IF BAND 01 BAND E Boolean And Out The BAND instruction logically ANDs as many as 8 boolean inputs To perform a bitwise AND see page 13 305 Structured Text Use AND or the ampersand sign amp as an operator within an expression The operands must be BOOL values or expressions that evaluate to BOOL values This expression evaluates whether operandA and operandB are both set true See Appendix B for information on the syntax of expressions within structured text Function Block Operand Type Format Description BAND tag FBD_BOOLEAN_AND structure BAND structure FBD_BOOLEAN_AND Structure Input Parameter Data Type Descr
265. ce B an immediate value is zero filled EQU Equal SourceA remote rack l l Data 0 241111 1111 1111 1111 Source B 231111 1111 1111 1111 42093 Publication 1756 RMOOSI EN P January 2007 638 Common Attributes Publication 1756 RMOOSI EN P January 2007 If you use a SINT or INT tag and an immediate value in an instruction that converts data by sign extension use one of these methods to handle immediate values e Specify any immediate value in the decimal radix e If you are entering the value in a radix other than decimal specify all 32 bits of the immediate value To do so enter the value of the left most bit into each bit position to its left until there are 32 bits e Create a tag for each operand and use the same data type throughout the instruction To assign a constant value either Enter it into one of the tags Add a MOV instruction that moves the value into one of the tags e Use a MEQ instruction to check only the required bits The following examples show two ways to mix an immediate value with an INT tag Both examples check the bits of a 1771 I O module to determine if all the bits are on Since the input data word of a 1771 I O module is an INT tag it is easiest to use a 16 bit constant value EXAMPLE Mixing an INT tag with an immediate value Since remote_rack_1 l Data O is an INT tag the value to check it against is also entered as an INT tag EQU
266. ch and Compare CBSCOS Mos umi t ieee eee a kn 349 DSC CXDISSSIODSCS 4 osque pO p PIC P ee he a eS 354 Valid Operators chs Bish cot gdh Rip eRe edat 355 Format ExpresstODS x Lao er Ret abeo A RR 355 Determine the order of operation 356 Use Strings In an Expression d aeg qd eb o E e 357 Copy File COP Synchronous Copy File CPS 358 File I CBELO sosta tested RIEN ERR a E PME Qo cc 364 bile Avete AVE si vetoes eke AR eased ITREGTEPIS 368 TilecSoft SR oa dee octo Roe oo doo S Ged ee ee dul 373 File Standard Deviation STD 2 0000 378 Size In Elements SIZE eos dare rd E nEPSSUDXS AES 384 Chapter 10 Introduction Cos we spo dr cie n e Appetit ds 387 Bit omi Der BSL y solae ctia mera x d dori e 0 388 Bit Sai Richt BSR es vta eoe oae do ae eraat 392 FFO Load EFE ua poni ng XE eO eS P ER ERR 396 FIFO Unload CEE DD 2a doen pd RC eee t eie o d 402 LIEO F dd TEL ooe a aa bobo db CUR e deas 408 LIFO Unload ELEUS E42 t3 RITESSTEPCERSS T ERSAEP P 414 Chapter 11 Introduction goo aeos qoa Bos bees to aii iod tea qd 421 Sequencer Input SQD s 05 6 1 eot s Can a S pag ater 422 Enter an Immediate Mask Value 423 Use SQI without SQO 1 425 Sequencer Output SQO s es uad ades ee eder oe qd 426 Enter an Immediate Mask Value se eax eror dy 427 Using SOLWIULSOCOUS exestuetektiuvkei fI ORE 429 Resetting the position of SQO 2 ee ee 429 Sequencer Load CSOD S a thea flay bee
267. ch are not included in the LEN count DATA SINT array ASCII characters of e To access the characters of the string address the name of the tag the string For example to access the characters of the string 1 tag enter string f e Each element of the DATA array contains one character e You can create new string data types that store less or more characters Publication 1756 RMOOSI EN P January 2007 622 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER String To DINT STOD The STOD instruction converts the ASCII representation of an integer to an integer or REAL value Operands Relay Ladder STOD String To DINT Source Dest Operand Type Format Enter Notes Source string tag tag that contains the value String data types are in ASCII e default STRING data type e any new string data type that you create Destination SINT tag tag to store the integer If the Source value is a floating point number value the instruction converts only the non fractional INT part of the number regardless of the destination data type DINT REAL Structured Text STOD Source Dest The operands are the same as those for the relay ladder STOD instruction Description The STOD converts the Source to an integer and places the result in the Destination e The instruction converts positive and negative numbers e If the Source string contains non numeric characters the STOD converts the first set of contiguous numb
268. channels are configured for remote 1 0 unknown error 00F7 The block transfer timeout set in the instruction timed out before completion unknown error OOF8 Error in block transfer protocol unsolicited block transfer unknown error OOF9 Block transfer data was lost due to a bad communication channel unknown error OOFA The block transfer module requested a different length than the associated unknown error block transfer instruction OOFB The checksum of the block transfer read data was wrong unknown error OOFC There was an invalid transfer of block transfer write data between the adapter and the unknown error block transfer module OOFD The size of the block transfer plus the size of the index in the block transfer data table was unknown error greater than the size of the block transfer data table file Publication 1756 RMOOSI EN P January 2007 Specify the Configuration Details Input Output Instructions MSG GSV SSV IOT 155 After you enter the MSG instruction and specify the MESSAGE structure use the Message Configuration dialog box to specify the details of the message Message MSG Click here to configure the MSG instruction The details you configure depend on the message type you select Message Configuration Message_1 Ed Configuration Communication Tag Message Type Source Element cir Data Table Read Number Of Elements Destination Element New Tag 42976
269. condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na Enableln is set The rung condition out is set to true na Enableln is always set The instruction executes instruction execution The instruction concatenates the strings postscan add node The rung condition out is set to false No action taken Example To trigger a message in a MessageView terminal the controller must send an ASCII string that contains a message number and node number String 1 contains the message number When add node is set the CONCAT instruction adds the characters in node num asc i node number to the end of the characters in string_1 and then stores the result in msg Relay Ladder CONCAT String Concatenate Source A string 1 1423V Source B node num ascii 4 Dest msg 1423 1 Structured Text IF add_node THEN CONCAT string 1 node num ascii msg add node 0 END IF Publication 1756 RMOOSI EN P January 2007 610 String Delete DELETE ASCII String Instructions CONCAT DELETE FIND INSERT MID The DELETE instruction removes ASCII characters from a string Operands Relay Ladder DELETE String Delete Source Qty Start Dest Operand Type Format Enter Notes Source string tag tag that contains the string String data types are from which you want to delete characters
270. counter leaves the value at the maximum count value Timestamp of high condition detection HAlarmCount LInAlarm Time LAlarmCount DINT LINT 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 Timestamp of low condition detection 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 LLAlarmCount LINT DINT Timestamp of low low condition detection 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 ROCPoslnAlarmTime ROCPosInAlarmCount LINT DINT Timestamp of positive rate of change condition detection 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 ROCNeglnAlarmTime ROCNegAlarmCount Publication 1756 RMOOSI EN P January 2007 LINT DINT Timestamp of negative rate of change condition detection 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 Output Parameter AckTime Data Type LINT Analog Alarm Instruction ALMA
271. cription The DTOS converts the Source to a string of ASCII characters and places the result in the Destination Arithmetic Status Flags not affected Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is greater than the DATA 1 Check that no instruction is writing to the LEN size of the string tag member of the string tag 2 In the LEN value enter the number of characters that the string contains 4 52 The output string is larger than the destination Create a new string data type that is large enough for the output string Use the new string data type as the data type for the destination Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction converts the Source postscan The rung condition out is set to false No action taken 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 Publ
272. ct because Logix controllers execute more efficiently and use less memory when working with 32 bit integers DINTs To convert between INTs and DINTs see Logix5000 Controllers Common Procedures publication 1756 PMO01 D 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 ol If you want to enable more than 16 MSGs at one time use some type of management strategy If you enable more than 16 MSGs at one time some MSG instructions may experience delays in entering the queue To guarantee the execution of each message use one of these options e Enable each message in sequence e Enable the messages in groups e Program a message to communicate with multiple devices For more information see Logix5000 Controllers Common Procedures publication 1756 PM001 e Program logic to coordinate the execution of messages For more information see Logix5000 Controllers Common Procedures publication 1756 PM001 e Keep the number of unconnected and uncached MSGs less than the number of unconnected buffers Publication 1756 RMOOSI EN P January 2007 The controller can have 10 40 unconnected buffers The default number is 10 e f all the unconnected
273. ction Block Attributes The Program request inputs take precedence over the Operator request inputs This provides the capability to use the ProgProgReq and ProgOperReq inputs to lock an instruction in a desired control For example let s assume that a Totalizer instruction will always be used in Operator control and your user program will never control the running or stopping of the Totalizer In this case you could wire a literal value of 1 into the ProgOperReq This would prevent the operator from ever putting the Totalizer into Program control by setting the OperProgReq from an operator interface device TOT 01 TOT E ProgProgReq a f ProgOperReq E ProgStartReq E ProgStopReq Wiring a 1 into ProgOperReq means the user program always wants the TOT to be in Operator control E ProgResetReq Publication 1756 RMOOSI EN P January 2007 Local 1 ChOData Totalizer In Total D OldTotal D ProgOper 3 RunStop D ProgResetDone D TargetFlag D TargetDev1Flag D TargetDev2Flag 3 Because the ProgOperReq input is Totalizer program MainProgram TOT 01 always set pressing the Program button on the faceplate which sets is j meus lie Mode the OperProgReg input has no effect ee k gallons Operator Normally setting OperProgReq puts Input 59 07 gal min Run the TOT in Program control Target Program 500 Dey 2 ESI Operator Start Stop
274. ction 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 Manual Mode of Control software manual SWM Special Instructions FBC DDT DTR PID 511 The PID instruction supports two manual modes of control Description also known as set output mode lets the user set the output 96 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 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 which is bypassing the output from the controller Note Manual mode overrides software manual mode if both mode bits are set on The PID instruction also 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 integra
275. ction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOO3I EN P January 2007 No action taken Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 531 Example Calculate the tangent of value and place the result in result Relay Ladder T N Tangent Source value 2 0943952 Dest result 1 7320507 Structured Text result TAN value Function Block Tangent value Publication 1756 RMOOSI EN P January 2007 532 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Arc Sine ASN The ASN instruction takes the arc sine of the Source value and stores the result in the Destination in radians Operands Relay Ladder ASN Arc Sine jeu Operand Type Format Description Source SINT immediate find the arc sine of this value INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest ASIN source Use ASIN as a function This function computes the arc sine of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 ASN 01 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 533 Function Block Operand Type F
276. ctured text only Publication 1756 RMOOSI EN P January 2007 472 For Break Instructions FOR FOR DO BRK EXIT RET For FOR The FOR instruction executes a routine repeatedly Operands Relay Ladder FOR a utine name Operand Type Format Description Index Routine ROUTINE routine routine to execute Initial value name nams Terminal value Index DINT tag counts how many times the routine has Step size been executed Initial value SINT immediate value at which to start the index INT tag DINT Terminal SINT immediate value at which to stop executing the routine value INT tag DINT Step size SINT immediate amount to add to the index each time the FOR instruction executes the routine INT tag DINT Structured Text FOR count initial value TO final value BY increment po Use the FOR DO construct See Appendix B for information on structured text constructs statement END FOR Description IMPORTANT Do not use a FOR instruction to call execute the main routine e You can put a FOR instruction in the main routine or any other routine e If you use a FOR instruction to call the main routine and then put a RET instruction in the main routine a major fault occurs type 4 code 31 Publication 1756 RMOOSI EN P January 2007 Arithmetic Status Flags Fault Conditions Condition prescan Execution For Break Instructions FOR FOR DO BRK EXIT RET 473 When enabl
277. d Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Ea Grtr Than or Eql amp B Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 219 Example If value 1 is greater than or equal to value 2 set light_b If value_1 is less than value 2 clear light b Relay Ladder light b Source value 1 0e Source B value 2 o Structured Text light b value 1 gt value 2 Function Block GEQ 01 GEQ umi Grtr Than or Eql A gt B C SourceA value 1 value 2 SourceB Publication 1756 RMOOSI EN P January 2007 220 Greater Than GRT Operands GAT Greater Than A gt B Source Source B IF sourceA sourceB THEN statements Greater Than A gt B O Sources Dest C SourceB Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ The GRT instruction tests whether Source A is greater than Source B Relay Ladder Operand Type Format Description Source A SINT immediate value to test against Source B INT tag DINT REAL string Source B SINT immediate value to test against Source A INT tag DINT REAL string e If you enter a SINT or INT tag the value converts to a DINT value by sign extension e String data types are
278. d DN BOOL The done bit is set when all the specified elements have been loaded into Array ER BOOL The error bit is set when LEN lt 0 POS lt 0 or POS gt LEN LEN DINT The length specifies the number of steps in the sequencer array POS DINT The position identifies the element that the controller is currently manipulating Publication 1756 RMOOSI EN P January 2007 Description IMPORTANT Sequencer Instructions SQI SQO SQL 431 When enabled the SQL instruction increments to the next position in the sequencer array and loads the Source value into that position If the DN bit is set or if POS 2 LEN the instruction sets POS 1 Typically use the same CONTROL structure as the SQI and SQO instructions You musttest and confirm that the instruction doesn t change data that you don t want it to change The SQL instruction operates on contiguous memory In some cases the instruction loads data past the array into other members of the tag This happens if the length is too big and the tag is a user defined data type Arithmetic Status Flags Fault Conditions Execution Condition prescan not affected A Major Fault Will Occur If Fault Type Fault Code Length size of Array 4 20 Relay Ladder Action The EN bit is set to prevent a false load when the program scan begins The rung condition out is set to false rung condition in is false The EN bit is cleared The rung condition out
279. d processes data Novice programmers should read all the details about an instruction before using the instruction Experienced programmers can refer to the instruction information to verify details Publication 1756 RMOOSI EN P January 2007 18 Preface Purpose of This Manual This section Instruction name Operands This manual provides a description of each instruction in this format Provides this type of information identifies the instruction defines whether the instruction is an input or an output instruction lists all the operands of the instruction if available in relay ladder describes the operands if available in structured text describes the operands if available in function block describes the operands The pins shown on a default function block are only the default pins The operands table lists all the possible pins for a function block Instruction structure lists control status bits and values if any of the instruction Description Arithmetic status flags describes the instruction s use defines any differences when the instruction is enabled and disabled if appropriate defines whether or not the instruction affects arithmetic status flags see appendix Common Attributes Fault conditions Execution Example Publication 1756 RMOOSI EN P January 2007 defines whether or not the instruction generates minor or major faults if so defines the fault type and code
280. d LEN 24 ARD 0 bag bar code bar code read END IF Publication 1756 RMOOSI EN P January 2007 ASCII Read Line ARL ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 591 The ARL instruction removes specified characters from the buffer and stores them in the Destination Operands Relay Ladder ARL ASCII Read Line END Channel Destination ND SerialPort Control 7 R SerialPort Control Length Characters Read 7 Operand Type Format Enter Notes Channel DINT immediate 0 tag Destination string tag tag into which the e f you want to compare convert or characters are moved manipulate the characters use a string data SINT read type e String data types are INT e Fora string data type g vp enter the name of the e default STRING data type ANG die tring data type that t e any new string data type that you create e For a SINT INT or DINT s cu A array enter the first element of the array Serial Port SERIAL PORT tag tag that controls the operation Control CONTROL Serial Port DINT immediate maximum number of e Enter the maximum number of characters Control Length characters to read if no that any message will contain that is when termination characters are to stop reading if no termination characters found are found For example if messages range from 3 to 6 characters in length enter 6 e he Serial Port Control Length must be less than or equ
281. d Text The operands are the same as those for the relay ladder EVENT instruction Use the EVENT instruction to programmatically execute an event task e Fach time the instruction executes it triggers the specified event task e Make sure that you give the event task enough time to complete its execution before you trigger it again If not an overlap occurs e 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 Programmatically Determine if an EVENT Instruction Triggered a Task 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 SSV Provides status information about the task Once the controller sets a bit you must manually clear the bit to determine if another fault of that type occurred To determine if Examine this bit An EVENT instruction triggered the task event task 0 only A timeout triggered the task event task only 1 An overlap occurred for this task 2 Publication 1756 RMOOSI EN P January 2007 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 467 The controller does not clear the bits of the Status attribute once they are set e To use a bit for new status i
282. d o a Ep RI ee 131 Reset RES o ee too eho hee ee Sota se Oe Peek Ses 136 Chapter 5 TOU GC DIDI o5 Ace hie no 9 tis i ee ee ute Qo Rae deo 1d 139 Message MISC ibs Ad ao aor odo E d C IO P bae ean 140 MSG EITOIJ OS ox eg AT roe wind CODEC Ep Sere tud 148 TPO WOES zc btu suele 3 5 418 8 DU tco a e ei AS 148 Compare Instructions CMP EQU GEO GRT LEO LES LIM MEQ NEQ Table of Contents 7 Extended Error Codes 4 4 rd or va et pdt seeded 150 PLC and SLC Error Codes CERRY rer oe rere ee 152 Block Transfer Error Codes 4 soe onere Cs 154 Specify the Configuration Details 3x vw 458 2 155 Specify CIP Data Table Read and Write messages 156 Reconfigure an I O modules 12 1 se ors 157 Specify CIP Genetic messages wm oe 8 ur XC Y v 158 Specify PLG 5 messages i stet ebd E a ane e eet 159 Specify SLC messages uei oce e deka db eee dus 161 Specify block transfer messages 12x ovo ei 161 Specify PLC 3 messages s oS ood RP RS RT EST 162 Specify PLC 2 messages o soa d accordo Ed 163 MSG Configuration Examples 0 00000000 164 Specify the Communication Details 4 ve xe ees 165 Specify a path sos votos Sok GE oe ate etn ANTA E Us 165 For Block Transfers uaa deret ob Do E ahh ne tbs 168 Specify a Communication Method Or Module Address 169 Choose a cache Option isse Tete eee oo tou 170 Guidelines ctus qoaa d a dei E aule e dose AO vp qnd 172 Get System Value GSV and Set System Value SSV 173 GSV SSW ODieCss cod
283. d uet eo o EC e De o ee 287 Enter an immediate mask value 288 Masked Move with Target MVMT 05 290 Bit Field Distribute BTD illie 293 Bit Field Distribute with Target BTDT 296 Clear CER esa Putas e ep PE bce Bae KS Mise ate 299 Swap Byte SWPB iucpeedopsctar en t e Ld rM Roe eem 301 Bitwise AND AND 4 4 tud xc e ab A es 305 BitWise OIUCOR bi ecd v Nu Cache EAE ac MAR AIO CR db ta 308 Bitwise Exclusive OR XOR 22124 oi 4 ee ets NS 311 Bitwise NOT NOT wy oda eg ae Coe d meti ed e 315 Boolean AND BAND lees 319 Boolean OR BORSA peaa hee ee Ped Na qe D uS ERO 322 Boolean Exclusive OR BXOR 0 0000 00005 225 Boolean NOT SBNOT 134 su 2er ue moe etes 328 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Array File Shift Instructions BSL BSR FFL FFU LFL LFU Sequencer Instructions SQI SQ0 SQL Table of Contents 9 Chapter 9 INR OCMCUOR saws e spud E o EE n eru dS 331 Selecting Mode of Operation due 44 Y Perdre 332 PNY SNOT SS PEEL 332 Numerical ode v oca doe pt oed edd p a 233 Incremental mode vsu ee 22 8 OST EES ee RSS Oe Ba 335 File Arithmetic and Logic FAL 0 000 337 FAL EXpressions Lua e eub ag Mk aed XM De ee ab 346 Valid Dpebliobs 27 exe ek BE OEY OR OHO Kee See 347 Format Expressions yn coe sag aac e emm esc 347 Determine the order of operation 348 File Sear
284. de Result POS gt size of Result array 4 20 Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 483 Execution Condition Relay Ladder Action prescan i compare EN bit is cleared examine compare DN 0 compare DN bit pe 1 compare DN bit is cleared compare POS value is cleared result DN bit is cleared ui rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 484 Special Instructions FBC DDT DTR PID Condition Relay Ladder Action rung condition in is false compare EN bit is cleared examine compare DN 0 compare DN bit pus compare DN bit is cleared compare POS value is cleared result DN bit is cleared ua rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 485 Condition Relay Ladder Action rung condition in is true examine compare EN 1 oto compare EN bit gt exit pee 0 compare DN 1 compare EN bit is set compare DN bit A compare DN 0 compare ER bit is cleared compare ENZO i compare POS 0 BENE no compare ER bit is set rung condition out is set to true goto om m page Publication 1756 RMOOSI EN P January 2007 486
285. doing anything else Operand Type Format Description count SINT tag tag to store count position as the FOR DO executes INT DINT initial SINT tag must evaluate to a number value INT expression specifies initial value for count DINT immediate final SINT tag specifies final value for count which value determines when to exit the loop INT expression DINT immediate increment SINT tag optional amount to increment count each time through the loop INT expression DINT immediate If you don t specify an increment the count increments by 1 IMPORTANT Make sure that you do not iterate within the loop too many times in a single scan e The controller does not execute any other statements in the routine until it completes the loop e If the time that it takes to complete the loop is greater than the watchdog timer for the task a major fault occurs e Consider using a different construct such as IF THEN Publication 1756 RMOOSI EN P January 2007 Structured Text Programming 679 Description The syntax is FOR count initial value TO final value optional BY increment If you don t specify an increment the loop increments by 1 DO statement IF bool expression THEN 1 pL ILA a If there are conditions when you want to optional exit the loop early use other statements END IF such as an IF THEN construct to condition an EXIT statement END FOR The foll
286. ds PPER Upper Case Source Dest UPPER Source Dest Description Arithmetic Status Flags Fault Conditions Execution ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 631 The UPPER instruction converts the alphabetical characters in a string to upper case characters Relay Ladder Operand Type Format Description Source string tag tag that contains the characters that you want to convert to upper case Destination string tag tag to store the characters in upper case Structured Text The operands are the same as those for the relay ladder UPPER instruction The UPPER instruction converts to upper case all the letters in the Source and places the result in the Destination e ASCII characters are case sensitive Upper case A 41 is not equal to lower case a 61 e If operators directly enter ASCII characters convert the characters to all upper case or all lower case before you compare them Any characters in the Source string that are not letters remain unchanged not affected none Condition prescan Relay Ladder Action The rung condition out is set to false Structured Text Action No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes The rung condition out is set to true na Publication 1756 RMOOSI EN P January 2007 632 ASCII
287. e rung condition in is true i examine data bit data bit 1 rung condition out is set data bit 0 rung condition out is set to true to false postscan Publication 1756 RMOOSI EN P January 2007 gt Y The rung condition out is set to false Example 1 Example 2 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 73 If limit_switch_2 is cleared this enables the next instruction the rung condition out is true Relay Ladder irit switch 2 Structured Text IF NOT limit switch 2 THEN statement END IF If S V is cleared indicates that no overflow has occurred this enables the next instruction the rung condition out is true Relay Ladder m E Structured Text IF NOT S V THEN statement END IF Publication 1756 RMOOSI EN P January 2007 74 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Output Energize OTE Operands Description Arithmetic Status Flags Fault Conditions Execution Condition prescan The OTE instruction sets or clears the data bit Relay Ladder Operand Type Format Description data bit BOOL tag bit to be set or cleared Structured Text Structured text does not have an OTE instruction but you can achieve the same results using a non retentive assignment data bit BOOL expression See Appendix B for info
288. e Publication 1756 RMOOSI EN P January 2007 Condition prescan Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 121 Execution Function Block Action No action taken Structured Text Action No action taken instruction first scan EN TT and DN are cleared ACC value is not modified EN TT and DN are cleared ACC value is not modified instruction first run EN TT and DN are cleared ACC value is not modified EN TT and DN are cleared ACC value is not modified Enableln is cleared EnableOut is cleared the instruction does nothing and the outputs are not updated na Enableln is set Function Block When Enableln transitions from cleared to set the instruction initializes as described for instruction first scan The instruction executes EnableOut is set Enableln is always set The instruction executes reset When the Reset input parameter is set the When the Reset input parameter is set the instruction clears EN TT and DN and sets instruction clears EN TT and DN and sets ACC zero ACC zero postscan No action taken No action taken Publication 1756 RMOOSI EN P January 2007 122 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Example Each scan that imit_switch1 is set the RTOR instruction increments the ACC value by elapsed time until the ACC value reaches the PRE valu
289. e 296 FBD BOOLEAN AND structure 319 Publication 1756 RMOOSI EN P January 2007 694 Index FBD BOOLEAN NOT structure 328 FBD BOOLEAN OR structure 322 FBD BOOLEAN XOR structure 325 FBD COMPARE structure 213 217 221 225 229 244 FBD CONVERT structure 562 565 FBD COUNTER structure 131 FBD LIMIT structure 233 FBD LOGICAL structure 306 309 312 316 FBD MASK EQUAL structure 239 FBD MASKED MOVE structure 290 FBD MATH structure 254 258 261 264 269 277 553 FBD_MATH_ADVANCED structure 273 280 523 526 530 533 537 541 546 550 557 560 FBD_ONESHOT structure 89 92 FBD_TIMER structure 110 114 118 FBD_TRUNCATE structure 567 feedback loop function block diagram 645 feedforward 518 FFL instruction 396 FFU instruction 402 FIFO load 396 FIFO unload 402 file arithmetic and logic 337 file bit comparison 480 file fill 364 file instructions See array instructions file search and compare 349 FIND instruction 612 Find String 612 FLL instruction 364 FOR instruction 472 for break instructions BRK 475 FOR 472 introduction 471 RET 476 FOR DO 678 FRD instruction 565 FSC instruction mode of operation 332 operands 349 function block diagram choose elements 641 create a scan delay 648 resolve a loop 645 resolve data flow between blocks 647 Publication 1756 RMOOSI EN P January 2007 functions structured text 665 G GEQ instruction 216 get system value 173 greater than 220 greater than or equal to 216 GRT
290. e When ACC 2 PRE the DN parameter is set and timer_state3 0 limit_amitch1 Publication 1756 RMOOSI EN P January 2007 is set Structured Text RTOR_01 Preset 500 RTOR Ol Reset reset RTOR Ol TimerEnable limit_switchl OR 01 timer state3 Function Block RTOR D RTOR O1 DN 4 RTOR Retentive Timer On with Reset TimerEnable C PRE Reset ACC D DN 3 tfi timer state3 Count Up CTU Operands Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 123 The CTU instruction counts upward This instruction is available in structured text and function block as CTUD see page 131 Relay Ladder CTU m Count Up CU Operand Type Format Description HUN CDN5 Counter COUNTER tag counter structure rese f Accum Preset DINT immediate how high to count Accum DINT immediate number of times the counter has counted initial value is typically 0 COUNTER Structure Mnemonic Data Type Description CU BOOL The count up enable bit indicates that the CTU instruction is enabled DN BOOL The done bit indicates that ACC 2 PRE OV BOOL The overflow bit indicates that the counter exceeded the upper limit of 2 147 483 647 The counter then rolls over to 2 147 483 648 and begins counting up again UN BOOL The underflow bit indicates that the counter exceeded the lower limit of 2 147 483 648 Th
291. e counter then rolls over to 2 147 483 647 and begins counting down again PRE DINT The preset value specifies the value which the accumulated value must reach before the instruction sets the DN bit ACC DINT The accumulated value specifies the number of transitions the instruction has counted Publication 1756 RMOOSI EN P January 2007 124 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Description When enabled and the CU bit is cleared the CTU instruction increments the counter by one When enabled and the CU bit is set or when disabled the CTU instruction retains its ACC value rung condition in count up enable bit CU count up done bit DN preset counter accumulated value ACC The accumulated value continues incrementing even after the DN bit 16636 is set To clear the accumulated value use a RES instruction that references the counter structure or write 0 to the accumulated value Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 125 Execution Condition Relay Ladder Action prescan The CU bit is set to prevent invalid increments during the first program scan The rung condition out is set to false rung condition in is false The CU bit is cleared The r
292. e 0 65 535 Access The SERIALPORT Object The SERIALPORT object provides an interface to the serial communication port Attribute Data Type Instruction Description BaudRate DINT GSV Specifies the baud rate Valid values are 110 300 600 1200 2400 4800 9600 and 19200 default DataBits SINT GSV Specifies the number of bits of data per character Value Meaning 7 7 data bits ASCII only 8 8 data bits default Parity SINT GSV Specifies the parity Value Meaning 0 no parity no default 1 odd parity ASCII only 2 even parity RTSOffDelay INT GSV Amount of time to delay turning off the RTS line after the last character has been transmitted Valid value 0 32 767 Delay in counts of 20 msec periods The default is 0 msec RTSSendDelay INT GSV Amount of time to delay transmitting the first character of a message after turning on the RTS line Valid value 0 32 767 Delay in counts of 20 msec periods The default is 0 msec StopBits SINT GSV Specifies the number of stop bits Value Meaning 1 1 stop bit default 2 2 stop bits ASCII only Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 193 Attribute Data Type Instruction Description PendingBaudRate DINT SSV Pending value for the BaudRate attribute PendingDataBits SINT SSV Pending value for the DataBits attribute PendingParity SINT SSV Pending value for the Parity attribute PendingRTSOffDelay INT
293. e DEG instruction converts the Source in radians to degrees and stores the result in the Destination Operands Relay Ladder DEG tient To Dewees Operand Type Format Description JOuIce f Source SINT immediate value to convert to degrees Dest INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest DEG source Use DEG as a function This function converts source to degrees and stores the result in dest See Appendix B for information on the syntax of expressions within structured text DEG 04 Function Block Operand Type Format Description DEG tag FBD MATH ADVANCED structure DEG structure Publication 1756 RMOOSI EN P January 2007 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 557 FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the conversion instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the conversion instruction Arithmetic status flags are set for this output Description The DEG instruction uses this algorithm Arithmetic Status Flags Fault Conditions Condition prescan Execution Source 180 m where x 3 141593 Arithmetic status flags are affected none Relay
294. e Dest D value masked Mack 0 mak D Target het a m0 target get D Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 293 Bit Field Distribute BTD Operands BTD Bit Field Distribute Source Source Bit Dest Dest Bit Lenath Description The BTD instruction copies the specified bits from the Source shifts the bits to the appropriate position and writes the bits into the Destination This instruction is available in structured text and function block as BTDT see page 296 Relay Ladder Operand Type Format Description Source SINT immediate tag that contains the bits to move INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Source bit DINT immediate number of the bit lowest bit number from where to start the move 0 31 DINT 0 15 INT must be within the valid range for the Source 0 7 SINT data type Destination SINT tag tag where to move the bits INT DINT Destination DINT immediate the number of the bit lowest bit number bit where to start copying bits from the Source 0 31 DINT 0 15 INT must be within the valid range for the 0 7 SINT Destination data type Length DINT immediate number of bits to move 1 32 When enabled the BTD instruction copies a group of bits from the Source to the Destination The group of bits is identified by
295. e base is always 1 msec For example for a 2 second timer enter 2000 for the PRE value TimerEnable Reset preset ja Dep 16651 0 timer did not reach 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 time now ACC ACC current_time last time scanned Publication 1756 RMOOSI EN P January 2007 120 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES IMPORTANT After it updates the ACC the timer sets last time scanned current time This gets the timer ready for the next scan Make sure to scan the timer at least every 69 minutes while it runs Otherwise the ACC value won t be correct The ast 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 wont 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 Arithmetic Status Flags not affected Fault Conditions non
296. e end of the zone e If an MCR zone continues to the end of the routine you do not have to program an MCR instruction to end the zone 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 Do not overlap or nest MCR zones Fach 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 stops when the zone is disabled and the timer is cleared not affected none Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 455 input 9 input 10 LE J3 Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false The instructions in the zone are scanned but the rung condition in is false and non retentive outputs in the zone are disabled rung condition in is true The rung condition out is set to true The instructions in the zone are scanned normally postscan The rung condition out is set to false Example When the first MCR instruction is enabled input_1 input 2 and inp
297. e length specifies the number of steps in the sequencer array POS DINT The position identifies the element that the instruction is currently comparing Publication 1756 RMOOSI EN P January 2007 Sequencer Instructions SQI SQO SQL 423 Description When enabled the SQI instruction compares a Source element through a Mask to an Array element for equality Typically use the same CONTROL structure as the SQO and SQL instructions The SQI instruction operates on contiguous memory Enter 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 162 hexadecimal for example 16 0FOF 0f octal for example 8216 2 binary for example 2 00110011 Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 424 Sequencer Instructions SQI SQO SQL Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true LEN lt 0 cnt mgs ERbitis cleared POS gt LEN yes ER bit is set no masked Source q masked Array POS p rung condition out is set to rung condition out is set to false true postscan The rung conditio
298. e monitored Value is copied to In when Immediate instruction executes ProgAck BOOL Tag Value is copied to ProgAck when instruction executes On transition Immediate from False to True acknowledges alarm if acknowledgement is required Publication 1756 RMOOSI EN P January 2007 Digital Alarm Instruction ALMD 33 Operand Type Format Description ProgReset BOOL Tag Value is copied to ProgReset when instruction executes On transition Immediate from False to True resets alarm if resetting is required ProgDisable BOOL Tag Value is copied to ProgDisable when instruction executes When True Immediate disables alarm does not override Enable Commands ProgEnable BOOL Tag Value is copied to ProgEnable when instruction executes When True Immediate enables alarm takes precedence over Disable commands ALMD NN Digital Alarm In amp larm Acked Suppressed Disabled Function Block Operands Operand ALMD tag ALARM DIGITAL structure ALMD structure Publication 1756 RMOOSI EN P January 2007 34 Digital Alarm Instruction ALMD Structure Definition for ALARM DIGITAL Tag Input Parameter Enableln Data Type BOOL The tag structure ALARM DIGITAL which corresponds to the ALMD tag is common to all languages except where noted Input Parameters Description System defined input Ladder Logic Corresponds to the rung state Does not affect processing Structured Te
299. e next element in the array If index equals array lengtb then the SWPB has acted on all the elements in the array Publication 1756 RMOOSI EN P January 2007 304 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Relay Ladder Initialize the tags SIZE Size in Elements Source array 0 1234 Dim To Vary 0 Size array length 4 Reverse the bytes swap bytes LBL SwPB DD Add Source A Swap Byte Source array index 1 Order Mode REVERSE Dest array bytes reverse index 4321 Source B index Dest Determine whether the SWPB instruction has acted on all the elements in the array LES Less Than A lt B Source index De swap bytes M Source B array length 4 Structured Text index 0 SIZE array 0 0 array length REPEAT SWPB array index REVERSE array bytes reverse index index index 1 UNTIL index gt array length END REPEAT Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 305 Bitwise AND AND The AND instruction performs a bitwise AND operation using the bits in Source A and Source B and places the result in the Destination To perform a logical AND see page 319 Operands Relay Ladder AND Bit
300. e on different sheets within the same routine disperse data to Latching Data Publication 1756 RMOOSI EN P January 2007 several points in the routine single output wire connector OCON and multiple input wire connectors ICON If you use an IREF to specify input data for a function block instruction the data in that IREF is latched for the scan of the function block routine The IREF latches data from program scoped and controller scoped tags The controller updates all IREF data at the beginning of each scan REF M p In this example the value of tagA is stored at the beginning of the routine s execution The stored value is used when Block 01 executes The same stored value is also used when Blcock_02 executes If the value of tagA changes during execution of the routine the stored value of tagA in the IREF does not change until the next execution of the routine Block 01 E a 34 P Block 02 A Function Block Attributes 643 This example is the same as the one above The value of tagA is stored only once at the beginning of the routine s execution The routine uses this stored value throughout the routine Block 01 Starting with RSLogix 5000 software version 11 you can use the same tag in multiple IREFs and an OREF in the same routine Because the values of tags in IREFs are latched every scan through the routine all IREFs will use the
301. e rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The RES instruction resets the specified structure The rung condition out is set to true postscan The rung condition out is set to false Examples Example Description When enabled reset timer 3 timer 3 CRES When enabled reset counter f counter 1 CRES 5 When enabled reset control 1 control 1 CRES 5 Publication 1756 RMOOSI EN P January 2007 138 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Notes Publication 1756 RMOOSI EN P January 2007 Chapter 5 Introduction If You Want To send data to or from another module Input Output Instructions MSG GSV SSV IOT 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 Use This Instruction Available In These Languages See Page MSG relay ladder 140 structured text get controller status information GSV relay ladder 173 structured text set controller status information SSV relay ladder 173 structured text e send output values to an I O module or consuming controller at a specific point in your logic e trigger an event task in another controller IOT relay ladder 200 structured text Publication 1756 RMOOSI EN P January 2007 140 Inpu
302. e 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 rung condition in goes true and remains set until either the DN bit or the ER bit is set and the rung condition in is false If the rung condition in goes false but the DN bit and the FR bit are cleared the EN bit remains set Important Do not change the EN 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 Refer to Choose a cache option on page 5 170 Connections for MSG instructions going out the serial port are not cached even if the EN CC bit is set ERR SRC SINT Used by RSLogix 5000 software to show the error path on the Message Configuration dialog box DestinationLink INT To change the Destination Link of a DH or CIP with Source ID message set this member to the required value Publication 1756 RMOOSI EN P January 2007 142 Input Output Instructions MSG GSV SSV IOT Mnemonic Data Description Type DestinationNode INT To change the Destination Node of a DH or CIP with Source ID message set this member to the required value SourceLink
303. ear as operands on the instruction The instruction operands are not common to all languages The ALMD instruction has a corresponding tag structure CALARM DIGITAD which is common to all languages Refer to Structure Definition for ALARM DIGITAL Tag on page 34 for descriptions of the tag elements and alarm execution About Operator Parameters Operator parameters for example OperSuppress work wih any Rockwell Automation or third party operator interface to allow control of alarm states When an Operator request is set the ALMD instruction evaluates whether it can respond to the request then always resets the request This lets operator interfaces work with this instruction by merely resetting the desired request bit You don t have to program the operator interface to reset the request bits Using the ALMD Instruction to Subscribe to and Display Alarms The ALMD instruction provides additional functionality when used with RSLinx Enterprise and FactoryTalk View SE software You can display alarms in the Alarm Summary Alarm Banner Alarm Status Explorer and Alarm Log Viewer displays in FactoryTalk View SE software RSLinx Enterprise software subscribes to alarms in the controller Using several output parameters shown in the output parameter tables that follow you can monitor the instruction to see the alarm Publication 1756 RMOOSI EN P January 2007 32 Digital Alarm Instruction ALMD Digital Alarm Operands subscri
304. earch failed 2100 Privilege failure 210F Task cannot start 2101 Invalid keyswitch position 2110 Unable to write 2102 Password invalid 2111 Unable to read 2103 No password issued 2112 Shared routine not editable 2104 Address out of range 2113 Controller in faulted mode 2105 Address and how many out of range 2114 Run mode inhibited 2106 Data in use 2107 Type is invalid or not supported Publication 1756 RMOOSI EN P January 2007 152 Input Output Instructions MSG GSV SSV IOT PLC and SLC Error Codes hex 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 e 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 OOFO error code e The change also makes the error codes more consistent with errors returned by other controllers such as PLC 5 controllers The following 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 R9 x And Earlier R10 x And Later Description ERR EXERR ERR EXERR 0010 1000 Illegal command or format from local proces
305. eared to set the OSRI instruction sets OutputBit for one scan Structured Text OSRI Ol InputBit limit switchl OSRI OSRI 01 State OSRI_01 OutputBit Function Block OSRI 01 OSRI EM One Shot Rising with Input 0 0 limit switch1 a mE InputBit OutputBit EeE State Publication 1756 RMOOSI EN P January 2007 92 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI One Shot Falling with Input The OSFI instruction sets the OutputBit for one execution cycle when OSFI the InputBit toggles from set to cleared This instruction is available in relay ladder as OSF see page 3 86 Operands OSFI OSFI tag Structured Text Operand Type Format Description OSH tag FBD_ONESHOT structure OSFI structure Function Block OSFI tag OSFI El One Shot Falling with Input Operand Type Format Description 0 OSH tag FBD_ONESHOT structure OSFI structure InputBit OutputBit f FBD_ONESHOT Structure Input Parameter Data Type Description Enableln BOOL Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes InputBit BOOL Input bit This is equivalent to rung condition for the relay ladder OSF instruction Default is cleared Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result OutputBit BOOL Ou
306. ected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code Result POS gt size of Result array 4 20 Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 491 Execution Condition Relay Ladder Action prescan i compare EN bit is cleared examine compare DN 0 compare DN bit pe 1 compare DN bit is cleared compare POS value is cleared result DN bit is cleared ui rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 492 Special Instructions FBC DDT DTR PID Condition Relay Ladder Action rung condition in is false compare EN bit is cleared examine compare DN 0 compare DN bit poen compare DN bit is cleared compare POS value is cleared result DN bit is cleared rung condition out is set to 4 Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 493 Condition Relay Ladder Action rung condition in is true examine compare EN 1 goto compare EN bit p exit pee 0 compare EN bit is set gt compare DN bit 1 examine compare DN bit goto exit compare DN bit 0 compare ER bit is cleared compare ENZO fr compare POS 0 BENE no compare ER bit is set rung condition out i
307. ecuted in order to minimize the sampling error between the input and the instruction Publication 1756 RMOOSI EN P January 2007 Function Block Attributes 651 Timing Mode Description real time sampling In the real time sampling mode the delta time DeltaT used by the instruction is the difference between two time stamp values that correspond to the updates of the process input Use this mode when the process input has a time stamp associated with its updates and you need precise coordination The time stamp value is read from the tag name entered for the RTSTimeStamp parameter of the instruction Normally this tag name is a parameter on the input module associated with the process input The instruction compares the configured RTSTime value expected update period against the calculated DeltaT to determine if every update of the process input is being read by the instruction If DeltaT is not within 1 millisecond of the configuration time the instruction sets the RTSMissed status bit to indicate that a problem exists reading updates for the input on the module Time based instructions require a constant value for DeltaT in order for the control algorithm to properly calculate the process output If DeltaT varies a discontinuity occurs in the process output The severity of the discontinuity depends on the instruction and range over which DeltaT varies A discontinuity occurs if the e instruction is not executed during a scan e in
308. ed Fault Conditions none Example 1 IF THEN If You Want This Enter This Structured Text IF rejects 3 then IF rejects 3 THEN conveyor off 0 conveyor 0 alarm on 1 alarm 1 END IF Example 2 IF THEN ELSE If You Want This Enter This Structured Text If conveyor direction contact forward 1 then IF conveyor direction THEN light off light 0 Otherwise light on ELSE light 1 END IF The tells the controller to clear light whenever the controller e enters the RUN mode e leaves the step of an SFC if you configure the SFC for Automatic reset This applies only if you embed the assignment in the action of the step or use the action to call a structured text routine via a JSR instruction Publication 1756 RMOOSI EN P January 2007 674 Structured Text Programming Example 3 IF THEN ELSIF If You Want This Enter This Structured Text If sugar low limit switch low on and sugar high limit IF Sugar Low amp Sugar High THEN switch not high on then THEN inlet valve open on Sugar Inlet 1 Until sugar high limit switch high off ELSIF NOT Sugar High Sugar Inlet 0 END_IF The tells the controller to clear Sugar Inlet whenever the controller e enters the RUN mode e leaves the step of an SFC if you configure the SFC for Automatic reset This applies only if you embed the assignment in the action of the step
309. ed the FOR instruction repeatedly executes the Routine until the Index value exceeds the Terminal value This instruction does not pass parameters to the routine 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 controllers watchdog to timeout which causes a major fault not affected A Major Fault Will Occur If Fault Type Fault Code main routine contains a RET instruction 4 31 Relay Ladder Action The rung condition out is set to false The controller executes the subroutine once If recursive FOR instructionOs exist to the same subroutine the subroutine is prescanned only the first time If multiple FOR instructions exist non recursive to the same subroutine the subroutine is prescanned each time rung condition in is false The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 474 For Break Instructions FOR FOR DO BRK EXIT RET Condition rung condition in is true Relay Ladder Action Y index initial value no goto index lt terminal value p Y step size lt 0 index gt terminal value no goto end execute routine rung condition out is set to true postscan Example Publication 1756 RMOOSI EN P January 2007 The rung condition out
310. ed from was entered for the instruction If cleared this the instruction entry bit indicates that no return parameter was entered for the instruction DN BOOL The done bit is set when the external routine The external routine sets this bit has executed once to completion ER BOOL The error bit is set if an error occurs The The external routine sets this bit instruction stops executing until the program clears the error bit FirstScan BOOL This bit identifies whether this is the first scan The controller sets this bit to reflect scan after switching the controller to Run mode Use status FirstScan to initialize the external routine if needed EnableOut BOOL Enable output The external routine sets this bit Enableln BOOL Enable input The controller sets this bit to reflect rung condition in The instruction executes regardless of rung condition The developer of the external routine should monitor this status and act accordingly User BOOL These bits are available for the user The Either the external routine or the user serd BOOL controller does not initialize these bits program can set these bits ScanType1 BOOL These bits identify the current scan type The controller sets these bits to reflect scan status Scan TypeQ BOOL Bit Values Scan Type 00 Normal 01 Pre Scan 10 Post Scan not applicable to relay Publication 1756 RMOOSI EN P January 2007 ladder programs Program Control Instructions JMP LBL JSR RET
311. ed value rather than snap to the lower value These bits are manipulated by the network specific tick synchronization method 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 a master CST object via a system time update 4 local network master the CST object is the local network master time source 5 in relay mode the CST object is acting in a time relay mode 6 duplicate master detected a duplicate local network time master has been detected This bit is always 0 for time dependent nodes 7 unused 8 9 00 time dependent node 01 time master node 10 time relay node 11 unused 10 15 unused CurrentValue DINT 2 GSV Current value of the timer DINT 0 contains the lower 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 request value as reported in the CurrentStatus attribute Publication 1756 RMOOSI EN P January 2007 182 Input Output Instructions MSG GSV SSV IOT Access the DF1 object The DF1 object provides an interface to the DF1 communication driver that you can configure for the serial port Attribute Data Type Instruction Description ACKTimeout
312. ee Tea 578 ASCII Clear Buffer GOLD od world ueSPISeemg Seen 581 ASCII Handshake Lines CAHL se py ees 583 ASCII Read ARD lee eA 587 ASCII Bead Line ARL 242 bated hor PEL eS 24 591 ASCII Write Append AWA d pa er a dete eee ete ila 595 ASCII Write AWT acted hore iode Rt cO e OE ated 600 Publication 1756 RMOOSI EN P January 2007 12 Table of Contents ASCII String Instructions CONCAT DELETE FIND INSERT MID ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Common Attributes Function Block Attributes Publication 1756 RMOOSI EN P January 2007 Chapter 19 PN ROCCO Dis its hernia eRe erat neste anal pea ENG 605 Stins Data ly DeSPa sav Fae gh os a Be be Ra ERE RS 607 String Goncatenate CONCAT s ue adesse os Ox 608 String Delete DEEBEE x td dedere RR DNO 610 Find String FIND SiaesticiqR2SveX e SEA 2fTYES6s 612 Insert String CINSERT 165i eR E399 8 demi dos d ops 614 Middle String MID 2 4 5 i a sme onu ode ob ba eios 616 Chapter 20 ot oc Diele xs NIE wb Da e DK E Re RSE 619 String Data Types ue 2 2 bre er EROR E DEI RS 621 String To DINT STOD c ou eu qued eer dede oe gd 622 String To REAL STOR a uN av e ber CP CR PUE UV 624 DINT to String DTOS cs oS eco 8 Ghee tednaethncs eS a8 626 REAL to String RTOS deseas dag oS pea Reni e 629 Upper Case UPPER a 1d jon kb Ger SCREEN 631 Lower Case LOWER cal ord ven XX EN eu RE T XR 633 Appendix A Introduction MERER
313. eln is set The instruction executes EnableOut is set postscan No action taken Example 1 This example performs an exclusive OR on bool_in1 and bool_in2 and places the result in value_result_xor Publication 1756 RMOOSI EN P January 2007 If BOOL_IN1Is If BOOL IN2is Then VALUE RESULT XOR Is 0 0 0 0 1 1 1 0 1 1 1 0 Structured Text value_result_xor bool_inl XOR bool_in2 Function Block BXOR 01 BXOR Es Boolean Exclusive Or 20 0 bool in1 JT Hini A value result xor lt a bool_in2 J Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 327 Example 2 In this example igbt1 is set on if e only bool in1 is set true e only bool in2 is set true Otherwise light1 is cleared off Structured Text IF bool_inl XOR bool_in2 THEN lightl 1 ELSE lightl 0 END IF Publication 1756 RMOOSI EN P January 2007 328 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Boolean NOT BNOT amp IF NOT operand TH statement END IF Operands EN BNOT 01 BNOT E Boolean NOT The BNOT instruction complements a boolean input To perform a bitwise NOT see page 13 315 Structured Text Use NOT as an operator within an expression The operand must be a BOOL values or expressions that evaluate to BOO
314. ength 1 Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 383 Example 2 Calculate the standard deviation of dini array which is DINT A 5 20 19 18 17 16 AVE if 5 90 5 18 dimension 1 K Sgt 2 3 4 0 20 19 18 17 16 1 15 14 13 12 11 dimension 0 2 10 9 8 7 6 3 smo real_std 1 581139 00718 19 Z 189 18 Z 18 17 Z 18 16 Z 18 1 SZ 1 581139 Relay Ladder Standard Deviation Position STD Array dint array 0 0 Dim to vary 1 N 5 Dest real std oo R Control control 1 Length 5e o Structured Text SI su FO EN av su FO EN re Z m 0 R positi sum D FOR erage m 0 R positi sum D FOR al std E dint array l length on 0 TO length 1 DO sum dint array position sum length on TO length 1 DO sum dint array position average 2 SORT sum length 1 Publication 1756 RMOOSI EN P January 2007 384 Size In Elements SIZE Operands SIZE Size in Elements Source Dim To Vary Size SIZE Source Dimtovary Size Description Arithmetic Status Flags Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE The SIZE instruction
315. ent element in array initial value is typically 0 Mode DINT immediate how to distribute the operation select INC ALL or enter a number Destination SINT tag tag to store the result INT DINT REAL Expression SINT immediate an expression consisting of tags and or immediate values separated INT tag by operators DINT REAL A SINT or INT tag converts to a DINT value by sign extension Structured Text Structured text does not have an FAL instruction but you can achieve the same results using a SIZE instruction and a FOR DO or other loop construct SIZE destination 0 length 1 FOR position 0 TO length DO destination position numeric_expression END_FOR See Appendix B for information on the syntax of constructs within structured text Publication 1756 RMOOSI EN P January 2007 338 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that 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 The error bit is set if the expression generates an overflow S V is set The instruction stops executing until the program clears the ER bit The POS value contains the position of the element that caused the overflow LEN DINT The length specifies the number of elements in the array on which the FAL instruction
316. ent gt lt q statements to execute when numeric expression selector2 selector3 lt statement gt lt q statements to execute when numeric expression selector3 Publication 1756 RMOOSI EN P January 2007 676 Structured Text Programming ELSE lt statement gt lt q Statements to execute when optional numeric expression any selector END CASE Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 See the table on the next page for valid selector values The syntax for entering the selector values is When Selector Is Enter one value value statement multiple distinct values value valueZ valueN statement Use a comma to separate each value a range of values value1 valueN statement Use two periods to identify the range distinct values plus a range valuea valueb valuef valueN statement of values The CASE construct is similar to a switch statement in the C or C programming languages However with the CASE construct the controller executes only the statements that are associated with the first matching selector value Execution always breaks after the statements of that selector and goes to the END_CASE statement not affected none Example If You Want This If recipe number 1 then Ingredient A outlet 1 open 1 Ingredient B outlet 4 open 1 If recipe number 2 or 3 then Ingredient A
317. ent to clients AlarmCount DINT The number of times the alarm has been activated InAlarm 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 acknowledgement If the alarm does not require acknowledgement 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 DeliveryER BOOL Indicates alarm notification message delivery error Set delivery error either no alarm subscriber was subscribed or at least one subscriber did not receive the latest alarm change state message Cleared delivery successful or in progress Publication 1756 RMOOSI EN P January 2007 38 Digital Alarm Instruction ALMD Output Parameter DeliveryDN Data Type BOOL Description Indicates alarm notification message delivery success Set delivery success at least one subscriber was subscribed and all subscribers received the latest alarm change state message successfully Cleared delivery not completed successfully or in progress DeliveryEN BOOL Indicates alarm notification message delivery in process Set delivery in progress Cleared delivery not in progress NoSubscriber BOOL Indicates that the alarm had no subscribers when attempting to deliver the
318. ently manipulating Publication 1756 RMOOSI EN P January 2007 Description Sequencer Instructions SQI SQ0 SQL 427 When enabled the SQO instruction increments the position moves the data at the position through the Mask and stores the result in the Destination If POS gt LEN the instruction wraps around to the beginning of the sequencer array and continues with POS 1 Typically use the same CONTROL structure as the SQI and SQL instructions The SQO instruction operates on contiguous memory Enter 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 for example 16 0FOF 0f octal for example 8216 24 binary for example 2200110011 Arithmetic Status Flags not affected Fault Conditions none Condition prescan Execution Relay Ladder Action The EN bit is set to prevent a false load when the program scan begins The rung condition out is set to false rung condition in is false The EN bit is cleared The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 428 Sequencer Instructions SQI SQO SQL Condition Relay Ladder Action rung condition in is true EN bit is set EN 0 examine EN bit gt p gt ER bit is cleared
319. er of characters from the buffer and stores them in the Destination e The ARD instruction continues to execute until it removes the specified number of characters Serial Port Control Length e While the ARD instruction is executing no other ASCII Serial Port instruction executes To program the ARD instruction follow these guidelines 1 Configure the serial port of the controller for user mode 2 Use the results of an ACB instruction to trigger the ARD instruction This prevents the ARD instruction from holding up the ASCII queue while it waits for the required number of characters 3 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See To trigger a subsequent action when the instruction is done examine the EM bit Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 589 Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes when rung condition in na toggles from cleared to set The rung condition
320. ered the event task that is when the continuous task executes its EVENT instruction to initialize the event task The RES instruction resets a counter that the event task uses Task Status D Counter 1 E 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 Sv Set System Value Class Name TASK Instance Name THIS Attribute Name Status Source Task Status 0 Task_Status 0 Task_Status 0 Publication 1756 RMOOSI EN P January 2007 470 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Notes Publication 1756 RMOOSI EN P January 2007 Chapter 13 For Break Instructions FOR FOR DO BRK EXIT RET Introduction Use the FOR instruction to repeatedly call a subroutine Use the BRK instruction to interrupt the execution of a subroutine If You Want To Use This Instruction Available In These Languages See Page Repeatedly execute a routine FOR relay ladder 472 FOR Do structured text Terminate the repeated execution of a routine BRK relay ladder 415 EXIT structured text Return to the FOR instruction RET relay ladder 476 1 Stru
321. erencing the same TIMER structure Publication 1756 RMOOSI EN P January 2007 106 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES The time base is always 1 msec For example for a 2 second timer enter 2000 for the PRE value rung condition in timer enable bit EN rung condition that controls RES instruction timer timing bit TT timer done bit DN preset timer accumulated value ACC _ L nS i 1 mm c timer did not reach PRE value How a Timer Runs A timer runs by subtracting the time of its last scan from the time now 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 Make sure to scan the timer at least every 69 minutes while it runs Otherwise the ACC value won t be correct The ast 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 e subroutine section of code that is between JMP and LBL instructions sequential function chart SFC event or periodic task state routine of a phase Arithmetic Status Flag
322. ers 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 for example the instruction converts only the first group of numbers Arithmetic Status Flags Arithmetic status flags are affected Publication 1756 RMOOSI EN P January 2007 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 623 Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is greater than the DATA 1 Check that no instruction is writing to the LEN size of the string tag member of the string tag 2 In the LEN value enter the number of characters that the string contains 4 53 The output number is beyond the limits of the Either destination data type e Reduce the size of the ASCII value e Use a larger data type for the destination Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set instruction execution na Enableln is always set The instruction executes SC is set Destination is cleared The instruction converts the Source If the result is zero then S Z is set postscan
323. es PVT BOOL process variable tracking 02no 1 yes DOE BOOL derivative of 0 PV 1 error SWM BOOL software manual mode 0 no auto 1 yes sw manual CA BOOL control action 0 means E SP PV 1 means E PV SP MO BOOL station mode 0 automatic 1 manual PE BOOL PID equation 0 independent 1 dependent NDF BOOL no derivative smoothing O derivative smoothing filter enabled 1 derivative smoothing filter disabled NOBC BOOL no bias back calculation O bias back calculation enabled 1 bias back calculation disabled NOZC BOOL no zero crossing deadband 0 deadband is zero crossing 1 deadband is not zero crossing INI BOOL PID initialized O no 1 yes SPOR BOOL setpoint out of range 0 no 1 yes OLL BOOL CV is below minimum output limit 02no 1 yes OLH BOOL CV is above maximum output limit 0 no 1 yes Publication 1756 RMOOSI EN P January 2007 504 Special Instructions FBC DDT DTR PID Mnemonic Data Type Description EWD BOOL error is within deadband 0 no 1 yes DVNA BOOL deviation is alarmed low O no 1 yes DVPA BOOL deviation is alarmed high 0 no 1 yes PVLA BOOL PV is alarmed low 0 no 1 yes PVHA BOOL PV is alarmed high 0 no 1 yes Description The PID instruction typically receives the process variable PV from Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 an analog input module and modulates a control variable output CV on an analog
324. es POS gt LEN e DN bit is set no postscan Publication 1756 RMOOSI EN P January 2007 yes POS gt LEN no Y FIFO POS 1 source POS POS 1 Y rung condition out is set to true The rung condition out is set to false Array File Shift Instructions BSL BSR FFL FFU LFL LFU 401 Example When enabled the FFL instruction loads value 1 into the next position in the FIFO which is array dint 5 in this example FFL FIFO Load EN Source value 1 DN5 FIFO array_dint O EM Control control 1 Length 10 Pasition 5 before FIFO load after FIFO load array_dint O 00000 00000 i di 1111 22222 22222 33333 control 1 pos 5 33333 44444 value 1 55555 44444 array dint 5 00000 p 55595 00000 00000 control_1 pos 6 00000 00000 00000 00000 00000 00000 Publication 1756 RMOOSI EN P January 2007 402 Array File Shift Instructions BSL BSR FFL FFU LFL LFU FIFO Unload FFU Operands FFU FIFO Unload FIFO Dest Control Lenath Position Publication 1756 RMOOSI EN P January 2007 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 Relay Ladder O
325. es erwep ER PAPIERS AR EE S EROS 176 Access the CONTROLLER object 177 Access the CONTROLLERDEVICE object 177 Access the CST object a neoxd gear PEREWPXU GS 181 Access the DEL object yous eps x tte et 182 Access the FAULTLOG QDIeet 2 2 aco Rut queen Beo o 185 Access The MESSAGE Object xa mee e 186 Access The MODULE Object 4 dixe RES PS RSS 188 Access The MOTIONGROUP Object 189 Access The PROGRAM Object 0005 190 Access The Routine object sey mae o epa ete 192 Access The SERIALPORT Object ede ow epe 192 Access The TASK Object gs d aac aed ceu lcg 194 Access The WALLCLOCKTIME Object 196 GSV SSV Programming Example lcs eese 197 Get Fault Information oue one q uc aesti Cand picasa qe 197 Set Enable And Disable Flags 0 4 sy oed n 199 Immediate Output c O1 s ox pss t ene ee Se ee eG 200 Chapter 6 Intr odo OE ue eot DAE capat QUIE ge POE en P Pe aot ces 205 Compare d GMPS oiu kennad loge roe cg e edet n oa 207 CMP eX pressions ss vester Vo oo as CR ede ad ts 209 Va lidoperators usce RV S Ro eee ees ROS eS po 209 Format EXpressions 35 yy p ee doe dm eds 210 Determine The Order of Operation 210 Publication 1756 RMOOSI EN P January 2007 8 Table of Contents Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR B
326. es not exist in 4 89 the SFC routine Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction resets the specified SFC routine The instruction resets the specified SFC routine postscan The rung condition out is set to false No action taken Example If a specific condition occurs shutdown is set restart the SFC at step initialize Relay Ladder shutdown SFR J SFC Reset SFC Routine Name mySFC Step Name initialize Structured Text IF shutdown THEN SFR mySFC initialize END_IF Publication 1756 RMOOSI EN P January 2007 466 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Trigger Event Task EVENT Operands EVENT Trigger Event Task Task EVENT task name Description Status Attribute of the TASK Object The EVENT instruction triggers one execution of an event task Relay Ladder Operand Type Format Description Task TASK name event task to execute The instruction lets you choose other types of tasks but it does not execute them Structure
327. escan The EN TT and DN bits are cleared The ACC value is cleared The rung condition out is set to false rung condition in is false The EN TT and DN bits are cleared The ACC value is cleared The rung condition out is set to false rung condition in is true Y examine DN bit Diit DN bit 0 EN bit is set examine EN bit TT bit is set ACC gt PRE TT bit is set examine ACC ACC ACC current time last time ACC lt PRE Y DN is se TT bit is cleared no ACC value lt q rolls over A yes rung condition out is set to true Y ACC 2 147 483 647 postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 99 Example When imit_switch_1 is set light 2 is on for 180 msec imer 1 is timing When timer 1 acc reaches 180 light_2 goes off and light_3 goes on Light_3 remains on until the TON instruction is disabled If limit switcb 1 is cleared while timer 1 is timing light_2 goes off limit switch 1 TON Timer On Delay Timer timer 1 Preset 180 Accum of timer_1 dn light_3 Publication 1756 RMOOSI EN P January 2007 100 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES
328. esult 1185921 Dest Structured Text result value 1 value 2 Function Block XPY 01 XPY T X To Power Of Y C SourceA value 1 value 2 4 result SourceB Chapter 17 Introduction If You Want To Convert radians to degrees Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC The math conversion instructions convert values Use This Instruction Available In These Languages See Page DEG relay ladder 556 structured text function block Convert degrees to radians RAD relay ladder 559 structured text function bloc Convert an integer value to a BCD value TOD relay ladder 562 function bloc Convert a BCD value to an integer value FRD relay ladder 565 function bloc Remove the fractional part of a value 1 Structured text only TRN relay ladder 567 TRUNC structured text function block 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 For relay ladder instructions 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 Publication 1756 RMOOSI EN P January 2007 556 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Degrees DEG Th
329. ext TAN 04 Function Block TAN en a Tingen Operand Type Format Description TANtag FBD_MATH_ADVANCED structure TAN structure Source Dest Publication 1756 RMOOSI EN P January 2007 530 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The Source must be greater than or equal to 102943 7 2nx2 and Arithmetic Status Flags Fault Conditions Condition prescan Execution less than or equal to 102943 7 2nx219 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true postscan Condition prescan The controller calculates the tangent of the Source and places the result in the Destination The rung condition out is set to true The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instru
330. ext IF SW 1 THEN discrete_prog_flag enable_prog ELSE discrete_prog_flag disable_prog END_IF SSV PROGRAM DISCRETE DISABLEFLAG discrete prog flag Publication 1756 RMOOSI EN P January 2007 200 Input Output Instructions MSG GSV SSV IOT Immediate Output IOT Operands IOT Immediate Output Update Tag IOT output tag Description The IOT instruction immediately updates the specified output data output tag or produced tag Relay Ladder Operand Type Format Description Update Tag tag tag that you want to update either e output tag of an I O module e produced tag Do not choose a member or element of a tag For example Local 5 0 is OK but Local 5 0 Data is not OK Structured Text The operands are the same as those for the relay ladder IOT instruction The IOT instruction overrides the requested packet interval RPD of an output connection and sends fresh data over the connection e An output connection is a connection that is associated with the output tag of an I O module or with a produced tag e If the connection is for a produced tag the IOT instruction also sends the event trigger to the consuming controller This lets the IOT instruction 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 configure the produced tag as follows f5 Tag Properties Produced Tag
331. f 1 162ffff 1 1620000 ffff 65535 9 1234 668 1620000 029c 668 2 1010 10 1620000 000a 10 Data Conversions Data conversions occur when you mix data types in your programming When Programming in Conversions Can Occur When You Relay Ladder Logic Mix data types for the parameters within one instruction Function Block Wire two parameters that have different data types Publication 1756 RMOOSI EN P January 2007 636 Common Attributes Instructions execute faster and require less memory if all the operands of the instruction use e the same data type e an optimal data type In the Operands section of each instruction in this manual a bold data type indicates an optimal data type The DINT and REAL data types are typically the optimal data types Most function block instruction only support one data type the optimal data type for its operands If you mix data types and use tags that are not the optimal data type the controller converts the data according to these rules e Are any of the operands a REAL value If Then input operands for example source tag in an expression limit convert to Yes REALs No DINTs e After instruction execution the result a DINT or REAL value converts to the destination data type if necessary You cannot specify a BOOL tag in an instruction that operates on integer or REAL data types Because the conversion of data takes additional time and memo
332. f Fault Type Fault Code POS lt 0 or LEN lt 0 4 21 Dimension to vary does not exist for the 4 20 specified array Publication 1756 RMOOSI EN P January 2007 370 X Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Execution Condition Relay Ladder Action prescan The EN bit is cleared The DN bit is cleared The ER bit is cleared The rung condition out is set to false rung condition in is false examine DN bit DNEER DN bit 1 EN bit is cleared ER bit is cleared DN bit is cleared a rung condition out is set to 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 Internally the instruction uses a FAL instruction to calculate the average Expression average calculation Mode ALL For details on how the FAL instruction executes see page 9 339 postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 dimension 0 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 371 Example 1 Average array dint which is DINTI4 5 dimension 1 T e e N w pA ce N ce co co N Oo AVE IE183935 Bes dint ave 12 Relay Ladder VE Average File Array array dint 0 1 Dim
333. f control The two equation types are merely provided to let you use the equation type with which you are most familiar Derivative Of Equation error E t 1 dE CV z ral d BIAS 0 process variable PV E SP PV t 1 dPV CV za rjenzr T BIAS 0 E PV SP t 1 dPV CV Kc E ret T 7 BIAS 0 Independent gains error E t CV KpE K Edt Ke BIAS 0 process variable PV E SP PV t CV KpE Kf Edie SY BIAS 0 E PV SP t CV KpE K Edt K 0 dPV TE BIAS Publication 1756 RMOOSI EN P January 2007 510 Special Instructions FBC DDT DTR PID Publication 1756 RMOOSI EN P January 2007 Where Variable Description Kp proportional gain unitless Kp Ke unitless Ki integral gain seconds To convert between K integral gain and T reset time use Kc K 60T Kg derivative gain seconds To convert between Ky derivative gain and T rate time use Ka Ke Tg 60 Ke controller gain unitless Ti reset time minutes repeat Tg 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 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 Kg or Tg equal to zero Anti reset Windup And Bumpless Transfer From Manual To Auto The PID instru
334. finds the size of a dimension of an array Relay Ladder Operand Type Format Description Source SINT array tag array on which the instruction is to operate INT DINT REAL structure string Dimension DINT immediate dimension to use to Vary 0 1 2 For The Size Of Enter first dimension 0 second dimension 1 third dimension 2 Size SINT tag tag to store the number of elements in the specified dimension of the array INT DINT REAL Structured Text The operands are the same as those for the relay ladder SIZE instruction The SIZE instruction finds the number of elements size in the designated dimension of the Source array and places the result in the Size operand e The instruction finds the size of one dimension of an array e The instruction operates on an array array in a structure array that is part of a larger array not affected Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 385 Fault Conditions none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction finds the size of a dimensi
335. for the relay ladder MEO instruction Description 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 you mix integer data types the instruction fills the upper bits of the smaller integer data types with Os so that they are the same size as the largest data type 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 for example 16 0FOF 0f octal for example 8716 2 binary for example 2 00110011 Publication 1756 RMOOSI EN P January 2007 240 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Arithmetic Status Flags not affected Fault Conditions none Execution Condition prescan Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true masked source masked compare rung condition out is set to true rung condition out is set to false Y postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan instruction first run No ac
336. g condition The controller evaluates ladder instructions based on the rung condition preceding the instruction rung condition in Based on the rung condition in and the instruction the controller sets the rung condition following the instruction rung condition oub which in turn affects any subsequent instruction input instruction output instruction eel a een fo PA K uw rung in rung out condition condition If the rung in condition to an input instruction is true the controller evaluates the instruction and sets the rung out condition based on the results of the instruction If the instruction evaluates to true the rung out condition is true if the instruction evaluates to false the rung out condition is false The controller also prescans instructions Prescan is a special scan of all routines in the controller The controller scans all main routines and subroutines during prescan but ignores jumps that could skip the execution of instructions The controller executes all FOR loops and subroutine calls If a subroutine is called more than once it is executed each time it is called The controller uses prescan of relay ladder instructions to reset non retentive I O and internal values During prescan input values are not current and outputs are not written The following conditions generate prescan e Toggle from Program to Run mode e Automatically enter Run mode from a power up condition Prescan does not o
337. gram B EVENT Trigger Event T ask Task Shut Down Shut Down Line Shut Down Line Dine Shot E Tins 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 Publication 1756 RMOOSI EN P January 2007 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 469 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 If nitialize Task 1 1 then The ONS instruction limits the execution of the EVENT instruction to one scan The EVENT instruction triggers an execution of Task 1 event task EVENT Trigger Event T ask Task Task_1 Initialize Task 1 Sterage ONS 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 that is Task 1 GSV Get System Value Class Name TASK Instance Name THIS Attribute Name Status Dest Task Status De If Task Status 0 1 then an EVENT instruction trigg
338. gram to acknowledge the alarm Requires a False to True transition while the alarm is Unacknowledged Ladder Logic Copied from instruction operand Structured Text Copied from instruction operand Default is cleared OperAck BOOL Operator Acknowledge Set by the operator interface to acknowledge the alarm Requires a False to True transition while the alarm is Unacknowledged The alarm instruction clears this parameter Default is cleared ProgReset BOOL Program Reset Set by the user program to reset the alarm Requires a False to True transition while the alarm is InAlarm and the In condition is not in alarm Ladder Logic Copied from instruction operand Structured Text Copied from instruction operand Default is cleared OperReset BOOL Operator Reset Set by the operator interface to reset the alarm Requires a False to True transition while the alarm is InAlarm and the In condition is not in alarm The alarm instruction clears this parameter Default is cleared Progsuppress BOOL Program Suppress Set by the user program to suppress the alarm Default is cleared OperSuppress BOOL Operator Suppress Set by the operator interface to suppress the alarm The alarm instruction clears this parameter Default is cleared ProgUnsuppress BOOL Program Unsuppress Set by the user program to unsuppress the alarm Takes precedence over Suppress commands Default is cleared OperUnsuppress BOOL Operator Unsuppress Set by the operator interface
339. he OSFI instruction sets OutputBit for one scan Structured Text OSFI Ol InputBit limit switchl OSFI OSFI 01 Output state OSFI_01 OutputBit Function Block OSFI 02 OSFI El One Shot Falling with Input 0 0 limit switch1 0 InputBit OutputBit El Ouput_state Publication 1756 RMOOSI EN P January 2007 Chapter Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Introduction Timers and counters control operations based on time or the number of events If You Want To Use This Instruction Available In These Languages See Page time how long a timer is enabled TON relay ladder 96 time how long a timer is disabled TOF relay ladder 100 accumulate time RTO relay ladder 105 time how long a timer is enabled with built in TONR structured text 110 reset in function block function bloc time how long a timer is disabled with built in TOFR structure text 114 reset in function block function bloc accumulate time with built in reset in function RTOR structured text 118 block function bloc count up CTU relay ladder 123 count down CTD relay ladder 127 count up and count down in function block CTUD structured text 131 function block reset a timer or counter RES relay ladder 136 The time base for all timers is 1 msec Publication 1756 RMOOSI EN P January 2007 96 Timer and Counter Instructions TON TOF
340. he description tag ORMask DINT immediate tag Serial Port Control SERIAL PORT CONTROL tag tag that controls the operation Channel Status Decimal DINT immediate 0 AHL Channel ANDMask ORMask SerialPortControl Structured Text During execution displays the status of the control lines For the Status Of This Control Line Examine This Bit CTS 0 RTS 1 DSR DCD 2 3 DTR 4 Received the XOFF character 5 The operands are the same as those for the relay ladder AHL instruction However you 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 Publication 1756 RMOOSI EN P January 2007 584 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT SERIAL PORT CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing EM BOOL The empty bit indicates that 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 POS DI
341. he device that is connected to the serial port of the controller To program the AWT instruction follow these guidelines 1 Configure the serial port of the controller If Your Application Then uses ARD or ARL instructions Select User mode does not use ARD or ARL Select either System or User mode instructions 2 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See 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 Publication 1756 RMOOSI EN P January 2007 602 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Arithmetic Status Flags not affected Fault Conditions none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes when rung condition in na toggles from cleared to set The rung condition out is set to true Enableln is set na Enableln is alw
342. he end of a string CONCAT Operands Relay Ladder CONCAT String Concatenate Source A 22 Source B 22 Dest Operand Type Format Enter Notes Source A string tag tag that contains the initial String data types are characters Source B string tag tag that contains the end da SUNG ala ype characters e any new string data type that you create Destination string tag tag to store the result Structured Text CONCAT SourceA SourceB Baas The operands are the same as those for the relay ladder CONCAT instruction Description The CONCAT instruction combines the characters in Source A with the characters in Source B and places the result in the Destination e The characters from Source A are first followed by the characters from Source B e Unless Source A and the Destination are the same tag Source A remains unchanged Arithmetic Status Flags not affected Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is 1 Check that no instruction is writing to the LEN member of the string tag greater than the DATA size of the string tag 2 In the LEN value enter the number of characters that the string contains Publication 1756 RMOOSI EN P January 2007 ASCII String Instructions CONCAT DELETE FIND INSERT MID 609 Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung
343. he 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 Relay Ladder PID Proportional Integral Derivative PID master JE PID Process variable pv master Process variable Tieback Tieback Control variable Control variable PID Master Loop PID Master Loop Inhold bit Inhold bit Inhold Value Inhold Value Setpoint 50 0 Setpoint Process Variable 0 0 Process Variable Output 0 0 Output PID Proportional Integral peeve i e slave pv slave cv master cv slave master Structured Text PID master pv master 0 cv master 0 0 0 PID slave pv slave 0O cv slave master 0 0 Special Instructions FBC DDT DTR PID 519 Control a Ratio You can maintain two values in a ratio by using these parameters e uncontrolled value e controlled value the resultant setpoint to be used by the PID instruction e ratio between these two values Relay Ladder UL Multiply Source uncontrolled_flow 00 Source B ratio 00 Dest pid 2 sp 0 0 PID Proportional Integral Derivative PID i Process variable Tieback Control variable PID Master Loop Inhold bit Inhold Value Setpoint Process Variable Output Structured Text pid_2 sp uncontrolled_flow ratio PID pid_2 pv_2 tieback_2 cv_2 0 0 0 For This Multiplication Parameter Enter This Value destination controlled value source A uncontrolled value
344. hecksum from the read response did not match the checksum of the data stream unknown error 00D2 The scanner requested either a read or write but the block transfer module responded with unknown error the opposite 00D3 The scanner requested a length and the block transfer module responded with a unknown error different length 00D6 The scanner received a response from the block transfer module indicating the write unknown error request failed OOEA The scanner was not configured to communicate with the rack that would contain this unknown error block transfer module OO0EB The logical slot specified is not available for the given rack size unknown error OOEC There is currently a block transfer request in progress and a response is required before unknown error another request can begin OO0ED The size of the block transfer request is not consistent with valid block transfer unknown error size requests OOEE The type of block transfer request is not consistent with the expected BT READ unknown error or BT WRITE OOEF The scanner was unable to find an available slot in the block transfer table to unknown error accommodate the block transfer request OOFO The scanner received a request to reset the remote 1 0 channels while there were unknown error outstanding block transfers 00F3 Queues for remote block transfers are full unknown error OOF5 No communication channels are configured for the requested rack or slot unknown error OOF6 No communication
345. ication 1756 RMOOSI EN P January 2007 628 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Relay Ladder DTOS DINT to String Source msg num 23 Dest msg num ascii 23 temp high Structured Text IF temp high THEN DTOS msg num msg num ascii temp high 0 END IF Publication 1756 RMOOSI EN P January 2007 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 629 REAL to String RTOS The RTOS instruction produces the ASCII representation of a REAL value Operands Relay Ladder RTOS Real to String Source Dest Operand Type Format Enter Notes Source REAL tag tag that contains the REAL value Destination string tag tag to store the ASCII value String data types are e default STRING data type e any new string data type that you create sich E pane Structured Text The operands are the same as those for the relay ladder RTOS instruction Description The RTOS converts the Source to a string of ASCII characters and places the result in the Destination Arithmetic Status Flags not affected Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is greater than the DATA 1 Check that no instruction is writing to the LEN size of the string tag member of the string tag 2 In the LEN value enter the number of characters that the string contains 4 52 The output string is larger than the destination
346. ication 1756 RMOOSI EN P January 2007 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 537 FBD MATH ADVANCED Structure Arithmetic Status Flags Fault Conditions Condition Execution Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The Source must be greater than or equal to 1 and less than or equal to 1 The resulting value in the Destination is always greater than or equal to 0 or less than or equal to x where n 3 141593 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false prescan rung condition in is false The rung condition out is set to false rung condition in is true The controller calculates the arc cosine of the Source and places the result in the Destination The rung condition out is set to true postscan The rung condition out is set to false Condition Function Block Action No action taken prescan instruction first scan No action taken instruction first run No action taken Publication 17
347. identifies the end of the data that has been loaded into the FIFO Description 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 IMPORTANT You must test and confirm that the instruction doesn t change data that you don t want it to change The FFU instruction operates on contiguous memory In some cases the instruction unloads data from other members of the tag This happens if the length is too big and the tag is a user defined data type Arithmetic Status Flags Fault Conditions not affected A Major Fault Will Occur If Fault Type Fault Code Length FIFO array size 4 20 Publication 1756 RMOOSI EN P January 2007 404 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Execution Condition Relay Ladder Action prescan EU bit is set to prevent a false unload when scan begins LEN lt 0 d v POS lt 0 us V EM is cleared EM is set yes EM is set no uH led DN is set no lt a rung condition out is set to false Publication 1756 RMOOSI EN P Janu
348. if the test value is equal to or outside the low and 0 1 1 eee high limit meet low limit n 1 n n maximum value Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 n 1 n n maximum value not affected none Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 235 Execution Condition prescan Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true evaluate limit comparison is false comparison is true rung condition out is set to true rung condition out is set to false postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared Enableln is set EnableOut is cleared the instruction does nothing and the outputs are not updated The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 236 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Example 1 LIM Limit Test CIRC Low Limit 0 Test value 0 High Limit 100 Publication 1756 RMOOSI EN P January 2007 Low Limit lt High Limit
349. in the buffer Structured Text The operands are the same as those for the relay ladder ACB instruction However you 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 SERIAL PORT CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing EM BOOL The empty bit indicates that 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 that 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 Publication 1756 RMOOSI EN P January 2007 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 579 Description The ACB instruction counts the characters in the buffer To program the ACB instruction follow these guidelines 1 Configure the serial port of the controller for user m
350. ination Relay Ladder S WPB SWPB Swap Byte Swap Byte Swap Byte Source DINT_1 Source DINT_1 Source S ABCD ABCD ABCD Order Mode REVERSE Order Mode WORD Order Mode HIGH LOW Dest DINT_1_reverse Dest DINT_1_swap_word Dest DINT_1_swap_high_low DCBA CDAB BADC Structured Text SWPB DINT 1 REVERSE DINT 1 reverse SWPB DINT 1 WORD DINT 1 swap word SWPB DINT 1 HIGHLOW DINT 1l swap high low Example 2 The following example reverses the bytes in each element of an array For an RSLogix 5000 project that contains this example open the RSLogix 5000 Projects Samples folder Swap Bytes in Array ACD file 1 Initialize the tags The SIZE instruction finds the number of elements in array and stores that value in array lengtb A subsequent instruction uses this value to determine when the routine has acted on all the elements in the array 2 Reverse the bytes in one element of array The SWPB instruction reverses the bytes of the element number that is indicated by the value of index For example when index equals 0 the SWPB instruction acts on array O The ADD instruction increments index The next time the instruction executes the SWPB instruction acts on the next element in array 3 Determine when the SWPB instruction has acted on all the elements in the array If index is less then the number of elements in the array array lengtb then continue with th
351. ination Node Station address of the target device in octal If there is only one DH link and you did not use the RSLinx 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 message routed over an EtherNet IP or ControINet network through RSLinx This lets the application receive data from a Source Link Remote ID of the topic in RSLinx software Destination Link Virtual Link ID set up in RSLinx 0 65535 Destination Node Destination ID 0 77 octal provided by the application to RSLinx For a DDE topic in RSLinx use 77 troller f 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 1756 DHRIO module that universal remote I O network is connected to the RIO network Rack Rack number octal of the module Group Group number of the module Slot Slot number that the module is in block transfer module over a Control Net Slot Slot number that the module is in ControlNet network Publication 1756 RMOOSI EN P January 2007 170 Input Output Instructions MSG GSV SSV IOT Choose a cache option Depending on how you configure a MSG instruction it may use a connection to send or receive data This Type Of Message And This Communicatio
352. ine and returns to the instruction that follows the calling FOR instruction BRK a Publication 1756 RMOOSI EN P January 2007 416 For Break Instructions FOR FOR DO BRK EXIT RET Return RET Operands RET Return Return par Description Arithmetic Status Flags Fault Conditions Execution Condition prescan rung condition in is false The RET instruction returns to the calling FOR instruction Relay Ladder none IMPORTANT Do not place a RET instruction in the main routine If you place a RET instruction in the main routine a major fault occurs type 4 code 31 When enabled the RET instruction returns to the FOR instruction The FOR instruction increments the Index value by the Step size and executes the subroutine again If the Index value exceeds the Terminal value the FOR instruction completes and execution moves on to the instruction that follows the FOR instruction The FOR instruction does not use parameters The FOR instruction ignores any parameters you enter in a RET instruction You could also use a TND instruction to end execution of a subroutine not affected A Major Fault Will Occur If Fault Type Fault Code main routine contains a RET instruction 4 31 Relay Ladder Action The rung condition out is set to false The rung condition out is set to false rung condition in is true Returns the specified parameters to the calling routine The rung condi
353. ing Publication 1756 RMOOSI EN P January 2007 The fag retains the assigned value until another assignment changes the value The expression can be simple such as an immediate value or another tag name or the expression can be complex and include several operators and or functions See the next section Expressions on page 663 for details Specify a non retentive assignment The non retentive assignment is different from the regular assignment described above in that the tag in a non retentive assignment is reset to zero each time the controller e enters the RUN mode e leaves the step of an SFC if you configure the SFC for Automatic reset This applies only if you embed the assignment in the action of the step or use the action to call a structured text routine via a JSR instruction A non retentive assignment has this syntax tag expression where Component Description tag represents the tag that is getting the new value the tag must be a BOOL SINT INT DINT or REAL is the non retentive assignment symbol expression represents the new value to assign to the tag lf tag is this data type Use this type of expression BOOL BOOL expression SINT numeric expression INT DINT REAL ends the assignment Structured Text Programming 663 Assign an ASCII character to a string Use the assignment operator to assign an ASCII character to an element of the DATA member of a string tag To assign a cha
354. ins set output bit is cleared Y postscan The storage bit is cleared The output bit is not modified The rung condition out is set to false Example Each time imit_switch_1 goes from cleared to set the OSR instruction sets output bit 1 and the ADD instruction increments sum by 5 As long as limit switcb 1 stays set sum stays the same value The limit switch 1 must go from cleared to set again for sum to be incremented again You can use output bit 1 on multiple rungs to trigger other operations Publication 1756 RMOOSI EN P January 2007 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 85 OSR One Shot Rising Storage Bit storage bit 1 Dutput Bit output bit 1 irit switch 1 output bit 1 Add Source B Dest Publication 1756 RMOOSI EN P January 2007 86 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI One Shot Falling OSF The OSF instruction sets or clears the output bit depending on the status of the storage bit This instruction is available in structured text and function block as OSFI see page 3 92 Operands Relay Ladder Operands OSF Operand Type Format Description se i T storage bit BOOL tag internal storage bit Output Bit EM stores the rung condition in from the last time the instruction was executed output bit BOOL tag bit to be set Description When disabled and the storage bit is set the OSF instr
355. inst Source B Source B INT tag DINT REAL string Source B SINT immediate value to test against Source A INT tag DINT REAL string e If you enter a SINT or INT tag the value converts to a DINT value by sign extension e String data types are default STRING data type any new string data type that you create e To test the characters of a string enter a string tag for both Source A and Source B E Structured Text IF sourceA sourceB THEN Use the less than and greater than signs lt gt together as an operator statements within an expression This expression evaluates whether sourceA is not equal to sourceB See Appendix for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 244 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ NEQ 01 NEQ Not Equal SourceA Cj SourceB Function Block Operand NEQ tag Type Format FBD COMPARE Description structure NEO structure FBD COMPARE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to test against SourceB Valid any float SourceB REAL Value to test against SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the i
356. ion The rung condition out is set to false Recovery Method Either e Change the Control Line setting of the serial port e Delete the AHL instruction Structured Text Action No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes when rung condition in toggles from cleared to set The rung condition out is set to true na Enableln is set na Enableln is always set The instruction executes instruction execution postscan The instruction obtains the control line status and turns on or off DTR and RTS signals The EN bit is set The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 586 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Example get control line status z E ls When get control line status becomes set obtain the status of the control lines of the serial port and store the status in the Channel Status operand To view the status of a specific control line monitor the SerialPortControl tag and expand the POS member Publication 1756 RMOOSI EN P January 2007 Relay Ladder AHL ASCII Handshake Lines CEN Channel 0 AND Mask 0 DN OR Mask 0 L ER SerialPort Control se
357. ion Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false 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 The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 289 Example Copy data from value a to value b while allowing data to be masked a 0 masks the data in value a The shaded boxes show the bits that changed in value D Relay Ladder MVM Masked Move Source value a 2 0101_0101_0101_0101_0101_0101_0101_0101 Mask mask_2 281111 0000 1111 O000 1111 0000 1111 0000 Dest value b 281111 1111 1111 1111 1111 1111 1111 1111 Structured Text value b value b AND NOT mask 2 OR value a AND mask 2 Publication 1756 RMOOSI EN P January 2007 290 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Masked Move with Target MVMT Operands MVMT MVMT tag MVMT 01 MVMT Ej Mowe With Mask with Target Source Dest Input
358. ion Block BNOT 01 BNOT El Boolean Not EN 0 0 bool in1 p In Out H c value_result_not If bool in1 is cleared light1 is cleared off Otherwise light is set on Structured Text IF NOT bool_inl THEN light1l 0 ELSE lightl 1 END IF Publication 1756 RMOOSI EN P January 2007 330 4 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Notes Publication 1756 RMOOSI EN P January 2007 Chapter 9 Introduction If You Want To perform arithmetic logic shift and function operations on values in arrays Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE The file miscellaneous instructions operate on arrays of data Use This Instruction Available In These Languages See Page FAL relay ladder 337 structured text search for and compare values in arrays FSC relay ladder 349 copy the contents of one array into another array COP relay ladder 358 structured text copy the contents of one array into another array without interruption CPS relay ladder 358 structured text fill an array with specific data calculate the average of an array of values FLL relay ladder 364 structured text AVE relay ladder 368 structured text sort one dimension of array data into ascending order SRT relay ladder 373 structured text calculate the st
359. iption Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set In1 BOOL First boolean input Default is set In2 BOOL Second boolean input Default is set In3 BOOL Third boolean input Default is set In4 BOOL Fourth boolean input Default is set Ind BOOL Fifth boolean input default is set In6 BOOL Sixth boolean input Default is set Publication 1756 RMOOSI EN P January 2007 320 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Input Parameter Data Type Description In7 BOOL Seventh boolean input Default is set In8 BOOL Eighth boolean input Default is set Output Parameter Data Type Description Enable output Out BOOL EnableOut BOOL Description Arithmetic Status Flags Fault Conditions Execution Condition prescan The output of the instruction The BAND instruction ANDs as many as 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 not affected none Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756
360. irectory the order of the strings determines which one is greater ASCII Characters Hex Codes 1ab 31 61 62 LA a Tb 31862 e r A 41 S e S a AB 41 42 AB B e t al B 42 4 r a 61 a gt B Y ab 61 62 Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 222 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Execution Relay Ladder Condition Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true rung condition out is set to true Source A gt Source B rung condition out is set to false Y postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 223 Example If va ue 1 is greater than value_2 set light_1 If value 1 is less than or equal to value 2 clear light_1 Relay Ladder light 1 HT Greater Than A5 B Source value 1 p e
361. irst run No action taken Enableln is cleared Enableln is set EnableOut is cleared The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 542 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Example Calculate the arc tangent of value and place the result in result Relay Ladder ATN Are Tangent Source value 0 86000001 Dest result 0 71027106 Structured Text result ATAN value Function Block value result Publication 1756 RMOOSI EN P January 2007 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 543 Notes Publication 1756 RMOOSI EN P January 2007 544 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Publication 1756 RMOOSI EN P January 2007 Chapter 16 Advanced Math Instructions LN LOG XPY Introduction The advanced math instructions include these instructions If You Want To Use This Instruction Available In These Languages See Page Take the natural log of a value LN relay ladder 546 structured text function block Take the log base 10 of a value LOG relay ladder 549 structured text function block Raise a value to the power of another value XPY relay ladder 552 structured text function block f There is no equivalent structured text instruction Use the operator in an expression You can mix data
362. is cleared The ER bit is cleared The POS value is cleared The rung condition out is set to false rung condition in is false The EN bit is cleared The DN bit is cleared The ER bit is cleared The POS value is cleared The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 390 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Condition rung condition in is true Relay Ladder Action examine EN bit EN bit 1 p bit 0 EN bit is id LEN 0 yes Y LEN 0 yes no Y Bp DN bitis set examine source bit ER bit is set shift array lef one position left UL bit source q array Hii DN bit is set source bit 0 Y source bit 1 UL bit is set lere UL bit remains set lt r a Y rung condition out is set to true postscan Publication 1756 RMOOSI EN P January 2007 The rung condition out is set to false Array File Shift Instructions BSL BSR FFL FFU LFL LFU Example 1 391 When enabled the BSL instruction starts at bit 0 in array dint Of The instruction unloads array dint 0 9 into the UL bit shifts the remaining bits and loads input 1 into array dintl0 O The values in the remaining bits 10 31 are invalid B
363. is set to false Publication 1756 RMOOSI EN P January 2007 432 Sequencer Instructions SQI SQO SQL Condition Relay Ladder Action rung condition in is true EN bit is set EN 0 examine EN bit 9 ER bit is cleared EN 1 POS LEN POS 1 yes no DN bit is set POS POS 1 POS value rolls over goto error DN bit is set POS gt LEN error Y __ ER bit is set ad Array control POS Source Y rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Sequencer Instructions SQI SQ0 SQL 433 Example When enabled the SQL instruction loads value 3 into the next position in the sequencer array which is array dini 5 in this example SaL Sequencer Load N Array array dint D Source value 3 DN Control control 1 Length 10 Position 5 before load after load array dint O 00000 00000 11111 11111 22222 22222 33333 control 1 pos 5 33333 44444 value 3 55555 44444 array dint 5 00000 p 55555 00000 00000 control 1 pos 6 00000 00000 00000 00000 00000 00000 Publication 1756 RMOOSI EN P January 2007 434 Sequencer Instructions SQI SQO SQL Notes Publication 1756 RMOOSI EN P
364. is set to true The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 524 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Condition prescan Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Example Publication 1756 RMOOSI EN P January 2007 No action taken Calculate the sine of value and place the result in result Relay Ladder Sine Source value 0 78539819 Dest result 0 70710677 Structured Text result SIN value Function Block Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 525 Cosine COS The COS instruction takes the cosine of the Source value in radians and stores the result in the Destination Operands Relay Ladder cos ih Operand Type Format Description De 4 Source SINT immediate find the cosine of this value INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest COS source Use COS as a function This function computes the cosine of source and stores the result in dest See for information on the syntax of expressions within structured text Function Block COS 01 cos eee is Operand Type F
365. it alarm OSRI osri 1 IF osri l OutputBit THEN alarm write LEN alarm msg LEN AWA 0 alarm msg alarm write END IF Publication 1756 RMOOSI EN P January 2007 600 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT ASCII Write AWT The AWT instruction sends a specified number of characters of the Source tag to a serial device Operands Relay Ladder AWT ASCII Write ND Channel Source ND SerialPort Control R SerialPort Control Length Characters Sent Operand Type Format Enter Notes Channel DINT immediate 0 tag Source string tag tag that contains the e f you want to compare convert or characters to send manipulate the characters use a string data SINT type e For a string data type e String data types are INT enter the name of the tag e default STRING data type DINT e For a SINT INT gr DINT e any new string data type that you create array enter the first element of the array Serial Port SERIAL_PORT_ tag tag that controls the operation Control CONTROL Serial Port DINT immediate number of characters to e The Serial Port Control Length must be less Control Length send than or equal to the size of the Source e f 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 AWT Channel Source SerialPortCo
366. it BOOL Output bit Publication 1756 RMOOSI EN P January 2007 90 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Description When InputBit is set and InputBit is cleared the OSRI instruction sets OutputBit When InputBit is set or when InputBit is cleared the OSRI instruction clears OutputBit eee InputBit eee InputBit OutputBit eee instruction is instruction resets during executed Arithmetic Status Flags not affected Condition Fault Conditions none Execution Function Block Action next scan execution 40048 Structured Text Action prescan No action taken No action taken instruction first scan instruction first run InputBit 1 is set InputBit 4 is set InputBit 1 is set InputBit 4 is set Enableln is cleared EnableOut is cleared the instruction does nothing and the outputs are not updated na Enableln is set On a cleared to set transition of InputBit the instruction sets InputBit y The instruction executes EnableOut is set On a cleared to set transition of InputBit the instruction sets InputBit y Enableln is always set The instruction executes postscan No action taken No action taken Publication 1756 RMOOSI EN P January 2007 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 91 Example When imit_switch1 goes from cl
367. ith alarm limits to detect the alarm conditions ProgAckAll BOOL Tag Value is copied to ProgAckAIl Immediate when instruction executes On transition from False to True acknowledges all alarm conditions that require acknowledgement ProgDisable BOOL Tag Value is copied to Immediate ProgDisable when instruction executes When True disables alarm does not override Enable Commands ProgEnable BOOL Tag Value is copied to ProgEnable Immediate when instruction executes When True enables alarm takes precedence over Disable commands ALMA 01 7 Function Block Operands Operand Type Format Description ALMA tag ALARM_ANALOG structure ALMA structure Publication 1756 RMOOSI EN P January 2007 50 Analog Alarm Instruction ALMA Structure Definition For ALARM_ANALOG Tag Input Parameter Enableln InFault Data Type BOOL REAL BOOL The tag structure ALARM_ANALOG which corresponds to the ALMA tag is common to all languages except where noted Input Parameters Description System defined input Ladder Logic Corresponds to the rung state If cleared the instruction does not execute and outputs are not updated Structured Text Does not affect processing Function Block Enable input If cleared the instruction does not execute and outputs are not updated Default is set The alarm input value which is compared with alarm limits to detect the al
368. itions Execution Condition prescan If the Bit Inthe The Bit In the Source Is Destination Is 0 1 1 0 If you mix integer data types the instruction fills the upper bits of the smaller integer data types with Os so that they are the same size as the largest data type Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The instruction performs a bitwise NOT operation The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 317 Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Example When enabled the NOT instruction performs a bitwise NOT operation on Source and places the result in Dest value 1101 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 11 11 1 1 1 1 value result not ce ce ce ce ce ce c
369. itions are either inactive or acknowledged or both Indicates a high high alarm condition Set In alarm Cleared Normal HinAlarm BOOL Indicates a high alarm condition Set In alarm Cleared Normal LInAlarm BOOL Indicates a low alarm condition Set In alarm Cleared Normal LLInAlarm BOOL Indicates a low low alarm condition Set In alarm Cleared Normal ROCPoslInAlarm BOOL Indicates whether a positive rate of change alarm condition is detected Set In alarm Cleared Normal ROCNeglnAlarm BOOL Indicates whether a negative rate of change alarm condition is detected Set In alarm Cleared Normal Publication 1756 RMOOSI EN P January 2007 56 Analog Alarm Instruction ALMA Output Parameter ROC Data Type REAL Description Indicates the calculated rate of change of the In value HHAcked BOOL Indicates whether the high high alarm condition is acknowledged Set Acknowledged Cleared Not acknowledged Always Set when AckRequired is false HAcked BOOL Indicates whether the high alarm condition is acknowledged Set Acknowledged Cleared Not acknowledged Always Set when AckRequired is false LAcked LLAcked BOOL BOOL Indicates whether the low alarm condition is acknowledged Set Acknowledged Cleared Not acknowledged Always Set when AckRequired is false
370. ject Type a2 Object ID 1 Object Attribute leave blank Source leave blank Number of Elements 0 Destination leave blank Communication Path communication path to self 1 5 where s slot number of controller Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 185 Access the FAULTLOG object The FAULTLOG object provides fault information about the controller Attribute Data Type Instruction Description MajorEvents INT GSV How many major faults have occurred since the last time this counter was reset SSV MinorEvents INT GSV How many minor faults have occurred since the last time this counter was reset SSV MajorFaultBits DINT GSV Individual bits indicate the reason for the current major fault SSV Bit Meaning 1 power loss 3 1 0 4 instruction execution program 5 fault handler 6 watchdog 7 stack 8 mode change 11 motion MinorFaultBits DINT GSV Individual bits indicate the reason for the current minor fault SSV Bit Meaning 4 instruction execution program 6 watchdog 9 serial port 10 battery Publication 1756 RMOOSI EN P January 2007 186 Input Output Instructions MSG GSV SSV IOT Access The MESSAGE Object You can 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
371. k Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Example Multiply zoat value 1 by float value 2 and place the result in multiply result Relay Ladder MUL Multiply Source float value 1 0 0 Source B float value 2 00 Dest multiply result 00 Structured Text multiply result float value 1 float value 2 Function Block MUL 04 MUL El Multiply 0 0 float value 1 J SourceA SourceB float_value2 Jj multiphy result Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 263 Divide DIV The DIV instruction divides Source A by Source B and places the result in the Destination Operands di Relay Ladder Divide Source A Operand Type Format Description Source B Source A SINT immediate value of the dividend Dest INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Source B SINT immediate value of the divisor INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest sourceA sourceB Use the divide sign as an operator in
372. k RES 136 relay ladder Reset RET 438 and 476 relay ladder Return structured text function block RTO Retentive Timer On relay ladder Publication 1756 RMOOSI EN P January 2007 Instruction Location Languages RTOR 118 structured text Retentive Timer On with function block Reset RTOS 629 relay ladder REAL to String structured text SBR 438 relay ladder Subroutine structured text function block SFP 462 relay ladder SFC Pause structured text SFR 464 relay ladder SFC Reset structured text SIN 522 relay ladder Sine structured text function block SIZE 384 relay ladder Size In Elements structured text sol 422 relay ladder Sequencer Input SQL 430 relay ladder Sequencer Load SQO0 426 relay ladder Sequencer Output SOR 272 relay ladder Square Root function block SORT 272 structured text Square Root SRT 373 relay ladder File Sort structured text Instruction Locator 29 Instruction Location Languages XOR 311 relay ladder Bitwise Exclusive OR structured text function block XPY 552 relay ladder X to the Power of Y structured text function block Instruction Location Languages SSV 173 relay ladder Set System Value structured text STD 378 relay ladder File Standard Deviation STOD 622 relay ladder String To DINT structured text
373. k output modile 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 nput moudule 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 digital Message Type CIP Generic opt Madig Service Type Reset Latched Diagnostics 0 Source tag_name of type DINT Publication 1756 RMOOSI EN P January 2007 This tag represents a bit mask of the points to reset diagnostics on If You Want To Unlatch the alarm of an analog input module In This Property Message Type Input Output Instructions MSG GSV SSV IOT 159 Type Or Select CIP Generic Service Type Select which alarm that you want to unlatch e Unlatch All Alarms I e Unlatch Analog High Alarm I e Unlatch Analog High High Alarm I e Unlatch Analog Low Alarm I e Unlatch Analog Low Low Alarm I e Unlatch Rate Alarm I Instance Channel of the alarm that you want to unlatch Unlatch the alarm of an analog output module Select This Command Message Type CIP Generic Service Type Select which alarm that you want to unlatch e Unlatch All Alarms 0 e Unlatch High Alarm 0 e Unlatch Low Alarm 0 e Unlatch Ramp Alarm 0 Instance Channel of the alarm that you want to unlatch Specify PLC 5 messages
374. ken Example When temp_high is set the INSERT instruction adds the characters in string 2to position 2 within string 7 and places the result in string 3 Relay Ladder temp high INSERT Insert String Source A string 1 AD Source B string 2 BC 2 Start Dest string 3 ABCD Publication 1756 RMOOSI EN P January 2007 616 ASCII String Instructions CONCAT DELETE FIND INSERT MID Structured Text IF temp_high THEN INSERT string 1l string 2 2 string 3 temp high 0 END IF Middle String MID The MID instruction copies a specified number of ASCII characters from a string and stores them in another string Operands Relay Ladder MID Middle String Source Qty Start Dest Operand Type Format Enter Notes Source string tag string to copy characters String data types are from e default STRING data type e any new string data type that you create Quantity SINT immediate number of characters to The Start plus the Quantity must be less than or CODy equal to the DATA size of the Source INT tag DINT Start SINT immediate position of the first Enter a number between 1 and the DATA size of character to copy the Source INT tag DINT Destination string tag string to copy the characters to Structured Text MID Source Oty Start Aes The operands are the same as those for the relay ladder MID instruction Publication 1756 RMOOSI EN P January 2007 ASCII String Instructions
375. l Expression MySearchKey reference control 1 pos MySearchKey reference control_3 pos 00000000000000000000000000000000 0 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 The FSC instruction finds that this array 11111111111111110000000000000000 11111111111111110000000000000000 pr element equals MySearchKey The instruction sets the FD and IN bits The POS 4 value indicates the position of the equal element To continue comparing the rest of the array clear the IN bit 11111111111111111111111111111111 11111111111111111111111111111111 1 11111111111111111111111111111111 11111111111111111111111111111111 11111111111111111111111111111111 cO o N oon A CO N Publication 1756 RMOOSI EN P January 2007 354 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 3 Search for a string in an array of strings When enabled the FSC instruction compares the characters in code to 10 elements in code table FSC File Search Compare Control code_table_search ND Length 10 Ro Position De Mode ALL Expression code code_table code_table_search POS code code_table code_table_search POS AFG 0 BEH 1 HUO 2 SON The FSC instruction finds that this array SAM SAM 4 we element equals code The instruction se
376. l 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 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 K 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 will maintain its last value You can disable back calculation of the BIAS term by setting the NOBC bit in the PID data structure Be aware that if you set NOBC true the PID instruction no longer provides a bumpless transfer from manual to auto when integral control is not used 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 milliseconds Only rare cases such as tension control Publication 1756 RMOOSI EN P January 2007 512 Special Inst
377. laces the result in the Destination The rung condition out is set to true postscan Condition prescan The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOO3I EN P January 2007 No action taken Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 561 Example Convert value to radians and place the result in result Relay Ladder AD Degrees To Radians Source value 450 est result 0 78539819 Structured Text result RAD value Function Block RAD 01 RAD m Degrees To Radians result Publication 1756 RMOOSI EN P January 2007 562 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Convert to BCD TOD The TOD instruction converts a decimal value 0 lt Source lt 99 999 999 to a BCD value and stores the result in the Destination Operands Relay Ladder TOD To BED Operand Type Format Description source f Source SINT immediate value to convert to decimal INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Destination SINT tag stores the result INT DINT TOD 04 Function Block TOD E FUE Operand Type Format Description To BCD TOD tag FBD CO
378. le PID instruction Tieback Control Variable PID Master Loop Inhold Bit Inhold Value Setpoint Process Variable Output Publication 1756 RMOOSI EN P January 2007 506 Special Instructions FBC DDT DTR PID In This Field Setpoint SP Specify tuning Select the Tuning tab Changes take affect as soon as you click on another field click OK click Apply or press Enter Specify Enter a setpoint value SP Set output 96 Enter a set output percentage S0 In software manual mode this value is used for the output In auto mode this value displays the output 96 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 K 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 Derivative time Kj Enter the derivative gain KD For independent gains it s the derivative gain seconds For dependent gains it s the rate time minutes Manual mode Publication 1756 RMOOSI EN P January 2007 Select either manual MO or software manual SWM Manual mode overrides software manual mode if both are selected Special Instructions FBC DDT DTR PID 507 Specify configuration
379. le 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 1msec 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 Output Parameter Data Type Request to reset the timer When set the timer resets Default is cleared 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 Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 111 Input Parameter Data Type Description DN BOOL Timing done output Indicates when the accumulated time is greater than or equal to the preset value 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 TONR instruction accumulates time until the enable bit EN timer timing bit TT timer done bit DN e TO
380. lias tag for the source tag in originating Logix5000 controller You cannot use an alias for the destination tag The destination must be a base tag Logix5000 PLC 5 Logix5000 SLC Logix5000 PLC 2 source tag array_1 0 destination element N7 70 You can use an alias tag for the source tag in originating Logix5000 controller source tag array_1 0 destination element 070 For MSG instructions originating from a Logix5000 controller and reading from another controller Message Path Logix5000 Logix5000 Logix5000 PLC 5 Logix5000 SLC Example Source and Destination 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 originating Logix5000 controller Logix5000 PLC 2 Publication 1756 RMOOSI EN P January 2007 source element N7 10 destination tag array_1 0 You can use an alias tag for the destination tag in originating Logix5000 controller source element 010 destination tag array_1 0 Input Output Instructions MSG GSV SSV IOT 165 Specify the To configure a MSG instruction you specify these details on the Communication Details Message Configuration My Message Configuration Communication Tag Path Browse Communication tab Communication Method CEE DH Channel z an PIE WIR Source Link fi Destir
381. lication 1756 RMOOSI EN P January 2007 202 Input Output Instructions MSG GSV SSV IOT Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction e updates the connection of the specified tag e resets the RPI timer of the connection postscan The rung condition out is set to false No action taken Example 1 When the IOT instruction executes it immediately sends the values of the Local 5 0 tag to the output module Relay Ladder Structured Text IOT Local 5 0 Publication 1756 RMOOSI EN P January 2007 IOT Immediate Dutput Update Tag Local 5 0 Input Output Instructions MSG GSV SSV IOT 203 Example 2 This controller controls station 24 and produces data for the next station station 25 To use an IOT instruction to signal the transmission of new data the produced tag is configured as follows fc Tag Properties Produced Tag General Connection Maximum Consumers E Produced Tag is configured to update its event trigger via an IOT instruction 8 Programmatically IOT Instruction Send E vent Trigger
382. lt 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 InFaulted BOOL User program has set InFault to indicate bad quality input data SeverityInv BOOL Indicates invalid alarm severity configuration If severity 1 the instruction uses Severity 1 If severity gt 1000 the instruction uses Severity 1000 Publication 1756 RMOOSI EN P January 2007 40 Digital Alarm Instruction ALMD Example Publication 1756 RMOOSI EN P January 2007 This illustration shows the manner in which a digital alarm executes in a typical system configuration Alarm execution is shown below In this example two motor failure signals are combined such that if either one occurs a motor fault alarm is activated A programmatic acknowledge is sometimes used to acknowledge the alarm Ladder Logic Motor010vertemp ALD 0 Digital Alarm ALMD Motor101Fautt CIn amp larm Motor101FailToSlart ProgAck Motor101 Ack Qe x Acked em ProgReset 0 H Suppressed ProgDisable 0 HODisabled ProgEnable 0 HnstructFault MinDurationPRE Oe MinDuration amp CC Oe Structured Text Motor101FaultConditions Motor101Overtemp AND Motor101FailToStart ALMD Motor101Fault Motor101FaultConditions Motor101Ack 0 0 0 Digital Alarm Instruction ALMD y Function Block BOR 01 Motor1O 1F a ult BOR
383. m 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 Relay Ladder reconfiqure 5 reconfigure 5 MOV E T 0NS Move Source 60 Dest Local 4 C ChOConfig HAlarmLimit 750 change Halarm EN MSG Type Module Reconfigure Message Control change_Halarm E ND 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 reconfigure 6 reconfigure 5 Publication 1756 RMOOSI EN P January 2007 158 Input Output Instructions MSG GSV SSV IOT Specify CIP Generic messages A CIP Generic message performs a specific action on an I O module If You Want To In This Property Type Or Select Perform a pulse test on a digital output Message Type CIP Generic module Service Type Pulse Test Source tag_name of type INT 5 This array contains 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 usecs usually 20 tag name 3 zero cross delay for ControlLogix 1 0 hundreds of psecs usually 40 tag_name 4 verify delay Destination leave blan
384. ments to sort DINT do not use CONTROL POS in the subscript REAL Dimension DINT immediate which dimension to use to vary 0 1 2 depending on the number of dimensions the order is array dim O dim 1 dim 2 array dim_0 dim_1 array dim 0 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 Structured Text Control The operands are the same as those for the relay ladder SRT instruction However you specify the Length and Position values by accessing the LEN and POS members of the CONTROL structure rather than by including values in the operand list CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the SRT instruction is enabled DN BOOL The done bit is set when the specified elements have been sorted ER BOOL The error bit is set when either LEN 0 or POS lt 0 Either of these conditions also generates a major fault LEN DINT The length specifies the number of elements in the array on which the instruction POS DINT The position contains the position of the current element that the instruction is accessing Publication 1756 RMOOSI EN P January 2007 374 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Description The SRT instruction sorts a set of values in one dimension Dim to vary of
385. mine EN bit internal bit bit 0 POS POS 1 EN bit is set yes no loop count LEN POS page 9 340 Publication 1756 RMOOSI EN P January 2007 yes no POS POS 1 84 DN bit is set p Y rung condition out is set to true Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 343 Condition Relay Ladder Action numeric mode Y EN bit 1 examine EN bit EN bit 0 POS POS 1 bit 1 examine internal bit ay 0 internal bit is set yes yes no no o POS POS 1 mode LEN 4 P yes Y DN bit is set rung condition out is set to EN bit is set m true loop count LEN POS Y mode gt loop count page 9 340 EN bit is set postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 344 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE File Arith Logical Control Example 1 When enabled the FAL instruction copies each element of array_2 into the same position within array 1 array to array copy FAL control_2 Lenath 10 N Position of Mode ALL R Dest array l control 2 pos 00 p eck Expression array_2 control_2 pos Expression Destination
386. minimum PID Initialized Using PID Instructions Publication 1756 RMOOSI EN P January 2007 Enter a minimum tieback value MINTIE that equals the minimum unscaled value received from the analog input channel for the tieback value If you change scaling constants during Run mode turn this off to reinitialize internal descaling values INI PID closed loop control holds a process variable at a desired set point The following figure shows a flow rate fluid level example setpoint error p PID equation flow rate process variable control variable level detector 14271 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 Gains Option Dependent gains ISA standard Special Instructions FBC DDT DTR PID 509 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 only affect their specific proportional integral or derivative terms respectively When using dependent gains the proportional gain is replaced with a controller gain which affects all three terms You can use either form of equation to perform the same type o
387. mode master only Value Meaning 0 message based but don t allow slaves to initiate messages 1 message based but allow slaves to initiate messages default 2 standard single message transfer per node scan 3 standard multiple message transfer per node scan Default setting is 1 The time acting as a master to wait after receiving an ACK before polling the slave for a response master only Valid value 0 65 535 Delay in counts of 20 msec periods The default is 5 periods 100 msec StationAddress INT GSV Current station address of the serial port Valid value 0 254 Default is 0 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 32 767 Delay in counts of 20 msec periods The default is 3000 periods 1 minute TransmitRetries SINT GSV Number of times to resend a message without getting an acknowledgment master and slave only Valid value 0 127 Default is 3 PendingACKTimeout DINT SSV Pending value for the ACKTimeout attribute Publication 1756 RMOOSI EN P January 2007 184 Input Output Instructions MSG GSV SSV IOT Attribute Data Type Instruction Description PendingDuplicateDetection SINT SSV Pending value for the DuplicateDetection attribute PendingEmbeddedResponse
388. n In the Serial Port Control Length enter the number of characters to send No Arithmetic Status Flags not affected Fault Conditions none Execution Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true toggles from cleared to set The rung condition out is set to true Before the instruction executes set the LEN member of the Source tag to the LEN member of the Serial Port Control tag Structured Text Action No action taken na The instruction executes when rung condition in na Enableln is set na Enableln is always set The instruction executes instruction execution predefined characters The EN bit is set The instruction sends a specified number of characters and appends either one or two The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 598 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Example 1 temp high Publication 1756 RMOOSI EN P January 2007 When the temperature exceeds the high limit G emp_high is set the AWA instruction sends a message to a MessageView terminal that is connected to the serial port of the controller The message contains five characters from the
389. n 1756 RMOOSI EN P January 2007 208 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true expression is true rung condition out is set evaluate expression to true expression is false rung condition out is set to false gt Y postscan The rung condition out is set to false Examples If the CMP instruction finds the expression true the rung condition out is set to true MP Compare Expression value 1 value 2 CM Compare Expression value 1 value 2 value 3 value 4 CM Compare Expression value 1 If you enter an expression without a comparison operator such as value 1 value 2 or value 1 the instruction evaluates the expression 4s If The Expression The Rung condition out Is Set To non zero true zero false Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 209 CMP expressions You program expressions in CMP instructions the same as expressions in FSC instructions Use the following sections for information on valid operators format and order of operation which are common to both instructions Valid operators
390. n Method Uses A Connection CIP data table read or write 3 PLC2 PLC3 PLC5 or SLC all types CIP CIP with Source ID DH 3 CIP generic T C your option 1 block transfer read or write 3 1 You can connect CIP generic messages 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 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 The connection closes after the MSG instruction is done This connection 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 Software Then You Can Cache And Firmware Revision 11 x or earlier e block transfer messages for up to 16 connections e other types of messages for up to 16 connections 12 x or later up to 32 connections Publication 1756 RMOOSI EN P January 2007 IF THE MSG Instructions Are To different devices Input Output Instructions MSG GSV SSV IOT 171 If several messages go to the same device the messages may be able to share a connection same device And They Are Then we Each MSG instruction uses
391. n a baggage handling conveyor of an airport each bag gets a bar code Characters 9 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 set the MID instruction copies the flight number and destination airport to the bag It and dest string Publication 1756 RMOOSI EN P January 2007 618 ASCII String Instructions CONCAT DELETE FIND INSERT MID Relay Ladder bag read EM MID Middle String Source bag barcode NWA HOP 5058 AMS 01 Qty 9 Start 9 Dest bag flt and dest 5058 AMS Structured Text IF bag read EM THEN MID bar barcode 9 9 bag flt and dest bag read EM 0 END IF Publication 1756 RMOOSI EN P January 2007 Chapter 20 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Introduction Use the ASCII conversion instructions to alter the format of data If You Want To For Example Use This Available InThese See Page Instruction Languages convert the ASCII representation of convert a value from a weight scale STOD relay ladder 622 an integer value to a SINT INT DINT orother ASCII device to an integer so or REAL value you can use it in your logic structured text convert the ASCII representation of a convert a value from a weight scale STOR relay ladder 624 floating point value to a REAL value or other ASCII device to a REAL value so you can use it in your logic s
392. n both imit switcb1 and interlock 1 are set set state After timer 1 completes EOT returns the value of state to the calling routine Relay Ladder limit switchl interlock_1 state JE JE C2 timer 1 DN state Structured Text state limit switchl1 AND interlock 1 IF timer 1 DN THEN EOT state END IF Publication 1756 RMOOSI EN P January 2007 462 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT SFC Pause SFP The SFP instruction pauses an SFC routine Operands Relay Ladder SFC Pause ar Operand Type Format Description usur oh EM ROUTINE name SFC routine to pause TargetState DINT immediate select one tag executing or enter 0 paused or enter 1 Structured Text SFP SFCRoutineName TargetState The operands are the same as those for the relay ladder SFP instruction Description The SFP instruction lets you pause an executing SFC routine If an SFC routine is in the paused state use the SFP instruction again to change the state and resume execution of the routine Also use the SFP instruction to resume SFC execution after using an SFR instruction see page 17 464 to reset an SFC routine Arithmetic Status Flags not affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code the routine type is not an SFC routine 4 85 Publication 1756 RMOOSI EN P January 2007
393. n counts the characters in the buffer up to and including the first termination character Relay Ladder Operand Type Format Description Channel DINT immediate 0 tag Serial Port SERIAL PORT tag tag that controls the operation Control CONTROL Character DINT immediate 0 Count During execution displays the number of characters in the buffer including the first set of termination characters Structured Text The operands are the same as those for the relay ladder ABL instruction You access the Character Count value via the POS member of the SERIAL PORT CONTROL structure Publication 1756 RMOOSI EN P January 2007 576 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT SERIAL PORT CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing EM BOOL The empty bit indicates that 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 that the instruction found the termination character or characters POS DINT The position determines the number of characters i
394. n 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 not affected none Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 457 Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The UID instruction prevents interruption by higher priority tasks The UIE instruction enables interruption by higher priority tasks postscan The rung condition out is set to false No action taken Example When an error occurs error bit is on the FSC instruction checks the error code against a list of critical errors If the FSC instruction finds that the error is
395. n first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 324 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Example 1 This example ORs bool_in1 and bool in2 and places the result in value result or If BOOL_IN1Is If BOOL IN2Is Th en VALUE RESULT OR Is 0 0 0 0 1 1 1 0 1 1 1 1 Structured Text value_result_or bool_in1 OR bool_in2 Function Block BOR Boole 0 bool in E qg In In2 ice bool_in2 E E In3 E Ing Example 2 In this example ight1 is set on e only bool in1 is set true e only bool in2 is set true BOR iu 04 an Or Out A value result or if e both bool in1 and bool_in2 are set true Otherwise light1 is cleared off Structured Text IF bool_inl OR bool_in2 THE light1 i 1 ELSE light1 0 END_IF Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Boolean Exclusive OR BXOR Operands IF operandA XOR operandB THEN statement END IF BXOR 01 BXOR E Boolean Exclusive Or Out 325 The BXOR performs an exclusive OR on t
396. n is disabled the ACC value is cleared rungconditionin Rs timer enable bit EN timer timing bit TT timer done bit DN OFF delay a gt preset Sill eigen issues t ee eer Rs my PE MW timer accumulated value ACC Oooo 0 A 16650 timer did not reach PRE value How a timer runs A timer runs by subtracting the time of its last scan from the time now 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 Make sure to scan the timer at least every 69 minutes while it runs Otherwise the ACC value won t be correct The last_t ime_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 e subroutine section of code that is between JMP and LBL instructions sequential function chart SFC event or periodic task e state routine of a phase Arithmetic Status Flags not affected Publication 1756 RMOOSI EN P January 2007 102 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Fault Conditions A Major Fault Will Occur If Fault Type Fault Code PRE lt 0 4 34 ACC lt 0 4 34 Execution Publication 1756 RMOOSI EN P J
397. n out is set to false Publication 1756 RMOOSI EN P January 2007 Sequencer Instructions SQI SQ0 SQL 425 Example When enabled the SQI instruction passes value 2 through the mask Sl Sequencer Input Array array 1 0 Mask 16 0000f0ff Source value 1 Control control 1 Lenath 10 Position 0 GRT Greater Than 5B Source control 1 pos p Source B control 1 len 10 to determine whether the result is equal to the current element in array_dint The masked comparison is true so the rung condition out goes true SOl Sequencer Input Armay array_dint 0 Mask 16 0F0F Source value 2 Control control 1 Length 10 Position oe SQI Operand Example Values DINTs Displayed In Binary Source XXXXXXXX XXXXXXXX XXXX0101 xxxx1010 Mask 00000000 00000000 00001111 00001111 Array XXXXXXXX XXXXXXXX XXXX0101 xxxx1010 A 0 in the mask means the bit is not compared designated by xxxx in this example Use SOI without S00 If you use the SQI instruction without a paired SQO instruction you have to externally increment the sequencer array The SQI instruction compares the source value The ADD instruction increments the sequencer array The GRT determined 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 ADD Add Source control 1 pos p Source B 1 Dest cont
398. n out is set to false No action taken Example 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 EM is set the LOWER instruction converts the characters in item_number to all lower 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 Relay Ladder terminal read EM LOWER Lower Case Source item number ABCD Dest item number lower case abcd Structured Text IF terminal read EM THEN LOWER item number item number lower case terminal read EM 0 END IF Publication 1756 RMOOSI EN P January 2007 Appendix A Common Attributes Introduction This appendix describes attributes that are common to the Logix instructions For Information About See Page Immediate Values 635 Data Conversions 635 Immediate Values Whenever you enter an immediate value constant in decimal format for example 2 3 the controller stores the value using 32 bits If you enter a value in a radix other than decimal such as binary or hexadecimal and do not specify all 32 bits the controller places a zero in the bits that you do not specify zero filD Cum Zero filling of immediate values If You Enter The Controller Stores 1 16 ffff ff
399. n the buffer up to and including the first set of termination characters The instruction only returns this number after it finds the termination character or characters ERROR DINT The error contains a hexadecimal value that identifies the cause of an error Description The ABL instruction searches the buffer for the first set of termination Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 characters If the instruction finds the termination characters it e sets the FD bit e counts the characters in the buffer up to and including the first set of termination characters The Controller Properties dialog box User Protocol tab defines the ASCII characters that the instruction considers as the termination characters To program the ABL 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 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition not affected none Condition prescan ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 577 Execution Relay Ladder Action The rung condition out is set to false Structured Text Action No action taken
400. n 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 e sends the specified number of characters Serial Port Control Length of the Source tag to the device that is connected to the serial port of the controller e adds to the end of the characters appends either one or two characters that are defined in the Controller Properties dialog box User Protocol tab To program the AWA instruction follow these guidelines 1 Configure the serial port of the controller a Does your application also include ARD or ARL instructions If Then Yes Select User mode No Select either System or User mode b Define the characters to append to the data 2 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition See Publication 1756 RMOOSI EN P January 2007 Condition prescan ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 597 3 Each time the instruction executes do you always send the same number of characters Yes The
401. n the loop too many times in a single scan e The controller does not execute any other statements in the routine until it completes the loop e If the time that it takes to complete the loop is greater than the watchdog timer for the task a major fault occurs e Consider using a different construct such as IF THEN Description The syntax is WHILE bool expressionl DO statement a Statements to execute while bool expression is true IF bool expression2 THEN l EO a If there are conditions when you want to optional exit the loop early use other statements END IF such as an IF THEN construct to condition an EXIT statement Ij END WHILE Publication 1756 RMOOSI EN P January 2007 682 Structured Text Programming The following diagrams show how a WHILE DO loop executes and how an EXIT statement leaves the loop early d BOOL expression false ad BOOL expression Talse true true statement 1 statement 1 statement 2 statement 2 statement 3 4 statement 3 ix rest of the routine 4 no v rest of the routine While the bool_expression is true the To stop the loop before the conditions are true use an controller executes only the statements within EXIT statement the WHILE DO loop Arithmetic Status Flags not affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code the construct loops too long 6 1 Example
402. n 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 arithmetic operation element array to element Destination Expression Publication 1756 RMOOSI EN P January 2007 346 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 8 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 arithmetic operation array array to element FAL File Arith Logical Control control 1 Length 10 Position of Mode inc Dest value 1 g array_1 control_1 pos array 3 control 1 pos Expression Expression Destination FAL Expressions You program expressions in FAL instructions the same as expressions in CPT instructions Use the following sections for information on valid operators format and order of operation which are common to both instructions Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE S
403. nable limit_switchl TONR TONR 01 timer state Function Block Example 0 limit switch1 p TONR_01 DN TONR_01 TONR Es Timer On Delay with Reset TimerEnable ACC D 0 Reset Publication 1756 RMOOSI EN P January 2007 114 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Timer Off Delay with Reset TOFR Operands TOFR TOFR tag TOFR Timer Off Delay with Reset E TimerEnable ACC D DN E Input Parameter Data Type Enableln BOOL The TOFR instruction is a non retentive timer that accumulates time when TimerEnable is cleared This instruction is available in relay ladder as two separate instructions TOF see page 4 100 and RES see page 136 Structured Text Variable Type Format Description TOFR tag FBD_TIMER structure TOFR structure Function Block Operands Operand Type Format Description TOFR tag FBD_TIMER structure TOFR structure FBD_ TIMER Structure Description Function Block If cleared the instruction does not execute and outputs are not updated If set the instruction executes Default is set Structured Text No effect The instruction executes 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 1msec units that ACC must reach before timing is finished If invalid the inst
404. nd TND Operands CTND TND Description Arithmetic Status Flags Fault Conditions The TND instruction acts as a boundary Relay Ladder Operands none Structured Text none You must enter the parentheses O after the instruction mnemonic even though there are no operands When enabled the TND instruction lets the controller execute logic only up to this instruction When enabled the TND instruction acts as the end of the routine When the controller scans a TND instruction the controller moves to the end of the current 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 not affected none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The current routine terminates The current routine terminates postscan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP S
405. nd Type Format Description Destination SINT tag tag to store the result INT DINT REAL Expression SINT immediate an expression consisting of tags and or immediate values separated by operators INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Structured Text Structured text does not have a CPT instruction but you can achieve the same results using an assignment and expression destination numeric_expresion See Appendix for information on the syntax of assignments and expressions within structured text The CPT instruction performs the arithmetic operations you define in the expression When enabled the CPT instruction evaluates the expression and places the result in the Destination The execution of a CPT instruction is slightly slower and uses more memory than the execution of the other compute math instructions The advantage of the CPT instruction is that it allows you to enter complex expressions in one instruction TIP There is no limitto the length of an expression Arithmetic status flags are affected none Publication 1756 RMOOSI EN P January 2007 250 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The instruction evaluates the Expression a
406. nd outputs are not updated Default is set SourceA DINT Value to XOR with SourceB Valid any integer SourceB DINT Value to XOR with SourceA Valid any integer Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest DINT Result of the instruction Arithmetic status flags are set for this output Description When enabled the instruction evaluates the XOR operation If the Bit In And the Bitin The Bit In the Source A Is Source B Is Destination Is 0 0 0 0 1 1 1 0 1 1 1 0 If you mix integer data types the instruction fills the upper bits of the smaller integer data types with Os so that they are the same size as the largest data type Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 313 Execution Relay Ladder Condition Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The instruction performs a bitwise OR operation The rung condition out is set to true postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Ena
407. nd places the result in the Destination The rung condition out is set to true postscan The rung condition out is set to false 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 Compute Dest result 1 0 0 Expression value 1 5 value 2 7 Example 2 When enabled the CPT instruction truncates Joat value 1 and float value 2 raises the truncated 7Toat value 2 to the power of two and divides the truncated Toat value 1 by that result and stores the remainder after the division in loat value result cpt Compute Dest float value result cpt 14 000051 Expression tmifloat value 1 OD tre Hloat value 2 2 Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 251 Valid operators Operator Description Optimal Operator Description Optimal add DINT REAL LOG log base 10 REAL subtract negate DINT REAL MOD modulo divide DINT REAL E multiply DINT REAL NOT bitwise complement DINT divide DINT REAL OR bitwise OR DINT ui exponent x to y DINT REAL RAD degrees to radians DINT REAL ABS absolute value DINT REAL SIN sine REAL ACS arc cosine REAL SOR square root DINT REAL AND bitwise AND DINT TAN tangent REAL ASN arc sine REAL TOD integer to BCD DINT ATN arc tangent R
408. ne parameter SINT e The return parameter is optional INT e You can have only one return parameter DINT REAL Publication 1756 RMOOSI EN P January 2007 450 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT EXT_ROUTINE_CONTROL Structure Mnemonic Data Type Description Implementation ErrorCode SINT If an error occurs this value identifies the error There are no predefined error codes The Valid values are from 0 255 developer of the external routine must provide the error codes NumParams SINT This value indicates the number of parameters Display only this information is derived from associated with this instruction the instruction entry ParameterDefs EXT ROUTINE This array contains definitions of the Display only this information is derived from PARAMETERS 10 X parameters to pass to the external routine The the instruction entry instruction can pass as many as 10 parameters ReturnParamDef EXT ROUTIN This value contains definitions of the return Display only this information is derived from PARAMETERS parameter from the external routine There is the instruction entry only one return parameter EN BOOL When set the enable bit indicates that the JXR The external routine sets this bit instruction is enabled ReturnsValue BOOL If set this bit indicates that a return parameter Display only this information is deriv
409. nformation you must manually clear the bit e Use a Set System Value SSV instruction to set the attribute to a different value Arithmetic Status Flags not affected Fault Conditions none Condition prescan Execution Relay Ladder Action The rung condition out is set to false Structured Text Action No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes The rung condition out is set to true na Enableln is set instruction execution postscan na Enableln is always set The instruction executes The instruction triggers one execution of the specified event task The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 468 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 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 but Down task one time Relay Ladder Program A Shut Down Line Shut Down Line Dine Shot E rins EVENT Trigger Event T ask Task Shut Down Pro
410. ng condition out is set to false Example 1 Example 2 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Az If limit switch 1 is set this enables the next instruction the rung condition out is true Relay Ladder irit switch 1 Structured Text IF limit switch THEN statement END IF If S V is set indicates that an overflow has occurred this enables the next instruction the rung condition out is true Relay Ladder SM Structured Text IF S V THEN statement END IF Publication 1756 RMOOSI EN P January 2007 72 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Examine If Open XIO Operands Description Arithmetic Status Flags Fault Conditions Execution Condition prescan rung condition in is false The XIO instruction examines the data bit to see if it is cleared Relay Ladder Operand Type Format Description data bit BOOL tag bit to be tested Structured Text Structured text does not have an XIO instruction but you can achieve the same results using an IF THEN construct IF NOT data bit THEN statement END IF See Appendix B for information on the syntax of constructs within structured text The XIO instruction examines the data bit to see if it is cleared not affected none Relay Ladder Action The rung condition out is set to false The rung condition out is set to fals
411. nges to take effect In This Field Specify PV high Enter a PV high alarm value PVH PV low Enter a PV low alarm value PVL 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 Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID In this field Specifying Scaling Select the Scaling tab You must click OK or Apply for any changes to take effect Specify 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 CV maximum Enter the minimum engineering units corresponding to MINI MINS 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
412. ning of this manual for a list of the instructions available in structured text A structured text instruction executes each time it is scanned A structured text instruction within a construct executes every time the conditions of the construct are true If the conditions of the construct are false the statements within the construct are not scanned There is no rung condition or state transition that triggers execution This differs from function block instructions that use EnableIn to trigger execution Structured text instructions execute as if EnableIn is always set This also differs from relay ladder instructions that use rung condition in to trigger execution Some relay ladder instructions only execute when rung condition in toggles from false to true These are transitional relay ladder instructions In structured text instructions will execute each time they are scanned unless you pre condition the execution of the structured text instruction For example the ABL instruction is a transitional instruction in relay ladder In this example the ABL instruction only executes on a scan when tag_xic transitions from cleared to set The ABL instruction does not execute when ag x c stays set or when tag xic is cleared ABL ASCII Test For Buffer Line Channel 0 SerialPort Control serial_control Character Count In structured text if you write this example as IF tag xic THEN ABL 0 serial control END
413. ns for the next step S00 relay ladder 426 Load reference conditions into SQL relay ladder 430 Sequencer arrays For relay ladder instructions 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 Publication 1756 RMOOSI EN P January 2007 422 Sequencer Instructions SQI SQO SQL Sequencer Input SQI The SQI instruction detects when a step is complete in a sequence pair of SQO SQI instructions Operands Relay Ladder ae Operand Type Format Description Source Array DINT array tag sequencer array Control raed specify the first element of the sequencer array do not use CONTROL POS in the subscript Mask SINT tag which bits to block or pass INT immediate DINT A SINT or INT tag converts to a DINT value by sign extension Source SINT tag input data for the sequencer array INT DINT A SINT or INT tag converts to a DINT value by sign extension Control CONTROL tag control structure for the operation typically use the same CONTROL as the SOO and SOL instructions Length DINT immediate number of elements in the Array sequencer table to compare Position DINT immediate current position in the array initial value is typically 0 CONTROL Structure Mnemonic Data Type Description ER BOOL The error bit is set when LEN lt 0 POS lt 0 or POS gt LEN LEN DINT Th
414. nstruction Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 134 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Condition prescan Execution Function Block Action No initialization required Structured Text Action No initialization required instruction first scan instruction first run CUEnable and CDEnable are set CUEnable and CDEnable are set CUEnable and CDEnable are set CUEnable and CDEnable are set Enableln is cleared EnableOut is cleared the instruction does nothing and the outputs are not updated na Enableln is set The instruction sets CUEnable and CDEnablej4 On a cleared to set transition of Enableln e The instruction executes e EnableOut is set The instruction sets CUEnable and CDEnablej4 Enableln is always set The instruction executes reset When set the instruction clears CUEnable When set the instruction clears CUEnable CDEnable CU CD DN OV and UN and sets CDEnable CU CD DN OV and UN and sets ACC zero ACC zero postscan No action taken No action taken Example When imit switcb1 goes from cleared to set CUEnable is set for one scan and the CTUD instruction increments the ACC value by 1 When ACC 2 PRE the DN parameter is set which enables the function block instruction following the CTUD inst
415. nstruction This is equivalent to rung condition out for the relay ladder NEO instruction Description The NEQ instruction tests whether Source A is not equal to Source B Publication 1756 RMOOSI EN P January 2007 Arithmetic Status Flags Fault Conditions When you compare strings e Strings are not equal if any of their characters do not match e ASCII characters are case sensitive Upper case A 41 is not equal to lower case a 61 ASCII Characters Hex Codes 1ab 31 61 62 I g Tb 31 62 e r 4 A A 4 S a AB 41 42 AB B e t Rec gt gt E B 42 d4 r a 61 a B Y ab 61 62 not affected none Execution Condition prescan Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 245 Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Source A Source B rung condition out is set rung condition out is set to true to false Y postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan
416. nstructions 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 The move instructions modify and move bits Use this instruction Available in these languages See page MOV relay ladder 285 structured text MVM relay ladder 287 MVMT structured text 290 function block move bits within an integer or between integers move bits within an integer or between integers in function block BID relay ladder 293 BIDT structured text 296 function block clear a value CLR structured text 299 relay ladder rearrange the bytes of a INT DINT or REAL tag SWPB relay ladder 301 structured text 1 There is no equivalent structured text instruction Use other structured text programming to achieve the same result See the description for the instruction Publication 1756 RMOOSI EN P January 2007 284 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT The logical instructions perform operations on bits If you want to Use this instruction Available in these languages See page bitwise AND operation Bitwise AND relay ladder 305 gn structured text function block bitwise OR operation Bitwise OR relay ladder 308 structured text function block bitwise exclusive OR operation Bitwise XOR relay ladder 31
417. nter an ASCII character directly into the expression enter the decimal value of the character If bar codeis a string tag and your specification says If bar code DATA 0 equals N then IF bar code DATA 0 65 THEN bool tag bool expressions If countand length are DINT tags done is a BOOL tag and your specification says If count is greater than or equal to ength you are done counting How Strings Are Evaluated done count gt length The hexadecimal values of the ASCII characters determine if one string is less than or greater than another string e When the two strings are sorted as in a telephone directory the order of the strings determines which one is greater ASCII Characters Hex Codes Jab 31 61 62 L a Mb 31 62 e r 4 S e A 4 S a AB 41 42 AB lt B e t B 42 d r a 61 a B Y ab 61 62 e Strings are equal if their characters match e Characters are case sensitive Upper case A 41 is not equal to lower case a 61 For the decimal value and hex code of a character see the back cover of this manual Publication 1756 RMOOSI EN P January 2007 668 Structured Text Programming Use This Format Use logical operators Logical operators let you check if multiple conditions are true or false The result of a logical operation is a BOOL value If The Comparison Is The Result I
418. ntrol Publication 1756 RMOOSI EN P January 2007 characters that were sent Structured Text The operands are the same as those for the relay ladder AWT instruction However you 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 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 601 SERIAL PORT CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the instruction is enabled EU BOOL The queue bit indicates that 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 that the instruction is executing EM BOOL The empty bit indicates that 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 Serial Port Control Length of the Source tag to t
419. o 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 Relay Ladder MOV AWT Move ASCII Write EN Source MV msg LEN Channel 0 10 Source MV msg ND Dest MV_write LEN 161365 8 1 r 10 SerialPort Control MV_write SerialPort Control Length 10 Characters Sent 10 Structured Text osri l InputBit MV update OSRI osri 1 IF osri l OutputBit THEN MV write LEN Mv msg LEN AWT 0 MV msg MV write END IF Publication 1756 RMOOSI EN P January 2007 604 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Notes Publication 1756 RMOOSI EN P January 2007 Chapter 19 ASCII String Instructions CONCAT DELETE FIND INSERT MID Introduction Use the ASCII string instructions to modify and create strings of ASCII characters If you want to For example Use this Available in these See page instruction languages add characters to the end of a string add termination characters or CONCAT relay ladder 608 delimiters to a string structured text delete characters from a string remove header or control characters DELETE relay ladder 610 from a string structured text determine the starting characterofa locate a group of characters within a FIND relay ladder 612 sub string string structured text insert characters into a string create
420. ocess of shutting down all connections to the module 1676000 Inhibited the MODULE object is inhibited the inhibit bit in the Mode attribute is set 1627000 Waiting the parent MODULE object upon which this MODULE object depends is not running FaultCode INT GSV A number which identifies a module fault if one occurs Faultlnfo DINT GSV Provides specific information about the MODULE object fault code ForceStatus INT GSV Specifies the status of forces Bit Meaning 0 forces installed 1 yes 0 no 1 forces enabled 1 yes 0 no 2 15 not used Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 189 Attribute Data Type Instruction Description Instance DINT GSV Provides the instance number of this MODULE object LEDStatus INT GSV Specifies the current state of the 1 0 LED on the front of the controller Value Meaning 0 LED 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 Note You do not enter an object name with this attribute because this attribute applies to the entire collection of modules Mode INT GSV Specifies the current mode of the MODULE object SSV Bit Meaning 0 If set causes a major fault to be generated if
421. ock 3 e p d p d p Execution order is only relative to the blocks that are wired together The following example is fine because the two groups of blocks are not wired together The blocks within a specific group execute in the appropriate order in relation to the blocks in that group Function Block Attributes 645 Resolve a Loop To create a feedback loop around a block wire an output pin of the block to an input pin of the same block The following example is OK The loop contains only a single block so execution order does not matter This input pin uses an output that the block produced on the previous scan 9 gc d el If a group of blocks are in a loop the controller cannot determine which block to execute first In other words it cannot resolve the loop To identify which block to execute first mark the input wire that creates the loop the feedback wire with the Assume Data Available indicator In the following example block 1 uses the output from block 3 that was produced in the previous execution of the routine This input pin uses the output that block 3 produced on the previous scan Assume Data Available indicator The Assume Data Available indicator defines the data flow within the l
422. ode 2 This is a transitional instruction e In relay ladder toggle the rung condition in from cleared to set each time the instruction should execute e In structured text condition the instruction so that it only executes on a transition Arithmetic Status Flags not affected Fault Conditions none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes when rung condition in na toggles from cleared to set The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction counts the characters in the buffer The EN bit is set The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue postscan The rung condition out is set to false No action taken Example Continuously count the characters in the buffer Relay Ladder bar code count EN ACB ASCII Chars in Buffer Channel 0 DND SerialPort Control bar code count R gt Character Count 0 Publication 1756 RMOOSI EN P January 2007 580 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Structured Text ACB 0 bar code count Publication 1756 RMOOSI EN P January 2007 ASCII Serial P
423. oduced a valid result Dest DINT Result of the conversion instruction Arithmetic status flags are set for this output Publication 1756 RMOOSI EN P January 2007 568 Description Arithmetic Status Flags Fault Conditions Execution Condition prescan Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Truncating does not round the value rather the non fractional part remains the same regardless of the value of the fractional part Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller removes the fractional part of the Source and places the result in the Destination The rung condition out is set to true postscan Condition prescan The rung condition out is set to false Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOOSI EN P January 2007 No action taken Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC 569 Example Remove the fractional part of float value 1 leaving the non fractional part the same and place the result in Joat value 1 tr
424. of the serial port cause a modem to hang up AHL relay ladder 583 control lines turn on or off the DTR signal Same ted text turn on or off the RTS signal read a fixed number of characters read data from a device that sends ARD relay ladder 587 the same number of characters each transmission structured text read a varying number of characters read data from a device that sends a ARL relay ladder 591 up to and including the first set of varying number of characters each termination characters transmission structured text send characters and automatically send messages that always use the AWA relay ladder 595 append one or two additional same termination character s characters to mark the end of the structured text data send characters send messages that use a variety of AWT relay ladder 600 termination characters structured text Publication 1756 RMOOSI EN P January 2007 572 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Publication 1756 RMOOSI EN P January 2007 Instruction Execution ASCII serial port instructions execute asynchronous to the scan of the logic Logic Rung condition in of instruction transitions from false to true Instruction enters the ASCII queue ASCII Queue Instruction 1 Instruction 2 Instruction 3 Instruction 4 Data flows between buffer and serial port ASCII Task Instruction at the top of the queue executes Data flow
425. oller system data that is ATTENTION A Publication 1756 RMOOSI EN P January 2007 stored in objects The controller stores system data in objects There is no status file as in the PLC 5 processor When enabled the GSV instruction retrieves the specified information and places it in the destination When enabled 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 available attributes For the SSV instruction the software displays only those attributes are allowed to set SSV Use the GSV and SSV instructions carefully Making changes to objects may cause unexpected controller operation or injury to personnel You must test and confirm that the instructions don t change data that you don t want them to change The GSV and SSV instructions write or read past a member into other members of a tag If the tag is too small the instructions don t write or read the data They log a minor fault instead Example 1 My Tag GSV I E My Tag Member A Attribute My_Tag Member_A0 zH My Tag Member A 1 H My Tag Member B Member A is too small for the attribute So the GSV instruction writes the last value to Member B Example 2 GSV ET My Tag My_Tag Member_A Attribute
426. on The instruction finds the size of a dimension postscan The rung condition out is set to false No action taken 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 Relay Ladder SIZE Size in Elements Source array a 0 255 Dim To Vary 0 Size array a size 10 Structured Text SIZE array a 0 array a size Publication 1756 RMOOSI EN P January 2007 386 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 2 Example 3 Publication 1756 RMOOSI EN P January 2007 Find the number of elements in the DATA member of string_1 which is a string Store 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 Relay Ladder SIZE Size in Elements Source string 1 DATA O 00 Dim To Vary 0 Size string 1 size 82 Structured Text SIZE string 1 DATA 0 0 string 1 size Strings 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 Relay Ladder SIZE Si
427. on out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 281 Example Place the absolute value of value 1 into value 1 absolute In this example the absolute value of negative four is positive four Relay Ladder ABS Absolute Value Source value 1 de Dest value 1 absolute 4e Structured Text value 1 absolute ABS value 1 Function Block value 1 absolute value 1 Publication 1756 RMOOSI EN P January 2007 282 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Notes Publication 1756 RMOOSI EN P January 2007 Chapter 8 Introduction If you want to copy a value copy a specific part of an integer copy a specific part of an integer in function block Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 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 For relay ladder i
428. ons are true the controller then executes the statements within the loop The statements in a REPEAT UNTIL loop are always executed at least once The statements in a WHILE DO loop might never be executed Enter This Structured Text pos 1 REPEAT pos pos 2 UNTIL pos 101 OR structarray pos valu targetvalu end repeat Publication 1756 RMOOSI EN P January 2007 686 Structured Text Programming Example 2 If You Want This Move ASCII characters from a SINT array into a string tag In a SINT array each element holds one character Stop when you reach the carriage return 1 Initialize Element number to 0 2 Count the number of elements in S NT array array that contains the ASCII characters and store the result in SINT array size DINT tag 3 Set String tag element number the character at SINT arraylelement number 4 Add 1 to element number This lets the controller check the next character in S NT array 5 Set the Length member of String tag element number This records the number of characters in String tag so far 6 If element number SINT array size then stop You are at the end of the array and it does not contain a carriage return 7 If the character at S NT arraylelement number 13 decimal value of the carriage return then stop Otherwise go to 3 Publication 1756 RMOOSI EN P January 2007 Enter This Structured Text
429. ontrollers 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 If You Want 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 e 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 e Specify how many 16 bit integers INT to send or receive You can specify from 0 to 64 integers If You Want The Then Specify Block transfer module to determine how many 0 for the number of elements 16 bit integers to send BTR Controller to send 64 integers BTW Publication 1756 RMOOSI EN P January 2007 162 Input Output Instructions MSG GSV SSV IOT Select this command Specify PLC 3 messages The PLC 3 message types are designed for PLC 3 processors If you want 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 Logix5000 controller and maintains data integrity This command also reads floating point data from
430. oop The arrow indicates that the data serves as input to the first block in the loop Publication 1756 RMOOSI EN P January 2007 646 Function Block Attributes Do not mark all the wires of a loop with the Assume Data Available indicator This is OK Assume Data Available indicator The Assume Data Available indicator defines the data flow within the loop Publication 1756 RMOOSI EN P January 2007 This is NOT OK The controller cannot resolve the loop because all the wires use the Assume Data Available indicator Function Block Attributes 647 Resolve Data Flow Between Two Blocks If you use two or more wires to connect two blocks use the same data flow indicators for all of the wires between the two blocks This is OK Neither wire uses the Assume Data Available indicator Assume Data Available indicator Both wires use the Assume Data Available indicator This is NOT OK One wire uses the Assume Data Available indicator while the other wire does not Publication 1756 RMOOSI EN P January 2007 648 Function Block Attributes Create a One Scan Delay To produce a one scan delay between blocks use the Assume Data Available indicator In the following example block 1 executes first It uses the output from block 2 that was produced in the previous scan of the routine Summary In summary a function block routine executes in this order 1 The controller latches all data
431. or use the action to call a structured text routine via a JSR instruction Example 4 IF THEN ELSIF ELSE If You Want This Enter This Structured Text If tank temperature 100 IF tank temp 200 THE then pump slow pump fast 1 pump slow If tank temperature 200 ELSIF tank temp 100 THE then pump fast pump fast 0 pump slow otherwise pump off ELSE pump fast 0 pump slow Publication 1756 RMOOSI EN P January 2007 0 1 0 pump off pump off pump off Structured Text Programming 675 CASE OF Use CASE to select what to do based on a numerical value Operands Structured Text CASE numeric_expression OF Operand Type Format Enter selectori statement SSTOGEOENS statenmdnts numeric_ SINT tag tag or expression that evaluates to a number numeric expression ELSE expression NT expression statement END_CASE DINT REAL selector SINT immediate same type aS numeric expression INT DINT REAL IMPORTANT If you use REAL values use a range of values for a selector because a REAL value is more likely to be within a range of values than an exact match of one specific value Description The syntax is CASE numeric_expression OF specify as many alternative selector values paths as you need selectorl lt statement gt lt q statements to execute when numeric expression selector selector2 lt statem
432. ormat Description ASN tag FBD MATH ADVANCED structure ASN structure FBD MATH ADVANCED Structure Arithmetic Status Flags Fault Conditions Execution Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The Source must be greater than or equal to 1 and less than or equal to 1 The resulting value in the Destination is always greater than or equal to 7 2 and less than or equal to x 2 where n 3 141593 Arithmetic status flags are affected none Relay Ladder Action Condition prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller calculates the arc sine of the Source and places the result in the Destination The rung condition out is set to true postscan The rung condition out is set to false Function Block Publication 1756 RMOOSI EN P January 2007 534 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Condition prescan Action No action taken instruction first scan No
433. ormat Description osine Car COPIE WHEN COS tag FBD MATH ADVANCED structure COS structure Publication 1756 RMOOSI EN P January 2007 526 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The Source must be greater than or equal to 205887 4 C2nx2 and Arithmetic Status Flags Fault Conditions Execution less than or equal to 205887 4 2nx2P The resulting value in the Destination is always greater than or equal to 1 and less than or equal to 1 Arithmetic status flags are affected none Relay Ladder Action Condition The rung condition out is set to false prescan rung condition in is false rung condition in is true The rung condition out is set to false The controller calculates the cosine of the Source and places the result in the Destination The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Function Block Condi
434. ort Instructions ABL ACB ACL AHL ARD ARL AWA AWT 581 ASCII Clear Buffer ACL The ACL instruction immediately clears the buffer and ASCII queue Operands Relay Ladder ACL Operand Type Format Enter ASCII Clear Buffer Channel TIEN TEMPE Channel DINT immediate 0 Clear Serial Port Write ti tag Clear Serial BOOL immediate To empty the buffer and remove ARD and Port Read ARL instructions from the queue enter Yes tag Clear Serial BOOL immediate To remove AWA and AWT instructions from Port Write the queue enter Yes tag Structured Text ACL Channel ClearSerialPortRead ClearSerialPortWrite ACL instruction The operands are the same as those for the relay ladder Description The ACL instruction immediately performs one or both of the following actions e clears the buffer of characters and clears the ASCII queue of read instructions e clears the ASCII queue of write instructions To program the ACL instruction follow these guidelines 1 Configure the serial port of the controller If Your Application uses ARD or ARL instructions Then Select User mode does not use ARD or ARL instructions Select either System or User mode 2 To determine if an instruction was removed from the queue or aborted examine the following of the appropriate instruction e ER bit is set e ERROR member is 16 E Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI
435. ort instruction fails to execute the ERROR member of its SERIAL PORT CONTROL structure will contain one of the following hexadecimal error codes This Hex Code Indicates That the 1642 Modem went offline 1673 CTS signal was lost during communication 1674 Serial port was in system mode 167A Before the instruction executed the UL bit was set This prevents the execution of the instruction 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 In the Controller Properties dialog box User Protocol tab 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 ACL instruction executed 16 F Serial port configuration changed from User mode to System mode This stops the execution of an ASCII serial port instruction and clears the ASCII serial port instruction queue 16 51 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 String Data Types E You store ASCII characters in tags that use a string data type iw S name_of_controller e You can use the default STRING data type It stores up to 82
436. ource to the Destination The Source remains unchanged Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 286 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Execution Condition prescan Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true postscan The instruction copies the Source into the Destination The rung condition out is set to true The rung condition out is set to false Example Move the data in value 1 to value 2 Publication 1756 RMOOSI EN P January 2007 Relay Ladder MOV Move Source Structured Text value 2 value 1 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 287 Masked Move MVM Operands MVM Masked Move Source Mask dest Dest AND NOT Mask OR Source AND Mask Description The MVM instruction copies the Source to a Destination and allows portions of the data to be masked This instruction is available in structured text and function block as MVMT see page 290 Relay Ladder Operand Type Format Description Source SINT immediate value to move INT tag DINT A SINT or INT tag converts to a DINT value by zero fill
437. out for the relay ladder GEO instruction Description The GEQ instruction tests whether Source A is greater than or equal to Source B When you compare strings e The hexadecimal values of the characters determine if one string is less than or greater than another string For the hex code of a character see the back cover of this manual e When the two strings are sorted as in a telephone directory the order of the strings determines which one is greater ASCII Characters Hex Codes 1ab 31 61 62 LA a stb 31862 e r A 41 S e L IT S a AB 41 42 AB B e t as Eti i B 42 r a 61 a B Y ab 61 62 Publication 1756 RMOOSI EN P January 2007 218 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Arithmetic Status Flags not affected Condition prescan Fault Conditions none Execution Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Source A gt Source B rung condition out is set to true rung condition out is set to false Y postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan instruction first run No action taken No action taken Enableln is cleared EnableOut is cleare
438. out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction removes characters from the buffer and stores them in the destination The EN bit is set The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue postscan The rung condition out is set to false No action taken Example A bar code reader sends bar codes to the serial port channel 0 of the controller Each bar code contains 24 characters To determine when the controller receives a bar code the ACB instruction continuously counts the characters in the buffer When the buffer contains at least 24 characters the controller has received a bar code The ARD instruction moves the bar code to the DATA member of the bag bar code tag which is a string Relay Ladder bar code count EN ACB ASCII Chars in Buffer Channel 0 SerialPort Control bar code count Character Count 0 GEQ Grtr Than or Egl A gt B ASCII Read EN Source A bar code count pos Channel 0 0 Destination bag bar code ND Source B 24 SerialPort Control bar code read R gt SerialPort Control Length 24 Characters Read 0 Structured Text ACB 0 bar code count IF bar code count POS 24 THEN Publication 1756 RMOOSI EN P January 2007 590 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT bar code rea
439. outlet 4 open 1 Ingredient B outlet 2 open 1 If recipe number 4 5 6 or 7 then Ingredient A outlet 4 open 1 Ingredient B outlet 2 open 1 If recipe number 8 11 12 or 13 then Ingredient A outlet 1 open 1 Ingredient B outlet 4 open 1 Otherwise all outlets closed 0 Enter This Structured Text CASE recipe_number OF 1 ELSE Ingredient A Outlet 1 Ingredient A Outlet 4 Ingredient B Outlet 2 Ingredient B Outlet 4 END CASE Ingredien Ingredient Ingredient Ingredien Ingredien Ingredient 13 Ingredien Ingredient e enters the RUN mode Structured Text Programming Outlet 1 1 Outlet 4 1 Outlet 4 1 Outlet 2 1 Outlet 4 1 Outlet 2 1 Outlet 1 1 Outlet 4 1 0 0 0 0 677 The tells the controller to also clear the outlet tags whenever the controller e leaves the step of an SFC if you configure the SFC for Automatic reset This applies only if you embed the assignment in the action of the step or use the action to call a structured text routine via a JSR instruction Publication 1756 RMOOSI EN P January 2007 678 Structured Text Programming FOR DO Operands FOR count initial_value TO final_value BY increment DO statement END FOR Structured Text Use the FOR DO loop to do something a specific number of times before
440. owing diagrams show how a FOR DO loop executes and how an EXIT statement leaves the loop early Donexnumber yes Donexnumber yes zt of times ad of times no no statement 1 statement 1 statement 2 statement 2 i statement 3 Y statement 3 yes X rest of the routine ic no v rest of the routine The FOR DO loop executes a specific To stop the loop before the count reaches the last number of times value use an EXIT statement Arithmetic Status Flags not affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code the construct loops too long 6 1 Publication 1756 RMOOSI EN P January 2007 680 Structured Text Programming Example 1 If You Want This Clear bits 0 31 in an array of BOOLs 1 Initialize the subscript tag to 0 Enter This Structured Text For subscript 0 to 31 by 1 do array subscript 0 End for 2 Clear array subscript For example when subscript 5 clear array 5 3 Add 1 to subscript 4 f subscript is lt to 31 repeat 2 and 3 Otherwise stop Example 2 If You Want This A user defined data type structure stores the following information about an item in your inventory e Barcode ID of the item string data type e Quantity in stock of the item DINT data type An array of the above structure contains an element for each different item in your inventory You want to search the array for a specific product use its bar code
441. p us serve you better in the future Thank you for taking the time to provide us feedback wy You can complete this form and mail it back to us visit us online at www ab com manuals or email us at RADocumentComments ra rockwell com Pub Title Type Logix5000 Controllers General Instructions Cat No Pub No 1756 RMOO3I EN P Pub Date January 2007 Part No Please complete the sections below Where applicable rank the feature 1 needs improvement 2 satisfactory and 3 outstanding Overall Usefulness 1 2 3 How can we make this publication more useful for you C 1 2 3 Can we add more information to help you ompleteness all necessary information procedure step illustration feature is provided er example guideline other explanation definition Technical Accuracy 1 2 3 Can we be more accurate all provided information l 1 is correct text illustration Clarity 1 2 3 How can we make things clearer all provided information is easy to understand Other Comments You can add additional comments on the back of this form Your Name Location Phone Your Title Function Would you like us to contact you regarding your comments ___No there is no need to contact me Yes please call me Yes please email me at Yes please contact me via Return this form to Allen Bradley Marketing Communications 1 Allen Bradley Dr Mayfield Hts OH 44124 9705 Phone 440 646 3176 Fax 440
442. pe FBD_MATH Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value from which to subtract SourceB Valid any float SourceB REAL Value to subtract from SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL Dest REAL Description Arithmetic Status Flags Fault Conditions Execution Condition prescan rung condition in is false The instruction produced a valid result Result of the math instruction Arithmetic status flags are set for this output The SUB instruction subtracts Source B from Source A and places the result in the Destination Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false The rung condition out is set to false rung condition in is true Destination Source B Source A The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 259 Condition prescan Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is
443. perand FIFO Type Format SINT array tag INT DINT REAL string structure Description FIFO to modify specify the first element of the FIFO do not use CONTROL POS in the subscript Destination SINT tag INT DINT REAL string structure value that exits the FIFO The Destination value converts to the data type of the Destination tag A smaller integer converts to a larger integer by sign extension Control CONTROL tag control structure for the 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 unloads data initial value is typically 0 If you use a user defined structure as the data type for the FIFO or Destination operand use the same structure for both operands Array File Shift Instructions BSL BSR FFL FFU LFL LFU 403 CONTROL Structure Mnemonic Data Type Description EU BOOL The enable unload bit indicates that the FFU instruction is enabled The EU bit is set to preset a false unload when the program scan begins DN BOOL The done bit is set to indicate that the FIFO is full POS LEN EM BOOL The empty bit indicates that the FIFO is empty If LEN lt 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
444. 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 096 MINTIE REAL minimum tieback value corresponding to 10096 MAXTIE REAL maximum tieback value corresponding to 096 Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 503 Mnemonic Data Type Description DATA REAL 7 The DATA member stores Element Description DATA 0 integral accumulation DATA 1 derivative smoothing temporary value DATA 2 previous PV value DATA 3 previous ERR value DATA M 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 dependent gain KP DATA 12 dependent gain KI DATA 13 dependent gain KD DATA 14 previous CV value DATA 15 CV descaling constant DATA 16 tieback descaling constant EN BOOL enabled ICT BOOL cascade type 0 slave 1 master CL BOOL cascade loop 0 no 1 y
445. production 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 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 IMPORTANT Identifies information that is critical for successful application and understanding of the product ATTENTION Identifies information about practices or circumstances that can lead to personal injury or death property damage or economic loss Attentions help you to identify a hazard avoid a hazard and recognize the consequences 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 be dangerous temperatures gt gt gt ii Allen Bradley ControlLogix FactoryTalk Logix5000 RSLogix RSLogix 5000 Rockwell Automation RSNetWorx and RSLinx are trademarks of Rockwell Automation Inc Trademarks not belonging to Rockwell Automation are property of their respective companies Summary of Changes Preface Instruction Locator Digital Alarm Instruction ALMD Analog Alarm Instr
446. ption EU BOOL The enable unload bit indicates that the LFU instruction is enabled The EU bit is set to preset a false unload when the program scan begins DN BOOL The done bit is set to indicate that the LIFO is full POS LEN EM BOOL The empty bit indicates that the LIFO is empty If LEN lt 0 or POS lt 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 Description 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 Arithmetic Status Flags Fault Conditions You musttest and confirm that the instruction doesn t change data that you don t want it to change The LFU instruction operates on contiguous memory In some cases the instruction unloads data from other members of the tag This happens if the length is too big and the tag is a user defined data type not affected A Major Fault Will Occur If Fault Type Fault Code Length LIFO array size 4 20 Publication 1756 RMOOSI EN P Januar
447. ption status and to display alarm status changes If a connection to RSLinx Enterprise software is lost the controller can briefly buffer alarm data until the connection is restored These operands are located on the instruction pony rare gt a Ladder Logic Operands Operand Type Format Description ALMD tag ALARM_DIGITAL structure ALMD structure ProgAck BOOL Tag Value is copied to ProgAck when instruction executes Immediate On transition from False to True acknowledges alarm if acknowledgement is required ProgReset BOOL Tag Value is copied to ProgReset when instruction Immediate executes On transition from False to True resets alarm if resetting is required ProgDisable BOOL Tag Value is copied to ProgDisable when instruction Immediate executes When True disables alarm does not override Enable Commands ProgEnable BOOL Tag Value is copied to ProgEnable when instruction Immediate executes When True enables alarm takes precedence over Disable commands 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 Structured Text Operands ALMD ALMD In ProgAck ProgReset ProgDisable ProgEnable Operand Type Format Description ALMD ALARM_DIGITAL structure ALMD structure In BOOL Tag Alarm Condition to b
448. putes the sine of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text SIN 01 C Source Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 523 Function Block Operand Type Format Description SIN tag FBD MATH ADVANCED structure SIN structure FBD MATH ADVANCED Structure Arithmetic Status Flags Fault Conditions Condition prescan Execution Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the math instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Description The Source must be greater than or equal to 205887 4 21x2 gt and less than or equal to 205887 4 2nx2P The resulting value in the Destination is always greater than or equal to 1 and less than or equal to 1 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true postscan The controller calculates the sine of the Source and places the result in the Destination The rung condition out
449. qual to the DATA size of the Source Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution The instruction deletes the specified characters postscan The rung condition out is set to false No action taken Example ASCII information from a terminal contains a header character After the controller reads the data zerm read EM is set the DELETE instruction removes the header character Relay Ladder term read EM DELETE String Delete Source term input 0655 Qty 1 Start 1 Dest term text 55 Publication 1756 RMOOSI EN P January 2007 612 ASCII String Instructions CONCAT DELETE FIND INSERT MID Structured Text IF term read F IHE N DELETE term input l1 1 term text term read EM 0 END IF Find String FIND The FIND instruction locates the starting position of a specified string within another string Operands Relay Ladder FIND Find String Source Search Start Result Operand Type Format Enter Notes Source string tag string to search in String data types are Search string tag string to find e default STR
450. r Block transfers Over Add These Modules To The 1 0 Configuration This Network ControlNet e local communication module for example 1756 CNB module e remote adapter module for example 1771 ACN module universal remote I 0 e local communication module for example 1756 DHRIO module e one emote adapter module for example 1771 ASB module for each rack or portion of a rack in the chassis e block transfer module optional Publication 1756 RMOOSI EN P January 2007 Input Output Instructions MSG GSV SSV IOT 169 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 Isa Then Select Logix5000 controller CIP LC 5 controller over an P EtherNet IP network LC 5 controller over a ontrolNet network And Specify no other specifications required LC 5 controller over a DH DH etwork P C SLC 5 05 controller P n S LC controller over a DH network PLC 3 processor PLC 2 processor Channel Channel A or B of the 1756 DHRIO module that is connected to the DH network Source Link 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 Destination Link Link ID of the remote DH link where the target device resides Dest
451. r defined structure io fest info Relay Ladder GSV GSV GSV Get system value Get system value Get system value Object class TASK Object class TASK Object class TASK Object name IO_TEST Object name IO TEST bject name IO TEST Attribute name WATCHDOG Dest io_test_info WatchDog 500000 Attribute name MAXSCANTIME Dest io_test_info MaxScanTime 0 6847 Attribute name LASTSCANTIME Dest io test info LastScanTime 2998 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 Publication 1756 RMOOSI EN P January 2007 Example Input Output Instructions MSG GSV SSV IOT 199 Set 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 similar to using inhibit bits with a PLC 5 processor Based on the status of W 1 place the appropriate value in the disableflag attribute of program discrete Relay Ladder MOV Move Source enable_prog ika Dest discrete prog flag ika MOV Move Source disable prog 1 Dest discrete prog flag of SSV Set system value Object class PROGRAM Object name DISCRETE Attribute name DISABLEFLAG Source discrete_prog_flag p Structured T
452. r greater than another string For the hex code of a character see the back cover of this manual e When the two strings are sorted as in a telephone directory the order of the strings determines which one is greater ASCII Characters Hex Codes 1ab 31 61 62 L a Tb 31862 e r 4 S e A 4 S a AB 41 42 e t B 42 r a 61 Y ab 61 62 AB B ue 0 i a B Publication 1756 RMOOSI EN P January 2007 212 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Equal to EQU Operands EQU Equal c A Source 4 Source B IF sourceA sourceB THEN statements Publication 1756 RMOOSI EN P January 2007 The EQU instruction tests whether Source A is equal to Source B Relay Ladder Operand Type Format Description Source A SINT immediate value to test against Source B INT tag DINT REAL string Source B SINT immediate value to test against Source A INT tag DINT REAL string e If you enter a SINT or INT tag the value converts to a DINT value by sign extension e REAL values are rarely absolutely equal If you need to determine the equality of two REAL values use the LIM instruction e String data types are default STRING data type any new string data type that you create e To test the characters of a string enter a string tag for both Source A and Source B Structured Text Use the equal sign
453. r 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 f 2 ABS ACS ASN ATN COS DEG FRD LN LOG RAD SIN SOR TAN TOD TRN 3 i 4 negate NOT 5 MOD 6 lt lt gt gt 7 subtract 8 AND g XOR 10 OR Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 211 Use Strings In an Expression Use a relay ladder or structured text expression to compare string data types To use strings in an expression follow these guidelines e An expression lets you compare two string tags e You cannot enter ASCII characters directly into the expression e Only the following operators are permitted Operator Description tt tt lt is sSSS equal lt less than lt less than or equal gt greater than gt greater than or equal o not equal e Strings are equal if their characters match e ASCII characters are case sensitive Upper case A 41 is not equal to lower case a 61 e The hexadecimal values of the characters determine if one string is less than o
454. r program to acknowledge the alarm low condition Requires a False to True transition while the alarm condition is Unacknowledged Default is cleared LOperAck BOOL Low Alarm Operator Acknowledge Set by the operator interface to acknowledge the alarm low condition Requires a False to True transition while the alarm condition is Unacknowledged The alarm instruction clears this parameter Default is cleared LLProgAck BOOL Low Low Alarm Program Acknowledge Set by the user program to acknowledge the alarm low low condition Requires a False to True transition while the alarm condition is Unacknowledged Default is cleared LLOperAck BOOL Low Low Alarm Operator Acknowledge Set by the operator interface to acknowledge alarm low low conditions Requires a False to True transition while the alarm condition is Unacknowledged The alarm instruction clears this parameter Default is cleared Publication 1756 RMOOSI EN P January 2007 52 Analog Alarm Instruction ALMA Input Parameter Data Type Description ROCPosProgAck BOOL Rate Of Change Positive Alarm Program Acknowledge Set by the user program to acknowledge a positive rate of change alarm condition Requires a False to True transition while the alarm condition is Unacknowledged Default is cleared ROCPosOperAck BOOL Rate Of Change Positive Alarm Operator Acknowledge Set by the operator interface to acknowledge a positive rate of change al
455. racter specify the value of the character or specify the tag name DATA member and element of the character For example This is OK This is not OK stringl DATA 0 65 stringl DATA 0 A stringl DATA 0 string2 DATA 0 stringl string2 To add or insert a string of characters to a string tag use either of these ASCII string instructions To Use This Instruction add characters to the end of a string CONCAT insert characters into a string INSERT Expressions An expression is a tag name equation or comparison To write an expression use any of the following e tag name that stores the value variable e number that you enter directly into the expression immediate value e functions such as ABS TRUNC e operators such as lt gt And Or As you write expressions follow these general rules e Use any combination of upper case and lower case letter For example these three variations of AND are acceptable AND And and e For more complex requirements use parentheses to group expressions within expressions This makes the whole expression easier to read and ensures that the expression executes in the desired sequence See Determine the order of execution on page 669 Publication 1756 RMOOSI EN P January 2007 664 Structured Text Programming In structured text you use two types of expressions BOOL expression An expression that produces either the BOOL value of 1 true or 0
456. rce 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 the masked Source differs from the Reference the rung condition out goes true for one scan When the masked Source is the same as the Reference the rung condition out is false ATTENTION A Publication 1756 RMOOSI EN P January 2007 Online programming with this instruction can be dangerous If the Reference value is different than the Source value the rung condition out goes true Use caution if you insert this instruction when the processor is in Run or Remote Run mode Special Instructions FBC DDT DTR PID 497 Enter 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 162 hexadecimal for example 16 0FOF 0f octal for example 8216 2 binary for example 2 00110011 Arithmetic Status Flags not affected Fault Conditions none Execution Condition Relay Ladder Action prescan The Reference Source AND Mask The rung condition out is set to false rung condition in is false The Reference Source AND Mask The rung condition out is set to false rung condition in is true reference is set equal to masked source masked source reference rung condition out is set to false
457. rceB REAL Value to test against SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition out for the relay ladder LES instruction Description The LES instruction tests whether Source A is less than Source B When you compare strings e The hexadecimal values of the characters determine if one string is less than or greater than another string For the hex code of a character see the back cover of this manual e When the two strings are sorted as in a telephone directory the order of the strings determines which one is greater ASCII Characters Hex Codes 1ab 31 61 62 LA a Tb 31862 e r A 41 S e S a AB 41 42 AB B e t al B 42 4 r a 61 a gt B Y ab 61 62 Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 230 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Execution Relay Ladder Condition Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true rung condition out is set to true Source A lt Source B rung condition out is set to false Y postscan The rung condition out is set to false
458. reak 475 BRK instruction 475 BSL instruction 388 BSR instruction 392 BTD instruction 293 BTDT instruction 296 BXOR 325 C cache connection 170 CASE 675 clear 299 CLR instruction 299 CMP instruction 207 comments Publication 1756 RMOOSI EN P January 2007 structured text 687 common attributes 635 converting data types 635 immediate values 635 compare 207 compare instructions CMP 207 EQU 212 expression format 210 355 GEO 216 GRT 220 introduction 205 LEO 224 LES 228 LIM 232 MEQ 238 NEO 243 order of operation 210 356 valid operators 209 355 COMPARE structure 481 489 compute 249 compute instructions ABS 279 ADD 253 CPT 249 DIV 263 expression format 251 347 introduction 247 MOD 268 MUL 260 NEG 276 order of operation 252 348 SOR 272 SUB 257 valid operators 251 347 CONCAT instruction 608 configuring 155 MSG instruction 155 PID instruction 505 connection cache 170 connector function block diagram 641 construct structured text 671 CONTROL structure 338 349 369 373 378 388 392 397 403 408 409 415 422 426 430 control structure 450 CONTROLLER object 177 CONTROLLERDEVICE object 177 conversion instructions DEG 556 FRD 565 introduction 555 RAD 559 TOD 562 TRN 567 convert to BCD 562 convert to integer 565 converting data types 635 COP instruction 358 copy 358 COS instruction 525 cosine 525 count down 127 count up 123 count up down 131 counter in
459. receive only one request to go to Auto every time the pushbutton is pressed When the TIC101AutoReq Pushbutton is pressed one shot latch ProgAutoReq for the PIDE instruction TIC101 TIC101 has been configured with the ProgValueReset input set so when the PIDE instruction executes it automatically clears ProgAutoReq Publication 1756 RMOOSI EN P January 2007 TiCi 1A amp utoReqPB TIC1 TAutoRegPB neShot TIC101 Prog amp utoReq p NS Appendix C Structured Text Programming Introduction This appendix describes issues that are unique with structured text programming Review the information in this appendix to make sure you understand how your structured text programming will execute For Information About See Page Structured Text Syntax 659 Assignments 661 Expressions 663 Instructions 670 Constructs 671 Comments 687 Structured Text Syntax Structured text is a textual programming language that uses statements to define what to execute e Structured text is not case sensitive e Use tabs and carriage returns separate lines to make your structured text easier to read They have no effect on the execution of the structured text Structured text is not case sensitive Structured text can contain these components Term Definition Examples assignment Use an assignment statement to assign values to tags tag expression see page 661 The operator is the assignment operator n n Terminate
460. red Enableln is set The instruction executes EnableOut is set postscan Publication 1756 RMOOSI EN P January 2007 No action taken Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 267 Example 1 Divide 7oat value 1 by float value 2 and place the result in divide result Relay Ladder DIV Divide Source float value 1 Source B float value 2 00 Dest divide result 00 Structured Text divide result float value 1 float value 2 Function Block DIV 02 DIV mi Divide 0 0 float_value_1 float_value_2 C SourceA Dest D divide_result C SourceB Example 2 The DIV and MOV instructions work together to divide two integers round the result and place the result in an integer tag e The DIV instruction divides dint a by dint b e To round the result the Destination is a REAL tag If the destination was an integer tag SINT INT or DINT the instruction would truncate the result e The MOV instruction moves the rounded result real temp from the DIV to divide result rounded e Since divide result rounded is a DINT tag the value from real temp is rounded and placed in the DINT destination Relay Ladder DIY MOY Divide Move Source dint_a Source real temp 5e 1 6666666 Source B dint_b Dest divide result rounded 3e 2 Dest real temp 1 6666666 Publi
461. red tex BTW 140 relay ladder ALM process control structured text Message structured text 2 gus BXOR 325 structured text ALMA 47 relay ladder Boolean Exclusive OR function block tured Analog Alarm funem b n CLR 296 relay ladder Clear structured text ALMD 31 relay ladder Digital Alarm structured tex CMP 207 relay ladder unction bloc Compare AND 305 relay ladder CONCAT 608 relay ladder Bitwise AND iei 5d String Concatenate structured text COP 358 relay ladder ARD 987 relay ladder Copy File structured text ASCII Read structured tex COS 525 relay ladder ARL 591 relay ladder Cosine tr ctured text ASCII Read Line structured tex function block ASN 532 relay ladder CPS 358 relay ladder Arc Sine ded Synchronous Copy File structured text ATN 540 relay ladder at 74 249 relay ladder Arc Tangent structured tex p function block CTD 127 relay ladder AVE 368 relay ladder Count Down File Average CTU 123 relay ladder AWA 595 relay ladder Count Up ASCII Write Append ipei CTUD 131 structured text AWT 600 relay ladder Count Up Down function block i tructured text RAPIT eure D2SD process control structured text BAND 319 structured text Discrete 2 State Device function block Boolean AND function block Publication 1756 RMOOSI EN P January 2007 Instruction Locator 25
462. rence array and records the bit number of each mismatch in the Result array You must test and confirm that the instruction doesn t change data that you don t want it to change The FBC instruction operates on contiguous memory In some cases the instruction searches or writes past the array into other members of the tag This happens if a length is too big and the tag is a user defined data type 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 Publication 1756 RMOOSI EN P January 2007 482 Special Instructions FBC DDT DTR PID Selecting 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 rung condition in 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 Clear the IN bit in the compare CONTROL structure Each time the rung condition in goes from false to true the FSC instruction searches for all mismatches between the Source and Reference arrays Arithmetic Status Flags not affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Co
463. rescan The rung condition out is set to false Action All operator requests timestamps and delivery flags are cleared All alarm conditions are set to OutOfAlarm and Acknowledged instruction first scan No action taken instruction first run No action taken Enableln is cleared Enableln is set postscan The instruction does not execute EnableOut is cleared The instruction executes EnableOut is set No action taken Analog Alarm Instruction ALMA 65 Analog State Timing Diagrams In Alarm Services HHInAlarm HInAlarm Lin Alarm LLInAlarm HHAcked HAcked LAcked LLAcked ProgAckAll OperAckAll These timing diagrams show the sequence of bit operations in a typical system configuration Alarm Level Condition Acknowledge Required Ack Request Alarm Condition HH Condition In Time t11 Ack Request Alarm condition Condition In Time HH 7 Ack Request imatarm SubeCondition H Condition In Time tr THA in Alar HinAlarm Lindlarm LLinAlarm HHAcked HAcked LAcked LLAcked HHinAlarmiTime UIT GUT HinAlarmTime TSS Ss 15 HSS ms ms ms H5 H5 LinAlarmTime hr on u rn n Uu i m om nm i I8 LLInAlarmTime io o o o o o jo o io o o RetToNormalTime H3 ona 3 n3 H3 43 83 13 03 3 t3 t2
464. rescan Fault Conditions none Execution Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Source A lt Source B rung condition out is set to true rung condition out is set to false Y postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan instruction first run No action taken No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 227 Example If va ue 1 is less than or equal to value 2 set light_2 If value 1 is greater than value 2 clear ligbt 2 Relay Ladder light 2 LEG Less Than or Eql amp B Source value 1 0e Source B value_2 0 Structured Text light 2 value 1 lt value 2 Function Block LEO 01 LEQ zl Less Than or Eql A lt B SourceA value 1 value 2 SourceB Publication 1756 RMOOSI EN P January 2007 228 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ Less Than LES Operands LES Less Than amp B Source
465. rface to disable the alarm The alarm instruction clears this parameter Default is cleared ProgEnable BOOL Program Enable Set by the user program to enable the alarm Takes precedence over Disable command Default is cleared OperEnable BOOL Operator Enable Set by the operator interface to enable the alarm Takes precedence over Publication 1756 RMOOSI EN P January 2007 Disable command The alarm instruction clears this parameter Default is cleared Analog Alarm Instruction ALMA 53 Input Parameter Data Type Description AlarmCountReset BOOL A False to True transition resets the alarm counts for all conditions to zero Default is cleared HHLimit REAL Specifies the high high alarm limit Valid HLimit HHLimit maximum positive float Default 0 0 HHSeverity DINT Specifies the severity of the high high alarm condition Valid 1 to 1000 1000 most severe 1 least severe Default 500 HLimit REAL Specifies the high alarm limit Valid LLimit HLimit HHLimit Default 0 0 HSeverity DINT Specifies the severity of the high alarm condition Valid 1 to 1000 1000 most severe 1 least severe Default 500 LLimit REAL Specifies the low alarm limit Valid LLLimit lt LLimit lt HLimit Default 0 0 LSeverity DINT Specifies the severity of the low alarm condition Valid 1 to 1000 1000 most severe 1 least severe Default 500 LLLimit REAL Specifies the lo
466. rial port Channel Status Decimal 29 Structured Text osri l InputBit get control line status OSRI osri 1 IF osri 1l OutputBit THEN AHL 0 0 0 serial port END IF ASCII Read ARD ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 587 The ARD instruction removes characters from the buffer and stores them in the Destination Operands Relay Ladder ARD ASCII Read ND Channel 2 Destination 7 ND SerialPort Control R SerialPort Control Length Characters Read Operand Type Format Enter Notes Channel DINT immediate 0 tag Destination string tag tag into which the e f you want to compare convert or characters are moved manipulate the characters use a string data SINT read type String data t INT e For a string data type i ee E enter the name of the e default STRING data type T e tring data type that t e Fora SINT INT or DINT e any new string data type that you create array enter the first element of the array Serial Port SERIAL PORT tag tag that controls the operation Control CONTROL Serial Port DINT immediate number of characters to e he Serial Port Control Length must be less move to the destination than or equal to the size of the Destination Control Length read e f 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
467. ription Arithmetic Status Flags Publication 1756 RMOOSI EN P January 2007 IF sfp en e THEN SFP normal executing sfp en e 0 END IF The SFR instruction resets the execution of a SFC routine at a specified step Relay Ladder Operands Operand Type Format Description SFCRoutine ROUTINE name SFC routine to reset Name Step Name SFC STEP tag target step where to resume execution Structured Text The operands are the same as those for the relay ladder SFR instruction When the SFR instruction is enabled e In the specified SFC routine all stored actions stop executing reset e The SFC begins executing at the specified step If the target step is 0 the chart will be reset to its initial step The Logix implementation of the SFR instruction differs from that in a PLC 5 controller In the PLC 5 controller the SFR executed when the rung condition was 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 not affected Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 465 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 do
468. rke eee a eS 3 518 Controla Riti ea Ragan ta beet a exe Reo rae tens 519 PID TREO 22 egre Loop e Redde taka Roo edo 520 PID Processa oe emu So ees EE URP Y 520 PID Process With Master slave Loops 520 Chapter 15 Tntrod c onm a o Yu ats woe OA os RE AURI CT e 521 SITS SCS TIN oe etiem oer le Lo INA ND De UEM Tat 522 Cose OD Sex eos eS ped R556 ROLES ES PETES RS 525 Tangent CIAN Au eque se aed de od cede S teed EPEE 529 Arc Sine ASN ede as st sch vob gee ocd he son Nob OO Eo ke ede 532 Ate Cosine LAGOS hea ee EV eee Pee texted 536 Arc Tangent ATN S uu Rend tdi Or OD of A enh nk 540 Chapter 16 Ttt FO CHE Lus Ju v Rue eoa VE VIELES Se ER ye 545 Natural Log ONY oseaan ia Este Lexi S oT cz ee Vs 546 Log Base TO LOG e cese ceris E49 tuppa Y deine E Oboe os 549 X to the Power Of Y XPY 2 dpa Qu mue eS Peo Ge eds 552 Chapter 17 TULROGERCTIOBR acre ita acte dise m oy aa iy AERE NE RA ure Ra AR 555 Destees ORG S o serae RIA eosin Ree ei PS 556 Radians CD atu sed her eee odes et 559 Convert to BCD TOD s eser cba uS 562 Convert to Integer FRD 4 A eed cu ed Vo EE TRU 565 Truncate TRN Vased eu pare gn OE Mb E ut En 567 Chapter 18 SEMEN OED cho 2 deae d dao Eee Eh ede Se Qon ade Pad 571 Instruction Execution lees 572 ASCIHL EtrOBGQUGES ws sre eX ee eas Prieta ES 574 String Data Types aor Ra e ce ep t dd 574 ASCII Test For Buffer Line ABL 0 0 575 ASCII Chars in Buffer ACB wn tpa qe e DTE
469. rmation on the syntax of assignments and expressions within structured text When the OTE instruction is enabled the controller sets the data bit When the OTE instruction is disabled the controller clears the data bit not affected none Relay Ladder Action The data bit is cleared The rung condition out is set to false rung condition in is false rung condition in is true The data bit is cleared The rung condition out is set to false The data bit is set The rung condition out is set to true postscan Publication 1756 RMOOSI EN P January 2007 The data bit is cleared The rung condition out is set to false Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 75 Example When switch is set the OTE instruction sets turns on light_1 When switch is cleared the OTE instruction clears turns off igbt 1 Relay Ladder switch light_1 Structured Text light_1 switch Publication 1756 RMOOSI EN P January 2007 76 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Output Latch OTL Operands a j Description Arithmetic Status Flags Fault Conditions Execution Condition prescan The OTL instruction sets latches the data bit Relay Ladder Operand Type Format Description data bit BOOL tag bit to be set Structured Text Structured text does not have an OTL instruction but you can achieve the same results using an
470. rn par RET ReturnPar Description Description data from this routine that you want to copy Relay Ladder Operand Type Format Return BOOL immediate parameter SINT tag INT array tag DINT REAL structure Structured Text to the corresponding return parameter in the JSR instruction The operands are the same as those for the relay ladder RET instruction Function Block RET Return Parameters 8 The operands are the same as those for the relay ladder RET instruction The JSR instruction initiates the execution of the specified routine which is referred to as a subroutine e The subroutine executes one time e After the subroutine executes logic execution returns to the routine that contains the JSR instruction Publication 1756 RMOOSI EN P January 2007 442 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT JSR 1 If you want to copy data to a tag in the subroutine enter an input parameter 2 If you want to copy a result of the subroutine to a tag in this routine enter a return parameter 3 Enter as many input and return parameters as you need Publication 1756 RMOOSI EN P January 2007 To program a jump to a subroutine follow these guidelines IMPORTANT Do not use a JSR instruction to call execute the main routine e You can put a JSR instruction in the main routine or any other
471. rol 1 pos p MOV Move Source 1 Dest control 1 pos p Publication 1756 RMOOSI EN P January 2007 426 Sequencer Instructions SQI SQO SQL Sequencer Output SQO The SQO instruction sets output conditions for the next step of a sequence pair of SQO SQI instructions Operands Relay Ladder l sao RET Output EN2 Operand Type Format Description at DN2 Array DINT array tag sequencer array Jest poe specify the first element of the sequencer Position array do not use CONTROL POS in the subscript Mask SINT tag which bits to block or pass INT immediate DINT A SINT or INT tag converts to a DINT value by sign extension Destination DINT tag output data from the sequencer array Control CONTROL tag control structure for the operation typically use the same CONTROL as the SQI and SQL instructions Length DINT immediate number of elements in the Array sequencer table to output Position DINT immediate current position in the array initial value is typically 0 CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the SOO instruction is enabled DN BOOL The done bit is set when all the specified elements have been moved to the Destination ER BOOL The error bit is set when LEN lt 0 POS lt 0 or POS gt LEN LEN DINT The length specifies the number of steps in the sequencer array POS DINT The position identifies the element that the controller is curr
472. routine e If you use a JSR instruction to call the main routine and then put a RET instruction in the main routine a major fault occurs type 4 code 31 The following diagram illustrates how the instructions operate Calling Routine Subroutine 2n 1 If the JSR instruction has an input SBR parameter enter an SBR instruction JSR 2 Place the SBR instruction as the first instruction in the routine 3 For each input parameter in the JSR instruction enter the tag into which 42974 RET 1 If the JSR instruction has a return parameter enter an RET instruction 2 Place the RET instruction as the last instruction in the routine 3 For each return parameter in the JSR instruction enter a return parameter to send to the JSR instruction 4 In a ladder routine place additional RET instructions to exit the subroutine based on different input conditions if required Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 443 There are no restrictions other than controller memory on the number of nested routines you can have or the number of parameters you pass or return level 1 level 2 level 3 main routine oM m SBR C SBR C SBR O JSR action_2 action_3 JSR JSR RET RET RET
473. rray position average 2 END_FOR destination SQRT sum length 1 See Appendix B for information on the syntax of constructs within structured text Description The standard deviation is calculated according to this formula N 2 Y Cesari Z AVE Standard Deviation i d NZI Where e start dimension to vary subscript of the array operand e x variable element in the array e N number of specified elements in the array eAVE N gt start i i 1 N 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 Publication 1756 RMOOSI EN P January 2007 380 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code POS lt 0 or LEN lt 0 4 21 Dimension to vary does not exist for the 4 20 specified array Publication 1756 RMOOSI EN P January 2007 Condition prescan Execution Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 381 Relay Ladder Action The EN bit is cleared The DN bit is cleared The ER bit is cleared The rung condition out is set to false rung condition in is false examine DN bit DN bit 1 EN bit is cleared ER bit is cleared DN bit
474. rs and underscores _ Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 437 Arithmetic Status Flags not affected Fault Conditions A Major Fault Will Occur If Fault Type Fault Code label does not exist 4 42 Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The rung condition out is set to true Execution jumps to the rung that contains the LBL instruction with the referenced label name postscan The rung condition out is set to false Example When the JMP instruction is enabled execution jumps over successive rungs of logic until it reaches the rung that contains the LBL instruction with abel 20 label 20 IMPS other rungs of code label_20 LBL J Publication 1756 RMOOSI EN P January 2007 438 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Jump to Subroutine JSR Subroutine SBR Return RET JSR Operands JSR Jump to Subroutine Routine name Input par Return par Publication 1756 RMOOSI EN P January 2007 The JSR instruction jumps execution to a different routine The SBR and RET instructions are optional instructions that exchange data with the JSR instruction Relay Ladder Operand Type Format Description Routine R
475. ruction Structured Text CTUD_01 Preset 500 CTUD_01 Reset Restart CTUD_O1 CUEnable limit switchl CTUD CTUD 01 counter state CTUD 01 DN Function Block Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 135 CTUD 02 CTUD Count Up Down 0 limit switch1 a CUEnable CDEnable C aie aa Publication 1756 RMOOSI EN P January 2007 136 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Reset RES The RES instruction resets a TIMER COUNTER or CONTROL structure Operands Relay Ladder CRES SH Operand Type Format Description structure TIMER tag structure to reset CONTROL COUNTER Description When enabled the RES instruction clears these elements When Using a Res The Instruction Clears Instruction For a TIMER ACC value control status bits COUNTER ACC value control status bits CONTROL POS value control status bits Because the RES instruction clears the ACC value DN bit and TT bit do not use the RES instruction to reset a TOF timer Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 137 Execution Condition Relay Ladder Action prescan Th
476. ructions 4 The controller writes outputs in OREFs 5 f the routine contains an RET instruction the controller executes the RET instruction last postscan The subroutine is called If the routine is an SFC routine the routine in initialized the same as it is during prescan Publication 1756 RMOOSI EN P January 2007 446 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT Example 1 The JSR instruction passes value 1 and value 2 to routine 1 The SBR instruction receives value 1 and value 2 from the JSR instruction and copies those values to value a and value b respectively Logic execution continues in this routine The RET instruction sends float_a to the JSR instruction The JSR instruction receives float a and copies the value to float value 1 Logic execution continues with the next instruction following the JSR instruction Relay Ladder Routine Program Main routine JSR Jump to Subroutine Routine name routine 1 Input par value 1 Input par value 2 Return par float value 1 Subroutine SBR Subroutine Input par value a Input par value b other rungs of code RET Return Return par float_a Structured Text Routine Program Main routine JSR routine 1 2 value 1l value 2 float value 1 Subroutine SBR value a value b statements RET float a Publication 1756 RMOOSI EN P January 2007
477. ructions FBC DDT DTR PID on an unwinder spool require loop updates as fast as every 10 milliseconds 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 Relay Ladder Publication 1756 RMOOSI EN P January 2007 PID Proportional Integral Derivative PID TiC101 yt Process variable Local 0 ChOData Tieback Local 0 l Ch1Data Control variable Local 1 0 Ch4Data PID Master Loop D Inhold bit Local 1 1 Ch4InHold Inhold Yalue Local 1 1 Ch4Data Setpoint 0 0 Process Variable 0 0 Output 0 0 Structured Text PID TIC101 Local 0 I ChOData Local 0 I ChlData jocal 1 0 Ch4Data 0 Local 1 I Ch4InHold jocal 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 ten 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
478. ructions sets the appropriate bit in Status and the timer does not execute Valid 0 to maximum positive integer Reset BOOL Output Parameter Data Type Request to reset the timer When set the timer resets Default is cleared 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 Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 115 Input Parameter Data Type Description 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 TOFR instruction accumulates time until the timer accumulated value ACC e TOFR instruction is disabled e ACC 2 PRE The time base is always 1 msec For example for a 2 second timer enter 2000 for the PRE value TimerEnable enable bit EN timer timing bit TT timer done bit DN OFF delay preset 4 PRSE
479. ry you can increase the efficiency of your programs by e using the same data type throughout the instruction e minimizing the use of the SINT or INT data types In other words use all DINT tags or all REAL tags along with immediate values in your instructions The following sections explain how the data is converted when you use SINT or INT tags or when you mix data types Publication 1756 RMOOSI EN P January 2007 Common Attributes 637 SINT or INT to DINT For those instructions that convert SINT or INT values to DINT values the Operands sections in this manual identify the conversion method This Conversion Method Converts Data By Placing Sign extension the value of the left most bit the sign of the value into each bit position to the left of the existing bits until there are 32 bits Zero fill zeroes to the left of the existing bits until there are 32 bits The following example shows the results of converting a value using sign extension and zero fill This value 2 1111 1111 1111 1111 1 Converts to this 2 1111_1111_1111_1111_1111_1111_1111_1111 1 value by sign extension Converts to this 2 0000_0000_0000_0000_1111_1111_1111_1111 65535 value by zero fill Because immediate values are always zero filled the conversion of a SINT or INT value may produce unexpected results In the following example the comparison is false because Source A an INT converts by sign extension while Sour
480. ry 2007 594 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Relay Ladder MV line EN ABL ASCII Test For Buffer Line EN Channel 0 DND SerialPort Control MV line EFD Character Count 0 MV line FD ASCII Read Line Channel Destination SerialPort Control SerialPort Control Length Characters Read Structured Text ABL 0 MV line osri l InputBit MVLine FD OSRI osri 1 IF osri l OutputBit THEN mv read LEN 12 ARL 0 MV msg MV read END IF Publication 1756 RMOOSI EN P January 2007 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 595 ASCII Write Append AWA The AWA instruction sends a specified number of characters of the Source tag to a serial device and appends either one or two predefined characters Operands Relay Ladder AWA ASCII Write Append ND Channel Source ND SerialPort Control R SerialPort Control Length Characters Sent 7 Operand Type Format Enter Notes Channel DINT immediate 0 tag Source string tag tag that contains the e f you want to compare convert or characters to send manipulate the characters use a string data SINT type e Fora string data type e String data types are INT enter the name of the tag e default STRING data type DINT e For a SINT INT DINT e any new string data type that you create array enter the first element of the array Serial
481. s CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Condition prescan Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true Destination Source The rung condition out is set to true postscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set postscan The instruction executes EnableOut is set No action taken Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 215 Example Calculate the square root of value 1 and place the result in sqr result Relay Ladder QR Square Root Source value 1 Dest sqr result 0 0 Structured Text sgr result SQRT value 1 Function Block sqr result 0 Publication 1756 RMOOSI EN P January 2007 276 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Negate NEG The NEG instruction changes the sign of the Source and places the result in the Destination Operands Relay Ladder NEG Negate Source Operand Type Format Description k Source SINT immediate value to negate INT tag DINT REAL A S
482. s between task and buffer Serial Port rai Buffer Each ASCII serial port instruction except ACL uses a SERIAL PORT CONTROL structure to perform the following functions e control the execution of the instruction e provide status information about the instruction ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT 573 The following timing diagram depicts the changes in the status bits as an ABL instruction tests the buffer for termination characters scan scan scan scan Y Y Y Y rung condition in false true false true false EN of on off on off EU of on RN of on of on of DN or ER of on off on FD of on off on EM of on off on enters queue resets status bits when scanned and DN or ER are set sets the EM bit executes in this example finds termination characters The ASCII queue holds up to 16 instructions When the queue is full an instruction tries to enter the queue on each subsequent scan of the instruction as depicted below scan scan scan scan rung condition in false true false EN off on EU off on attempts to enter queue but queue is full enters queue Publication 1756 RMOOSI EN P January 2007 574 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT ASCII Error Codes If an ASCII serial p
483. s not affected Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 107 Fault Conditions A Major Fault Will Occur If Fault Type Fault Code PRE 0 4 34 ACC lt 0 4 34 Publication 1756 RMOOSI EN P January 2007 108 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Execution Condition Relay Ladder Action The EN TT and DN bits are cleared prescan rung condition in is false The ACC value is not modified The rung condition out is set to false The EN and TT bits are cleared The DN bit is not modified The ACC value is not modified The rung condition out is set to false rung condition in is true Y examine DN bit DN bit 0 examine EN bit DN bit 1 EN bit is set TT bit is set TT bit is set ACC ACC current time last time ACC value rolls over ACC 2 147 483 647 examine ACC ACC lt PRE ACC gt PRE Y IT bit is DN is se cleared rung condition out is set to postscan Publication 1756 RMOOSI EN P January 2007 The rung condition out is set to false Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 109 Example When imit_switch_1 is set light 1
484. s the STOR converts the first set of contiguous numbers including the decimal point The instruction skips any initial control or non numeric characters Cexcept the minus sign in front of a number If the string contains multiple groups of numbers that are separated by delimiters for example the instruction converts only the first group of numbers ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER 625 Arithmetic Status Flags Arithmetic status flags are affected Fault Conditions Type Code Cause Recovery Method 4 51 The LEN value of the string tag is greater than the DATA 1 Check that no instruction is writing to the LEN size of the string tag member of the string tag 2 In the LEN value enter the number of characters that the string contains 4 53 The output number is beyond the limits of the Either destination data type e Reduce the size of the ASCII value e Use a larger data type for the destination Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes na Enableln is ste The rung condition out is set to true na Enableln is always set The instruction executes instruction execution S C is set Destination is cleared The instruction converts the Source
485. s true 1 false 0 Use the following logical operators For Use This Operator Data Type logical AND amp AND BOOL logical OR OR BOOL logical exclusive OR XOR BOOL logical complement NOT BOOL For example Example For This Situation You d Write BOOLtag If photoeye is a BOOL tag and your specification IF photoeye THEN says If photoeye is on then NOT BOOLtag If photoeye is a BOOL tag and your specification IF NOT photoeye THEN says If photoeye is off then expressioni1 amp expression2 If photoeye is a BOOL tag tempis a DINT tag IF photoeye amp temp lt 100 and your specification says If photoeye ison THEN and temp is less than 100 then expressioni ORexpression2 If photoeye is a BOOL tag temp is a DINT tag IF photoeye OR temp lt 100 and your specification says If photoeye ison THEN or temp is less than 100 then expressionl X0Rexpression2 If photoeye and photoeye2 are BOOL tags and your specification says If IF photoeyel XOR photoeye2 THEN e photoeyet is on while photoeyeZ is off or e photoeyel is off while photoeye2 is on BOOLtag expressionl amp expression2 Publication 1756 RMOOSI EN P January 2007 then If photoeye1 and photoeye2 are BOOL tags open photoeyel amp openis a BOOL tag and your specification says photoeye2 f photoeyel and photoeye2 are both on set open to true
486. s Flags Fault Conditions Execution Condition prescan rung condition in is false Valid any float Description The instruction produced a valid result Result of the math instruction Arithmetic status flags are set for this output The ADD instruction adds Source A to Source B and places the result in the Destination Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false The rung condition out is set to false rung condition in is true Destination Source A Source B The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Condition prescan Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 255 Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 256 X Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Example Add float_value_1 to float_value_2 and place the result in add_result Relay Ladder ADD Add Source float value 1 00 Source B float value 2 00 Dest add result 00E Str
487. s of derivative gain Ky gt 10 for example To disable derivative smoothing select the No derivative smoothing option on the Configuration tab or set the NDF bit in the PID structure Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 517 Set the deadband 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 lets you 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 deadband setpoint error within deadband range deadband time 41026 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 will not change 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 You can use the deadband without the zero crossing feature by selecting the no zero crossing for deadband option on the Configuration tab or set the NOZC bit in the PID structure
488. s set to true goto om m page 14 494 Publication 1756 RMOOSI EN P January 2007 494 Special Instructions FBC DDT DTR PID Condition compare POS gt compare LEN Source compare POS eference compare POS Relay Ladder Action compare POS compare LEN compare FD bit is set reference compare POS compare POS compare POS 1 goto exit page 14 493 result DN 1 examine result DN bit result DN 0 q result DN bit is cleared result POS lt 0 yes result POS gt size of result array result result POS compare POS Y result POS gt result LEN result DN bit is set Y compare ER bit is set Y goto exit page postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Special Instructions FBC DDT DTR PID 495 Example When enabled the DDT instruction compares the source array dint1 to the reference array dint2 and stores the locations of any mismatches in the result array dint3 The controller also changes the mismatched bits in the reference array dint2 to match the source array dint1 DDT Diagnostic Detect N Source array_dint1 0 DN 5 Reference array dint2 0 FD Result array_dint3 0 IN 5 Cmp Control control_1 R Lenath 10 P
489. same value even if an OREF obtains a different tag value during execution of the routine In this example if tagA has a value of 25 4 when the routine starts executing this scan and Block 01 changes the value of tagA to 50 9 the second IREF wired into Block 02 will still use a value of 25 4 when Block 02 executes this scan The new tagA value of 50 9 will not be used by any IREFs in this routine until the start of the next scan Block 04 Block 02 Publication 1756 RMOOSI EN P January 2007 644 Function Block Attributes Order of Execution Publication 1756 RMOOSI EN P January 2007 The RSLogix 5000 programming software automatically determines the order of execution for the function blocks in a routine when you e verify a function block routine e verify a project that contains a function block routine e download a project that contains a function block routine You define execution order by wiring function blocks together and indicating the data flow of any feedback wires if necessary If function blocks are not wired together it does not matter which block executes first There is no data flow between the blocks If you wire the blocks sequentially the execution order moves from input to output The inputs of a block require data to be available before the controller can execute that block For example block 2 has to execute before block 3 because the outputs of block 2 feed the inputs of bl
490. scribed 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 ACS ASN ATN COS DEG FRD LN LOG RAD SIN SQR TAN TOD TRN 3 2 4 negate NOT 5 MOD 6 subtract 7 AND 8 XOR 9 OR File Search and Compare FSC Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 349 The FSC instruction compares values in an array element by element Arithmetic Status Flags Fault Conditions Operands Relay Ladder FSC OPE Fio aN CONOR EN Operand Type Format Description Control DN Control CONTROL tag control structure for the operation Length ER Position Length DINT immediate number of elements in the array to Mode be manipulated Expression Position DINT immediate offset into array initial value is typically 0 CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that 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 JN BOOL The inhibit bit indicates that the FSC instruction detected a true comparison You mu
491. set postscan No action taken Example Subtract float_value_2 from float value 1 and place the result in subtract result Relay Ladder SUB Subtract Source float value 1 00 Source B float value 2 00 Dest subtract result 0 0 Structured Text subtract result float value 1 float value 2 Function Block SUB 01 SUB Subtract 0 0 0 0 C SourceA float value 1 float value 2 D subtract result C SourceB Publication 1756 RMOOSI EN P January 2007 260 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Multiply MUL The MUL instruction multiplies Source A with Source B and places the result in the Destination Operands Relay Ladder MUL play tande Multiply Source A Operand Type Format Description Source D 4 Source A SINT immediate value of the multiplicand Dest E INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Source B SINT immediate value of the multiplier INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest sourceA sourceB Use the multiply sign as an operator in an expression This expression multiplies sourceA by sourceB and stores the result in dest See Appendix B for information on the syntax of expressions within structured text MU
492. sing 24 significant bits DINT to SINT or INT To convert a DINT value to a SINT or INT value the controller truncates the upper portion of the DINT and sets the overflow status flag if necessary The following example shows the result of a DINT to SINT or INT conversion EXAMPLE Conversion of a DINT to an INT and a SINT This DINT Value Converts To This Smaller Value 16 0001_0081 65 665 INT 16 0081 129 SINT 16 81 127 Publication 1756 RMOOSI EN P January 2007 640 Common Attributes REAL to an integer To convert a REAL value to an integer value the controller rounds the fractional part and truncates the upper portion of the non fractional part If data is lost the controller sets the overflow status flag Numbers round as follows e Numbers other than x 5 round to the nearest whole number e X 5 rounds to the nearest even number The following example show the result of converting REAL values to DINT values EXAMPLE Conversion of REAL values to DINT values This REAL Value Converts To This DINT Value 2 5 2 1 6 2 1 5 2 14 1 1 4 1 1 5 2 1 6 2 2 5 2 IMPORTANT The arithmetic status flags are set based on the value being stored Instructions that normally do not affect arithmetic status keywords might appear to do so if type conversion occurs because of mixed data types for the instruction parameters The type conversion process sets the arithmetic status ke
493. sor 0020 2000 Communication module not working 0030 3000 Remote node is missing disconnected or shut down 0040 4000 Processor connected but faulted hardware 0050 5000 Wrong station number 0060 6000 Requested function is not available 0070 7000 Processor is in Program mode 0080 8000 Processor s compatibility file does not exist 0090 9000 Remote node cannot buffer command 00B0 B000 Processor is downloading so it is not accessible OOFO 0001 F001 Processor incorrectly converted the address OOFO 0002 F002 Incomplete address OOFO 0003 F003 Incorrect address OOFO 0004 F004 Illegal address format symbol not found OOFO 0005 F005 Illegal address format symbol has 0 or greater than the maximum number of characters supported by the device OOFO 0006 F006 Address file does not exist in target processor OOFO 0007 F007 Destination file is too small for the number of words requested OOFO 0008 F008 Cannot complete request Situation changed during multipacket operation Publication 1756 RMOOSI EN P January 2007 PLC and SLC Error Codes hex Continued Input Output Instructions MSG GSV SSV IOT 153 R9 x And Earlier R10 x And Later Description ERR EXERR ERR EXERR OOFO 0009 F009 Data or file is too large Memory unavailable OOFO 000A FOOA Target processor cannot put requested information in packets OOFO 000B FOOB Privilege error access denied OOFO 000C FOOC Requested function is no
494. st INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest RAD source Use RAD as a function This function converts source to radians and stores the result in dest See Appendix B for information on the syntax of expressions within structured text RAD 04 Function Block Degrees To Radians Operand Type Format Description RAD tag FBD_MATH_ADVANCED structure RAD structure Dest D Publication 1756 RMOOSI EN P January 2007 560 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC FBD MATH ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Input to the conversion instruction Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the conversion instruction Arithmetic status flags are set for this output Description The RAD instruction uses this algorithm Arithmetic Status Flags Fault Conditions Condition prescan Execution Source 2 180 where m 3 141593 Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The controller converts the Source to radians and p
495. st clear this bitto continue the search operation FD BOOL The found bit indicates that 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 FSC instruction is enabled and the comparison is true the instruction sets the FD bit and the POS bit reflects the array position where the instruction found the true comparison The instruction sets the IN bit to prevent further searching Arithmetic status flags are affected A Major Fault Will Occur If Fault Type Fault Code POS lt 0 or LEN lt 0 4 21 Publication 1756 RMOOSI EN P January 2007 350 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Execution Condition prescan Relay Ladder Action The rung condition out is set to false rung condition in is false DN bit 0 examine DN bit J 9 INC mode e internal bit is cleared Y rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 DN bit yes EN bit is cleared EN bit is cleared ALL mode ER bit is cleared yes ud es y 4 LEN 0 no mers no no POS POS 1 ves 98
496. string Source B SINT immediate value to test against Source A INT tag DINT REAL string e If you enter a SINT or INT tag the value converts to a DINT value by sign extension e String data types are default STRING data type any new string data type that you create e To test the characters of a string enter a string tag for both Source A and Source B E Structured Text IF sourceA sourceB THEN Use adjacent greater than and equal signs gt as an operator within statements an expression This expression evaluates whether sourceA is greater than or equal to sourceB See Appendix for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 GEQ 01 m Grtr Than or Eql A gt B O Sources C SourceB Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ 217 Function Block Operand Type Format Description GEQ tag FBD_COMPARE structure GEQ structure FBD_COMPARE Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA REAL Value to test against SourceB Valid any float SourceB REAL Value to test against SourceA Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition
497. struction is executed multiple times during a task e task is running and the task scan rate or the sample time of the process input changes e user changes the time base mode while the task is running Order parameter is changed on a filter block while the task is running Changing the Order parameter selects a different control algorithm within the instruction Publication 1756 RMOOSI EN P January 2007 652 Function Block Attributes Input Parameter Data Type TimingMode DINT OversampleDT REAL Publication 1756 RMOOSI EN P January 2007 Common instruction parameters for timing modes The instructions that support time base modes have these input and output parameters Input parameters Description Selects timing execution mode Value Description 0 periodic mode 1 oversample mode 2 real time sampling mode valid 0 to 2 default 0 When TimingMode 0 and task is periodic periodic timing is enabled and DeltaT is set to the task scan rate When TimingMode 0 and task is event or continuous periodic timing is enabled and DeltaT is set equal to the elapsed time span since the last time the instruction was executed When TimingMode 1 oversample timing is enabled and DeltaT is set to the value of the OversampleDT parameter When TimingMode 2 real time sampling timing is enabled and DeltaT is the difference between the current and previous time stamp values read from the module associated with the inp
498. structions CTD 127 CTU 123 CTUD 131 introduction 95 RES 136 COUNTER structure 123 127 CPS instruction 358 CPT instruction 249 CST object 181 CTD instruction 127 CTU instruction 123 CTUD instruction 131 D data transitional 496 DDT instruction operands 488 search mode 490 deadband 517 DEG instruction 556 degree 556 DELETE instruction 610 description structured text 687 DF1 object 182 diagnostic detect 488 digital alarm 31 DINT to String 626 DIV instruction 263 division 263 document structured text 687 DTOS instruction 626 Index 693 DTR instruction 496 E elements SIZE instruction 384 end of transition instruction 460 EOT instruction 460 EQU instruction 212 equal to 212 error codes ASCII 574 MSG instruction 148 EVENT instruction 466 event task configure 194 trigger via consumed tag 200 trigger via EVENT instruction 466 examine if open 72 execution order 644 exponential 552 expression BOOL expression structured text 663 numeric expression structured text 663 order of execution structured text 669 structured text arithmetic operators 665 bitwise operators 669 functions 665 logical operators 668 overview 663 relational operators 666 expressions format 210 251 347 355 order of operation 210 252 348 356 valid operators 209 251 347 355 F FAL instruction mode of operation 332 operands 337 FAULTLOG object 185 FBC instruction operands 480 search mode 482 FBD BIT FIELD DISTRIBUTE structur
499. structured text function block Take the tangent of a value TAN relay ladder 529 structured text function block Take the arc sine of a value ASN relay ladder 532 ASIN structured text function block Take the arc cosine of a value ACS relay ladder 536 Acos structured text function block Take the arc tangent of a value ATN relay ladder 540 ATAN structured text function block 1 Structured text only Publication 1756 RMOOSI EN P January 2007 522 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Sine SIN Operands SIN Source Dest dest SIN source Publication 1756 RMOOSI EN P January 2007 You can mix data types but loss of accuracy and rounding error might occur and the instruction takes more time to execute Check the overflow status bit S V to see whether the result was truncated For relay ladder instructions 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 The SIN instruction takes the sine of the Source value in radians and stores the result in the Destination Relay Ladder Source SINT immediate find the sine of this value INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text Use SIN as a function This function com
500. stscan The rung condition out is set to false Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 271 Example Divide dividend by divisor and place the remainder in remainder In this example three goes into 10 three times with a remainder of one Relay Ladder Bap Madulo Saure dividend 1 Source B divisor 3 Dest remainder 1 Structured Text remainder dividend MOD divisor Function Block MOD 01 MOD Modulo dividend SourceA remainder C SourceB divisor Publication 1756 RMOOSI EN P January 2007 272 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Square Root SOR The SQR instruction computes the square root of the Source and places the result in the Destination Operands Relay Ladder SOR Square Root hune PS r Operand Type Format Description Dest Source SINT immediate find the square root of this value INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest S RT source Use SQRT as a function This expression computes the sq
501. t bemchbes Operand Type Format Enter END IF bool BOOL tag BOOL tag or expression that evaluates to expression a BOOL value BOOL expression expression Description The syntax is IF bool expressioni THEN statement gt a Statements to execute when bool expression is true statements to execute when bool expressionZ is true optional optional 4 statements to execute when both expressions are false END IF To use ELSIF or ELSE follow these guidelines 1 To select from several possible groups of statements add one or more ELSIF statements e Each ELSIF represents an alternative path e Specify as many ELSIF paths as you need e The controller executes the first true IF or ELSIF and skips the rest of the ELSIFs and the ELSE 2 To do something when all of the IF or ELSIF conditions are false add an ELSE statement Publication 1756 RMOOSI EN P January 2007 Structured Text Programming 673 The following table summarizes different combinations of IF THEN ELSIF and ELSE If You Want To And Use This Construct do something if or when conditions do nothing if conditions are false IF THEN are true do something else if conditions are false IF THEN ELSE choose from alternative statements do nothing if conditions are false IF THEN ELSIF i oo pasedon n default statements if al IF THEN ELSIF ELSE p conditions are false Arithmetic Status Flags not affect
502. t 5 00000 p 55595 00000 00000 control_1 pos 6 00000 00000 00000 00000 00000 00000 Publication 1756 RMOOSI EN P January 2007 414 Array File Shift Instructions BSL BSR FFL FFU LFL LFU LIFO Unload LFU Operands LFU LIFO Unload EUS LIFO DNS Dest EM Control Length Position Publication 1756 RMOOSI EN P January 2007 Relay Ladder Type Format SINT array tag INT DINT REAL string Structure The LFU instruction unloads the value at POS of the LIFO and stores 0 in that location Description LIFO to modify specify the first element of the LIFO do not use CONTROL POS in the subscript SINT tag INT DINT REAL string structure value that exits the LIFO The Destination value converts to the data type of the Destination tag A smaller integer converts to a larger integer by sign extension CONTROL tag control structure for the operation typically use the same CONTROL as the associated LFL DINT immediate maximum number of elements the LIFO can hold at one time DINT immediate next location in the LIFO where the instruction unloads data initial value is typically 0 If you use a user defined structure as the data type for the LIFO or Destination operand use the same structure for both operands Array File Shift Instructions BSL BSR FFL FFU LFL LFU 415 CONTROL Structure Mnemonic Data Type Descri
503. t Instructions MSG GSV SSV IOT 145 Where Description Where Description 1 rung condition in is true 5 message is sent EN is set ST is set EW is set EW is cleared connection is opened 2 message is sent 6 message is done or errored ST is set rung condition in is still true EW is cleared DN or ER is set ST is cleared connection is closed if EN CC 0 3 message is done or errored 7 rung condition in goes false and DN or ER is set rung condition in is false EN is cleared DN or ER is set ST is cleared connection is closed if EN CC 0 EN is cleared rung condition in is false 4 rung condition in is true DN or ER was previously set EN is set EW is set connection is opened DN or ER is cleared Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken Publication 1756 RMOOSI EN P January 2007 146 Input Output Instructions MSG GSV SSV IOT Condition Relay Ladder Action Structured Text Action rung condition in is false EN bit 1 EN bit 0 examine EN bit EW bit 1 examine EW bit EW bit 0 examine ST bit examine DN bit ER bit 1 ERbit 0 block transfer no command examine ER bit module path valid DN bit 1 module connection running examine DN bit Y DN bit z 0 EN bit is cleared execute message request
504. t Output Instructions MSG GSV SSV IOT Message MSG Operands MSG Message E et 2 Message Control le CDN I CER2 MSG MessageControl The MSG instruction asynchronously reads or writes a block of data to another module on a network Relay Ladder Operand Type Format Description Message MESSAGE tag message structure control Structured Text The operands are the same as those for the relay ladder MSG instruction MESSAGE Structure ATTENTION A IMPORTANT Publication 1756 RMOOSI EN P January 2007 If you check the status bits more than once The controller changes the DN ER EW and ST bits asynchronous to the scan of your logic 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 Do not change the following status bits of a MSG instruction e DN e EN e ER e EW e ST Do not change those bits either by themselves or as part of the FLAGS word If you do the controller may have a non recoverable fault The controller clears the project from its memory when it has a non recoverable fault Input Output Instructions MSG GSV SSV IOT 141 Mnemonic Data Description Type FLAGS INT The
505. t available OOFO 000D FOOD Request is redundant OOFO 000E FOOE Command cannot be executed OOFO 000F FOOF Overflow histogram overflow OOFO 0010 F010 No access OOFO 0011 FO11 Data type requested does not match data available OOFO 0012 F012 Incorrect command parameters OOFO 0013 F013 Address reference exists to deleted area OOFO 0014 F014 Command execution failure for unknown reason PLC 3 histogram overflow OOFO 0015 F015 Data conversion error OOFO 0016 F016 The scanner is not available to communicate with a 1771 rack adapter OOFO 0017 F017 The adapter is no available to communicate with the module OOFO 0018 F018 The 1771 module response was not valid OOFO 0019 F019 Duplicate label OOFO 001A F01A File owner active the file is being used OOFO 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 OOFO 001D F01D Disk file is being used by another application Update not performed offline only Publication 1756 RMOOSI EN P January 2007 154 Input Output Instructions MSG GSV SSV IOT Block Transfer Error Codes These are the Logix5000 block transfer specific error codes Error Code Description Display In Software Hex 00D0 The scanner did not receive a block transfer response from the block transfer module unknown error within 3 5 seconds of the request 00D1 The c
506. t leds a OE de er PO dos 430 Publication 1756 RMOOSI EN P January 2007 10 Table of Contents Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT For Break Instructions FOR FOR DO BRK EXIT RET Special Instructions FBC DDT DTR PID Publication 1756 RMOOSI EN P January 2007 Chapter 12 TOROUIBECCIDTI n 0 Go ce OIM VE Lnd Deo REA irt a dca s 435 Jump to Label JMP tabel LBL eu aque et SEA oe ee e et d Pt RR 436 Jump to Subroutine JSR Subroutine SBR Return RET vasa ruvidurs4ctsciq9 9 438 Jump to External Routine JXR llle essen 449 Temporary End TND xiv so sis eh x Erden 452 Master Control Reset MGR ur ac 3 Xo X Re REGERE 454 User Interrupt Disable UID User Interrupt Enable UIE 456 Always False Instruction AFI 0 0 2 000s 458 No Operation NOR mem usd ee aes CREDE 459 End of Transition OT au ode pe Be Red e Read es BS 460 SFC Pause CSP Oh L5 ua tome GR Sh tle abb abide oe Sadho St 462 SEG Reset SPR ese Vene e RICO e Eg UA 464 Trigger Event Task EVENT 4 adeo er TS xta nas 466 Programmatically Determine if an EVENT Instruction T esered a Task csto muria dur Ld M ACA a 466 Chapter 13 TU OCIU COE sain sa ted HOUSSE adis RUE Ua er SN ENTE 471 o Uc MNT DIRAS CREE 472 Break BRK 4 eas opa ute o ese M t ato dure qe marke odes 475 Retura RET i6 oe e ocasion Ami cad Sob fasidi 476 Chapter 14 Totroductiols 179 ma
507. taken No action taken Publication 1756 RMOOSI EN P January 2007 292 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Example 1 Copy Target into Dest k k k k k k k k Target Dest 2 Mask Source and compare it to Dest Any required changes are made in Dest Source and Target remain unchanged A 0 in the mask restrains the instruction from comparing that bit shown by x in the example 0uce 011 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Mask1 s Looe Lene C C s SS Le C Ln X C C C C s SS Le C C Dest 0 1 0 111 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 The shaded boxes show the bits that changed Structured Text T Ol Source value 1 VMT 01 Mask mask1 0l Target target VMT MVMT 01 value masked MVMT_01 Dest Function Block MT 04 MVMT Masked Move with Target 0 0 value 1 P Sourc
508. te 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 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 This makes the behavior of this block different than the TONR block EN BOOL Timer enabled output Indicates the timer instruction is enabled TT BOOL Timer timing output When set a timing operation is in progress Publication 1756 RMOOSI EN P January 2007 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES 119 Input Parameter Data Type Description 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 disabled When the timer accumulated value ACC L enable bit EN timer timing bit TT timer done bit DN RTOR instruction is disabled it retains its ACC value You must clear the ACC value using the Reset input The tim
509. test and confirm that the instruction doesn t change data that you don t IMPORTANT Arithmetic Status Flags Fault Conditions want it to change The LFL instruction operates on contiguous memory In some cases the instruction loads data past the array into other members of the tag This happens if the length is too big and the tag is a user defined data type not affected A Major Fault Will Occur If Fault Type Fault Code starting element POS gt LIFO array size 4 20 Publication 1756 RMOOSI EN P January 2007 410 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Execution Condition Relay Ladder Action prescan EN bit is set to prevent a false load when scan begins LEN 0 Mii V POS lt 0 yes r EM is cleared EM is set Ye EM is set no uH yes DN is set no mj rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Condition rung condition in is false EN bit is cleared LEN lt 0 yes Relay Ladder Action Array File Shift Instructions BSL BSR FFL FFU LFL LFU 411 ve POS lt 0 yes V EM is cleared yes Y EM is set EM is set yes DN is set rung condition out is set to false Publication 1756 RMOOSI
510. the MG data type of the PLC 5 processor Attribute Data Type Instruction Description ConnectionPath SINT 130 GSV Data to setup the connection path The first two bytes low byte and high byte are the length in bytes of the connection path SSV ConnectionRate DINT GSV Requested packet rate of the connection SSV Message Type SINT GSV Specifies the type of message SSV Value Meaning 0 not initialized Port SINT GSV Indicates which port the message should be sent on SSV Value Meaning 1 backplane 2 serial port TimeoutMultiplier SINT GSV Determines when a connection should be considered timed out and closed SSV Value Meaning 0 connection will timeout in 4 times the update rate default 1 connection will timeout in 8 times the update rate 2 connection will timeout in 16 times the update rate UnconnectedTimeout DINT GSV Timeout period in microseconds for all unconnected messages The default is 30 000 000 microseconds 30 seconds SSV Publication 1756 RMOOSI EN P January 2007 To change a MESSAGE attribute follow these steps 1 Use a GSV instruction to get the MessageType attribute and save it in a tag 2 Use a SSV instruction to set the MessageType to 0 3 Use a SSV instruction to set the MESSAGE attribute that you want to change Use a SSV instruction to set the MessageType attribute back to the original value you obtained in step 1 msg path msg 1 EN Input Output Instructions MSG GSV
511. 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 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 If you mix integer data types the instruction fills the upper bits of the smaller integer data types with Os so that they are the same size as the largest data type Publication 1756 RMOOSI EN P January 2007 294 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Arithmetic Status Flags not affected Fault Conditions none Execution Condition Relay Ladder Action prescan The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condition in is true The instruction copies and shifts the Source bits to the Destination The rung condition out is set to true postscan The rung condition out is set to false Example 1 When enabled the BTD instruction moves bits within value 1 BTD Bit Field Distribute Source value 1 2111 1111 1111 1111 1111 1000 0000 0000 Source Bit 3 Dest value 1 281111 1111 1111 1111 1111 1000 0000 0000 Dest Bit 10 Lenath B destination bit source bi
512. the current value used by the output channel The controller s output will ramp 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 instruction The 1756 analog output module returns two values for each 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 goes 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 turns off the InHold status bit which allows the PID instruction to start controlling normally Derivative Smoothing The derivative calculation is enhanced by a derivative smoothing filter This first order low pass digital filter helps to minimize 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 value
513. 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 C 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 Ju nn a SL one scan gt 16639 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 333 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 one scan lt rung condition in EN bit DN bit clears status bits and clears POS value scan of the instruction i Li operation complete no execution occurs Numerical mode 40010 Numerical mode distributes the array operation over a number of scans This mode is useful when working with non time critical data or large amounts of data You enter the number of elements to operate on for each scan which keeps scan time shorter Publication 1756 RMOOSI EN P January 2
514. thmetic Status Flags not affected Fault Conditions none Execution Condition Relay Ladder Action Structured Text Action prescan The rung condition out is set to false No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes when rung condition in na toggles from cleared to set The rung condition out is set to true Enableln is set na Enableln is always set The instruction executes instruction execution postscan The instruction removes the specified characters from the buffer and stores them in the destination The EN bit is set The remaining status bits except UL are cleared The instruction attempts to enter the ASCII queue The rung condition out is set to false No action taken Example Continuously test the buffer for a message from a MessageView terminal Since each message ends in a carriage return r the carriage return is configured as the termination character in the Controller Properties dialog box User Protocol tab When the ABL finds a carriage return its 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 Publication 1756 RMOOSI EN P Janua
515. timing diagrams show the sequence of bit operations in a Diagrams typical system configuration Alarm Acknowledge Required and Latched InAlarm ProgAck OperAck ProgReset OperReset InAlarm s Acked Inputs Outputs Publication 1756 RMOOSI EN P January 2007 44 Digital Alarm Instruction ALMD Alarm Acknowledge Required and Not Latched InAlarm Y Mi A ProgAck OperAck E ProgReset OperReset InAlarm a 9 ES 3 amp 0 Acked Publication 1756 RMOOSI EN P January 2007 Inputs Outputs Digital Alarm Instruction ALMD 45 Alarm Acknowledge Not Required and Latched InAlarm ProgAck OperAck ProgReset OperReset InAlarm T Acked Publication 1756 RMOOSI EN P January 2007 46 Digital Alarm Instruction ALMD Alarm Acknowledge Not Required and Not Latched InAlarm ProgAck OperAck ProgReset OperReset False InAlarm Acked Publication 1756 RMOOSI EN P January 2007 Chapter 2 Analog Alarm Instruction ALMA i Introduction Use the ALMA instruction to detect alarms based on the level or rate of change of analog value The ALMA instruction has parameters which appear as operands on the instruction The instruction operands are not common to all languages The ALMA instruction has a corresponding tag s
516. tion prescan Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 527 Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 528 Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN Example Calculate the cosine of value and place the result in result Publication 1756 RMOOSI EN P January 2007 Relay Ladder COS Cosine Source value 1 0471976 Dest result 05 Structured Text result COS value Function Block Cosine Trigonometric Instructions SIN COS TAN ASN ASIN ACS ACOS ATN ATAN 529 Tangent TAN The TAN instruction takes the tangent of the Source value in radians and stores the result in the Destination Operands Relay Ladder T N Tangent Operand Type Format Description Source E UD iD ais ld fud CN Source SINT immediate find the tangent of this value Dest INT tag DINT REAL Destination SINT tag tag to store the result INT DINT REAL Structured Text dest TAN source Use TAN as a function This function computes the tangent of source and stores the result in dest See for information on the syntax of expressions within structured t
517. tion in is true The instruction performs a bitwise OR operation The rung condition out is set to true postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 310 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Function Block Condition Action prescan No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enableln is set The instruction executes EnableOut is set postscan No action taken Example When enabled the OR instruction performs a bitwise OR operation on SourceA and SourceB and places the result in Dest SouceA 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 SouceB 010 00 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 Dest 0 0 0 0 00 0 0 0 0 0 0 1 1 1 1 1 1 11 0 1 0 1 1 1 1 11 1 1 1 Relay Ladder OF Bitwise Inclusive OF Source value 1 z 0000_0000_0000_0101_0101_0101_1111_1111 Source B value 2 2 0000_0000_0000_1111_1111_0000_0000_0000 Dest value_result_or 2 0000_0000_0000_1111_1111_0101_1111_1111 Structured Text value result or value 1 OR value 2 Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MV
518. tion out is storage bit storage bit remains set gt Y rung condition out is set postscan The storage bit is cleared The rung condition out is set to false Example You typically precede the ONS instruction with an input instruction because you scan the ONS instruction when it is enabled and when it is disabled for it to operate correctly Once the ONS instruction is enabled the rung condition in must go clear or the storage bit must be cleared for the ONS instruction to be enabled again Publication 1756 RMOOSI EN P January 2007 82 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI liit switch 1 storage 1 Publication 1756 RMOOSI EN P January 2007 On any scan for which limit_switch_1 is cleared or storage 1 is set this rung has no affect On any scan for which imit switcb 1 is set and storage 1 is cleared the ONS instruction sets storage 1 and the ADD instruction increments sum by 1 As long as limit_switch_1 stays set sum stays the same value The imit_switch_1 must go from cleared to set again for sum to be incremented again Relay Ladder Add Source Source B Structured Text IF limit switch 1 AND NOT storage 1 THEN sum sum 1 END IF storage 1 limit switch 1 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 83 One Shot Rising OSR The OSR instruction sets or clears the output bit depending on the stat
519. tion out is set to true postscan Publication 1756 RMOOSI EN P January 2007 The rung condition out is set to false For Break Instructions FOR FOR DO BRK EXIT RET 471 Example The FOR instruction repeatedly executes routine_2 and increments value_2 by 1 each time When value_2 is gt 10 or a BRK instruction is enabled the FOR instruction no longer executes routine_2 The RET instruction returns to the calling FOR instruction The FOR instruction either executes the subroutine again and increments the Index value by the Step size or if the Index value exceeds the Terminal value the FOR instruction is complete and execution moves on to the instruction that follows the FOR instruction calling routine subroutine FOR RET For lt lt Return Routine name routine 2 Index value 2 Initial value 0 Terminal value 10 Step size 1 Publication 1756 RMOOSI EN P January 2007 478 For Break Instructions FOR FOR DO BRK EXIT RET Notes Publication 1756 RMOOSI EN P January 2007 Chapter 14 Special Instructions FBC DDT DTR PID Introduction The special instructions perform application specific operations If You Want To Use This Instruction Available In These Languages See Page Compare data against a known good reference FBC relay ladder 480 and record any mismatches Compare data against a known good reference DDT relay ladder 488 record any mismatches and
520. tion taken No action taken Enableln is cleared EnableOut is cleared the instruction does nothing and the outputs are not updated Enableln is set The instruction executes EnableOut is set postscan No action taken Publication 1756 RMOOSI EN P January 2007 Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 241 Example 1 If the masked value 1 is equal to the masked value 2 set light_1 If the masked value 1 is not equal to the masked value_2 clear light_1 This example shows that the masked values are equal A 0 in the mask restrains the instruction from comparing that bit shown by x in the example value 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 value 2 0 10 1 0 1 0 1 1 1 1 1 0 0 0 0 c c c c mask 1 mask_1 Masked value 1 0 110 1 10 1 0 1 1 1 1 T1 x x x x Masked value 2 01110 1 0 1 0 1 1 1 1 1 x x x x Relay Ladder MEQ light_1 Mask Equal Source value 1 280101 0101 1111 1111 ask mask 1 281111 1111 1111 0000 Compare value 2 2 0101_0101_1111_0000 M Structured Text light 1 value 1 AND mask_1 value_2 AND mask 2 Function Block Compare Publication 1756 RMOOSI EN
521. to lower case characters Relay Ladder Operand Type Format Description Source string tag tag that contains the characters that you want to convert to lower case Destination string tag tag to store the characters in lower case Structured Text The operands are the same as those for the relay ladder LOWER instruction The LOWER instruction converts to lower case all the letters in the Source and places the result in the Destination e ASCII characters are case sensitive Upper case A 41 is not equal to lower case a 61 e If operators directly enter ASCII characters convert the characters to all upper case or all lower case before you compare them Any characters in the Source string that are not letters remain unchanged not affected none Condition prescan Relay Ladder Action The rung condition out is set to false Structured Text Action No action taken rung condition in is false The rung condition out is set to false na rung condition in is true The instruction executes The rung condition out is set to true na Publication 1756 RMOOSI EN P January 2007 634 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER Condition Relay Ladder Action Structured Text Action Enableln is set na Enableln is always set The instruction executes instruction execution The instruction converts the Source to lower case postscan The rung conditio
522. to vary 0 Dest dint ave 0 R Control control 1 Length 4 Position of Structured Text SIZE array_dint 0 length sum 0 FOR position 0 TO length 1 DO sum sum array_dint position END_FOR dint_ave sum length Publication 1756 RMOOSI EN P January 2007 372 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE Example 2 Average array dint which is DINTI4 5 P dimension 1 K Ol A 2 3 4 0 20 19 18 17 16 AVE 5 l 1 115 12 11 dimension 0 dint_ave 3 2 10 7 6 3 2 1 Relay Ladder VE Average File N Array array dint 3 0 Dim to vary 1 N3 Dest dint ave ne RH Control control 1 Length 5 Position of Structured Text SIZE array_dint 1 length sum 0 FOR position 0 TO length 1 DO sum sum array_dint position END_FOR dint_ave sum length Publication 1756 RMOOSI EN P January 2007 5 44 34 2 1 15 pes File Sort SRT Sort File Array Dim to vary Control Lenath Position Operands SRT Array Dimtovary Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 373 The SRT instruction sorts a set of values in one dimension Dim to vary of the Array into ascending order Relay Ladder Operand Type Format Description Array SINT array tag array to sort INT specify the first element of the group of ele
523. tore ASCII characters in tags that use a string data type a e name of controller You can use the default STRING data type It stores up to 82 T vof characters Data Types e You can create a new string data type that stores less or more Er User Defined characters gt 2 38 Strings 8 STRING To create a new string data type see Logix5000 Controllers Common Predefined Procedures publication 1756 PMO01 Ug Module Defined L 1 0 Configuration Each string data type contains the following members Name Data Type Description Notes LEN DINT number of characters The LEN automatically updates to the new count of characters whenever you in the string e use the String Browser dialog box to enter characters e use 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 e To access the characters of the string address the name of the tag the string For example to access the characters of the string 1 tag enter string f e Each element of the DATA array contains one character e You can create new string data types that store less or more characters Publication 1756 RMOOSI EN P January 2007 608 ASCII String Instructions CONCAT DELETE FIND INSERT MID String Concatenate The CONCAT instruction adds ASCII characters to t
524. tput bit Publication 1756 RMOOSI EN P January 2007 Description Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 93 When the InputBit is cleared and the InputBit 4 is set the OSFI instruction sets the OutputBit When InputBit is cleared or when InputBit is set the OSFI instruction clears the OutputBit InputBi eee InputBit e utputBit eee EE instruction is instruction resets during executed next scan execution 40047 Arithmetic Status Flags not affected Fault Conditions none Execution Condition Function Block Action Structured Text Action prescan No action taken No action taken instruction first scan InputBit 4 is cleared InputBit 4 is cleared instruction first run InputBit 4 is cleared InputBit 4 is cleared Enableln is cleared Enableln is set EnableOut is cleared the instruction does nothing na and the outputs are not updated On a cleared to set transition of InputBit the On a cleared to set transition of InputBit the instruction clears InputBit 4 instruction clears InputBit 4 The instruction executes Enableln is always set EnableOut is set The instruction executes postscan No action taken No action taken Publication 1756 RMOOSI EN P January 2007 94 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Example When imit switcb1 goes from set to cleared t
525. trol device valve damper etc variable INT If you are using the deadband the Control variable must be REAL or it will be forced to 0 when the error is within the deadband DINT REAL PID master PID structure optional PID tag for the master PID loop If you are performing cascade control and this PID is a slave loop enter the name of the master PID Enter 0 if you don t 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 Enter 0 if you don t want to use this parameter Inhold value SINT tag optional data readback value from a 1756 analog output channel to support bumpless restart INT Enter 0 if you don t want to use this parameter DINT REAL Publication 1756 RMOOSI EN P January 2007 500 Special Instructions FBC DDT DTR PID Operand Type Format Description Setpoint displays current value of the setpoint Process displays current value of the scaled Process Variable variable Output 96 displays current output percentage value Structured Text PID PID ProcessVariable The operands are the same as those for the relay ladder Tieback ControlVariable PID instruction However you specify the Setpoint Process Variable PIDMasterLoop InholdBit and Output 96 by accessing the SP PV and OUT members of the PID InHoldValue structure rather than by including values in the operand list Publication 1756 RMOOSI EN P
526. truction execution The instruction searches for the specified characters postscan The rung condition out is set to false No action taken 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 Relay Ladder MV read EM FIND Find String Source MV msg 06324 12 1 r Search find N Start 1 Result find pos 5 Publication 1756 RMOOSI EN P January 2007 614 ASCII String Instructions CONCAT DELETE FIND INSERT MID Structured Text IF MV read EM THEN FIND MV msg find l1 find pos MV read EM 0 END IF Insert String INSERT The INSERT instruction adds ASCII characters to a specified location within a string Operands Relay Ladder INSERT Insert String Source A Source B Start Dest Operand Type Format Enter Notes Source A string tag string to add the characters String data types are to Source B string tag string containing the edet STRING data type characters to add e any new string data type that you create Start SINT immediate position in Source Ato add Enter a number between 1 and the DATA size of the characters the Source INT tag DINT Result string tag string to store the result Structured Text INSERT SourceA SourceB
527. tructure ALARM_ANALOG that is common to all languages Refer to Structure Definition For ALARM ANALOG Tag on page 50 for descriptions of the tag elements and alarm execution About Operator Parameters Operator parameters for example OperSuppress work wih any Rockwell Automation or third party operator interface to allow control of alarm states When an Operator request is set the ALMA instruction evaluates whether it can respond to the request then always resets the request This lets operator interfaces work with this instruction by merely setting the desired request bit You don t have to program the operator interface to reset the request bits Using the ALMA Instruction to Subscribe to and Display Alarms The ALMA instruction provides additional functionality when used with RSLinx Enterprise and FactoryTalk View SE software You can display alarms in the Alarm Summary Alarm Banner Alarm Status Explorer and Alarm Log Viewer displays in FactoryTalk View SE software RSLinx Enterprise software subscribes to alarms in the controller Using several output parameters shown in the output paramater tables that follow you can monitor the instruction to see the alarm subscription status and to display alarm status changes If a connection to RSLinx Enterprise software is lost the controller can briefly buffer alarm data until the connection is restored Publication 1756 RMOOSI EN P January 2007 48 Analog Alarm Instruction
528. tructured text convert a SINT INT DINT or REAL convert a variable to an ASCII string DTOS relay ladder 626 value to a string of ASCII characters so you can send it to a MessageView terminal structured text convert a REAL value to a string of convert a variable to an ASCII string RTOS relay ladder 629 ASCII characters so you can send it to a MessageView terminal structured text convert the letters in a string of ASCII convert an entry made by an operator UPPER relay ladder 631 characters to upper case to all upper case so you can search for it in an array structured text convert the letters in a string of ASCII convert an entry made by an operator LOWER relay ladder 633 characters to lower case to all lower case so you can search for it in an array structured text Publication 1756 RMOOSI EN P January 2007 620 ASCII Conversion Instructions STOD STOR DTOS RTOS UPPER LOWER You can also use the following instructions to compare or manipulate ASCII characters If You Want To Use This Instruction See Page add characters to the end of a string CONCAT 608 delete characters from a string DELETE 610 determine the starting character of a sub string FIND 612 insert characters into a string INSERT 614 extract characters from a string MID 616 rearrange the bytes of a INT DINT or REAL tag SWPB 301 compare a string to another string CMP 207 see if the characters are equal to specific characters EQU 2
529. ts FOG 5 the FD and IN bits The POS 4 value indicates the position of the equal element CLE 6 To continue comparing the rest of the array CAK j clear the IN bit DET 8 BWG 9 FSC expressions You program expressions in FSC instructions the same as expressions in CMP instructions Use the following sections for information on valid operators format and order of operation which are common to both instructions Publication 1756 RMOOSI EN P January 2007 Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 355 Valid Operators Operator Description Optimal Operator Description Optimal add DINT REAL DEG radians to degrees DINT REAL subtract negate DINT REAL FRD BCD to integer DINT s multiply DINT REAL LN natural log REAL divide DINT REAL LOG log base 10 REAL equal DINT REAL MOD modulo divide DINT REAL lt less than DINT REAL NOT bitwise complement DINT lt less than or equal DINT REAL OR bitwise OR DINT gt greater than DINT REAL RAD degrees to radians DINT REAL gt greater than or equal DINT REAL SIN sine REAL gt not equal DINT REAL SOR square root DINT REAL exponent x to y DINT REAL TAN tangent REAL ABS absolute value DINT REAL TOD integer to BCD DINT ACS arc cosine REAL TRN truncate DINT REAL AND bitwise AND DINT XOR bitwise exclusive OR DINT ASN arc sine REAL ATN arc tangent REAL COS cosine REAL
530. ts are not updated Enableln is set The instruction executes Enableln is always set EnableOut is set The instruction executes postscan No action taken No action taken Publication 1756 RMOOSI EN P January 2007 298 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Example 1 The controller copies Target into Dest mes TES Target Dest 11141 2 The SourceBit and the Length specify which bits in Source to copy into Dest starting at DestBit Source and Target remain unchanged DestBit SourceBit Y Y Source 111 1 1 1 1 1 1 1 1 1 111 1 1 1 0 0 0 00 0 0 0 0 0 0 Dest Publication 1756 RMOOSI EN P January 2007 Structured Text BTDT 01 Source source BTDT_01 SourceBit source bit BTDT Ol Length length BTDT_01 DestBit dest bit BTDT Ol Target target BTDT BTDT 01 distributed value BTDT_01 Dest Function Block BTDT 01 BTDT xx source m Bit Field Distribute with Target o E Source Dest j d
531. tured text DR 01 Function Block Bitwise Inclusive OR Operand Type Format Description Sourds Dest OR tag FBD_LOGICAL structure OR structure SourceB Publication 1756 RMOOSI EN P January 2007 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 309 FBD LOGICAL Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA DINT Value to OR with SourceB Valid any integer SourceB DINT Value to OR with SourceA Output Parameter Data Type EnableOut BOOL Dest DINT Description Arithmetic Status Flags Fault Conditions Execution Condition prescan Valid any integer Description The instruction produced a valid result Result of the instruction Arithmetic status flags are set for this output When enabled the instruction evaluates the OR operation If the Bit In And the Bit In The Bit In the Source A Is Source B Is Destination Is 0 0 0 0 1 1 1 0 1 1 1 1 If you mix integer data types the instruction fills the upper bits of the smaller integer data types with Os so that they are the same size as the largest data type Arithmetic status flags are affected none Relay Ladder Action The rung condition out is set to false rung condition in is false The rung condition out is set to false rung condi
532. tured text Input Reference Enhanced Select function block JKFF process control structured text EVENT 466 relay ladder JK Flip Flop function block Trigger Event Task structured text JMP 436 elay ladder FAL 337 relay ladder Jump to Label File Arithmetic and Logic JSR 438 elay ladder FBC 480 relay ladder Jump to Subroutine structured text File Bit Comparison unction block FFL 396 relay ladder JXR 449 elay ladder FIFO Load Jump to External Routine FFU 402 relay ladder LBL 436 elay ladder FIFO Unload Label FGEN process control structured text LDL2 process control structured text Function Generator function block Second Order Lead Lag unction block FIND 612 relay ladder LDLG process control structured text Find String structured text Lead Lag function block FLL 364 relay ladder LEQ 224 elay ladder File Fill Less Than or Equal to structured text unction block Publication 1756 RMOOSI EN P January 2007 26 Instruction Locator Instruction LES Less Than LFL LIFO Load LFU LIFO Unload LIM Limit LN Natural Log LOG Log Base 10 LOWER Lower Case Languages relay ladder structured text function block relay ladder relay ladder relay ladder function block relay ladder structured text function block relay ladder structured text function block relay ladder structured text Publication 1756 RMOOSI EN P January 2007 Instruction MCR Master Control Reset
533. uare root of source and stores the result in dest See Appendix B for information on the syntax of expressions within structured text Publication 1756 RMOOSI EN P January 2007 SQR 01 SOR Square Root Source Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 273 Function Block Operand Type Format Description SOR tag FBD_MATH_ADVANCED structure SOR structure FBD_MATH_ADVANCED Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set Source REAL Find the square root of this value Valid any float Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest REAL Result of the math instruction Arithmetic status flags are set for this output Arithmetic Status Flags Description If the Destination is not a REAL the instruction handles the fractional Fault Conditions portion of the result as follows If The Source Is Then The Fractional Example Portion Of The Result nota REAL truncates Source DINT 3 Destination DINT 1 a REAL rounds Source REAL 3 0 Destination DINT 2 If the Source is negative the instruction takes the absolute value of the Source before calculating the square root Arithmetic status flags are affected none Publication 1756 RMOOSI EN P January 2007 214 Compute Math Instruction
534. uction ALMA Table of Contents Introduction SE ar ck e oper d re oto pee ipo qur a quar det bi pdt 15 Updated Information si ic cd 6d oth xc o p aoa e ly 15 TMEGUUICHOM caua set nv e ea S perm ie de PP eo d 17 Who Should Use This Manual i225 212 2 yap sre 17 Purpose of This Manual ea xdg dX ERROR Ka BA Uie 18 Common Information for All Instructions 19 Conventions and Related Terms 4 c 4 an Een 19 Setand Ceu eode abt OP e ERA o o d dre 19 Relay ladder rung Conditions 04 55 See Y XS ee 20 Function block States 62444949 264 5 40 43 bes 21 Where to Find an Instruction d qu xs Sa Outs Pee BERS 23 Chapter 1 TREES oT gu T 31 About Operator Parameters llle 31 Using the ALMD Instruction to Subscribe to and Display ALIAS og Wah o usotsr ve qETSLATISESAREERAY 31 Digital Alarm Operands s 35 4 4 p x qe eet eee e e d 32 Ladder Logic Operands ca au mE ea 32 Structured Text Operdbdsoove esa Va m EXER xS 32 Function Block Operands 6 405 044 5464 aed Rhea 33 Structure Definition for ALARM DIGITAL Tag 34 Input Parameters aya qe PU dnd oos Ket 34 Output Parameters cles 37 Example cuu 2 3 ab P on a a t vale Qo DE OUR CI male ed 40 Ladder LOGIC Air exa CI REL bo SOR 40 b notot Block sedo Cedo hia oes tae eS 41 XCTI Ate ue het d enh ied Be gt too ME mat Css uas tuf ado S 42 Fadder LOGIC asy ae Te Aun do e oi ot ed x9 Bat aed d 42 F ncton BIoGk c e mpeg ATH eC XOT Sa 42 Digital State Timing
535. uction but you can achieve the same results using a SIZE instruction and a FOR DO or other loop construct SIZE array 0 length sum 0 FOR position 0 TO length 1 DO sum sum array position END FOR Array File Misc Instructions FAL FSC COP CPS FLL AVE SRT STD SIZE 369 destination sum length See Appendix B for information on the syntax of constructs within structured text CONTROL Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that the AVE instruction is enabled DN BOOL The done bit is set when the instruction has operated on the last element in the Array POS LEN ER BOOL The error bit is set if the instruction generates an overflow The instruction stops executing until the program clears the ER bit The position of the element that caused the overflow is stored in the POS value 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 The AVE instruction calculates the average of a set of values Arithmetic Status Flags Fault Conditions 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 Arithmetic status flags are affected A Major Fault Will Occur I
536. uction sets the output bit When disabled and the storage bit is cleared or when enabled the OSF instruction clears the output bit eee rung condition in t eee storage bit output bit e ee d i ft instruction is instruction resets during executed next scan execution Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI 87 Execution Condition Relay Ladder Action prescan The storage bit is cleared to prevent an invalid trigger during the first scan The output bit is cleared The rung condition out is set to false rung condition in is false i storage bit remains cleared storage bit 0 examine storage bit don g output bit is cleared storage bit storage bit is cleared output bit is set gt Y rung condition in is true The storage bit is set The output bit is cleared The rung condition out is set to true postscan See rung condition in is false above Example Each time imit_switch_1 goes from set to cleared the OSF instruction sets output bit 2 and the ADD instruction increments sum by 5 As long as limit switch 1 stays cleared sum stays the same value The limit switch 1 must go from set to cleared again for sum to be incremented again You can use output bit 2 on multiple rungs
537. uctured Text add result float_value_1 float_value_2 Function Block ADD_06 0 0 float value 1 float value 2 C SourceA add result SourceB Publication 1756 RMOOSI EN P January 2007 Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS 257 Subtract SUB The SUB instruction subtracts Source B from Source A and places the result in the Destination Operands eiia Relay Ladder Subtract Source A Operand Type Format Description Source B Source A SINT immediate value from which to subtract Source B Dest j INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Source B SINT immediate value to subtract from Source A INT tag DINT REAL A SINT or INT tag converts to a DINT value by sign extension Destination SINT tag tag to store the result INT DINT REAL Structured Text dest sourceA sourceB Use the minus sign as an operator in an expression This expression subtracts sourceB from sourceA and stores the result in dest See Appendix B for information on the syntax of expressions within structured text SUB 04 Function Block SUB zi Subtract Operand Type Format Description SUB tag FBD MATH structure SUB structure O SourceA SourceB Publication 1756 RMOOSI EN P January 2007 258 X Compute Math Instructions CPT ADD SUB MUL DIV MOD SOR SORT NEG ABS Input Parameter Data Ty
538. ue is greater than a GRT relay ladder 220 second value structured text function block test whether one value is less than or equal to LEQ relay ladder 224 a second value structured text function block test whether one value is less than a LES relay ladder 228 second value structured text function block Publication 1756 RMOOSI EN P January 2007 206 Compare Instructions CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ If You Want To Use This Instruction Available In These Languages See Page test whether one value is between two other values LIM relay ladder 232 structured text function block pass two values through a mask and test whether they are equal MEQ relay ladder 238 structured text function block test whether one value is not equal to a second value 1 2 Publication 1756 RMOOSI EN P January 2007 NEQ relay ladder 243 structured text function block There is no equivalent structured text instruction Use other structured text programming to achieve the same result See the description for the instruction There is no equivalent structured text instruction Use the operator in an expression You can compare values of different data types such as floating point and integer For relay ladder instructions 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 optim
539. ult control structure Using the same tag for both could result in unpredictable operation possibly causing equipment damage and or injury to personnel Special Instructions FBC DDT DTR PID 489 COMPARE Structure Mnemonic Data Type Description EN BOOL The enable bit indicates that 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 JN BOOL The inhibit bit indicates the DDT search mode 0 2 all mode 1 one mismatch at a time mode ER BOOL The error bit is set if the compare POS 0 the compare LEN 0 the result POS 0 or the result LEN 0 The instruction stops executing until the program clears the ER bit 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 Description When enabled the DDT instruction compares the bits in the Source array with the bits in the Reference array records the bit num
540. uncated Relay Ladder TAN Truncate Source float value 1 783 55554 Dest flnat value 1 truncated Foo 0 Structured Text float_value_l_truncated TRUNC float value 1 Function Block TRN 01 TRN Truncate 0 0 p float value 1 Source e float value 1 truncated Publication 1756 RMOOSI EN P January 2007 570 Math Conversion Instructions DEG RAD TOD FRD TRN TRUNC Notes Publication 1756 RMOOSI EN P January 2007 Chapter 18 ASCII Serial Port Instructions ABL ACB ACL AHL ARD ARL AWA AWT Introduction Use the ASCII serial port instructions to read and write ASCII characters IMPORTANT To use the ASCII serial port instructions you must configure the serial port of the controller See the Logix5000 Controllers Common Procedures publication 1756 PM001 If You Want To For Example Use This Available InThese See Page Instruction Languages determine when the buffer contains check for data that contains ABL relay ladder 575 termination characters termination characters structured text count the characters in the buffer check for the required number of ACB relay ladder 578 characters before reading the buffer structured text clear the buffer e remove old data from the buffer at ACL relay ladder 581 start up clear out ASCII Serial Port instructions that are currently e synchronize the buffer with a SUMI UON executing or are in the queue device obtain the status
541. ung condition out is set to false rung condition in is true it CU bit is set examine CU bit egi rus ACC value rolls over ACC ACC 1 CU bit 1 Y examine UN bit LUN bit 1 LUN bit 0 UN bit is cleared DN bit is cleared examine OV bit UN DIES 0V bit z 1 examine ACC ACC PRE LUN bit 1 ACC gt PRE examine UN bit OV bit is set DN bit is cleared DN bit is set Y true rung condition out is set to postscan The rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 126 Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CTD CTUD RES Example After imit switcb 1 goes from disabled to enabled 10 times the DN bit is set and ight_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 igbt 1 turns off limit switch 1 CTU Count Up Counter counter_1 Preset 10 Accum of counter_1 dn light_1 limit_switch_2 counter_1 RES Publication 1756 RMOOSI EN P January 2007 Count Down CTD Timer and Counter Instructions TON TOF RTO TONR TOFR RTOR CTU CT
542. update the reference to match the source Pass the source data through a mask and DTR relay ladder 496 compare the result to reference data Then write the source into the reference for the next comparison Control a PID loop PID relay ladder 499 structured text Publication 1756 RMOOSI EN P January 2007 480 Special Instructions FBC DDT DTR PID File Bit Comparison FBC The FBC instruction compares bits in a Source array with bits in a Reference array Operands Relay Ladder FBC EBENEN EC Operand Type Format Description ooo aie Source DINT array tag array to compare to the reference Cmp Control ER5 m do not use CONTROL POS in the subscript Result Control Length Reference DINT array tag array to compare to the source Position 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 structure control structure for the results control Length DINT immediate number of storage locations in the result Position DINT immediate current position in the result initial value is typically 0 Use different tags for the compare control structure and the result control structure Using the
543. urce SINT immediate value to test against Compare Compare INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Mask SINT immediate defines which bits to block or pass INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Compare SINT immediate value to test against Source INT tag DINT A SINT or INT tag converts to a DINT value by zero fill E Structured Text Structured text does not have an MEQ instruction but you can achieve the same results using structured text IF Source AND Mask Compare AND Mask THEN statement END IF MEO 01 MEQ Ez Mask Equal Operand MEQ tag Cj Compare Publication 1756 RMOOSI EN P January 2007 Function Block Type Format FBD MASK EQUAL Description structure MEO structure Compare Instructions CMP EQU GEO GRT LEQ LES LIM MEQ NEQ 239 FBD_MASK_EQUAL Structure Input Parameter Data Type Description Enableln BOOL If cleared the instruction does not execute and outputs are not updated If set the instruction executes as described under Execution Default is set Source DINT Value to test against Compare Valid any integer Mask DINT Defines which bits to block mask Valid any integer Compare DINT Compare value Valid any integer Output Parameter Data Type Description EnableOut BOOL The instruction produced a valid result Dest BOOL Result of the instruction This is equivalent to rung condition out
544. us of the storage bit This instruction is available in structured text and function block as OSRI see page 3 89 Operands Relay Ladder OSR Operand Type Format Description One Shot Rising OB y Pp yp p Storage Bit SB5 storage bit BOOL tag internal storage bit Dutput Bit stores the rung condition in from the last time the instruction was executed output bit BOOL tag bit to be set Description When enabled and the storage bit is cleared the OSR instruction sets the output bit When enabled and the storage bit is set or when disabled the OSR instruction clears the output bit eee rung condition in eee storage bit output bit e o instruction is instruction resets during executed next scan execution Arithmetic Status Flags not affected Fault Conditions none Publication 1756 RMOOSI EN P January 2007 84 Bit Instructions XIC XIO OTE OTL OTU ONS OSR OSF OSRI OSFI Execution Condition Relay Ladder Action prescan The storage bit is set to prevent an invalid trigger during the first scan The output bit is cleared The rung condition out is set to false rung condition in is false The storage bit is cleared The output bit is not modified The rung condition out is set to false rung condition in is true d storage bit is set storage bit 0 p examine storage bit ll output bit is set storage bit storage bit rema
545. ut If TimingMode invalid the instruction sets the appropriate bit in Status Execution time for oversample timing The value used for DeltaT is in seconds If TimingMode 1 then OversampleDT 0 0 disables the execution of the control algorithm If invalid the instruction sets DeltaT 0 0 and sets the appropriate bit in Status valid 0 to 4194 303 seconds default 0 0 Function Block Attributes 653 Input Parameter Data Type Description RTSTime DINT Module update period for real time sampling timing The expected DeltaT update period is in milliseconds The update period is normally the value that was used to configure the module s update time If invalid the instruction sets the appropriate bit in Status and disables RTSMissed checking valid 1 to 32 767ms default 1 RTSTimeStamp DINT Module time stamp value for real time sampling timing The time stamp value that corresponds to the last update of the input signal This value is used to calculate DeltaT If invalid the instruction sets the appropriate bit in Status disables execution of the control algorithm and disables RTSMissed checking valid 1 to 32 767ms wraps from 32767 to 0 1 count 1 millisecond default 0 Output parameters Output Parameter Data Type Description DeltaT REAL Elapsed time between updates This is the elapsed time in seconds used by the control algorithm to calculate the process output Periodic DeltaT task scan rate if t
546. ut 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 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 rung condition in goes false for all the rungs in the MCR zone regardless of input conditions input 1 input 2 input 3 E AR eer input_4 output 1 input 11 input 12 output 2 input 3 output 3 Publication 1756 RMOOSI EN P January 2007 456 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT User Interrupt Disable UID User Interrupt Enable UIE Operands UID gt CUIE gt UID UIE Description Arithmetic Status Flags Fault Conditions Publication 1756 RMOOSI EN P January 2007 The UID instruction and the UIE instruction work together to prevent a small number of critical rungs from being interrupted by other tasks Relay Ladder none Structured Text none You must enter the parentheses O after the instruction mnemonic even though there are no operands When the rung condition in is true the e 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 e UIE instructio
547. ut is set to false Publication 1756 RMOOSI EN P January 2007 Array File Shift Instructions BSL BSR FFL FFU LFL LFU 395 Example 1 When enabled the BSR instruction starts at bit 9 in array dint 0 The instruction unloads array dint O0 O into the UL bit shifts the remaining bits right and loads input 1 into array dint 0 9 The values in the remaining bits 10 31 are invalid BSR Bit Shift Right N Array array dint D Control control 1 N Source Bit input 1 Length 10 9876543210 array_dint 0 111 1 1 0 0 0 01 1 1 11 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 before shift i E these bits shift right 98765432 1 0 array dint O 1 0 0 1 1 1 1 0 0 0 after shift Example 2 When enabled the BSR instruction starts at bit 25 in array dint 1 The instruction unloads array dintl O O into the UL bit shifts the remaining bits right and loads input 1 into array dint 1 25 The values in the remaining bits 31 26 in dint array 1 are invalid Note how array dint 1 0 shifts across words into array dintl 0 51 BSR Bit Shift Right N Array array dint D Control control 1 DN gt Source Bit input 1 58 amay din o 1 11 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 3 0 array dint 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1
548. values in IREFs 2 The controller executes the other function blocks in the order determined by how they are wired 3 The controller writes outputs in OREFs Publication 1756 RMOOSI EN P January 2007 Function Block Responses to Overflow Conditions Response 1 Blocks execute their algorithm and check the result for NAN or INF If NAN or INF the block outputs NAN or INF ALM DEDT DERV ESEL FGEN HPF LDL2 LDLG NTCH PMUL POSP RUM RMPS SCRV SEL SNEG SRTP SSUM TOT UPDN Function Block Attributes 649 In general the function block instructions that maintain history do not update history with NAN or INF values when an overflow occurs Each instruction has one of these responses to an overflow condition Response 2 Blocks with output limiting execute their algorithm and check the result for NAN or INF The output limits are defined by the HighLimit and LowLimit input parameters If INF the block outputs a limited result If X NAN the output limits are not used and the block outputs NAN HLL INTG PI PIDE SCL SOC Response 3 The overflow condition does not apply These instructions typically have a boolean output BAND OSRI BNOT RESD BOR RTOR BXOR SETD CUTD TOFR D2SD TONR D3SD DFF JKFF OSFI Publication 1756 RMOOSI EN P January 2007 650 Function Block Attributes Timing Modes These process control and drives instructions support different timing modes
549. vel POS overtravel POS ABS overtravel valuel operator function value2 value3 2 Publication 1756 RMOOSI EN P January 2007 If adjustment and position are DINT tags and sensor and sensor2 are REAL tags and your specification says Find the absolute value of the average of sensor and sensorZ add the position adjustment ABS sensorl sensor2 2 adjustment and store the result in position Use relational operators Relational operators compare two values or strings to provide a true or false result The result of a relational operation is a BOOL value If The Comparison Is The Result Is true 1 false 0 Use the following relational operators For This Comparison Use This Operator Optimal Data Type equal DINT REAL string less than lt DINT REAL string less than or equal lt DINT REAL string greater than gt DINT REAL string greater than or equal gt DINT REAL string not equal lt gt DINT REAL string Use This Format For example Structured Text Programming 667 Example For This Situation You d Write If temp is a DINT tag and your specification IF temp 100 THEN valuel operator value2 says If temp is less than 100 then stringtagl operator stringtag2 If bar code and dest are string tags and your specification says If bar code equals dest then IF bar code dest THEN charl operator char2 To e
550. w low alarm limit Valid maximum negative float lt LLLimit lt LLimit Default 0 0 LLSeverity DINT Specifies the severity of the low low alarm condition Valid 1 to 1000 1000 most severe 1 least severe Default 500 Publication 1756 RMOOSI EN P January 2007 54 Analog Alarm Instruction ALMA Input Parameter MinDurationPRE Data Type DINT Description Specifies the minimum duration preset for the alarm In value to be in any level based non normal condition before the alarm notification is sent to clients milliseconds Does not apply to Rate of Change limits Once the minimum duration preset it reached any alarm notifications for subsequent alarm level events are sent immediately The minimum duration time will be reset once the alarm returns to normal Valid 0 to 2147483647 Default 0 Deadband REAL Specifies the deadband for detecting that high high high low and low low alarm levels have returned to normal Valid 0 0 to maximum possible float Default 0 0 ROCPosLimit REAL Specifies the limit for an increasing rate of change in units per second Detection is enabled for any value gt 0 0 if ROCPeriod is also gt 0 0 Valid 0 0 to maximum possible float Default 0 0 ROCPosSeverity ROCNegLimit ROCNegseverity DINT REAL DINT Specifies the severity of the increasing rate of change alarm condition Valid 1 to 1000 1000 most severe
551. w path e Enter the path as hexadecimal values e 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 Remotelndex DINT If you use an asterisk to designate the element number of the remote array the Remotelndex provides the element number To change the element number set this member to the required value If the message Then the remote array is the reads data Source element writes data Destination element RemoteElement STRING 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 If the message Then the remote array is the reads data Source element writes data Destination element Publication 1756 RMOOSI EN P January 2007 Mnemonic Data Type UnconnnectedTimeout DINT Input Output Instructions MSG GSV SSV IOT 143 Description Time out for an unconnected message or for making a connection The default value is 30 seconds Ifthe messageis Then unconnected The ER bit turns on if the controller doesn t get a response within the UnconnectedTimeout time connected The ER bit turns on if the controller doesn t get a response for making the connection within the UnconnectedTimeout time ConnectionRate DINT
552. wise AND Source Operand Type Format Description Source B k Source A SINT immediate value to AND with Source B Dest 1 INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Source B SINT immediate value to AND with Source A INT tag DINT A SINT or INT tag converts to a DINT value by zero fill Destination SINT tag stores the result INT DINT E Structured Text dest A AND B a as ae Use AND or the ampersand sign amp as an operator within an expression This expression evaluates sourceA AND sourceB See Structured Text Programming for information on the syntax of expressions within structured text AND 01 Function Block AND Es Bitwise AND Operand Type Format Description AND tag FBD_LOGICAL structure AND structure SourceA SourceB Publication 1756 RMOOSI EN P January 2007 306 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Input Parameter Data Type FBD LOGICAL Structure Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set SourceA DINT Value to AND with SourceB Valid any integer SourceB DINT Value to AND with SourceA Output Parameter Data Type EnableOut BOOL Dest DINT Description Arithmetic Status Flags Fault Conditions Execution Condition prescan Valid any integer Description The instruction produced a valid result
553. wledge all conditions of this alarm Requires a False to True transition while the alarm condition s are Unacknowledged Default is cleared OperAckAll BOOL Operator Acknowledge All Set by the operator interface to acknowledge all conditions of this alarm Requires a False to True transition while the alarm condition s are Unacknowledged The alarm instruction clears this parameter Default is cleared HHProgAck BOOL High High Alarm Program Acknowledge Set by the user program to acknowledge the alarm high high condition Requires a False to True transition while the alarm condition is Unacknowledged Default is cleared HHOperAck BOOL High High Alarm Operator Acknowledge Set by the operator interface to acknowledge the alarm high high condition Requires a False to True transition while the alarm condition is Unacknowledged The alarm instruction clears this parameter Default is cleared HProgAck BOOL High Alarm Program Acknowledge Set by the user program to acknowledge the alarm high condition Requires a False to True transition while the alarm condition is Unacknowledged Default is cleared HOperAck BOOL High Alarm Operator Acknowledge Set by the operator interface to acknowledge the alarm high condition Requires a False to True transition while the alarm condition is Unacknowledged The alarm instruction clears this parameter Default is cleared LProgAck BOOL Low Alarm Program Acknowledge Set by the use
554. wledged Set Alarm is both active and unacknowledged Cleared Alarm is either inactive or acknowledged or both ROCPosInAlarmUnack BOOL Indicates whether the positive rate of change alarm condition is active and unacknowledged Set Alarm is both active InAlarm and unacknowledged Cleared Alarm is either inactive or acknowledged or both ROCNeglnAlarmUnack BOOL Indicates whether the negative rate of change alarm condition is active and unacknowledged Set Alarm is both active InAlarm and unacknowledged Cleared Alarm is either inactive or acknowledged or both Publication 1756 RMOOSI EN P January 2007 58 Analog Alarm Instruction ALMA Output Parameter Suppressed Data Type BOOL Description Indicates whether the alarm is suppressed Set Alarm suppressed Cleared Alarm unsuppressed Disabled BOOL Indicates whether the alarm is disabled Set Alarm disabled Cleared Alarm enabled MinDurationACC DINT Indicates the elapsed time since the first non normal level excursion was detected When this value reaches MinDurationPRE the pertinent alarm condition s become active and notification s are sent to clients HHInAlarmTime LINT Timestamp of high high condition detection HHAlarmCount HInAlarmTime DINT LINT The number of times the high high condition has been activated If the maximum value is reached the
555. wo boolean inputs To perform a bitwise XOR see page 13 311 Structured Text Use XOR as an operator within an expression The operands must be BOOL values or expressions that evaluate to BOOL values This expression evaluates whether only operandA or only operandB is set true See Appendix B for information on the syntax of expressions within structured text Function Block Operand Format Type Description BXOR tag FBD_BOOLEAN_XOR structure BXOR structure FBD_BOOLEAN_XOR Structure Input Parameter Data Type Description Enableln BOOL Enable input If cleared the instruction does not execute and outputs are not updated Default is set In1 BOOL First boolean input Default is cleared In2 BOOL Second boolean input Default is cleared Output Parameter Data Type Description EnableOut BOOL Enable output Out BOOL The output of the instruction Description The BXOR instruction performs an exclusive OR on two Arithmetic Status Flags Fault Conditions boolean inputs Out In1 XOR In2 not affected none Publication 1756 RMOOSI EN P January 2007 326 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Execution Condition prescan Function Block Action No action taken instruction first scan No action taken instruction first run No action taken Enableln is cleared EnableOut is cleared Enabl
556. words in 32 bit words in 16 bit words in 32 bit words in PLC 3 processor Logix5000 controller PLC 3 processor Logix5000 controller 2 p 2 2 p 4 3 3 3 3 4 4 4 The typed commands maintain data structure and value The word range commands fill the destination tag contiguously Data structure and value change depending on the destination data type Specify PLC 2 messages The PLC 2 message types are designed for PLC 2 processors Select this command If you want 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 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 Logix5000 tag appropriately stores the transferred data typically as an INT array Publication 1756 RMOOSI EN P January 2007 164 Input Output Instructions MSG GSV SSV IOT MSG Configuration The following examples show source and destination tags and Examples elements for different controller combinations For MSG instructions originating from a Logix5000 controller and writing to another controller Message Path Logix5000 Logix5000 Example Source and Destination source tag array_1 0 e estination tag array Z 0 You can use an a
557. xX JSR Routine Input Parameters Return Parameters g g Jump to Subroutine T The operands are the same as those for the relay ladder JSR instruction Publication 1756 RMOOSI EN P January 2007 440 Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT SBR InputPar x Publication 1756 RMOOSI EN P January 2007 SBR Operands SBR Subroutine SBR Subroutine Input par E ATTENTION A For each parameter in a 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 produce unexpected results The SBR instruction must be the first instruction in a relay ladder or structured text routine Relay Ladder Operand Type Format Input BOOL tag parameter SINT array tag INT DINT REAL structure Structured Text Description tag in this routine into which you want to copy the corresponding input parameter from the JSR instruction The operands are the same as those for the relay ladder SBR instruction Function Block X SBR Subroutine Parameters 8 The operands are the same as those for the relay ladder SBR instruction Program Control Instructions JMP LBL JSR RET SBR JXR TND MCR UID UIE AFI NOP EOT SFP SFR EVENT 441 RET Operands RET Return Retu
558. xt Does not affect processing Function Block Enable input If cleared the instruction does not execute and outputs are not updated Default is set InFault BOOL BOOL The digital signal input to the instruction Ladder Logic Follows rung state Structured Text Copied from instruction operand Default is 0 0 Input bad health indicator If In is read from a digital input then InFault is normally controlled by the digital input fault status When InFault is set it indicates the input signal has an error Default is cleared good health BOOL Specifies how alarm is activated When set alarm condition is activated when In is Set When reset alarm condition is activated when In is Cleared Default is set AckRequired Latched i Condition BOOL BOOL Specifies whether alarm acknowledgement is required Set Acknowledgement required Cleared Acknowledgement not required Default is set Specifies whether alarm is latched Latched alarms remain InAlarm when the alarm condition becomes false until a Reset command is received Set Latched Cleared Unlatched Default is cleared Publication 1756 RMOOSI EN P January 2007 Digital Alarm Instruction ALMD 35 Ladder Logic Copied from instruction operand Structured Text Copied from instruction operand Input Parameter Data Type Description ProgAck BOOL Program Acknowledge Set by the user pro
559. y 2007 416 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Execution Condition Relay Ladder Action prescan EU bit is set to prevent a false unload when scan begins LEN 0 Mii V POS lt 0 yes r EM is cleared EM is set Ye EM is set no uH yes DN is set no mj rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 Condition rung condition in is false EU bit is cleared LEN 0 yes Relay Ladder Action Array File Shift Instructions BSL BSR FFL FFU LFL LFU 417 n POS 0 yes V EM is cleared yes Y EM is set EM is set yes DN is set rung condition out is set to false Publication 1756 RMOOSI EN P January 2007 418 Condition rung condition in is true Array File Shift Instructions BSL BSR FFL FFU LFL LFU Relay Ladder Action EU 0 T es examine EU bit EU bit is set y no es iu POS lt 0 y no Y EM bit is cleared EM bit is set POS lt 0 Y Y EM bit is set iti es EM bit is cleared y EM bit is set i no yes
560. y Ladder Structured Text value 0 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT 301 Swap Byte SWPB Operands The SWPB instruction rearranges the bytes of a value SWPB Relay Ladder Swap Byte Source Order Mode Dest Operand Type Format Enter Source INT tag tag that contains the bytes that you want to rearrange DINT REAL Order Mode Ifthe Source And You Want To Change the Bytes To Then Select Is an This Pattern Each Letter Represents a Different Byte INT n a any of the options DINT ABCD DCBA REVERSE or enter 0 REAL ABCD CDAB WORD or enter 1 ABCD BADC HIGH LOW or enter 2 Destination INT tag tag to store the bytes in the new order DINT Ifthe Source Then the Destination Must Be an Is an REAL INT INT DINT DINT DINT REAL REAL SWPB Source OrderMode Dest Structured Text The operands are the same as those for the relay ladder SWPB instruction If you select the HIGH LOW order mode enter it as HIGHLOW or HIGH LOW without the slash Publication 1756 RMOOSI EN P January 2007 302 Move Logical Instructions MOV MVM BTD MVMT BTDT CLR SWPB AND OR XOR NOT BAND BOR BXOR BNOT Description The SWPB instruction rearranges the order of the bytes of the Source It places the result in the Destination When you read or write ASCII characters you typically do not need to swap ch
561. ywords Publication 1756 RMOOSI EN P January 2007 Appendix B Function Block Attributes Introduction This appendix describes issues that are unique with function block instructions Review the information in this appendix to make sure you understand how your function block routines will operate IMPORTANT When programming in function block restrict the range of engineering units to 10 5 because internal floating point calculations are done using single precision floating point Engineering units outside of this range may result in a loss of accuracy if results approach the limitations of single precision floating point 4 10 38 Choose the Function Block To control a device use the following elements Elements input reference IREF function block output reference OREF output wire connector OCON input wire connector ICON Publication 1756 RMOOSI EN P January 2007 642 Function Block Attributes Use the following table to choose your function block elements z If You Want To Use a supply a value from an input device or tag input reference IREF send a value to an output device or tag output reference OREF perform an operation on an input value or values and function block produce an outp ut value or values transfer data between function blocks when they output wire connector OCON and an input wire are connector ICON e far apart on the same sheet
562. ze in Elements Source strings a 0 DATA O 00 Dim To Vary 0 Size data size a 24 Structured Text SIZE strings a 0 DATA 0 0 data size a Chapter 10 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Introduction Use the array file shift instructions to modify the location of data within arrays If You Want To Use This Instruction Available In These Languages See Page Load bits into shift bits through and unload BSL relay ladder 388 bits from a bit array one bit at a time BSR relay ladder 392 Load and unload values in the same order FFL relay ladder 396 FFU relay ladder 402 Load and unload values in reverse order LFL relay ladder 408 LFU relay ladder 414 You can mix data types but loss of accuracy and rounding errors might occur For relay ladder instructions 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 Publication 1756 RMOOSI EN P January 2007 388 Array File Shift Instructions BSL BSR FFL FFU LFL LFU Bit Shift Left BSL The BSL instruction shifts the specified bits within the Array one position left Operands Relay Ladder Ls END Operand Type Format Description Array Array DINT array tag array to modify Control CDNS Source Bit Length specify the first element of the group of elements do
Download Pdf Manuals
Related Search
Related Contents
Cables Direct PC-107 parallel cable Bedienungsanleitung Fujitsu PRIMERGY Econel 200a Xeon 2.8GHz 1GB 2x160GB 7.2K DVD Parrilla de Mesa a Carbón Sencor SWM 170 RDS FM transmitter iMAG LTS Multi-Channel SQUID System Addonics AD4SAML-PCI TAB-705 7" (18 CM) TABLET WITH ANDROID™ 4.2 User Manual Thesis - Técnico Lisboa Copyright © All rights reserved.
Failed to retrieve file