《2.数码管显示串口发送数据.docx》由会员分享,可在线阅读,更多相关《2.数码管显示串口发送数据.docx(9页珍藏版)》请在第一文库网上搜索。
1、1 .数码管显示学号#includeint ms,ij;codechartab=0x5b,0x3f,0x6d,0x4f,0x5b,0x3f,0x3f,0x4f,0x3f,0x07;codecharTABl=0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7Fjvoid delay(int ms)(int i,j;for(i=0;ims;i +)(for(j=0;j110;j +);)void mai(void)(TMOD=0X10jEAljET1=1;TR1 = 1;THl=(65536-1000)/256;TLl=(65536-1000)%256jwhile(l)f
2、or(i=0;ij;i +)if(i=7)(PO=tabj-i-l;P2=TABli;delay(l);)P2JP3,P0=JP2jvoid time_l() interrupt 3THl=(65536-1000)256jTL1=(65536-1000)%256jms+;if(ms= = 1000)ms=0;j+;)if(j=Dj=l;)2.数码管显示键盘序号值#includecodechartab=0x3Fj0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F);sbit P1O=P1AO;void mai()(PO=OXFFjTMOD=0X10jEA=1
3、;ET1=1;TH1=(65536-1000)/256;TL1(65536-1000)%256jwhile(l)P10=0;if(P3=0X7f)P2=0Xfe;P0=tabl;TRl=0;elseif(P3=0XBF)P2=0Xfe;P0=tab2;TRl=l;elseif(P3 二二 OXDF)P2 = OXfepO=tab3;TRl=0;elseif(P3 二二 OXEF)P2 = OXfepO 二 tab4;TRl=l;elseif(P3=0XF7)P2=0xfe;P0=taTab=0x3Fj0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x
4、77,07c,0x39,0x5E,0x79,0x71;b5;TRl=0;elseif(P3=0XFB)P2=0Xfe;P0=tab6;TRl=l;elseif(P3=0XFD)P2=0Xfe;P0=tab7;TRl=0;elseif(P3=0XFE)P2=0XfejP0=tab8;TRl=l;)void time_0() interrupt 3(THl=(65536-1000)256jTLl=(65536-1000)%256jP10=-P10j)JP0=JP7,JP8=JP2,P10=Pl0j2 .数码管显示串口发送数据#includesbit feng = P2A0;void main(vo
5、id)2400bps()12.000MHz(char i;SCON = 0x50;/8 位数据,可变波特率TMOD = 0x21; 设定定时器1为8位自动重装方式TH0 = (65536-1000)/256;设定定时初值TLO = (65536-1000)%256;THl=0xE6jTLl=0xE6j 设定定时器重装值禁止定时器1中断TRI = 1; 启动定时Unsignedcharb5;TRl=0;elseif(P3=0XFB)P2=0Xfe;P0=tab6;TRl=l;elseif(P3=0XFD)P2=0Xfe;P0=tab7;TRl=0;elseif(P3=0XFE)P2=0XfejP
6、0=tab8;TRl=l;)void time_0() interrupt 3(THl=(65536-1000)256jTLl=(65536-1000)%256jP10=-P10j)JP0=JP7,JP8=JP2,P10=Pl0j2.数码管显示串口发送数据#includesbit feng = P2A0;void main(void)2400bps()12.000MHz(char i;SCON = 0x50;/8 位数据,可变波特率TMOD = 0x21; 设定定时器1为8位自动重装方式TH0 = (65536-1000)/256;设定定时初值TLO = (65536-1000)%256;TH
7、l=0xE6jTLl=0xE6j 设定定时器重装值禁止定时器1中断TRI = 1; 启动定时b5;TRl=0;elseif(P3=0XFB)P2=0Xfe;P0=tab6;TRl=l;elseif(P3=0XFD)P2=0Xfe;P0=tab7;TRl=0;elseif(P3=0XFE)P2=0XfejP0=tab8;TRl=l;)void time_0() interrupt 3(THl=(65536-1000)256jTLl=(65536-1000)%256jP10=-P10j)JP0=JP7,JP8=JP2,P10=Pl0j2.数码管显示串口发送数据#includesbit feng = P2A0;void main(void)2400bps()12.000MHz(char i;SCON = 0x50;/8 位数据,可变波特率TMOD = 0x21; 设定定时器1为8位自动重装方式TH0 = (65536-1000)/256;设定定时初值TLO = (65536-1000)%256;THl=0xE6jTLl=0xE6j 设定定时器重装值禁止定时器1中断TRI = 1; 启动定时