gnupic: Re: [gnupic] 18F, table read, sdcc
Subject:
Re: [gnupic] 18F, table read, sdcc
From:
Peter Onion ####@####.####
Date:
6 Aug 2005 00:16:36 +0100
Message-Id: <1123283757.6845.55.camel@HP.RoomLan>
On Sat, 2005-08-06 at 00:43 +0200, Alessandro Zummo wrote:
>
> Hello,
>
> anyone has suggestions on the best way to read data
> stored in program memory using SDCC/PIC16?
>
> in assembly I would use a DB directive,
> TBLPTR and the table read istruction..
>
> I was planning to keep using the DB directive,
> assemble with gpasm -c into an object file,
> and loading the data from C.
It's easy.... No need to mess around with TBLPTRL/H/U, let the compiler
do all that for you....
unsigned char __code myData[8] = {1,2,3,4,5,6,7,8};
unsigned char __code *myDataPointer = myData;
Sequential access via pointer
n = *myDataPointer++;
Random access via array
n = myData[m];
Peter