There is one more input to the SQO and SQC instructions: the state of their
Input Rung.
According to the
manual, SQO and SQC intructions use a False-to-True transition (rising edge) of their
Input Rungs to increment the
Position of the
File element to compare (SQC) or write (SQO). The rising edge is detected on a single scan when the
Input Rung's state is True and
Control object's /EN bit's value is 0. N.B. the
Control object's
/EN bit's value will
usually be the
Input Rung's state on the previous scan cycle. The
Position can also be assigned external to the SQO/SQC instructions.
In addition, the state of their
Input Rungs affects how and whether the SQO and SQC instructions write to
Dest and
Position, their respective outputs.
See
here and
here* for SQO.
See
here and
here* for SQC
* The latter link in each pair is for the SQO/SQI instructions of RSLogix/Studio 5000, which may not operate exactly the same as the RSLogix 500 SQO/SQC. Note that the SQI instruction does not use a rising edge of its
Input Rung to increment the
Position value. I supect this is so a single
Control object can be used for a single SQI/SQO pair.
TL;DR
When the state of its
Input Rung is True, SQO takes a
Position (step; state number) and writes the
Masked bits of its
File** element at that
Position to its output
Destination.
**
File = array of words or long words
SQC compares
Masked
Source bits to the bits at a
Position in its file, and assigns a value of 1 to the
Control object's /FD bit if the comparison sees the same
Masked bit pattern.
SQC and SQO can be thought of as performing somewhat opposite functions: SQC
Source =>
/FD based on
File element bits at
Position; SQO
File element bits at
Position =>
Dest.