Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create a software (variable) based counter using a PCI-6503?

I would like to count the number of high inputs on a designated channel. I'm guessing that I need to make a structure that will increment a variable by one every time a high is detected? Am I on the right track?

The input highs are seperated approximately 250ms from each other and stay high for about 10ms each.
0 Kudos
Message 1 of 2
(2,824 Views)
Seth,

The absolute best solution would be to use one of our counter boards such as the NI 660x series. These boards directly support the application which you are building.

However, due to your slow timing needs, you may be able to successfully use the PCI-6503 to complete this task in software. Traditionally, software timed operations are not as accurate as hardware timed operations, and you should be aware that the timing resolution in LabVIEW, and your computer, is about 1ms. Other factors, such as your operating system resource and application management, can have serious affects on software timing.

With the above said, you could write a program which continuously polls the digital input lines. Keeping track of the last value and the prese
nt value you could determine when a rising or falling edge was detected. After this edge you could increment a variable and not increment the variable again for a period of either 250ms or 10ms. At this point you would begin looking for another edge and continue incrementing this variable. While not the best solution, it may work.

For the optimal solution you may want to check out our counter/timer devices. If you have a Multifunction DAQ board it will also most likely contain 2 general purpose counters.

Counter/Timers
http://sine.ni.com/apps/we/nioc.vp?cid=4529〈=US

Regards,
Justin Britten

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,824 Views)