LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set the read rate of visa same as in daqmx in the same loop

Solved!
Go to solution

Hi Everyone,

 

I'm trying to receive data from USB 6001 and Arduino via visa at the same time, the loop is 50 hz due to daqmx and means on the data, the visa is upto 100 samples per second so there is a buffer in receiving visa data and there is a delay at presenting the visa data.

 

So how i can set the visa read rate the same as the loop rate or the same as daqmx sample rate? How to Synchronize the two sources of data visa and daqmx. 

Attached VI

Thank you for helping,

 

 

Kareem 

0 Kudos
Message 1 of 5
(713 Views)

Your USB-6001 runs off a pretty accurate crystal clock, so I "trust" that you are getting 20 samples 50 times a second (given your sampling rate of 1 kHz).  Arduino is definitely running on its own clock, and I don't know (and haven't done the research to find out) how accurate or precise it is.  

 

Are you trying to make "control" decisions, or are you in "pure sample mode"?  For example, if your DAQmx sample size was 1000 points, you would get points once a second, and could also ask the Arduino for all of its unread data once a second (at the same time you do the DAQmx Read, so you're doing your best to synchronize the data).  You'll get 1000 points from DAQmx, and I don't know how many points from VISA, but you'll have a whole second to do whatever you need to do with both of them, and with the longer sampling interval, the possible "mismatch" between DAQmx and Arduino in sampling rate might be less "significant" (a VISA difference of one sample in 1 second is "smaller" than one sample in 20 ms).

 

The question comes at what point do you need to do things with both sets of data.  You haven't described much about what you are hoping to accomplish.  It might be that it makes sense with two such different sources to save the data in two distinct streams, combining them after-the-fact (and doing whatever post-acquisition fudging needed to "synchronize' their two clocks).

 

Bob Schor

0 Kudos
Message 2 of 5
(677 Views)

Thank you Bob,

 

 

What I'm trying to do is to control the visa sampling rate same as in the loop rate, the data in live experiment so the two sources should be match in time, is their a way to read visa data in different controlled sampling rate without filling the buffer (just read when i want so i can integrated with the loop 

0 Kudos
Message 3 of 5
(660 Views)
Solution
Accepted by kareemab

Hi kareemab,

 


kareemab@post.jce.ac.il wrote:

What I'm trying to do is to control the visa sampling rate same as in the loop rate, the data in live experiment so the two sources should be match in time, is their a way to read visa data in different controlled sampling rate without filling the buffer (just read when i want so i can integrated with the loop 


You cannot control the "sample rate" of your external device with VISA communication.

 

But you can place the VISA code into its own loop and put the read values into a notifier to always keep the most recent data.

In your other loop you can read from the notifier whenever you want and you will get the most recent value…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(653 Views)

I tried the notifier and it works well, thank you for your support.

0 Kudos
Message 5 of 5
(615 Views)