Bit Field Distribute (BTD)
This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The BTD instruction copies the specified bits from the Source, shifts the bits to the appropriate position, and writes the bits into the Destination.
Available Languages
Ladder Diagram
Function Block
This instruction is not available in function block.
Structured Text
This instruction is not available in structured text.
Operands
There are data conversion rules for mixed data types within an instruction. See Data Conversion.
Ladder Diagram
Operand | Type | Format | Description |
---|---|---|---|
Source | SINT INT DINT | immediate tag | Tag that contains the bits to move |
Source bit | DINT | immediate (0-31) | Number of the bit (lowest bit number) from where to start the move Must be within the valid range for the Source data type |
Destination | SINT INT DINT | tag | Tag where to move the bits |
Destination bit | DINT | immediate (0-31) | The number of the bit to which the data should be moved must be within the valid range for the Destination data type. |
Length | DINT | immediate (1-32) | Number of bits to move |
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 Source) and the Length (number of bits to copy). The Destination bit identifies the lowest bit number 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.
A SINT or INT tag is converted to a DINT value by zero-fill.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Rung-condition-in is false. | N/A |
Rung-condition-in is true. | The instruction copies and shifts the Source bits to the Destination. |
Postscan | N/A |
Examples
Example 1
Ladder Diagram
When enabled, the BTD instruction moves bits within value_1.
Example 2
When enabled, the BTD instruction moves 10 bits from value_1 to value_2.
Provide Feedback