Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

ND_COUNT - but for NI DAQmx?

Is there an equivalent way to do an ND_COUNT in NI DAQmx?

 

    pGPCTR_Watch(m_NIDeviceNumber,SyncToGpctrNum, ND_COUNT,&watchValue);

 

The above C++ code line works fine to return the current clock value for this counter in Traditional, but we can't find an equivalent to ND_COUNT in NI DAQmx. This if for an E-series board.

0 Kudos
Message 1 of 13
(6,195 Views)

I believe that you could use the DAQmxGetCICount to achieve generally the same thing.  You can find this command in the NI-DAQmx C Reference help under NI-DAQmx C Properties»List of Channel Properties»Counter Input»More»Count.  Let me know if that doesn't do it for you.  Have a good one!

 

0 Kudos
Message 2 of 13
(6,170 Views)

I am also looking for the DAQmx alternative for the following function in Traditional DAQ.

GPCTR_Watch(ctrBrd, fault, ND_WRITE_MARK, &countF);

 

Does anyone Know how to achieve this using new DAQmx?

 

Hiren

Hiren Patel
0 Kudos
Message 3 of 13
(5,802 Views)

Hi Hiren,

 

I believe the DaqStream.ReadRelativeTo Property is what you're looking for.

 

-Andrew

National Instruments
0 Kudos
Message 4 of 13
(5,776 Views)

Andrew

 

Where can I find that function on the CVI?

Hiren Patel
0 Kudos
Message 5 of 13
(5,760 Views)

Hiren,

 

If you open up your NI-DAQmx C Reference Help (Go to Start>>All Programs>>National Instruments>>NI-DAQ>>Text Base Code Support), you then can navigate (under Contents) to:

 

NI-DAQmx C Properties

List of Read Properties

Relative To (at the very top of the list).

 

Note that this function works in conjunction with the Offset property--in other words, you need to specify what offset you want so that you can get a relative value of where you're reading from.  See attachment for this help page.

 

Keep in mind the DAQmx driver does not always give you the same functionality as the Legacy DAQ drivers.  For instance, DAQmx will use these functions in a relative sense, but they won't give you the absolute memory location.

 

Maybe it would be useful to take a step back and re-think what you're trying to do.  DAQmx may allow you to do it automatically, without having to worry about the memory locations at all.  What are you trying to do with reading certain buffer memory locations?

 

Regards,

Andrew

National Instruments
0 Kudos
Message 6 of 13
(5,751 Views)

Hi Andrew,

 

I am measure the volume go through the unit. I simulate the volume flow by 2 AO channels and it generate enough pulses to simulate 25cuft of volume. On the other side I want to see the pulses come acroos and count them.

 

I am attaching the way it is being done by traditional counter boards now. We are moving on to NI-6341 that only supports DAQmx. So I am trying to convert the code to DAQmx.

 

Please help me understand how can I do this.

 

Thanks,

Hiren Patel
0 Kudos
Message 7 of 13
(5,731 Views)

Hi Hiren,

 

I don't see a reason why you need to use the particular functions we were talking about to generate AO pulses and count them.  You would simply need to program the various DAQmx Tasks (Analog Output Tasks or Counter Input Tasks) and set them up accordingly.

 

I'm not able to go through your code and revamp it for you, but I have some resources you can use for learning how to use DAQmx in text-based environments. Please see below:

 

This is the main page for learning more about DAQmx programming:

http://zone.ni.com/devzone/cda/tut/p/id/5434

 

Navigating through, there are two articles I think you'd find helpful.  One is learning to program with DAQmx in text-based environments:

http://zone.ni.com/devzone/cda/tut/p/id/5409

 

The other is learning how to use buffered counter tasks in LabVIEW:

http://zone.ni.com/devzone/cda/tut/p/id/5404

 

Combining what you learn from these tutorials should be helpful in migrating your code from the Legacy NI-DAQ driver to DAQmx.  Please let me know if I can help you further.

 

Regards,

Andrew

National Instruments
0 Kudos
Message 8 of 13
(5,708 Views)

Hi Hiren,

 

I realized I wasn't incredibly clear in my previous post.  Is there a particular reason you were reading data from certain locations in the buffer?  

 

As I said, I don't see a reason you should need to do that if you're just generating pulses from an AO and reading them through a Counter Input Task.  However, if you could clarify the reasoning, it would help to determine if you need the RelativeTo and Offset properties.  (These functions aren't used very often for DAQmx applications.)

 

Regards,

Andrew

0 Kudos
Message 9 of 13
(5,690 Views)

Hello Andrew,

 

I unit I am testing measures the volume flow passing through meter. I generate the AO pulses at 100K (10usec) to simulate the volume. The unit then take that and send the pulses out through the other connector, where I need to hook up the counter to measure the pulse width. So I need to use the buffered pulse width measurement. Then I take the last write mark to get the count in the buffer and use it to calculate the pulse width on the output side.

 

Please let me know if this will help understanding what I am trying to do. I appreciate your help.

 

Thanks you,

Hiren Patel
0 Kudos
Message 10 of 13
(5,680 Views)