Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

1kHz logic AND gate with PCI-6221 and BNC-2110

Solved!
Go to solution

Dear all,

I need to to perform an AND operation between two signals:

-a square wave at 1 kHz;

-a gating pulse lasting 10s of ms,

so that the 1 khz train is only "transmitted" while the gate signal is high. I do have a PCI-6221 connected to a BNC-2110. My guess was to use 2 of the inputs of the 2110 to acquire and digitise the 1khz sq wave and the gate pulses, calculate AND in labview and convert it back to analog, assigning it to one of the AO of the 2110 box...

Is this feasible? Will it be super jittery i.e. it is best to get a dedicated hardware fast logic gate? 

0 Kudos
Message 1 of 6
(198 Views)

You can do this by configuring your 1 kHz output task to use the gating pulse as its "Pause Trigger", set to pause when low (thus allowed to output when high).  You can try it by using the shipping example for continuous counter output, no mods needed.

 

 

-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?
Message 2 of 6
(194 Views)

thanks a lot, this seems very helpful. But I do not understand how to configure the counter-continuous output.vi

I have to set a "counter", an "output terminal", a "frequency" a "duty cycle" and a "digital pause". "No trigger" and "digital start" can be ignored? Output terminal will be were i pick my AND signal from, digital pause takes the gate pulse and is set to low in the .vi, but where does the1khz signal go? Does it have to be connected to the counter? Do I have to set "frequency" and "duty cycle" manually?

 

 

0 Kudos
Message 3 of 6
(180 Views)
Solution
Accepted by topic author g_bress

From the top:

 

1. Select a counter to use for generating your gated pulse train, such as "Dev1/ctr0".

2. Specify a terminal to direct your output pulses, such as "/Dev1/PFI12".  You may want to wire it to a scope or something so you can observe the output.

3. Specify the frequency and duty cycle of the pulse train you want to generate, such as 1000 and 0.5

4. In the Trigger Settings area, select the "Digital Pause" tab.

5. Specify the "Pause Trigger Source", i.e., the terminal where you'll wire your external gating signal, such as "/Dev1/PFI0".

Make sure your gating signal is physically wired to the terminal you configured.

6. Specify the polarity, such as Pause When Low (so it will generate pulses only when high)

7. Run the program.  Turn your gating signal on and off to see the AND-like behavior

 

 

-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?
0 Kudos
Message 4 of 6
(167 Views)

thanks a lot! The counter vi was confusing me in terms of names of the inputs on the bnc2110 connector so I configured a similar thing but with the continuous voltage output with the start trigger provided by the rising edge of my "real" 1khz train, set it to produce a sq wave at 1khz, gated with the 10s of ms long pulse "pause when low" and it does what I need. I checked it on a scope. What are the differences between what I made and the counter .vi you described above?

Also, as this is a continuous output generator I am not understanding what "number of samples"  mean... how does this value have to be set?

0 Kudos
Message 5 of 6
(141 Views)

The DAQmx API makes continuous voltage output predominantly similar to continuous counter output, as you should be able to see when you compare the code for the two.

 

Similarly, you can look in the code to see how the 'number of samples' value gets used in the continuous AO example.  It simply determines how many values get written to the task buffer.  Once the task is started, it will continuously generate those samples by treating the buffer as though it's circular.  In other words, when it gets to the last sample in the array, it wraps around and starts over again from the beginning.  And keeps doing it continuously.

    So you can define a finite # of distinct values but then keep *regenerating* them indefinitely.   It's a pretty great feature!

 

 

-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?
0 Kudos
Message 6 of 6
(133 Views)