Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

USB Hardware suggestion for syncing a short digital pulse with periodic analog out

Go to solution

I'm hoping someone can point me in the right direction, and also clear up a few concepts!

  Background: I am currently using the USB-6009 and labview on a laptop to output 2 analog waveforms. One acts as a (periodic) velocity waveform(0.5-2Hz) for a stepper motor(via a driver) running a flow loop, and the other waveform acts as a short 5V signal to trigger some imaging equipment. The ability to shift or delay the start time of the  "trigger" waveform relative to the velocity waveform in small (ms) steps has become a requirement for my experiments. Given the software based timing of the USB-6009, the accuracy has not been quite enough for I need, and the way I wrote the VI restricts my delay/shifts to the velocity waveform deltaT(30-40ms). I started looking at the USB-M series(portability is a requirement)since some have hardware-based timing, and I could send the waveform to a buffer, rather than have to iteratively read each value of the waveform in. It also seems that a short digital "pulse" would work better than creating an entire analog waveform. Where I've run into some confusion is determining the requirements to deterministically synchronize the two. I'm looking at getting some new hardware. I started out by looking at the USB-6211. However, I've run across a few posts talking about correlated digital I/O being needed for vaguely similar setups, which would require something more like the USB-6221. Since I will probably need the digital out to be on a different time scale than the analog out,is Correlated Digital I/O required? If not, would the 6211 work?


Just to be clear, I need the periodic waveform and trigger to be consistently in sync (anywhere from10 minutes to several hours). Then be able to shift the pulse +/- 1ms(minimum) and repeat.  I can justify the more expensive device if necessary, but I don't want to get something that I don't need.


I've attached a figure(not to scale) of what I am after, in the probable case that my explanation wasn't too clear.





0 Kudos
Message 1 of 14

Hi Gabe,

If you only need to generate two pulses on different lines and accurately control the tim difference between them then a USB M series device that can do hardware timed digital I/O is what you will need. The USB 6211 is software timed and you will run into the same timing constraints as the USB 6009. The USB 6221   has the ability to do hardware correlated digital IO. With this you would be able to give two different data sets to each line and have them update at the same rate (up to 1 MHz). The two lines would stay in sync because they would use the same clock in the same task so you would have to worry about drift relative to each other.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 14

Hi Matt,

 Thanks for getting back to me.

I think I am getting a bit confused. I had spoken with someone at NI earlier and they suggested using the start of the analog output(velocity waveform) as a trigger for the digital pulse, and setting the desired delay. I am realizing that I had assumed that the USB-6211 had hardware timing. So if I am understanding what you are saying correctly, the output of the analog waveform values from the FIFO buffer are software timed. Is that a different timer from what would be controlling the delay for the digital signal(also software timed)? My hunch is that the main problem I'm having with the 6009 is that it has to read in and send out each value of the waveform individually, or one value per loop. How stable is the software timing on a board with the buffer?  Sorry to keep ask so many questions, I just want to make sure I fully understand the capabilities of the boards so as to not run into problems down the line.



0 Kudos
Message 3 of 14
Accepted by Gacevedo

Hi Gabe,


The 6211 does not have buffered digital I/O like some of our other devices.  However, there are two full-featured counters on the 6211 that may be used to perform pulse generation (either single pulse or continuous pulse train--you may output a finite pulse train by using of both counters).  You might want to take a look at the Counter Output Applications section of the 621x manual for more information.



From what it sounds like, the 6211 will do what you need for the following reasons:

1.  The AO lines of the 6211 are buffered and may be clocked out at up to 250 kHz per channel (unlike the 6009 which uses SW-timed AO).

2.  The counters of the 6211 may be used to generate two pulses based off of an 80 MHz timebase (12.5 ns pulse width and delay resolution).  The 6009 does not have counter outputs.
a)  If the two pulses must be on the same line, you should configure a "finite pulse generation" task (this uses both counters behind-the-scenes).
b)  If the two pulses are on separate lines, then you can use a seperate counter task for each line with a different initial delay.


The 6211 does not support clocked digital waveform generation (e.g. 100010101110100) but if you just need to generate pulses then this is precisely what the counters can be used for.  I think this is where the confusion lies, but it sounds like digital waveform generation should not be necessary for your application.  Triggering the counter outputs off of the AO Start Trigger and adjusting the "Initial Delay" parameter should give you what you are looking for.  Remember to start the counter tasks in software before the AO tasks (so they are armed and ready to go before the AO Start Trigger is sent).



I hope this helps, be sure to post back if you have any questions!



Best Regards,

John Passiak
Message 4 of 14

Hi John,

   Thank you! It seems like you also anticipated some of the questions that had come up since my last posting. 6211 it is then.



0 Kudos
Message 5 of 14

Hi John,


I am trying to do a similar if not the same thing with my USB-6251 card (and Labview 2009). Basically I need to generate sinusoidal (with analog output) and square (with digital or counter output) waves that would run in sync. I couldn't find any .vi example here or on Labview help that would do similar thing. What would be the easiest way to do that?





0 Kudos
Message 6 of 14

Hi Egid,


You could generate both sine and square waves on the AO lines if you wanted to since there are 2 AO channels on the 6251.  A good example to start with is:

Generate Multiple Channels of Analog Output with Different Frequencies



If you need both AO lines for two channels of sine wave generation but also want to add TTL pulse generation, you should build a digital waveform and synchronize a DO task with the AO sample clock.  The following example shows how you can synchronize the two tasks but you will need to build the digital waveform yourself:

Correlated Digital Output with Analog Output Sample Clock



You could go with the counters as well, but the 6251 has the capability for clocked Digital Output so this is probably how I would approach the application.




Best Regards,

John Passiak
0 Kudos
Message 7 of 14

Thanks John, I have tried doing that with DO (I cannot use AO) but I need a bit more form the device. Basically, at the moment I am generating two sine (or triangular) functions with two AO and I need to generate TTL pulses of the same periodicity and in sync with the two AO (which are in sync between themselves but of different period). Would the device be capable of doing that?





0 Kudos
Message 8 of 14

Hi Egid,


Try this example, if I understand correctly it should be what you need to do:



John Passiak
0 Kudos
Message 9 of 14



I am currently using a USB-6211. I am requied to output 2 counters/signals to oscillate a stepper motor. 1 signal to control "step" and 1 signal to control "direction" . For forward movement, I just need to send signal to "step" and for reverse movement, I need to send 2 sychronized signal to "step" and direction". I have tried to send 2 counters output but failed. I have also tried to send 2 digital output but some how the signals are not sychronized. 

Can i know how I can send 2 counters or similar methods to oscillate a stepper motor?



0 Kudos
Message 10 of 14