我在汇编中为intel 8051制作了一个程序。程序编译正常,在模拟器中执行正常,但它不显示端口上的任何输出。输出端口只是空的。
以下是代码:
ORG 00H
MOV P1, #00H
MOV P2, #00H
MOV P3, #00H
mov R4, #00h
TakeInput:
MOV R3,#0H
JB P3.4, TakeOperation
DJNZ R3,TakeInput
MOV R0, P1
MOV R1, P2
MOV P2, #00H
TakeOperation:
mov p2,#00h
jb p3.5,CheckFunction
sjmp TakeOperation
CheckFunction:
mov P3,#00h
Mov R5,P2
CJNE R5,#02H,ADDT
ajmp end
ADDT:
MOV A,R0
ADD A, R1
MOV P3, A
SJMP CheckFunction
输出没有在端口显示我做错了什么? 此致
答案 0 :(得分:0)
比较两个Rx
寄存器:
MOV A,R0
CJNE A,01h,r0_r1_not_equal ; Assumes that you're using register bank 0
; take action based on R0==R1
; ...
SJMP done
r0_r1_not_equal:
; take action based on R0!=R1
; ...
done: