74LS164.docx
《74LS164.docx》由会员分享,可在线阅读,更多相关《74LS164.docx(18页珍藏版)》请在冰豆网上搜索。
![74LS164.docx](https://file1.bdocx.com/fileroot1/2023-1/29/7e5ee73f-ccb9-4e7a-9d3f-f164ebd32161/7e5ee73f-ccb9-4e7a-9d3f-f164ebd321611.gif)
74LS164
org00H
JMPSTART
ORG000BH
JMPT0IN
ORG0013H
JMPDSFM
START:
MOVTMOD,#01H
MOVIE,#86H
SETBPX1
MOVTH0,#3CH
MOVTL0,#0B0H
MOVDPTR,#TAB
MOVR2,#0
MOV30H,#0
MOV31H,#0
MOV32H,#12
SETBTR0
JMP$
T0IN:
MOVTH0,#3CH
MOVTL0,#0B0H
INCR2
CJNER2,#20,FH
MOVR2,#0
INC30H
MOVA,30H
CJNEA,#60,FH1
MOV30H,#0
INC31H
MOVA,31H
CJNEA,#60,FH1
MOV31H,#0
INC32H
MOVA,32H
CJNEA,#13,FH1
MOV32H,#1
FH1:
ACALLFYSBCD
ACALLDISP
FH:
RET
FYSBCD:
MOVR3,#3
MOVR0,#30
MOVR1,#40H
LP:
MOVA,@R0
MOVB,#10
DIVAB
MOV@R1,B
INCR1
MOV@R1,A
INCR0
INCR1
DJNZR3,LP
RET
DISP:
MOVR1,#40H
LP1:
MOVA,@R1
MOVCA,@A+DPTR
MOVSBUF,A
JNBTI,$
CLRTI
INCR1
CJNER1,#46H,LP1
RET
DSFM:
CLREA
CLRTR0
ACALLDELY
JBP3.3,FH2
JNBP3.3,$
LP0:
ACALLFYSBCD
ACALLDISP
ACALLKEY
ACALLFYSBCD
ACALLDISP
ACALLDELY1
FH2:
SETBEA
SETBTR0
RETI
DELY:
MOVR4,#100
D0:
MOVR5,#200
D2:
DJNZR5,D2
DJNZR4,D0
RET
DELY1:
MOVR5,#20
D1:
MOVR6,#100
D3:
MOVR7,#100
DJNZR7,$
DJNZR6,D3
DJNZR5,D1
RET
KEY:
MOV45H,#10
MOV44H,#10
ACALLDISP
ACALLDELY1
JBP2.0,N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FH
MAIN:
JBP1.0,AA
ACALLDS0
AA:
JBP1.1,BB
ACALLDS1
BB:
JBP1.2,CC
ACALLDS2
CC:
JBP1.3,DD1
ACALLDS3
DD1:
JBP1.4,EE
ACALLDS4
EE:
JMPMAIN
ds0:
acalldl
clrP2.0
ACALLDELAY
SETBP2.0
ACALLDELAY
jnbp1.1,ds1
jnbp1.2,ds2
jnbp1.3,ds3
jnbp1.4,ds4
jmpds0
ds1:
acalldl
clrP2.1
ACALLDELAY1
SETBP2.1
ACALLDELAY
jnbp1.0,ds0
jnbp1.2,ds2
jnbp1.3,ds3
jnbp1.4,ds4
jmpds1
ds2:
acalldl
clrP2.2
ACALLDELAY2
SETBP2.2
ACALLDELAY
jnbp1.0,ds0
jnbp1.1,ds1
jnbp1.3,ds3
jnbp1.4,ds4
jmpds2
ds3:
acalldl
clrP2.3
ACALLDELAY3
SETBP2.3
ACALLDELAY
jnbp1.0,ds0
jnbp1.1,ds1
jnbp1.2,ds2
jnbp1.4,ds4
jmpds3
ds4:
acalldl
clrp2.4
jnbp1.4,$
k1:
jbp1.4,k1
jnbp1.4,$
setbp2.4
jmpmain
delay:
movr5,#25
d1:
movr6,#100
d2:
movr7,#100
djnzr7,$
djnzr6,d2
djnzr5,d1
ret
delay1:
movr5,#50
da1:
movr6,#100
da2:
movr7,#100
djnzr7,$
djnzr6,da2
djnzr5,da1
ret
delay2:
movr5,#75
dsf1:
movr6,#100
dsf2:
movr7,#100
djnzr7,$
djnzr6,dsf2
djnzr5,dsf1
ret
delay3:
movr5,#100
ddf1:
movr6,#100
ddf2:
movr7,#100
djnzr7,$
djnzr6,ddf2
djnzr5,ddf1
ret
dl:
movr0,#100
djnzr0,$
ret
end
ORG00H
JMPMAIN
ORG0030H
MOVSP,#60
MOVP3,#0FFH
MOVP1,#0FFH
MAIN:
JNBP3.2,K1
JNBP3.3,K2
JNBP3.4,K3
JNBP3.5,K4
JNBP3.7,K5
JMPMAIN
K1:
ACALLDELAY
JBP3.2,K1
JNB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