11-18-2013 11:37 AM
Hi , first of all english isn't my native language so forget de orthographic mistakes.
i'm making a datalogger with arduino uno, with 6 analog inputs. the uno sends the data just fine (i use CoolTerm to test). but when im geting the data with labview some bits are lost. i make two VI's, one using "bytes at port" and the other with "byte count". as seen below:
in the next graph i show you the data that reads coolterm and every VI
you can see the time stamp that arduino is sending, in coolterm is every 2-3 ms, with byte count is 2-3 ms but frequently some data is lost and with bytes at port look like its random.
additional data:
baud rate 115200, 8 bits
the case structure is for dismiss the first data in the buffer and to start an pause the acquisition , using a serial flush in bytes at port, dont know why i can't use serial flush with byte count so i use memory free function.
arduino code:
String buffer;
int i;
unsigned long t;
int datos[5];
void setup()
{
Serial.begin(115200);
Serial.flush();
}
void loop()
{
for(i=0;i<6;i++){
datos[i]=analogRead(i);
}
t=millis();
buffer = String(datos[0])+" "+String(datos[1])+" "+String(datos[2])+" "+String(datos[3])+" "+String(datos[4])+" "+String(datos[5])+" "+String(t);
Serial.println(buffer);
}
11-18-2013 11:40 AM
attached the other VI
11-18-2013 11:48 AM
What I recommend is add an End Of Line character to the end of you Arduino buffer. This way you will actually have a termination character. Then just read a huge number of bytes. The VISA Read will stop when it finds the termination character. So get rid of that case structure before the VISA Read. You don't need to free up memory for this.
11-18-2013 02:06 PM
i put "T" as end of line in arduino, 0x54 in labview and still lose some data. it get the first 550 strings that are send and start to lose data , could be that the data is coming to fast?¿?¿ maybe taking more samples and then send all as a bigger buffer?¿?¿