打印

请教三斑竹 S1D13700驱动LCD问题

[复制链接]
3019|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
我是土匪|  楼主 | 2009-11-10 22:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
我是土匪|  楼主 | 2009-11-11 12:11 | 只看该作者
本帖最后由 我是土匪 于 2009-11-11 12:17 编辑

是这样,某些位置可以打点,如(0,0),某些位置不可以如(3,3).

这个屏还分4的显示分区,很费解。

我认为基本程序是OK的,显示整屏图片也是OK的;唯独显示字符,点坐标不对,而且某些位置不能显示。


三斑竹,能给我一个画点的基本函数看看吗?
还有我很关心你地址的计算公式,你那个是宏,我看不到。。,我猜测显示点 字符(文本文件和图形文件的地址不同)

使用特权

评论回复
板凳
我是土匪|  楼主 | 2009-11-12 00:50 | 只看该作者
给您一个我的程序看一下:

可以显示图片,可以显示字符,唯独不可以利用输入坐标参数控制在LCD上的显示位置。

void initLCDM(void)
{
        //_RES    = 1;    // reset pin
        //_RES    = 0;
        delayms(5);
        //_RES    = 1;
        delayms(10);

        SdCmd(0x40);    //System set (8 byte parameter)
        SdData(0x30);   // IV=1(no line comp),ws=0(single drv),M2=0(8bit char height),M0=0(int CGROM), D4=1(by default)                    
        SdData(0x87);   // MOD=1 two frame AC drv, HorChar Size=8
        SdData(0x07);   // VerChar Size=8
        SdData(0x28);   // (320/8=40) char per line
        SdData(0x47);   // 23+blanking (frame freq = 66Hz (clk ratio=1/4  @ 10MHz)
        SdData(0xEF);   // (240-1=239) line per screen
        SdData(0x28);   // Virtual screen width LSB
        SdData(0x00);   // Virtual screen width MSB
       
        SdCmd(0x59);    // Display ON/OFF(1 byte parameter)
        SdData(0x04);   // SAD1=on, cursor=off
               
        SdCmd(0x44);    //Scroll (10 byte parmeter)
        SdData(0x00);   // SAD1 start ADD LSB
        SdData(0x00);   // SAD1 start ADD MSB
        SdData(0xEF);   // SAD1 block size(no.of line-1)
        SdData(0x00);   // SAD2 start ADD LSB
        SdData(0x00);   // SAD2 start ADD MSB
        SdData(0xEF);   // SAD2 block size(no.of line-1)
        SdData(0x00);   // SAD3 start ADD LSB
        SdData(0x00);   // SAD3 start ADD MSB
        SdData(0x00);   // SAD4 start ADD LSB
        SdData(0x00);   // SAD4 start ADD MSB
       
        SdCmd(0x5D);    //CSRFORM (2 byte parmeter)
        SdData(0x07);   // cursor width = 8
        SdData(0x17);   // CM=1, for graphic mode, cursor height = 8        
       
        SdCmd(0x4C);    // CSRDIR (0 byte parmeter) to the right side

        SdCmd(0x5B);    // OVLAY (1 byte parmeter)
        SdData(0x05);   // 0v=0(2layer),DM1=0(blk3 for text),DM0=1(blk1 for graphic),layers combine=01(XOR)

/*        SdCmd(0x5C);    // CGRAMADR (2 byte parmeter)
        SdData(0x00);
        SdData(0x00);
*/
        SdCmd(0x5A);    // HDOT SCR (1 byte parmeter)
        SdData(0x00);   // no scroll

        SdCmd(0x60);    // GRAYSCALE (1 byte parmeter)
        SdData(0x00);   // 1bpp       

}
、、

//-----------------------------------
//描点函数
//-----------------------------------
void Draw_Dot(uint x,uint y)
{
         uchar dotdata,m ;
         uint addr;
         addr = y * 0x30 + x/8  ;         

         
         m = x % 8;
         dotdata = 0x80;
         dotdata = dotdata >> m;
         SdCmd(0x46);
         SdData(addr);
         SdData(addr >> 8);
         SdCmd(0x43);
         m = RdData() | dotdata;
         SdCmd(0x46);
         SdData(addr);
         SdData(addr >> 8);
         SdCmd(0x42);
         SdData(m);
}

void main()
{
        int i;
        uint x,y;
                uchar test_asc[] = "1234567abcdef";
       
       
        DDRC |= 0XFF;
       
        //SP=0x60;
        //EA = 0;                 // disable interrupts

    //_RES        = 1;             // init all signal
                DDRG  |= 0x04;
        PORTG |= 0X04;//_CS     = 1;
       
                DDRG  |= 0x02;                          
        PORTG |= 0X02;//_RD     = 1;
    //_WR     = 1;                                  wr pg0
        DDRG  |= 0x01;
        PORTG |= 0X01;
   // A0      = 0;
              DDRG  |= 0x08;
              PORTG |= 0X08;//PORTG &= ~0X08;
   
              PORTC = 0xff;//LCDBUS  = 0xff;         // pull up data bus

                   //PORTC = 0x55;
           initLCDM();

       
        Clear_LCD();                  

       
        DDRA  |= 0x04;
                PORTA |= 0X04;         
        while(1)
        {
                WriteGraphicScreen(Graphic**);        delayms(1000);     //可以正确显示的整屏图片
                WritePatternScreen(Pat_AllOn);      delayms(1000);
                    WritePatternScreen(Pat_AllOff);     delayms(1000);
                


        Draw_Dot(0,0);    //可以正确显示
        Draw_Dot(3,3);    //显示不出来
       
        for(y=0;y<240;y++)       
               Draw_Dot(50,y);   //没有显示出直线而是一些间隔显示的点       
                                 delayms(2000);}
               
        }
}





虽然这样问问题比较烦,但确实着急,请高手指点迷津!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

226

主题

1761

帖子

30

粉丝