LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to sync COM port and DAQmx AI

hello, has anyone ever tried synchronizing COM-port data and analog input channels data using DAQmx and writing the same to a file?

I have an application which requires this...

 

thanks,

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 1 of 7
(3,977 Views)

"Synchronizing" is not possible between those interfaces in itself.

There are two ways, to do "achieve synchronicity", so please check if one applies to your requirements. If not, you will have no chance.....

 

A) The acquisition is really slow (i'd say about 100 Hz at best), you can use "software timing". This will, as close as possible to one another acquire a single value from serial and DAQmx. The difference can easily become several ms, esp. if you don't make sure that initializing the interface (VISA and DAQmx) is done outside the loop accessing the interfaces for reading. If you open and close each interface for each access, the time difference can easily get up to several 10-100ms.

So this will introduce a jitter between the values.

 

B) If the external (serial) device supports trigger/clock import/export, you can synchronize the DAQmx device with the serial device. You have to wire the trigger/clock between those. For DAQmx, NI provides examples on how to import/export trigger/clock, so you should start looking into this.

You can achieve a real synchronization with this method, but it really depends on the serial device. If it does not give you this option, option A is the only way to get something close to synchronization.

Please note that you will have delays between the instruments depending on the length of the cable (usually up to several us).

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 7
(3,965 Views)

, 100Hz is also very fast for my application. I would probably be sampling the signals at say 10Hz. i do not have both the devices yet with me, but wanted to get the research done before ordering...

I think there might be an issue with saving both the data to 1 file... lets see how it goes...

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 3 of 7
(3,945 Views)

Hi LV_Enthu,

 

Based on what Norbert said, you should not have a problem using the "software timing" option at 10Hz.

 

As far as saving data from multiple devices, you can do this easily in LabVIEW. I included a link to another forum post with some related code for saving multiple sets of data.

http://forums.ni.com/t5/LabVIEW/Plotting-and-Saving-Data-from-Multiple-Channels-and-Tasks/m-p/187879...

 

Zach P.

Staff Software Engineer | LabVIEW R&D | National Instruments
0 Kudos
Message 4 of 7
(3,926 Views)

ok... will try and post accordingly if i had questins... thanks all for the help

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 5 of 7
(3,911 Views)

Hello, 

I know this post is a few years old....But here goes, im relatively new to Labview but have been working with it for the last 8 months. 

I have a 6 axis force sensor that im taking data with through a PXI-6225 DAQ card i'd like to aquire at at least 500Hz. I also have a laser distance measurer that gives distance values via serial port through a PXI 8432 card and is powered via a PXI 4110 DC Pwr card. All cards are mounted in a PXIe-1082 Chassis.  Laser can operate at a max of 50Hz. Laser has an external trigger option that requires a pulse >= to 1ms of at least 3VDC. 

 

I am trying to synchronize the data recieved from both devices to some extent. I need to be able to correlate a force at a particular distance. Currently each runs independently so time is not sync'd between devices. My thought is that I could send a trigger voltage from the DC pwr card on a different channel to the laser, of which that trigger voltage was sync'd to the same clock as DAQmx card. Even if each are are aquiring at different rates, as long as there is some sync  with time that would be good, I can interpolate values in between. 

 

Any adivce on where to start would be great. I have not seen much about sync'ing or triggering VISA devices. 

0 Kudos
Message 6 of 7
(3,646 Views)

It sounds like you’ve got a good idea of what you want to accomplish. Have you tried implementing any triggers thus far? Here’s a link to a tutorial on how to utilize triggering.  

 

http://www.ni.com/tutorial/4329/en/

 

I know this isn’t quite what you’re trying to accomplish, but the overall layout of this other example has helped me with syncing.

 

https://decibel.ni.com/content/docs/DOC-25154

 

Also, I would recommend starting a thread. This thread is a few years old, and you’ll probably get more of a response if you start a fresh one.

0 Kudos
Message 7 of 7
(3,606 Views)