Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
631 B
2
Indexable
Never
org 0000h

MAIN:
		MOV 	TMOD,#02h 	; chon Timer 0, che do 2
HERE:	
		CPL		P1.6
		ACALL	DELAY
		SJMP	HERE2		; nap lai TH, TL
		RET
HERE2:
		CPL		P1.6
		ACALL	DELAY2
		SJMP	HERE		; nap lai TH, TL
		RET
; tao tre
DELAY: 
		MOV 	TH0, #0E6h
		MOV 	TL0, #0E6h
		SETB 	TR0 			; khoi dong Timer
AGAIN: 	JNB 	TF0, AGAIN 		; kiem tra co Timer da tran chua
		CLR 	TR0 			; xóa TR0
		CLR 	TF0 			; xoa TF0
		RET
DELAY2: 
		MOV 	TH0, #046h
		MOV 	TL0, #046h
		SETB 	TR0 			; khoi dong Timer
AGAIN2: 	JNB 	TF0, AGAIN2 		; kiem tra co Timer da tran chua
		CLR 	TR0 			; xóa TR0
		CLR 	TF0 			; xoa TF0
		RET
end
Leave a Comment