11-18-2010 08:56 PM
I am working on a vi that calculates the speed of a motor as well as direction. I have successfully determined the speed of the motor but I cannot figure out how to tell which direction it is going. The outside holes are the 0 index of the DAQ and the inside holes are the 1 index. I know that if I could sense which indicator lit first I could tell the direction that way, but I am lost as to how to implement this in labview. I can get it to output clockwise or counter-clockwise, but since the loop is updating every 20 milliseconds the indicator is constantly switching. Any help that I could get would be greatly appreciated.
Thanks,
Matt
11-18-2010 09:05 PM
Here is a picture of the encoder wheel I am using.
11-18-2010 10:51 PM
So do you have 2 digital inputs that basically behave like a quadrature encoder where one digital input always leads the other input for coming on or turning off and that means one direction, and if it lags, it is the other direction?
Do it like this. When you detect the transition of one digital input from low to high, look at the value of the other digital input at the same time. If it is low, it is one direction. If it is high, then it is the other direction.
PS. Look at this message in the Rube Goldberg thread and see if you can spot anything like it in your code.
11-19-2010 12:22 AM
11-19-2010 12:26 AM
11-19-2010 08:38 AM
New to LabVIEW? Take the tutorials.
I LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
Yes. There is no reason to have a Select Function with a True wired to the top and a False wired to the bottom. The boolean wire going into it is already a True or a False. Maybe the professor needs to take some LabVIEW tutorials.
How fast are the pulses occurring? Right now you are relying on software timing with your 20 msec while loop and reading the both voltages 1 sample at a time. This is okay as long as you don't need speed calculations with better than millisecond accuracy (actually 20 msec +/- a few msec accuracy) and the pulses are sufficiently slow enough that you will detect all of them.
You might be better off reading more samples such as N samples for 1/4 or 1/2 second. Now you'll have a 2-D array of different samples in one dimension, and the two channels in the other dimension. Then you can be sure you've acquired all the samples at a regular pace and can analyze that array for multiple edges at a time and determine which channel leads the other one.
11-22-2010 05:40 PM
That is my goal, but I am stuck on figuring out how to get a window of time equivalent to one inside hole and one outside hole--freeze that by a stored voltage value and compare the two,,,,,or do a check during this time window to see which one goes high first. It seems really simple but I have not found the right combination of structures or functions to make this work.
11-22-2010 05:49 PM - edited 11-22-2010 05:54 PM
This is for FPGA but havea look at the bottom and see if the logic suits your needs.
http://zone.ni.com/devzone/cda/tut/p/id/3921
Edit: I think I linked the wrong article. Search the knowledgebase. I know there is stuff there on calculating rotational direction using the encoder. This may help too.