26Views2Replies

Author Options:

Arduino flash memoru using PROGMEM Answered

I have called a 2 D array in Arduino Mega2560.

It is working well in Ram.

If am using Flash memory using PROGMEM it is giving faulty results.

Please help me to use flash memory properly.

Discussions

0
None
parvatyele

2 months ago

Thank you so much for your comment.
The reading method is as per the examples from arduino code from insrtructables.
If I give number to call from memory as per the following lines result is correct. If I give any variables to call from memory it becomes wrong.
unit1= jan [Dayct]; ///calling from flash memory wrong.
unit1= 8 [Dayct]; ////calling from flash memory working well.
unit1= jan [Dayct]; ///// if I use Ram it is working well.
I need help to call from flash memory.

0
None
Downunder35m

2 months ago

I am no expert with the use of flash memory but I think you got it slightly wrong.
Please check here for reference.
When working with the flah you not only need to get your data in there by defining it correctly (type of data for example) but also by calling it correctly.
You pushed the jan data into the flash but you are not reading it from there, instead you try to read out jan as a variable.
There is more examples in the Arduino Playground that might help as well, just go over there and have look in the related sections.
As said, no expert but I think if you get the pushing and pulling of the flash data done the right way you code will work fine.
Did you try to manually ready out the flash to confirm it is going in as planned?
If so try the same for reading it out.
If both work fine then it is just the matter or using the correct commands in your code.