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?
Solved! Go to Solution.
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.
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?
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
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?
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!