LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mirroring input to output on NI usb-6259 (with or without DSP)

Hi, I'm new to Labview and I am looking to make a vi that reads a digital waveform in and echoes that waveform out on another pin, preferrably after having undergone some logical switching for channel selection purposes. I have tried looking through and modifying the example vi's (e.g. Multi-Function-Synch AI-AO.vi ) with little luck. It seems that the best I can do is to generate a square/triangle/sine wave at a frequency that is governed by my external clock trigger... No data echoing for anything complex. Can anyone offer me some pointers on where to start with this IO stuff? Ideally from a "block diagram" point of view, I'd like to have my external waveform generator running an external trigger to a DAQ pin, use that to trigger sampling on another (digital) IO pin, send that data to the DSP blocks, and then finally echo the data out to another IO pin... I've tried constructing this setup in all the "intuitive" ways I can think of, and have sort of struck out. Please help?
0 Kudos
Message 1 of 3
(2,689 Views)
pmub
Smiley Surprised
0 Kudos
Message 2 of 3
(2,670 Views)

Hello Godzilla,

 

In order to do synchronized digital input and output you will need to route your external trigger through a "dummy" analog input task.  The reason for this is that the digital I/O tasks do not support start triggers.  By using the analog input sample clock and starting the digital tasks before the analog input they will be started at the same time and thus be synchronized.

 

I would recommend starting with the Multi-Function-Synch AI-Read Dig Chan.vi example program.  This example does everything you need to do for the digital input; the only thing you need to change to the source input of the DAQmx Timing VI for the analog input task.  Right click the source input and create a constant, then choose the PFI line you want to route your external trigger in on.

 

At this point you'll have a program that uses your external sample clock and you have the ability to add a digital output task that will be synchronized with your input.  To add this digital output task I would suggest the Cont Write Dig Port-Ext Clk-Non Regeneration.vi example.  If you copy this example into the other one and merge the two while loops you'll only have a few modifications to make.

 

Here are some things you'll need to change:

1.  Route the same analog input sample clock to the source terminal of the DAQmx Timing VI for the digital output task.

2.  Buffer the output with the data you want by changing the data input to the DAQmx Write VI.

 

Non-regeneration keeps the digital output from looping previous data.  This will allow you to know if you are buffering output data fast enough.  If you have trouble running this loop with your analysis then I would recommend implementing data pipelining.  For an overview of what pipelining is please see this article:  http://zone.ni.com/devzone/cda/tut/p/id/6425

 

In general control loops are not recommended on Windows operating systems.  However, depending on the analysis you're doing, your computer, and what loop rate you're looking to get it can be possible with good programming techniques.  The fastest I would recommend trying to execute your loop on a Windows OS is on the order of 10ms (give or take depending on your computer and analysis).  If you need to execute this control loop faster than 1ms I would recommend considering a Real-Time operating system.  We have benchmarked PID control loops on Real-Time operating systems at more than 30 kHz.

 

I hope this helps get you started, and if you'd like to talk with someone at National Instruments about Real-Time control loops feel free to contact us directly using the information at www.ni.com/contact.

 

Have a great day!

Brooks
0 Kudos
Message 3 of 3
(2,631 Views)