《实验T学号滚动.docx》由会员分享,可在线阅读,更多相关《实验T学号滚动.docx(10页珍藏版)》请在第一文库网上搜索。
1、TM0D=0X10jTH1= (65536-1000)/256;1 .学号滚动ftincludeint ms, i, j;codechartab-0x5b, 0x3f, 0x6d, Ox4f, 0x5b, 0x3f, 0x3f, 0x66, 0x06, 0x4f;codecharTABl = 0xFE, OxFD, OxFB, 0xF7, OxEF, OxDF, OxBF, 0x7Fvoid delay(int ms)(int i,j;for (i=0;ims;i+)(for(j=0jj110;j+);)void main(void)EA=1;ET1=1;TR1=1;TH1= (65536-1
2、000)/256;TLl(65536-1000)%256jwhile(1)(for (i=0;ij;i+)(if (i=7)(PO=tabj-i-l ;P2=TABlidelay (1);void time_l () interrupt 3TLl=(65536-1000)%256jms+;if (ms=1000)(ms=0;j+;)if(j=ll)(j=l;)2.数码管显示键盘序号值ftincludecode chartab = 0x06, 0x5b, 0x4f, Ox66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f;sbit P10P0jvoid main(void)PO=O
3、XFF;TM0D=0X10jEA=1;ET1=1;TH1=(65536-1000)/256;TL1= (65536-1000)%256;while (1)P10=0;if (P3=0X7f)P2=OXBF;PO二tab0;TR1=1;elseif (P3=0XBF)P2=0XbfjP0=tabl;TR1=O;elseif (P3=0XDF)P2=0XbF;P0=tab2;TR1=1;elseif(P3=0XEF)P2=0XbFjP0=tab3;TR1=O;elseif(P30XF7)P0=tab4;P2=0XbF;TRl=l;elseif(P3=0XFB)P0=tab5;P2=0XbF;TRl
4、=0;elseif(P3=0XFD)P0=tab6;P2=0XbF;TRl=l;elseif(P3=0XFE)P0=tab7;P2=0XbF;TRl=0;)void time_0 () interrupt 3(TH1= (65536-1000)/256;TL1= (65536-1000)%256;PIOPIO;3串口发送数据ttincludeunsignedcharTab = 0x3F, 0x06, 0x5B, Ox4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7c, 0x39,0x5E, 0x79, 0x71;sbit feng=P20jvo
5、id main(void)(char i;SC0N=0x50jTM0D=0X21;THO= (65536-1000)/256;TLO (65536-1000)%256;THl=0xE6jTLl=0xE6jTR1=1;while(1)while(Rl)voidTimeO(void)interrupt 1i=SBUF;Pl=Tabi;RI=O;if (i%2=0)(EA=1;ETO=1;TRO=1;EA=O;ETO=O;TRO=O;)TLO= (65536-1000)%256feng=fengj4.传感器控制蜂鸣器发响Wincludesbit P21=P0jvoid main(void)TM0D=0x01;THO=(65536-100)/256;TLO= (65536-100)%256;EA=1;ETO=1;while(1)if(P2=0xFE)(TRO=O;P21ljTHO= (65536-1000)/256;elseTimer(void)interrupt 1TRO=1;P21=0;THO(65536-100)/256;TLO= (65536-100)%256;PO=PO;)void