and Janni was of course right: There is no problem, the values of registers R0..R6 are saved. I should have seen that...This should not be a problem if respective internal registers (R5,6,7) are saved and restored in ISR. You could check this in *.lst file.
Normally, saving context includes all internal registers used both in ISR and main code. And optimizer may replace local variables with internal registers in ISR, just like in any routine - the only difference is that ISR requires restoring previous values of internal registers.
Original post:
Hi mE people,
I saw in a project (not mine) that local variables of the interrupt routine are overlayed with some other variables. I was under the impression that was impossible (meaning: should not be allowed).
Apparently, sometines mP for PIC v.6.4.0. optimiser decides that it can be done, see below address 4,5 and 6. The source code looks like this:
Code: Select all
procedure interrupt;
var
enc, bbb : byte;
tas : byte;
begin
...
end;
The PIC used in the problem project is P18F67J60.
Thanks for investigating.