指示灯.txt

来自「关于单片机中流水线处理,红绿灯转化等实验」· 文本 代码 · 共 46 行

TXT
46
字号
	org	0000H
	jmp	MAIN
;************************************
	org	0030H
MAIN:

MAIN_LOOP:
	mov	p1,#0FFH	;shutdown all led
	call	DELAY

	clr	p1.0	;right the L1
	call	DELAY
	clr	p1.1	;right the L2
	call	DELAY
	clr	p1.2
	call	DELAY
	clr	p1.3
	call	DELAY
	clr	p1.4
	call	DELAY
	clr	p1.5
	call	DELAY
	clr	p1.6
	call	DELAY
	clr	p1.7
	call	DELAY

	ljmp	MAIN_LOOP	;next loop

	ret
;***************************************************
;delay for a interval
DELAY:
	mov	R6,#0FFH
DELAY_1:
	mov	R7,#0FFH
DELAY_0:
	nop
	nop
	djnz	R7,DELAY_0

	djnz	R6,DELAY_1

	ret
;******************************************************
	END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?