您好,欢迎访问三七文档
当前位置:首页 > 中学教育 > 初一人称代词知识点整理
第八章:51系列单片机键盘/显示器接口技术•常用的显示设备:发光二极管、八段LED显示器、点阵LED,液晶显示器(LCD)、屏幕显示器(CRT)等。•8.1LED显示器接口技术•8.2键盘接口技术•8.3点阵接口技术•8.4液晶显示器接口技术8.151单片机显示器接口技术1、LED显示器结构与原理:•(1)结构:LED封装图共阴极LED共阳极LED(2)LED显示器的基本问题•a.七段码问题•共阳极、共阴极七段码•如显示“0”,共阴极七段码:dpgfedcba001111113FH•共阳极七段码:dpgfedcba110000000C0H•共阴极七段码表:•unsignedcharcodedaima[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};•b.驱动问题•LED显示器的每一个段通常需要1~5mA电流。•段驱动、位驱动;•段口、位口•c.显示方式问题•静态显示、动态显示•d.译码方式问题•硬件译码:采用专用译码器芯片实现,如CD4511、7447等芯片•软件译码:采用软件查表的方法,如显示“3”:•unsignedcharcodetable[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};unsignedchari,j;i=0x03;//j=table[i];//查表,转换成7段码•(3)显示函数的编写问题•a.建立7段码表•b.建立显示缓冲区通常,显示缓冲区中存放要显示的内容,对应于每个显示器,显示缓冲区的数据由其他函数或主函数来修改。•c.编制显示函数显示函数只完成将显示缓冲区中的数据通过查表转换成7段码送显示器显示。•d.显示函数的调用在主函数或其他函数中调用显示函数。•例如:2位显示器显示函数的编写•unsignedchardis_buf[2];//显示缓冲区•unsignedcharcodetable[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};•voidDisp(void)//2位数码管显示函数•{•unsignedchari;•i=dis_buf[0];//取显示内容•P1=table[i];//7段码送显示器•i=dis_buf[1];•P3=table[i];•}(4)LED显示器静态显示•1、一个8位端口控制1位LED显示器;•2、不改变显示内容,显示器一直显示不变;•3、硬件复杂,软件控制简单。例1:利用P2、P3口进行静态显示:轮流显示“12”、“--”、“AB”ahabcdefgbcdefghR1A02B018A13B117A24B216A35B315A46B414A57B513A68B612A79B711CE19AB/BA1U274LS245A02B018A13B117A24B216A35B315A46B414A57B513A68B612A79B711CE19AB/BA1U374LS245XTAL218XTAL119ALE30EA31PSEN29RST9P0.0/AD039P0.1/AD138P0.2/AD237P0.3/AD336P0.4/AD435P0.5/AD534P0.6/AD633P0.7/AD732P1.0/T21P1.1/T2EX2P1.23P1.34P1.45P1.56P1.67P1.78P3.0/RXD10P3.1/TXD11P3.2/INT012P3.3/INT113P3.4/T014P3.7/RD17P3.6/WR16P3.5/T115P2.7/A1528P2.0/A821P2.1/A922P2.2/A1023P2.3/A1124P2.4/A1225P2.5/A1326P2.6/A1427U1AT89C52•#includereg51.h•unsignedchardis_buf[2];//显示缓冲区•unsignedcharcodetable[18]={•0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71,0x40,0x00};•voiddl(unsignedintx)//延时xms•{•unsignedintt1,t2;•for(t1=0;t1x;t1++)•for(t2=0;t2120;t2++);•}•voiddisplay(void)//显示函数•{•P2=table[dis_buf[0]];//静态显示1•P3=table[dis_buf[1]];//静态显示2•}•voidmain(void)•{•while(1)•{•dis_buf[0]=1;dis_buf[1]=2;//送显示数据12•display();//调显示函数•dl(500);//延时500ms•dis_buf[0]=16;dis_buf[1]=16;//显示--•display();•dl(500);•dis_buf[0]=0x0a;dis_buf[1]=0x0b;//显示ab•display();•dl(500);•}•}例2:利用8255PA、PB、PC口进行静态显示:轮流显示“123”、“abc”PA7PC7PC0PC1PC2PC3PC4PC5PC0PC6PC1PC7PC2PC3PC4PC5PC6PA0PA5PA1PA6PA2PA7PA3PA4PA5PA6PA0PA1PA2PA3PA4XTAL218XTAL119ALE30EA31PSEN29RST9P0.0/AD039P0.1/AD138P0.2/AD237P0.3/AD336P0.4/AD435P0.5/AD534P0.6/AD633P0.7/AD732P1.0/T21P1.1/T2EX2P1.23P1.34P1.45P1.56P1.67P1.78P3.0/RXD10P3.1/TXD11P3.2/INT012P3.3/INT113P3.4/T014P3.7/RD17P3.6/WR16P3.5/T115P2.7/A1528P2.0/A821P2.1/A922P2.2/A1023P2.3/A1124P2.4/A1225P2.5/A1326P2.6/A1427U1AT89C52PROGRAM=..\例2程序\例2.hexD034D133D232D331D430D529D628D727RD5WR36A09A18RESET35CS6PA04PA13PA22PA31PA440PA539PA638PA737PB018PB119PB220PB321PB422PB523PB624PB725PC014PC115PC216PC317PC413PC512PC611PC710U58255AA02B018A13B117A24B216A35B315A46B414A57B513A68B612A79B711CE19AB/BA1U274LS245A02B018A13B117A24B216A35B315A46B414A57B513A68B612A79B711CE19AB/BA1U374LS245A02B018A13B117A24B216A35B315A46B414A57B513A68B612A79B711CE19AB/BA1U474LS245•#includereg51.h•#includeabsacc.h•#defineCOM8255XBYTE[0xbfff]•#definePA8255XBYTE[0xbcff]•#definePB8255XBYTE[0xbdff]•#definePC8255XBYTE[0xbeff]•unsignedchardis_buf[3];//显示缓冲区•unsignedcharcodetable[18]={•0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71,0x40,0x00};•voiddl(unsignedintx)//延时xms•{unsignedintt1,t2;•for(t1=0;t1x;t1++)•for(t2=0;t2120;t2++);•}•voiddisplay(void)•{•PA8255=table[dis_buf[0]];•PB8255=table[dis_buf[1]];•PC8255=table[dis_buf[2]];}•voidmain(void)•{•COM8255=0x80;//8255初始化•while(1)•{•dis_buf[0]=1;•dis_buf[1]=2;•dis_buf[2]=3;//显示123•display();//调显示函数•dl(500);//延时500ms•dis_buf[0]=0x0a;•dis_buf[1]=0x0b;•dis_buf[2]=0x0c;//显示abc•display();•dl(500);•}•}(5)LED动态显示•动态显示即一位一位轮流点亮各位显示器,采用动画模式。理解:段口和位口的含义•unsignedchardis_buf[8];//显示缓冲区•unsignedcharcodetable[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};•voiddisplay(void)•{•unsignedchari;•unsignedcharbitcode=0xfe;//位码•for(i=0;i8;i++)•{•DUANKOU=table[dis_buf[i]];//送段码•WEIKOU=bitcode;//位码•dl_ms();//延时1ms•WEIKOU=0xff;//关闭显示•bitcode=_crol_(bitcode,1);//位码左循环移位•}•}例3:利用P0、P3口进行动态显示:显示“123456”XTAL218XTAL119ALE30EA31PSEN29RST9P0.0/AD039P0.1/AD138P0.2/AD237P0.3/AD336P0.4/AD435P0.5/AD534P0.6/AD633P0.7/AD732P1.0/T21P1.1/T2EX2P1.23P1.34P1.45P1.56P1.67P1.78P3.0/RXD10P3.1/TXD11P3.2/INT012P3.3/INT113P3.4/T014P3.7/RD17P3.6/WR16P3.5/T115P2.7/A1528P2.0/A821P2.1/A922P2.2/A1023P2.3/A1124P2.4/A1225P2.5/A1326P2.6/A1427U1AT89C52A02B018A13B117A24B216A35B315A46B414A57B513A68B612A79B711CE19AB/BA1U274LS24512U1:A740734U1:B740756U1:C740798U1:D74071110U1:E74071312U1:F7407•#includereg51.h•#includeintrins.h•unsignedchardis_buf[6]={0};//显示缓冲区•unsignedcharcodetable[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};•voiddl_ms()//延时1ms•{•unsignedintj;•for(j=0;j150;j++);•}•voiddisplay
本文标题:初一人称代词知识点整理
链接地址:https://www.777doc.com/doc-2113086 .html