LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How count with DAQmx counter as long as PFI Input HIGH?

Hello,

could anybody tell me: How is it possible to configure the DAQmx M or X Series device to count events (from stepper encoder) with counter input as long as one (other) PFI line is HIGH.

When the PFI line goes to LOW, the counting should be stopped (on the NI card hardware, independent of Windows) (and perhaps send me a notification or sth like that). Then I would like to get the count when the PFI line went to LOW.

 

Is this possible?

 

Thanks a lot.

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 1 of 3
(2,180 Views)

Hi,

 

maybe this link is helpful to you:

http://www.ni.com/white-paper/4329/en

 

Do you already have the hardware? If so, which one. 

 

Kind regards

0 Kudos
Message 2 of 3
(2,158 Views)

Yes, this is possible.

 

The most intuitive way is probably to configure a pause trigger on an edge count task.  Something like this example.

However, if the line only goes low momentarily and then goes back high, the counter will continue to increment (and you might have not yet had a chance to read back the count when the line went low).

 

To get around this, you might instead use the external line as a sample clock instead of a pause trigger, where the falling edge would latch in the count (and perhaps the rising edge would arm the counter).  Something like this example.  If you want to monitor the count before the external line goes low you should be able to do it by reading the CI.Count property.  You have to configure the task to acquire at least 2 samples, but you really would only be interested in reading back one.

If you want to acquire multiple samples in this manner this method wouldn't be appropriate since the counter wouldn't reset upon receiving a falling edge.

 

If you do want to acquire multiple samples (i.e., you have multiple iterations of the PFI line going high, and you are interested in measuring the number of counts that occur during each iteration) then you should look into using a buffered implicitly-timed semi-period measurement.  Something like this example (though you need to specify that you want to use the encoder signal on the PFI line as your "timebase").

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 3
(2,144 Views)