help with turning one ttl off if another is turned on

bbrendon

Active Member
 
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?
 
START
  TSTEQ OP1 1  
  SET OP2 0  
 
  TSTEQ OP2 1  
  SET OP1 0      
 
  END   
 
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.
 
Thanks.
 
I'm using a web get to control on or off.
 
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. 
 
Back
Top