不带字库12864程序实例.docx
- 文档编号:10659670
- 上传时间:2023-02-22
- 格式:DOCX
- 页数:20
- 大小:18.34KB
不带字库12864程序实例.docx
《不带字库12864程序实例.docx》由会员分享,可在线阅读,更多相关《不带字库12864程序实例.docx(20页珍藏版)》请在冰豆网上搜索。
不带字库12864程序实例
/*********************************************************************************************/
//程序部分开始//
/*********************************************************************************************
//头文件定义
//
/*********************************************************************************************/
#include
#include
/*********************************************************************************************
//接口定义
//
/*********************************************************************************************/
#defineLCM12864_DB7_DB0P0//定义LCM12864的数据总线
sbitLCM12864_RS=P2^3;//定义LCM12864的RS控制线
sbitLCM12864_RW=P2^4;//定义LCM12864的RW控制线
sbitLCM12864_E=P2^2;//定义LCM12864的E控制线
sbitLCM12864_CS1=P2^7;//定义LCM12864的CS1控制线
sbitLCM12864_CS2=P2^6;//定义LCM12864的CS2控制线
sbitLCM12864_RESET=P2^5;//定义LCM12864的RESET控制线
sbitLCM12864_LEDK=P2^0;//定义LCM12864的LEDK(BLK)控制线
/*********************************************************************************************
//数据定义
//定义LCM12864的命令字
/*********************************************************************************************/
#defineLCM12864_DISP_ON0x3f//打开LCM12864显示
#defineLCM12864_DISP_OFF0x3e//关闭LCM12864显示
#defineLCM12864_START_ROW0xc0//显示起始行0,可以用LCM12864_START_ROW+x设置起始行。
(x<64)
#defineLCM12864_PAGE_START_ADDR0xb8//页起始地址,可以用LCM12864_PAGE_START_ADDR+x设置当前页。
(x<8)
#defineLCM12864_COL_START_ADDR0x40//列起始地址,可以用LCM12864_COL_START_ADDR+x设置当前列。
(x<64)
//定义LCM12864的状态屏蔽码
//在BUSY和REST状态时,除读状态指令外,其他指令均不对LCM12864产生作用。
//在对LCM12864操作之前要查询BUSY状态,以确定是否可以对LCM12864进行操作。
#defineLCM12864_STATUS_BUSY0x80//LCM12864忙状态屏蔽码
#defineLCM12864_STATUS_DISP_OFF0x20//LCM12864显示关闭状态屏蔽码
#defineLCM12864_STATUS_REST0x10//LCM12864复位状态屏蔽码
/*********************************************************************************************
//字符/图像定义库
//
/*********************************************************************************************/
/*--文字:
欢--*/
/*--宋体12;此字体下对应的点阵为:
宽x高=16x16--*/
/*纵向取模,字节倒序*/
unsignedcharcodehuan1[]={
0x0C,0x6C,0xEC,0x8C,0xFC,0x3C,0x40,0x70,0x3F,0xCF,0xCC,0x0C,0x3C,0x3C,0x00,0x00,
0x10,0x38,0x1C,0x07,0x07,0x4C,0x60,0x30,0x18,0x0F,0x07,0x0C,0x18,0x30,0x20,0x00,
};
/*--文字:
迎--*/
/*--宋体12;此字体下对应的点阵为:
宽x高=16x16--*/
/*纵向取模,字节倒序*/
unsignedcharcodeying2[]={
0x60,0x66,0xEE,0xE8,0x00,0xFE,0xFE,0x07,0x03,0xFE,0xFE,0x06,0xFE,0xFE,0x00,0x00,
0x40,0x60,0x3F,0x1F,0x30,0x67,0x67,0x62,0x60,0x6F,0x6F,0x62,0x67,0x67,0x60,0x00
};
///////////////////////////////////////////////////////////////////
//ASCII字模的数据表//
//码表从0x20~0x7e//
//字库:
Asc8X16E.dat纵向取模下高位//
///////////////////////////////////////////////////////////////////
unsignedcharcodenAsciiDot[]=//ASCII
0x04,0xFC,0xFC,0x04,0x0C,0xF8,0xF0,0x00,//-D-
0x08,0x0F,0x0F,0x08,0x0C,0x07,0x03,0x00,
0xE0,0xE0,0x00,0x00,0x00,0xE0,0xE0,0x00,//-y-
0x47,0x4F,0x48,0x48,0x68,0x3F,0x1F,0x00,
0x00,0x10,0x18,0xFC,0xFC,0x00,0x00,0x00,//-1-
0x00,0x08,0x08,0x0F,0x0F,0x08,0x08,0x00,
0x08,0x0C,0x84,0xC4,0x64,0x3C,0x18,0x00,//-2-
0x0E,0x0F,0x09,0x08,0x08,0x0C,0x0C,0x00,
0xB8,0xFC,0x44,0x44,0x44,0xFC,0xB8,0x00,//-8-
0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00,
0xF0,0xF8,0x4C,0x44,0x44,0xC0,0x80,0x00,//-6-
0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00,
0xC0,0xE0,0xB0,0x98,0xFC,0xFC,0x80,0x00,//-4-
0x00,0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,
};
/////////////////////////////////////////////////////////////////////////
//Bitmap点阵数据表//
//图片:
C:
\..鎈doyleee.bmp,纵向取模下高位,数据排列:
从左到右从上到下//
//图片尺寸:
128*64//
/////////////////////////////////////////////////////////////////////////
unsignedcharcodedoyleee[]=//数据表
{
0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x81,0xF1,0xF1,0xF1,0x71,0x31,
0x31,0x71,0xF1,0xF1,0xE1,0xC1,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x81,0xF1,0xF1,0xF1,0x71,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xF0,0xFF,0xFF,0xFF,0x0F,0x00,0x00,
0x00,0x00,0xC0,0xFF,0xFF,0xFF,0x7F,0x00,
0x00,0xF0,0xFC,0xFE,0xFE,0x0F,0x03,0x03,
0x07,0xFF,0xFE,0xFE,0xF8,0x00,0xE0,0xE0,
0xE0,0xE0,0x00,0x03,0x3F,0xFF,0xFF,0xFC,
0xC0,0xF0,0xFE,0x3F,0x0F,0x03,0x00,0xF0,
0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xF0,0xFC,
0xFE,0xFE,0x3F,0x33,0x33,0x33,0x3F,0x3F,
0x3E,0x38,0x00,0x00,0xF0,0xFC,0xFE,0xFE,
0x3F,0x33,0x33,0x33,0x3F,0x3F,0x3E,0x38,
0x00,0x00,0xF0,0xFC,0xFE,0xFE,0x3F,0x33,
0x33,0x33,0x3F,0x3F,0x3E,0x38,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,
0x8E,0x8F,0x8F,0x8F,0x8C,0x8C,0x8C,0x8C,
0x8E,0x8F,0x87,0x87,0x83,0x81,0x80,0x80,
0x80,0x81,0x87,0x87,0x8F,0x8E,0x8C,0x8C,
0x8F,0x87,0x87,0x83,0x80,0x80,0x80,0xC0,
0xC0,0xC0,0xC0,0xC0,0xC0,0xF3,0x7F,0x3F,
0x0F,0x03,0x00,0x00,0x00,0x00,0x0E,0x0F,
0x0F,0x0F,0x00,0x00,0x00,0x00,0x01,0x07,
0x07,0x0F,0x0E,0x0C,0x0C,0x0F,0x07,0x03,
0x01,0x00,0x00,0x00,0x01,0x07,0x07,0x0F,
0x0E,0x0C,0x0C,0x0F,0x07,0x03,0x01,0x00,
0x00,0x00,0x01,0x07,0x07,0x0F,0x0E,0x0C,
0x0C,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,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,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,0xFF,
0xFF,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x00,0x00,0xFC,
0xFC,0x04,0x0C,0xF8,0xF0,0x00,0x00,0xF0,
0xF0,0x00,0x00,0xF0,0xF0,0x00,0x00,0x40,
0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x10,
0x10,0x18,0xFC,0xFC,0x00,0x00,0x00,0x18,
0x1C,0x84,0xC4,0x7C,0x38,0x00,0x00,0xB8,
0xFC,0x64,0xC4,0xFC,0xB8,0x00,0x00,0xE0,
0xF0,0x3C,0x2C,0xE4,0xC0,0x00,0x00,0x80,
0xFC,0x7C,0x00,0xF0,0xF0,0x00,0x00,0xFC,
0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,
0xFC,0x04,0x04,0x1C,0x18,0x00,0x00,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
0x07,0x04,0x06,0x03,0x01,0x00,0x20,0x23,
0x27,0x34,0x1C,0x0F,0x03,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0x07,0x04,0x00,0x00,0x06,
0x07,0x05,0x04,0x04,0x04,0x00,0x00,0x03,
0x07,0x04,0x04,0x07,0x03,0x00,0x00,0x03,
0x07,0x04,0x04,0x07,0x03,0x00,0x00,0x01,
0x01,0x01,0x01,0x07,0x07,0x01,0x00,0x07,
0x07,0x04,0x04,0x04,0x04,0x00,0x00,0x03,
0x07,0x04,0x04,0x07,0x03,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,0xFF,
0xFF,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,0xF0,0xF0,
0x00,0x00,0x00,0x00,0xF0,0xF0,0x00,0x00,
0x00,0x20,0x20,0xF0,0xF0,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,
0x10,0x10,0x90,0x50,0xF0,0xE0,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,0xFF,
0xFF,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,0x81,0x83,
0x86,0x8C,0x8C,0x86,0x83,0x81,0x80,0x80,
0x88,0x88,0x88,0x8F,0x8F,0x88,0x88,0x88,
0x80,0x80,0x8C,0x8C,0x80,0x80,0x87,0x8F,
0x8A,0x89,0x88,0x88,0x8F,0x87,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,0xFF
};
/********************************************************************************************
//软件延时Delay()
//
*********************************************************************************************/
voidDelay(unsignedintcount){
unsignedchari;
while(--count!
=0){
for(i=0;i<125;i++);//";"表示空语句,CPU空转。
}//i从0加到125,在12M晶体下CPU大概耗时1毫秒
}
/*********************************************************************************************
//LCM12864测忙函数LCM12864_TestBusy()
//
**********************************************************************************************/
voidLCM12864_TestBusy(void){
LCM12864_RW=1;
LCM12864_RS=0;
LCM12864_E=0;
LCM12864_E=1;
while(LCM12864_DB7_DB0&LCM12864_STATUS_BUSY);
}
/*********************************************************************************************
//
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 字库 12864 程序 实例