📄 lcd15xx.lst
字号:
C51 COMPILER V8.05a LCD15XX 04/11/2008 14:19:23 PAGE 17
static void LCD_WriteDoubleCommand0(char P1, char P2) {
LCD_LOCK();
WRITE_CMD0(P1);
WRITE_CMD0(P2);
LCD_UNLOCK();
}
#if (LCD_NUM_CONTROLLERS >1)
static void LCD_WriteDoubleCommand1(char P1, char P2) {
LCD_LOCK();
WRITE_CMD1(P1);
WRITE_CMD1(P2);
LCD_UNLOCK();
}
#endif
#if (LCD_NUM_CONTROLLERS >2)
static void LCD_WriteDoubleCommand2(char P1, char P2) {
LCD_LOCK();
LCD_WRITECMD2(P1);
LCD_WRITECMD2(P2);
LCD_UNLOCK();
}
#endif
#if (LCD_NUM_CONTROLLERS >3)
static void LCD_WriteDoubleCommand3(char P1, char P2) {
LCD_LOCK();
LCD_WRITECMD3(P1);
LCD_WRITECMD3(P2);
LCD_UNLOCK();
}
#endif
/****************************************
* *
* Read data *
* *
****************************************/
#if LCD_READABLE
static U8 LCD_ReadData0(void) {
U8 r;
LCD_LOCK();
READ_DATA0(r);
LCD_UNLOCK();
return r;
}
#if (LCD_NUM_CONTROLLERS >1)
static U8 LCD_ReadData1(void) {
U8 r;
LCD_LOCK();
READ_DATA1(r);
LCD_UNLOCK();
return r;
}
#endif
#if (LCD_NUM_CONTROLLERS >2)
static U8 LCD_ReadData2(void) {
U8 r;
LCD_LOCK();
READ_DATA2(r);
LCD_UNLOCK();
return r;
}
C51 COMPILER V8.05a LCD15XX 04/11/2008 14:19:23 PAGE 18
#endif
#if (LCD_NUM_CONTROLLERS >3)
static U8 LCD_ReadData3(void) {
U8 r;
LCD_LOCK();
READ_DATA3(r);
LCD_UNLOCK();
return r;
}
#endif
#endif
/****************************************
* *
* Read command (status) *
* *
****************************************/
#if LCD_READABLE
static U8 LCD_ReadCmd0(void) {
U8 r;
LCD_LOCK();
READ_CMD0(r);
LCD_UNLOCK();
return r;
}
#if (LCD_NUM_CONTROLLERS >1)
static U8 LCD_ReadCmd1(void) {
U8 r;
LCD_LOCK();
READ_CMD1(r);
LCD_UNLOCK();
return r;
}
#endif
#if (LCD_NUM_CONTROLLERS >2)
static U8 LCD_ReadCmd2(void) {
U8 r;
LCD_LOCK();
READ_CMD2(r);
LCD_UNLOCK();
return r;
}
#endif
#if (LCD_NUM_CONTROLLERS >3)
static U8 LCD_ReadCmd3(void) {
U8 r;
LCD_LOCK();
READ_CMD3(r);
LCD_UNLOCK();
return r;
}
#endif
#endif
/*
****************************************
* *
* Write to all controllers *
* *
****************************************
C51 COMPILER V8.05a LCD15XX 04/11/2008 14:19:23 PAGE 19
Some commands should be written to all controllers at the same time.
(Commands used in the init-sequence, or display on/off).
With a multi-controller LCD it can come in handy to have a routine to
write to all of them at once.
*/
#if (LCD_NUM_CONTROLLERS ==1)
#define LCD_WriteSingleCommandAll LCD_WriteSingleCommand0
#else
void LCD_WriteSingleCommandAll(char cmd) {
LCD_WriteSingleCommand0(cmd);
LCD_WriteSingleCommand1(cmd);
#if (LCD_NUM_CONTROLLERS >2)
LCD_WriteSingleCommand2(cmd);
#endif
#if (LCD_NUM_CONTROLLERS >3)
LCD_WriteSingleCommand3(cmd);
#endif
}
#endif
/*
********************************************************************
* *
* Hardware access, register level *
* *
* Write Page / Column *
* *
********************************************************************
The following routines are used for all access to the
LCD-controller(s).
*/
#if (LCD_NUM_CONTROLLERS > 1)
static U8 CurController; /* Currently selected controller. All
hardware operations are executed on
this particular controller. It is
more efficient to have a global
variable than to pass this value as
parameter many times. And in a low
level driver as this one, the
priority of efficiency is top of
the list. */
#endif
static U8* pCacheByte;
static U8 aPage[LCD_NUM_CONTROLLERS]; /* Current page of
LCD controller(s) */
static U8 aCAdr[LCD_NUM_CONTROLLERS]; /* Current column adr
of LCD controller(s) */
static U8 Page, Col; /* Page / column of cache byte */
static U8 DataW_Dirty; /* Set (1) bits are dirty */
static U8 DataW_Cache; /* Data to be written
(not all bits may be valid !) */
static U8 DataR_Valid;
static U8 DataR_Cache;
/* The coordinates of the cache byte. We save current X,Y as well
as Y0/Y1 (min/max) in Y-direction. Note that on this level we
always talk about physical coordinates ! */
static int DataCacheX=-1; /* x-adr. of currently cached byte.
If it is <0 it is sure invalid ! */
C51 COMPILER V8.05a LCD15XX 04/11/2008 14:19:23 PAGE 20
static int DataCacheY;
static int DataCacheY0;
static int DataCacheY1;
#if LCD_SUPPORT_COMTRANS
static int DataCacheYBit0;
#else
#define DataCacheYBit0 DataCacheY0
#endif
/*
*****************************************
* *
* Set Page routines *
* *
*****************************************
These routines set the page-register of their respective
LCD-controller. Note that page is not what you might imagine,
but is a section of the controllers internal video RAM.
For details, please refer to the datasheet.
*/
static void SetPage0(void) {
SET_PAGE0(Page);
aPage[0] = Page;
}
#if (LCD_NUM_CONTROLLERS > 1)
static void SetPage1(void) {
SET_PAGE1(Page);
aPage[1] = Page;
}
#endif
#if (LCD_NUM_CONTROLLERS > 2)
static void SetPage2(void) {
SET_PAGE2(Page);
aPage[2] = Page;
}
#endif
#if (LCD_NUM_CONTROLLERS > 3)
static void SetPage3(void) {
SET_PAGE3(Page);
aPage[3] = Page;
}
#endif
/*
*****************************************
* *
* Set column routines *
* *
*****************************************
*/
static void SetCAdr0(void) {
#if LCD_SEGOFF0
U8 ColP = Col+LCD_SEGOFF0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -