?? lcddrive.h
字號:
//#include <lcddrive.h>
#include <absacc.h>
#define unchar unsigned char
#define GRAPHIC_HOME_ADRESS 2048
//-----------------------------------
//the lcd driver based on t6963c
//write by liujianwei 2005-6-23
// e-mail:liujianwei@ruyi.com
// qq:361299856
//-----------------------------------
#define LCD_DATA_PORT 0x8000
#define LCD_CMD_PORT 0x8001
#define LCD_STATUS_PORT 0x8001
//--------------------------------------
// data type declare
//-----------------------------------------
//#define unchar unsigned char
//#include <ABSACC.H>
//----------------------------------
// write data to the lcd
//----------------------------------
void WriteData(unchar Dat)
{
while ((XBYTE[LCD_STATUS_PORT]&3)!=3);
XBYTE[LCD_DATA_PORT]=Dat;
}
//---------------------------------------
// write command to the lcd
//---------------------------------------
void WriteCmd(unchar Cmd)
{
while((XBYTE[LCD_STATUS_PORT]&3)!=3);
XBYTE[LCD_CMD_PORT]=Cmd;
}
//----------------------------------------
// cursor point set
//-----------------------------------------
CursorPointSet(unchar x,unchar y)
{
WriteData(x);
WriteData(y);
WriteCmd(0x21);
}
//----------------------------------------
//adress pointer set
//-----------------------------------------
void AdressPointSet(unchar x,unchar y)
{
WriteData(x);
WriteData(y);
WriteCmd(0x24);
}
//------------------------------------------
// text area home adress set
//------------------------------------------
void TxtHomeAdresSet(unchar x,unchar y)
{
WriteData(x);
WriteData(y);
WriteCmd(0x40);
}
//-------------------------------------------
//text area width set bytes number per line
//-----------------------------------------------
void TxtWidthSet(unchar x)
{
WriteData(x);
WriteData(0);
WriteCmd(0x41);
}
//---------------------------------------------
//graphic area home adrress set
//---------------------------------------------
void GraphicHomeAdressSet(unchar x,unchar y)
{
WriteData(x);
WriteData(y);
WriteCmd(0x42);
}
//-------------------------------------------
//graphic area width set bytes number per line
//-----------------------------------------------
void GraphicWidthSet(unchar x)
{
WriteData(x);
WriteData(0);
WriteCmd(0x43);
}
//---------------------------------------------------
// display model set
// logic or,logic xor,logic and
// text special set
// ------------------------------------------------
void DisplayModelOr() //or model and use the cgrom in the lcd
{
WriteCmd(0x80);
}
//-----------------------------------------------
void displayModelXor() // xor model
{
WriteCmd(0x81);
}
//-----------------------------------------------
void displayModelAnd() //and model
{
WriteCmd(0x83);
}
//-----------------------------------------------
void TxtAttributeSet() //
{
WriteCmd(0x84);
}
//-----------------------------------------------------
// display turn on and turn off set
//---------------------------------------------------------
void CursorFlashOn()
{
WriteCmd(0x91);
}
void CursorFlashOff()
{
WriteCmd(0x90);
}
void CursorOn()
{
WriteCmd(0x92);
}
void CursorOff()
{
WriteCmd(0x90);
}
void TxtDisplayOn()
{
WriteCmd(0x94);
}
void TxtDisplayOff()
{
WriteCmd(0x90);
}
//-----------------------------------------------------
//cursor shape set
//----------------------------------------------------
void CursorShapeSet(unchar shape) //the shape my be 0xA0----0xA7
{
WriteCmd(shape);
}
//----------------------------------------------------------
// data auto read or write set
//----------------------------------------------------------
void DataAutoWrite()
{
WriteCmd(0xb0);
}
//----------------------------------------------------------
void DataAutoRead()
{
WriteCmd(0xb1);
}
//---------------------------------------------------------
void OverAutoWrite()
{
WriteCmd(0xb2);
}
void OverAutoRead()
{
WriteCmd(0xb3);
}
//--------------------------------------------------------------
// display a string at current point
//--------------------------------------------------------------
void DisplayString(unchar string[])
{
unchar i;
i=0;
DataAutoWrite();
while (string[i]!=0)
{
WriteData(string[i]-0x20);
i++;
}
OverAutoWrite();
}
//----------------------------------------------------------------
// set the attribe in the mix model
//----------------------------------------------------------------
GraphicAttribAutoWrite(unchar Attrib, unchar Number)
{unchar i;
DataAutoWrite();
for (i=0;i<=Number;i++)
{
WriteData(Attrib);
}
OverAutoWrite();
}
//---------------------------------------------------------------------
// clear the screen
//---------------------------------------------------------------------
ClrScreen()
{
int i;
AdressPointSet(0,0);
DataAutoWrite();
for (i=0;i<=1023;i++)
{
WriteData(0);
}
OverAutoWrite();
AdressPointSet(GRAPHIC_HOME_ADRESS%256,GRAPHIC_HOME_ADRESS/256);
DataAutoWrite();
for (i=0;i<=1023;i++)
{
WriteData(0);
}
OverAutoWrite();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -