For this Kind of task i'll prefer using Select Case instead of bang my head everywhere.
I see you check only two bits variable..
if r1sched = 0 and r1ctrl = 1 then
if those are comming from some PORT pins, let's say PORTB.0 and PORTB.1 use the following
that's easier like that.Code:GetPORTB = PORTB & $3 ' mask other bits than B0 and B1 select case GetPORTB Case 0 ' b0=0 b1=0 ' Do your stuff here for that condition Case 1 ' b0=1 b1=0 ' Do your stuff here for that condition Case 2 'b0=0 b1=1 ' Do your stuff here for that condition Case 3 ' b0=1 b1=1 ' Do your stuff here for that condition end select
Or you can also use BRANCH statement that will make your program jump (GOTO) to a specific label depending of the value of your var.
Code:GetPORTB = PORTB & $3 ' mask other bits than B0 and B1 branch GetPORTB[condition0,condition1,condition2,condition3]
BUT in case you still want to use IF then bla blah
Code:IF condition 1 then ' do your stuff here endif IF condition 2 then ' do your stuff here endif IF condition 3 then ' do your stuff here endif IF condition 3 then ' do your stuff here endif




Bookmarks