panda1988 发表于 2010-8-16 09:05:02

郁闷啊!TFT屏显示一个还行,但现实多个就闪的不行!怎么办啊?

我这几天玩ILI9320的TFT,当我每次写一个字符或汉字的话就没事,可写几个的时候就一直在闪,很难看清写的东西。我写多个字符或汉字是调用写一个字符或汉字的函数。
下边是部分代码:
/*************************************************************
函数名称:LCD_DispOneMaxChar
功    能://以16*24点阵显示一个字符
参    数:chr:          要显示的字符
             xStart:要显示字符的起始X坐标
             yStart:要显示字符的起始Y坐标
             fColor:字符前景色
             bColor:字符背景色
返 回 值:无
*************************************************************/
void LCD_DispOneMaxChar(unsigned char chr,unsigned int xStart,unsigned int yStart,
                        unsigned long fColor,unsigned long bColor)
{
        unsigned char i,j;
        unsigned char nCols;
        unsigned char nRows;
        unsigned char nBytes;
        unsigned int PixelRow;
        unsigned int Mask;
        unsigned long Word;
        unsigned int *pFont;
        unsigned int *pChar;
        write_reg(0x03,0x0000);        //Entry Mode Set.
        // get pointer to the beginning of the selected font table
        pFont = (unsigned int *)FONT16x24;
       
        // get the nColumns, nRows and nBytes
        nCols = *pFont;
        nRows = *(pFont + 1);
        nBytes = *(pFont + 2);

        // get pointer to the first byte of the desired character
        pChar = pFont + nBytes*(chr - 0x1F);
       
        //define display window
        Lcd_SetBox(xStart,yStart,nCols,nRows,0,0);
       
        // loop on each row, working backwards from the top to the bottom
        for (i = 0; i < nRows; i++)
        {
                // copy pixel row from font table and then increment row
                PixelRow = *pChar++;
               
                // loop on each pixel in the row (left to right)
                // Note: we do one pixel each loop
                Mask = 0x0001;
                for (j = 0; j < nCols; j++)
                {
                        // if pixel bit set, use foreground color; else use the background color
                        if ((PixelRow & Mask) == 0)
                                Word = bColor;
                        else
                                Word = fColor;
                        Mask = Mask << 1;
                  rw_data_prepare();
                  write_data(Word);

                }
        }
}
/*************************************************************
函数名称:LCD_DispMaxStr
功    能:以16*24点阵显示字符串
参    数:pStr:字符串地址
       xStart:要显示字符串的起始X坐标
       yStart:要显示字符串的起始Y坐标
       fColor:字符前景色
       bColor:字符背景色
返 回 值:无
*************************************************************/
void LCD_DispMaxStr(unsigned char *pStr,unsigned int xStart,unsigned int yStart,unsigned long fColor,unsigned long bColor)
{
        // loop until null-terminator is seen
        while (*pStr != 0x00)
        {
                // draw the character
                LCD_DispOneMaxChar(*pStr++,xStart,yStart,fColor,bColor);
                // advance the X position
                xStart += 16;
                // bail out if X exceeds LCD_HEIGHT
                if (xStart > LCD_HEIGHT)
                        break;
        }
}
请大家帮我看看

fsclub 发表于 2010-8-16 09:17:40

没看代码。
刷屏太快了吧?
它正确写到屏上了,你眼睛反应不过来。

一次性把你要写的与到屏上,下次再写前等半秒。

zxky001 发表于 2010-8-23 16:50:34

注意延时

ufo2007 发表于 2010-9-20 12:44:04

我告诉你吧,多字的时候,字的区域叠加了,我遇到过。字距放宽些,你16*24字体比较特殊,检查代码吧
页: [1]
查看完整版本: 郁闷啊!TFT屏显示一个还行,但现实多个就闪的不行!怎么办啊?