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: 

Generating arbitrary pulses with PXI-6602

Hi everyone!

 

I have a problem generating pulses with the PXI-6602. What I need is a sequence of pulses that appear for example at t0=0, t1=1ms, t2=5ms, t3=100ms and loop after 1000ms.

 

As far as I understood the NI-DAQmx-functions and -examples, I should be able to achieve this with the "DAQmxWriteCtrTime(...)" / "DAQmxWriteCtrFreq(...)" / "DAQmxWriteCtrTicks(...)" functions, as used in the example "DigPulseTrain-Cont-Buff-Implicit".

 

The problem is: When I try to run this example as it is on my PXIe-1075 chassis with the PXIe-8135 controller and the PXI-6602 in Slot 2, I get an error saying that I have to start the task before calling the write-function (see screenshot).

DAQmxError.PNG

 

So I copied the line with the "DAQmxWriteCtrFreq(...)"-function below the "DAQmxErrChk (DAQmxStartTask(taskHandle));"-line. Now the program is running, but on the oscilloscope I see that it just repeats the same puls over and over and does not change the ratio as it should do. Looking at the output of the write-function I can see that only one sample was written to the buffer, instead of 1000 samples which I expected.

 

When I tried to google the problem, I found these two threads, which seem at least related to my issue.

https://forums.ni.com/t5/Counter-Timer/buffered-counter-output-in-C/td-p/2791758

http://forums.ni.com/t5/Multifunction-DAQ/Auto-Start-DAQmx-task-functionality/td-p/456366

In the first discussion it is mentioned to use the write-function before starting the task, in the second it says to simply start the task before writing to the buffer.

 

I am using Labwindows/CVI 2009 on Win7 64bit. Maybe someone has an idea, what I did wrong or how to fix the problem.

 

Thank you very much in advance!

Best regards,

Christof

0 Kudos
Message 1 of 5
(4,889 Views)

Hi Chrishell,

 

as far as I know, you cannot generate a arbitrary pattern with PXI-6602. You can output a pulse (define T_L and T_H) but you cannot outout a pattern. Therefore you need a arbitray waveform generator for eample.

 

Best Regards, Fabian

0 Kudos
Message 2 of 5
(4,827 Views)

Thank you for your answer, Fabian.

 

Anyway, I don't quite agree with you. The NI DAQmx Driver obviously offers c-functions to achieve the behaviour I need. The above mentioned example should show this, although it generates a PWM signal instead of the pulses that I need (only TTL-level if the "arbirtrary" was misleading, but with varying low-times) - but modifying this functionality should not be a problem I guess. And there are NI timer/counter devices that use the DAQmx driver, for example the PXI-6602.

 

Nevertheless I dug a bit deeper after your reply and found this in the DAQmx help: http://zone.ni.com/reference/en-XX/help/370466V-01/mxdevconsid/smpclkcountertime/

This refers to the buffered, sample-clock-timed pulse generation, but I guess, that it is valid for buffered pulse generation with implicit timing, too. And furthermore I assume that the PXI-6602 is a device of the TIO series, which does not support this feature, whereas e.g. the PXIe-6612 (a device of the X-Series) does. Can someone please confirm (or correct) this?

 

Thank you!
Christof

0 Kudos
Message 3 of 5
(4,821 Views)

Yes, You are right,

 

If you just want to outout a TTL Signal, you can use a X Series card, of course. These Card have the STC3 timing chip which supports more functionality than th one of the 6602. The example you found was made for X Series device and cDAQ chassis (which have the STC3 chip, too), I think.

 

If you are interested in the functionalities, the 6602 card support, you can find them in the DAQmx C Reference Help.

The device supports the following functions:

http://zone.ni.com/reference/en-XX/help/370471W-01/cdaqmxsupp/pci-6602/

 

They support:

NI PCI-6602 Supported Properties (click on link above and if you click on the links inside this link, you find the DAQmx name of the functions)

Counter Output >> Pulse >> Output Terminal
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr18D6.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Time &gt;&gt; Units</a><br>"); // </script> Counter Output >> Pulse >> Time >> Units
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr18BA.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Time &gt;&gt; High Time</a><br>"); // </script> Counter Output >> Pulse >> Time >> High Time
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr18BB.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Time &gt;&gt; Low Time</a><br>"); // </script> Counter Output >> Pulse >> Time >> Low Time
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr18BC.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Time &gt;&gt; Initial Delay</a><br>"); // </script> Counter Output >> Pulse >> Time >> Initial Delay
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr1176.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Frequency &gt;&gt; Duty Cycle</a><br>"); // </script> Counter Output >> Pulse >> Frequency >> Duty Cycle
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr18D5.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Frequency &gt;&gt; Units</a><br>"); // </script> Counter Output >> Pulse >> Frequency >> Units
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr1178.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Frequency &gt;&gt; Frequency</a><br>"); // </script> Counter Output >> Pulse >> Frequency >> Frequency
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr0299.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Frequency &gt;&gt; Initial Delay</a><br>"); // </script> Counter Output >> Pulse >> Frequency >> Initial Delay
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr1169.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Ticks &gt;&gt; High Ticks</a><br>"); // </script> Counter Output >> Pulse >> Ticks >> High Ticks
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr1171.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Ticks &gt;&gt; Low Ticks</a><br>"); // </script> Counter Output >> Pulse >> Ticks >> Low Ticks
<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr0298.html\">Counter Output &gt;&gt; Pulse &gt;&gt; Ticks &gt;&gt; Initial Delay</a><br>"); // </script> Counter Output >> Pulse >> Ticks >> Initial Delay

 

A simple pulse out is also possible with this card, if you need assistance in this, please let me know how your signal shall look like.

 

Best Regards, Fabian


<script type="text/javascript">// document.write("<a href=\"mxcprop.chm::/attr0339.html\">Counter Output &gt;&gt; General Properties &gt;&gt; Counter Timebase &gt;&gt; Source</a><br>"); // </script>

0 Kudos
Message 4 of 5
(4,815 Views)

Thanks again for your reply!

 

Okay, I didn't realize that the example does not go with the PXI-6602.

 

Unfortunately, the list of properties didn't help me very much, as there is support for Counter Output >> Pulse properties and I don't see the big difference compared to the properties of the PXIe-6612. Except that there are more buffer properties for the latter.

 

Maybe I can exchange the Timer I have at the moment with the PXIe-6612 and hopefully just use the write-functions to output the pulses I need, which in my opinion would be the cleanest way to do it. On the other hand, if I stick with the PXI-6602, I assume that the workaround would be to either ouput single pulses with their high and low time and load the high and low time of the following pulse as soon as the task started and so on or to use multiple counters, which trigger each other. I don't really like the first idea because I'm a bit concerned that depending on the processor load there can be glitches on the output signal and I don't like the second idea because it would be a waste of counters.

 

Initially I need the pulse train to edge trigger other devices. The high time of each pulse should be at least 25ns and they should appear at 0ms, 1ms, 4ms, 100ms, 105ms, 750ms, 850ms after an external trigger signal. Later I need some state triggers for other stuff, too. If you know an easy way to do this with the PXI-6602, please let me know, otherwise I will try to get my hands on the other Timer/Counter Card.

 

Best regards,

Christof

0 Kudos
Message 5 of 5
(4,796 Views)