Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronize AI and counter

I need to synchronize continuous buffered AI (using PCI-MIO16E series) and Encoder Up and Down Counts (using PCI-6602).  I want to use LabVIEW and DAQmx and I am wondering if I also need a rtsi cable to synchronize the 2 boards.  I need a common timestamp for both the encoder counts and the analog input measurements in my spreadsheet file.  Is there a good example program that shows how to synchronize the measurements?  If I do need the rtsi cable, how do I set up the rtsi synchronization in the code (and MAX).

0 Kudos
Message 1 of 3
(3,477 Views)

Hopefully, this little bit of info will help get you started:

1. A RTSI cable is not strictly necessary, but I would recommend it to save yourself present and future screwdriver work.  (An alternative is simply to connect a wire between appropriate pins on the two boards' terminal blocks).  If you need something to try out the proof-of-concept, it turns out that the RTSI cable is good old-fashioned 34-pin ribbon.  This is the same type of connector used by 3.5 inch floppy drives.  You may have an old floppy cable that'll let you try things out.  CAUTION: make sure all pin connections are straight-through between the connectors.  Some old floppy cables were partly split and some lines were "twisted" to swap certain pins.  If it isn't straight-through, DON'T use it.

2. In MAX you would add a new DAQmx device.  One of the choices is to add a RTSI cable.  Then you define which of the DAQ boards are connected to the RTSI cable.  After you've done that, DAQmx is smart enough to assign particular RTSI lines to your tasks as needed.  You won't need to specify them directly.  When you configure the counter task, you'd tell it to use the AI sampling clock from the other board as its own sampling clock.  DAQmx handles the RTSI routing assignments under the hood.

3. If you're stuck in traditional NI-DAQ, you'll need to handle the signal routing more manually.  You would use Route Signal.vi to push the AI sampling clock up to a particular RTSI pin, and then configure the counter task to use that same RTSI pin as a sampling clock.

4. I don't have LV here at my network PC, but there are a variety of shipping examples that show synchronization.  This site has many more examples of various kinds.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 3
(3,464 Views)
Hello mccahilp,

I would certainly recommend using a RTSI cable.  As Kevin mentioned, when using a RTSI cable, the DAQmx driver can automatically handle the necessary routing.  In addition to programming your hardware-timed analog input task, all you would have to do is configure a buffered position measurement task, then for the sample clock, specify "/DevX/ai/SampleClock" as the source, where "DevX" is the device name of your DAQ board.  Then start the position task before the analog input task so that it does not miss any clock cycles of the analog input sample clock.

Although I could not find any examples that do directly what you are asking, there are examples for buffered position measurement.  You could start with the following example, then add your analog input code and make the necessary modifications:

NI-DAQmx: Reading the Position of an Encoder into a Buffer

I hope you find this information helpful. 

Best regards,
0 Kudos
Message 3 of 3
(3,448 Views)