Hi mackrackit,
I changed the program SELECT CASE to this:
Code:
SELECT CASE CHAN0
CASE IS > 192
TRISA = %11001111
PORTA = %00100000
CASE IS > 254
TRISA = %11001111
PORTA = %00010000
CASE IS > 128
TRISA = %11101011
PORTA = %00010000
CASE IS > 64
TRISA = %11101011
PORTA = %00000100
CASE ELSE
PORTA = %00000000
END SELECT
With this D0 didn't light, D1 lit at 5V, D2 at 3.65V, D3 at 2.45V. Mmm.
So your question was:
What happens if the order of CASE IS is switched around? Why?
My answer is: I don't know for sure
But, is it because for an 8bit ADC the conversion started at 192 (not 255 2_to_the_power_eight) therefore 192 became 5V. 255 would then be greater than the 5V supply reference voltage so wouldn't be read and was missed out. The other readings were all lower so were all calculated and there LED's lit.
I'm suspecting I'm North of the North pole.......Again 
Dave
Bookmarks