Why is my PIC18F452 reseting?
Hi this is my second posted Thread on this Forum.
The problem is i belive my PIC 18F452 is reseting it's self every 20 to 30 interrupts it recives via RS232. Is this possible?
Or is the reset a result off overflowing Stack?
The µController has to carry out several HSEROUT and A/D operations after receiving an interrupt .
I do not know if this data is stored on the PIC after ist send or read?
Many thanks
by NVM
I use this to test a stack overflow
Hi,
Have a look at the code below and modify according to your needs to test a stack over/underflow
Code:
INIT:
'BELOW IS A CHECK FOR STACK ResetERROR FOR DEBUG ************************************
IF STKPTR.7 = 1 THEN ' CHECK FOR STACK POINTER OVERFLOW
HSEROUT ["STACK OVERFLOW"] ' DUMP DATA TO LCD
STKPTR.7 = 0 ' CLEAR STACK POINTER OVERFLOW BIT
GOSUB DLY5K ' CALL THE 5 SECONDS DELAY SUBROUTINE
ENDIF
IF STKPTR.6 = 1 THEN ' CHECK FOR STACK POINTER UNDERFLOW
HSEROUT ["STACK UNDERFLOW"] ' DUMP DATA TO LCD
STKPTR.6 = 0 ' CLEAR STACK POINTER UNDERFLOW BIT
GOSUB DLY5K ' CALL THE 5 SECONDS DELAY SUBROUTINE
ENDIF