From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Train pulse generation - USB 6211 - in MATLAB

Hi everyone, 

I am trying to setup the USB 6211 DAQ to trigger a pulse train used to activate camera video acquisition (the freq might be 30-40 Hz).

I am using the following code 

ch1 = addCounterOutputChannel(s,'Dev1', 0, 'PulseGeneration');
ch1.Frequency = 10;

through an LED connected to the DAQ I am able to see the pulse signal. However, when I tried to record it (relaying the digital output  to an analog input pin on the DAQ itself), I cannot see anything but noise (it could be the noise amplitude is larger than the one of the signal?).

The purpose of recording the generated train would be to compare it's offset with a similar signal generated by the camera (the camera generates an output signal for every acquired frame).

Is there another way to do visualize/calculate/detect the pulses without recording the output through the DAQ input lines ? (this may sound a bit primitive indeed). I know that a "clock counter" (a channel detecting the rises/edges of a pulsed signal and calculating the pulse freq) could be added when having 2 or more devices but in this case the same device cannot be used as both a source and target of the "counter-clock" .

 

Sorry if the question is too naive, I am not so familiar with this. Thanks for any advice !

 

0 Kudos
Message 1 of 2
(2,259 Views)

I can't help at all with any Matlab syntax, but I know DAQmx and your family of devices (M-series multifunction) pretty well.

 

- you should be able to observe the pulse train when you wire it to an analog input.  I'd recommend you use MAX test panels to look at the analog input.  You can easily change the terminal configuration there, which is a possible reason why your earlier attempt didn't seem to work.

    Another thing you might try is to physically wire the DGND pin to either AIGND, AISENSE, or the + side of the appropriate AI channel if in differential mode.   See this article for more details.

 

- M-series boards have 2 counters.  A *finite* pulse train (with a predetermined fixed # of pulses) uses both of them.  But a *continuous* pulse train uses only 1.  So the other one could be used to detect / count / measure it.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 2
(2,232 Views)