| ??? 04/30/03 07:17 Read: times |
#44527 - RE: reading a rotary encoder : Erik Responding to: ???'s previous message |
About the multi Megaherz Problem: I don't agree that this causes problems as long as the oscillation just occures between two states (which is normally the case), I just have to handle all possible states in software, as of course can also be done in HW using an Agilent $$$$ chip: Here is an expample that I used with position measuring in a robot system.
We have four states A B C D. 1) I detect the states all 50 usecs 2) if changed, then I compare to the old state and decide if it counts up or down and store the new state. Now if a multimegaherz oscillation occures between A-B i would miss a lot of action, but the worst thing that would happen, is that my reading would accidentally change 1 digit quite unpredictable. The part of the SW would do something like every 50usec: A=0;B=2;C=3;D=1; new=P1 & 3; if(new != old) { if(old==A && new==B) x++; else if(old==B && new==A) x--; etc.. old=new; } However if I would miss B between A and C then it does not work anymore. So a complete state can't be shorter than 50usec. Werner |



