LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Count with Voltage Output

My goal is to continuously run a program that reads a counter and increments a voltage output with a save function.  The counter has to read once after a given time interval (user selected ) then reset back to zero (and repeat).  So far, I have been successful, but the counter is acting strangely.  When I test the counter with a reliable source (a million counts per second), the counter oscillates with time and spontaneously jumps to a higher or lower reading.  I suspect this results from the program being software timed.  So, is there a way I could do this through hardware timing or can I somehow improve my code?  I tried a few shipping examples, but that did not help.  I use PC-TIO-10 for the counter, PCI-MIO-16e-1 for the voltage output, regular LabView7.0 (not real time), NI-DAQ6.93.f3, and Windows2000.  Any help will be appreciated. Thanks.
0 Kudos
Message 1 of 9
(3,600 Views)

Hello Topher,

Let me see if I understand you correctly. Do you want to output a signal when the counter reaches a certain number? You can put your signal into counter 0 source. Then output a pulse on counter 1 that uses the number of timebase ticks to create the digital pulse. For example, it would count 5 rising edges or ticks on counter 0 source and then create a rising edge on counter 1. This would repeat continuously. You could then use counter 1 internal output as the sample clock for your analog output.

This is really easy to do in DAQmx. With this setup, since you are only using 2 counters, you could just use the PCI-MIO-16E-1. Please let me know if you have any questions. Have a great day!

Sincerely,

Marni S.

Message 2 of 9
(3,547 Views)

Let me clear this up.

 

I would like a LabView program that reads three separate counters after a user selected time interval. For example, I would select “1-second” and the program would give me the number of counts (from three photon counters) that has accumulated over the 1-second. These counters should reset back to zero at the end of each time interval.  Also, this process has to repeat until I stop the program.  (I think this may be related to a buffered period measurement.)

The voltage output is an independent operation that has to be synchronized with the counters.  In other words: I would start the counters, wait some time interval, read the counters, increment a predefined voltage, wait the same time interval, read the counts, increment the same voltage, wait, et cetera.  Also, I want to save this sequence of events at the end.

 

Start--> Wait --> Read --> Increment --> Wait --> Read --> Increment --> Wait-->…--> Stop

 

I have already successfully done this through software timing, but the counters have problems reading a steady test signal.  So, I am now trying to do the same task with hardware timing.  Any advice with any part of this program would help.  Thanks again!
0 Kudos
Message 3 of 9
(3,538 Views)

Hello Topher,

I understand what you are saying now. You can't do all of that in hardware, but you can use a combination of hardware and software to do what you want.

If you want to read a counter after a specified amount of time and restart it every time, you can do it with buffered event counting. Output a pulse on a second counter that is the same width as time between reading in the first counter. Input the second counter into the source of the first counter. It will read every time the second counter's pulse goes high. Since you can't actually restart the count register you will have to subtract the count from the previous count.

If you want to add the analog output in there, you can do triggered analog output. Based on what the user specifies as the selected time interval, you can create the trigger off of that.

If you can upgrade your counter/timer board, this is much easier to do in DAQmx. Please let me know if you have any questions. Have a great day!

Sincerely,

Marni S.

Message 4 of 9
(3,495 Views)
 
The buffered event counting works really well when I use the PCI-MIO-16e-1 board, but I need three counters.  I planned on using the PC-TIO-10, but this leads to a problem.  Apparently, the PC-TIO-10 does not support buffered counting (look at the bottom of :“http://zone.ni.com/devzone/conceptd.nsf/webmain/4baec2bee4c02fad86256802007b8b5c”) So, I do not know where to go from here.  Thank you very much for your help, I really appreciate it.
0 Kudos
Message 5 of 9
(3,490 Views)
Hello Topher,
 
I can't think of any way to start and stop the counter that does not use buffered counting. I strongly recommend upgrading your PC-TIO-10 to a Counter/Timer board or, if money is an issue, get a low-cost M Series board (2 counters from PCI-MIO-16e-1 and 2 from M Series). Please let me know if you have any questions. Have a great day!
 
Sincerely,
Marni S.
Message 6 of 9
(3,394 Views)

Topher,

I would suggest you use "buffered period counting" rather than buffered event counting, because in buffered period mode, the counter value resets to zero on each sample clock edge.

As to the need for 3 counters, I would highly recommend the PCI-6602.  It can perform 3 buffered operations using high-speed DMA for data transfer (the cheaper 6601 only supports 1 channel of DMA).  Also, since your MIO card is a PCI type, you hopefully have a PCI slot available.  You may not have realized this, but the PC-TIO-10 must use an old ISA slot which you may not even have.

A final suggestions with the 6602: In addition to the 3 buffered period counters, you could program a 4th counter to generate the sample clock.  This would allow you to change the sampling rate on-the-fly if needed.  The 6602 also allows you to start the 3 counters off a common trigger so that all the time measurements are sync'ed to the same 0 point.

Good luck with the app!

-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.
Message 7 of 9
(3,388 Views)

Since I need to make measurements every half a second (minimum), would LabView real-time fix the problem with my counts? I find it very strange that my program can precisely read a steady test signal at one million counts then decide to decrease two thousand counts once every 3-4 minutes (After that, it returns to the correct reading).  I’m confident that my app is programmed correctly, so maybe there is a problem with my test signal... Thank you very much for your responses.

 

0 Kudos
Message 8 of 9
(3,370 Views)
Hello Topher,
 
The counter/timer boards PCI-6608 and PCI-6602 have a timebase of 80 MHz, so they can count hw-timed measurements as small as 12.5 ns. You won't need LabVIEW Real-Time for this application. Please let me know if you have any questions. Have a great day!
 
Sincerely,
Marni S.
0 Kudos
Message 9 of 9
(3,298 Views)