这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 综合技术 » 基础知识 » t6963c,lcd 由用过t6963c驱动lcd的吗?

共2条 1/1 1 跳转至

t6963c,lcd 由用过t6963c驱动lcd的吗?

院士
2006-09-17 18:14:16     打赏
t6963c,lcd 由用过t6963c驱动lcd的吗?



关键词: t6963c     用过     驱动     的吗    

院士
2006-12-22 22:43:00     打赏
2楼
问 我读状态位好像不怎么稳定
还有,怎么显示数据,才接触,高手请指点 1: re//240*64点阵屏,下面是显示“公司”的程序,俺从老程序中cut出来的,不知道管不管用,大虾见笑了,呵呵

//#include <reg52.h>
#define CMD XBYTE [0x9000]
#define DAT XBYTE [0x7000]
unsigned char code LMM[]={
/*--  文字1:  公  --*/
0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,
/*--  文字2:  司  --*/
0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,};
/**********************************/
/*********  手动写忙吗?  *********/
/**********************************/
void check()
{
    unsigned char TEMP;
    TEMP=0;                                                     while (TEMP != 0x03)
    TEMP = CMD & 0x03;
}

/**********************************/
/**********  自动写忙吗?  *********/
/**********************************/
void check1()
{
    unsigned char temp;
    temp=0;
    while (temp!=0x08)
    temp = CMD & 0x08;
}

/**********************************/
/*********  初始化显示屏  *********/
/**********************************/
void init_lcd()
{
   unsigned int t1;
   check();
   CMD=0x0B2;            /* DISABLE AUTO R/W */
   check();
   CMD=0x09C;            /* TXT AND GRAPH SHARING MODEL */

   check();
   CMD=0x88;             /* SELECT CGRAM ,"AND" LOGIC DISPLAY */

   check();
   DAT=0;               
   check();
   DAT=0;               
   check();
   CMD=0x40;             /* TXT AREA START ADDRESS IS 0000H */

   check();
   DAT =30;
   check();
   DAT =0;
   check();
   CMD =0x41;           /* TXT AREA 30 WORDS A ROW */

   check();
   DAT=0;               
   check();
   DAT=8;               
   check();
   CMD=0x42;             /* GRAPH AREA START ADDRESS IS 800H */

   check();
   DAT =30;
   check();
   DAT =0;
   check();
   CMD =0x43;           /* GRAH AREA 30 WORDS A ROW */


   check();
   DAT =0;
   check();
   DAT =0;
   check();
   CMD =0x24;          /* ADDRESS POINTER IS 00H */

   check();
   DAT =0x1f;
   check();
   DAT =0;
   check();
   CMD =0x22;          /* CGRAM FIRST ADDRESS IS 0x2000H */

   //check();
   //CMD =0x0A0;         /* SELECT CURSOR SHAPE */

   check();
   DAT =0;
   check();
   DAT =0;
   check();
   CMD =0x24;         
   check();
   CMD =0x0B0;
    for(t1=0;t1<0xf800;t1++)
    {
        check1();
        DAT=0;
    }
     
   check();
   CMD = 0x0B2;        /* DISABLE AUTO R/W */
}
/**********************************/
/*********  汉字代码输入 **********/
/**********************************/
void INPUT_CGRAM()
{
    unsigned char i,j;
    unsigned int t1;
    check();
    DAT = 0;
    check();
    DAT = 0xf8;
    check();
    CMD = 0x24;       
    check();
    CMD = 0xB0;
    t1=0;
    for(i=0;i<2;i++)   
    {
        for(j=0;j<16;j++)
        {
            check1();
            DAT = LMM[j+j+t1];
        }
        for(j=0;j<16;j++)
        {
               check1();
            DAT = LMM[j+j+1+t1];
        }
        t1=t1+32;
    }
    check();
    CMD = 0x0B2;
}

void disp_company()
{
      unsigned char i,k;
                 k=2;
        check();
        DAT=k;
        check();
        DAT=0;
        check();
        CMD=0x24;
        check();
        CMD=0xB0;
        for(i=0;i<4;i++)
        {
            check1();
            DAT=i+i;
            
        }
        check();
        CMD=0xB2;
        
        check();
        DAT=k+30;
        check();
        DAT=0;
        check();
        CMD=0x24;
        check();
        CMD=0xB0;
        for(i=0;i<4;i++)
        {
            check1();
            DAT=i+i+1;
        }
        check();
        CMD=0xB2;
}
void main()
{
      EA=0;
      init_lcd();
      INPUT_CGRAM();
      disp_company();
      while(1)
      ;
} 2: 这是我的程序,怎么显示不了东西呢?//240*64点阵屏,下面是显示“公司”的程序,俺从老程序中cut出来的,不知道管不管用,大虾见笑了,呵呵

//#include <reg52.h>
#define CMD XBYTE [0x9000]
#define DAT XBYTE [0x7000]
unsigned char code LMM[]={
/*--  文字1:  公  --*/
0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,
/*--  文字2:  司  --*/
0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,};
/**********************************/
/*********  手动写忙吗?  *********/
/**********************************/
void check()
{
    unsigned char TEMP;
    TEMP=0;                                                     while (TEMP != 0x03)
    TEMP = CMD & 0x03;
}

/**********************************/
/**********  自动写忙吗?  *********/
/**********************************/
void check1()
{
    unsigned char temp;
    temp=0;
    while (temp!=0x08)
    temp = CMD & 0x08;
}

