I have two identical programs. Yet in those two, the output does energize when input is toggled. But in this program, it doesn't. Not unless the output itself is toggled.
If the code is in a sub-routine, make sure that you are calling the sub-routine. If it is not scanned the output will not energize. Also, make sure that you have not somehow duplicated the output elsewhere in the program. It could be turned on then off in the same processor scan.
All programs behave like they should. Perhaps not as we expect, but always like they should.
I'm sorry. For some reason on this PC I can't view the image you've embedded/attached so I'm reduced to just making smart unhelpful remarks. (Hmmm... no change there, mutters the rest of the forum ...)
Clarify the question, please.
I do not see any toggling logics in the code fragment, assuming that "toggle" means bidirectional changing the bit state to opposite.
Do you probably mean your attempts to toggle the bit manually from online PC?
I've had this EXACT problem before too. What I do is delete the element and then insert a new element of the same type. Try that, sounds childish but it fixed my problem.
To answer all your questions:
- it happens during Program Run
- how do I know if the sub-routine is being run (or not)?
- XI_7689_DCS should not affect the output because the Modbus relay is opened
- the output isn't duplicated elsewhere; I've checked using cross-reference search
I ended up using one of the other identical program, do "Save As" and correct the tags. Took care of most of the problem.
To Krilun,
Do you have to delete and re-create the same tag as well?
Is this PLC attached to an HMI that could possibly have control of the bit in question? The PLC and the HMI could be fighting over control of the same bit.
You say the output is not cross referenced... try cross referencing the ALIAS, or output, to see if you have mistakenly assigned the alias to more than one tag.
This can happen if you use the same OTE instruction in multiple places in the program. If you need to have the same output in several different rungs or ladders, even if the ladder is inactive, you need to use it as an OTL and OTU.