您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 酒店餐饮 > 单片机-LED点阵-点阵显示数字
太原师范学院实验报告ExperimentataionReportofTaiyuanteachersCollege系部:计算机系年级:201404课程:单片机基础姓名:王利军同组者:陈敬斌日期:2016.10.28项目LED点阵-点阵显示数字一、实验要求通过单片机使LED点阵一次循环显示数字字母。二、实验目的使LED点阵显示数字。熟悉8255的功能,了解点阵显示的原理及控制方法;三、实验仪器软件:KeiluVision4硬件:单片机开发实验仪四、实验连线JP10(P0)和J12用8PIN排线连接起来。JP1(P2)和J20用8PIN排线连接起来。报告内容一、实验目的四、实验方法二、实验原理五、实验记录及数据处理三、实验仪器及材料六、误差分析及讨论JP8(P1)和J19用8PIN排线连接起来。J21接VCC,JP165断开。五、实验程序#includereg51.h//--定义要使用的IO口--//#defineREADPORTSP2#defineGREENPORTSP1#defineCOMMONPORTSP0//--列选通控制--//unsignedcharcodeTAB[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//--点阵字码--//unsignedcharcodeCHARCODE[18][8]={{0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00},//0{0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00},//1{0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00},//2{0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00},//3{0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00},//4{0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00},//5{0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00},//6{0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00},//7{0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00},//8{0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00},//9{0x00,0x00,0x7F,0x48,0x48,0x30,0x00,0x00},//P{0x00,0x00,0x7F,0x48,0x4C,0x73,0x00,0x00},//R{0x00,0x00,0x7F,0x49,0x49,0x49,0x00,0x00},//E{0x00,0x00,0x3E,0x41,0x41,0x62,0x00,0x00},//C{0x00,0x00,0x7F,0x08,0x08,0x7F,0x00,0x00},//H{0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00},//I{0x00,0x7F,0x10,0x08,0x04,0x7F,0x00,0x00},//N{0x7C,0x48,0x48,0xFF,0x48,0x48,0x7C,0x00}//中};/********************************************************************************函数名:main*函数功能:主函数*输入:无*输出:无*******************************************************************************/voidmain(){unsignedchartab,j;unsignedinti;while(1){for(i=0;i5000;i++)//两个字之间的扫描间隔时间{for(tab=0;tab8;tab++){READPORTS=0xFF;//消隐COMMONPORTS=CHARCODE[j][tab];//输出字码READPORTS=TAB[tab];}}j++;if(j==18){j=0;}}}
本文标题:单片机-LED点阵-点阵显示数字
链接地址:https://www.777doc.com/doc-1805493 .html