?? lcm240128.c
字號:
0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66, /*-- Q --*/
0x66,0x66,0x66,0x3C,0x0C,0x06,0x00,0x00,
0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C, /*-- R --*/
0x6C,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3C,0x66,0x60,0x30,0x18, /*-- S --*/
0x0C,0x06,0x66,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18, /*-- T --*/
0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66, /*-- U --*/
0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66, /*-- V --*/
0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x6B, /*-- W --*/
0x6B,0x36,0x36,0x36,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x66,0x66,0x34,0x18,0x18, /*-- X --*/
0x2C,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3C, /*-- Y --*/
0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x7E,0x06,0x06,0x0C,0x18, /*-- Z --*/
0x30,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x3C,0x30,0x30,0x30,0x30, /*-- [ --*/
0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x3C,
0x00,0x00,0x00,0x60,0x60,0x30,0x30,0x18, /*-- \ --*/
0x18,0x0C,0x0C,0x06,0x06,0x00,0x00,0x00,
0x00,0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C, /*-- ] --*/
0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x3C,
0x00,0x18,0x3C,0x66,0x00,0x00,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,0x38,0x18,0x0C,0x00,0x00,0x00,0x00, /*-- ` --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x06, /*-- a --*/
0x3E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66, /*-- b --*/
0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x60, /*-- c --*/
0x60,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x06,0x06,0x3E,0x66,0x66, /*-- d --*/
0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66, /*-- e --*/
0x7E,0x60,0x60,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1E,0x30,0x30,0x30,0x7E, /*-- f --*/
0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66, /*-- g --*/
0x66,0x66,0x66,0x3E,0x06,0x06,0x7C,0x7C,
0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66, /*-- h --*/
0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x18,0x00,0x78,0x18,0x18, /*-- i --*/
0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,
0x00,0x00,0x0C,0x0C,0x00,0x3C,0x0C,0x0C, /*-- j --*/
0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x78,0x78,
0x00,0x00,0x00,0x60,0x60,0x66,0x66,0x6C, /*-- k --*/
0x78,0x6C,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18, /*-- l --*/
0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7E,0x6B,0x6B, /*-- m --*/
0x6B,0x6B,0x6B,0x63,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66, /*-- n --*/
0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66, /*-- o --*/
0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66, /*-- p --*/
0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,
0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66, /*-- q --*/
0x66,0x66,0x66,0x3E,0x06,0x06,0x06,0x06,
0x00,0x00,0x00,0x00,0x00,0x66,0x6E,0x70, /*-- r --*/
0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3E,0x60,0x60, /*-- s --*/
0x3C,0x06,0x06,0x7C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x30,0x30,0x7E,0x30,0x30, /*-- t --*/
0x30,0x30,0x30,0x1E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66, /*-- u --*/
0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66, /*-- v --*/
0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x63,0x6B,0x6B, /*-- w --*/
0x6B,0x6B,0x36,0x36,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C, /*-- x --*/
0x18,0x3C,0x66,0x66,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66, /*-- y --*/
0x66,0x66,0x66,0x3C,0x0C,0x18,0xF0,0xF0,
0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C, /*-- z --*/
0x18,0x30,0x60,0x7E,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0C,0x18,0x18,0x18,0x30, /*-- { --*/
0x60,0x30,0x18,0x18,0x18,0x0C,0x00,0x00,
0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18, /*-- | --*/
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x00,0x00,0x00,0x30,0x18,0x18,0x18,0x0C, /*-- } --*/
0x06,0x0C,0x18,0x18,0x18,0x30,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x71,0xDB, /*-- ~ --*/
0x8E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*-- . --*/
0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00,
};
typedef struct // 漢字字模數據結構
{
char Index[2];
char Msk[32];
}typFNT_GB16;
typFNT_GB16 code GB_16[] =
{ // 顯示為16*16
/*-- 文字: 上 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"上",
0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xF8,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x7F,0xFE,0x00,0x00,
/*-- 文字: 海 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"海",
0x21,0x00,0x11,0x00,0x11,0xFE,0x02,0x00,0x97,0xF8,0x52,0x88,0x52,0x48,0x12,0x08,
0x2F,0xFE,0x22,0x88,0xE2,0x48,0x22,0x08,0x23,0xFE,0x20,0x08,0x20,0x28,0x20,0x10,
/*-- 文字: 創 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"創",
0x08,0x02,0x08,0x02,0x14,0x12,0x13,0x12,0x21,0xD2,0x40,0x92,0xBF,0x12,0x21,0x12,
0x21,0x12,0x25,0x12,0x22,0x12,0x20,0x82,0x20,0x82,0x20,0x8A,0x1F,0x84,0x00,0x00,
/*-- 文字: 遠 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"遠",
0x00,0x00,0x47,0xF8,0x30,0x00,0x20,0x00,0x00,0x00,0x0F,0xFE,0xF1,0x20,0x11,0x20,
0x11,0x20,0x11,0x22,0x12,0x22,0x14,0x1E,0x10,0x00,0x28,0x00,0x47,0xFE,0x00,0x00,
"電",
/*-- 文字: 電 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,
0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xFE,0x00,0x00,
/*-- 文字: 子 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"子",
0x00,0x00,0x3F,0xF0,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x01,0x00,0x01,0x04,
0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,
/*-- 文字: 有 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"有",
0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x0F,0xF0,0x18,0x10,0x28,0x10,
0x4F,0xF0,0x88,0x10,0x08,0x10,0x0F,0xF0,0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20,
/*-- 文字: 限 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"限",
0x00,0x00,0xFB,0xF8,0x92,0x08,0x93,0xF8,0xA2,0x08,0xA2,0x08,0x93,0xF8,0x8A,0x80,
0x8A,0x48,0xAA,0x50,0x92,0x20,0x82,0x20,0x82,0x10,0x82,0x8E,0x83,0x04,0x82,0x00,
/*-- 文字: 公 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"公",
0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,
/*-- 文字: 司 --*/
/*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
"司",
0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,
};
uchar code turnf[8] = {7,6,5,4,3,2,1,0};
uchar gCurRow,gCurCol; // 當前行、列存儲,行高16點,列寬8點
/* 取當前行數據 */
uchar fnGetRow(void)
{
return gCurRow;
}
/* 取當前列數據 */
uchar fnGetCol(void)
{
return gCurCol;
}
/************************************************/
/* 狀態位STA1,STA0判斷(讀寫指令和讀寫數據) */
/* 在讀寫數據或者寫入命令前必須保證均為1 */
/************************************************/
uchar fnSTA01(void)
{
uchar i;
for(i=10;i>0;i--)
{
if((LCMCW & 0x03) == 0x03) // 讀取狀態
break;
}
return i; // 若返回零,說明錯誤
}
/********************************************************/
/*檢查STA2,如果 STA2=1 為自動讀狀態 */
/********************************************************/
uchar fnSTA2(void)
{
uchar i;
for(i=10;i>0;i--)
{
if((LCMCW & 0x04) == 0x04)
break;
}
return i; // 若返回零,說明錯誤
}
/********************************************************/
/* 狀態位STA3判斷(STA3 = 1 數據自動寫狀態) */
/********************************************************/
uchar fnSTA3(void)
{
uchar i;
for(i=10;i>0;i--)
{
if((LCMCW & 0x08) == 0x08)
break;
}
return i; // 若返回零,說明錯誤
}
/********************************************************/
/* 狀態位STA6判斷(STA6 =1 屏讀/屏拷貝狀態) */
/********************************************************/
uchar fnSTA6(void)
{
uchar i;
for(i=10;i>0;i--)
{
if((LCMCW & 0x40) == 0x40)
break;
}
return i; // 若返回零,說明錯誤
}
/********************************************************/
/* 寫雙參數的指令 */
/********************************************************/
uchar fnPR1(uchar uCmd,uchar uPar1,uchar uPar2)
{
if(fnSTA01() == 0)
return 1;
LCMDW = uPar1;
if(fnSTA01() == 0)
return 2;
LCMDW = uPar2;
if(fnSTA01() == 0)
return 3;
LCMCW = uCmd;
return 0; // 返回0成功
}
/********************************************************/
/* 寫單參數的指令 */
/********************************************************/
uchar fnPR11(uchar uCmd,uchar uPar1)
{
if(fnSTA01() == 0)
return 1;
LCMDW = uPar1;
if(fnSTA01() == 0)
return 2;
LCMCW = uCmd;
return 0; // 返回0成功
}
/********************************************************/
/* 寫無參數的指令 */
/********************************************************/
uchar fnPR12(uchar uCmd)
{
if(fnSTA01() == 0)
return 1;
LCMCW = uCmd;
return 0; // 返回0成功
}
/********************************************************/
/* 寫數據 */
/********************************************************/
uchar fnPR13(uchar uData)
{
if(fnSTA3() == 0)
return 1;
LCMDW = uData;
return 0; // 返回0成功
}
/********************************************************/
/* 讀數據 */
/********************************************************/
uchar fnPR2(void)
{
if(fnSTA01() == 0)return 1; // 獲取狀態,如果狀態錯
return LCMDW; // 返回數據
}
/********************************************************/
/* 設置當前地址 */
/********************************************************/
void fnSetPos(uchar urow, uchar ucol)
{
uint iPos;
iPos = urow * 30 + ucol+(Addr_High);
fnPR1(LC_ADD_POS,iPos & 0xFF,iPos / 256);
gCurRow = urow;
gCurCol = ucol;
}
/********************************************************/
/* 設置當前顯示行、列 */
/********************************************************/
void cursor(uchar uRow, uchar uCol)
{
fnSetPos(uRow * 16, uCol);
}
/********************************************************/
/* 清屏 */
/********************************************************/
void cls(void)
{
uint i;
fnPR1(LC_ADD_POS,0x00,0x00); // 置地址指針為從零開始
fnPR12(LC_AUT_WR); // 自動寫
for(i=0;i<240*128/8+(Addr_High);i++) // 清一屏
{
fnSTA3();
fnPR13(0x00); // 寫數據,實際使用時請將0x55改成0x0
}
fnPR12(LC_AUT_OVR); // 自動寫結束
fnPR1(LC_ADD_POS,0x00,0x00); // 重置地址指針
gCurRow = 0; // 置地址指針存儲變量
gCurCol = 0;
}
/********************************************************/
/* dispaly logo */
/********************************************************/
void dispalylogo(void)
{
uchar i,m;
uchar j,uRow,uCol;
uchar arow,acol;
arow=120;
acol=160/8;
fnPR1(LC_ADD_POS,0x00,Addr_High>>8); // 置地址指針為從零開始
uRow=2;
uCol=2;
j=0;
fnSetPos(uRow,uCol);
for(j=0;j<arow;j++)
{
fnPR12(LC_AUT_WR); // 自動寫.
for(i=0;i<acol;i++)
{
fnSTA3();
m=LOGO[j*acol+i];
fnPR13(m);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -