TINY10 / Store constants in flash memory and use them

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

Hi, I am trying to store some constants in flash memory of TINY10 and use them.
- Studio 5 latest version
- GCC
#include

unsigned char current_comp[3][2] PROGMEM=
{
{255,101},{254,101},{251,102}
};

In the main function, I put the following codes to use those constants.
OCR0A = pgm_read_byte(&(current_comp[1][0]));

Then, I got the following erros when ran compiler.
- illegal opcode lpm for mcu attiny10
- register number above 15 required

Any helps on this matter would be appreciated. Thanks!

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

Quote:

Hi, I am trying to store some constants in flash memory of TINY10 and use them.
- Studio 5 latest version
- GCC

I don't think GCC has "real" support for Tiny10--and you've just uncovered one of the gotchas, as that family has different flash access mechanism than LPM.

Use ASM, or CodeVision has full support. Or ???

See https://www.avrfreaks.net/index.p...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Hi, Thank you very much for your response. I will try ASM or check other compilers to see if they work. Thank you.