Hi all.
Got a little problem with a project:

I am reading a single Anaolgue pin, and then sterring a particular LED on depending on the reading

start:

adcin 1, instate

select case instate

case is>220 'actual is 248
portb = %00010000
goto finish

case is>190 'actual is 201
portb = %00001000
goto finish

case is>162 '178
portb = %00000100
goto finish

case is> 139 '154
portb = %00000010
goto finish

case is<133 '108
portb = %00000001
goto finish
case is >132 and is <140 '136
portb = %00000000
goto finish

finish: end select
pause 20
goto start


The first 5 cases are OK, however when I disconnect the input pin so that it is open circuit, rather than setting all LEDs off, for some reason PB1 turns on. The open circuit reading is not in the range for that, as it is 136 which falls into the 6th case.
Each reading sith within a particular window, but for some reason there is a hiccup.

There is a resistor divider and Cap on the input line, and have looked at it on my CRO and can't see any noise on the pin. (anyway, any noise would (should) cause a couple of LEDs to blink?))

Have tried 'F88, 'F819 and 'C715 in the target PCB and in my development board with the same result.
Have also sent the reading to an LCD and each shows up as what it should be.

Any ideas (again?)

Regards,
Peter Moritz.