adccommunitymod (AutomationDirect) asked a question.

Sequencer Block inside a FOR loop.

Created Date: March 12,2018

Created By: FishFacs

**** 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.****

Hello, As the topic says, I have several devices I need to sequence programmatically. It sure would be easier to use a FOR LOOP rather than cutting and pasting sequence code for each device. Does the productivity PLC support putting timed functions (like the sequencer) inside a FOR loop, or does the progress of those functions get lost from memory when the loop moves to the next cycle? PS. I know I could test this myself, but its going to be a few days before I can sit down and program this and would rather know if this functionality is supported ahead of time. Thanks, -FF


  • adccommunitymod (AutomationDirect)

    Created Date: March 12,2018

    Created by: FishFacs

    Hello,

    As the topic says, I have several devices I need to sequence programmatically. It sure would be easier to use a FOR LOOP rather than cutting and pasting sequence code for each device.

    Does the productivity PLC support putting timed functions (like the sequencer) inside a FOR loop, or does the progress of those functions get lost from memory when the loop moves to the next cycle?

    PS. I know I could test this myself, but its going to be a few days before I can sit down and program this and would rather know if this functionality is supported ahead of time.

    Thanks,

    -FF

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: March 12,2018

    Created by: kewakl

    Hello,

    As the topic says, I have several devices I need to sequence programmatically. It sure would be easier to use a FOR LOOP rather than cutting and pasting sequence code for each device.

    Does the productivity PLC support putting timed functions (like the sequencer) inside a FOR loop, or does the progress of those functions get lost from memory when the loop moves to the next cycle?

    PS. I know I could test this myself, but its going to be a few days before I can sit down and program this and would rather know if this functionality is supported ahead of time.

    Thanks,

    -FF

    No !.

    The FOR...LOOP executes in ONE PLC SCAN.

    If the time to execute the for...loop exceeds the WDT, the CPU will fault.

    Describe (in general terms) what you want to do, maybe someone here can help.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: March 16,2018

    Created by: FishFacs

    So, maybe I wasn't clear, but after testing it would appear that what I was asking above actually does work. You can also use timers and counters in a FOR loop, apparently.

    I can't see how they compile, but based on my testing, the sequence/timer/counter functions appear to be just glorified math blocks. What I mean is, each timer block is just a counter that records the exact time at the last last and then increments a value after each scan based on how much time has passed since the previous scan. At the programming level, it appears you can treat them this way. Since the sequence timer is just effectively an incrementing counter, there is no harm in inserting it inside a FOR loop. It won't actually delay the scan or the loop cycle since it isn't actually waiting for anything.

    I could be wrong, but it does seem to be working as I intended (explained above).

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: March 16,2018

    Created by: kewakl

    Post your testing program, maybe someone can add insights.