Guten Morgen,

also es wäre noch ganz net zu wissen, um welchen PIC es sich handelt. Dann wäre es noch gut, wenn ich den kompletten Code hätte. So könnte man nachvollziehen, wo du überall hin springst.
Dann wird jedesmal wenn du eine Sprungmarke callst die Rücksprungandresse im Stack gespeichert. Der Stack ist nicht unendlich groß und irgendwann gibt es dann einen überlauf und du weiß nicht mehr was der PIC macht. Wenn du mit Call in eine Routine springst solltest du auch mit return wieder zurück gehen und dann erst mit goto in diedie nächste Routine callen. Ich weiß das ist nicht immer möglich und sinnvoll, also muss man sich mit dem Datenblatt und dem Stack beschäftigen.

Hier mal einen Auszug auf dem Datenblatt des 16F87XA

The PIC16F87XA family has an 8-level deep x 13-bit
wide hardware stack. The stack space is not part of
either program or data space and the stack pointer is not
readable or writable. The PC is PUSHed onto the stack
when a CALL instruction is executed, or an interrupt
causes a branch. The stack is POP’ed in the event of a
RETURN, RETLW or a RETFIE instruction execution.
PCLATH is not affected by a PUSH or POP operation.
The stack operates as a circular buffer. This means that
after the stack has been PUSHed eight times, the ninth
push overwrites the value that was stored from the first
push. The tenth push overwrites the second push (and
so on).


In diesem Sinne
Gruß