// Show a Character
// the character is dots * dots
const int dots = 16 ;
void lcd_show_char(int x, int y, unsigned char c_char[],
int fore_color, int bk_color)
{
int i,k;
// for each char
for(i = 0;i < (dots * dots / 8);i++)
{
unsigned char currChar = c_char16[i];
// for each bit
for(k=0;k<8;k++)
{
long mask = 1<<7;
if(currChar & (mask>>k)) // Put
{
PutPixel( x + (i*8+k)%dots, y + i/2, fore_color);
}
else // Not Put
{
PutPixel( x + (i*8+k)%dots, y + i/2, bk_color);
} //if
} //for
} //for
}
// the character is dots * dots
const int dots = 16 ;
void lcd_show_char(int x, int y, unsigned char c_char[],
int fore_color, int bk_color)
{
int i,k;
// for each char
for(i = 0;i < (dots * dots / 8);i++)
{
unsigned char currChar = c_char16[i];
// for each bit
for(k=0;k<8;k++)
{
long mask = 1<<7;
if(currChar & (mask>>k)) // Put
{
PutPixel( x + (i*8+k)%dots, y + i/2, fore_color);
}
else // Not Put
{
PutPixel( x + (i*8+k)%dots, y + i/2, bk_color);
} //if
} //for
} //for
}
本文介绍了一段用于在LCD上显示字符的程序代码。该程序通过位操作来绘制每个字符的点阵图案,并允许设置前景色和背景色。通过对代码的逐行分析,读者可以了解到如何实现字符的点阵显示。
1840

被折叠的 条评论
为什么被折叠?



