07-21-2008 07:48 AM
07-22-2008 01:30 PM
Hello Dadsf,
Welcome to the NI Discussion Forums! From your post, you would like to be able to count the number of pulses from your sensor that occur during a period of time and convert this to RPM. Let me know if I have interpreted this incorrectly. Your USB-6008 manual indicates that the device has a built in counter that can be used to count falling edge signals. If your sensor outputs digital signal this would be a good way to go. You can take the number of pulses that occur over a certain period of time (perhaps between two loop iterations) to find the number of pulses per second. The longer the period of time you acquire pulses for, the more accurate your average RPM will be. This will be at an expense of how often the user is updated with a new RPM value. Check out the links in my signature for some great information on how to get started with DAQmx and what all of the different terms in the DAQ Assistant mean.
I noticed that your DAQ Assistant was set to 1 sample on demand. What this does is causes the USB-6008 to read a single sample from the analog input during each iteration of the loop. I am not sure if that is the behavior you are looking for. Another option would be to setup the task as continuous hardware timed analog input (change the Acquisition mode to Continuous Samples with you desired sample rate and the desired number of samples you would like to read at a time). This will give you a waveform of data that should show the pulses over a period of time. You could then count the number of pulses that occur over the length of the waveform. This would be the equivalent of the number of pulses per second that could be converted to RPM. This method requires a little more processing than the first method, but could give you a little better accuracy. Post back if you need more info.
07-22-2008 01:41 PM
07-23-2008 05:05 PM - edited 07-23-2008 05:05 PM
Hello Dadsf,
The easiest to start with would be to count pulses during a known loop time and then equate that to the number of pulses. This assumes that the RPM sensor is outputting a TTL compatible signal. I made a really quick example of how you could software time this. Basically, this example counts the number of pulses that come in between loop iterations. The loop takes 0.5 seconds to run, so the number of pulses that come in is divided by 0.5 to get the frequency of the pulses. This could be converted to RPM with a few more math functions.
