LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to read high rate serial data?

Solved!
Go to solution

@johnsold wrote:

That article on the high res timer is quite old.  Search the Forum for that topic.  Within the past week or so someone posted a modern version.  Note that these are Windows-only VIs.

 

Lynn



As a matter of fact- someone did as I recall   Here is a link.  Funny, I hadn't seen that article and was doing some intensive searching. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 11 of 21
(2,400 Views)

Hi

 

I have a similar problem, I trying to get data from a laser (SICK)  that can works in continous mode sendind strings of data.

It saise 1 readind each ms and can take data at 2kHz rate.

 

The problem is that string seems the numbers rotating from is positition between readings and i only can get about 400 wrong readings/s.

 

Can somebody please help me increase the rate of readings and that readings arrive has a complete string.

 

In a simple program (SEEIT has hyperterminal) I send a comand and it arrives in continous mode about 2000samples/sec

 

Attach is a file 2nd colunm is number, last is the string, at the beggining the number is good than a chacater change its position

 

Please see right down coner of datasheet

 

best regards

cpalha


 

0 Kudos
Message 12 of 21
(2,300 Views)

cpalka wrote:


The problem is that string seems the numbers rotating from is positition between readings and i only can get about 400 wrong readings/s.


How many wrong readings per second do you require?

 

Seriously though, I think you're just not using a termination character (check to see if the data being sent includes a termination character).

Message 13 of 21
(2,292 Views)

It is too dificult, imagine 1 reading each ms 

Below is an extract froma a file and the string lenght seems to bee  48.8850\0D and I only need the number 48.8850.

If I configure the visa read to 10 byte count  it only change the character position seems to be a time syncro between laser and pc?

 

 

0.129007 36\0D48.8848
0.132008 \0D48.8850\0D4
0.134007 8.8854\0D48.
0.136008 8849\0D48.88
0.139008 49\0D48.8853
0.141008 \0D48.8838\0D4
0.143008 8.8852\0D48.
0.144008 8853\0D48.88
0.146008 40\0D48.8860
0.149008 \0D48.8851\0D4
0.151009 8.8852\0D48.
0.153008 8843\0D48.88
0.155009 50\0D48.8850
0.157009 \0D48.8847\0D4
0.160009 8.8852\0D48.
0.162009 8835\0D48.88

 

0 Kudos
Message 14 of 21
(2,275 Views)

What do you think the \0D is?

 

It's the <CR> Termination character lsited in your data sheet.

 

Set up VISA to recognise this as a termination character and all your troubles will be gone.

 

Plus, ALWAYS keep an ASCII table handy when programming Serial.

 

Shane.

0 Kudos
Message 15 of 21
(2,269 Views)

Hi Intaris

 

Thats it ! Thanks a lot

Now you can help me find a easy way to transform this string into a number?

I use scan from string but sometimes crashs.

 

 

0 Kudos
Message 16 of 21
(2,254 Views)

Hi

 

 

Now is perfect, but in continous mode I only get about 450sample/s.

In visa configurations the sample rate can change data acquisition?

The bd maximum for laser, 7800.

I stiil have many diference between LB and the simple program (seeit) that can read about 2000S/s

 

 

Best regards

CPalha

0 Kudos
Message 17 of 21
(2,248 Views)
Never use continuous mode except as a debug tool. I can't look at your VI now but your VISA Read should be inside of a while loop with nothing else except the conversion to dbl.

Changing the baud rate could affect the acquisition rate but there could be basic limitations with the instrument.
0 Kudos
Message 18 of 21
(2,243 Views)

You are also writing to file 450 times a second.  That's probably too often.  Try buffering the values (storing into a pre-allocated Array) and save only when the array is full.

 

If the Max baud for your laser is 7800 then you will only get approximately 780 Characters per second.  Given a response length of 8 Characters, that will yield a maximum of approximately 100 values per second, I don't know where your 480 is coming from.

0 Kudos
Message 19 of 21
(2,241 Views)

I put a while loop but does not work.

Can you make the changes in the vi? When You have time?

 

 

Thanks

Best

cpalha

0 Kudos
Message 20 of 21
(2,230 Views)