?? txtdisplay.c
字號:
// ------------ Functions for displaying text ----------------------------------
#ifdef LCD_CHINESE
uint8 fontW = 16; // Global variables for font width and height
uint8 fontH = 2; // fontW is pixel, fontH is page
// Set the width and height of font in pixel
void SetFont(uint8 fWidth, fHeight)
{
fontW = fWidth;
fontH = fHeight/8; // convert to pagehold
}
// Display a string of Chinese Charactors on the LCD Screen
void disp_hanzi(uint8 *ptrHanzi, uint8 startP, uint8 startC)
{
// Attention for Keil's 0xFD Bug
uint16 i;
uint8 k;
while((*ptrHanzi) != '\0')
{
for (i = 0; i < HZ_MAX; i++)
{
if ((*ptrHanzi == GB16[i].Index[0]) &&
(*(ptrHanzi + 1) == GB16[i].Index[1]))
{
for (k = 0; k < fontW*fontH; k++)
{
if (k%fontW == 0)
{
Gotoxy(startP - k/fontW, startC);
}
SendByte(iDat, GB16[i].Msk[k]);
}
break;
}
}
ptrHanzi += 2;
startC += fontW;
}
}
#endif
#ifdef LCD_ASCII_0508
// Display an Ascii string on the LCD Screen
void disp_ascii0508(uint8 *ptrAscii, uint8 startP, uint8 startC)
{
uint16 index;
uint8 i;
Gotoxy(startP, startC);
while((*ptrAscii) != '\0')
{
index = ((*ptrAscii) - 0x20)*5;
for (i = 0; i < 5; i++)
{
SendByte(iDat, AsciiDot0508[index++]);
}
SendByte(iDat, 0x00);
ptrAscii++;
}
}
// Tile screen with one letter
void aTile(uint8 *Abc)
{
uint8 i, k;
// Display Abc
for (i = 0; i < LCD_PMAX; i++)
{
SetPA(i);
for (k = 0; k < LCD_CMAX/6; k++)
{
disp_ascii0508(Abc, i, k*6);
//DelayMs(100);
}
}
}
// Call built-in Charactors
void CallBuiltinChar(void)
{
uint8 i;
uint8 RowCounter = LCD_ROW;
uint8 CurrentChar[] = "S";
for (i = 0; i < 95; i++)
{
if (i%LCD_COL == 0)
{
RowCounter--;
}
if ((i != 0)&&(i%LCD_CHAR == 0))
{
wait_and_clear();
RowCounter = LCD_ROW - 1;
}
CurrentChar[0] = 0x20 + i;
disp_ascii0508(CurrentChar, RowCounter, (i%LCD_COL)*6);
}
if (i == 95)
wait_and_clear();
}
#endif
#ifdef LCD_ASCII_0816
// Display an Ascii string on the LCD Screen
void disp_ascii0816(uint8 *ptrAscii, uint8 startP, uint8 startC)
{
uint16 index;
uint8 i;
while((*ptrAscii) != '\0')
{
Gotoxy(startP, startC);
index = ((*ptrAscii) - 0x20)*16;
for (i = 0; i < 16; i++)
{
if (i == 8)
{
Gotoxy(startP - 1, startC);
}
SendByte(iDat, AsciiDot0816[index++]);
}
startC += 8;
ptrAscii++;
}
}
#endif
// -----------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -