发表于:2005/7/10 22:59:00
#10楼
课题不难,要把K2按下加放开减该为K2按下加(放开不变),K3按下减(放开不变)才能实用但本人不愿多花脑筋,就把以前的一个制作发给你吧,P1.0同步信号,低电平有效,P1.1复位外部同步信号,P1.2加速P1.3减速(低电瓶有效),P1.7触发脉冲信号输出
ljmp nain
NOP
mov r1,#0dah
nop
reti
nop
nop
nop
clr p1.7
clr tr0
mov th1,#0f6h
mov tl1,#0ffh
nop
setb tr1
nop
reti
nop
setb p1.7
nop
clr tr1
nop
reti
nop
nop
nain: mov r3,#0
nop
clr p1.1
nop
setb p1.7
nop
setb it0
nop
setb ex0
nop
setb et1
nop
setb et0
nop
setb ea
nop
mov tmod,#11h
nop
mov r0,#0ffh
nop
mov r1,#0dfh
nop
lookf: jb p1.0,$
nop
mov tl0,r0
nop
mov th0,r1
nop
setb tr0
nop
setb p1.1
nop
clr p1.1
nop
jb p1.2,av
nop
inc r3
nop
cjne r3,#2h,lookf
nop
mov r3,#0
nop
dec r0
nop
cjne r0,#0ffh,lookf
nop
cjne r1,#0dfh,r1dec
nop
mov r0,#0ffh
nop
ljmp lookf
nop
r1dec: dec r1
nop
ljmp lookf
nop
av: jb p1.3,lookf
nop
inc r3
nop
cjne r3,#2h,lookf
nop
mov r3,#0
nop
cjne r1,#0ffh,noma
nop
cjne r0,#0ffh,noma
nop
ljmp lookf
nop
noma: inc r0
nop
cjne r0,#0,lookf
nop
r1a: cjne r1,#0ffh,r1inc
nop
ljmp lookf
nop
r1inc: inc r1
nop
ljmp lookf
nop
rav: dec r0
nop
ljmp lookf
nop
nop
ljmp lookf
nop
ljmp nain
NOP
mov r1,#0dah
nop
reti
nop
nop
nop
clr p1.7
clr tr0
mov th1,#0f6h
mov tl1,#0ffh
nop
setb tr1
nop
reti
nop
setb p1.7
nop
clr tr1
nop
reti
nop
nop
nain: mov r3,#0
nop
clr p1.1
nop
setb p1.7
nop
setb it0
nop
setb ex0
nop
setb et1
nop
setb et0
nop
setb ea
nop
mov tmod,#11h
nop
mov r0,#0ffh
nop
mov r1,#0dfh
nop
lookf: jb p1.0,$
nop
mov tl0,r0
nop
mov th0,r1
nop
setb tr0
nop
setb p1.1
nop
clr p1.1
nop
jb p1.2,av
nop
inc r3
nop
cjne r3,#2h,lookf
nop
mov r3,#0
nop
dec r0
nop
cjne r0,#0ffh,lookf
nop
cjne r1,#0dfh,r1dec
nop
mov r0,#0ffh
nop
ljmp lookf
nop
r1dec: dec r1
nop
ljmp lookf
nop
av: jb p1.3,lookf
nop
inc r3
nop
cjne r3,#2h,lookf
nop
mov r3,#0
nop
cjne r1,#0ffh,noma
nop
cjne r0,#0ffh,noma
nop
ljmp lookf
nop
noma: inc r0
nop
cjne r0,#0,lookf
nop
r1a: cjne r1,#0ffh,r1inc
nop
ljmp lookf
nop
r1inc: inc r1
nop
ljmp lookf
nop
rav: dec r0
nop
ljmp lookf
nop
nop
ljmp lookf
nop
[此贴子已经被作者于2005-7-10 22:59:48编辑过]