CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

csv arrays

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

csv arrays
PostPosted: Sun Feb 26, 2012 12:27 pm     Reply with quote

Dear Friends,

Currently I am making a datalogging system and to save data on SD Card I was going to us the following structure. First I create a 2D array such as:

Code:

int value1[15][5]
int1 = date;
int2 = time;
int3 = temp1;
int4 = temp2;
int5 = status;


where the 5 is the number of readings e.g, Date, Time, Temp1, Temp2, Status while the 15 is the number of readings needed. Hope that I am on the right track! now the csv format is just: int1, int2, int3, int4, int5;

thanks for your help
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Feb 26, 2012 1:29 pm     Reply with quote

If you're going to import into Excel, you'll need a cr,lf after 'status'. This allows Excel to automatically enter the data into the correct rows and columns.
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Sun Feb 26, 2012 2:08 pm     Reply with quote

thanks temtronic, but the idea is good? on the SD Card, can I say that 16MB card has 16384000000 bytes (1024*16000000 = 16384000000), so it can holds more than 8192000000 integers(values) since integer in 16-bit takes 2 bytes (hope that I know this good)?
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Feb 26, 2012 3:38 pm     Reply with quote

Not quite...

16MBytes is the raw unformatted data storage for the card. Depending on how it is formatted you can easily lose 5-10% of the bytes ! Even more depends on the actual file type(FAT16,FAT32,NTFS,custom).If you're always dealing with small files of known data, it's better to format using smaller clusters to maximize the storage capability of the drive.

All this should be covered in any decent book on 'PC file formats'.

And...if using CSV formatted data, every "," (comma) which is the data separator takes up one byte of storage.In your example,if the data are all 16 bit values ,you'll need 5 *2 +6 *1 + 2 bytes per 'record' or 18 bytes total.Not to sure how you're encoding the date and time into 16 bits though.And HOW you decode the data in the PC is another matter.
It's a lot easier to just save the date and time as string data so that Excell can automatically load into a spreadsheet for instant analysis.

Also be aware that to some of us, 'integer' IS an 8 bit value( a Byte).What the variable actually holds depends on the operating system, program be used, and programmers preferences.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group