?? lcd.c
字號(hào):
LCD_COM = 0x42;
for (j=0;j<high;j++) LCD_DAT=0x78;
}
//清條形圖
void ClearBar(Uint16 x, Uint16 y, Uint16 high, Uint16 partition)
{
union{
Uint16 total;
struct{
Uint16 low:8;
Uint16 high:8;
}e;
}d;
Uint16 j;
d.total=x+(y-high)*41;
if (partition==2) d.total=d.total+0x2a00;
if (partition==3) d.total=d.total+0x5400;
LCD_COM = 0x4F;
LCD_COM = 0x46;
LCD_DAT = d.e.low;
LCD_DAT = d.e.high;
LCD_COM = 0x42;
for (j=0;j<high;j++) LCD_DAT=0x00;
}
//==============================================================================
//************************* PAGE 2 ********************************************
//==============================================================================
// 顯示24x24點(diǎn)陣字
void display1(Uint16 dsp,Uint16 x, Uint16 y,Uint16 condition,Uint16 partition)
{
union
{
Uint16 total;
struct
{
Uint16 low:8;
Uint16 high:8;
}e;
}d;
Uint16 dspah;
Uint16 i,j,k;
const Uint16 *word;
if(dsp<500) k=2,word=LIB16x24,dspah=dsp*48;
else k=3,word=LIB24x24,dspah=(dsp-500)*72;
for(i=0;i<k;i++)
{
d.total=x+y*41+i;
if (partition==2) d.total=d.total+0x2a00;
if (partition==3) d.total=d.total+0x5400;
LCD_COM = 0x4F;
LCD_COM = 0x46;
LCD_DAT = d.e.low;
LCD_DAT = d.e.high;
LCD_COM = 0x42;
for (j=0;j<24;j++)
{
dsp=word[dspah+j*k+i];
if (condition==0) LCD_DAT = dsp;
else LCD_DAT = ~dsp;
}
}
}
//顯示16x16點(diǎn)漢字
void display2(Uint16 dsp,Uint16 x, Uint16 y,Uint16 condition,Uint16 partition) /*顯示16x24點(diǎn)陣,24X24點(diǎn)陣*/
{
union
{
Uint16 total;
struct
{
Uint16 low:8;
Uint16 high:8;
}e;
}d;
Uint16 dspah;
Uint16 i,j,k;
const Uint16 *word;
if(dsp<500) k=1,word=LIB8x16,dspah=dsp*16;
else k=2,word=LIB16x16,dspah=(dsp-500)*32;
for(i=0;i<k;i++)
{
d.total=x+y*41+i;
if (partition==2) d.total=d.total+0x2a00;
if (partition==3) d.total=d.total+0x5400;
LCD_COM = 0x4F;
LCD_COM = 0x46;
LCD_DAT = d.e.low;
LCD_DAT = d.e.high;
LCD_COM = 0x42;
for (j=0;j<16;j++)
{
dsp=word[dspah+j*k+i];
if (condition==0) LCD_DAT = dsp;
else LCD_DAT = ~dsp;
}
}
}
void display64(Uint16 dsp,Uint16 x, Uint16 y,Uint16 condition,Uint16 partition)
{
union
{
Uint16 total;
struct
{
Uint16 low:8;
Uint16 high:8;
}e;
}d;
Uint16 dspah;
Uint16 i,j;
const Uint16 *word;
word=LIB64,dspah=dsp*512;
for(i=0;i<8;i++)
{
d.total=x+y*41+i;
if (partition==2) d.total=d.total+0x2a00;
if (partition==3) d.total=d.total+0x5400;
LCD_COM = 0x4F;
LCD_COM = 0x46;
LCD_DAT = d.e.low;
LCD_DAT = d.e.high;
LCD_COM = 0x42;
for (j=0;j<64;j++)
{
dsp=word[dspah+j*8+i];
if (condition==0) LCD_DAT = dsp;
else LCD_DAT = ~dsp;
}
}
}
void ShowWord(Uint16 menunum,Uint16 partition )
{
Uint16 a,b,m=0;
const Uint16 *mnum;
if(menunum<500) mnum=WordList1[menunum];
else mnum=WordList2[menunum-500];
while (mnum[m]!=last)
{
a=mnum[m],m++;
b=mnum[m],m++;
while (mnum[m]!= end)
{
if(menunum<500) display1(mnum[m],a,b,0,partition),a++,a++;
else display2(mnum[m],a,b,0,partition),a++;
if (mnum[m]>=500) a++;
m++;
}
m++;
}
}
void ShowIcon(Uint16 menunum,Uint16 partition )
{
Uint16 a,b,m=0;
const Uint16 *mnum;
mnum=IconList[menunum];
while (mnum[m]!=last)
{
a=mnum[m],m++;
b=mnum[m],m++;
while (mnum[m]!= end)
{
display64(mnum[m],a,b,0,partition),a++,a++,a++,a++;
m++;
}
m++;
}
}
void ShowChar(Uint16 menunum,Uint16 Num,Uint16 partition )
{
Uint16 a,b,m=0;
Uint16 TempNum=0;
const Uint16 *mnum;
if(menunum<500) mnum=WordList1[menunum];
else mnum=WordList2[menunum-500];
while (TempNum != Num)
{
while (mnum[m]!= end)
{
m++;
}
TempNum++;
m++;
if (mnum[m] == last) return;
}
a=mnum[m],m++;
b=mnum[m],m++;
while (mnum[m]!= end)
{
if(menunum<500) display1(mnum[m],a,b,0,partition),a++,a++;
else display2(mnum[m],a,b,0,partition),a++;
if (mnum[m]>=500) a++;
m++;
}
m++;
}
//***********************************************************************
//======================================================================
//===================== PAGE 3 =========================================
//=======================================================================
//***********************************************************************
void WhiteNum(Uint16 num,Uint16 white,Uint16 partition)
{
union
{
Uint16 total;
struct
{
Uint16 low:8;
Uint16 high:8;
}e;
}d;
Uint16 i,j;
const Uint16 *mnum;
mnum=WhiteList[num];
white=4*white;
for (i=0;i<mnum[white+2];i++)
{
for(j=0;j<mnum[white+3];j++)
{
d.total=(i+mnum[white])+(mnum[white+1]+j)*41;/*字符在顯存中的地址int型*/
if (partition==2) d.total=d.total+0x2a00;
if (partition==3) d.total=d.total+0x5400;
LCD_COM = 0x46;
LCD_DAT = d.e.low;
LCD_DAT = d.e.high;
LCD_COM = 0x43;
num = LCD_COM;
num=~num;
LCD_COM = 0x46;
LCD_DAT = d.e.low;
LCD_DAT = d.e.high;
LCD_COM = 0x42;
LCD_DAT = num;
}
}
}
//***********************************************************************
//======================================================================
//===================== PAGE 4 =======================================
//=======================================================================
//***********************************************************************
void Smenu(void)
{
drawarea(1,1,320,240,2);
drawarea(2,2,319,239,2);
drawabscissa(29,1,320,2);
drawabscissa(28,1,320,2);
drawabscissa(219,1,320,2);
drawabscissa(220,1,320,2);
ShowWord(0,2);
ShowIcon(0,2);
ShowWord(500,2);
}
//===============================================================
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -