相关代码 |
|
;PROGRAM NAME:12-5-4.ASM $MOD51 BUFFER DATA 20H DEBUG1 EQU 1 ;除错完毕后把1改为0 SCOPE_CH1 EQU P3.7 ;接到示波器CH1上观察 ; ORG 0000H MOV SP,#50H ;设定堆栈 MOV A,#00H ;累加器=00H MOV BUFFER,A ;(20H)=00H LOOP: MOV P1,BUFFER ;P1=(BUFFER) INC BUFFER ;将BUFFER内容加上1 IF (DEBUG1) SETB SCOPE_CH1 ;CHECK POINT=1 ENDIF LCALL DELAY ;延迟一小段时间 IF (DEBUG1) CLR SCOPE_CH1 ;CHECK POINT=0 ENDIF SJMP LOOP ;ROUTINE ;单纯时间延迟用 DELAY: MOV R0,#00H DLY: MOV R1,#00H DJNZ R1,$ DJNZ R0,DELAY RET END
相关资源 |
|