News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Cdata over 64K border in 128 kByte PIC18

Started by Sommi, Mar 02, 2022, 03:51 PM

Previous topic - Next topic

Sommi

Hi
I tried a long Cdata Table in an 18F27Q10 Pic, it seems ther is a problem when the 46 Kbyte border iis in the table.

I tried to put the table in the upper 64kBytes with the ORG command, however ther was the message "Org not possible when prodedures are used".

Any Idea? Regards Sommi
KISS - keep it simple and stupid

Sommi

Of course it should read "64 kByte border"
KISS - keep it simple and stupid

top204

Add the declare:

Declare Access_Upper_64K = On

This will get the assembler code to also manipulate the TBLPTRU SFR, so high flash memory data can be accessed.

I thought I had added the declare to the manual a few years ago, but I could not find it in there. I will add it for the next upgrade. Your, general, code size will increase, because it must also load and read the TBLPTRU SFR, instead of just the TBLPTRL and TBLPTRH SFRs.

With large Cdata tables, you are better placing them at the beginning of the code and jump over the data to your main section. This keeps the code smaller and faster. Assembler mnemonics have no problems in code above 64K, but data reading does, because it needs the TBLPTRU SFR accessed as well.

Sommi

KISS - keep it simple and stupid