gnupic: Re: [gnupic] 18F, table read, sdcc


Previous by date: 6 Aug 2005 00:16:36 +0100 Re: [gnupic] 18F, table read, sdcc, mengjin_su.agilent.com
Next by date: 6 Aug 2005 00:16:36 +0100 Learning PIC on the job, Nicholas Robinson
Previous in thread: 6 Aug 2005 00:16:36 +0100 Re: [gnupic] 18F, table read, sdcc, mengjin_su.agilent.com
Next in thread: 6 Aug 2005 00:16:36 +0100 Re: [gnupic] 18F, table read, sdcc, Alessandro Zummo

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




Previous by date: 6 Aug 2005 00:16:36 +0100 Re: [gnupic] 18F, table read, sdcc, mengjin_su.agilent.com
Next by date: 6 Aug 2005 00:16:36 +0100 Learning PIC on the job, Nicholas Robinson
Previous in thread: 6 Aug 2005 00:16:36 +0100 Re: [gnupic] 18F, table read, sdcc, mengjin_su.agilent.com
Next in thread: 6 Aug 2005 00:16:36 +0100 Re: [gnupic] 18F, table read, sdcc, Alessandro Zummo


Powered by ezmlm-browse 0.20.