Aha! So, really, the only criteria is that you cannot be FILLING more than one station at once?? And you can only fill ONE at a time??
OK... that is a pretty simple constraint.
So, your "RUNNING" flag just becomes a "FILLING" flag that goes up when the START command is seen, and goes down when the fill is done. As Lancie said, you may want some additonal conditions on that... good thoughts Lancie.
For the FIFO... let's talk about the 12-stn machine for simplcity. You are going to have 12 FIFO load rungs, someplace in the existing logic for the machine. When the START PB for the station is pressed, you load the FIFO with the NUMBER of that station.
Now, you still need the new subr. But instead of having to count stations, you maybe just have one flag - FILLING ACTIVE - that either lets you proceed, or just leads to a RET if it's set.
Assuming you proceed, you look to see if the FIFO is Empty. If it is, nothing is waiting to start and again you RET.
If it's not, you do an UNLOAD. The UNLOAD will put a number... a station number... into the register you've designated as the Unload Register. Now, with that number, you can set the STN START CMD flag for that station. Then, RET.
Another thing you'll want your machine reset logic to do is clear this FIFO. After an EStop, or at powerup, you'll want to make sure the FIFO is Empty else it will suddenly try and start a station. And, what happens if the FIFO tries to start the station but the door is open or some starting IK is not met?? The FIFO has been unloaded of that station, so if it doesn't start how big a deal is that and what do you need to do to make sure your logic proceeds to unload the next station number out of the FIFO?
Also, you will have a small issue in that, if say six stations are in the FIFO stack and the OPR suddenly decides that one of them should not run, well there it is in the middle of the stack and you can't get it out. So, good practice requires that you have ANOTHER flag for the station - something like STN START KILL. If, after pressing the START PB and adding the station to the FIFO, the OPR changes his mind later, but before that station has started, he presses a button and it sets the KILL flag. That flag then goes into your station start logic so that when the FIFO is unloaded, the station doesn't start after all and the logic just continues on.
Some more ideas for ya. Just what you needed, right?? LOL! It's always the exceptions and transitions, not the normal RUN stuff, that kills you.
OK... that is a pretty simple constraint.
So, your "RUNNING" flag just becomes a "FILLING" flag that goes up when the START command is seen, and goes down when the fill is done. As Lancie said, you may want some additonal conditions on that... good thoughts Lancie.
For the FIFO... let's talk about the 12-stn machine for simplcity. You are going to have 12 FIFO load rungs, someplace in the existing logic for the machine. When the START PB for the station is pressed, you load the FIFO with the NUMBER of that station.
Now, you still need the new subr. But instead of having to count stations, you maybe just have one flag - FILLING ACTIVE - that either lets you proceed, or just leads to a RET if it's set.
Assuming you proceed, you look to see if the FIFO is Empty. If it is, nothing is waiting to start and again you RET.
If it's not, you do an UNLOAD. The UNLOAD will put a number... a station number... into the register you've designated as the Unload Register. Now, with that number, you can set the STN START CMD flag for that station. Then, RET.
Another thing you'll want your machine reset logic to do is clear this FIFO. After an EStop, or at powerup, you'll want to make sure the FIFO is Empty else it will suddenly try and start a station. And, what happens if the FIFO tries to start the station but the door is open or some starting IK is not met?? The FIFO has been unloaded of that station, so if it doesn't start how big a deal is that and what do you need to do to make sure your logic proceeds to unload the next station number out of the FIFO?
Also, you will have a small issue in that, if say six stations are in the FIFO stack and the OPR suddenly decides that one of them should not run, well there it is in the middle of the stack and you can't get it out. So, good practice requires that you have ANOTHER flag for the station - something like STN START KILL. If, after pressing the START PB and adding the station to the FIFO, the OPR changes his mind later, but before that station has started, he presses a button and it sets the KILL flag. That flag then goes into your station start logic so that when the FIFO is unloaded, the station doesn't start after all and the logic just continues on.
Some more ideas for ya. Just what you needed, right?? LOL! It's always the exceptions and transitions, not the normal RUN stuff, that kills you.