code led trai tim
;*********************************************START***********************************************
#include <sfr51.inc>
org000h
td:movr0,#7h
movr1,#7h
lan1:
movp0,#0ffh
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
lcalldelay
movp0,#0
movp1,#0
movp2,#0
movp3,#0
lcalldelay
djnzr0,lan1
lan2:movp0,#0aah
movp1,#0aah
movp2,#0aah
movp3,#0aah
lcalldelay
movp0,#55h
movp1,#55h
movp2,#55h
movp3,#55h
lcalldelay
djnzr1,lan2
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan3:clrc
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan3
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan4:clrc
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
lcalldelay
jclan4
movp0,#0
movp1,#0
movp2,#0
movp3,#0
lcalldelay
lan5:setbc
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan5
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
movp0,0
lcalldelay
movp2,0
lcalldelay
movp3,0
lcalldelay
movp1,0
lcalldelay
movp0,0
movp2,0
lcalldelay
movp0,0
movp3,0
lcalldelay
movp1,#0
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
movp1,#0ffh
movp3,#0
movp2,#0ffh
movp0,#0ffh
movp1,#0ffh
movp3,#0ffh
movp2,#0
movp0,#0ffh
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0
movp1,#0
movp3,#0
movp2,#0ffh
movp0,#0ffh
movp1,#0ffh
movp3,#0ffh
movp2,#0
movp0,#0
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
movp1,#0
movp3,#0
movp2,#0
movp0,#0
lcalldelay
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan5b:clrc
mova,p1
rlca
movp1,a
clrc
mova,p3
rlca
movp3,a
clrc
mova,p2
rlca
movp2,a
clrc
mova,p0
rrca
movp0,a
lcalldelay
jclan5b
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan6:clrc
mova,p1
rrca
movp1,a
clrc
mova,p3
rrca
movp3,a
clrc
mova,p2
rrca
movp2,a
clrc
mova,p0
rlca
movp0,a
lcalldelay
jclan6
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
movp0,#0ffh
lcalldelay
lan7:clrc
mova,p1
rrca
movp1,a
clrc
mova,p3
rrca
movp3,a
clrc
mova,p2
rrca
movp2,a
clrc
mova,p0
rrca
movp0,a
lcalldelay
jclan7
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan8:clrc
mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
clrc
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan8
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan9:clrc
mova,p3
rrca
movp3,a
clrc
mova,p2
rlca
movp2,a
clrc
mova,p1
rlca
movp1,a
clrc
mova,p0
rlca
movp0,a
lcalldelay
jclan9
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan10:clrc
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
clrc
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
lcalldelay
jclan10
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan11:clrc
mova,p1
rrca
movp1,a
clrc
mova,p0
rrca
movp0,a
lcalldelay
jclan11
lan12:clrc
mova,p3
rrca
movp3,a
clrc
mova,p2
rlca
movp2,a
lcalldelay
jclan12
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan13:clrc
mova,p2
rrca
movp2,a
mova,p3
rrca
movp3,a
clrc
mova,p0
rrca
movp0,a
mova,p1
rlca
movp1,a
lcalldelay
jclan13
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan14:clrc
mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
clrc
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan14
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan15:clrc
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
clrc
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
lcalldelay
jclan15
movp0,#0ffh
movp1,#7fh
movp2,#0ffh
movp3,#0feh
clr05h
clr06h
lan16:lcalldelay
clrc
cpl05h ; cpl :lenh bu bit 05h
movc,05h
mova,p3
rlca
movp3,a
mova,p2
rlca
movp2,a
clrc
cpl06h
movc,06h
mova,p1
rrca
movp1,a
mova,p0
rlca
movp0,a
jclan16
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan17:clrc
mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
clrc
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan17
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan18:clrc
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
clrc
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
lcalldelay
jclan18
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan19:clrc
mova,p3
rlca
movp3,a
mova,p2
rlca
movp2,a
clrc
mova,p1
rrca
movp1,a
mova,p0
rlca
movp0,a
lcalldelay
jclan19
movp1,#0feh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
clr20h
clrc
lan20:cpl20h
movc,20h
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan20
movp0,#0ffh
movp1,#0ffh
movp2,#0feh
movp3,#7fh
clr05h
clr06h
lan21:lcalldelay
clrc
cpl05h
movc,05h
mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
clrc
cpl06h
movc,06h
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
jclan21
movp3,#0ffh
movp2,#0ffh
movp1,#0ffh
movp0,#0ffh
lcalldelay
lan22:clrc
mova,p3
rlca
movp3,a
clrc
mova,p2
rrca
movp2,a
lcalldelay
jclan22
lcalldelay
lan23:clrc
mova,p1
rlca
movp1,a
clrc
mova,p0
rlca
movp0,a
lcalldelay
jclan23
movp3,#0ffh
movp1,#0ffh
movp0,#7fh
movp2,#7fh
clr05h
clr06h
lan24:lcalldelay
clrc
cpl05h
movc,05h
mova,p2
rrca
movp2,a
mova,p3
rrca
movp3,a
clrc
cpl06h
movc,06h
mova,p0
rrca
movp0,a
mova,p1
rlca
movp1,a
jclan24
movr3,#4
lan25:movp0,#0aah
movp1,#0aah
movp2,#0aah
movp3,#0aah
lcalldelay
movp0,#55h
movp1,#55h
movp2,#55h
movp3,#55h
lcalldelay
djnzr3,lan25
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan26:clrc
mova,p2
rrca
movp2,a
clrc
mova,p0
rrca
movp0,a
clrc
mova,p3
rrca
movp3,a
clrc
mova,p1
rlca
movp1,a
lcalldelay
jclan26
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan27:clrc
mova,p2
rlca
movp2,a
clrc
mova,p0
rlca
movp0,a
clrc
mova,p3
rlca
movp3,a
clrc
mova,p1
rrca
movp1,a
lcalldelay
jclan27
movp1,#0feh
movp3,#0ffh
movp2,#0ffh
movp0,#0feh
lcalldelay
clr20h
clr22h
lan28:clrc
cpl20h
movc,20h
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
clrc
cpl22h
movc,22h
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
lcalldelay
jclan28
movr4,#4
lan29:movp3,#0ffh
movp2,#0ffh
movp1,#0ffh
movp0,#0ffh
lcalldelay
lan30:clrc
mova,p3
rrca
movp3,a
clrc
mova,p1
rlca
movp1,a
clrc
mova,p0
rlca
movp0,a
clrc
mova,p2
rlca
movp2,a
lcalldelay
jclan30
movp3,#0ffh
movp2,#0ffh
movp1,#0ffh
movp0,#0ffh
lcalldelay
lan31:clrc
mova,p3
rlca
movp3,a
clrc
mova,p0
rrca
movp0,a
clrc
mova,p1
rrca
movp1,a
clrc
mova,p2
rrca
movp2,a
lcalldelay
jclan31
djnzr4,lan29
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lan32:clrc
mova,p2
rlca
movp2,a
lcalldelay
jclan32
lan33:clrc
mova,p1
rrca
movp1,a
mova,p0
rlca
movp0,a
lcalldelay
jclan33
lan34:clrc
mova,p3
rlca
movp3,a
lcalldelay
jclan34
movp1,#0ffh
movp3,#0ffh
movp2,#0ffh
movp0,#0ffh
lcalldelay
lan35:clrc
mova,p3
rrca
movp3,a
lcalldelay
jclan35
lan36:clrc
mova,p0
rrca
movp0,a
mova,p1
rlca
movp1,a
lcalldelay
jclan36
lan37:clrc
mova,p2
rrca
movp2,a
lcalldelay
jclan37
ckequ10h
slxequ11h
jequ12h
btg0equ13h
btg1equ14h
j2equ15h
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
movck,#8
movj,#0ffh
movj2,#0ffh
lan38:movslx,ck
movbtg0,#0ffh
movbtg1,#0ffh
clrc
lan39:mova,btg0
rlca
movbtg0,a
anla,j
movp1,a
movp2,a
movp3,a
mova,slx
cjnea,ck,lan40
clrc
lan40:mova,btg1
rrca
movbtg1,a
anla,j2
movp0,a
lcalldelay
djnzslx,lan39
movj,p1
movj2,p0
djnzck,lan38
movp0,#1
movp1,#80h
movp2,#80h
movp3,#80h
lcalldelay
movck,#8
movj,#0ffh
movj2,#0ffh
lan41:movslx,ck
movbtg0,#0ffh
movbtg1,#0ffh
clrc
lan42:mova,btg0
rrca
movbtg0,a
anla,j
movp1,a
movp2,a
movp3,a
mova,slx
cjnea,ck,lan43
clrc
lan43:mova,btg1
rlca
movbtg1,a
anla,j2
movp0,a
lcalldelay
djnzslx,lan42
movj,p1
movj2,p0
djnzck,lan41
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan42b:clrc
mova,p3
rrca
movp3,a
clrc
mova,p2
rlca
movp2,a
lcalldelay
jclan42b
lan43b:clrc
mova,p1
rlca
movp1,a
clrc
mova,p0
rlca
movp0,a
lcalldelay
jclan43b
ckmequ10h
slxmequ11h
jmequ12h
btequ13h
tg1equ14h
jiequ15h
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
movckm,#8
movjm,#0ffh
movj2,#0ffh
lan47:movslxm,ckm
movbt,#0ffh
movtg1,#0ffh
clrc
lan48:mova,bt
rlca
movbt,a
anla,jm
movp1,a
movp2,a
movp3,a
mova,slxm
cjnea,ckm,lan49
clrc
lan49:mova,tg1
rrca
movtg1,a
anla,ji
movp0,a
lcalldelay
djnzslxm,lan48
movjm,p1
movji,p0
djnzckm,lan47
movp0,#1
movp1,#80h
movp2,#80h
movp3,#80h
lcalldelay
movckm,#8
movjm,#0ffh
movji,#0ffh
lan50:movslxm,ckm
movbt,#0ffh
movtg1,#0ffh
clrc
lan51:mova,bt
rrca
movbt,a
anla,jm
movp1,a
movp2,a
movp3,a
mova,slxm
cjnea,ckm,lan52
clrc
lan52:mova,tg1
rlca
movtg1,a
anla,ji
movp0,a
lcalldelay
djnzslxm,lan51
movjm,p1
movji,p0
djnzckm,lan50
movckm,#8
movj,#0
movji,#0
lan51b:movslxm,ckm
movbt,#0
movtg1,#0
setbc
lan52b:mova,bt
rrca
movbt,a
orla,j
movp1,a
movp2,a
movp3,a
mova,ckm
cjnea,slxm,lan53
setbc
lan53:mova,tg1
rlca
movtg1,a
orla,ji
movp0,a
lcalldelay
djnzslxm,lan52b
movj,p1
movji,p0
djnzckm,lan51b
movr4,#6
lan54:movp0,#0aah
movp1,#0aah
movp2,#0aah
movp3,#0aah
lcalldelay
movp0,#55h
movp1,#55h
movp2,#55h
movp3,#55h
lcalldelay
djnzr4,lan54
movp3,#1fh
movp1,#0ffh
movp2,#0ffh
movp0,#0ffh
movr1,#2
setbc
lan55:mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
lcalldelay
jclan55
setbc
lan56:mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
lcalldelay
jclan56
ck1equ10h
sla1equ11h
m01equ12h
m02equ13h
btg01equ16h
btg02equ17h
m03equ18h
m04equ19h
btg03equ20h
btg04equ21h
movck1,#16
movm01,#0ffh
movm02,#0ffh
movm03,#0ffh
movm04,#0ffh
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan57:movsla1,ck1
movbtg01,#0ffh
movbtg02,#0ffh
movbtg03,#0ffh
movbtg04,#0ffh
clrc
lan58:mova,btg01
rlca
movbtg01,a
anla,m01
movp1,a
mova,btg02
rlca
movbtg02,a
anla,m02
movp3,a
mova,sla1
cjnea,ck1,lan59
clrc
lan59:mova,btg03
rlca
movbtg03,a
anla,m03
movp2,a
mova,btg04
rrca
movbtg04,a
anla,m04
movp0,a
lcalldelay
djnzsla1,lan58
movm01,p1
movm02,p3
movm03,p2
movm04,p0
djnzck1,lan57
movck1,#16
movm01,#0
movm02,#0
movm03,#0
movm04,#0
lan60:movsla1,ck1
movbtg01,#0
movbtg02,#0
movbtg03,#0
movbtg04,#0
setbc
lan61:mova,btg01
rlca
movbtg01,a
orla,m01
movp1,a
mova,btg02
rlca
movbtg02,a
orla,m02
movp3,a
mova,ck1
cjnea,sla1,lan62
setbc
lan62:mova,btg03
rlca
movbtg03,a
orla,m03
movp2,a
mova,btg04
rrca
movbtg04,a
orla,m04
movp0,a
lcalldelay
djnzsla1,lan61
movm01,p1
movm02,p3
movm03,p2
movm04,p0
djnzck1,lan60
kck1equ10h
sxa1equ11h
l01equ12h
l02equ13h
bg01equ16h
bg02equ17h
l03equ18h
l04equ19h
bg03equ20h
bg04equ21h
movkck1,#16
movl01,#0ffh
movl02,#0ffh
movl03,#0ffh
movl04,#0ffh
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan63:movsxa1,kck1
movbg01,#0ffh
movbg02,#0ffh
movbg03,#0ffh
movbg04,#0ffh
clrc
lan64:mova,bg01
rrca
movbg01,a
anla,l01
movp3,a
mova,bg02
rrca
movbg02,a
anla,l02
movp1,a
mova,sxa1
cjnea,kck1,lan65
clrc
lan65:mova,bg03
rlca
movbg03,a
anla,l03
movp0,a
mova,bg04
rrca
movbg04,a
anla,l04
movp2,a
lcalldelay
djnzsxa1,lan64
movl01,p3
movl02,p1
movl03,p0
movl04,p2
djnzkck1,lan63
movkck1,#16
movl01,#0
movl02,#0
movl03,#0
movl04,#0
lan66:movsxa1,kck1
movbg01,#0
movbg02,#0
movbg03,#0
movbg04,#0
setbc
lan67:mova,bg01
rrca
movbg01,a
orla,l01
movp3,a
mova,bg02
rrca
movbg02,a
orla,l02
movp1,a
mova,kck1
cjnea,sxa1,lan68
setbc
lan68:mova,bg03
rlca
movbg03,a
orla,l03
movp0,a
mova,bg04
rrca
movbg04,a
orla,l04
movp2,a
lcalldelay
djnzsxa1,lan67
movl01,p3
movl02,p1
movl03,p0
movl04,p2
djnzkck1,lan66
movp0,#0ffh
movp1,#0ffh
movp2,#0feh
movp3,#7fh
clr05h
clr06h
lan69:lcalldelay
clrc
cpl05h
movc,05h
mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
clrc
cpl06h
movc,06h
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
jclan69
movp0,#0ffh
movp1,#7fh
movp2,#0ffh
movp3,#0feh
clr05h
clr06h
lan70:lcalldelay
clrc
cpl05h
movc,05h
mova,p3
rlca
movp3,a
mova,p2
rlca
movp2,a
clrc
cpl06h
movc,06h
mova,p1
rrca
movp1,a
mova,p0
rlca
movp0,a
jclan70
movp3,#0ffh
movp1,#0ffh
movp0,#7fh
movp2,#7fh
clr05h
clr06h
lan71:lcalldelay
clrc
cpl05h
movc,05h
mova,p2
rrca
movp2,a
mova,p3
rrca
movp3,a
clrc
cpl06h
movc,06h
mova,p0
rrca
movp0,a
mova,p1
rlca
movp1,a
jclan71
movp1,#0feh
movp3,#0ffh
movp2,#0ffh
movp0,#0feh
lcalldelay
clr20h
clr22h
lan72:clrc
cpl20h
movc,20h
mova,p1
rlca
movp1,a
mova,p3
rlca
movp3,a
clrc
cpl22h
movc,22h
mova,p0
rlca
movp0,a
mova,p2
rrca
movp2,a
lcalldelay
jclan72
movp2,#0feh
lcalldelay
clrc
lan73:mova,p2
rlca
movp2,a
lcalldelay
jclan73
clrc
movp0,#7fh
lan74:mova,p0
rrca
movp0,a
lcalldelay
jclan74
clrc
movp1,#0feh
lan75:mova,p1
rlca
movp1,a
lcalldelay
jclan75
clrc
movp3,#0feh
lan76:mova,p3
rlca
movp3,a
lcalldelay
jclan76
movp3,#7eh
clrc
lan77:mova,p3
rrca
movp3,a
lcalldelay
jclan77
movp1,#7eh
clrc
lan78:mova,p1
rrca
movp1,a
lcalldelay
jclan78
movp0,#0feh
clrc
lan79:mova,p0
rlca
movp0,a
lcalldelay
jclan79
movp2,#7fh
clrc
lan80:mova,p2
rrca
movp2,a
lcalldelay
jclan80
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#7fh
lcalldelay
setbc
lan82:mova,p3
rrca
movp3,a
mova,p1
rrca
movp1,a
setbc
mova,p2
rlca
movp2,a
mova,p0
rrca
movp0,a
lcalldelay
jclan82
movp0,#0ffh
movp1,#0ffh
movp2,#0ffh
movp3,#0ffh
lcalldelay
lan83:
movp0,#000h
movp3,#000h
movp1,#0ffh
movp2,#0ffh
lcalldelay
movp1,#0
movp2,#0
movp0,#0ffh
movp3,#0ffh
lcalldelay
movp0,#000h
movp3,#000h
movp1,#0ffh
movp2,#0ffh
lcalldelay
movp0,#0ffh
movp3,#0ffh
movp1,#000h
movp2,#000h
lcalldelay
movp0,#000h
movp3,#000h
movp1,#0ffh
movp2,#0ffh
lcalldelay
movp0,#0ffh
movp3,#0ffh
movp1,#000h
movp2,#000h
lcalldelay
movp0,#000h
movp3,#000h
movp1,#0ffh
movp2,#0ffh
lcalldelay
movp0,#0ffh
movp3,#0ffh
movp1,#000h
movp2,#000h
lcalldelay
jclan83
ljmptd
delay:
movr7,#01h
d3:movr6,#0bdh
d2:movr5,#0ffh
djnzr5,$
djnzr6,d2
djnzr7,d3
end
Bạn đang đọc truyện trên: Truyen247.Pro