Here's a few things I see off the bat.
Code:
myint
; BCF INTCON,GIE ;Should I have this????
No, you won't need that. With ASM interrupts, another interrupt can not happen until the current interrupt is finished.
This section is for context saving. But since the PIC you're using has more than 2k of code space, PBP has already inserted the same code. So by the time it gets to your handler, those registers have been changed, and it's saving and restoring the wrong values. These should be commented out.
Code:
movwf wsave
swapf STATUS, W
clrf STATUS
movwf ssave
movf PCLATH, W
movwf psave
The debounce pause is using PBP's system registers which by itself can cause the program to go wacko. Saving and restoring the system registers would help, although I think once you fix these things, you won't need that delay anyhow.
Code:
movlw high 100 ; Wait 100us to debounce encoder
movwf R0 + 1
movlw low 500
call PAUSEUSL
PORTB.4 and PORTB.5 will also trigger the PORTB change interrupts.
They seem to be left floating and in input mode. Reason #3 for wacko-ness.
Either pull them up or down with resistors, or set those 2 pins to output, and do not use them for anything else.
<br>
Bookmarks