ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating a digital counter in labview

Currently using a proximity switch connected to an SCC-DIO1 to read pulses from an encoder to develop an RPM measurement ( and angular velocity).  How do I convert my digital pulse into a true numeric count per minute (or millisecond)?  I'm able to detect the pulse from the module in labVIEW but I'm unclear on how to count the pulses per minute.      Currently using labVIEW 7.1.
 
 
0 Kudos
Message 1 of 5
(12,542 Views)
If all you're doing is counting pulses, you'd actually be better off using the counters on your DAQ card. They automatically track the number of pulses and can give other info like frequency. Look in the Examples for Counter VIs to show you how to use them. There's a pretty good one named "Getting Started Counter.vi".

If you're set on just using a digital line, the attached image shows how to setup a basic 32 bit counter. (but I still suggest you have a look at using the Counters)

Ed


Message Edited by Ed Dickens on 07-14-2005 03:38 PM



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 5
(12,506 Views)
What you need to do is measure the time between some pulses.

If the shaft has one pulse per rev. then the rotational speed (RPM) = (1 \ time from first pulse to second pulse) * 60

i.e.
800 RPM = a period of 0.075 seconds.
1000RPM = a period of 0.06 seconds.

                                                                                            0.06s = 1 Rotation
__________|=========|_________________________________________________|=========|_________
assuming leading edge being used to start and stop counting

Although from what you say, I think things are a bit more interesting.
The best way is to input the pulses to a timer counter hardware so that the hardware will do the timing work for you. Lots of NI boards support a timer couter that can be used in this way. The hardware is set up using the timer counter functions to start and stop on an edge transition, such as a rising edge transition. That is from a 0 to a 1. If you are trying to get to angular velocity then you may have more than one pulse per rev!!

In principal if there are more than one pulse per rev. then using the time for one tooth period yields: -
speed (RPM) = (1 \ (time from first pulse to second pulse * N)) * 60
N is the number of teeth.

Thus 1ms would be the period for 1000 RPM using a 60 tooth encoder.

You could find interesting things if you are using certian types of rotational systems.

Anyway see the links below, they will be of great additional benefit and complement what is here :-
http://zone.ni.com/devzone/conceptd.nsf/webmain/7C10D82CCB777CE086256F4F0018C3A9
http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&774F83DCE164A86D86256E6600816C93

Complete Industrial Digital I/O and Counter/Timer Tutorial
http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&71012CCCCB2E89A586256E54006E2259



0 Kudos
Message 3 of 5
(12,500 Views)

Hi ED,

 

I had a similar problem and tried to apply the .vi that you suggested. When I try to run it I got an error and it says I must specify the line. I am quite new using the daq palette. Could you let me know what is the problem? I connected only one digital input on my daq 6210. Many thanks! 

Message 4 of 5
(11,891 Views)

I also tried the following vi but it does not seem to count every time I have a pulse input.

0 Kudos
Message 5 of 5
(11,886 Views)