/**********************************/
/*********  初始化显示屏  *********/
/**********************************/
void init_lcd()
{
   unsigned int t1;
   check();
   CMD=0x0B2;            /* DISABLE AUTO R/W */
   check();
   CMD=0x09C;            /* TXT AND GRAPH SHARING MODEL */

   check();
   CMD=0x88;             /* SELECT CGRAM ,"AND" LOGIC DISPLAY */

   check();
   DAT=0;               
   check();
   DAT=0;               
   check();
   CMD=0x40;             /* TXT AREA START ADDRESS IS 0000H */

   check();
   DAT =30;
   check();
   DAT =0;
   check();
   CMD =0x41;           /* TXT AREA 30 WORDS A ROW */

   check();
   DAT=0;               
   check();
   DAT=8;               
   check();
   CMD=0x42;             /* GRAPH AREA START ADDRESS IS 800H */

   check();
   DAT =30;
   check();
   DAT =0;
   check();
   CMD =0x43;           /* GRAH AREA 30 WORDS A ROW */


   check();
   DAT =0;
   check();
   DAT =0;
   check();
   CMD =0x24;          /* ADDRESS POINTER IS 00H */

   check();
   DAT =0x1f;
   check();
   DAT =0;
   check();
   CMD =0x22;          /* CGRAM FIRST ADDRESS IS 0x2000H */

   //check();
   //CMD =0x0A0;         /* SELECT CURSOR SHAPE */

   check();
   DAT =0;
   check();
   DAT =0;
   check();
   CMD =0x24;         
   check();
   CMD =0x0B0;
    for(t1=0;t1<0xf800;t1++)
    {
        check1();
        DAT=0;
    }
     
   check();
   CMD = 0x0B2;        /* DISABLE AUTO R/W */
}
/**********************************/
/*********  汉字代码输入 **********/
/**********************************/
void INPUT_CGRAM()
{
    unsigned char i,j;
    unsigned int t1;
    check();
    DAT = 0;
    check();
    DAT = 0xf8;
    check();
    CMD = 0x24;       
    check();
    CMD = 0xB0;
    t1=0;
    for(i=0;i<2;i++)   
    {
        for(j=0;j<16;j++)
        {
            check1();
            DAT = LMM[j+j+t1];
        }
        for(j=0;j<16;j++)
        {
               check1();
            DAT = LMM[j+j+1+t1];
        }
        t1=t1+32;
    }
    check();
    CMD = 0x0B2;
}

void disp_company()
{
      unsigned char i,k;
                 k=2;
        check();
        DAT=k;
        check();
        DAT=0;
        check();
        CMD=0x24;
        check();
        CMD=0xB0;
        for(i=0;i<4;i++)
        {
            check1();
            DAT=i+i;
            
        }
        check();
        CMD=0xB2;
        
        check();
        DAT=k+30;
        check();
        DAT=0;
        check();
        CMD=0x24;
        check();
        CMD=0xB0;
        for(i=0;i<4;i++)
        {
            check1();
            DAT=i+i+1;
        }
        check();
        CMD=0xB2;
}
void main()
{
      EA=0;
      init_lcd();
      INPUT_CGRAM();
      disp_company();
      while(1)
      ;
}
3: re:re不会是头文件没定义的原因吧?考虑你可能使用自己的头文件,我把它屏蔽了,
如果编译没报错,请检查一下硬件连线是否正确,RST CS C/D都好好看一下,我的C/D接的是P2.7,另外如果用背光的话,注意调节负压,-7v左右足够。
祝你成功!
4: 我发错了,这是我的程序,请指教!#include <stdio.h>
#include <90s4414.h>  
#include <delay.h>

char lcd_state=0;
void state01_check()
{
    DDRC.0=1;//CD
    PORTC.0=1;
    DDRC.1=1;//CE
    PORTC.1=0;
    DDRD.6=1;//RD
    PORTD.6=0;
    DDRD.7=1;//WR
    PORTD.7=1;
    do
    {       
        DDRA=0x00;
        lcd_state=PINA;
    }
    while((lcd_state&0x03)!=3);
    PORTD.6=1;           
}    
void send_data(char data)
{    
    state01_check();
    DDRD.6=1;//RD
    PORTD.6=1;
    DDRC.0=1;//CD
    PORTC.0=0;
    DDRC.1=1;//CE
    PORTC.1=0;
    DDRA=0xFF;
    PORTA=data;    
    DDRD.7=1;//WR
    PORTD.7=0;
    PORTD.7=1;//WR
    PORTC.0=1;//CD
}
void cmnd_write(char cmnd)
{    
    state01_check();
    DDRD.6=1;//RD
    PORTD.6=1;
    DDRC.0=1;//CD
    PORTC.0=1;
    DDRC.1=1;//CE
    PORTC.1=0;
    DDRA=0xFF;
    PORTA=cmnd;
    DDRD.7=1;//WR
    PORTD.7=0;
    PORTD.7=1;
    PORTC.0=0;
}
void initLCD()
{
    cmnd_write(0x0B2);
    send_data(0x00);//text area addr
    send_data(0x00);
    cmnd_write(0x40);
    
    send_data(0x20);//text area wide
    send_data(0x00);
    cmnd_write(0x41);
    
    send_data(0x00);//graphic area addr
    send_data(0x08);
    cmnd_write(0x42);
    
    send_data(0x20);//graphic area wide
    send_data(0x00);
    cmnd_write(0x43);
                     
    cmnd_write(0xA7);//cursor pattern

    cmnd_write(0x80);//display mode
}
void main(void)
{
          initLCD();
    cmnd_write(0x9C);
    send_data(0x00);
    send_data(0x00);
    cmnd_write(0x24);
    send_data(0x21);
    while(1)
    ;

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]