Chapter 13
Special Instructions (FBC, DDT, DTR, PID)
Mnemonic
Data Type
.DN
BOOL
.LEN
DINT
.POS
DINT
Description:
If you want to detect
One mismatch at a time
All mismatches
Arithmetic Status Flags:
Fault Conditions:
502
RESULT Structure
Description
The done bit is set when the Result array is full.
The length value identifies the number of storage locations in the Result array.
The position value identifies the current position in the Result array.
When enabled, the DDT instruction compares the bits in the Source array
with the bits in the Reference array, records the bit number of each mismatch
in the Result array, and changes the value of the Reference bit to match the
value of the corresponding Source bit.
IMPORTANT
The difference between the DDT and FBC instructions is that each time the
DDT instruction finds a mismatch, the DDT instruction changes the
reference bit to match the source bit. The FBC instruction does not change the
reference bit.
Select the Search Mode
Select this mode
Set the .IN bit in the compare CONTROL structure.
Each time the rung-condition-in goes from false to true, the DDT instruction searches for the next
mismatch between the Source and Reference arrays. Upon finding a mismatch, the instruction
sets the .FD bit, records the position of the mismatch, and stops executing.
Clear the .IN bit in the compare CONTROL structure.
Each time the rung-condition-in goes from false to true, the DDT instruction searches for all
mismatches between the Source and Reference arrays.
Not affected
A major fault will occur if
Result.POS > size of Result array
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
You must test and confirm that the instruction doesn't
change data that you don't want it to change.
The DDT instruction operates on contiguous memory. In
some cases, the instruction searches or writes past the
array into other members of the tag. This happens if a
length is too big and the tag is a user-defined data type.
Fault type
4
Fault code
20