LEQ (Less Than or Equal To) Ladder Logic Instruction

Definition

The Less Than or Equal To instruction is a ladder logic rung input instruction that compares two values. If Source A is less than or equal to Source B the logic to the right of the instruction, or rung-condition-out, is enabled and disabled otherwise. The values can be constants, tags or any combination.

Strings can be compared. The software compares the hexadecimal value of the characters to determine if one string is greater than or less than another.

List of possible arguments

SOURCE A and SOURCE B can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL
  • STRING

Note: Negative numbers are valid.

GEQ (Greater Than or Equal To) Ladder Logic Instruction

Definition

The Greater Than or Equal To instruction is a ladder logic rung input instruction that compares two values. If Source A is greater than or equal to Source B the logic to the right of the instruction, or rung-condition-out, is enabled and disabled otherwise. The values can be constants, tags or any combination.

Strings can be compared. The software compares the hexadecimal value of the characters to determine if one string is greater than or less than another.

List of possible arguments

SOURCE A and SOURCE B can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL
  • STRING

Note: Negative numbers are valid.

GRT (Greater Than) Ladder Logic Instruction

Definition

The Greater Than instruction is a ladder logic rung input instruction that compares two values. If Source A is greater than Source B the logic to the right of the instruction, or rung-condition-out, is enabled and disabled otherwise. The values can be constants, tags or any combination.

Strings can be compared. The software compares the hexadecimal value of the characters to determine if one string is greater than or less than another.

List of possible arguments

SOURCE A and SOURCE B can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL
  • STRING

Note: Negative numbers are valid.

LES (Less Than) Ladder Logic Instruction

Definition

The Less Than instruction is a ladder logic rung input instruction that compares two values. If Source A is less than Source B the logic to the right of the instruction, or rung-condition-out, is enabled and disabled otherwise. The values can be constants, tags or any combination.

Strings can be compared. The software compares the hexadecimal value of the characters to determine if one string is greater than or less than another.

List of possible arguments

  • SOURCE A and SOURCE B can be any combination of the following data types.
  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL
  • STRING

 

Note: Negative numbers are valid.

NEQ (Not Equal To) Ladder Logic Instruction

Definition

The Not Equal To instruction is a ladder logic rung input instruction that compares two values. If the values are not equal the logic to the right of the instruction, or rung-condition-out, is enabled and disabled if equal. The values can be constants, tags or any combination.

Strings can be compared. Strings are equal if the characters match.

List of possible arguments

SOURCE A and SOURCE B can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL
  • STRING

Note: Negative numbers are valid.

EQU (Equal To) Ladder Logic Instruction

Definition

The Equal To instruction is a ladder logic rung input instruction that compares two values. If the values are equal the logic to the right of the instruction, or rung-condition-out, is enabled and disabled if not equal. The values can be constants, tags or any combination.

Strings can be compared. Strings are equal if the characters match.

List of possible arguments

SOURCE A and SOURCE B can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL
  • STRING

 

Note: Negative numbers are valid.

MEQ (Mask Equal To) Ladder Logic Instruction

Definition

The Mask Equal To instruction is a ladder logic rung input instruction that compares a source value to a compare value through a mask. If the adjusted source and compare values are equal the logic to the right of the instruction, or rung-condition-out, is enabled and disabled if otherwise. The Source value, Mask value and Compare value can be constants, tags or any combination.

Constant or immediate values always default to decimal display. To display the value in a different radix precede the value with one of the following prefixes.

            Prefix              Description                 Example

  •             16#                  hexadecimal                16#FFF0
  •             8#                    Octal                                8#16
  •             2#                    Binary                             2#01010101

List of possible arguments

The SOURCE VALUE, MASK VALUE, and COMPARE VALUE can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL

 

Note: Negative numbers are valid.

LIM (Limit) Ladder Logic Instruction

Definition

The Limit instruction is a ladder logic rung input instruction that compares a test value against a high and low limit. If the test value is in range logic to the right of the instruction, or rung-condition-out, is enabled and disabled if the test value is out of range. The high limit, low limit and test value can be constants, tags or any combination.

List of possible arguments

The LOW LIMIT, HIGH LIMIT, and TEST VALUE can be any combination of the following data types.

  • CONSTANT
  • SINT              
  • INT
  • DINT
  • REAL

 

Note: Negative numbers are valid. Use other comparison instructions for comparing strings.

CMP (Compare) Ladder Logic Instruction

Definition

The Compare instruction is a ladder logic rung input instruction that evaluates an arithmetic expression. If the expression is true the logic to the right of the instruction, or rung-condition-out, is enabled and disabled if the expression is false. The Compare instruction is slower and uses more memory than other comparison instructions; however it allows complex expressions in one instruction.

The expression is defined using tags, math operators, and constants. Parentheses ( ) are used to give priority to sections of an expression. Here is a full list of arithmetic operands.

Expressions are executed in a predetermined order of operation, not the order they are written in. To change the order place sections of the expression in parentheses as an expression enclosed in parentheses will execute first.

Order                          Operation

  • 1                                            () Parentheses
  • 2                                            ABS, ACS, ASN, ATN, COS, DEG, FRD, LN, LOG, RAD, SIN, SQR, TAN, TOD, TRN
  • 3                                            **
  • 4                                            –(negate), NOT
  • 5                                            *, /, MOD
  • 6                                            <, <=, >, >=, =, <>
  • 7                                            –(subtract), +(add)
  • 8                                            AND
  • 9                                            XOR
  • 10                                        OR

Strings can be compared in an expression. Strings are equal if their characters match. The hexadecimal values of the characters determine the value of one compared to another.

List of possible Operators for strings

  • =          equals
  • <          less than
  • <=        less than or equal
  • >          greater than
  • >=        greater than or equal
  • <>        not equal

List of possible arguments

  • SINT               PRE DEFINED STRUCTURE
  • INT                 PRE DEFINED STRUCTURE
  • DINT              PRE DEFINED STRUCTURE
  • REAL             PRE DEFINED DATA TYPE
  • STRING         PRE DEFINED DATA TYPE

 

Note: Not all advanced operands are available in safety routines.