LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pause and reset 6229 counter

Hi,
I'm using a counter (rising edge) on a 6229 board to count the number of times a device appears in front of a sensor. However, I'd like to be able to pause counting under circumstances, and then resume at the same count. I'd also like to be able to reset the counter to zero and begin counting again.
If I put the counter in a while loop and stop the while loop, the counter continues counting.
If I wire the stop button to the stop input of the DAQmx counter, the counter stops but does not resume counting until the vi is closed and restarted.
Suggestions?
Thanks
Dave
0 Kudos
Message 1 of 4
(2,843 Views)
dgg,

1. Under DAQmx, you can configure a "Pause Trigger" so that your counter only counts when an external signal is logic high (or alternately, only when logic low).

2. I'm not near my Data Acq PC now to check this out for sure. I don't think you can use a software call to reset the count value of a counter while its task is in a run state. I think you would have to set an initial value when it's not running.

3. There *is* a way to reset the count value using hardware which should work for your M-series board. It's kinda complicated though, especially if you haven't done much with counters before. If you give me a couple days, I can probably whip up an example. The basic outline is to configure for measuring position of a 2-pulse encoder in units of ticks rather than counting edges. Then you'd also enable z-indexing. Finally you'd run a wire from either a digital output bit or your other counter to act as this z-index signal. Oh yeah, you'd probably also need to wire a particular counter input to logic low.

I tend to lose threads in the general LabVIEW forum because of all the traffic. If you don't hear back from me, perhaps you could post in the Hardware-->Counter Timer forum?

-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 2 of 4
(2,842 Views)
dgg,

I started putting together an example, but am not sure I'll be successful. I don't seem to be able to configure a "Pause Trigger" when using a Counter Input->Encoder task. It would be allowed with regular edge counting, but *that* wouldn't provide a way to reset the count to 0 based on a hardware signal.

Do you need hardware-level timing for the pause and reset functions? If not, post back and I may have some suggestions for how to handle those functions in software. Meanwhile, I'll give a little more thought to another possible hw solution.

-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 3 of 4
(2,829 Views)
Kevin
I think I have figured this out. I'm not in the lab right now, but I'll send an example of the code in the next few days.
Thanks
Dave
0 Kudos
Message 4 of 4
(2,825 Views)