玩ILI9320的TFT

[复制链接]
833|11
 楼主| dingy 发表于 2018-12-22 18:20 | 显示全部楼层 |阅读模式
当我每次写一个字符或汉字的话就没事,可写几个的时候就一直在闪,很难看清写的东西
chenjunt 发表于 2018-12-22 18:37 | 显示全部楼层
怎么实现的啊
 楼主| dingy 发表于 2018-12-22 18:40 | 显示全部楼层

我写多个字符或汉字是调用写一个字符或汉字的函数。
ousj 发表于 2018-12-22 18:46 | 显示全部楼层
代码看看吧
yinxiangh 发表于 2018-12-23 13:49 | 显示全部楼层
函数名称CD_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);

}
}
}
/*************************************************************
函数名称CD_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;
}
}
pengf 发表于 2018-12-23 16:11 | 显示全部楼层

没看代码。
刷屏太快了吧?
它正确写到屏上了,你眼睛反应不过来。
renyaq 发表于 2018-12-23 16:15 | 显示全部楼层
一次性把你要写的与到屏上,下次再写前等半秒。
liuzaiy 发表于 2018-12-23 16:17 | 显示全部楼层
多字的时候,字的区域叠加了,我遇到过。
kangzj 发表于 2018-12-23 16:21 | 显示全部楼层

字距放宽些,你16*24字体比较特殊,检查代码吧
ousj 发表于 2018-12-23 16:24 | 显示全部楼层

lz是用在PSOC上的吗??
 楼主| dingy 发表于 2018-12-23 16:27 | 显示全部楼层


哦,我看看吧
keaibukelian 发表于 2019-1-8 11:33 | 显示全部楼层
是不是刷新频率太高了啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

745

主题

10920

帖子

6

粉丝
快速回复 在线客服 返回列表 返回顶部