You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

EdSim51仿真8051单片机时出现Unknown Label - DELAY错误求助

解决EdSim51仿真8051时“Unknown Label - DELAY”错误
  • 错误根源:你用Acall Delay调用了延时子程序,但整个代码里没有定义Delay这个标签,汇编器找不到对应的子程序,所以抛出这个错误。另外你用了Djnz R1, Main循环,但没给R1初始化赋值,会导致循环次数不可控。

  • 修正后的代码(添加Delay子程序+初始化R1):

Org 00h

Main:
    Mov R1, #10h  ; 初始化循环次数,可根据需求调整
    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

; 定义延时子程序
Delay:
    Mov R2, #0FFh
Delay_Loop:
    Djnz R2, Delay_Loop
    Ret

End

内容的提问来源于stack exchange,提问作者Arman Mollick

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 08:54:53