suohaidong2004
驱动牛犊
驱动牛犊
  • 注册日期2004-09-07
  • 最后登录2004-10-19
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1398回复:0

sed1335液晶屏为什么没有数据显示

楼主#
更多 发布于:2004-10-09 19:18
各位大侠:
    进来用单片机控制SED1335的液晶屏,但是不管怎么改变程序就是没有显示。有请各位大侠给看看,是程序的问题还是液晶屏出现了问题。在此谢谢各位!!!
#include <reg52.h>
unsigned char zi[]={0x09,0x00,0x09,0x80,0x11,0x04,0x13,0xFE,0x22,0x04,0x34,0x48,0x68,0x40,0xA2,0x50,
0x23,0x48,0x22,0x48,0x24,0x44,0x24,0x46,0x28,0x44,0x21,0x40,0x20,0x80,0x00,0x00};
void Initialize();
sbit P1_0=P1^0;//CS
sbit P1_1=P1^1;//RST
sbit P1_2=P1^2;//RD
sbit P2_1=P2^1; //WR
sbit P2_0=P2^0;//A0
void delay(unsigned int delx);
void writework(unsigned char *unit);
void main()
{  unsigned  int i;
   P1_0=0;//CS
   P1_1=0;
   P1_1=0;
   P1_1=0;
   P1_1=1;
   P1_1=1;
   P1_1=1;//RST
   P1_2=1;//RD=1
   Initialize();
   while(1)
{   P2_1=0;
    P2_1=0;
    P2_0=1;//COMMAND WRITE
    P0=0x42;
for (i=0; i<3600; i++)
   {    P2_0=0; P0=0xff;
   }
   delay(0x30);
    P2_1=1;
    P2_1=1;
}
        //do//
//{  
// writework(zi);
        // delay(0x9);
        // P1_0=1;
// P2_1=!P2_1;
   //}
        //while(1);
        
  
}


void Initialize()
 {
  
//**************************  
   P2_1=0;
   P2_1=0;//WR
   P2_0=1;//A0=1
   P0=0x40;
   P2_0=0; P0=0x30;
   P2_0=0; P0=0x87;
   P2_0=0; P0=0x08;
   P2_0=0; P0=40;
   P2_0=0; P0=44;
   P2_0=0; P0=240;
   P2_0=0; P0=41;
   P2_0=0; P0=0; //systemset
   delay(0x9);
   P2_0=1;
   P0=0x59;
   P2_0=0; P0=0x04;//dispon
   delay(0x9);
   P2_0=1;//A0=1
   P0=0x44;
   P2_0=0; P0=0x00;
   P2_0=0; P0=0x00;
   P2_0=0; P0=240;
   P2_0=0; P0=0x80;
   P2_0=0; P0=0x25;
   P2_0=0; P0=240;
   P2_0=0; P0=0x00;
   P2_0=0; P0=0x0b;
   P2_0=0; P0=0;
   P2_0=0; P0=0;//scroll
   delay(0x9);
   P2_0=1;
   P0=0x5d;
   P2_0=0; P0=0x03;
   P2_0=0; P0=0x81;//csrform
   delay(0x9);
   P2_0=1;
   P0=0x5b;
   P2_0=0; P0=0x1c;//oylay
   delay(0x9);
   P2_0=1;
   P0=0x5a;
   P2_0=0; P0=0x00;//hdotset
    delay(0x9);
   P2_0=1;
   P0=0x46;
   P2_0=0; P0=0x00;
   P2_0=0; P0=0x00;//csrw
    delay(0x9);
   P2_0=1;                          
   P0=0x4c;//csrdir
   delay(0x9);
   P2_1=1;
   P2_1=1;//WR=1
   }
  void delay(unsigned int delx)
{
        unsigned int i=0;
           do
       {
          i++;
        }
 while (i<=delx);
}

 void writework(unsigned char *unit)
 {  
     unsigned char j;
     unsigned char i;
     for (i=0 ;i<16; i++)
 {
    for(j=0 ;j<2;j++)
    { P2_0=1;
 P0=0x4c;
      delay(0x9);
      P2_0=1;
 P0=0x42;
      P2_0=0; P0=unit[j];
 }
    P2_0=1;
   delay(0x9);
P0=0x4f;
    }
return ;
    }
游客

返回顶部