用74hc164串转并如何控制数码管的显示顺序
1:你的原理图设计有问题,应该改为:
2:初始化串口9600波特率,方式0。时钟:11.0592M
3:定时器中断和串口中断配合使用,动态扫描数码管!
ORG 0000H
LJMP START
ORG 000BH
AJMP INT_0
ORG 0023H
AJMP SRXD
ORG 0030H
START:
MOV SP,#50H
MOV SCON,#00010000B ;S MOD 0 ;设置成方式0,你自己去查
MOV TMOD,#22H ;T0,MOD 1
mov th1,#0fdh ;时钟11.0956MHz,通讯频率:9600
mov tl1,#0fdh
MOV TH0,#38H ;8位再装入定时器,200uS(0.2mS)
MOV TL0,#38H
MOV PCON,#00H
setb tr1
SETB PS
CLR SENDF
MOV IE,#10010011B
mov ip,#00010000b
setb IT0
SETB TR0
MAIN:
INT_0: push psw
push acc
INC R0
cjne R0,#10,inend
MOV A,DATAS1
MOV SBUF,A
CLR RI
MOV P1,#11111110B
cjne R0,#20,inend
MOV A,DATAS2
MOV SBUF,A
CLR RI
MOV P1,#11111101B
cjne R0,#30,inend
MOV A,DATAS3
MOV SBUF,A
CLR RI
MOV P1,#11111011B
cjne R0,#40,inend
MOV A,DATAS1
MOV SBUF,A
CLR RI
MOV P1,#11110111B
MOV R0,#00H
inend: pop acc
pop psw
RETI
SRXD: JNB RI,SEND ;RI=0,TO SEND
clr ri
SJMP ENDSRXD
SEND: clr ti
ENDSRXD:
RETI