You did restart your computer, right? Well, if we don't have any success going that route, there are alternatives.
Look at the code in the Interrupt Handler. Put this in your main loop, so it repeatedly checks PORTB for changes. Like This:
Code:
'************************
' DEFINE your OSC
' and any other
' configuation items
'************************
Old_Bits VAR BYTE
New_Bits VAR BYTE
RotEnc1_val VAR BYTE 'Connected to PORTB<4:5>
RotEnc2_val VAR BYTE 'Connected to PORTB<6:7>
TRISB = %11110000
RotEncDir VAR BIT
'************************
' SETUP YOUR LCD HERE!!!
'************************
Old_Bits = PORTB & (%11110000)
Main:
New_Bits = PORTB & (%11110000)
IF (New_Bits & %00110000) = (Old_Bits & %00110000) then No_Change_Rot1
RotEncDir = New_Bits.5 ^ Old_Bits.4
if RotEncDir = 1 then
RotEnc1_val = RotEnc1_val + 1
if RotEnc1_val = 36 then RotEnc1_val = 0
ELSE
RotEnc1_val = RotEnc1_val - 1
if RotEnc1_val = 255 then RotEnc1_val = 35
ENDIF
No_Change_Rot1:
IF (New_Bits & %11000000) = (Old_Bits & %11000000) then DoneRotEnc
RotEncDir = New_Bits.7 ^ Old_Bits.6
if RotEncDir = 1 then
RotEnc2_val = RotEnc2_val + 1
if RotEnc2_val = 36 then RotEnc2_val = 0
ELSE
RotEnc2_val = RotEnc2_val - 1
if RotEnc2_val = 255 then RotEnc2_val = 35
ENDIF
DoneRotEnc:
Old_Bits = New_Bits
LCDOUT $FE, 2,"ROT1:", DEC2 RotEnc1_val,"ROT2:", DEC2 RotEnc2_val
GOTO Main

Let's walk before we run and get this working.
Steve
Bookmarks