dianzi.asm

来自「电子钟.rar包括原理图和程序。用51单片机实现」· 汇编 代码 · 共 105 行

ASM
105
字号

	hour	equ	40h
	mint	equ	41h
	scnd	equ	42h
	hour_1	equ	43h
	hour_2	equ	44h
	mint_1	equ	45h
	mint_2	equ	46h
	latch	equ
	key1	equ	
	adds	equ

	org 	0
	jmp	main
	org	0bh
	jmp	int_t0


main:	mov	r2,#7
	mov	r0,#40h
	mov	a,#0
	mo
start:	mov	@r0,a
	djnz	r2,start

	mov	tmod,#02h
1s:	mov	r3,#20
	mov	th0,#
	mov	tl0,#	;!
	setb	ea
	setb	et0
	setb	tr0
	djnz	r3,1s
	inc	scnd
	call	desplay
	cjne	scnd,#60,1s
	mov	scnd,#0
	inc	mint
	call	desplay
	cjne	mint,#60,1s
	mov	mint,#0
	inc	hour
	call	desplay
	cjne	hour,#24,1s
	mov	hour,#0
	call	key
	


	

desplay:mov	a,hour
	mov	b,#10
	div	ab
	mov	hour_1,a	;!
	mov	hour_2,b

	mov	a,mint
	mov	b,#10
	div	ab
	mov	mint_1,a	;!
	mov	mint_2,b

	mov	r4,#4
	mov	r5,#43h
	mov	47h,#011111111b

play:	mov	a,@r5
	mov	sbuf,a
	mov	a,47h
	mov	sbuf,a
	clr	latch
	setb	latch
	call	delay
	inc	r5
	rr	a
	mov	47h,a
	djnz	r4,play
	ret



key:	jnb	key1,$
	call	delay1
	jnb	key1,key
	inc	48h
	cjne	48h,#1,to_2
	jmp	real time_hour
to_2:	cjne	48h,#2,to_3
	jmp	real time_mint
to_3:	cjne	48h,#3,to_4
	jmp	alarm time_hour
to_4:	cjne	48h,#4,to_5
	jmp	alarm time_mint
	cjne	48h,#5,to_5
	mov	48h,#0
to_5:	ret

	





⌨️ 快捷键说明

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