luly101 发表于 2009-9-22 17:32:15

s3c2410驱动液晶LCD12864好难!!好难!!

各位大侠:谁帮我看看!!!
我为什么不能驱动液晶LCD12864呀!
我的硬件连接是这样的:
接线关系为:
----LCD (LCD12864) -------------ARM (s3c2410)--------
    DB0~DB7                     LDATA0~LDATA7(2410数据总线0-7)
    RS                        ADDR2 (2410地址总线2)
    R/W                         ADDR3 (2410地址总线3)                     
是LCD的E:    GCS2(片选) 控制的
以下是我的程序:
主函数:
void Main(void)
{   
    SerialSwitch(0);
    SerialChgBaud(115200);
    printf("please Enter any key to run test\n");
    getch();
    while(1)
    {
    LcdPutString( 0,0, "电子工程师之家") ;
   }
}
子函数:
#define BASE                  0x20000000UL
#define WriteComond(base)      (*(volatile unsigned short*)(base + 0x00))         //RS=0 RW=0
#defineWriteData(base)         (*(volatile unsigned short*)(base + 0x20))          //RS=1 RW=0
#define ReadComond(base)      (*(volatile unsigned short*)(base + 0x10))         //RS=0 RW=1
#defineReadData(base)            (*(volatile unsigned short*)(base + 0x30))         //RS=1 RW=1
/***********************************************************
LCD读忙
***********************************************************/
void LCD_B_Ready(void)
{
    volatile int i;

    while (ReadComond(BASE)&0x80)
    {
      for(i=0;i<50;i++);
    }
}

/***********************************************************
向LCD发送指令
***********************************************************/
void LCD_B_W_Command(unsigned char Command)
{
    int i;   
    LCD_B_Ready(); //LCD读忙
    WriteComond(BASE) = (unsigned int)Command;
    for(i=0; i<50; i++);
}
/***********************************************************
向LCD发送数据
***********************************************************/
void LCD_B_W_Data(unsigned char Data)
{
    int i;
    LCD_B_Ready(); //LCD读忙
   WriteData(BASE) = (unsigned int)Data;
    for(i=0; i<50; i++);
}


void LcdAddress(unsigned char x,unsigned char y )//地址转换

{

    unsigned char byAddress ;

    switch( y )

    {

      case 0 :    byAddress = 0x80 + x ;

            break;

      case 1 :    byAddress = 0x90 + x ;

            break ;

      case 2 :    byAddress = 0x88 + x ;

            break ;

      case 3 :    byAddress = 0x98 + x ;

            break ;

      default :

            break ;
    }

    LCD_B_W_Command( byAddress ) ;

}
void LcdPutString( unsigned char x, unsigned char y, unsigned char *pData )
{
   LcdAddress( x, y );
   while( *pData != '\0' )
   {
       LCD_B_W_Data( *pData++ ) ;
   }
}

cyborg2008 发表于 2009-10-5 12:38:15

你的IO口方向有设置吗?程序不全,比较难分析

wusj1234 发表于 2009-10-19 22:41:39

注意LCD与S3C2410引脚电平是否匹配。

avr-arm 发表于 2009-10-23 14:31:27

尽管有延时,但速度还是太快了,lcd反应不过来或者乱码

gooogleman 发表于 2009-11-7 00:35:37

总线宽度设置了吗?设置成八位的合适。

还有读写控制使用普通GPIO就可以了吧。嘿嘿

lanselian 发表于 2009-11-7 11:03:29

估计是延时和地址设置的问题

jiaweijing 发表于 2010-12-20 20:14:26

mark
页: [1]
查看完整版本: s3c2410驱动液晶LCD12864好难!!好难!!