Go Down

Topic: Having an array variable stored on SD CARD (Read 152 times) previous topic - next topic

casemod

I'm wondering if it is possible to have a data array stored on an SD Card and have access to it, as if it were local:

Code: [Select]

int my array [20][20] = {0};
myarray [10][12] = 596;


I understand one can 'add' into the exiting file, but I need to read or at least select the correct position to write.

Thanks
CircuitGuru
http://www.circuitguru.co.uk/

Delta_G

No you cannot treat an SD card as an extension of memory.  You'll have to write code to read values out of the file and put them into the array or vice versa. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

casemod

No you cannot treat an SD card as an extension of memory.  You'll have to write code to read values out of the file and put them into the array or vice versa. 
Thanks, +1!
CircuitGuru
http://www.circuitguru.co.uk/

cattledog

#3
Aug 13, 2019, 11:11 pm Last Edit: Aug 13, 2019, 11:12 pm by cattledog
Can you use the EEPROM instead of an SD card? The read/write should be more simple.

You can lay out your [20][20] 2 byte integer data into a flat file occupying memory addresses 0-799.

With the zero indexed array indexes, you can access any location with firstIndex*40 + secondIndex*2.   Address of
Code: [Select]
myarray[i][j] = i*40 +j*2

myarray [10][12] should be at eeprom address 424.

For myarray [10][12] = 596;

EEPROM.put(424, 596);






Greg9901

EEPROM memory are really slow so be careful if you want to make fast things. Furthermore, I think that these memories can be damaged if you use them too often.

casemod

Thanks - Surely no EEPROM/Flash.

I might have a go at some SRAM... those things are quite pricey, am I missing any other viable options?

Found these on mouser earlier.

... either that or a hack to access GRAM on a display is on the way.
CircuitGuru
http://www.circuitguru.co.uk/

Delta_G

Even with those things it is t going to map to the same memory space.  You'll still have to write the same sorts of methods to get the data from whatever external memory device you get.  You're not going to be able to use it like normal memory space. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

casemod

Even with those things it is t going to map to the same memory space.  You'll still have to write the same sorts of methods to get the data from whatever external memory device you get.  You're not going to be able to use it like normal memory space. 
That should be trivial for an SPI memory (or parallel with a few 595's). The memory itself is a large array  :)
CircuitGuru
http://www.circuitguru.co.uk/

Go Up