中级会员
 
- 积分
- 347
- 金钱
- 347
- 注册时间
- 2012-5-20
- 在线时间
- 0 小时
|

楼主 |
发表于 2012-7-7 15:25:03
|
显示全部楼层
回复【13楼】正点原子:
---------------------------------
下面是想做18*18字体的改动,18*18只显示!.调试没成功,想拜托师兄指教,下面的哪改错了,如何修改呢 红色为修改部分,请师兄帮忙,不胜感激
const unsigned char asc2_1808[2][36]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" " 0*/
{0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!"1*/
};
ILI93xx.c文件改动
void LCD_ShowString(u16 x,u16 y,const u8 *p,u8 size )
{
while(*p!='\0')
{
if(x>MAX_CHAR_POSX){x=0;y+=16;}
if(y>MAX_CHAR_POSY){y=x=0;LCD_Clear(WHITE);}
if(size==16) LCD_ShowChar(x,y,*p,16,1);
if(size==12) LCD_ShowChar(x,y,*p,12,1);
if(size==18) LCD_ShowChar(x,y,*p,18,1);
x+=8;
p++;
}
}
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode)
{
#if USE_HORIZONTAL==1
#define MAX_CHAR_POSX 312
#define MAX_CHAR_POSY 232
#else
#define MAX_CHAR_POSX 232
#define MAX_CHAR_POSY 312
#endif
u8 temp,a=0;
u8 pos,t;
u16 x0=x;
u16 colortemp=POINT_COLOR;
if(x>MAX_CHAR_POSX||y>MAX_CHAR_POSY)return;
//设置窗口
num=num-' ';//得到偏移后的值
if(!mode) //非叠加方式
{
for(pos=0;pos<size;pos++)
{
if(size==12||size==16)
{
if(size==12)temp=asc2_1206[num][pos]; //调用1206字体
if(size==16)temp=asc2_1608[num][pos]; //调用1608字体
for(t=0;t<size/2;t++)
{
if(temp&0x01)POINT_COLOR=colortemp;
else  OINT_COLOR=BACK_COLOR;
LCD_DrawPoint(x,y);
temp>>=1;
x++;
}
}
if(size==18)
{
temp=asc2_1808[num][a];
for(t=0;t<8;t++)
{
if(temp&0x01)POINT_COLOR=colortemp;
else  OINT_COLOR=BACK_COLOR;
LCD_DrawPoint(x,y);
temp>>=1;
x++;
}
a++;
temp=asc2_1808[num][a];
for(t=0;t<8;t++)
{
temp=asc2_1808[num][a];
if(temp&0x01)POINT_COLOR=colortemp;
else  OINT_COLOR=BACK_COLOR;
LCD_DrawPoint(x,y);
temp>>=1;
x++;
}
a++;
}
x=x0;
y++;
}
}
}
主函数改动
int main(void)
{
Stm32_Clock_Init(9);//系统时钟设置
delay_init(72); //延时初始化
uart_init(72,9600); //串口1初始化
LED_Init();
LCD_Init();
  OINT_COLOR=YELLOW;
LCD_Clear(BLACK);
LCD_ShowString(30,110,"11haha#3034",16);
LCD_ShowString(30,50,"!",18);
LCD_ShowString(30,70,"11haha#3034",12);
LED0=!LED0;
delay_ms(1000);
}
以上的12和16都现显示正常,但是18不行,想拜托师兄,如果有时间帮忙指正一下。 万分感激。 |
|