我无法找出问题所在。它在 edsim51 中显示“未知标签 - 延迟”
Org 00h
Main:
Mov A, #0FEh
Mov P1, A
Acall Delay
Mov A, #0FFh
Mov P1, A
Acall Delay
Djnz R1, Main ; Repeat the code until R1 becomes zero
End
我无法找出问题所在
您没有提供子例程
Delay
,因此汇编器/链接器无法将标签解析为地址。
解决方案是提供子例程,作为单独的源代码模块,或在同一源代码中。
您的代码中缺少 Delay 子例程。
Org 00h
Main:
Mov A, #0FEh
Mov P1, A
Acall Delay
Mov A, #0FFh
Mov P1, A
Acall Delay
;you forgot to give the R1 an initial value
Djnz R1, Main ; Repeat the code until R1 becomes zero
;If R1 equals zero halt the system
JMP HALT
;For example this is a delay for 1 Microsecond while using FREQUENCY 11.0592MHZ
Delay:
MOV R6,#2D ;10uS delay
DJNZ R6, $ ;'$' mean to jump on the same line
RET
HALT:
JMP $
End
另外,不要忘记为您在“Djnz R1,Main”中使用的 R1 提供初始值