I am trying to use my tachometer and LabVIEW (V11) to give me the rpm of a wheel/hubmotor system. Using a USB 6211, the ctr0 counter pin, the OAT Digital Tachometer vi and a function generator (generating a square wave at 2Vpp, 50% duty cycle and 1-25 Hz) is giving me very big errors. For instance, there are times where the setup will say that the rpm's are extremely large, negative, NAN or infinity. Also, when I increase the frequency, there are regions that it will increase the rpm and others where it will decrease it. I have also added the loop timing delay to somewhat account for the likely delay that will be incurred when this code is inserted into the larger program that will have a lot more running along side this, and this seems to alter the performance. Any help would be appreciated.
I would recommend you use the OAT Build Digital Tacho Info VI. This should help make sure the data is going into the OAT Digital Tacho Process VI correctly. Let me know how that goes!
Also, are you doing 1 sample or continuous samples on your DAQ assistant task? How long are you waiting? What results are you expecting? I would be interested to know if the data is valid before entering the program--i.e.. when just using MAX, are you getting valid data? Just to double check that there is not a hardware issue as well as software issue.
Thanks for your response, and I apologize that it has taken me a while to get back to you.
I tried incorporating the OAT Build Digital Tacho Info VI, and received the same results.
In response to the second half of your reply, I did use MAX and confirmed that the count was incrementing at the frequency of the signal from the function generator. I have attached the VI that will be using the tachometer to get a wheel's rpm/ground speed to monitor performance so that you can get a better look at all that is going on. The other VI was used to test LabVIEW rpm/groundspeed methods outside of the main program, which is not currently complete enough to run. Additionally, the tachometer will need to be sampled continuously at a rate of 7kHz. The wheel will only ever have a ground speed of 0 to 50 kph (0 to 33 mph) which means that a point will occur with frequency between 22 and 24 Hz (24 and 26 in wheel).
My biggest concern is finding a method of calculating the rpm/groundspeed that will not slow down the rest of the program. Of the other sensors, three will also be sampling continuously at 7kHz and two at only a few Hz.
For the attached VI, you only really need to look at the "True" case for the two top most case structures, as all other cases are basically copies of this case. Also, there are some subvi/support VIs that LV will look for, which can be ignored since they do not have anything to do with the tachometer implementation/problem.
Thanks again for the help,
Regarding your 2Vpp signal from the function generator-
Is that a 0 to 2V signal?
You could be right at the edge of the high logic level on the 6211, it is spec'd at 2V min, 5.25V max. Can you increase the voltage level a bit coming out of the function generator and see what happens?
I did later look at the 6211 specs and saw that trigger range, and ran the function generator at a 3Vpp and received the same results. However, now that I write this I am thinking that you might be right. That Vpp might mean a -1V to 1V signal (up 1V to the high and down 1V to the low, for a 2Vpp). If this is the case, this would mean atleast a 4Vpp, or a 2Vpp with a 1VDC offset. I will try this out later today and let you know.
I just realized while walking to my next class that what I just said is wrong in that when just using MAX, and at 2 and 3Vpp, the edge counter was being triggered and counting up at the same frequency of the function generator. So, it is not that the signal is insufficient and not triggering the edge counter.