04-22-2011 02:42 AM
Hi all,
I have a probem with reading continuous measurement data and save them to a file with serial RS232 port.
Attched is my VI that sends a command "MEASURE START_A" to a laser displacement sensor in order to continous reading out of measurement value of HEAD A. (detail informations could be refered to previous post "Send command to laser sensor via serial port RS232").
The response from the device has the structure as in the communication manual pdf file page 6. In the current VI, I used a while loop to define a specified read time, and the loop read and save data batch by batch.
I am dealing with these problems:
(1). I am not sure that if this loop could help me to save data continously or it may lost data in between each iteration of the loop or is there any other better methods to read and save data for my requirement ???
(2). The sampling frequency of the device is 100us (10kHz), so will the record data from VISA Read in each batch also have this sampling rate or it may depends on other parameters ???
(3). One more thing, when I run my VI it always ends with an ERROR for "Timeout expired" as in the jpg file. Some body can tell me how to deal with it ???
Thank you so much for any help.
04-22-2011 10:49 AM
I've modified my VI as the attached image. Two improvements have been suggested:
(1). Replace the while loop by a for loop and let it run just one time to acquire a certain amount of data. Say each measurement usually contains 7 bits (ex. +5.273CR+4.263CR ...) where CR(0DH) is inserted between the measurement. Then if I intend to acquire 2000 data, a number of 2000*7=14000 is wired to the VISA Read. By this way, I could eliminate the risk of loosing data compared to the last VI.
(2). In order to eliminate the ERROR of "Timeout expired", a larger timeout (90s) is set to the VISA Serial port.
However, my original requirement that is saving a specified time for the measurement still hasn't been solved since I don't know what is the sampling rate of the current data in order to multiply with the acquired number of data ???
Still waiting for any grateful assistance !!!
04-22-2011 11:47 AM
In the communication manual pdf file, page 6, it wrote "The transmission speed is 1 character per 5-10ms, regardless the baud rate".
So does it mean that in case I want to receive 2000 measurement or 14000 characters (bytes) it will take the for loop in my VI 70-140sec to complete the receiving and save it to the Text file?
However, the sensor measurement sampling cycle is 100 usec, then the actual recording time of the 2000 measurement is 0.2 sec ???
I need to take 70-140 sec to save a record of 0.2 sec of data ???
Is my above analyzation right ???