Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hardware stack overflow...

Status
Not open for further replies.

asp1987

New Member
Plz help...
I want to switch two leds ON and OFF depending on the state of two sensors.
sensors are connected to porte pins-re1 and re2.. Wrote program using tables(its the first time we use them).
On simulating it using 'pic simulator ide',i get the following message
'HARDWARE STACK OVERFLOW'.
Can someone say what it means?Also how to eliminate it?here is the code in
assembly..delays were reduced for easy step by step simulation..pic 16F877A..10MHz..

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin
call table
movwf 0x05
call delay
call begin

delay
movlw 0x03
movwf 0x0C
movlw 0x02
movwf 0x0E
loop1
decfsz delay_0,1
goto loop1
decfsz delay_1,1
goto loop1
return

table
movf 0x09,0 ;port e to w register
bsf 0x09,0 ;make bit0 of porte 1
addwf 0x02,1 ;add value to prog. counter
retlw 0x00 ;if porte bits <2:1>00,pc incremented by 1
nop
retlw 0x01 ;if 01,incremented by 3
nop
retlw 0x02 ;if 10,incremented by 5
nop
retlw 0x03 ;if 11,incremented by 7
return
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
It means that you have put more return address on the Hardware Stack then it can hold. The way it is written it will put an unlimited number of return address on the stack. The way to avoid the error, as Nigel has pointed out, is to limit the number of return address placed on the hardware stack by each call instruction. You could try reading the datasheet more carefully. It is pretty explicit about this point. I'm surprised that you missed it and even more surprised that you were clueless about what it meant.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top