初学汇编语言请大侠点拨。
以下我的程序
ORG 0000H
LJMP MAIN
ORG 0100H
MAIN:MOV A,#01H
MOV R1,#FFH
MOV R2,#08H
DJNz R1,$
DJNz R2,delay
RR A
MOV P0,A
RET
结果在Keil uVision2中编释后报错如:
1\Text1.asm(2): error A45: UNDEFINED SYMBOL (PASS-2)
1\Text1.asm(4): error A9: SYNTAX ERROR
1\Text1.asm(4): error A3: ILLEGAL CHARACTER
1\Text1.asm(4): error A3: ILLEGAL CHARACTER
1\Text1.asm(4): error A3: ILLEGAL CHARACTER
1\Text1.asm(4): error A3: ILLEGAL CHARACTER
1\Text1.asm(5): error A9: SYNTAX ERROR
1\Text1.asm(5): error A9: SYNTAX ERROR
1\Text1.asm(5): error A9: SYNTAX ERROR
1\Text1.asm(8): error A45: UNDEFINED SYMBOL (PASS-2)
1\Text1.asm(11): warning A41: MISSING 'END' STATEMENT
答案:ORG 0000H
LJMP MAIN
ORG 0100H
MAIN:MOV A,#01H //这个逗号输入法是错的
delay:MOV R1,#0FFH //这个逗号输入法是错的,还有立即数改为0FFH ,再加个delay就对了
MOV R2,#08H
DJNz R1,$
DJNz R2,delay
RR A
MOV P0,A
RET
其他:ORG 0000H
LJMP MAIN
ORG 0080H
MAIN:MOV A,#01H
MOV R2,#08H
D:
RR A
MOV P0,A
CALL delay
DJNZ R2,D
ORG 0160h
delay: MOV R1,#00H
D1: MOV R3,#00h
D2: DJNZ R3,D2
DJNZ R1,D1
RET
END
//你是不是想写流水灯啊,P0口要上拉电阻哦。
上一个:汇编求高手请教个问题
下一个:中文分词系统简易实现办法php简易分词源码