adccommunitymod (AutomationDirect) asked a question.

Click PLC For-Next Loop Help

Created Date: December 30,2014

Created By: NBI

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Hey there friends, So I'm trying to optimize an automatic dispensing system, and I'm pretty sure I need to implement a For-Next Loop. Basically, a tray moves along with a conveyor. In this tray are 9 wells that need to be filled. When the well of the tray passes under a photo eye, it tells the conveyor to stop. So when the photo eye has the signal, conveyor moves, and when the signal is broken, it stops and dispenses. Now, if the next tray isn't "bumper to bumper " with the one currently being filled, that last edge of the tray breaks the signal and it will dispense onto the conveyor, leading to a mess and pause in production. I 've attached the code I use that works fine if the trays are end to end, but if there is a gap there, it won't work. I suppose I just need the dispensing output to be triggered 9 times (once for each well), then somehow skip that 10th time that way it won't be triggered again until the first well of the following tray. Thanks for any help or advice you can offer about the For-Next loop or any other aspect of the code! I appreciate it. Thanks, Chris


  • adccommunitymod (AutomationDirect)

    Created Date: December 30,2014

    Created by: jonesjeremya

    Based on my understanding of your description, you 're trying to eliminate an action that is caused by a variable on the conveyor line

    Is there some way to remove this variable on the conveyor? The sensor and logic perform based on the action of the sensor.

    Maybe change the action of the sensor/logic so it's ON when the tray well is detected & present, and off in every other circumstance.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: December 30,2014

    Created by: Tinker

    For a start, PLC programing is nothing like, say, BASIC. You probably do not need a FOR-NEXT loop (there is a good chance one would never need one in a PLC program, while there are some things one would be useful for, they are NOT particularly common tasks). A shift register is a possibility, but maybe not even that.

    I'm not sure I understand the: "that last edge of the tray breaks the signal and it will dispense onto the conveyor " Perhaps you just need a timer that causes the program to ignore that edge, i.e. wait a short time after starting the conveyor before "looking " at the sensor signal. Or maybe just a mechanical adjustment of the sensor might eliminate detecting that edge? (or pretty much what jonesjeremya said)

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: December 30,2014

    Created by: bcarlton

    I see the problem as, you are looking down detecting the raised edge of each well. If you have an individual tray then you are seeing 10 edges for 9 wells. Only when the trays are back-to-back does the lagging edge of one tray merge with the leading edge of the next providing just one raised structure.

    If you look sideways across the tray, possibly near the bottom, can you see 'well ' and 'not well '? If so use a send/receive pair to look across the path waiting for it to be blocked indicating the start of each well.

    Maybe a few pictures of a tray would help.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: December 30,2014

    Created by: NBI

    Hey there friends,

    So I'm trying to optimize an automatic dispensing system, and I'm pretty sure I need to implement a For-Next Loop.

    Basically, a tray moves along with a conveyor. In this tray are 9 wells that need to be filled. When the well of the tray passes under a photo eye, it tells the conveyor to stop. So when the photo eye has the signal, conveyor moves, and when the signal is broken, it stops and dispenses.

    Now, if the next tray isn't "bumper to bumper " with the one currently being filled, that last edge of the tray breaks the signal and it will dispense onto the conveyor, leading to a mess and pause in production.

    I 've attached the code I use that works fine if the trays are end to end, but if there is a gap there, it won't work.

    I suppose I just need the dispensing output to be triggered 9 times (once for each well), then somehow skip that 10th time that way it won't be triggered again until the first well of the following tray.

    Thanks for any help or advice you can offer about the For-Next loop or any other aspect of the code! I appreciate it.

    Thanks,

    Chris

    Expand Post