LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Record measurements from serial device and DAQ with common clock

Solved!
Go to solution

What would be the best way to go about recording two signals, one of which is analog input through a National Instruments DAQ, and the other is through serial VISA access to a USB device, with a common clock?

 

Here is a more detailed description -- I'm still very new to LabVIEW so I apologize if I'm omitting necessary details, please let me know and I'll include them in a reply:  I have a 4-channel NI DAQ that my group has previously used to sample and record two analog signals. One input comes from a CT scanner and indicates whether the beam is on or off.  The other is the output of a pressure to voltage transducer.  We need both of these signals to have the same sample clock so that we can determine what the pressure measurements were when the beam was on.  This was very straightforward when both signals were coming through the DAQ, however we've recently replaced the transducer with a newer model that connects by USB (OMEGA PX409-USBH).  The transducer has no provisions for timing.  It can be accessed through VISA or as a .NET object.

 

I am able to access the new transducer through LabVIEW using VISA read/writes, but I'm unsure about how to go about writing a VI that will record the analog input through the DAQ with shared time information.  I need to either force the VISA read to occur as close as possible to the read from the DAQ, or measure both signals independently but record timestamps with a common clock.  Is one of these approaches more straightforward/advantageous than the other?

 

From other threads I've read, this should be possible using software timing.  Synchronization accuracy to within 10 ms would be ideal, but really anything under 100 ms or so would be acceptable.  In the VI, we are just writing the two signal measurements to a file that can be post-processed later.

 

Would the producer/consumer design pattern (http://www.ni.com/white-paper/3023/en/) with 2 loops to measure the signals and a 3rd to synchronize/time stamp and then write to file be the way to go here, or am I completely confused?

 

Thanks in advance.

0 Kudos
Message 1 of 3
(2,313 Views)
Solution
Accepted by topic author tenthe

First of all, I would be using TDMS purely for the grouping.  Your analog signals go in one group, the USB goes in another.

 

Yes, you will want a Producer/Consumer with 3 loops.  The first loop does the DAQ.  The second loop does the VISA.  The third loop just logs.  The data type for your queue should be a cluster with a string and a waveform in it.  The string will tell the logging loop which group to write to.  The waveform will be the data to log.

 

In the case of the DAQ, you just have to bundle up and send.  The logging loop can just write directly and be done.

 

For the VISA signal, you will need to use Build Waveform to put your data in the Y and a current timestamp in the T0.  The logging loop will also want to get these values out and write the value to two different channels (time and pressure).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(2,282 Views)

I know it's been a while, but I just wanted to follow up and thank you for your help!  Really appreciate it, I was able to get a working VI following your suggestions.  I tested the synchronization by sending the same pressure signal to the USB transducer and an additional analog transducer connected to the DAQ.  Synchronization by the system timestamps was precise enough for our purposes. 

 

TDMS was a good idea.  It's nice to have some metadata and the write performance speed is excellent.

 

Cheers!

 

 

0 Kudos
Message 3 of 3
(2,211 Views)