BTD (Bit Field Distribute) Ladder Logic Instruction

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.

Source Bit is the number of the bit to start the move. Start at the lowest bit number not the highest.

Destination Bit is where the copied Source value is to be placed.

Possible values for the Source and Destination Bits depending on the data type used.

            SINT               0-7
            INT                 0-15
            DINT              0-31

Length is the number of bits to move

Example:

Source as SINT =                      11001100
Source Bit =                                2
Destination Bit =                       0
Length =                                      2
Destination as SINT =              00000011

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.

Leave a Comment