Hi there! When I test my PIC, I get "Hardware Stack Underflow" from my sim. (PIC16F84A) Here is the code:
How can I avoid the error? Thanks much!!!!!!!!
Code:
title "Program"
include "p16f84a.inc"
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
ORG 0X000
;===== variables ===========
count1 equ 0xC
value equ 0xD
;===== end variables =======
;===== set ports ======
bsf STATUS,RP0 ;set PORTB, 0 to input, others to output
movlw 0x1C
movwf TRISA
movlw 0xFF
movwf TRISB
bcf STATUS, RP0
; ====== end ======
movlw 0x2
movwf PORTA
start ;========================== digit 1 ======================
movwf value
btfsc PORTB, 0
goto start
btfsc PORTB,1
goto start
btfsc PORTB, 2
goto start
btfsc PORTB, 3
goto start
btfsc PORTB, 4
goto start
btfsc PORTB, 5
goto start
btfsc PORTB, 6
goto start
btfsc PORTB, 7
goto start
btfsc PORTA, 4
goto start
btfss PORTA, 3
goto start
loop decfsz count1,1
goto loop
btfss PORTA,3
goto start
btfsc PORTA, 2
goto term ; calling this sub causes error! Everything else is ok!
goto start
term
movlw 0x0
movwf value
return
end
How can I avoid the error? Thanks much!!!!!!!!
Last edited: