[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] why the pointer get a error address?
From: |
whiteman |
Subject: |
RE: [avr-gcc-list] why the pointer get a error address? |
Date: |
Mon, 16 Feb 2004 9:5:36 +0800 |
Hi,Phillip Vogel!
My project have many independents array in program space,they
will be read in defferece subroutine,so I can't combine them together.I would
try the function you mentioned.
======= 2004-02-15 17:48:00:=======
>I can't believe I can actually answer this:
>
>First, define you array like this:
>
>const char pattern[] PROGMEM = {
> 1,2,3,a,b,c
>};
>
>The data can go on for several lines (mine goes on for a couple of
>thousand lines).
>
>Then to access the data, us a function like this:
>
>char readpattern(int i) // read a byte out of the pattern array in
>flash
>{
> return (char)pgm_read_byte(pattern);
>}
>
>I forget where I found this, probably in the FAQ, but it DOES work.
>
>Phillip Vogel
>Bartal Design Group, Inc.
>318 Marlboro Road Englewood, NJ 07631-1416
>Phone: 201-567-1343 Fax: 201-568-2891
>Cell: 201-232-5208
>mailto:address@hidden http://www.VisualConductor.com
>Ask me about the Visual Conductor
>
>> -----Original Message-----
>> From: address@hidden
>> [mailto:address@hidden On Behalf Of whiteman
>> Sent: Friday, February 13, 2004 8:28 PM
>> To: avr-gcc-list
>> Subject: [avr-gcc-list] why the pointer get a error address?
>>
>>
>> hi,all$B!*(B
>> I defined a array in program space and a pointer to this array.
>> eg:
>>
>>
>> uint8_t test_array[] PROGMEM = {
>> 1,2,3,4,5,6,7
>> };
>> const prog_char *character_pnt;
>>
>> void main(void)
>> {
>> charcter_pnt = test_array;
>> ;
>> ;
>> }
>>
>> but when I simulated with avr_studio, I found the
>> "character_pnt" get a error address,The "*character_pnt"
>> isn't equal to 1.why?
>>
>>
Regards
whiteman
address@hidden
2004-02-16