[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: |
Phillip Vogel |
Subject: |
RE: [avr-gcc-list] why the pointer get a error address? |
Date: |
Sun, 15 Feb 2004 17:48:11 -0500 |
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!
> 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-14
>
>
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-> list
>
>
> -----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!
> 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-14
>
>
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-> list
>
>