i am writing a code for a pic16f88 to turn the LED on and off,when i try to run.it reports "
CORE-E0002: Stack under flow error occurred from instruction at 0x000000"
here is my code
; Example of using Shared Uninitialized Data Section
INT_VAR UDATA_SHR
W_TEMP RES 1 ; w register for context saving (ACCESS)
STATUS_TEMP RES 1 ; status used for context saving (ACCESS)
PCLATH_TEMP RES 1 ; variable used for context saving
; Example of using GPR Uninitialized Data
GPR_VAR UDATA
MYVAR1 RES 1 ; User variable placed by linker
MYVAR2 RES 1 ; User variable placed by linker
MYVAR3 RES 1 ; User variable placed by linker
;------------------------------------------------------------------------------
; EEPROM INITIALIZATION
;
; The 16F88 has 256 bytes of non-volatile EEPROM, starting at address 0x2100
;
;------------------------------------------------------------------------------
DATAEE CODE 0x2100
DE "MCHP" ; Place 'M' 'C' 'H' 'P' at address 0,1,2,3
;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------
RESET CODE 0x0000 ; processor reset vector
; pagesel START
; GOTO START ; go to beginning of program
;------------------------------------------------------------------------------
; INTERRUPT SERVICE ROUTINE
;------------------------------------------------------------------------------
INT_VECT CODE 0x0004 ; interrupt vector location
; Context saving for ISR
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
;------------------------------------------------------------------------------
; USER INTERRUPT SERVICE ROUTINE GOES HERE
;------------------------------------------------------------------------------
; Restore context before returning from interrupt
MOVF PCLATH_TEMP,W ; retrieve copy of PCLATH register
MOVWF PCLATH ; restore pre-isr PCLATH register contents
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 PROGRAM
;------------------------------------------------------------------------------
;PROGRAM CODE
;START
;------------------------------------------------------------------------------
; PLACE USER PROGRAM HERE
;------------------------------------------------------------------------------
STATUS equ 03h ;addres of the status register
TRISA equ 85h ;address of the tristate register for port A
PORTA equ 05h ;Address of port A
COUNT1 equ 08h ;FIRST COUNTER FOR OUR DELAY LOOP
COUNT2 equ 09h ;SECOND COUNTER FOR OUR DELAY LOOP
;******SET UP THE PORTS*******
bsf STATUS,5 ;switch to bank 1
movlw 00h ;set the port A pins
movwf TRISA ;to output
bcf STATUS,5 ;switch back to bank 0
;********TURN ON LED*******
start movlw 02h ;turn the LED on by first putting it into the w register and than on the port
movwf PORTA
;******start the delay loop1********
loop1 decfsz COUNT1,1 ;Subtract 1 from 255
goto loop1 ;if count is zero,carry on
decfsz COUNT2,1 ;Subtract 1 from 255
goto loop1 ;go back to the start of our loop.
;******TURN OFF LED**********
movlw 00h ;turn the led off by first putting
movwf PORTA
;******ADD ANOTHER DELAY*******
loop2 decfsz COUNT1,1 ;Subtract 1 from 255
goto loop2 ;if count is zero,carry on
decfsz COUNT2,1 ;Subtract 1 from 255
goto loop2 ;go back to the start of our loop.
;------------------------------------------------------------------------------
GOTO $
END
CORE-E0002: Stack under flow error occurred from instruction at 0x000000"
here is my code
; Example of using Shared Uninitialized Data Section
INT_VAR UDATA_SHR
W_TEMP RES 1 ; w register for context saving (ACCESS)
STATUS_TEMP RES 1 ; status used for context saving (ACCESS)
PCLATH_TEMP RES 1 ; variable used for context saving
; Example of using GPR Uninitialized Data
GPR_VAR UDATA
MYVAR1 RES 1 ; User variable placed by linker
MYVAR2 RES 1 ; User variable placed by linker
MYVAR3 RES 1 ; User variable placed by linker
;------------------------------------------------------------------------------
; EEPROM INITIALIZATION
;
; The 16F88 has 256 bytes of non-volatile EEPROM, starting at address 0x2100
;
;------------------------------------------------------------------------------
DATAEE CODE 0x2100
DE "MCHP" ; Place 'M' 'C' 'H' 'P' at address 0,1,2,3
;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------
RESET CODE 0x0000 ; processor reset vector
; pagesel START
; GOTO START ; go to beginning of program
;------------------------------------------------------------------------------
; INTERRUPT SERVICE ROUTINE
;------------------------------------------------------------------------------
INT_VECT CODE 0x0004 ; interrupt vector location
; Context saving for ISR
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
;------------------------------------------------------------------------------
; USER INTERRUPT SERVICE ROUTINE GOES HERE
;------------------------------------------------------------------------------
; Restore context before returning from interrupt
MOVF PCLATH_TEMP,W ; retrieve copy of PCLATH register
MOVWF PCLATH ; restore pre-isr PCLATH register contents
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 PROGRAM
;------------------------------------------------------------------------------
;PROGRAM CODE
;START
;------------------------------------------------------------------------------
; PLACE USER PROGRAM HERE
;------------------------------------------------------------------------------
STATUS equ 03h ;addres of the status register
TRISA equ 85h ;address of the tristate register for port A
PORTA equ 05h ;Address of port A
COUNT1 equ 08h ;FIRST COUNTER FOR OUR DELAY LOOP
COUNT2 equ 09h ;SECOND COUNTER FOR OUR DELAY LOOP
;******SET UP THE PORTS*******
bsf STATUS,5 ;switch to bank 1
movlw 00h ;set the port A pins
movwf TRISA ;to output
bcf STATUS,5 ;switch back to bank 0
;********TURN ON LED*******
start movlw 02h ;turn the LED on by first putting it into the w register and than on the port
movwf PORTA
;******start the delay loop1********
loop1 decfsz COUNT1,1 ;Subtract 1 from 255
goto loop1 ;if count is zero,carry on
decfsz COUNT2,1 ;Subtract 1 from 255
goto loop1 ;go back to the start of our loop.
;******TURN OFF LED**********
movlw 00h ;turn the led off by first putting
movwf PORTA
;******ADD ANOTHER DELAY*******
loop2 decfsz COUNT1,1 ;Subtract 1 from 255
goto loop2 ;if count is zero,carry on
decfsz COUNT2,1 ;Subtract 1 from 255
goto loop2 ;go back to the start of our loop.
;------------------------------------------------------------------------------
GOTO $
END