SQC Instruction

epdiesel

Supporting Member
Join Date
Sep 2023
Location
Wisconsin
Posts
7
Hello,

Can anyone explain the sequencer compare instruction to a beginner PLC programmer, if you could use a actual real world application that would be of great help as well! Thanks much! :)
 
SQC compares an input to the provided data. A memory file stores the data to be compared and SQC connects to the input. If the input signal is equal to the word stored in the data file SQC determines that they are the same and energizes the Bit found for example energises an output.
It is the equivelent I suppose as a rung of contacts that are either true or false if the pattern matches a particular pattern stored in the data file then the result is true.
To be honest never been a fan of sequencer blocks prefer to do my sequences using a word as a step number, the logic then evaluates the step number you want to go to. Anybody who has to diagnose a step sequncers can find it a bit mind boggling, siemens had similar add on blocks but not many people used them.
For me personally, I always use a step sequence word based on steps of at least 10, that way if you need to add other steps you have plenty of spares,it also is self explanatory for anybody looking at the program if documented well, allows skiping steps, can be foreced back to a previous step. Easy to modify or extend, I nearly always use the sequence number to populate messages on an HMI to show the current operation.
A simple example is:
0 =IDLE
If 0 AND x AND y ANDNOT Z MOVE 10 SEQWord. //Step 1
IF 10 AND A AND B ANDNOT C MOVE 20 SEQword. //Step 2
IF 10 ANDNOT A MOVE 10 SEQWord //Move back Step 1
IF 20 ....... AND so on
Don't get me wrong, sequencers are ok, but they can be a little hard to negotiate. & it is personal preference.
 
The SQC instruction is analogous to a light timer e.g. here https://www.walmart.com/ip/Hyper-Tough-Indoor-Analog-Timer-Single-Grounded-Outlet/725810211?wmlspartner=wlpa&selectedSellerId=0&wl13=1781&adid=22222222278725810211_117755028669_12420145346&wmlspartner=wmtlabs&wl0=&wl1=g&wl2=m&wl3=501107745824&wl4=pla-306310554666&wl5=9005585&wl6=&wl7=&wl8=&wl9=pla&wl10=8175035&wl11=local&wl12=725810211&wl13=1781&veh=sem_LIA&gclsrc=aw.ds&&adid=22222222238725810211_117755028669_12420145346&wl0=&wl1=g&wl2=m&wl3=501107745824&wl4=pla-306310554666&wl5=9005585&wl6=&wl7=&wl8=&wl9=pla&wl10=8175035&wl11=local&wl12=725810211&veh=sem&gad_source=1&gclid=CjwKCAjw4P6oBhBsEiwAKYVkqxID_Y8fN6jNJ7GJvujlJBzJs1OF0zvEAyrllxUbTcWcYjMxgv1vbBoCI5YQAvD_BwE, someone might use to make it seem their house was occupied when they were actually away on a trip or vacation.

Such a light timer might turn on a lamp at 7pm and turn it off at 11pm. The on/off action of the light timer is implemented via adjustable plastic nubs on a dial that trigger an electrical switch to send power to the lamp when the dial is at certain positions. The dial in turn rotates once per day so on each day it is at the same position at the time time of day. The position of the nubs determines when the switch, and the lamp, are on our off.

Expanding the idea, a second timer could be used to control outside lights to turn on at 7pm and off at 6am, or a second set of nubs, a second dial, and a second switch could be added to the first timer, so one device could control two circuits, or multiple circuits with more layers.

Expanding the concept further, times such as 7pm and 11pm are represented by the nubs being near the switch can be conceptually thought of as events, so instead of times, a device that responds to a sequence of events that can be ordered, with a drum (several dials on the same axis), driven by discrete events instead of continuous time, could be be built, and indeed such drum sequencers have been, and probably still are, used to control processes.

The SQC instruction is the digital version of a drum sequencer. The advantages are simplicity of programming events and simplicity of validation of outputs.

Simplicity of programming: I assume the SQC uses an edge trigger, so if the SQC is at step N and the state of inputs necessary to transition to step N+1 is X, then it is fairly simple to make a rung or rungs ANDing (SQCstate is N) and (X) that can be ORed with all other transition conditions to feed the SQC and trigger the transitions.

Simplicity of validation of outputs: the only possible combinations of outputs are controlled by the outputs' states at each defined step of the SQC. For example, say the process is baking bread on a set of covers, and it is necessary to turn off gas to the oven temporarily when the doors to the oven are opened to allow loaves to enter and exit the oven; it would be easy to ensure that constraint was met by a brief check of the possible output combinations from the SQC.

