Hi Bruce,

first of all many thanks for all the time you have spent to help finding a solution to the problem!

After I had cut down my code to the absolute minimum I have solved the problem.

It was just a few lines of stupid code.

Here ist a short code example that forces a lock-up of the 18F252 after 29 successful loops.

' 8< ---------- snip
DEFINE LOADER_USED 1
DEFINE OSC 20

Loop:

gosub Test

Test:
HIGH PortA.0
Pause 300
low PortA.0
pause 300
goto loop
RETURN

END
' snap ---------- >8

It is calling a subroutine using GOSUB and jumping out of that subroutine using GOTO before the end (RETURN) of the subroutine is reached.

But there is still the question why there is no problem with this code on the 16F876.

regards

Ralph