Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2138 TBLPTRx not saved in interrupt

open
nobody
PIC16
5
2013-12-20
2013-03-02
Herbert Pötzl
No

using const arrays/tables like

const unsigned char tbl_a[] = { 0, 1, 2, 3 };

on pic16 taget (e.g. pic18f2455) will result in code using the TBLPTRx
registers, but those are not saved in interrupt context, so in case both, the
main code and the interrupt handler use such an array, the TBLPTRx will get
messed up leading to all kind of unexpected behaviour.
(see tblptr.lst for details)

$ sdcc --std-sdcc99 --use-non-free -mpic16 -p18f2455 tblptr.c
$ sdcc --version
SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.2.1 #8246 (Dec 17 2012) (Linux)

Discussion

  • Herbert Pötzl
    Herbert Pötzl
    2013-03-02

    example code

     
    Attachments
  • Maarten Brock
    Maarten Brock
    2013-12-20

    • Category: --> PIC16