LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synch DAQ and RS232

I have a rather unusual challenge.  I am acquiring data from two sources:

 

1.  From an RS232 instrument.  I request the data via RS232, and then get a constant stream of values sent to my COM port.  Each value comes with a timestamp provided by the clock on the instrument.

 

2.  From a USB DAQ card.  This data is obviously timestamped also, using a combination of the the system clock (for t-zero) and the onboard DAQ clock (for delta-t).

 

The challenge:  How do I synch the signals?

 

Sure each signal has a timestamp ... but they come from different clocks!  And I can't actually rely on the clock on the RS232 instrument to be correct.  The time between each sample will of course be accurate, but the "real world" time is not reliable.

 

I am wondering if there is some way to trigger the DAQ task upon receiving the first RS232 byte ... but even that is unreliable because by the time I receive the first byte, some number of milliseconds have already passed!

 

Any ideas out there?

http://www.medicollector.com
0 Kudos
Message 1 of 5
(2,439 Views)

Hello josborne!

 

How closely matched do you need these signals to be?  What kinds of signals are they?  Why is it necessary for them to be synchronized?

 

I don't know of a way to truly synchronize an RS232 instrument with a USB DAQ card.  I think that no matter how you slice the cake, there will be some kind of software lag involved.  As you suggested, you could set up a program that triggers a DAQ task when it receives some serial command, but you would still have that lag.

Michael B.
Applications Engineer
0 Kudos
Message 2 of 5
(2,417 Views)

One way to synchronize two independent instruments like this is to record the same signal on both, ideally a signal which has a characteristic suitable for determining the synchronization.  Whether this can be done depends on the availablity of a suitable signal and on an unused channel on at least one of the instruments.  If one of the instruments generates an output (like an Acquisition Start pulse) with a known timing relationship to the data from that instrument, record that output on the other instrument.

 

Lynn

Message 3 of 5
(2,405 Views)

Thanks for all your tips.

 

As it turns out, we have decided to solve this issue using the exact technique reccomended by Johnsold.

 

We are going to feed a trigger pulse freom the DAQ board back into the RS232 instrument.  We can't actually trigger the RS232 instrument, but we can read back the trigger pulse and then align the signals after-the-fact.  Cool technique.  Thanks!

http://www.medicollector.com
0 Kudos
Message 4 of 5
(2,376 Views)

You are welcome.

 

I learned to use this technique long ago when lack of triggering was more common than its presence. It turns out to be useful in quite a few situations.

 

Lynn

0 Kudos
Message 5 of 5
(2,368 Views)