Submitted by: bruno
Severity: Mayor (affects mikroPascal v7.0.0.0, pic18 family )
Status: Pending.
Description:
Using table read/write PIC18 operations may cause malfunction when used from main loop and from interrupt at the same time
The reason is the registers TBLPTR[U:H:L] and TABLAT are not saved during ISR.
Workaround:
Save these registers yourself in interrupt. See the example code below.
Code: Select all
procedure interrupt();
var a, b, c, d : byte;
begin
a := TBLPTRL ;
b := TBLPTRH ;
c := TBLPTRU ;
d := TABLAT ;
// your code here...
TBLPTRL := a ;
TBLPTRH := b ;
TBLPTRU := c ;
TABLAT := d ;
end;