05-08-2009 02:52 PM - edited 05-08-2009 02:53 PM
HI
I try to modify the example "Basic serial write and read.vi" to have timestamp with the data string and save them to a file.
Could anyone help me to do that. I am a beginner in LV. Thanks
05-09-2009 07:33 AM
05-11-2009 03:25 PM
05-12-2009 05:00 PM
Thanks a lot.
I add these 2 sub-VIs and it works.
However, numbers (measurands from the serial port) are sometimes unreadable
and sometimes there are 2 (or more than 2) numbers recorded at a certain time stamp.
Could anyone help me to figure the problems out?
Thanks a lot
Hara
05-12-2009 06:43 PM
You've got at least one major problem. The example you used should never be used in a loop. What you want to do is place the VISA Configure Serial Port and the VISA Close outside the loop. You are reinitializing the serial port with every iteration. Also, the basic example is, well, pretty basic. The way you have it, you are writing to the file with every iteration - even if the byte count is 0. It would make more sense to place a case statement around the VISA Read and execute that if the count is greater than 0. You could also place all of the file write code inside the same case statement so you only write when you have data.
If the data from the instrument is a known and fixed byte count, you could also use that as a constant instead of reading available bytes.
05-13-2009 04:29 PM
Thanks
I have checked the instument and found that the byte count is not fixed.
How can I just record one at a time?
Thanks a lot!
Hara