开发工具:
文件大小: 82kb
下载次数: 0
上传时间: 2011-11-22
详细说明: #include //包含头文件 #include //包含固有函数 #define uint unsigned int //定义一下方便使用 #define uchar unsigned char //定义一下方便使用 #define DATA P0 //LCD12864数据线 sbit RS=P2^2; // 数据\指令 D、I 选择 sbit RW=P2^1; // 读\写 选择 R、W sbit EN=P2^0; // 读\写使能 sbit cs1=P2^4; // 片选1 sbit cs2=P2^3; // 片选2 /********************************/ /* 定义图形字库 */ uchar code Hzk[]={ //左屏幕第1页 0xFF,0xFF,0xFF,0xFF,0x7F,0xBF,0x3F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF, 0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0x BF, 0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF, 0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF, //左屏幕第2页 0xFF,0xFF,0xFF,0xAB,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, //左屏幕第3页 0xFF,0xFF,0xFF,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0xE0,0xEA,0xE0,0xEA, 0xE0,0xEA,0xE0,0xEA,0xE0,0xEA,0xC0,0xAA,0x00,0xAA,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BF,0x1F,0xBF,0x1F,0xBF,0x1F,0xBF,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00, //右屏幕第2页 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA, 0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x01,0xFF,0xFF,0xFF,0xFF,0x00, //右屏幕第3页 0xE0,0xEA,0xE0,0xEA,0xE0,0xEA,0xE0,0xAA,0x00,0xEA,0xE0,0xEA,0xE0,0xEA,0xE0,0xEA, 0xE0,0xEA,0xE0,0xEA,0xE0,0xAA,0x00,0xAA,0xE0,0xEA,0xE0,0xEA,0x00,0xAA,0x00,0xAA, 0x00,0xEA,0xE0,0xEA,0xE0,0xAA,0x00,0xAA,0x80,0xEA,0xC0,0xEA,0xE0,0xEA,0xE0,0xEA, 0xE0,0xEA,0x80,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xFF,0xFF,0xFF,0xFF,0x00, //右屏幕第4页 0xFF,0xFF,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xFF,0xFF,0xFF,0xFF,0xBA,0x38,0xBA, 0x38,0xBA,0x38,0xBA,0x00,0xAA,0x00,0xAA,0xFF,0xFF,0xFF,0xFF,0x00,0xAA,0x00,0xAA, 0x00,0xFF,0xFF,0xFF,0xFF,0xAA,0x00,0xAA,0x8F,0xAF,0x9F,0xBF,0x3C,0xBE,0x38,0xFB, 0xFB,0xFB,0xF3,0xEB,0x00,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xFF,0xFF,0xFF,0xFF,0x00, //右屏幕第5页 0x0F,0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 0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F, 0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F, 0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00, }; /*状态检查,LCD是否忙*/ void CheckState() { uchar dat;//状态信息(判断是否忙) RS=0; // 数据\指令选择,D/I(RS)=“L” ,表示 DB7∽DB0 为显示指令数据 RW=1; //R/W=“H” ,E=“H”数据被读到DB7∽DB0 do{ DATA=0x00; EN=1; //EN下降源 _nop_(); //一个时钟延时 dat=DATA; EN=0; dat=dat>>7; //仅当第7位为0时才可操作(判别busy信号) }while(!(dat==0x00)); } /*写命令到LCD中*/ SendCommandToLCD(uchar com) { CheckState();//状态检查,LCD是否忙 RS=0; //向LCD发送命令。RS=0写指令,RS=1写数据 RW=0;//R/W=“L” ,E=“H→L”数据被写到 IR 或 DR DATA=com; //com :命令 EN=1;//EN下降源 _nop_(); _nop_(); EN=0; } /*设置页 0xb8是页的首地址*/ void SetLine(uchar page) { page=0xb8|page; //1011 1xxx 0<=page<=7 设定页地址--X 0-7,8行为一页64/8=8,共8页 SendCommandToLCD(page); } /*设定显示开始行,0xc0是行的首地址*/ void SetStartLine(uchar startline) { startline=0xc0|startline; //1100 0000 SendCommandToLCD(startline); //设置从哪行开始:0--63,一般从0 行开始显示 } /*设定列地址--Y 0-63 ,0x40是列的首地址*/ void SetColumn(uchar column) { column=column &0x3f; //column最大值为64,越出 0=
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.