PDA

View Full Version : Why is my PIC18F452 reseting?



Vincent
- 6th June 2006, 18:41
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

mister_e
- 6th June 2006, 23:12
everything is possible, your code will help us to point you on the most possible problem.

Vincent
- 7th June 2006, 08:10
Thanks again mister_e!

I would like to post the hole program CODE but it is to long!
Im not sure whitch parts of the program are necessary?
is there a posibility to send it to you?

The program is the same like the one in my other posted thread
"Controlling an 240x128 LCD touch panel"

thanks

by NVM

mister_e
- 7th June 2006, 12:51
Hi NVM, Where i am right it's almost impossible to get in touch with all the hardware you have. I have 2-3 pending project for some user here (no no no not free ;) ) and i have some daily 'asian medecine' session to take. Couldn't be impossible to check your whole code... but if it's a rushing project and it can be publish here, you can even use the file attachement and post the whole thing here.

I sent you my e-mail in your PM.

Bruce
- 7th June 2006, 15:42
This does sound like stack overflow reset. You can turn this option off in config word for a quick test, but to fix it, make sure whenever you use a CALL or GOSUB, that you RETURN instead of GOTO to get back.

sougata
- 7th June 2006, 15:59
Hi,

Have a look at the code below and modify according to your needs to test a stack over/underflow



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

Vincent
- 7th June 2006, 23:35
Mots of my problems are solved...
I should have posted earlier in this Forum.
That would have saved me some sleepless nights.

Thanks to all of you.

I'll be back with better problems or better say tasks...


good night

by NVM