下面的程序用汇编语言怎么写,哪位高手能帮忙解答一下,谢谢了。。。

2024-12-25 14:37:31
推荐回答(2个)
回答1:

51单片机的汇编:

CLR C
MOV A, sheding
SUBB A, avgl
JZ DENGYU
JC XIAOYU

MOV zhengzhuan, #1 ;大于
MOV fanzhuan, #0
JMP NEXT

DENGYU: ;等于
MOV zhengzhuan, #0
MOV fanzhuan, #0
JMP NEXT

XIAOYU: ;小于
MOV zhengzhuan, #0
MOV fanzhuan, #1

NEXT: ;退出
……

回答2:

CMPAV:MOV A ,sheding
CJNE A ,avgl , LARGE
MOV zhengzhuan,#0
MOV fanzhuan ,#0
RET
LARGE:JC SMALL
MOV zhengzhuan,#1
MOV fanzhuan ,#0
RET
SMALL:MOV zhengzhuan,#0
MOV fanzhuan ,#1
RET