12-20-2012 08:29 AM
Hi , i have a Third Party where i am using it for acquiring the signals from the encoder HEDL 5540 . Now i have two signals from encoder i need to find the direction of the encoder .
Condition:
When channel A leads it should could counter clockwise .
When channel B comes it should could clockwise .
CAn someone suggest me a simple algorithm for finding it?
Solved! Go to Solution.
12-20-2012 08:45 AM
You have a third party what? DIO board? Encoder interface? Analog input board?
According to the datasheet, the rising edge of the index pulse is synchronized with the rising edge of the barB output. If the barA signal is high at that point it means its already a high and is leading barB; but if barA is not high, barB is leading barA.
Mike...
12-20-2012 08:52 AM
I have REDLAB 1208fs ,DIO port only.
Thanks for your reply , but can tell me or show me clearly about the structure.
12-20-2012 08:59 AM
The way I would do it with NI hardware would be to setup a task to read the state of barA and use the barB signal as the external acquisition clock. I don't know if your device that level of operation.
Mike...
12-20-2012 09:08 AM
Ya it is possible , i have an 32 bit counter also in it.
Pls correct me if am wrong
12-20-2012 09:13 AM - edited 12-20-2012 09:17 AM
If all you want is the direction of rotation the counter shouldn't be necessary. If you do need RPM, you will need to configure that part of the acquisiton hardware as an interval counter in which case you will get a rotation time with a resolution time that is a function of the clock that is driving the counter. You will get a number of pulses per rotation. Multiplying this number by the period of the clock will give you time per rotation.
Once you get the rotation time, the reciprocal of it will give you the speed in rotations per second. And multiplying by 60 will give revolutions per minute.
Hopefully the drivers will let you do both tasks at the same time.
Mike...
12-20-2012 09:28 AM
Dear Mike,
Yes ur right but before proceeding further i want to first get the direction right still findin problem with it . Can u suggest me any algorithm u know.?
12-20-2012 09:41 AM
Already gave you that in my first reply, and told you how to implement it.
Mike...