LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview serial update rate

Here is what I tested

0 Kudos
Message 11 of 40
(1,802 Views)

yet another test the data send at from the PC is slow then the rate of data received.

And also asynchronis, so beginning to think it is not possible (only at slow rates).

0 Kudos
Message 12 of 40
(1,794 Views)

Changing the last example to timed loop is better, but then would it be possible to synchronize the timed loopt to the termination character or the received data (within a certain range) ?

 

Why can't I edit my previous post?

0 Kudos
Message 13 of 40
(1,787 Views)

there is a few minute window to allow you to edit, looks like it was about 20 minutes between your posts, which is longer than the window.

 

You could try looking at the various time outputs of the timed loop and adjust the next loops timing accordingly. When you create a timed loop it has terminals on either side of the inside of the loop. Left clicking on them brings up a drop box with "Select Output" with a "previous interation timing" from which you can tell if the loop went long or not, adjusting the timing on the right hand terminal.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 14 of 40
(1,781 Views)

Yes have found those block the loop now is within 2ms always. but the send data is not in sync with the dsPIC, what I ment is it possible to trigger timed loop with the serial dat in.

0 Kudos
Message 15 of 40
(1,778 Views)

Working backwards through your questions....

 

There is a time limit on how long you can edit a post.  After that you need to reply, creating a new post.

 

You have conflicts in your code: You have termination characters enabled (default).  You have the termination character set to a character not in your dataset (line feed - also default). You are using Bytes at Port (conflicts with termination character). And you are running this in a loop much too slow for your data.  You have already been told most of these things.

 

Fixes: 1. Set the termination character to carriage return.  Read the detailed help for the Configure Serial Port VI.

2. Get rid of Bytes at Port.  The termination character will end each read when a carriage return occurs in the data.

3. Take the Wait functions out of your loop. You cannot set a wait less than 1 millisecond but you need to read about every 65-70 microseconds. The VISA Read will wait until it sees the carrriage return.

 

Lynn

0 Kudos
Message 16 of 40
(1,778 Views)

1: I always had this on carriage return, so no problem there. It is indee \lf by default but set it to \r (or 13 decimal)

2: I will try that didn't know that, shall try it.

3: wait function delete when I changed the loop timed loop.

0 Kudos
Message 17 of 40
(1,776 Views)

The code I now have seems to work on 500Hz. I will test it tomorrow if it realy works.

 

Thanks for the great support.

0 Kudos
Message 18 of 40
(1,770 Views)

I changed the code to 500Hz most of the time it works but after a while it sometimes receives incorrect data

See attachment error, and also the VI.

 

Can I improve the VI so there are no false reads ?

 

Also the data at serial port says there 951 bytes when it is in fact only 12.

Download All
0 Kudos
Message 19 of 40
(1,756 Views)

Are you getting an Error on your VISA read?  Hook up an indicator on the error wire.  If you aren't getting the correct data, then conversion from string to an integer may be resulting in zeroes, which you are seeing on the graph.

 

Is the value in the bytes at port growing over time?  You may be accumulating data in your buffer.  You say "when in fact it is only 12".  What make you say that?  Because that is what the Received bytes indicator shows?  What is that indicator attached to, because it doesn't exist in the VI you attached.  You are requesting 20 bytes.  Your termination character is enabled and set for the carriage return character.  You may have 952 bytes in the buffer, you ask to read 20.  You get 12 because that 12th character is the carriage return.  Then you write some data.

 

If your serial port is getting packets of data that each end with a carriage return faster than you read in the loop, you are going accumulate bytes in your serial buffer.

0 Kudos
Message 20 of 40
(1,747 Views)