org 0h
jmp start
;subrotine delay time
delay: mov r4,#2
delay1: mov r5,#180
delay2: mov r6,#225
delay3: djnz r6,delay3
djnz r5,delay2
djnz r4,delay1
ret
start: mov r0,#0
mov r1,#0
cek1: jb p1.0,cek2
lcall delay
mov a,r0
lcall disp
mov p0,a
lcall delay
inc r0
mov a,r0
cjne a,#10,cek1
jmp start
cek2: jb p1.1,cek1
lcall delay
mov a,r1
lcall disp
mov p2,a
lcall delay
inc r1
mov a,r1
mov r0,#0
cjne a,#10,cek2
lcall delay
jmp start
;subroutine ini digunakan untuk menmpilkan digit
disp: inc a
movc a,@a+pc
ret
;=================================
;Data 7segment common anode
db 0C0h ;digit 0
db 0F9h ;digit 1
db 0A4h ;digit 2
db 0B0h ;digit 3
db 99h ;digit 4
db 92h ;digit 5
db 83h ;digit 6
db 0F8h ;digit 7
db 80h ;digit 8
db 98h ;digit 9
;=================================
end ;program berakhir
No comments:
Post a Comment