Hmmn. I wonder what happened to my previous reply

adcin porta.0, vin
if compvalue > (vin + 1) or compvalue < (vin - 1) then serout porta.5,6,[#vin]
pause 10
compvalue = vin

Ok. I am using a pickit with the on board test pot.
with no if statement I get a stream of numbers in hyperterminal that range from 0 to 255 when I turn the pot so it seems like my adcin is working as I would expect.

Without a pause the if statement is always false. With a pause of 10 the if statement becomes true when I turn the pot fast but not when I turn it slowly. The longer the pause the more slowly I can turn the pot and get a result in Hyper terminal.

Is it possible that the whole code executes while the adcin is being done in the background? it seems that compvalue is always = to vin. I am confused!