Think of SELECT CASE as a series of IF/THENS.
The first time a condition is met the code jumps to END SELECT.
If a "random" value is being tested IF/THEN is probably the better option.
In the example we have been working with when the value is predictable SELECT CASE is nice.
But that also means the order that SELECT CASE uses matches the "predictable" value.
Give this a shot
BTW. I will have limited to none internet till Monday so I may not be around here much in the mean time.Code:SELECT CASE CHAN0 CASE IS < 64 TRISA = %11001111 'D0 PORTA = %00010000 CASE IS < 128 TRISA = %11001111 'D1 PORTA = %00100000 CASE IS < 192 TRISA = %11101011 'D2 PORTA = %00010000 CASE IS < 254 TRISA = %11101011 'D3 PORTA = %00000100 CASE ELSE PORTA = %00000000 END SELECT
Have fun!!!





Bookmarks