Interrupt org 0x04 ; interrupt vector
movwf W_TEMP ;
swapf STATUS,W
movwf S_TEMP
bcf STATUS,RP0
Disable_Int
bcf INTCON,GIE ;
btfsc INTCON,T0IF ;
goto Step ;
; btfsc PIR1,TMR2IF ;
; goto Left_Step ;
Pop
swapf S_TEMP,W ;
movwf STATUS
swapf W_TEMP,f
swapf W_TEMP,w
retfie
;****The main program*****
#include "Bot.inc"
Start
CLRF PORTA ; Initialize Port A
CLRF PORTB ; Initialize Port B
CLRF PORTC ; Initialize Port C
CLRW
BANK1 ; Select Register Bank 1
MOVWF TRISB ; Set B to all outputs for stepper control
BANK0
CLRF TMR0 ; Clear Timer0 register
CLRF INTCON ; Disable interrupts and clear T0IF
BANK1
MOVLW 0xC7 ; PortB pull-ups are disabled,
MOVWF OPTION_REG ; Interrupt on rising edge of RB0
; Timer0 increment from internal clock
; with a prescaler of 1:256.
BANK0
BSF INTCON, T0IE ; Enable Timer0 Interrupts
BSF INTCON, GIE ; Enable all interrupts
BSF INTCON, PEIE