Hi,
It's strange if it really does work with the IF-THEN version. However, as is common on these PICs there are analog inputs on PortA. These normaly needs to be switched to digital in order to work in digital mode (no surprise) and this PIC is no exception. I know you're using the ADC in your GetADC rotuine so I know you have it setup some way or another but are you sure that the pins used for the encoder are setup as digital? (ANSEL0 and ANSEL1 registers)

My thought with the LED was something in the line of:
Code:
i VAR BYTE
LED VAR PortB.7
 
EncoderState1 = PortA
 
For i = 0 to EncoderState1
  High LED
  Pause 200
  Low LED
  Pause 200
NEXT
 
'Rest of code
 
Pause 2000  'Just to make a visual "mark" that the loop starts over
Goto Main
This should make the LED blink the number of times equal to the value loaded into EncoderState1. It should help you figure out what's going on.

My money is on the ADC being configured to have its inputs on some of the pins you're trying to use as digital. I don't know why it seems to work with the IF-THEN version though....

If this doesn't help can you post a schematic and the complete code?

/Henrik.