Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/05/00 12:54
Read: times


 
#6982 - RE: Digital encoder
Hi John,

here is my routine:
It works fine with a 4 phase 1 step jogshuttle.
Now the table was made for 1 step on every phase.
It must also be called within a timer interrupt.


Peter


JogA bit p1.1 ;input pin A
JogB bit p2.7 ;input pin B

JogOld equ 30h ;store previous reading
JogCount equ 31h ;up / down counter

intt0:
push psw
push acc
mov a, JogOld
mov c, JogA
rlc a
mov c, JogB
rlc a
mov JogOld, a
anl a, 0Fh ;A: 0, 0, 0, 0, Aold, Bold, Anew, Bnew
add a, #intt0b - intt0a
movc a, @a+pc
intt0a: add a, JogCount
mov JogCount, a
pop acc
pop psw
reti
intt0b:

; 4 phase = 4 steps:
; CW: 0 - 1 - 3 - 2 - 0
; CCW: 0 - 2 - 3 - 1 - 0
db 0, 1, -1, 0, -1, 0, 0, 1
db 1, 0, 0, -1, 0, -1, 1, 0

; 4 phase = 1 step:
; CW: 0 - 1
; CCW: 1 - 0
; db 0, 1, 0, 0, -1, 0, 0, 0
; db 0, 0, 0, 0, 0, 0, 0, 0



List of 17 messages in thread
TopicAuthorDate
Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
Wrong counts, Debouncing            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      
RE: Digital encoder            01/01/70 00:00      

Back to Subject List