玩过TFT彩屏的都进来帮忙找找问题呗

2019-03-23 19:02发布

为什么会出现这种情况呢
刷屏时没问题的
3BBFAB81EB419EBF2C2E079A0466C21E.jpg 1.jpg

int main(void)
{         
//          u8 x=0;
        u8 lcd_id[12];                        //′æ·ÅLCD ID×Ö·û′®
        delay_init();                     //Ñóê±oˉêy3õê¼»ˉ         
        NVIC_Configuration();          //éèÖÃNVICÖD¶Ï·Ö×é2:2λÇàÕ¼óÅÏ輶£¬2λÏìó|óÅÏ輶
        uart_init(9600);                 //′®¿ú3õê¼»ˉÎa9600
        LED_Init();                             //LED¶Ë¿ú3õê¼»ˉ
        LCD_Init();
        POINT_COLOR=RED;                                 
  while(1)
        {                 
                POINT_COLOR=RED;         
                LCD_ShowString(64,0,320,16,16,"ABCDEF");                                                           
                delay_ms(1000);        
        }
}

void LCD_ShowString(u8 x,u8 y,u8 width,u8 height,u8 size,u8 *p)
{         
        u8 x0=x;
        width+=x;
        height+=y;
    while((*p<='~')&&(*p>=' '))
    {      
        if(x>=width){x=x0;y+=size;}
        if(y>=height)break;//íË3ö
        LCD_ShowChar(x,y,*p,size,0);
        x+=size/2;
        p++;
    }  
}
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode)
{                                                            
  u8 temp,t1,t;
        u16 y0=y;
        u16 colortemp=POINT_COLOR;                                   
        num=num-' ';
        if(!mode) //·Çμt¼ó·½ê½
        {
            for(t=0;t<size;t++)
            {   
                                if(size==12)temp=asc2_1206[num][t];
                                else temp=asc2_1608[num][t];                                         
                                for(t1=0;t1<8;t1++)
                                {                           
                                                if(temp&0x80)POINT_COLOR=colortemp;
                                                else POINT_COLOR=BACK_COLOR;
                                                LCD_DrawPoint(x,y);        
                                                temp<<=1;
                                                y++;
                                                if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//
                                                if((y-y0)==size)
                                                {
                                                        y=y0;
                                                        x++;
                                                        if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//
                                                        break;
                                                }
                                }           
            }   
        }else
        {
            for(t=0;t<size;t++)
            {   
                        if(size==12)temp=asc2_1206[num][t];  //
                        else temp=asc2_1608[num][t];                 //                        
            for(t1=0;t1<8;t1++)
                        {                           
                    if(temp&0x80)LCD_DrawPoint(x,y);
                                temp<<=1;
                                y++;
                                if(x>=lcddev.height){POINT_COLOR=colortemp;return;}//
                                if((y-y0)==size)
                                {
                                        y=y0;
                                        x++;
                                        if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//
                                        break;
                                }
                        }           
            }     
        }
        POINT_COLOR=colortemp;                                          
}
void LCD_SetCursor(u16 Xpos, u16 Ypos)
{         
          LCD_WR_REG(lcddev.setxcmd);
                LCD_WR_DATA(Xpos>>8);
                LCD_WR_DATA(Xpos&0XFF);         
                LCD_WR_REG(lcddev.setycmd);
                LCD_WR_DATA(Ypos>>8);
                LCD_WR_DATA(Ypos&0XFF);
}                   此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
9条回答
楞伽山人
1楼-- · 2019-03-24 21:10
 精彩回答 2  元偷偷看……
平行电
2楼-- · 2019-03-25 00:38
看一下初始化寄存器的时候是什么要求,我以前用的时候,可以设置是竖着还是倒着写点,另外最有效的接决方案是在哪里买的从哪里找资料,这样效率高
季夏木槿
3楼-- · 2019-03-25 02:04
你贴的这个代码咋有问题呢?

一周热门 更多>