wallaby, First place these declarations at the top of your program:

' LCD SETUP DEFINES
DEFINE LCD_DREG PORTA ' set LCD data port
DEFINE LCD_DBIT 0 ' set starting bit ( 0 or 4 ) if 4 bit bus
DEFINE LCD_RSREG PORTA ' set LCD register select port
DEFINE LCD_RSBIT 4 ' set LCD register select bit
DEFINE LCD_EREG PORTA ' set LCD enable port
DEFINE LCD_EBIT 5 ' set LCD enable bit
DEFINE LCD_BITS 4 ' set LCD bus size ( 4 or 8 bits )
DEFINE LCD_LINES 2 ' set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' set command delay time in us
DEFINE LCD_DATAUS 50 ' set data delay time in us

'******** DEFINE VARIABLES **********
OFS VAR BYTE 'ENCODER + or - COUNT
TEMP1 VAR BYTE 'ENCODER SCRATCH VARIABLE
TEMP2 VAR BYTE 'ENCODER SCRATCH VARIABLE
KNOBLIM VAR WORD 'UP-DOWN COUNTER LIMIT
UP_DOWN VAR WORD 'COUNTER PASS VARIABLE
MULTIPLY VAR BYTE 'KNOB MULTIPLIER FOR SPEED

'*********** INITIALIZE VARIABLES ************
Multiply = 1 'set multiplier to 1
Variable = 100 'set variable initially to value of 100
Knoblim = 1000 'set maximum rollover to occur at 1000
TEMP1 = (PORTB & %00000011) << 2 'only executed once to preload temp1


Next, run this code and then rotate the encoder
to see the action. By the way don't forget the A and B outputs from the rotary encoder are wired to PORTB pins 0 and 1 respectively.

loop:'
UP_DOWN = Variable 'make current position equal to value of variable
GOSUB ENCOD 'READ ENCODER
Variable = UP_DOWN 'add up/down count to variable
lcdout $FE,$02,DEC5 Variable
goto loop


'*************************************************
ENCOD: 'READ ROTARY ENCODER POSITION SUBROUTINE
'*************************************************
TEMP2 = TEMP1 | (PORTB & %00000011)
LOOKUP TEMP2,[2,3,1,2,1,2,2,3,3,2,2,1,2,1,3,2],OFS
TEMP1 = (TEMP2 << 2) & %00001100
UP_DOWN = UP_DOWN + ((OFS * MULTIPLY) - (2 * MULTIPLY))
IF UP_DOWN = (KNOBLIM + MULTIPLY) THEN UP_DOWN = 0
IF UP_DOWN > KNOBLIM THEN UP_DOWN = KNOBLIM
MULTIPLY = 1
RETURN

Dave Purola,
N8NTA