ORG 0000H
AJMP MAIN
ORG 0100H
MAIN: MOV SCON,#40H 设置串行口工作方式1
MOV PCON,#0 设置波特率4800
MOV TMOD,#20H 波特率可根据需要自己修改高猛
MOV TL1,#0FAH
MOV TH1,#0FAH
SETB TR1
MOV DPTR,#MSG DPTR指向待输出字符串首地址
NEXT: MOV A,#0
MOVC A,@A+DPTR
CJNE A,'$',NEXT1 字符串结尾?
AJMP NEXT2
NEXT1: CLR TI
MOV SBUF,A 发送
JNB TI,$ 等待发送完成
INC DPTR 指向下一字符
AJMP NEXT
NEXT2: SJMP $ 动态暂停
MSG DB '中华人民共和国' 定义中文字符串
MSGEND DB '$' 定义慎念凯字符串结尾字符,自定义
END
#include char tt = 0bit flgchar code table[] = { //世局共悉银阳搜陆让段码 0 ~ 90xC0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90}void main(){TMOD = 0x01 TH0 = 0x3C TL0 = 0xB0 IE = 0x82 TR0 = 1 while (1)}void b() interrupt 1{TH0 = 0x3C TL0 = 0xB0 tt++ if (tt == 10) { tt = 0 flg = !flg if(flg) {SBUF = table[3]while(!TI)TI = 0 SBUF = table[2]while(!TI)TI = 0 SBUF = table[1]while(!TI)TI = 0 SBUF = table[0]while(!TI)TI = 0 } else {SBUF = table[7]while(!TI)TI = 0 SBUF = table[6]while(!TI)TI = 0 SBUF = table[5]while(!TI)TI = 0 SBUF = table[4]while(!TI)TI = 0 }}}仿真截图如下:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)