BTD (Bit Field Distribute) Ladder Logic Instruction

Definition

The BTD instruction is a ladder logic rung output instruction that copies user determined bits from the Source, shifts the bits to a user defined position and places the result in the Destination. The instruction is enabled when the preceding logic is true and disabled otherwise. The destination must be a value tag. [click to continue…]

CLR (Clear) Ladder Logic Instruction

Definition & Video Demonstration

The Clear instruction is a ladder logic rung output instruction that clears all the bits (sets them to zero) of the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The destination must be a value tag.

List of possible arguments

DESTINATION can be any of the following data types.

SINT              
INT
DINT
REAL

 

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

NOT (Bitwise NOT) Ladder Logic Instruction

Definition

The Bitwise NOT instruction is a ladder logic rung output instruction that performs a NOT operation on Source the result in the Destination tag. The instruction swaps the value bit by bit, Ones become zeros and zeros become ones. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

NOT truth table

Source             Destination
     0                       1               

     1                       0

List of possible arguments

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

CONSTANT             Can’t be the DESTINATION obviously
SINT              
INT
DINT
 

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

SWPB (Swap Byte) Ladder Logic Instruction

Definition

The Swap Byte instruction is a ladder logic rung output instruction that swaps the bytes from the Source value according to the Order Mode and places the result in the Destination tag. The order mode is chosen via a drop down list on the instruction. The instruction is enabled when the preceding logic is true and disabled otherwise. The Source and Destination values must be tags.

If the Source is an INT the Order Mode is irrelevant, all modes will have the same result.

For example:   If the Source (Represented in ASCII) =   ‘AB’ and the Mode = REVERSE, WORD, or HIGH/LOW the Destination will be ‘BA’

If the Source is a DINT or REAL the Order Mode can one of the three.

Source (Represented in ASCII) = ‘ABCD’

            0 or REVERSE Mode:           Destination will be ‘DCBA’
            1 or WORD Mode:                 Destination will be ‘CDAB’
            2 or HIGH/LOW Mode:         Destination will be ‘BADC’

 

List of possible arguments

SOURCE and DESINATION must follow the rules described below.

If the Source is an INT the Destination must be either an INT or DINT. If the Source is a DINT or REAL the Destination must be a DINT or REAL respectively.

Note: You can either select the Order Mode from the drop down list or enter a 0 for Reverse, 1 for Word, or 2 for High/Low.

XOR (Bitwise Exclusive OR) Ladder Logic Instruction

Definition

The Bitwise XOR instruction is a ladder logic rung output instruction that performs an XOR operation on Source A and Source B and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

XOR truth table

Source A         Source B         Destination
     0                       0                            0
     1                       0                            1
     0                       1                            1
     1                       1                            0
 

List of possible arguments

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

CONSTANT             Can’t be the DESTINATION obviously
SINT              
INT
DINT

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

OR (Bitwise OR) Ladder Logic Instruction

Definition

The Bitwise OR instruction is a ladder logic rung output instruction that performs an OR operation on Source A and Source B and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

OR truth table

Source A         Source B         Destination
     0                       0                            0
     1                       0                            1
     0                       1                            1
     1                       1                            1
 

List of possible arguments

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

CONSTANT             Can’t be the DESTINATION obviously
SINT              
INT
DINT

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

AND (Bitwise AND) Ladder Logic Instruction

Definition

The Bitwise AND instruction is a ladder logic rung output instruction that performs an AND operation on Source A and Source B and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

And truth table

       Source A         Source B         Destination

  •      0                       1                             0
  •      1                        0                            0
  •      0                       0                            0
  •      1                        1                              1

List of possible arguments

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

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT

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

MVM (Masked Move) Ladder Logic Instruction

Definition

The Masked Move instruction is a ladder logic rung output instruction that copies the Source value through a mask and places the masked copy in the Destination tag. The Source remains unchanged. The instruction is enabled when the preceding logic is true and disabled otherwise. The values 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 DESTINATION VALUE can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT

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

MOV (Move) Ladder Logic Instruction

Definition

The Move instruction is a ladder logic rung output instruction that copies the Source value and places a copy in the Destination tag. The Source remains unchanged. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

List of possible arguments

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

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

 

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