;EXAM6 .ASM
;SIMPLE TEST 7 SEGMENT 2 DIGIT
;
	ORG	00H

;Set Common LED ON
	CLR	P3.2		;SEGMENT 2 ON
	CLR	P3.3		;SEGMENT 1 ON

MAIN:	MOV	R5,#10		;LOAD COUNT OFF BYTE
	MOV	DPTR,#SEGTBL	;LOAD TABLE POINTER
LOOP:	CLR	A
	MOVC	A,@A+DPTR
	MOV	P1,A
	LCALL	DELAY
	INC	DPTR		;INC POINTER
	DJNZ	R5,LOOP		;DEC COUNTER R3


	SJMP	MAIN


DELAY: 	MOV    R2,#8		;wait 0.8 sec
	LCALL  DTSEC		;call delay in 1/10 second input in R2
	RET

; ********** DTSEC SUB **********
; DELAY	1/10 SECOND
; IN  =	R2
; REG =	R2,R3,R4

DTSEC:	MOV	R3,#179
DTSEC1:	MOV	R4,#0
DTSEC2:	DJNZ	R4,DTSEC2
	NOP
	NOP
	DJNZ	R3,DTSEC1
	DJNZ	R2,DTSEC
	RET


SEGTBL:	DB	0C0H,0F9H,0A4H,0B0H,99H
	DB	92H,82H,0F8H,80H,90H
	END

