16ć5, 3 filećtoćfile xor – Rockwell Automation 1772-LP3 PLC - 2/30 Programmable Controller Programming and Operations Manual User Manual
Page 284
File Logic Instructions
Chapter 16
16Ć5
Programming of FileĆtoĆFile OR Instruction
WARNING: The counter address for the File-to-File OR
instruction should be reserved for that instruction. Do
not manipulate the counter accumulated or preset values.
Inadvertent changes to these values could result in unpredictable
or hazardous machine operation or run-time error. Damage to
equipment and/or personal injury could result.
To program a File-to-File OR instruction, press keys [FILE] 16. The
format, and the technique for insertion of numbers, will be identical to that
for the File-to-File AND (Figure 16.2, Section 16.1.1) except that logical
OR operation will replace logical AND operation.
The procedure for using the data monitor mode for data entry or monitor is
presented in Chapter 12.
This output instruction operates on the contents of two data Files A and B
and places the results of the logic operation XOR (exclusive OR) in a third
File R.
The logic operation XOR compares each bit in file A to the corresponding
bit in File B. If the bits are both 1 or both 0, a 0 is stored in the
corresponding bit location of File R. For other conditions, a 1 is stored in
File R (Table 16.C).
Table 16.C
Truth Table for Logical XOR
Bit In File A
Bit In File B
Bit In File R
1
1
0
0
1
0
1
0
0
1
1
0
The XOR operation can be used for diagnostic programming. With the
XOR function, two files, one containing actual I/O states (File A) and one
containing desired I/O states (File B) at a particular point in time, can be
compared. The result, File R, will contain discrepancies between File A
and File B. The discrepancies are errors in machine operation. Additional
programming (Chapter 17, Diagnostic Instructions) can alert the operator
to the malfunction.
16.1.3
FileĆtoĆFile XOR