?? lcdop.c
字號(hào):
#define _LCD_INCLUDE
#include "include.h"
//=======================Pin Define==========================
sbit LcdCL = P1^0;
sbit LcdDI = P1^1;
sbit LcdCE = P1^2;
code BYTE CCBADDR[]={0x41};
code BYTE StrDispOther[]={0x00,0x00,0x00,0x00,0x00};//remains 5 bytes inclued DR SC BU
code WORD StrDisp[]={0x6301,0x6000,0x4718,0x1234,0x2345,//0~4
0x0000,0x6000,0x4718,0x1234,0x2345,//5~9
0x0000,0x6000,0x4718,0x1234,0x2345,//A~E
0x0000,0x6000,0x4718,0x1234,0x2345,//F~J
0x0000,0x6000,0x4718,0x1234,0x2345,//K~O
0x0000,0x6000,0x4718,0x1234,0x2345,//P~T
0x0000,0x6000,0x4718,0x1234,0x2345,//U~Y
0x2345};//Z
WORD *DispDataPstr = StrDisp;
//====================================================
void LcdSendOneByte(BYTE Data)
{
BYTE DataBit;
for (DataBit = 0; DataBit < 8; DataBit++)
{
LcdCL = 0;
if (Data & 0x01) //LSB send first
LcdDI = 1;
else
LcdDI = 0;
LcdCL = 1;
Data >>= 1;
}
}
void LcdSend15Bits(WORD Data)
{
BYTE DataBit;
for (DataBit = 0; DataBit < 15; DataBit++)
{
LcdCL = 0;
if (Data & 0x01) //LSB send first
LcdDI = 1;
else
LcdDI = 0;
LcdCL = 1;
Data >>= 1;
}
}
void LcdDisplay(WORD *DataPstr)
{
BYTE ByteCount, *StrDataPstr;
//CCBADDR = 0x41
LcdSendOneByte(*CCBADDR);
//send data display
LcdCE = 1; //enable Lcd chip
for (ByteCount = 0; ByteCount < 8; ByteCount++)
{
LcdSend15Bits(*DataPstr);
DataPstr++;
if (DataPstr > StrDisp + 35) //0 will behind the z
DataPstr = StrDisp;
}
//send others include DR SC BU
StrDataPstr = StrDispOther;
for (ByteCount = 0; ByteCount < sizeof(StrDispOther); ByteCount++)
{
LcdSendOneByte(*StrDataPstr);
DataPstr++;
}
LcdCE = 0; //disable Lcd chip
}
void LcdRollOver(BYTE RollFlag)
{
LcdDisplay(DispDataPstr);
if (RollFlag == LEFT)
{
DispDataPstr++;
if (DispDataPstr > StrDisp + 35)
DispDataPstr = StrDisp;
}
else
{
DispDataPstr--;
if (DispDataPstr < StrDisp)
DispDataPstr = StrDisp + 35;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -