yup, that makes perfect sense.
the "SDuFAT.h" library I'm using has two print functions, print and println. These two functions will be all you need to do what you are looking for. You can combine all of the elements of a line in code and then send a println command to write the entire line at once or write each item one at a time by using the print function and then using the println function for the last element of the line.
Lets take this NMEA sample data and I'll show you what I'm saying.
"$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47"
Ok, lets say you have this line combined in code already and you want to send the entire line at once. You would simply sent the println command like this... SD.println("hola.txt","$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47");
. For time sake this is going to be the faster option.
But lets say you want to send each item to the card one at a time, you could to it like this...
SD.print("hola.txt","$GPGGA,");
SD.print("hola.txt","123519,");
SD.print("hola.txt","4807.038,");
SD.print("hola.txt","N,");
SD.print("hola.txt","01131.000,");
SD.print("hola.txt","E,");
SD.print("hola.txt","1,");
SD.print("hola.txt","08,");
SD.print("hola.txt","0.9,");
SD.print("hola.txt","545.4,");
SD.print("hola.txt","M,");
SD.print("hola.txt","46.9,");
SD.print("hola.txt","M,");
SD.print("hola.txt",",");
SD.println("hola.txt","*47");
Both will render the same results. Each line will be written to the card as one line. You can change the name to a .csv and open it in excel and then write a macro to clean up the file and your done.
I created a .csv file using this sample code and just changing the .txt to .csv.
#include "SDuFAT.h"
#define MEM_PW 8
void setup(){
pinMode(MEM_PW, OUTPUT);
digitalWrite(MEM_PW, HIGH);
Serial.begin(9600);
}
void loop(){
if (Serial.available() > 0) {
int result = 0;
byte inSerByte = Serial.read();
switch (inSerByte) {
case 'R':
result = SD.cat("hola.txt");
break;
case 'P':
result = SD.println("hola.txt","$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47");
break;
}
}
}
Pardon the code, it could be cleaned up a bit but it works for a quick check.
Hope that helps.