Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital pulse train using D/O (without counters)

LV 7.1, DAQmx 8.5, USB-6221
 
Hi all,
 
We are looking to generate a pulse train (with a given number of samples and a fixed rate) using a Digital Output line using the above hardware and software. We have 2 counters on the 6221, but unfortunately we need them to do pulse counting for this application.
 
We've looked at the LV examples, e.g. Write Dig Chan-Int Clk-Dig Start but keep getting errors with using the Analog Output sample clock as the clock source. The task seems to timeout before anything happens, giving us this error message (200560):
 
"Measurements: Wait Until Done did not indicate that the task was done within the specified timeout.
Increase the timeout, check the program, and make sure connections for external timing and triggering are in place."
 
Has anyone had any experience with such an application? Any help will be much appreciated!
 
Thanks,
Charlie P.
0 Kudos
Message 1 of 4
(3,256 Views)

Hi Charlie,

First, the Write Dig Chan-Int Clk-Dig Start.vi isn't supported by the 6221.  It is only supported by the 6533, 6534, 6536, and 6537 because it uses a digital start trigger.  I would recommend using the write digital channel.vi (Help » Find Examples » Hardware Input and Output » DAQmx » Digital Generation).  In addition, the only way to generate a pulse train with a digital out is to use software timing to change the output from high to low.  This is going to be much less precise than hardware timed pulse train, because it is dependent on your computer, operating system, other programs running, etc.  In addition, the speed of your pulse train will also be constrained by how fast your loop can run in LabVIEW.  If you want to implement a software timed pulse train, I would recommend using a while or for loop (for loop for a finite number of pulses) and use the iteration count to cycle between a case structure that turns the digital output high and low.  For example, on even iterations (0,2,4,6,8,etc.) of the loop you cycle to case 0 which writes the digital output high and on odd iterations (1,3,5,7,9,etc) you cycle to case 1 which writes the digital output low.

I hope this helps,
Paul C.

0 Kudos
Message 2 of 4
(3,246 Views)
You could set up an analog output to put out your pulse train (i.e. 100 pulses, create array of 200 elements alternate 0 and 5 Volts) and then output them at your desired sampling rate (output at 1 kHz, then output your array at 2 kHz).  Then use the PFI channel for the Digital Start.


Randall Pursley
0 Kudos
Message 3 of 4
(3,234 Views)
Hi again Charlie,

My apologies, I didn't realize that the 6221 had 8 clocked digital I/O lines.  This means that you can use the Write Digital Chan-Ext Clk.vi (Help » Find Examples » Hardware Input and Output » DAQmx » Digital Generation) and select the external clock as one of the other clocks located on the 6221 such as the analog input clock.  This will output the digital waveform at whatever rate of the clock you specify.  I would recommend taking a look at that example and setting the external clock to be your analog input clock. 

Hope this helps,
Paul C.
0 Kudos
Message 4 of 4
(3,226 Views)