03-22-2013 09:24 AM
Hi, I have a PXI-5152 digitizer with two channels, one to read the voltage signal and the other to read the current signal from an electrical discharge machining (EDM) process.
I want to count the pulses generated in the process, at the moment, what the code did was first to acquire certain number of data points then pause to process the data in a while loop to count the pulses on rising or falling edge triggering. The reason to do that is also some other information of the data points are extracted in the while loop. But in this way, I can't count all the pulses geneated in the process due to the acquisition and pause cycle.
Is it possible that I can write a code to only continously count the pulses (rising or falling edge triggering) during the process? The process may last more than half an hour and number of pulses generated could be a few million?
Or do I need an additional card for the purpose?
Any help will be most appreciated!
Cook
Solved! Go to Solution.
03-23-2013 06:39 AM
You can of course use a counter or multi-IO card, configure it to edge or pulse counting and count up to 2^32-1 events (64 bit counter by cascading also possible).
But if you already have a vi to count the pulses with your analog channel, you can try a producer consumer architecture. (See templates and examples).
Mean you sample continuously and read the data in blocks (producer) and process them(consumer).
Things to optimize:
Samplerate (should be as low as possible)
Blocksize
your vi to count the pulses (post your vi if you need hints how and where to optimize)
However if you have other use for the digitizer and only want to count the pulses (maybe need some analog preprocessing)... counting with a few 100kHz should be no problem for any counter. (OK, maybe except the USB-600X...)
04-23-2013 08:38 AM
Hi Henrik,
Thanks for the reply, I didn't check the forum recently.
I attached two VI. The first one is what I have now, it's a simple program which first acquires data, then count the pulses in the small while loop. For one of my testing cases, the acquistion part is about 300 ms, and the counting part is about 200 ms, which means for each acquisition and counting cycle, I lost about 500 ms data in real time perspective.
I tried to implement producer consumer architecture from the example (https://decibel.ni.com/content/docs/DOC-3441) to my case, but could not manage it, the second one shows some trials I made. It will be great if you can give some suggestions.
Cook
04-24-2013 05:43 AM
here is a 10 min try 🙂
I started with an example and add the producer consumer .
04-24-2013 06:59 AM
Hi Henrik,
Could you change the VI version to 11.0 and attach it again?
Thanks!
Cook
04-25-2013 12:54 AM
here it is 🙂
05-06-2013 10:53 AM
Hi Henrik,
This is not exactly what I want, but it works fine for direct pulse counting purpose, and I can start with your program for my case. It will be very nice if you could help again when there is further questions.
Thanks again.
Cook