Garbage Const Array

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi...
i define an array of characters and used them to show on lcd and it is ok!
but when change my array to const PROGMEM array in avr studio i see garbage character in lcd...
is any body know why?!
thanks...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you show us your code we have a better chance of helping you. My guess is you havent read the tutorial on progmem and are not using the correct method to read the values.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this is my first array:

unsigned int Font[][16]={0x00,....};

change that to this:

const PROGMEM unsigned int Font[][16]={0x00,....};

and i read like this:
int i=font[0][1];

thanks again

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But you then have to pgm_read_word() the entries. Something like

int i = pgm_read_word(&font[0][1]);

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i don`t know this command ...
really thanks clawson it`s worked:)...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
My guess is you havent read the tutorial on progmem and are not using the correct method to read the values.

Seems I was right. Apart from asserting my righteousness, there is a tutorial on the use of progmem which will assist:
https://www.avrfreaks.net/index.p...