Convert a counter to frequency
Hi,
I am using two counters on a 6023E board. I have two pulse generators which
give 1000 pulses in one rotation.
How can I convert the counts to frequency or speed in LabView?
Greetings,
Erik.
We found that the best way of obtaining speed measurement from a pulse generator is to use the buffered period measurement and scan some period (more than one), then eliminate the first measure (first period measurement may be incorrect due to the uncertainty in the start of measurement with respect to the slope of the signal), next average the measures obtained.
The next step is to divide base time used (internal base time of 20 mhz for example) by the average measure obtained in the preceding step: this is the average period measurement and must be multiplied by 60 and divided by n. of pulses per round: this gives you the rpm value.
Step two can be put in a loop in orded to obtain a continuous measurement, provided that you restart the counter once obt
ained a finished reading from it.
Roberto
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?
Similar Messages
-
How to convert the counter input as a RPM
Hello NI,
Could you tell me. how to convert the Counter input to the RPM. I am using Rotary encoder has a 5V amplitude with 500 PPR. i am going to measure the Engine speed as a rpm.
I am using third party hardware, from the hardware i can get the Count as well as Frequency also.
Could you suggest to me...? i looked out some disscussion in these forum but i cant able to understand.
can you please explain with simple way....
if you have any simulation send me....
Regards,
Balaji DPHi balaji,
[email protected] wrote:
...I am using third party hardware, from the hardware i can get the Count as well as Frequency also.
If you're able to read frequency as X pulses/sec(?) that seems to convert RPM as follows:
X (pulse/sec) * 1/500 (rev/pulse) * 60 (sec/min) = X * 60/500 RPM (???)
Cheers!
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare) -
Converting a counter to relative time
Hello! I have a fairly simple question if anyone has a moment. I have a while loop with a 1000ms Wait inside, along with some other stuff that's irrelevant to the question. Since my incrementer essentially counts the seconds elapsed due to the presence of the 1000ms Wait, I'd like to take the built in incrementer (i) and use it to display the relative time that has elapsed since the while loop began. This loop will be running for 3 hours, so I'd like to display in HH:MMS format. So basically, I'm looking for a way to convert the counter into a time value. Any thoughts? I know the Wait function isn't exactly accurate, but that's ok. I don't need to be 100% accurate in this vi. Just a rough estimate will be fine. It seems like there should be a relatively simple way to do this, but I can't figure it out... Thanks!!
Solved!
Go to Solution.The code could not get much simpler. You just wire a numeric indicator to the iteration terminal. Set the display format to absolute time and HH:MMS time format.
Message Edited by Dennis Knutson on 02-04-2009 09:00 AM
Attachments:
Simple Elapsed Time.PNG 2 KB -
Help Counting high frequency voltage spikes
Equipment: NI USB-6229 (250 kS/sec Analog In., 16 bit DAC, 32 bit Counters and internal clocks <= 80 Mhz)
LabView 14
Problem:
I have an experimental application where I need to count voltage spikes (integer #) caused by electrons hitting a sensor. These spikes can be as frequent as 500,000 Counts/sec. The spikes are not going to be the same voltage everytime, but they will be visible above the noise so I need to allow the user to select a Threshold Voltage that triggers a real count rather than noise spikes.
Attempts:
To count such a high frequency, I deduce that I need to use a Counter Input to read fast enough, HOWEVER, I wasn't able to find a way to set a threshold voltage for a Counter Input because I believe they expect a TTL signal anyways, which I won't have. To set the threshold, I realize that Analog Input reads can be triggered at a selected level which is great but the Analog Input Sampling Rate is only 250kS/sec which won't catch every count in my project.
I have a program that uses the Count Edges channel and it is accurate within 3% of the expected # of counts. I was just testing it with a function generator and the program doesn't count unless the signal's voltage is above 2-3 V which won't work for my application. I will post what I have. Does anybody know of a way to trigger off only at selected Voltage levels using counters, or know of a way to filter through the noise to get real spikes?
Thanks!
Solved!
Go to Solution.
Attachments:
ElectronCountsTest.vi 29 KBThanks for the reply johnsold. I didn't think to use a comparator but that is good to know that I have that option. I was and still am hoping for some kind of trick to do this programmatically. One other idea that I was playing with is offsetting two or three different Reads on the same signal to read the signal at different times. If this is a possibility, it may be able to double or triple my sample rate to 500k or 750kS / sec. Anyone else have any ideas on this solution?
-
I am trying to set the max frequency for PCI-6120 counter. By the card specification, the counter's max source frequency is 20MHz. However, on MAX software test panel, if the counter frequency is set greater than 5MHz, program pops up an error stating the max valid value is 5e6 MHz.. Attached is the error message. Did I do anything wrong? Or special card setting is needed. Please help. Thanks very much.
Attachments:
NI 6120 counter error message.jpg 36 KBHi windwalker,
The max source frequency is 20 MHz. The source is an input to the counter which is divided down to produce the output signal:
The default behavior is that the counter will count to N, and then toggle its output. N must be at least 2, so the maximum frequency you can generate with the default (toggle) mode is 5 MHz (2 ticks high, 2 ticks low of the 20 MHz maximum source).
The other mode is "pulse" mode, where the counter will count to N and then a pulse its output. You can end up getting a pulse every 2 ticks of the source, which could give you a 10 MHz clock. You can't set this mode in the test panels, but here's an example in LabVIEW showing how to get a 10 MHz output (the "External Clock" can be the 20 MHz timebase).
However, if you're just trying to generate a 10 MHz continuous output, then I suggest using the Frequency Output which is a 4-bit counter that can output a small set of frequencies including 10 MHz -- {10 MHz,100 kHz} / {1:16}. It is programmed similar to the other counters.
Best Regards,
John Passiak -
Minimum Frequency for counter Pulse Frequency Generation
Hello,
What is the Minimum Frequency that the Counter Output Pulse Frequency VI can generate?
If I need to generate a REALLY low frequency pulse train can I do that?
Thanks
DanHi Dan,
If you don't explicitly specify a timebase, DAQmx will choose a default depending on the initial parameters you set up for CO Pulse Frequency. For example, the following code should work on any DAQ device with a 32-bit counter and a 100 kHz timebase available (from my first post, 11.64 uHz is the minimum frequency in this scenario).
So... your 10-100 second periods should be more than achievable. The inverse of 12uHz is about 23.15 hours.
If you're on a 24-bit counter the maximum pulse width would only be ~167.77 seconds (2^24/100000), giving a frequency of about 2.98 mHz assuming 50% duty cycle.
The only way you should be getting an error at the 10-100 second durations that you are describing is if you start the task off at a faster rate (so DAQmx will pick a faster timebase by default) then modify it to output a lower frequency. Rollover times for the maximum default timebases are as follows:
E Series: ~0.839 seconds (24-bit counter, 20 MHz timebase)
M Series: ~53.69 seconds (32-bit counter, 80 MHz timebase)
X Series: ~42.95 seconds (32-bit counter, 100 MHz timebase)
If you want to set a different signal source as a timebase, you can do it with a DAQmx Channel Property Node:
I'm afraid I don't really understand what you are trying to do specifically. How does this "infinite" pulse length fit within the context of your application? Why not simply write the line high in software? What hardware are you using?
Best Regards,
John Passiak -
Hi everyone,
I'm building a heart rate monitor as a final year project with my lab partner using the NI USB-6009 and Labview 2009. We have managed to obtain a signal using a photo transciever, smooth it out and count the events, however the count is incremental.
We wish to count the number of pulses we obtain for a few seconds (5-10 for example) and then use this value to obtain a pulse rate in beats per minute (e.g. 10 pulses in the first 10 seconds would give an estimated BPM of 60 etc etc).
Does anybody have ides on how we could implement this? We have tried timed loops, elapsed time VI's and other things but nothing gives us what we need.
Thanks in advance for any help that is offered.
Jeshua Graham.We are very new to Labview. We are taking a raw signal from our DAQ and then using VIs to filter and then trigger counts on rising edges. I have attached our vi file to this post for you to look at (I hope that is what you mean by code).
Attachments:
TCRT-1010DAQ_jeshua1.vi 367 KB -
How do you count the frequency of a boolean signal?
Hi, I'm new to LabVIEW, so I suspect this is propbably quite a simple problem.
I'm developing an optical tacometer for a model gas turbine engine. I have a boolean signal in labview which is switching at a frequency between 4 and 26Hz. I need a live readout of the frequency of this signal.
Does anyone know how I could do this? Any help would be really appreciated!
Many thanks
Will
Solved!
Go to Solution.This vi should work for you
Tim
Johnson Controls
Holland Michigan
Attachments:
Calculate Frequency from boolean.vi 11 KB -
How do you count the frequency of a booloen signal?
Hi, I'm new to LabVIEW, so I suspect this is propbably quite a simple problem.
I'm developing an optical tacometer for a model gas turbine engine. I have a boolean signal in labview switching between 4 and 26Hz. I need a live readout of the frequency of this signal.
Does anyone know how I could do this? Any help would be really appreciated!
Many thanks
WillNew post here...
http://forums.ni.com/ni/board/message?board.id=170&message.id=481337
Rich R
Applications Engineer
National Instruments UK & Ireland -
Hi all,
I'm very new to Java, only a few months into it. I am working on a program that compresses a file, thread, string. Firstly it takes a string of undetermided length as input and using the delimiter splits the string, then places that string into a list. Then from that list I take out the recurring words with another list and return the index of where the words are, this has been done without any problems.
Next I want to get the word frequency and return the most common word into the first index following onto the next and so on. I am not sure how best to go about this. I did use a map but that just gives the frequency of the words without any ordering. Can anybody give me any suggestions that I could try bearing in mind that java is my first language so this is also a confidence building exercise.
Many thanks to anybody who responds.littlejim4 wrote:
Hi all,
I'm very new to Java, only a few months into it. I am working on a program that compresses a file, thread, string. Firstly it takes a string of undetermided length as input and using the delimiter splits the string, then places that string into a list. Then from that list I take out the recurring words with another list and return the index of where the words are, this has been done without any problems.
Next I want to get the word frequency and return the most common word into the first index following onto the next and so on. I am not sure how best to go about this. I did use a map but that just gives the frequency of the words without any ordering. Can anybody give me any suggestions that I could try bearing in mind that java is my first language so this is also a confidence building exercise.
Many thanks to anybody who responds.Okay, so you have a Map with the 'word' as keys, and the 'frequency' as values, right?
If so, create a class (WordOccurrence for example) that holds a "word" and "occurrence" variable. Let that class also implement the Comparable interface. Now, when you can do something like this:
public static List<WordOccurrence> getWordOccurrances(String text) {
// get the occurrence of each (unique) word
Map<String, Integer> frequencyMap = getFrequencyMap(text);
// create a lit to hold you WordOccurrence instances
List<WordOccurrence> list = new ArrayList<WordOccurrence>();
// for each word in your map, create a WordOccurrence instance
for(String word : frequencyMap.keySet()) {
list.add(new WordOccurrence(word, frequencyMap.get(word)));
// sort the list of WordOccurrences
Collections.sort(list);
// return the sorted list
return list;
} -
6254 Counter stops counting as frequency increases
I'm counting tach pulses (CI cnt edges) with a 6254. The DAQmx read is in a timed loop and passes the counter value to an indicator in another lower priority loop using shared variables. The counter counts correctly when the tach is turning slowly but stops counting when the tach speed increases. As the tach slows down the counter begins to count again. I think the maximum tach rate is about 4K..
Please refer to your other forum for more information and questions.
Regards,
Jordan F
National Instruments -
sir,
our project is about designing an "eddy current based sensor for contactless measurement of breathing".we had so far designed an colpitts oscillator with 12MHZ of output,this frequency is converted to square pulse using a schmitt trigger.Now we want to know whether it is possible to count this frequency of 12MHZ in lab view?.what is the maximum and minimum frequency counted by lab view?
Solved!
Go to Solution.Not until you tell me exactly which DAQ hardware you are using (model number) and what you mean by "feeding 12MHz to LabVIEW". Are you trying to measure the frequency, pulses, edges, what?
“A child of five could understand this. Send someone to fetch a child of five.”
― Groucho Marx -
Synchronize sampling of rpm using frequency counter with force (voltage) signals
I have a VI attached which converts the voltage values measured from the ATI force/torque senosr to force values. I would like to integrate the measuring of TTL pulses from an RPM senosr. There is a bug with my current program, as the RPM value only updates once. If I put the read VI in a while loop, the program returns an error. How should I modify my code to solve this, and as well as to synchronize the recording of data from both sensors?
I have no prior labview experience, and really appreciate any help.
Attachments:
atidaqft-mx.llb 93 KBDear Jochen,
(1) Principally, I'd like to use PCI-6602 to be a motion encoder also be a counter (Is it possible? Due to the manual, it is possible). I expect to have all information, such as position, time, velocity, etc. from that motion encoder (or at least the position and time). It is also expected of using PCI-6602 to do all measurements that I mentioned before . My meaning is, after having a signal from the counter, that 'count' will be converted to desire units under other programs. So, in this case, PCI-6602 is only used to get the 'count'.
Simplified, the voltage command will send to the system (linear motor) through PCI-6052E (-10V to 10V). The actual position or other actual information will be catched (read) by using PCI-6602 (as a motion encoder, also as a counter). Then, this actual position will be used as a feedback, that will be compared to desired position.
Is that also possible to use PCI-6602 be a motion controller + a counter + a frequency measurement in a same time parallely?
I don't decide yet (I don't know) which acquisition rate will be needed/required, higher is better.
(2) I'd like to apply an adaptive robust controller (yes, it is a closed loop system) under matlab with their feature called Real-Time-Workshop instead of using LV.
(3) Power drive for the linear system will be driven by AC servo drive.
Thanks for your help before,
Warmly regards,
hendro -
Frequency counter unreliable using rotary vane anemometer
I have set up an anemometer to measure air flow speed, with the signal being acquired by a 9402 module in a cDAQ-9174 chassis (4 slot). I am using Signal Express 2011 to program the instrument.
I have set up a frequency counter task, using a maximum frequency of 1.8 kHz a minimum frequency of 250 mHz, rising edge and 1-counter (low frequency). The output is scaled using y = 0.0111x + 0. This gives 20 m/s when the frequency is 1.8 kHz.
The readings given by Signal Express give a very noisy signal, at a frequency much higher than the bandwidth of the anemometer. The range is in the order of 20% of the mean. I have attached a PDF of the signal, for two different air flow sources, the seproj file and the tdms file for one of the runs. I have also observed that the counter output is rounded to the nearest multiple of 10, e.g. 490, 470, 480, 480, 470, etc.
Is this consistent with a digital bounce issue? Is this consistent with an earthing issue? Is this consistent with a sample rate issue? Any other ideas for investigating this issue?
thanks
Attachments:
EXPT 20 - ANEMOMETER NOISE.pdf 49 KB
EXPT 20 Anemometer Noise.seproj 637 KBI have logged the voltage signal coming from the anemometer, using our 9239, a report of a few cycles is attached as a PDF. The graph clearly shows a small digital bounce. The noise is small compared to the signal, is there any way it can be filtered when acquired by the 9402?
Other tests that I ran showed a background noise in the order of 50 microVolts and a frequency of 50 Hz, this is very likely a background noise from a power supply (we run at 50 Hz in Aus) but is many orders of magnitude smaller than the signal, I assume it would be ignoredby the 9402.
Attachments:
EXPT 20 Anemometer Noise Voltage.seproj 261 KB
EXPT 20 Anemometer Noise Voltage.pdf 19 KB -
Synchroniz​ing two counter frequency inputs with multiple analog inputs
Hello all,
I'm fairly new to LabVIEW and I'm trying to collect data from multiple sources with synchronized timing on the acquisition but I'm having trouble figuring it out. My problem is that I've got two counter frequency inputs, one optical tachometer reading one pulse per revolution, and a max machinery flow meter with a k factor of 12000. I can't seem to figure out how to sync the timing with my multiple analog inputs. I've been attempting to get the tachometer to sync with the analog inputs first by following the example linked here. (https://decibel.ni.com/content/docs/DOC-10785) So far each time I run it I either get a timeout error on the DAQmx read or a "Multiple sample clock pulses were detected" error (see attached image). It seems if I slow the sampling rate way down to say 10 hz and ensure that the tachometer signal is over 800-1000 RPM (13-17 Hz) before starting the VI then the program will run without errors until the RPM drops below that threshold then the "Multiple sample clock pulses" error occurs. The code is attached below.
Does anyone know of a more effective way of syncing counter frequency inputs with analog inputs? I'd like to have a VI that can show 0 RPM (and eventually 0 flow as well, but I think I need to figure out the timing of one counter before I add another as it seems I can't have two counters in the same task). Any help on this would be greatly appreciated.
LabVIEW version 13.0
cDAQ-9178 Chassis with NI 9401 for the two counter inputs and NI 9205 for the analog inputs.
Thanks!
Richard
Solved!
Go to Solution.
Attachments:
SimpleDAQ.vi 44 KB
LV_Error.JPG 31 KBMaybe third times the charm?
So I've finally got a good handle on why the VI is having problems at low RPM though I'm somewhat embarassed how long it took me to do that
Because I have the counter time synced to my Analog input task if it doesn't see at least two pulses between the two clock pulses set by the analog input task I get the -201314 "Multiple sample clock pulses" error. This seems fine at first as it just sets a minimum RPM that I can measure and it's well below the area I'm interested in so no problems there. I tried a simple error handler that would clear the error when it happend assuming the loop would keep iterating until the RPM went above that minimum at which point I would get a signal again. This is not the case, the read function just continues to spit out the -201314 error even after the RPM is back in the readable range. So then I tried adding two case structures so that when the error occured it would stop the task, clear the error, and then start the task again on the next loop iteration (Code Attached). This also doesn't work as the error shows up again on the stop task and then AGAIN on the start task on the next loop iteration. It seems this error is not actually being cleared and once it happens it stays with the task regardless of what the error cluster is carrying.
Anyone have any ideas? The only solution I can think of is to just clear all tasks and recreate them each loop iteration until the RPM is readable again but that strikes me as a horribly clunky solution.
Richard
Attachments:
SimpleDAQ_1_Start Stop.vi 48 KB
Maybe you are looking for
-
Real Instruments Overdriving?
Hi guys. I have recently run into a problem. I rarely dip into my RI loops, but just the other day I was previewing the drums and they were overdriving the soundcard of my Mac Mini and I don't know why. The previews for the SI sound just fine. It's s
-
Make expense report read only after approval
Hello, Please guide on how to make an expense report read only once it is approved and no change option should be enabled on enterprise portal. I have tried all the combinations of security in the ESS roles inside ABAP but not able to find the right
-
Where to find the doc of package "com.sun.media.util"
In the jmf.jar,it also has the com.sun.media package,but jmf20.pdf doc not include the comment,how to find the document of package com.sun.meida?
-
My macbook wont switch on even if power adaptor is lit up
After updating to yosemite, my sons was watching you tube then probably due to duration of watching, it turned of due to low battery, but i tried to charge it, and it wont start. The power adaptor is lit and its green which should mean that the charg
-
Why cant i hear siri unless my headphones are plugged in
why cant i hear siri unless my headphones are plugged in