Hi,
I know my questions are relatively elementary and have been partly covered in old topics, but I am having trouble making progress. I need multiple input conditions and multiple output actions
Re compound IF/THEN. I take it that the BLOCK IF / ENDIF function is not available? (used by Johnson Control Basic). I am doing som basic tests using several toggle switches for inputs and output monitor blue LEDs.
The poorly formatted example in the T3000 manual (p176) shows conditional branching to different line numbers, with each branch having an END statement. This allows only one scan through the code. (END statements are not recommended so why are they included in an example?).
How would this example look if END was replaced by ???
My main question is how to get the THEN branch to skip over the following ELSE branch. Unless it skips, then both THEN and ELSE branches execute.
I have tried the following:(using local variable A per previous topic). This is a very simple example for test purposes. The desired result is if both inouts are true outputs 1 and 2 both turn on, otherwise outputs 1 & 2 are off and Output 5 is on.
10 IF IN1 AND IN2 THEN A = 1 ELSE 40
20 IF A = 1 THEN OUT1 = 1
30 IF A = 1 THEN OUT2 = 1
40 OUT5 = 1
If both input conditions are true, both outputs 1 & 2 turn on.- OK
If I then turn off either input, line40 executes (OUT5 comes on) but line30 does not execute (OUT2 also stays on)
If I then make both input conditions true again, line 40 still executes and OUT5 remains on
I can get the correct operation using the (inefficient) code:
10 IF IN1 = 1 AND IN2 = 1 THEN A = 1 ELSE A = 0
20 IF A = 1 THEN OUT1 = 1 , OUT2 = 1 ELSE OUT1 = 0 , OUT2 = 0
30 IF A = 0 THEN OUT5 = 1 ELSE OUT5 =0
I seem to have to explicitly reset Outputs if the turn-on logic is not true.
What am I doing wrong here?