sorry for not having paste the complete code...
DEFINE OSC 40 ' XTAL= 10 MHZ CLOCK= 40 MHZ
INCLUDE "MODEDEFS.BAS"
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
INTCON2.BIT6=0 ' interrupt from 1 down to 0
CNT VAR WORD ' COUNTER TO BE DISPLAYED ON TERMINAL
CNT= 32000
CNTOLD VAR WORD
CNTOLD=32000
B VAR PORTD.1 ' encoder B PHASE
A VAR PORTD.0 ' encoder A PHASE
' DEBUG INTERFACE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\
'' Set Debug pin port ________________________________________
DEFINE DEBUG_REG PORTD
'' Set Debug pin bit _________________________________________ PIC_PIN_30
DEFINE DEBUG_BIT 7
'' Set Debug baud rate _________________________________________
DEFINE DEBUG_BAUD 115200
'' Set Debug mode: 0 = true, 1 = inverted ______________________
DEFINE DEBUG_MODE 1
DEBUG 13,10,13,10, " START OF PROGRAM ", 13, 10, 13, 10
ADCON1=7 ' all digital !
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE INT_INT ; enable external (INT) interrupts
Main:
PAUSE 1
IF CNT <> CNTOLD THEN
DEBUG DEC CNT,13,10
CNTOLD=CNT
ENDIF
GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
if b=0 then cnt=cnt-1
IF B=1 THEN CNT=CNT+1
@ INT_RETURN




Bookmarks