LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use PCI-6534 High speed DIO to count the no.of pulses aquired

HI All
 
I have PCI-6534 high speed DIO card. My requirement is to count the no.of pulses coming. Here i have an energy meter which generates pulses with frequency of around 8MHz. i need to cunt the no. of pulses coming in, here i am attaching the VI i am using. I could not really count all pulses coming in. right now i am using single line, but the requirement is to develop for 7 lines. I do not know where i am going wrong. Can any of you help me in this regards.
 
 
Thanks
Anil Punnam
0 Kudos
Message 1 of 6
(3,131 Views)
Hello Anil:

Yes, I openned your vi.  Does your requirement of 7 line be independent among each other, meaning that the input signals are not related?

Anyway, could you please try the following if it works.
Change your timing to sample clock with rate higher than twice of your maximum pulse frequency.  Then change your DAQmx Read to Multiple Samples.  The output would then be an array of data.  Then you could use For-Loop to count the pulses acquired.

Please see attached image of block diagram.

Please advice if you have any comments.



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

Thanks debo for your response.

 

here some more to add to the question.

I need to acquire the data for some period of time(like 10 min, 20 min etc...). In this, i get pulses from different (7) sources, so i need to use single line only. But presently i am trying with one only, once i get success in one, i can make it for 7 sources. Here main thing, acquisition must be stopped after the stipulated time period. and count all pulses acquired.

Thanks in advance, hope to get a solution here.

 

Anil

 

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

Sorry, not near a LV PC so can't look at your vi now.  Are you limited to using only the 6534?  If all you need to know is the count of pulses from each of the 7 ~8MHz sources, it seems like the amount of data storage required with a 6534 is terribly inefficient.  Since the 7 sources are unlikely to be synchronized in any way and they are each at ~8MHz, you're looking at about 100+ million transitions per second with change detection.  I don't think the hw can keep up with that.  Even using a constant sampling rate of 20 MHz (which just barely satisfies the Nyquist minimum of 2x 8MHz), it's questionable whether you can keep up with that rate for several minutes.  Even supposing the hw and your PCI bus and software can keep up, there's still a TON of processing to do.  20 MB/sec for 20 minutes = 24 GB! 

On the other hand, consider the 6602 counter timer board.  Here you would simply set up 7 edge counting tasks, probably without any buffering at all.  At any leisurely pace you want, you can software query the counts of the # of pulses on each of the 7 channels and have an instant answer.  The only issue to deal with is that the counts will rollover when you reach 2**32.  At 8 MHz, this will happen about every 9 minutes.  However, DAQmx provides a nice way to handle this.  There's a property you can query that will tell you if a rollover has occurred.  It automatically resets itself to False after you read it so it's ready to detect the next rollover 9 minutes later.  See my first post in this thread for example.  (Last I knew, only DAQmx does the automatic reset, not traditional NI-DAQ).

If you can possibly buy a 6602, I'd highly recommend it.

-Kevin P.

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 6
(3,113 Views)

Hi Kevin

Thank you for your response. I am limited to use 6534 card only here, as we already have this card, we are supposed to use this card.

But one relief is acquisition time would be maximum of 1 minute. From one source only i will be getting pulses at 6MHz and from other 6 sources i will get pulses at the rate of maximum of 300KHz (it can be less also). so now the plan is to use hardware trigger to start and stop the acquisitin, To use change detection concept for this purpose. so that the required memory also will become less. we acquire the data when there is change in data, means when there is a pulse, then only we acquire the data. Ffirst we need to acquire and keep it in buffer, then we can read that data, and to put the data in an array. so that i can read this data easily without missing any pulse. i think i get some more help from this forum in this regards.

I am using DAQmx here. i need to know how to start and stop the acquisition using hardware trigger. can i generate a clock using software only to trigger start and stop. how to keep the data in buffer for the selected duration of period. Later i need to read this. Once i read the buffer, it should get cleared.

Please help me in this. i am strucked up here.

Anil

 

0 Kudos
Message 5 of 6
(3,100 Views)
Anil,
 
I must agree that using a counter/timer device such as the PCI-6602 would be a more elegant solution.
 
To answer your question about the start trigger, put a DAQmx Start Trigger VI between the Timing VI and the Start Task VI. Select Start>Digital Edge, and specify a trigger source and a trigger edge. Try using PFI2 as the source signal. Take a look at other DAQmx Trigger examples in the Example Finder for pointers (Help>>Find Examples).
 
To have a stop trigger, it might be easiest to just include the line you want to signify to stop in your change detection lines, and programmatically check it each time you read in the values, and stop the loop when the line toggles.
--
Michael P
National Instruments
0 Kudos
Message 6 of 6
(3,091 Views)