tft屏图像显示也成功完成

2010-04-30 14:18:00

tft屏图像显示也成功完成。

其实有了刷屏的经验,图像显示就很简单。

void address_set(uint x1,uint y1,uint x2,uint y2)
{
    main_W_com_data(0x0020,x1);//设置X坐标位置
    main_W_com_data(0x0021,y1);//设置Y坐标位置
    main_W_com_data(0x0050,x1);   //开始X
 main_W_com_data(0x0052,y1);   //开始Y
    main_W_com_data(0x0051,x2);  //结束X
 main_W_com_data(0x0053,y2);  //结束Y
    main_Write_COM(0x0022);
}

 

于是,我的小海宝(50*100)居中显示主程序为

void main(void)
{
 int i;
 uint dd;
 uchar j;
    inti_port();
 main_init();   //tft初始化 
 Pant(0xffff);  //TFT清屏
 address_set(90,110,149,209); //注意不能写为address_set(90,110,150,210);

    for(i=0;i<4620;i++)
    {
     dd=(0x00|gImage_haibao[i*2+1])<<8;
     dd=dd|gImage_haibao[i*2];
     main_Write_DATA(dd);
      }
 while(1);
}

我就是因为写为address_set(90,110,150,210);让我调试了n久,还以为是图形取模软件有问题呢!

另外,数组文件要存入内部flash。否则SRAM空间不够。内部flash也就16K。

#pragma data:code
__flash unsigned char gImage_haibao[] = {}

扫描二维码关注公众号,回复: 6034086 查看本文章

#pragma data:data

还涉及到iccavr7.22版本的编译问题,6.3版可以用const,但是7.22就报错。所以要进行如下设置

以下操作步骤找了我老半天。终于编译成功。

 

Step1:设置编译目录,
点击ICCV7 for AVR->Project Options->Paths
Include Parth:C:\iccv722avr\include
Library Parth: C:\iccv722avr\lib
Step2:设置编译选项,
点击ICCV7 for AVR->Project Options->Compiler->[]Treat 'const' as '__flash'(bac
kword compatibility)打钩
Step3:设置编译变量,在程序中将'const'变量全部替换成'__flash'

猜你喜欢

转载自www.cnblogs.com/AppleCai/p/10777853.html