单片机程序详解,尤其是查表指令,如何查表,tab怎么那么多数据啊?数据怎么用?顺序是怎么的?谢谢!
ORG0000HLJMPMAINORG030HMAIN:MOV20H,#00HMOVA,20HGOON:CLRCANLA,#0FHMOVDPTR,#TABMOVCA,@A...
ORG 0000H
LJMP MAIN
ORG 030H
MAIN: MOV 20H,#00H
MOV A,20H
GOON: CLR C
ANL A,#0FH
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P0,A
MOV A,20H
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
ACALL DEL
MOV A,20H
INC A
DA A
MOV 20H, A
AJMP GOON
DEL: MOV R7,#014H
DEL1: MOV R6,#0FFH
DEL2: MOV R5,#01FH
DEL3: DJNZ R5,DEL3
DJNZ R6,DEL2
DJNZ R7,DEL1
RET
ORG 0100H
TAB: DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H
DB 080H,090H,088H,083H,0C6H,0A1H,086H,08EH
END
查表指令讲详细点,这块一点也不懂啊! 展开
LJMP MAIN
ORG 030H
MAIN: MOV 20H,#00H
MOV A,20H
GOON: CLR C
ANL A,#0FH
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P0,A
MOV A,20H
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
ACALL DEL
MOV A,20H
INC A
DA A
MOV 20H, A
AJMP GOON
DEL: MOV R7,#014H
DEL1: MOV R6,#0FFH
DEL2: MOV R5,#01FH
DEL3: DJNZ R5,DEL3
DJNZ R6,DEL2
DJNZ R7,DEL1
RET
ORG 0100H
TAB: DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H
DB 080H,090H,088H,083H,0C6H,0A1H,086H,08EH
END
查表指令讲详细点,这块一点也不懂啊! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询