Basically if ttl1 is on I want ttl2 off and vise versa, but I think I get into a race condition because its not working reliably. Any ideas on a solution?
If I understand what you want your code to do is to simply toggle between OP1 and OP2.
Are you setting the initial state of OP1 and OP2 somewhere?
If the initial condition of OP1 is 0 expression will evaluate to false and the SET OP2 statement is skipped.
OP2 is now in an undetermined state. If it is 0 falls out the end of the routine.
Other debugging thoughts:
When in doubt just stick a long delay between the the two action for debugging.
When debugging use the VARs to echo stuff to the web interface so you can see it.
what is the event that you are following to cause the two to toggle? Use that event to trigger the two to toggle to opposite states rather than using the outputs to trigger each other.
I'm using it to control a furnace. Basically I want to make sure the FAN control or HEAT control is off before turning the other on. Right now I do two web gets to make sure the other is off before turning one on but I thought it would be nice to also make sure that is the case in the PLC code.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.