exactly.So, if I am understanding correctly,
Would I then use the value in integer N7:0/0 to essentially "lock out" other steps of the process so that only one can run at a time? e.g. by not allowing the "Start" sequence to begin unless N7:0 is set to 0?
- I would declare an integer, say N7:0, as "Machine Sequence" or something like that
- When the system is against the Home limit switch, I would use the MOV command to move a value of 0 into integer N7:0 to signify that the system is homed/idle
- When the Reset PB is pressed, I would use the MOV command to move a value of 10 into integer N7:0 to signify that the machine is in the process of resetting
Btw, there are many canonical patterns that are used over and over again in ladder logic. The Start/Stop Circuit pattern, which you already know, is one of them. The main ones are listed here. One of those is called the Step pattern, which is another way to handle this. It is basically uses the Start/Stop Circuit pattern, with a seal-in to maintain a bit for a step in a sequence. I would encourage you to try that also.
However, when you think about it, use a MOV instruction behind some True/False logic, to move a step number into a state tag, is similar to a Start/Stop pattern in that it writes the bits for that step's value into the state tag when the value is something else (i.e. another step), and then the PLC does not change the value until the conditions are True for the next transition from that state, so the PLC effectively "latches" or "seals-in" the bits for that state's value into the state tag.
One big difference between the two approaches is this:
- with the Step pattern using a bit for each step, the code must
- both write a 1 into the bit for the step being transitioned to,
- and write a 0 into the bit for the step being transitioned from
- With the integer state tag, there is only one set of bits (the integer state tag), to hold all step information,
- so when the code writes the bits for the integer value of the step being transitioned to,
- that already takes care of overwriting the bits for the integer value of the step being transitioned from.
- so when the code writes the bits for the integer value of the step being transitioned to,