BlackOps
Full Member level 5

- Joined
- Jan 1, 2005
- Messages
- 279
- Helped
- 14
- Reputation
- 28
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- AZERBAIJAN
- Activity points
- 2,496
mplab sim interrupts
Hello, i am debugging simple program, which turns on/off led every period of time. eround 2 seconds. and i want to measure the exact delay when the LED is On or Off (by calculation on paper it is 2.031616 seconds)
i am doing it on PIC16F88 chip, and using MPLAB SIM for debugging.
but during debug, the cursor goes to the main program loop after the setup routine, and never jumps to interrupt... So, the debugger doesnt make interrupt event occur, how can i fully debug it with MPLAB SIM?
here is code:
Hello, i am debugging simple program, which turns on/off led every period of time. eround 2 seconds. and i want to measure the exact delay when the LED is On or Off (by calculation on paper it is 2.031616 seconds)
i am doing it on PIC16F88 chip, and using MPLAB SIM for debugging.
but during debug, the cursor goes to the main program loop after the setup routine, and never jumps to interrupt... So, the debugger doesnt make interrupt event occur, how can i fully debug it with MPLAB SIM?
here is code:
Code:
;***********************************************************************************
;
;
;
;
;***********************************************************************************
#include <p16F88.inc>
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_ON & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
RESET_ADDR EQU 0x00
ISR_ADDR EQU 0x04
COMRAM_ADDR EQU 0x70
CBLOCK COMRAM_ADDR
status_temp
w_temp
count
ENDC
ORG RESET_ADDR
START
goto SETUP
ORG ISR_ADDR
;***********************************************************************************
; START OF THE INTERRUPT SERVICE ROUTINE
;***********************************************************************************
INTERRUPT
movwf w_temp
swapf STATUS, w
movwf status_temp;
decfsz count, f
goto INTEXIT
movlw b'10000000'
xorwf PORTB,f
movlw 0x1F
movwf count
INTEXIT
bcf INTCON, TMR0IF
swapf status_temp, w
movwf STATUS
swapf w_temp, f
swapf w_temp, w
retfie
;***********************************************************************************
; END OF THE INTERRUPT SERVICE ROUTINE
;***********************************************************************************
;***********************************************************************************
; START OF THE SETUP ROUTINE (RUNS ONLY ONCE)
;***********************************************************************************
SETUP
banksel OPTION_REG
movlw 0xc7
movwf OPTION_REG
banksel TRISB
movlw b'00000000'
movwf TRISB
banksel PORTB
clrf PORTB
banksel OSCCON
movlw b'01100000' ; should be 4 mhz
movwf OSCCON
banksel TMR0
clrf TMR0
banksel INTCON
clrf INTCON
movlw 0x1f
movwf count
movlw 0xe0
movwf INTCON
;***********************************************************************************
; END OF THE SETUP ROUTINE
;***********************************************************************************
;###################################################################################
; MAIN PROGRAM START
;###################################################################################
MAINLOOP
nop
nop
nop
goto MAINLOOP
;###################################################################################
; MAIN PROGRAM END
;###################################################################################
END