
The Yellow Dart (Customer) asked a question.
P2000 Execution Order - External Comms vs Scans
Hi,
I'm looking to better understand PLCs that set up to allow external coil/register setting.
Example setup: coil X1 is externally writable but X1 -> RST runs every scan. If X1 is externally set, will it be temporarily on before the ladder resets it?
The practical use case here is safety interlocks on valves. If the HMI directly sets an output coil, will that valve be energized before the ladder interlock gets a chance to fire?
Thanks,
Pat
It's best to have a couple internal bits that represent the 2 possible coil states, one that is written externally, one that is written by the logic. Then have the bottom of the scan determine which bit drives the actual coil output based on some 3rd "override" bit.
You never want to have multiple places writing to single coil. The above "override" or "manual mode" pattern is very common in PLCs.
Thanks. That's what we're currently doing, and will continue to do. Just curious if it was one of those old patterns that persists even when no longer needed.
It is typically considered bad practice to have something writing to a physical "X" input point that is external or otherwise not an actual physical device wired up to that point. These external writes of an input state normally go to internal "C" bits like Franji1 said.
As for execution order, my understanding was that comms are going on in their own thing by part of the CPU. The Ladder will start a comm instruction but the CPU will manage that in a different process. This is somewhat why in Productivity the comms will run still while the ladder code has stopped executing.
So the ladder will look at the most updated value its memory map has at the start of a ladder scan, and will not update the input map for ladder until the next scan if that value has changed in the meantime because it is not reading the input map yet.
This is a similar situation to very fast acting physical inputs. If something only triggers on for 1-2ms and then is off, your ladder will often not "see" it because it was off at the start of a scan, went on and then off during that same scan, and then is still off at the start of the next scan. This is what pulse catch inputs are used for in PLCs.