Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 501
Special Instructions (FBC, DDT, DTR, PID) Chapter 13
Diagnostic Detect (DDT)
The DDT instruction compares bits in a Source array with bits in a Reference
array to determine changes of state.
Operands:
Relay Ladder
COMPARE Structure
Operand Type Format Description
Source DINT Array tag Array to compare to the reference
Do not use CONTROL.POS in the subscript
Reference DINT Array tag Array to compare to the source
Do not use CONTROL.POS in the subscript
Result DINT Array tag Array to store the results
Do not use CONTROL.POS in the subscript
Cmp control CONTROL Structure Control structure for the compare
Length DINT Immediate Number of bits to compare
Position DINT Immediate Current position in the source
Initial value typically 0
Result control CONTROL Structure Control structure for the results
Length DINT Immediate Number of storage locations in the result
Position DINT Immediate Current position in the result
Initial value typically 0
ATTENTION: Use different tags for the compare control structure
and the result control structure. Using the same tag for both could
result in unpredictable operation, possibly causing equipment
damage and/or injury to personnel.
Mnemonic Data Type Description
.EN BOOL The enable bit indicates that the DDT instruction is enabled.
.DN BOOL The done bit is set when the DDT instruction compares the last bit in the Source and Reference arrays.
.FD BOOL The found bit is set each time the DDT instruction records a mismatch (one-at-a-time operation) or after
recording all mismatches (all-per-scan operation).
.IN BOOL The inhibit bit indicates the DDT search mode.
0 = all mode
1 = one mismatch at a time mode
.ER BOOL The error bit is set if the compare .POS < 0, the compare .LEN < 0, the result .POS < 0 or the result .LEN
< 0. The instruction stops executing until the program clears the .ER bit.
.LEN DINT The length value identifies the number of bits to compare.
.POS DINT The position value identifies the current bit.