08-19-2011 02:35 PM
Hello
I collected data using Labview through serial port from Inertial Measurement Unit (IMU) sensor. The baud rate is set 9600. But when I reviewed the data on the spreat sheet. I see 5 data per second, so salpmig rate is 5hz. by the way I add a delay before saving data on the file (200 ms) the reason is without any delay; some rows of data are empty. I cannot receive all the data.
So is there any way to control it?
Thanks
08-19-2011 02:42 PM
The serial port will buffer that data. Just read the port periodically and read the whole buffer each time (see: VISA "bytes at port" property). It will probably be difficult to know the exact sampling rate, since the port isn't deterministic like a DAQ device would be.
08-19-2011 02:47 PM
It would also be helpful to see your code. If you are doing a save inside your read loop, that will obviously slow your acquisition rate. I also don't understand why you would have blank rows. Also provide details on the device that is doing the sending of the serial data.
08-20-2011 02:10 PM
The sensor measures roll, pitch and yaw and send to serial port of pc through Bluetooth. Since there are two sensors; I used two serial ports in the code. I am interested in just roll data, so using regular expression I could extract those info.
Attached please find my code. let me know if there is a better way to do it.
Thanks;
08-20-2011 04:05 PM
The sequence structure is not at all necessary and is just hiding some of your wires. Please clean up your code.
Having the file writes and the 200msec delay is just slowing down your acquisition. I would suggest you look at the producer consumer architecture and have the producer loop with just the serial read. You can avoid blank lines by testing for 0 bytes available. You do not want to do a read or conversion/writing of any data if there are 0 bytes.
Another thing is your regular expression. You have some '\' codes in there but you have not enable '\' Display.