Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to count digital inputs from sensor

Solved!
Go to solution

IImsmd

I am using a PCI 6221 NI-DAQ device and I want to count the total number of times a sensor is activated. The sensor is connected in on a digital line.

0 Kudos
Message 1 of 3
(3,325 Views)
Solution
Accepted by topic author Tadhg Adderley

Hi Tadhg,

 

If all you want to do is count the number of times the sensor is activate, the easiest way to so this is to use a counter line, in the case of the 6221 try pin 37, Cnt 0 Src/PFI8. And have a look at the example code Count Digital Events.vi which you can find from the Example Finder under Hardware Input and Output > DAQmx > Counter Measurements > Count Digital Events.

 

Alternatively, if you must use a digital line, simply read the line and if the sample is true increment a variable held in a shift register, similar to the attached DI Count.vi

 

I hope this helps,

Sheela Sujeeun

Applications Engineer
National Instruments UK
Message 2 of 3
(3,298 Views)

Hi SheelaS,

 

I have a similar problem as the posted, the problem is that I have a previous version of labview (8.5) so I cant open the file could you please upload a .png figure or so? Thanks!

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