PROTEUS仿真电路图:
仿真结果展示:
大长安城墙的一角:
大雁塔:
龙:
C语言程序代码:
#include #define LCDLCDDisp_Off 0x3e #define LCDLCDDisp_On 0x3f #define Page_Add 0xb8//ye #define LCDCol_Add 0x40//lie #define Start_Line 0xC0//hang /*****液晶显示器的端口定义*****/ #define data_ora P1 /*液晶数据总线*/ sbit LCDMcs=P2^4 ; /*片选1*/ sbit LCDScs=P2^3 ; /*片选2*/ sbit LCDDi=P2^2 ; /*数据/指令 选择*/ sbit LCDRW=P2^1 ; /*读/写 选择*/ sbit LCDEnable=P2^0 ; /*读/写 使能*/ char code Hz[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x20,0x28,0x38,0x38,0x18,0x00, 0x08,0x08,0x08,0x04,0x04,0x04,0x04,0x84,0xC8,0x78,0x30,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0xC0,0x40,0x00,0x80,0x80,0x80,0x00,0x00, 0xC0,0x80,0x00,0x40,0x80,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x0E,0x35,0x73,0x7B,0xBE,0xFE,0x3E,0xFC,0xF8,0xFC,0xFC,0xFE,0xDE, 0xDD,0xFF,0xEF,0xBF,0xFF,0xFF,0xDE,0xB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x80,0x80,0x80, 0x80,0xC0,0xC0,0xC0,0xE0,0xE0,0xF0,0xF0,0xF8,0xF8,0xFD,0xFC,0xFE,0xFF,0x7F,0x7F, 0x7F,0x3F,0x3F,0x3F,0x1F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x03,0x03,0x07,0x07, 0x0F,0x0F,0x0F,0x1B,0x1B,0x1B,0x1B,0x1B,0x03,0x07,0x07,0x05,0x01,0x01,0x03,0x00, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x81,0x81,0x80,0x00,0x00,0xC0,0xC0,0xC0,0x80,0xA0,0x60,0xE0,0x60,0x60, 0x6C,0x7C,0x36,0x36,0x36,0x3B,0x39,0x39,0x38,0x18,0x18,0x1C,0x1C,0x1C,0x1C,0x1C, 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x0E,0x0E,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x07,0x07, 0x07,0x07,0x03,0x07,0x03,0x05,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0xC0,0xA0,0xE0,0xD0,0x70,0x68,0x78, 0xBC,0xBC,0xBC,0xF6,0xDE,0xDE,0xEE,0x66,0x66,0x6E,0x7E,0x72,0x36,0x3A,0x38,0x39, 0x18,0x19,0x05,0x0D,0x03,0x03,0x02,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x90,0x88,0x86,0x85,0x8A,0x8B,0x85,0x85,0x87,0x82,0x82,0x83,0x81,0x83, 0x83,0x83,0x81,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 }; /**************************************************************************** 函数功能:LCD延时程序 入口参数:t 出口参数: ****************************************************************************/ void LCDdelay(unsigned int t) { unsigned int i,j; for(i=0;i } /**************************************************************************** 状态检查,LCD是否忙 *****************************************************************************/ void CheckState() { unsigned char dat,DATA;//状态信息(判断是否忙) LCDDi=0; // 数据指令选择,D/I(RS)="L" ,表示 DB7∽DB0 为显示指令数据 LCDRW=1; //R/W="H" ,E="H"数据被读到DB7∽DB0 do { DATA=0x00; LCDEnable=1; //EN下降源 LCDdelay(2);//延时 dat=DATA; LCDEnable=0; dat=0x80 & dat; //仅当第7位为0时才可操作(判别busy信号) } while(!(dat==0x00)); } /***************************************************************************** 函数功能:写命令到LCD程序,RS(DI)=L,RW=L,EN=H,即来一个脉冲写一次 入口参数:cmdcode 出口参数: *****************************************************************************/ void write_com(unsigned char cmdcode) { CheckState();//检测LCD是否忙 LCDDi=0; LCDRW=0; P1=cmdcode; LCDdelay(2); LCDEnable=1; LCDdelay(2); LCDEnable=0; } /***************************************************************************** 函数功能:LCD初始化程序 入口参数: 出口参数: *****************************************************************************/ void init_lcd() { LCDdelay(100); LCDMcs=1;//刚开始关闭两屏 LCDScs=1; LCDdelay(100); write_com(LCDLCDDisp_Off); //写初始化命令 write_com(Page_Add+0); write_com(Start_Line+0); write_com(LCDCol_Add+0); write_com(LCDLCDDisp_On); } /***************************************************************************** 函数功能:写数据到LCD程序,RS(DI)=H,RW=L,EN=H,即来一个脉冲写一次 入口参数:LCDDispdata 出口参数: *****************************************************************************/ void write_data(unsigned char LCDDispdata) { CheckState();//检测LCD是否忙 LCDDi=1; LCDRW=0; P1=LCDDispdata; LCDdelay(2); LCDEnable=1; LCDdelay(2); LCDEnable=0; } /***************************************************************************** 函数功能:清除LCD内存程序 入口参数:pag,col,hzk 出口参数: *****************************************************************************/ void Clr_Scr() { unsigned char j,k; LCDMcs=0; //左、右屏均开显示 LCDScs=0; write_com(Page_Add+0); write_com(LCDCol_Add+0); for(k=0;k<8;k++)//控制页数0-7,共8页 { write_com(Page_Add+k); //每页每页进行写 for(j=0;j<64;j++) //每页最多可写32个中文文字或64个ASCII字符 { write_com(LCDCol_Add+j); write_data(0x00);//控制列数0-63,共64列,写点内容,列地址自动加1 } } } /***************************************************************************** 函数功能:左屏位置显示 入口参数:page,column,hzk 出口参数: *****************************************************************************/ void Bmp_Left_Disp(unsigned char page,unsigned char column, unsigned char code *Bmp) { unsigned char j=0,i=0;
上一篇:单片机控制12864显示动态图片
下一篇:单片机控制12864显示多行汉字
推荐阅读最新更新时间:2024-11-11 14:57
设计资源 培训 开发板 精华推荐
- DEVKIT-S12VRP: S12VRP评估板
- 单片机最小系统板-STM8L051F3
- AD-FMCOMMS2-EBZ,评估板使用 AD9361 高性能、高度集成的射频收发器,用于射频应用
- LT3470HDDB 5V 降压转换器的典型应用电路
- 电机PCB_REC
- 具有 PGIA 的隔离式多通道数据采集系统,用于单端和差分工业电平信号
- LM2904ADMR2G 维恩桥振荡器的典型应用
- TP78-基于CH582M的小红点VIA三模客制化键盘
- 【衍生分支】XBoard ET1.1写字机控制器 ESP32 GRBL
- LTC3621IMS8E-3.3 1.2Vout、强制连续模式、1MHz 同步降压稳压器的典型应用