Simple counting routine

Hi All,

Does it look okay now?


Yes. It looked okay originally except for the (copy-paste?) typo.


Sensor_High contains the conveyor stopped and the carton present


Hmm, I'd be worried about the conveyor stopping, and then starting and stopping again, both times while the same carton is present, as that would trigger a second add and subtract for one carton.



Index_Step - this simply is high when the conveyor is on certain indexes


Same worry.

The debounce TON and one-shot should ensure each carton is counted (added at C1, or added and subtracted at C2 and C3, or subtracted at C4) only and exactly once.
_
 
I agree with Brian, If index goes high & PE is High then it will re-trigger so remove the index (is it really required ?).
If box covers PE then it should not matter if conveyor is indexing or not just the leading edge of the box is the count trigger.
 
If you really feel the need to check the conveyor indexing (and I agree it probably shouldn't be necessary) then if you move those specific XIC to after the oneshots this will remove the possibility of extra triggers caused by the conveyor stopping/starting.
 
Yep I forgot to add that, this could be what is causing your problem if the PE is covered & the conveyor indexes it will create a count.
 
Here is a working logic that will work, note the Conveyor index moved after the one shot & the compare > 0 just in case.

Count.png
 
Not that is necessarily the wrong thing to do, but putting the index XIC after the ONS/PLS could cause the PLC to miss a [carton present] event.
 
Also note that Logix has the CTUD instruction (cf. this link), which is neither here nor there, but that would eliminate the ONS instructions. The CTUD is only available in FB, but I assume it could be wrapped in an AOI and made available to Ladder. The code gains a few rungs but only one branch net, and it may be easier to read:

xic sensor1 ton ton1 50 0
xic sensor2 ton ton2 50 0
xic sensor3 ton ton3 50 0
xic sensor4 ton ton4 50 0

ctudaoi ctud12 ton1.DN ton2.DN ...
ctudaoi ctud23 ton2.DN ton3.DN ...
ctudaoi ctud34 ton3.DN ton4.DN ...







 
Not that is necessarily the wrong thing to do, but putting the index XIC after the ONS/PLS could cause the PLC to miss a [carton present] event.
Placing it there relies on the assumption that the index bit will be on when the carton debounce finishes, yes, just as having it before the oneshot assumes that it will not cycle off/on while the carton present. Without knowing exactly what controls the index bit we have little choice but to rely on some level of assumption.
Also note that Logix has the CTUD instruction, which is neither here nor there, but that would eliminate the ONS instructions. The CTUD is only available in FB, but I assume it could be wrapped in an AOI and made available to Ladder. The code gains a few rungs but only one branch net, and it may be easier to read
Replacing the ADD and SUB with CTU and CTD would also eliminate the oneshot instructions without needing an AOI.
 
Last edited:
Placing it there relies on the assumption that the index bit will be on when the carton debounce finishes, yes, just as having it before the oneshot assumes that it will not cycle off/on while the carton present. Without knowing exactly what controls the index bit we have little choice but to rely on some level of assumption.


yeah, one-twenty-fourth gross of the the other ;).
 
Personally, I would not put the index signal in at all, however, maybe there is some reason for it, I normally would not use the ADD instruction but rather an INC, On this system most contacts/functions also have a one shot mode i.e. a contact can have a one shot pulse Rising or falling function as do many others for example the INC also has an INCP i.e. one shot built in.
 

Similar Topics

Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
170
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
6
Views
258
I'm trying to build my Classic Step 7 programming skills this weekend. I get stuck on little things that are not covered in YouTube tutorials. I'm...
Replies
7
Views
319
I have a program that does a 7 second "scan" sensor calibration routine whenever a setting (setting is called assistance level or "AL" and ranges...
Replies
3
Views
214
Hi all, I have a simple question that I have overcomplicated and gotten stuck on. I have a variable, we can call it "light" that I need to stay...
Replies
4
Views
321
Back
Top Bottom