level 9
jolinbuxia
楼主
org0000h
sjmpmain
org0030h
main:
;movP0,#03h
;movP2,#01h
mov50H,#00h
lcallKeyScan
movA,50h
jnzlp1
sjmplpend
lp1:
mov51h,50h
movdptr,#KeyValue;
movcA,@A+DPTR
movP0,A
lpend:
nop
sjmpmain
sjmp$
KeyScan:
movP1,#0ffh
orlP1,#0fh
anlP1,#0efh;P1.4 置零
jnbP1.0,Key01;1号键按下,跳到处理程序
jnbP1.1,Key05;5号键
jnbP1.2,Key09;9Key
jnbP1.3,Key13;13
movP1,#0ffh
anlP1,#0dfh;P1.5 置零
jnbP1.0,Key02;2号键按下,跳到处理程序
jnbP1.1,Key06;6号键
jnbP1.2,Key10;10Key
jnbP1.3,Key14;14
movP1,#0ffh
anlP1,#0bfh;P1.6 置零
jnbP1.0,Key03;2号键按下,跳到处理程序
jnbP1.1,Key07;6号键
jnbP1.2,Key11;10Key
jnbP1.3,Key15;14
movP1,#0ffh
anlP1,#07fh;P1.7 置零
jnbP1.0,Key04;2号键按下,跳到处理程序
jnbP1.1,Key08;6号键
jnbP1.2,Key12;10Key
jnbP1.3,Key16;14
ljmpKeyend
Key01:
mov50h,#01h
mov p2,#3fh
sjmpKeyend
Key05:
mov50h,#05h
mov p2,#3fh
sjmpKeyend
Key09:
mov50h,#09h
mov p2,#3fh
sjmpKeyend
Key13:
mov50h,#03h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Key02:
mov50h,#02h
mov p2,#3fh
sjmpKeyend
Key06:
mov50h,#06h
mov p2,#3fh
ljmpKeyend
Key10:
movp0,#3fh
mov p2,#06h
sjmpKeyend
Key14:
mov50h,#04h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Key03:
mov50h,#03h
mov p2,#3fh
sjmpKeyend
Key07:
mov50h,#07h
mov p2,#3fh
sjmpKeyend
Key11:
mov50h,#01h
mov p2,#06h
sjmpKeyend
Key15:
mov50h,#05h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Key04:
mov50h,#04h
mov p2,#3fh
sjmpKeyend
Key08:
mov50h,#08h
mov p2,#3fh
sjmpKeyend
Key12:
mov50h,#02h
mov p2,#06h
sjmpKeyend
Key16:
mov50h,#06h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Keyend:
nop
ret
KeyValue:
DB 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71h
end
2016年03月03日 04点03分
1
sjmpmain
org0030h
main:
;movP0,#03h
;movP2,#01h
mov50H,#00h
lcallKeyScan
movA,50h
jnzlp1
sjmplpend
lp1:
mov51h,50h
movdptr,#KeyValue;
movcA,@A+DPTR
movP0,A
lpend:
nop
sjmpmain
sjmp$
KeyScan:
movP1,#0ffh
orlP1,#0fh
anlP1,#0efh;P1.4 置零
jnbP1.0,Key01;1号键按下,跳到处理程序
jnbP1.1,Key05;5号键
jnbP1.2,Key09;9Key
jnbP1.3,Key13;13
movP1,#0ffh
anlP1,#0dfh;P1.5 置零
jnbP1.0,Key02;2号键按下,跳到处理程序
jnbP1.1,Key06;6号键
jnbP1.2,Key10;10Key
jnbP1.3,Key14;14
movP1,#0ffh
anlP1,#0bfh;P1.6 置零
jnbP1.0,Key03;2号键按下,跳到处理程序
jnbP1.1,Key07;6号键
jnbP1.2,Key11;10Key
jnbP1.3,Key15;14
movP1,#0ffh
anlP1,#07fh;P1.7 置零
jnbP1.0,Key04;2号键按下,跳到处理程序
jnbP1.1,Key08;6号键
jnbP1.2,Key12;10Key
jnbP1.3,Key16;14
ljmpKeyend
Key01:
mov50h,#01h
mov p2,#3fh
sjmpKeyend
Key05:
mov50h,#05h
mov p2,#3fh
sjmpKeyend
Key09:
mov50h,#09h
mov p2,#3fh
sjmpKeyend
Key13:
mov50h,#03h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Key02:
mov50h,#02h
mov p2,#3fh
sjmpKeyend
Key06:
mov50h,#06h
mov p2,#3fh
ljmpKeyend
Key10:
movp0,#3fh
mov p2,#06h
sjmpKeyend
Key14:
mov50h,#04h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Key03:
mov50h,#03h
mov p2,#3fh
sjmpKeyend
Key07:
mov50h,#07h
mov p2,#3fh
sjmpKeyend
Key11:
mov50h,#01h
mov p2,#06h
sjmpKeyend
Key15:
mov50h,#05h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Key04:
mov50h,#04h
mov p2,#3fh
sjmpKeyend
Key08:
mov50h,#08h
mov p2,#3fh
sjmpKeyend
Key12:
mov50h,#02h
mov p2,#06h
sjmpKeyend
Key16:
mov50h,#06h
mov p2,#06h
sjmpKeyend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Keyend:
nop
ret
KeyValue:
DB 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71h
end