Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Externally gating a counter in DAQmx BASE! ?

Dear DQA support

I hope somebody can help me with externally gating a counter on a NI-PCIe-6251 DAQ-board with DAQmx Base. I just can't find out a way to do it. I want to count events in the vicinity of 40kHz during a certain period when a gate signal is high. This was fairly easy in the good old NI-DAQ but no longer obvious to me with the DAQmx Base driver.

There is an example in LV8.20 daqmxbase called ''Count Digital Events-Buffered-Continuous-Ext Clk.vi'' which comes close to what I want to do. An external timebase acts kind of like a gate but only in between two consecutive rasing or falling edges of a digital signal and not on a level which is actually what I want the counter to do.

Again I want the counter to count only as long as the gate signal is high. This is a very basic task to me and I am surprised that it does not seem to be possible right out of the box.

Thank you for the help

Urs

Urs Lauterburg
Physics demonstrator
Physikalisches Institut
University of Bern
Switzerland


0 Kudos
Message 1 of 6
(3,641 Views)
OK, nobody has responded to my quest so after consulting the domestic support of NI-Switzerland I add a reply myself. The application engineer in charge told me, that normal level gating of an event counting task which is inputted to the source of a counter on a NI-PCIe-6251 the way I need to do it, is not possible in DAQmx Base. I must admit that I am pretty surprised that such kind of a regular function is not possible. I used to do this a lot with traditional NI-DAQ from the Classic Mac environment as well as from PXI Real-Time Controllers that contain NI-DAQ.

If anybody has been able to perform level gated event counting with the regular DAQmx from LabVIEW on Windows I would be glad to know. So far no user has actually reported positively about this. However, of course I think it must be possible.

NI developers please build this feature into the next DAQmx Base release too!

Happy wireworking yours

Urs

Urs Lauterburg
Physics demonstrator
Physikalisches Institut
University of Bern
Switzerland


0 Kudos
Message 2 of 6
(3,604 Views)

Hi Urs,

DAQmx can most definitely gate the counting of an external clock - it's referred to as a "Pause Trigger" and there is a an example available (Count Dig Events - Pause Trig.vi), though I realize this doesn't help in OSX.  Also, with DAQmx Base you can perform a Pulse Width Measurement which uses a similar method to what you describe with an internal timebase, so if you were looking to use that method for that purpose you can just create a CI Pulse Width channel and measure the length of a pulse. However, there wouldn't be a way to count your 40kHz external signal. As for your feedback on DAQmx Base,  I would encourage you to put in a product suggestion. This is a way for customers to let R&D know what features our customers are requesting.

Cheers,

Andrew S

National Instruments 

0 Kudos
Message 3 of 6
(3,601 Views)
Andrew,

Thanks a lot for the prompt feedback. I will request this feature through the product suggestion page.

Regards

Urs

Urs Lauterburg
Physics demonstrator
Physikalisches Institut
University of Bern
Switzerland


0 Kudos
Message 4 of 6
(3,598 Views)
Andrew,

It's me again. As a result of my relative struggle to implement an acceptable DAQ-solution with my NI-PCIe-6251 boards I describe a bit more in detail what I need to do. I have to take frequency measurements of a signal around 40kHz during several intervals which are signaled by TTL-pulses of various durations however the later staying constant for a given set of measurements. The idea was to measure the time of the pulse interval first, then count how many times a positive slope occurred by using the TTL to gate a counter application. I want to take a limited number of frequency measurements over a given duration of time.

Now I learned that a level gated event counting task in DAQmx would look like the attached BD. I definitely think such kind of simple basic task should be possible with DAQmx base as well. What is missing in DAQmx Base are the DAQ-Property nodes for configuring and controlling DAQ tasks which differ a bit from the very common things.

However if yourself or anybody else who reads this message sees a possible solution in DAQmx Base 2.1 I would be really glad to learn about it.

Thank you for the helping wires

Urs

Urs Lauterburg
Physics demonstrator
Physikalisches Institut
University of Bern


0 Kudos
Message 5 of 6
(3,585 Views)
Because I was able to find a solution i the meantime I'm going to post it myself here as well. It may help others to achieve it quicker than myself:

After a few iterations with various instances of NI tech support (who really all wanted to help me on this) I was given the solution by NI support. She solution was presented to me as a modification of the global variable ''MSeries.Globals.vi'' by appropriate parameters to the ''MSeries.Globals.ReadCTR.vi''. Yes, DAQmx Base uses many globals to link the programmed DAQ-tasks with the various available options of hardware solutions. Because my NI-PCIe-6251 is a M-Series device it's only logical I need to act on the ''MSeries.Globals.vi'' global.

Thus after creating a new channel with ''DAQmxBase Create Channel.vi'' set to ''(CI-Count Edges)'' one has to insert a VI that reads the ''Data''-cluster from ''''MSeries.Globals.ReadCTR.vi'' to change the cluster elements accordingly as follows:

Counter Trigger Mode :
Gate Parameters.Gate Select : (or whatever input you want to be the gate)
Gate Parameters.Gate Polarity : (or whatever edge you want the counter to start counting events)

The modified data cluster is then fed into the ''Data''-input of ''MSeries.Globals.WriteCTR.vi'' et voilà.... you can start and perform a continuos event counting as shown in the LV example example ''Applications:National Instruments:LabVIEW 8.2:examples:daqmxbase:dynamic:ctr:Count Digital Events.vi''. The counter input now only counts events as long as the gate signal stays high which is exactly what I needed to do.

After all it looks as if DAQmx Base does indeed offer almost all the possibilities of the full featured DAQmx but with the great benefit that the driver is almost entirely written in ''G''. However, some more special measurement parameters have to be programmed by drilling down a bit underneath the hood and this of course implies a certain knowledge about the structure of the driver and its topology. Since the later is a complex one, with hundreds of VIs that are called as needed and according to the used hardware it does take some time to gain the necessary understanding. I'm slowly beginning to see some lights underneath the hood but am confident that I will gain more insight with the growing experience. The benefit of NI-DAQmx Base is that it can sometimes be relatively simple to add functionality to the driver since it's written in LabVIEW and this is a great plus. I would like to thank NI tech support at this point for providing me the necessary know-how to solve my particular measurement problem with DAQmx Base on MacOS 10.4.9

I hope my elaborations will help others to implement similar counter/timer activities.

Happy platform independent wireworks

Urs

Urs Lauterburg
Physics demonstrator
Physikalisches Institut
University of Bern
Switzerland


0 Kudos
Message 6 of 6
(3,543 Views)