0

Hellp My Code Error

;        R1=SECOND     R2=MINUTE     R3=HOUR
		ORG	00H		
		JMP	MAIN
		ORG	03H
		JMP	INT_1
		ORG	13H
		JMP	INT_2
		ORG	30H
MAIN:	MOV		IE,#85H
		SETB	TCON.0
		SETB	TCON.2
		MOV		R1,#00H
		MOV		R2,#00H
		MOV		R3,#00H
;********  DELAY FOR 1 SECOND ****************		

DELAY PROC FAR
START:	MOV		TMOD,#01H
		MOV		R0,#16	
NEW:	MOV		TL0,#0DCH
		MOV		TH0,#0BH
		SETB	TR0
AGAIN:	JNB		TF0,AGAIN
		CLR		TR0
		CLR		TF0
		JNZ	R0,NEW
DELAY END		
;****************************************************
		CALL	CONV
		CALL	DISPLAY
		INC		R1
		JNE	R1,#60,START
		MOV		R1,#00
		INC		R2
		JNE	R2,#60,START
		MOV		R2,#00
		INC		R3
		JNE	R3,#24,START
		MOV		R3,#00
		JMP	START
;MAKE SECOND VALUES TO BCD IN  64H , 65H
CONV:	MOV		A,R1
		MOV		B,#10
		DIV		AB
		MOV		65H,B
		MOV		B,#10
		DIV		AB
		MOV		64H,B
;MAKE MINUTE VALUES TO BCD IN  62H , 63H
		MOV		A,R2
		MOV		B,#10
		DIV		AB
		MOV		63H,B
		MOV		B,#10
		DIV		AB
		MOV		62H,B
;MAKE HOUR VALUES TO BCD IN  60H , 61H
		MOV		A,R3
		MOV		B,#10
		DIV		AB
		MOV		61H,B
		MOV		B,#10
		DIV		AB
		MOV		60H,B
;CONVERSION ALL VALUES TO ASCII
		MOV		A,60H
		ORL		A,#30H
		MOV		60H,A
		MOV		A,61H
		ORL		A,#30H
		MOV		61H,A
		MOV		A,62H
		ORL		A,#30H
		MOV		62H,A
		MOV		A,63H
		ORL		A,#30H
		MOV		63H,A
		MOV		A,64H
		ORL		A,#30H
		MOV		64H,A
		MOV		A,65H
		ORL		A,#30H
		MOV		65H,A
		RET
; DISPLAY WATCH VALUES ON LCD
DISPLAY:
		MOV		A,#38H
		CALL	COMMAND
		MOV		A,#0CH
		CALL	COMMAND
		MOV		A,#01H
		CALL	COMMAND
		MOV		A,#06H
		CALL	COMMAND
		MOV		A,#85H
		CALL	COMMAND
		MOV		A,60H
		CALL	DATA_DISPLAY
		MOV		A,61H
		CALL	DATA_DISPLAY
		MOV		A,#':'
		CALL	DATA_DISPLAY
		MOV		A,62H
		CALL	DATA_DISPLAY
		MOV		A,63H
		CALL	DATA_DISPLAY
		MOV		A,#':'
		CALL	DATA_DISPLAY
		MOV		A,64H
		CALL	DATA_DISPLAY
		MOV		A,65H
		CALL	DATA_DISPLAY
		RET
COMMAND:	
		CALL	READY
		MOV		P1,A
		CLR		P2.0
		CLR		P2.1
		SETB	P2.2
		CLR		P2.2
		RET
DATA_DISPLAY:
		CALL	READY
		MOV		P1,A
		SETB	P2.0
		CLR		P2.1
		SETB	P2.2
		CLR		P2.2
		RET
READY:
		SETB	P1.7
		CLR		P2.0
		SETB	P2.1
BACK: 	CLR		P2.2
		SETB	P2.2
		JB		P1.7,BACK
		RET
;***************************************************
INT_1:   	INC		R2
		JNE	R2,#60,UP
		MOV		R2,#00
UP:		CALL	DELAY				
		RET I
INT_2:	INC		R3
		JNE	R3,#24,UP
		MOV		R3,#00
UP:		CALL	DELAY
		RET I
;***************************************************
DELAY:	MOV		R4,#07
		MOV		TMOD,#10H
OVER1:	MOV		TL1,#00
		MOV		TH1,#00
		SETB	TR1
HERE1:	JNB		TF1,HERE1
		CLR		TR1
		CLR		TF1
		JNZ	    R4,OVER1
		RET
		END
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Goalatio
0

Well, it's hard to help you fix an error when you don't tell us what the error is . . .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.