Hasil Videonya https://www.youtube.com/watch?v=cseiySal-s4
Kode Asmnya :
SP1 BIT P3.6
SP2 BIT P3.7
ORG 00H
AJMP MAIN
ORG 30H
MAIN:
CLR SP1
CLR SP2
K1:
LCALL DISP
JNB SP1,K2
LCALL DISP
JB SP1,$-3
INC 30H
MOV A,30H
CJNE A,#10,K1
MOV 30H,#0
INC 31H
MOV A,31H
CJNE A,#10,K1
MOV 31H,#0
INC 32H
MOV A,32H
CJNE A,#10,K1
MOV 32H,#0
LJMP MAIN
K2:
ACALL DISP
JNB SP2,K1
LCALL DISP
JB SP2,$-3
DEC 30H
MOV A,30H
CJNE A,#0FFH,K2
MOV 30H,#9
DEC 31H
MOV A,31H
CJNE A,#0FFH,K2
MOV 31H,#9
DEC 32H
MOV A,32H
CJNE A,#0FFH,K2
MOV 32H,#9
LJMP MAIN
DISP:
MOV DPTR,#TAB
MOV A,30H
MOVC A,@A+DPTR
SETB P2.2
MOV P0,A
ACALL DLY
CLR P2.2
MOV A,31H
MOVC A,@A+DPTR
SETB P2.1
MOV P0,A
ACALL DLY
CLR P2.1
MOV A,32H
MOVC A,@A+DPTR
SETB P2.0
MOV P0,A
ACALL DLY
CLR P2.0
RET
DLY:
MOV R6,#2
D1:
MOV R7,#248
DJNZ R7,$
DJNZ R6,$-4
RET
TAB: DB 0C0H;0
DB 0F9H;1
DB 0A4H;2
DB 0B0H;3
DB 099H;4
DB 092H;5
DB 082H;6
DB 0F8H;7
DB 080H;8
DB 090H;9
END
yg pake bahasa c sdcc ada bang?..
ReplyDelete