View attachment edited_POSITION TRACKING V2 (THINNED O.pdf
I am dealing with a weird bug in my program, and am looking for some help.
I do not know if my issue stems from the flow of the program, or if I am just utilizing a command incorrectly.
My program is pretty basic, there is just a little bit of complexity in the handling of the data. I am using an encoder attached to a conveyor motor to track the position of plastic bottles on the conveyor. They get sorted into empty boxes off the side of the conveyor using air nozzles.
I am using a photoeye to trigger the storage of the current HSC.ACC value when a bottle is detected. This value is moved to a Long data file and gets an 'offset' added to it; this is the number of encoder pulses between the photoeye and the air nozzle of whichever box is empty.
I use a counter with indirect addressing to 'queue' multiple bottle positions in these long data files (Ladder 4). In another subroutine (Ladder 5), I use another counter to monitor which position in the 'queue' it should be looking for.
MY PROBLEM IS THIS: when the first station finishes and bottles start to be filled into another box, the very first position in the Long data files for the next boxes seems to get skipped. If 320 bottles are sent to the first box, and 320 bottles are knocked into the first box, the next 320 bottles will get sent to the second box, but only 314 will get knocked off. The number of bottles that aren't knocked off seem to correlate to the number of times the counters 'loop' through the Long data files. I observe the very first position in the long data files being updated with a new bottle position, however, it seems to get skipped when it is being monitored for knocking the bottle off.
It seems C5:20 from Ladder 5, Rung 6 gets reset, but when it resets, it doesn't reset to zero, it immediately hops to 1. What is weird is that if Box 1 is already full, and I trigger Box 2 to fill, it doesn't demonstrate this behavior; it will knock off the entirety of the bottles assigned to it.
Any help is appreciated.
Thanks
I am dealing with a weird bug in my program, and am looking for some help.
I do not know if my issue stems from the flow of the program, or if I am just utilizing a command incorrectly.
My program is pretty basic, there is just a little bit of complexity in the handling of the data. I am using an encoder attached to a conveyor motor to track the position of plastic bottles on the conveyor. They get sorted into empty boxes off the side of the conveyor using air nozzles.
I am using a photoeye to trigger the storage of the current HSC.ACC value when a bottle is detected. This value is moved to a Long data file and gets an 'offset' added to it; this is the number of encoder pulses between the photoeye and the air nozzle of whichever box is empty.
I use a counter with indirect addressing to 'queue' multiple bottle positions in these long data files (Ladder 4). In another subroutine (Ladder 5), I use another counter to monitor which position in the 'queue' it should be looking for.
MY PROBLEM IS THIS: when the first station finishes and bottles start to be filled into another box, the very first position in the Long data files for the next boxes seems to get skipped. If 320 bottles are sent to the first box, and 320 bottles are knocked into the first box, the next 320 bottles will get sent to the second box, but only 314 will get knocked off. The number of bottles that aren't knocked off seem to correlate to the number of times the counters 'loop' through the Long data files. I observe the very first position in the long data files being updated with a new bottle position, however, it seems to get skipped when it is being monitored for knocking the bottle off.
It seems C5:20 from Ladder 5, Rung 6 gets reset, but when it resets, it doesn't reset to zero, it immediately hops to 1. What is weird is that if Box 1 is already full, and I trigger Box 2 to fill, it doesn't demonstrate this behavior; it will knock off the entirety of the bottles assigned to it.
Any help is appreciated.
Thanks