Hello all,
I have a project in which I have to read a file (.CSV) which contains the order of which to open and run other CSV files on the SD card. The CSV file that contains the running order is of variable length. Now as the DUE does not have EEPROM, SO I was going to store the running order in a vector on PROGMEM. But as I read through the progmem.h library I realised that idea would not be possible.
So my question is what is the easiest way to store a list of instructions from a file on the DUE to open other files in a certain order. I would prefer to have this storage to be able to survive loss of power.
Can you just store the run order information on a file on the SD card? Load said file when you want to figure out the run order?
Or are you trying to insert sdcard 1, inform due of the order, power cycle or whatever, then insert sdcard2, and still have the information from sdcard1?
No I am reading all of the files off of a single SD card. I have a file called daylog which contains the order to run each day, eg day1.csv , day3.csv, day2.csv. A file like day1.csv will contain PWM values to control a LED array used to grow plants for Research.
I just worry about storing them in a 2d array as if the power gets interrupted I will lose the array and thus my spot in the run order.
zedulias:
No I am reading all of the files off of a single SD card. I have a file called daylog which contains the order to run each day, eg day1.csv , day3.csv, day2.csv. A file like day1.csv will contain PWM values to control a LED array used to grow plants for Research.
I just worry about storing them in a 2d array as if the power gets interrupted I will lose the array and thus my spot in the run order.
I don't really see how you're prevented from reading it off the sd card whenever you need it. If you are worried about in a single day losing power on your data, you can use two bytes of EEPROM to index your csv file with a single unsigned int. Say, you're at PWM value for the 3rd hour of the day, then you just store "3" in your eeprom and then in the worse case of losing power you will only lose the time interval between when you are moving between point 3 and point 4. If that time interval is too long, then increase the resolution of your CSV file.
You can use another byte or two to store what day you're on, if that's a problem too.