Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

how to pause a counter task

Hi,
 
I'm using a quadrature encoder on a counting wheel to measure the product length when a machine is running.
When the machine is stopped the counter should not count even when pulses comes out of the encoder because someone turns manually on the counting wheel.
I can't use the "DAQmx Stop" vi to stop the task since it will start counting from 0 when the machine starts again, I need to continu counting.
Only when the spool is taken off the machine I can use "DAQmx Stop" vi and start from 0 again.
 
I use a PCI 6601
Encoder signal A on PFI39, signal B on PFI37
 
I made a "Linear Postion task" with DAQmx
Timing "one sample on demand", done with LV software "DAQmx Read" vi at regular time interval no problem.
 
The DAQmx Trigger property "Pause.TrigType" and others don't work with the "Linear Position Task" while it work well with a "Count edges" task, why is that? Smiley Mad
 
Which other property should I use to pause a "Linear Postion task" ?
 
Thanks for any help...
0 Kudos
Message 1 of 7
(4,953 Views)
Hmm, I didn't know that encoder position tasks didn't allow Pause Triggering.  Are you able to make use of the Initial Count property?  Your program would need to know when the machine is stopped and when it's about to start again.  You're allowed to write values to it when your task is stopped and your measurement will start counting from that value when you Start again.
 
I'm not 100% sure about my memory, but I toyed around a bit with the encoder scaling settings back around DAQmx 7.1 or so.  I seem to recall that the behavior was unexpected when I assigned an Initial Count but also had some type of floating-point scaling.  I *think* what happened was that the Initial Count I assigned was NOT treated as an Initial Encoder Position.  Instead, the Count got scaled too.  The problem was that it became impossible to pre-assign a specific unit-based position because there was no possible integer count value that would scale exactly to that position.  The 1x, 2x, 4x designations also interacted with this stuff.
 
Anyhow, that's from memory when I was new to DAQmx, and DAQmx itself was also fairly new.  The lesson I took away was that I now *always* use Units==Ticks, do all my encoder thinking in terms of raw counts, and then do my own scaling exactly where and when I needed to.   Perhaps that approach isn't strictly necessary, but I figured I'd mention it in case you run into similar issues with Initial Counts and scaling.
 
-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 7
(4,950 Views)
It's a pity that the Tirigger.Pause functionality isn't implemented in a "high end" up-down counter "Linear Position" task with a quadrature encoder while it is in the "low end" always up (or down) counter "CountEdges" task. Smiley Mad
 
I indeed can access the "CI.LinEncoder.InitialPos" property of the "Linear Position" task but have to implement a lot of software (edge detection on machine run relay, store counter values, ...) while all is pure hardware with "CountEdges" task (no software equal no bugs Smiley Surprised ).
 
I can't believe it's not implemented for the "Linear Position" task, I just don't know the right property to access it.
How knows it ??

Message Edited by Alain S on 05-05-2006 08:46 AM

0 Kudos
Message 3 of 7
(4,949 Views)

Hello Alain,

I think that the preferrable task for you to use is the 'Count edges' task with the option for count direction set to 'externally controlled'. In this case you can link the A-wire of your quadrature encoder to the source of the counter and the B-wire to the AUX-input of the counter.

There is also no problem with using the pause function that you already implemented. Since you will not need to 'stop' the task in this case your count will remain at the number it was. It will also count up and down according to the direction the encoder is turning.

Regards,

Wouter Van Hoof
AE, National Instruments Belgium

 

0 Kudos
Message 4 of 7
(4,916 Views)

Before you switch to an edge-counting task with hw-controlled count direction, I'd highly recommend reading through App Note 084.  It may still turn out to be your best option overall, though I'd suggest that you use a quadrature decoder chip like the one described in the app note. 

-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 5 of 7
(4,910 Views)

Hi Kevin,

That app note is dated May 1996, not quite recent and intend for use with NI E-Series MIO DAQ boards.

I use a NI PCI-6601 TIO device. Any idea if the problem described in app note 084 is still standing for this board?

Regards

Alain

0 Kudos
Message 6 of 7
(4,905 Views)

It's an oldie but goodie.  The 660x counter/timer boards (and the M-series counters) have been specifically designed to support an additional measurement mode that performs quadrature decoding internally.  So for most people in most situations, there'd be no compelling reason to measure a quadrature encoder signal using edge counting with hw-controlled direction on a 660x board.  On an E-series board though, that was the closest approximation available, hence the app note.

However.  Your app seems to be an exception.  If you're unable to implement pause-triggering with a true quadrature encoder task, then edge-counting with hw-controlled direction becomes an option to consider.  The behavior of the 660x's counters would be like the E-series counters when using that mode, in which case the problems described in AN084 would indeed still apply to the 660x counters.

-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 7 of 7
(4,902 Views)