| ??? 05/17/00 11:59 Read: times |
#2726 - RE: Rotary Encoder and an 8051 |
Here's the algorithm I awoke with: All you have to do is take the last value, shift it once left and XOR it with the current value. If bit 1 (zero relative) is 1 then its one direction if its 0 its the other. This occurs because the xor result is 1 or 4, its one direction, if its 2 or 7 its the other. Using the last code as an example: .dowhat: . mov a,r7 ;get last dibit . rl a . xrl a,r6 ;combine with current . jb acc.1,doup ;jig dial up .dodn: ;else dial down ... .doup: ... You'll have to screen the no change and skip conditions or figure out their reslts. That is a cool algorithm! Jay C. Box |
| Topic | Author | Date |
| Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder and an 8051 | 01/01/70 00:00 | |
| RE: Rotary Encoder,bouncing problems | 01/01/70 00:00 | |
RE: Rotary Encoder,bouncing problems | 01/01/70 00:00 |



