escoplcguy;433417this is why i ask about them running simultaniously.....its not even a matter of how incredibly fast its running its scan then switching back and forth (i know its still important) as much as can it do 2 or more at the same time. [/quote said:
Let's put it this way....
I have one rung of logic reading Photoeye A to trigger Output A and I have one rung of logic reading Photoeye B to trigger Output B.
When the PLC scans the logic, it does not scan those rungs simultaneously, it scans the logic sequentially, from top to bottom. The top is the beginning of one scan and the bottom is the end of one scan.
Let's say now I decide to use subroutines. I write logic where Photoeye A calls Subroutine A. Within Subroutine A I have logic that controls Output A. I have a similar setup for B.
When the PLC runs that logic lets say both photoeyes are made. Do those routines get scanned simultaneously? Again, no, they run sequentially. The scan jumps from the main routine to Sub A. It runs Sub A once (not, "until it finishes") and then returns to the main routine. Then it jumps to Sub B and runs it once. Then it returns to the main routine where we finish one scan of the program. We then start all over with a new scan where in all probability we do the exact same thing again. Until one of those routines "finishes".
An Event task would simply make the act of jumping to the routine happen immediately when the event occurs instead of waiting for the scan to reach the rung that calls the routine.
That description got a lot longer than I intended, but hopefully it helps a little.
OG