真是郁闷,
这是我写的一部分汇编
请大家 帮忙 查查是否有错误,还是全错,
org 0000h
sjmp start
org 0030h
start: mov tmod,#20h
mov th1,#0fah
mov tl1,#0fah
mov scon,#50h
mov pcon,#80h
setb tr1
mov r0,#00h ;给P0赋值
mov a,r0
nokey0: mov p0,#0ffh ;给P1口赋值
clr p0.4 ; 清 位P1。4=0
mov a,p0 ;在把 =11101111---A
anl a,#0ffh ;11101111 与 00001111=00001111
xrl a,#0ffh ; 00001111 异或 00001111= 00000000 (相同为0,不同为1)
jz nokey1 ;判断A是否=0 ,转移,A=1顺序执行
mov a,p0 ;测试 P1口给A
anl a,#0fh ;A 相与 0FH =A
cjne a,#0eh,next1 ; 比较A 是否等于 0EH,相等顺序执行,否跳到NEXT1处。壹百
up1: mov a,r0
mov dptr,#up
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#09h,up1
ajmp nokey0
next1: cjne a,#0dh,next2 ;比较判断
down1: mov a,r0
mov dptr,#down
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#09h,down1
ajmp nokey0
next2: cjne a,#0bh,next3 ; 比较
left1: mov a,r0
mov dptr,#left
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#09h,left1
ajmp nokey0
next3: cjne a,#07h,nokey0; 比较
right1: mov a,r0
mov dptr,#right
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#09h,right1
ajmp nokey0 ; 如果 a不对于1 / 2 /3 则跳到nokey0 处继续判断
nokey1:mov p0,#0ffh ;
clr p0.5
mov a,p0
anl a,#0fh
xrl a,#0fh
jz nokey2
mov a,p0
anl a,#0fh
cjne a,#0eh,next5
jdwz1: mov a,r0
mov dptr,#jdwz
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#0eh,jdwz1
ajmp nokey1
next5: cjne a,#0dh,next6;
xdwz1: mov a,r0
mov dptr,#jdwz
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#0eh,xdwz1
ajmp nokey1
next6: cjne a,#0bh,next7;
yd1: mov a,r0
mov dptr,#yd
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#04h,yd1
ajmp nokey1
next7: cjne a,#07h,nokey1;
fw1: mov a,r0
mov dptr,#fw
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#09h,fw1
ajmp nokey1
nokey2:mov p0,#0ffh;
clr p0.6
mov a,p0
anl a,#0fh
xrl a,#0fh
jz nokey3
mov a,p0
anl a,#0fh
cjne a,#0eh,next9;
poweron1: mov a,r0
mov dptr,#poweron
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,poweron1
ajmp nokey2
next9: cjne a,#0dh,next10;
poweroff1: mov a,r0
mov dptr,#poweroff
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,poweroff1
ajmp nokey2
next10:cjne a,#0bh,next11;
bjstop1: mov a,r0
mov dptr,#bjstop
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bjstop1
ajmp nokey2
next11:cjne a,#07h,nokey2;
bjlj1: mov a,r0
mov dptr,#bjlj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bjlj1
ajmp nokey2
nokey3:mov p0,#0ffh;
clr p0.7
mov a,p0
anl a,#0fh
xrl a,#0fh
jz nokey4
mov a,p0
anl a,#0fh
cjne a,#0eh,next13;
bjtj1: mov a,r0
mov dptr,#bjtj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bjtj1
ajmp nokey3
next13:cjne a,#0dh,next14 ;
jjstop1:mov a,r0
mov dptr,#jjstop
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bjstop1
ajmp nokey3
next14:cjne a,#0bh,next15;
jjyj1: mov a,r0
mov dptr,#jjyj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,jjyj1
ajmp nokey3
next15:cjne a,#07h,nokey3;
jjjj1: mov a,r0
mov dptr,#jjjj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,jjjj1
ajmp nokey3
nokey4: mov p1,#0ffh
clr p1.4
mov a,p1 ;
anl a,#0fh ;
xrl a,#0fh ;
jz nokey5 ;
mov a,p1 ;
anl a,#0fh ;
cjne a,#0eh,next16 ;
zdjj1: mov a,r0
mov dptr,#zdjj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,zdjj1
ajmp nokey4 ;
;
next16: cjne a,#0dh,next17 ;
sdjj1: mov a,r0
mov dptr,#sdjj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,sdjj1
ajmp nokey4
next17: cjne a,#0bh,next18;
zsqh1: mov a,r0
mov dptr,#zsqh
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,zsqh1
ajmp nokey4
next18: cjne a,#07h,nokey4;
bphzd1: mov a,r0
mov dptr,#bphzd
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bphzd1
ajmp nokey4
;
nokey5:mov p1,#0ffh ;
clr p1.5
mov a,p1
anl a,#0fh
xrl a,#0fh
jz nokey6
mov a,p1
anl a,#0fh
cjne a,#0eh,next19
bphsn1: mov a,r0
mov dptr,#bphsn
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bphsn1
ajmp nokey5
next19: cjne a,#0dh,next20;
bphsw1: mov a,r0
mov dptr,#bphsw
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bphsw1
ajmp nokey5
next20: cjne a,#0bh,next21;
ldfw1: mov a,r0
mov dptr,#ldfw
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,ldfw1
ajmp nokey5
next21: cjne a,#07h,nokey5;
ldzj1: mov a,r0
mov dptr,#ldzj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,ldzj1
ajmp nokey5
nokey6:mov p1,#0ffh;
clr p1.6
mov a,p1
anl a,#0fh
xrl a,#0fh
jz nokey7
mov a,p1
anl a,#0fh
cjne a,#0eh,next22;
ldjs1: mov a,r0
mov dptr,#ldjs
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,ldjs1
ajmp nokey6
next22: cjne a,#0dh,next23;
kmfw1: mov a,r0
mov dptr,#kmfw
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,kmfw1
ajmp nokey6
next23:cjne a,#0bh,next24;
kmzj1: mov a,r0
mov dptr,#kmzj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,kmzj1
ajmp nokey6
next24:cjne a,#07h,nokey6;
kmjs1: mov a,r0
mov dptr,#kmjs
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,kmjs1
ajmp nokey6
nokey7:mov p1,#0ffh;
clr p1.7
mov a,p1
anl a,#0fh
xrl a,#0fh
jz nokey8
mov a,p1
anl a,#0fh
cjne a,#0eh,next25;
gqfw1: mov a,r0
mov dptr,#gqfw
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,gqfw1
ajmp nokey7
next25:cjne a,#0dh,next26 ;
gqzj1: mov a,r0
mov dptr,#gqzj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,gqzj1
ajmp nokey7
next26:cjne a,#0bh,next27;
gqjs1: mov a,r0
mov dptr,#gqjs
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,gqjs1
ajmp nokey7
next27:cjne a,#07h,nokey7;
zyfw1: mov a,r0
mov dptr,#zyfw
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,zyfw1
ajmp nokey7
nokey8: mov p2,#0ffh ;给P1口赋值
clr p2.4 ; 清 位P1。4=0
mov a,p2 ;在把 =11101111---A
anl a,#0fh ;11101111 与 00001111=00001111
xrl a,#0fh ; 00001111 异或 00001111= 00000000 (相同为0,不同为1)
jz nokey9 ;判断A是否=0 ,转移,A=1顺序执行
mov a,p2 ;测试 P1口给A
anl a,#0fh ;A 相与 0FH =A
cjne a,#0eh,next28 ; 比较A 是否等于 0EH,相等顺序执行,否跳到NEXT1处。
zyzj1: mov a,r0
mov dptr,#zyzj
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,zyzj1
ajmp nokey8 ;把立即数送给KEY= 0----30H单元
;跳到OK处
next28: cjne a,#0dh,next29 ;比较判断
zyjs1: mov a,r0
mov dptr,#zyjs
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,zyjs1
ajmp nokey8
next29: cjne a,#0bh,next30 ; 比较
bgbcon1: mov a,r0
mov dptr,#bgbcon
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bgbcon1
ajmp nokey8
next30: cjne a,#07h,nokey8; 比较
bgboff1: mov a,r0
mov dptr,#bgboff
movc a,@a+dptr
mov sbuf,a
jnb ti,$
clr ti
inc r0
cjne r0,#05h,bgboff1
ajmp nokey8
; 如果 a不对于1 / 2 /3 则跳到nokey0 处继续判断
nokey9:mov p2,#0ffh ;
clr p2.5
mov a,p2
anl a,#0fh
xrl a,#0fh
jz nokey10
mov a,p2
anl a,#0fh
cjne a,#0eh,next31
ljmp start
next31: cjne a,#0dh,next32;
ljmp start
next32: cjne a,#0bh,next33;
ljmp start
next33: cjne a,#07h,nokey9;
ljmp start
nokey10:mov p2,#0ffh;
clr p2.6
mov a,p2
anl a,#0fh
xrl a,#0fh
jz nokey11
mov a,p2
anl a,#0fh
cjne a,#0eh,next34;
ljmp start
next34: cjne a,#0dh,next35;
ljmp start
next35:cjne a,#0bh,next36;
ljmp start
next36:cjne a,#07h,nokey10;
ljmp start
nokey11:mov p2,#0ffh;
clr p2.7
mov a,p2
anl a,#0fh
xrl a,#0fh
jz nokey12
mov a,p2
anl a,#0fh
cjne a,#0eh,next37;
ljmp start
next37:cjne a,#0dh,next38 ;
ljmp start
next38:cjne a,#0bh,next39;
ljmp start
next39:cjne a,#07h,nokey12;
ljmp start
nokey12: ljmp start
up: db 81h,01h,06h,01h,05h,06h,03h,01h,0ffh ;向上
down: db 81h,01h,06h,01h,05h,06h,03h,02h,0ffh ;向下
left: db 81h,01h,06h,01h,05h,06h,01h,03h,0ffh ;向左
right:db 81h,01h,06h,01h,05h,06h,02h,03h,0ffh ;向右
setp: db 81h,01h,06h,01h,05h,06h,03h,03h,0ffh ;停止
jdwz: db 81h,01h,06h,03h,05h,06h,00h,00h,00h,00h,00h,00h,00h,00h,0ffh ;绝对位置
xdwz: db 81h,01h,06h,03h,05h,06h,00h,00h,00h,00h,00h,00h,00h,00h,0ffh ;相对位置
yd: db 81h,01h,06h,04h,0ffh ;原点位置
fw: db 01h,01h,06h,05h,0ffh ;复位
poweron: db 81h,01h,04h,00h,02h,0ffh ;对D70开启电源
poweroff: db 81h,01h,04h,00h,03h,0ffh ;关闭D70电源,停止工作
bjstop: db 81h,01h,04h,07h,00h,0ffh ;变焦停止
bjlj: db 81h,01h,04h,07h,02h,0ffh ;变焦拉近
bjtj: db 81h,01h,04h,07h,03h,0ffh ;变焦推远
jjstop: db 81h,01h,04h,08h,00h,0ffh ;聚焦停止
jjyj: db 81h,01h,04h,08h,02h,0ffh ;聚焦远焦
jjjj: db 81h,01h,04h,08h,03h,0ffh ;聚焦近焦
zdjj: db 81h,01h,04h,38h,02h,0ffh ;自动聚焦
sdjj: db 81h,01h,04h,38h,03h,0ffh ;手动聚焦
zsqh: db 81h,01h,04h,38h,10h,0ffh ;自动手动聚焦切换
bphzd: db 81h,01h,04h,35h,00h,0ffh ;自动白平衡
bphsn: db 81h,01h,04h,35h,01h,0ffh ;白平衡室内模式
bphsw: db 81h,01h,04h,35h,02h,0ffh ;白平衡室外模式
ldfw: db 81h,01h,04h,0dh,00h,0ffh ;亮度复位
ldzj: db 81h,01h,04h,0dh,02h,0ffh ;亮度增加
ldjs: db 81h,01h,04h,0dh,03h,0ffh ;亮度减少
kmfw: db 81h,01h,04h,0ah,00h,0ffh ;快门复位
kmzj: db 81h,01h,04h,0ah,02h,0ffh ;开门增加
kmjs: db 81h,01h,04h,0ah,03h,0ffh ;开门减少
gqfw: db 81h,01h,04h,0bh,00h,0ffh ;光圈复位
gqzj: db 81h,01h,04h,0bh,02h,0ffh ;光圈增加
gqjs: db 81h,01h,04h,0bh,03h,0ffh ;光圈减少
zyfw: db 81h,01h,04h,0ch,00h,0ffh ;增益复位
zyzj: db 81h,01h,04h,0ch,02h,0ffh ;增益增加
zyjs: db 81h,01h,04h,0ch,03h,0ffh ;增益减少
bgbcon: db 81h,01h,04h,33h,02h,0ffh ;背光打开
bgboff: db 81h,01h,04h,33h,03h,0ffh ;背光关闭
end