Go Down

Topic: Temperature control/data logging with excel (Read 13 times) previous topic - next topic

strykeroz

Hi

You don't need to keep the commas in the array, just the int values. Also you have the EEPROM available to you too so that would be my choice over a array.

Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

syphex

Ok if they aren't commas then they would have to be spaces anyway, otherwise how would excel know to seperate them? I'm glad I found out I can just save as .csv for excel and it puts the data into different cells already. I dont want to have to write another program to run the data through just to prettymuch add commas/spaces :/

Also I thought of an array because I can limit the size at declaration, and the sram has 2kb whereas the EEPROM only has 1kb. But I admit I don't know how much space my other variables take up yet, but they shoulden't change size too drastically.

Is writing to the EEPROM just like writing to a notepad? Or I see you have to write each byte, in which you would probably have to create an array to temporarily store them anway for use in a for loop wouldn't you? Sorry I am inexperienced.

strykeroz

Sorry you misunderstand my suggestion there.  If you want to store the most data in the space available to you, keep the values only and reconstruct the text file by expanding it with spaces, or commas, only once the SD card becomes available again.  Each value as an int takes 2 bytes of RAM (regardless if in an array or EEPROM) however as text a value will take up a 1 byte for every character it comprises.  So a 2 digit value followed by a comma will be 3 bytes rather than the two you'd have just storing the value.

On your 2nd point, SRAM might be larger, but remember your program is running in it.  EEPROM on the other hand is all there for you to write data to, and you'd be able to store up to 341 of your 3 integer value sets before you ran out.

Writing to the EEPROM is quite different to writing to the notepad.  Of needing an array anyway, you'd only need one to store 3 values so that's no more overhead than your 3 values anyway.  If you load it into a data structure containing those 3 integers you could use this method on the Playground which simplifies things some.  You will need to keep track of how many records there are to read back from EEPROM, but another way is to write the whole EEPROM with a known value your records can never contain before hand, and check when you read back that this value is not what you've found.  When you hit a record that's just those filler characters you know to stop reading back, and erase the EEPROM again for next time.

Hope this helped.  In the first instance though aim to get it going without the queue for dealing with the lack of SD before adding that complexity and you should be fine.

Cheers ! Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

HDowns

May be this program can be an option:
http://www.aggsoft.com/usb-hid-logger/
I didn't use it myself, but used some other similar products from Aggsoft. They can work as you described.

syphex

#9
Jun 25, 2013, 12:11 pm Last Edit: Jun 25, 2013, 12:24 pm by syphex Reason: 1
Thanks for the help! I already know each integer takes 2 bytes. Thats 6 bytes for the ints and 2 bytes for the commas, 8 bytes.


On your 2nd point, SRAM might be larger, but remember your program is running in it.  EEPROM on the other hand is all there for you to write data to, and you'd be able to store up to 341 of your 3 integer value sets before you ran out.


The EEPROM is 1024 bytes right? So 1024/8=128 value sets. I dont understand how you get 341, thats 1024/341=3.002 bytes? And I thought the SRAM because yes it has more space and you have to declare the size of an array at initialization anyway, so I can just see how much memory my sketch takes (slightly more than half) and then assign some (not all) of whats left for my array? Or would that slow down the processing or something?

Also as for recombining the integer values and adding the commas when writing to the SD... How would I temporarily store the information without commas? Woulden't using a two dimensional array use >= the memory of storing it as a string anyway for example? Or do you mean store it like 282355 then split it to 28,23,55 for writing to the SD?

Finally, you said create an array with filler characters presumably so that if it starts writing to the SD while writing to the EEPROM that the EEPROM data is saved to the SD card and then deleted up to the filler characters? Why not just check the data entry string length to see if its greater than 0? Since an empty string will be "", then it wont take up a character byte for an empty position in the array?

Sorry if I am misunderstanding you again, thanks for the input though.

edit: Is the playground link for writing the data bytewise? So thats how you can store the integer values without a comma? Does that mean its being written like this?

28 23 55 27 22 54 ? for two 3 int entries? Only in bytes?

Go Up