搜索
bottom↓
回复: 3

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

[复制链接]

出0入0汤圆

发表于 2010-8-16 09:05:02 | 显示全部楼层 |阅读模式
我这几天玩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;
        }
}
请大家帮我看看

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入0汤圆

发表于 2010-8-16 09:17:40 | 显示全部楼层
没看代码。
刷屏太快了吧?
它正确写到屏上了,你眼睛反应不过来。

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

出0入0汤圆

发表于 2010-8-23 16:50:34 | 显示全部楼层
注意延时

出0入0汤圆

发表于 2010-9-20 12:44:04 | 显示全部楼层
我告诉你吧,多字的时候,字的区域叠加了,我遇到过。字距放宽些,你16*24字体比较特殊,检查代码吧
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-25 11:22

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表