51单片机AT89C51,我刚刚接触,大神门帮我看一下哪里错了
时间:10-02
整理:3721RD
点击:
ORG 0000H
LJMP L0003
L0003: MOV R0,#07fH
CLR A
L0006: MOV @R0,A
DJNZ R0,L0006
MOV SP,#0aH
INC R2
LJMP L004a
L000f: LJMP L0128
L0012: CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
L0016: CLR A
MOVC A,@A+DPTR
INC DPTR
JC L001e
MOV @R0,A
SJMP L001f
L001e: MOVX @R0,A
L001f: INC R0
DJNZ R7,L0016
SJMP L004d
ADD A,R1
L0024: CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
ANL A,#07H
ADD A,#0cH
XCH A,R0
CLR C
RLC A
SWAP A
ANL A,#0fH
ORL A,#020H
XCH A,R0
MOVC A,@A+PC
JC L003c
CPL A
ANL A,@R0
SJMP L003d
L003c: ORL A,@R0
L003d: MOV @R0,A
DJNZ R7,L0024
SJMP L004d
DB 01H,02H,04H,08H,010H,020H,040H,080H
DB 090H,01H,020H
L004d: CLR A
MOV R6,#01H
MOVC A,@A+DPTR
JZ L000f
INC DPTR
MOV R7,A
ANL A,#03fH
JNB 0e5H,L0063
ANL A,#01fH
MOV R6,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JZ L0063
INC R6
L0063: XCH A,R7
ANL A,#0c0H
ADD A,A
JZ L0012
JC L0024
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R2,A
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
L0074: CLR A
MOVC A,@A+DPTR
INC DPTR
XCH A,R0
XCH A,DPL
XCH A,R0
XCH A,R2
XCH A,DPH
XCH A,R2
MOVX @DPTR,A
INC DPTR
XCH A,R0
XCH A,DPL
XCH A,R0
XCH A,R2
XCH A,DPH
XCH A,R2
DJNZ R7,L0074
DJNZ R5,L0074
SJMP L004d
DB 0e5H,08H,070H,076H,0e5H,09H,024H,0feH
DB 060H,024H,014H,060H,03bH,014H,060H,052H
DB 024H,03H,070H,066H,0d2H,080H,0d2H,081H
DB 0c2H,082H,0c2H,083H,0d2H,084H,0d2H,085H
DB 07fH,0d0H,07eH,07H,012H,01H,0aH,075H
DB 08H,00H,075H,09H,02H,022H,07fH,0c8H
DB 07eH,00H,012H,01H,0aH,0b2H,081H,05H
DB 0aH,0e5H,0aH,064H,0aH,070H,03bH,0e4H
DB 0f5H,0aH,0f5H,08H,075H,09H,03H,022H
DB 0c2H,080H,0d2H,081H,0d2H,082H,0d2H,083H
DB 0d2H,084H,0c2H,085H,07fH,0d0H,07eH,07H
DB 012H,01H,0aH,075H,08H,00H,075H,09H
DB 04H,022H,07fH,0c8H,07eH,00H,012H,01H
DB 0aH,0b2H,084H,05H,0aH,0e5H,0aH,0b4H
DB 0aH,08H,0e4H,0f5H,0aH,0f5H,08H,075H
DB 09H,01H,022H,0efH,01fH,0aaH,06H,070H
DB 01H,01eH,04aH,060H,0bH,07dH,078H,0edH
DB 0d3H,094H,00H,040H,0eeH,01dH,080H,0f7H
DB 022H
L0120: DB 01H,0aH,00H,02H,08H,00H,01H,00H
L0128: LCALL L008f
DB 00H,08fH,080H,0fbH
END
LJMP L0003
L0003: MOV R0,#07fH
CLR A
L0006: MOV @R0,A
DJNZ R0,L0006
MOV SP,#0aH
INC R2
LJMP L004a
L000f: LJMP L0128
L0012: CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
L0016: CLR A
MOVC A,@A+DPTR
INC DPTR
JC L001e
MOV @R0,A
SJMP L001f
L001e: MOVX @R0,A
L001f: INC R0
DJNZ R7,L0016
SJMP L004d
ADD A,R1
L0024: CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
ANL A,#07H
ADD A,#0cH
XCH A,R0
CLR C
RLC A
SWAP A
ANL A,#0fH
ORL A,#020H
XCH A,R0
MOVC A,@A+PC
JC L003c
CPL A
ANL A,@R0
SJMP L003d
L003c: ORL A,@R0
L003d: MOV @R0,A
DJNZ R7,L0024
SJMP L004d
DB 01H,02H,04H,08H,010H,020H,040H,080H
DB 090H,01H,020H
L004d: CLR A
MOV R6,#01H
MOVC A,@A+DPTR
JZ L000f
INC DPTR
MOV R7,A
ANL A,#03fH
JNB 0e5H,L0063
ANL A,#01fH
MOV R6,A
CLR A
MOVC A,@A+DPTR
INC DPTR
JZ L0063
INC R6
L0063: XCH A,R7
ANL A,#0c0H
ADD A,A
JZ L0012
JC L0024
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R2,A
CLR A
MOVC A,@A+DPTR
INC DPTR
MOV R0,A
L0074: CLR A
MOVC A,@A+DPTR
INC DPTR
XCH A,R0
XCH A,DPL
XCH A,R0
XCH A,R2
XCH A,DPH
XCH A,R2
MOVX @DPTR,A
INC DPTR
XCH A,R0
XCH A,DPL
XCH A,R0
XCH A,R2
XCH A,DPH
XCH A,R2
DJNZ R7,L0074
DJNZ R5,L0074
SJMP L004d
DB 0e5H,08H,070H,076H,0e5H,09H,024H,0feH
DB 060H,024H,014H,060H,03bH,014H,060H,052H
DB 024H,03H,070H,066H,0d2H,080H,0d2H,081H
DB 0c2H,082H,0c2H,083H,0d2H,084H,0d2H,085H
DB 07fH,0d0H,07eH,07H,012H,01H,0aH,075H
DB 08H,00H,075H,09H,02H,022H,07fH,0c8H
DB 07eH,00H,012H,01H,0aH,0b2H,081H,05H
DB 0aH,0e5H,0aH,064H,0aH,070H,03bH,0e4H
DB 0f5H,0aH,0f5H,08H,075H,09H,03H,022H
DB 0c2H,080H,0d2H,081H,0d2H,082H,0d2H,083H
DB 0d2H,084H,0c2H,085H,07fH,0d0H,07eH,07H
DB 012H,01H,0aH,075H,08H,00H,075H,09H
DB 04H,022H,07fH,0c8H,07eH,00H,012H,01H
DB 0aH,0b2H,084H,05H,0aH,0e5H,0aH,0b4H
DB 0aH,08H,0e4H,0f5H,0aH,0f5H,08H,075H
DB 09H,01H,022H,0efH,01fH,0aaH,06H,070H
DB 01H,01eH,04aH,060H,0bH,07dH,078H,0edH
DB 0d3H,094H,00H,040H,0eeH,01dH,080H,0f7H
DB 022H
L0120: DB 01H,0aH,00H,02H,08H,00H,01H,00H
L0128: LCALL L008f
DB 00H,08fH,080H,0fbH
END
机器语言看不到!我们基本都有C语言写程序
太多了 忘啦!
看不懂了,但是建议你加中文注释,这个很重要。
看C
汇编啊?十有八九是学校老师要求学习的吧?考试要求你就学。不然趁着精力足,快快溜号。汇编,好恐怖。
汇编好久没有弄了,刚开始的时候感觉汇编还是很好弄得,但是学了c就没弄过汇编,总感觉你的跳转有问题,查汇编最好的方法就是按照汇编指令一步步的查,看你的跳转会到哪里,最起码我没找到 LJMP L004a跳转到哪里了!
10年前用汇编做产品,现在都用C,不愿再承受汇编那种痛苦。
难道C语言就是万能的?感觉C语言学起来太啰嗦。
汇编这东西我刚开始学的时候也没感觉怎么难,但是要记住好多的命令,寄存器,还有各种中断的入口,比较费脑子,不过写的过程只要能清晰了,还是不错的!
用C吧
汇编注释很重要,能帮助你和别人更容易读懂,没注释没兴趣看下去