creative_35
Full Member level 1
- Joined
- Apr 10, 2006
- Messages
- 95
- Helped
- 9
- Reputation
- 18
- Reaction score
- 3
- Trophy points
- 1,288
- Location
- Under Mango Tree
- Activity points
- 2,032
include 16fxxx
I have problem in port change enable configuration while simulating this routine in mblab.
I configured RB4 as changing port and when firing RB4, it jumps to ISR and never returns from ISR routine. I don't know why. any of you had such problems? pls help me.
I have problem in port change enable configuration while simulating this routine in mblab.
I configured RB4 as changing port and when firing RB4, it jumps to ISR and never returns from ISR routine. I don't know why. any of you had such problems? pls help me.
Code:
list p=16f628 ; list directive to define processor
#include <p16f628.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _ER_OSC_CLKOUT & _MCLRE_ON & _LVP_ON
;***** VARIABLE DEFINITIONS
w_temp EQU 0x70 ; variable used for context saving
status_temp EQU 0x71 ; variable used for context saving
;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
;****************ISR ROUTINE**********************************
ORG 0x004 ; 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
BANKSEL INTCON
bcf INTCON,RBIF
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
:***********************************************************************
MAIN
BANKSEL CMCON
movlw 7h
movwf CMCON
BANKSEL PORTB
clrf PORTB
clrf PORTA
BANKSEL TRISB
movlw 0x10
movwf TRISB
clrf TRISA
START
BANKSEL INTCON
bsf INTCON ,GIE
bcf INTCON,RBIF
bsf INTCON,RBIE
goto $
END