FSC(File Search & Compare) Ladder Logic Instruction

Definition

The FSC instruction is a ladder logic rung output instruction that compares data in an array, element by element. The instruction uses a Control data type in conjunction with a user defined expression.  The instruction is enabled when the preceding logic is true and disabled otherwise.

Insure the Length and Position does not travel outside the array boundaries.

List of possible arguments

CONTROL Must be a Control Data Type

  • Control.EN     High when the instruction is enabled.
  • Control.DN     When the .POS is equal to the .LEN
  • Control.ER      Error bit
  • Control.IN      Inhibit bit is set when a true comparison is detected. Clear the bit to continue the search operation.
  • Control.FD      Set when a true comparison is found. Similar to the Inhibit bit.
  • Cotnrol.LEN   The number of elements in an array to search.
  • Contol.POS     The current element the instruction is comparing.

LENGTH Number of elements in the array to be compared. Constant type no tags.

POSITION The current element in the array. Is an element of the control tag and can be used in the expression to step through arrays.

MODE Can be ALL or INCREMENTAL. Selecting ALL will enable the instruction to execute from the first element in an array to the last element in an array on a false to true transition. INCREMENTAL will enable the instruction to execute one element in an array for every false to true transition.

EXPRESSION can contain one or more of the following data types

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

Note: The REAL data type is supported for safety routines on the 1756-L7xS series of controllers.

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

Expressions are executed in a predetermined order of operation, not the order they are written in. The operation order may be changed by placing 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                                            –(subtract), +(add)
  • 7                                            AND
  • 8                                            XOR
  • 9                                            OR

If the Position or Length is less than zero a major fault will occur. Make sure the length is less than or equal to the actual array size. If the Length value is set higher than the length of the array the destination value will be wrong.

Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.

 

SRT(Sort File) Ladder Logic Instruction

Definition

The Sort File instruction is a ladder logic rung instruction that sorts data in an array into ascending order.  The instruction is enabled when the preceding logic is true and disabled otherwise.

The Sort File instruction uses the Control data type to sort the data.

Insure the Length and Position does not travel outside the array boundaries.

List of possible arguments

ARRAY TAG & DIMENSION TO VARY must be an array and the dimension of the array must be pointed out.

ARRAY can be one of the following data types

  • SINT              
  • INT
  • DINT
  • REAL
  • DIM TO VARY Must be a Constant with one of these values 0,1,2
  • CONTROL Must be a Control Data Type
  • LENGTH The amount of elements in the array to average
  • POSITION Is the beginning position in the array to average

If the Position or Length is less than zero a major fault will occur. Make sure the length is less than or equal to the actual array size. If the Length value is set higher than the length of the array the destination value will be wrong.

Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.

 

SIZE Ladder Logic Instruction

Definition

The Size Ladder instruction calculates the size of a dimension in an array. Arrays can have up to three dimensions. The instruction is enabled when the preceding logic is true and disabled otherwise. The Source can be an array, structure or string.

List of possible arguments

DIMENSION TO VARY

CONSTANT     Can be 0,1,2 for dimensions 0,1,2

SOURCE can be any of the following arrays:

  • SINT              
  • INT
  • DINT
  • REAL
  • STRUCTURE
  • STRING

SIZE can be any of the following:

  • SINT
  • INT
  • DINT
  • REAL

Note: The data type REAL is supported for safety routines in the 1756-L7xs processors.

CPS (Synchronous Copy File) Ladder Logic Instruction

Definition

The Synchronous Copy File instruction is a ladder logic rung output instruction that copies data from the Source to the Destination x amount of elements long. The Source data remains the same. The CPS instruction cannot be interrupted by other tasks running in the processor. Use this instruction when you want to insure the data being copied is not changed by higher priority tasks running in the processor. [click to continue…]

COP (Copy File) Ladder Logic Instruction

Definition

The Copy File instruction is a ladder logic rung output instruction that copies data from the Source to the Destination x amount of elements long. The Source data remains the same.

Insure the Length does not travel outside the array boundaries. Use the SIZE instruction to determine how many elements are in an array. [click to continue…]