OK, here's a tip which works in SCL and in just about every other text-based language -
TIP :
Don't use an IF...THEN... structure to control a binary variable.
If the thing you're controlling has only two states, us a simple assignment instead. The problem with IF...THEN is that there is no implicit ELSE. You have to remember to code it explicitly. Look at your first line of code -
Code:
IF START AND NOT STOP THEN START_ON:=true;
END_IF;
So imagine the four logic scenarios associated with START and STOP -
Scenario 1 is when START is false and STOP is false - result is START_ON is false.
Scenario 2 is when START is true and STOP is false - result is START_ON is now true.
Scenario 3 is when START is false and STOP is true - result is that START_ON stays true.
Scenario 4 is when START is true and STOP is true - result is that START_ON stays true.
Go back to scenario 1 and START_ON still stays true.
Once your logic has encountered scenario 2 START_ON is true and will stay that way forever. I can't see anything in your code at any point which states 'START_ON := false'.
If the logical condition solves false, the THEN section is not evaluated - the processing just skips straight to the END_IF, or, if you've remembered, the ELSE statement.
What I suspect you meant to write is -
START_ON := START and not STOP;
I'm still not entirely clear about how you wanted the relationship between START, STOP and START_ON to be expressed, but I think this will correctly resolve all 4 logic scenarios.
Regards
Ken