From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High frequency sampling with VISA-COM port

Solved!
Go to solution

Dear All!

 

First of all, I'm kinda new to Labview, but I'm making a Labview program in which I'm using DAQmx (hardware: USB-6001) to acquire some analog signals at 1000 Hz, and give out one digital (high or low) signal. This part is running smoothly, but there is also a digital scale from which through COM port I would like to collect continuously the weight data. If I use the VISA read inside the while loop, the frequency drops to 23 Hz, and has an impact on all the acquisitions. I do not want to get samples at 1000 Hz from the scale, but I would like to connect the data from it with all the other data I acquired. One thing in regard the scale: it's sending the weight data continuously at about 23-24 Hz with no trigger needed.

 

So my question is, how can I connect the 23-24 Hz data from the scale through COM port with all the other data with 1000 Hz?

 

I attached the VI and also a picture too.

 

Thank you!

polbazs_0-1606335033655.png

 

0 Kudos
Message 1 of 4
(1,135 Views)
Solution
Accepted by topic author polbazs

Your DAQ Assistant is currently set for 1 sample at 2 Hz.

 

What is the baud rate of your digital scale?  You didn't set it in the VI, so it defaults to 9600 baud.  That means the best you can do is get about 100 bytes per second.  There is no way to get 1000's of Hz of data out of that.  In general, serial ports aren't meant for  "high frequency".

 

If you are trying to create a VI that merges 1000 Hz data with 23-24 Hz data, you'll need to do them in separate loops.  About every 40 samples of the 1000 Hz data will have the same digital scale value.  Just use a notifier or even a local variable to pass the slower data from the digital scale loop to the loop that gathers the DAQmx data and processes it.

 

Message 2 of 4
(1,073 Views)

Thanks for the reply! 

Yes my DAQ Assistant is set to 2000 in this VI but I will only use it on 1000Hz.

 

The baud rate if the scale is 9600, so the default value is good for me. As I mentioned I don't want to collect data at 1000Hz from the COM port, I only intend to merge them like you said. Thanks, I will try the seperate loops.

0 Kudos
Message 3 of 4
(1,068 Views)

@polbazs wrote:

Thanks for the reply! 

Yes my DAQ Assistant is set to 2000 in this VI but I will only use it on 1000Hz.

 


Not in the VI you attached.  The DAQ Assistant is set to 2.

 

I have another thought.  First I recommend getting rid of the DAQ Assistant and using real DAQmx functions.  Put them in the same loop and let the VISA stuff control the loop rate.  When you do the DAQmx Read, set it to -1 which will read all available samples.  Now merge the one set of readings you get from the VISA Read, with X number of samples from the DAQmx Read (roughly 40, but give or take).

 

Now it can be one loop, VISA controls the loop rate, DAQmx reads all that is available.

Message 4 of 4
(1,060 Views)