《题目一数码管显示学号.docx》由会员分享,可在线阅读,更多相关《题目一数码管显示学号.docx(11页珍藏版)》请在第一文库网上搜索。
1、数码管显示学号题目一、#i ncIudei nt ms, j, i ;code chartab = 0x5b, 0x3f,0x6d,0x4f,0x5b,0x3f, 0x3f, Ox66, 0x5b, 0x3f;code charTAB1 = OXFE, OXFD,OXFB, 0XF7, OXEF, 0XDF, OXBF, 0X7F;vo i d de I ay (i nt t)(int i,j ;for (i-0; it; i+)for(j=0;j110;j+);)vo i d ma i n ()TM0D=0X10;EA=1 ;ET1=1;TR1=1;TH1 = (65536-1000)/25
2、6;TL1 = (65536-1000)%256;wh i le(1)for (i=0;i j;i+)(if (i10)(tj=1 ;TH1 = (65536-1000)/)256;)TL1 = (65536-1000)%256;题目二、数码管显示键盘序号值#i ncIudecode chartab = 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d,0x07, 0x7f, 0x6f;sb it P10=P10vo i d ma i n () PO=OXFF;TMOD=OX1O;EA=1 ;ET1=1;TH1 = (65536-1OOO) /256;TL1=(65536-
3、1000)%256;wh i le(1) P10=0;if (P3=0X7f) P2=0XBF;P0=tab0 ;TR1=0;)e I seif (P3=0XBF) P2=0Xbf;PO=tab1 ;TR1=1 ;)e I seif (P3=0XDF)P2=0XbF;PO=tab2;TR1=0;)e I seif (P3=0XEF) P2=0XbFjP0=tab3 ;TR1=1 ;)e I seif (P3=0XF7) P0=tab4 ;P2=0XbF;TR1=O;)e I sei f (P3=0XFB) PO=tab 5 ; P2=0XbF; TR1 =1 ;)e I seif (P3=0X
4、FD) P0=tab6 ;P2=0XbF;TR1=O;)e I seif (P3=0XFE)PO=tab7;P2=0XbF;TR1=1;)vo i d t i me_0 () i interrupt 3(TH1=(65536-1OOO)/256;TL1=(65536-1000)%256;P10=10;题目三、数码管显示串口发送数据“电脑+板子”三根线P00蜂鸣器,右边任意数码接地#includeunsigned charTab=0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7c,0x39,0x5E,0x79,0x71;sbit
5、 feng=POAO;void main(void)(char i;SCON = 0x50;TMOD = Ox21;THO=(65536-1000)/256;TLO=(65536-1000)%256;TLl=0xE6;TRI = 1;while(l)(feng=O;while(RI)(i=SBUF;Pl=Tabi;RI=0;if(i%2=0)(EA=1;ETO=1;TRO=1;)else(EA=O;ETO=O;THl=0xE6;TRO=O;THO(65536-1000)/256;TLO(65536-1000)%256;voidTime0(void)feng=feng;interrupt 1g
6、I u-r (vo.ouj1zyzcj bw:www. lmluuai a.coj/; xa;h-.m片机四STC89C52RC/LE52RC 引脚数 Auto 程序文件EEPRM文件串口助手Kil仿真设置选型/价格件品范例程序 串口号 USB-SERIAL CK340 (COM)扫海长低波特率2400金始地址最高波耨军U52hcOOOO叼酒除代码缓冲区hc200清除EEPRCM缓冲区打开程序文件打开EEPMM文件硬件送【页脱机下载/W/U7程序加密后传输ID4 使能6T(双倍速)模式降低振荡2S的放大增益只有眇电才可停止看门狗内部扩展融耐用 ALEUP 用作 P4.5 口下次泠启动M,PL
7、0/M 1为0/0才可下载程序下次下载用户程序时操除用户EEPMM区在代码区的最后添加ID号接收缓冲区文本模式OMK模式清空雌区保存搔收效据发送缓冲区O文本模式模式保存发送效掘周期清空发送区发送文件发送数据自动发送清空全部数据自动循环发送 C04 波特军12 7 校验位无校蛤 停止位1位7由困口 口婚程完成后自动打开串口发送l 29!天串口将U8/V7设置为标准US咻串口接收I0:者零选择Flsh空白区城的填充值FF:果牌“钻瓷器籁用户EEPR区lt 器誓2M/SBC下如编程检;Mcu选项停止注意点助3每次下载前都重新装载目标文件重复埔程重复延时3秒7重复次数无限-n当目标文件竟化时自幼盗舅并
8、发送下钱命令操作成功! (2022-06-17 12:55:41)CUsrsxjhjinDsktopji(shiytn7. 2xhiyn7. hx发布项目程序发布项目帮助读取本机硬盘号叼攫示音成功计数74 菁零题目三、数码管显示串口发送数据“仿真”接收:ta b =0x3f,0x06,0x5 binclude,0x4f,0x66,0x6d,0x7d,codechar0x07,0x7f,0x6fkvoid main()int cad;TMOD=0X20;SCON=0X50;TH1=OXE6;TL1=OXE6;TR1=1;while(l)(while(RI)(cad=SBUF;RI=0;Pl=ta
9、bcad;)发送:#includecodecharta b=0x3 F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F;void main()int key;TMOD=0X20;SCON=0X40;TH1=OXE6;TL1=OXE6;TR1=1;while(l) P1=OXFF;if(Pl=OXFE)key=O;elseif(Pl=OXFD)key=l;elseif(Pl=0XFB)key=2;elseif(Pl=0XF7)key=3jelseif(Pl=0XEF)key=4;elseif(Pl=0XDF)key=5jelseif(Pl=0XBF)ke
10、y=6;elseif(Pl=0X7F)key=7;elseif(Pl=0XFC)key=8jelseif(Pl=OX3F)key=9jP2=tabkey;SBUF=key;while(TI=0);TI=0;)EA=1 ;ET0=1;TR0=1;wh i le(1)(if (P21=0)(TR0=0;题目4、传感器控制蜂鸣器发饷#i ncIudesbit P20=P20jsbit P1O=P1Ojsbit P21=P21;vo i d ma i n (vo i d)(TM0D=0x01;THO= (65536-100)/256;TLO=(65536-100)%P20=1;)256;e seTR0=1;P20=0; P1O 蜂鸣器,P21光敏,P20LED灯vo i d T ime (vo i d)i interrupt 1(THO= (65536-100)/256;TLO= (65536-100)%256;P10=10;)