|
我的編譯環(huán)境是keil5,我想接受藍牙串口過來的數(shù)據(jù),然后單片機處理后顯示在tft上。
開始是學(xué)習(xí)用歷程usart1來操作,發(fā)現(xiàn)buf里面的數(shù)據(jù)無法顯示在tft上,sprintf函數(shù)也使用了,參考的tft歷程和視頻和手頭tft的歷程的不一樣,在確定usart1電腦和單片機通信沒問題以后,看兩種tft歷程也沒看出個所以然。。。
這個是我手頭tft的歷程
void LCD_ShowString(u16 x,u16 y,const u8 *p)
{
while(*p!='\0')
{
if(x>LCD_W-16){x=0;y+=16;}
if(y>LCD_H-16){y=x=0;LCD_Clear(RED);}
LCD_ShowChar(x,y,*p,0);
x+=8;
p++;
}
}
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode)
{
u8 temp;
u8 pos,t;
u16 x0=x;
u16 colortemp=POINT_COLOR;
if(x>LCD_W-16||y>LCD_H-16)return;
num=num-' ';
Address_set(x,y,x+8-1,y+16-1);
if(!mode)
{
for(pos=0;pos<16;pos++)
{
temp=asc2_1608[(u16)num*16+pos];
for(t=0;t<8;t++)
{
if(temp&0x01)POINT_COLOR=colortemp;
else POINT_COLOR=BACK_COLOR;
LCD_WR_DATA(POINT_COLOR);
temp>>=1;
x++;
}
x=x0;
y++;
}
}else
{
for(pos=0;pos<16;pos++)
{
temp=asc2_1608[(u16)num*16+pos];
for(t=0;t<8;t++)
{
if(temp&0x01)LCD_DrawPoint(x+t,y+pos);
temp>>=1;
}
}
}
POINT_COLOR=colortemp;
}
void LCD_DrawPoint(u16 x,u16 y)
{
Address_set(x,y,x,y);//設(shè)置光標(biāo)位置
LCD_WR_DATA(POINT_COLOR);
}
然后就操作不明白了,不知道為什么人家就是sprintf+lcd_showstring兩句話就能解決,為啥我不行呢,真是一頭霧水,能麻煩大佬看一眼嗎,謝謝大佬 |
|