somepicguy
New Member
This looks like a great forum. I've spent the last few months getting started programming PICs and while they have alot of features there are some issues I've run into.
Hopefully this will help some people.
; Fixed RESET_VECTOR
RESET_VECTOR CODE 0x000 ; processor reset vector
pagesel start ; Select proper page for "start" marker
goto start ; go to beginning of program
; Fixed digital selection of PORTB IO lines- lines come up as analog
banksel ANSELH ; Select memory bank that contains ANSELH
movlw h'00' ; Move literal 00000000 to W register
movwf ANSELH ; Move W register to ANSELH
; use pagesel for all call and goto commands
; use banksel for all variable related commands
;USE THIS FOR A INTERRUPT VECTOR. SOMETIMES THE PCLATH REGISTER GETS TRASHED ON THE "GOTO INTERRUPT" and you want to ;save it first
INT_VECTOR CODE 0x0004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
movf PCLATH,w ; move pclath register into w register
movwf pclath_temp ; save off contents of PCLATH register
pagesel INTERRUPT
goto INTERRUPT
Hopefully this will help some people.
; Fixed RESET_VECTOR
RESET_VECTOR CODE 0x000 ; processor reset vector
pagesel start ; Select proper page for "start" marker
goto start ; go to beginning of program
; Fixed digital selection of PORTB IO lines- lines come up as analog
banksel ANSELH ; Select memory bank that contains ANSELH
movlw h'00' ; Move literal 00000000 to W register
movwf ANSELH ; Move W register to ANSELH
; use pagesel for all call and goto commands
; use banksel for all variable related commands
;USE THIS FOR A INTERRUPT VECTOR. SOMETIMES THE PCLATH REGISTER GETS TRASHED ON THE "GOTO INTERRUPT" and you want to ;save it first
INT_VECTOR CODE 0x0004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
movf PCLATH,w ; move pclath register into w register
movwf pclath_temp ; save off contents of PCLATH register
pagesel INTERRUPT
goto INTERRUPT