As @parky notes, the SQC is not the only way to skin this cat, but it is another tool in the toolbox.
 
Yes Brian is right, perhaps a better equivelent is the old washing machine selector, often you select a program, as the dial rotates it enables contacts driven by cams to switch on or off for example motors, solenoids heating elements, even these might have interlocks like wait until water level reaches a pre-set amount, or until the water temperature reached a certain level before re-enabling the motor again, the only difference is it will be the logic driving it instead of a motor. I doubt that any modern washer now has a mechanical drum now though.
I seem to remember an old post on here some years ago regarding a drum sequencer of the mechanical type where it was programmable similar to the light timer.
 
An interesting fact, in the early 80's I was going through a divorce, I let my wife take most of the appliances etc. I was working out of town & having a pint with one of the sites engineers, he had a washer that was perfect, he had replaced it with a colour (yes I'm English), one instead of white, I loaded it into my car took it home, worked ok I thought, however, noticed it was not heating, tracing the heating back (element was ok) to the cam timer to check the contacts were ok, it turned out to be a wrong cam had been fitted in the assembly at the factory, it was not closing the heater contact, the heater was comming on during spin, the cams had not been replaced or moved as the assembly was as factory riveted, so must have been done in assembly, I filed off the cam at the spin segment, drilled some small holes where it should be & moulded some epoxy cement to make a new cam worked fine after that, the clothes were definitely cleaner.
 
PARKEY AND DRBITBOY thanks foe the replies, yes this makes much more sense now. I wanted a better understanding so i could complete a lab for class. I am going to attach it below. I have the array setup (the little lobes on the washing machine cam) in the correct way for the given problem. My only question (kind of relating back to the mechanical day/night light timer) is how I can get this program to advance through the (lobes)? Here is the problem closely quoted from the handout "Create a new program using a pair of sequencer compare and sequencer output commands to program a mixing machine with five sequential steps." I will include pictures of the arrays for the four inputs that need to be controlled and four outputs that need to be controlled.

Here is some more text at the bottom of my handout. "Enter the program and demonstrate that is functions as intended. For example, to start the mixing machine, the door must be closed. After it is closed, the machine will energize a machine running light and begin to fill the tank. Once the Tank Filled input is made, then the machine will advance to the next step and run the mixing motor. Verify that each step proceeds as indicated and that you can restart the mixer machine control sequence from the beginning."


Our trainers in class have discrete i/o , a row of toggle switches and a row of led lights, so I am guessing the inputs called out on the handout will need to be manually triggered with the toggle switches, as well as the output wont be starting anything rather just illuminating a led light. I am just not sure how to advance the SQC using the inputs. Use all of the inputs and create a or statement? But if I did that any of the switches could trigger the next step in the sequence which would be incorrect. I'd need like a check in front of each switch saying the switch before it in the sequence has been made allowing the next switch to function? I am not sure.

IMG_3660.jpg IMG_3659.jpg
 

Attachments

  • SEQ_LAB_1PDF.pdf
    319.1 KB · Views: 5
@ TheWaterboy, lol, She had already taken them or i would have & to be honest, I think the original machine rubber seal was about to perish so probably got the best deal, although I also lost the fridge/freezer, another guy gave me a fridge with small freezer compartment so ideal for me.
you use the SQO function to effectively move position
There are five parameters MASK: The address of the mask word or file through which the instruction moves data
DEST: Address of the output word or file for a SQO to which the instruction moves data from its sequencer file

control: Instruction’s address and control element 3 words I believe for SLC that stores the status byte of the instruction, the length of the file, and the position in the file.
LENGTH: Number of steps of the sequencer file
POSITION: The word location or step in the sequencer file from/to which the instruction moves
It's a long time since I looked at one of these perhaps look at this

https://instrumentationtools.com/plc-sequencer-instruction-with-example/?utm_content=cmp-true
 
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.
 

Similar Topics

I need to convert a SLC SQC sequencer instruction to control logix. There is no SQC instruction in ControlLogix just SCI, SQO, and SQL. Has anyone...
Replies
1
Views
2,205
Hello all, I was hoping to get some advice on an issue I am having. We are doing a conversion slc to clx. The original code uses a SQC...
Replies
1
Views
2,425
I am new to RS Logix. Thank you to the peolpe who have posted help on the SQO instructions. I have been writting simple programs for the past two...
Replies
0
Views
1,887
Hey guys, My name is David and I began teaching myself the art of PLC programming using RSLogix 500 last summer. I am currently working on...
Replies
70
Views
14,554
Back
Top Bottom