在LCD上显示一个6x8的字符,字库格式是这样的
unsigned char code Font_code[][6] = {
{0x00,0x00,0x00,0x00,0x00,0x00},// (0)
{0x00,0x00,0x00,0x4F,0x00,0x00},//!(1)
{0x00,0x00,0x07,0x00,0x07,0x00},//"(2)
{0x00,0x14,0x7F,0x14,0x7F,0x14},//#(3)
{0x00,0x24,0x2A,0x7F,0x2A,0x12},//$(4)
{0x00,0x23,0x13,0x08,0x64,0x62},//%(5)
{0x00,0x36,0x49,0x55,0x22,0x50},//&(6)
{0x00,0x00,0x05,0x03,0x00,0x00},//'(7)
{0x00,0x00,0x1C,0x22,0x41,0x00},//((8)
{0x00,0x00,0x41,0x22,0x1C,0x00},//)(9)
{0x00,0x14,0x08,0x3E,0x08,0x14},//*(10)
{0x00,0x08,0x08,0x3E,0x08,0x08},//+(11)
{0x00,0x00,0x50,0x30,0x00,0x00},//,(12)
{0x00,0x08,0x08,0x08,0x08,0x08},//-(13)
{0x00,0x00,0x60,0x60,0x00,0x00},//.(14)
.
.
.
}
程序中调用(显示6x8的字符)
void print6x8c(unsigned char x, unsigned char y, unsigned char c_dat)
{
unsigned char i;
c_dat -= 32; //查表
x *= 6; //宽6
LCD_pos_byte(x, y); //坐标
for(i = 0; i < 6; i++) LCD_write_dat(Font_code[c_dat][i]);
}
请问这个c_dat -= 32;为啥要-32?
所以需要减去32 你看ascii码表数字0的位置和实际字库里面0的位置就知道了
一周热门 更多>