单片机第一个代码

2019-07-14 00:22发布

完成从20H、30H开始的10字节相加,相加的结果依次赋给30H开始的单元。 ORG 0000H MAIN: MOV 30H,#22H ;赋初值 MOV 31H,#22H MOV 32H,#22H MOV 33H,#22H MOV 34H,#22H MOV 35H,#22H MOV 36H,#22H MOV 37H,#22H MOV 38H,#22H MOV 39H,#22H MOV 20H,#00H MOV 21H,#01H MOV 22H,#02H MOV 23H,#03H MOV 24H,#04H MOV 25H,#05H MOV 26H,#06H MOV 27H,#07H MOV 28H,#08H MOV 29H,#09H MOV R0,#30H MOV R1,#20H MOV R2,#0AH LOOP: MOV A,@R0 //寄存器间接寻址 ADDC A,@R1 MOV @R0,A INC R0 INC R1 DJNZ R2,LOOP END