LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling Rate

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

0 Kudos
Message 1 of 5
(2,396 Views)

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.

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 5
(2,393 Views)

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.

0 Kudos
Message 3 of 5
(2,390 Views)

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;

0 Kudos
Message 4 of 5
(2,359 Views)

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.

0 Kudos
Message 5 of 5
(2,353 Views)