;TITOLO: CONVERTITORE BCD=>7 SEGMENTI
;|-------------------------TABELLA VARIABILI--------------------------|
;|								      |
;|P3.0 / P3.3 => INGRESSO DATI 0 = NON ATTIVO; 1 = ATTIVO	      |
;|P1.0 / P1.7 => USCITA DISPLAY 0 = ATTIVO; 1 = NON ATTIVO	      |
;|--------------------------------------------------------------------|


	$MOD51
	ORG 1000H
        mov p3,#15
	mov a,p3
START:	CJNE A,#0,PROX		;0
	MOV P1,#11000000B
	CALL RIT
	JMP START
PROX:	CJNE A,#1,PROX2		;1
	MOV P1,#11111001B
	CALL RIT
	JMP START
PROX2:	CJNE A,#2,PROX3		;2
	MOV P1,#10100100B
	CALL RIT
	JMP START
PROX3:	CJNE A,#3,PROX4		;3
	MOV P1,#10110000B
	CALL RIT
	JMP START
PROX4:	CJNE A,#4,PROX5		;4
	MOV P1,#10011001B
	CALL RIT
	JMP START
PROX5:	CJNE A,#5,PROX6		;5
	MOV P1,#10010010B
	CALL RIT
	JMP START
PROX6:	CJNE A,#6,PROX7		;6
	MOV P1,#10000011B
	CALL RIT
	JMP START
PROX7:	CJNE A,#7,PROX8		;7
	MOV P1,#11111000B
	CALL RIT
	JMP START
PROX8:	CJNE A,#8,PROX9		;8
	MOV P1,#10000000B
	CALL RIT
	JMP START
PROX9:	CJNE A,#9,PROX10	;9
	MOV P1,#10011000B
	CALL RIT
	JMP START
PROX10:	CJNE A,#10,PROX11	;10
	MOV P1,#10001000B
	CALL RIT
	JMP START
PROX11:	CJNE A,#11,PROX12	;11
	MOV P1,#10100001B
	CALL RIT
	JMP START
PROX12:	CJNE A,#12,PROX13	;12
	MOV P1,#11000110B
	CALL RIT
	JMP START
PROX13:	CJNE A,#13,PROX14	;14
	MOV P1,#10100011B
	CALL RIT
	JMP START
PROX14:	CJNE A,#14,PROX15	;15
	MOV P1,#10000110B
	CALL RIT
	JMP START
PROX15:	MOV P1,#10001110B
	CALL RIT
	JMP START
RIT:	MOV R1,#100
RIT3:	MOV R2,#100
RIT2:	MOV R3,#50
	DJNZ R3,$
	DJNZ R2,RIT2
	DJNZ R1,RIT3
	RET
	END