Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

One pulse train gating the other

Hi,
I am using NIDAQ 6220 which has 2 counters. My project requires me to generate 2 pulse trains, one gating the other within 1 micro seconds. I am using Linux and C. I tried to look for all help possible but everything seems to be in LabView (I do not have LabView). I have tried all sorts of things and all the help that I find online is it says to make one as a continuous and the other as finite sample. Can somebody help me with that... If someone could help me just generate exact same pulses in the two counters modifying the code below, I think that would be the best starting point.

Thank you
Kaushal


    DAQmxErrChk (DAQmxCreateTask("Counter_1",&taskHandle1));

    // Although I say 0 sec delay, there is a delay of 7.2 microseconds between the two counters
    DAQmxErrChk (DAQmxCreateCOPulseChanFreq(taskHandle1,"Dev1/ctr0","",DAQmx_Val_Hz,DAQmx_Val_Low, 0.00 , 50.00, 0.10));
    DAQmxErrChk (DAQmxCreateCOPulseChanFreq(taskHandle1,"Dev1/ctr1","",DAQmx_Val_Hz,DAQmx_Val_Low, 0.00 , 50.00, 0.10));

     DAQmxErrChk (DAQmxCfgImplicitTiming(taskHandle1,DAQmx_Val_ContSamps,10));
 
    // DAQmx Start Code
    DAQmxErrChk (DAQmxStartTask(taskHandle1));
   

0 Kudos
Message 1 of 3
(2,734 Views)

I only program LabVIEW so I don't know the specifics of "C" calls to the DAQmx driver.  However, here are some tidbits that may help:

1. You definitely should NOT set up either counter to generate a "finite pulsetrain."  Generating 1 finite pulsetrain output would require using up both of your counters.  (One is used "behind the scenes" to control how long the other one generates its output.)  You'd have no counters available for the 2nd pulsetrain.  You should either generate continuous pulsetrains or single pulses so you can create 2 independent outputs.

2. The code snippet looks like you are trying to put both counter output channels into a single task.  This capability is relatively new in the LabVIEW world, and I'm not sure how it would work or be coded in C.  I'm also not 100% sure how closely the start times are sync'ed if you put them in the same task.

3. I don't know what you mean by the phrase "one gating the other within 1 microsec".  Exactly what do *you* mean by this?  I find that people have different notions of what the term "gating" should mean...

4. Two basic ideas I'd offer for generating 2 pulsetrains at the same freq but one having phase delay relative to the other.

A.  Configure both to use a particular TTL signal as a Digital Start Trigger.  Configure both as continuous pulse trains.  Define both pulsetrains with the same freq & duty cycle, but with different "initial delay" parameters to produce the desired phase delay.

B. Configure one as a continuous pulsetrain.  Configure the other for Retriggerable Single Pulse generation and start it first.  Define both with same "high time", but use the "low time" and/or "initial delay" of the retriggerable single pulse to produce the desired phase delay.

Sorry I can't help more with the code syntax, but I *do* know that these techniques are viable with your DAQ board so at least you can know that your pursuit of syntax won't be a dead end.

-Kevin P.

 

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 2 of 3
(2,730 Views)
Thanks Kevin,

Just after I posted on the forum, I went around looking for the NIDAQmxBase examples. Although they don't work with my card, the C examples seem to be helpful. The example showed how to trigger the pulse train from an external trigger. I used that and modified the second counter to be triggered by the first counter. So adding the delay of 1microsecond was then obviously seen on the oscilloscope. Thanks though.

Kaushal
0 Kudos
Message 3 of 3
(2,727 Views)