打印

HT1621

[复制链接]
2847|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
chen3bing|  楼主 | 2007-3-2 20:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我用HT1621驱动液晶,发现一个问题。
液晶清屏之后无法显示;要么就是显示以后
不能清除。
这是怎么回事,应该怎么解决?
请高手指教,谢谢!
沙发
yezhenyu| | 2007-3-6 09:18 | 只看该作者

可以确定,你的程序有问题。

仔细看看程序吧,一定是写HT1621的时序有问题或把相关的程序贴出来。

使用特权

评论回复
板凳
安步当车| | 2007-3-6 10:05 | 只看该作者

LCD

使用特权

评论回复
地板
chen3bing|  楼主 | 2007-3-6 17:05 | 只看该作者

谢谢

谢谢你的回复,下面是我的程序,麻烦多费心看看。(ST单片机C程序)
PC6 WR,PA6 DATA,PB4 /CS
#include "io72324.h"                        /* 寄存器定义文件 */
#include "lib.h"
#include "linsci.h"                        /* COSMIC 编译器需要用的头文件 */
#include "st72324.h"
#define BIAS 0x29
#define SYSDIS 0x00
#define SYSEN  0x01
#define LCDOFF 0x02
#define LCDON  0x03
const u8 DisNumber[10][7]={{0x06,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf},{0x00,0x03,0x04,0x05,0x06,0xaf,0xaf},
             {0x02,0x05,0xaf,0xaf,0xaf,0xaf,0xaf},{0x04,0x05,0xaf,0xaf,0xaf,0xaf,0xaf},
                 {0x00,0x03,0x04,0xaf,0xaf,0xaf,0xaf},{0x01,0x04,0xaf,0xaf,0xaf,0xaf,0xaf},{0x01,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf},
                 {0x03,0x04,0x05,0x6,0xaf,0xaf,0xaf},{0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf},{0x04,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf}
};






void t_clk(void)
{
 #asm
  nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    nop
    #endasm
}                                                
/************************************************/
/*函数调用方式:SendBit(uchar Dat,uchar BitNum);*/          
/*将Dat数据从高位开始发送共BitNum位             */
/************************************************/
void SendBit(u8 Dat,u8 BitNum)
{
  
   u8 i;
     
   for(i=0;i<BitNum;i++)
   {                                          /*置时钟线为低通知被控器开始接收*/
       ClrBit(PCDR,6);
          t_clk();
     if(( Dat & 0x80 ) == 0)
        { 
              ClrBit(PADR,6);
            
                     
        }
        else
        { 
               SetBit(PADR,6);/*    Q3=6DATA*/                                   /*发送数据由高位到低位传送     */
                                      
        }
         
        SetBit(PCDR,6);                //SetBit(PADR,Q4);                                        /*保持住总线准备下一个数据位   */
        t_clk();
        Dat=Dat<<1;                                          /*发送数据左移一位             */
   }

}

void SendDataBit_1621(u8 Dat,u8 BitNum)
{u8 i;
   
  for(i=0;i<BitNum;i++)
      
    { ClrBit(PCDR,6);
          t_clk();
      if((Dat&0x01)==0) 
       {
          
          ClrBit(PADR,6);
                     
         }    
      else 
        {
         SetBit(PADR,6);
                 
      }        
         
        SetBit(PCDR,6);                //SetBit(PADR,Q4);                                        /*保持住总线准备下一个数据位   */
        t_clk();
        Dat=Dat>>1;
    }
}    
/************************************************/
/*函数调用方式:SendCmd(uchar Dat);             */          
/*将Dat命令字发给接收端                         */
/************************************************/
void SendCmd(u8 Dat)

  
     
   ClrBit(PBDR,4);  /*Q6=4*/
   
   SendBit(0x80,3);
   SendBit(Dat,9);
     #asm
     nop
     #endasm
   SetBit(PBDR,4);
       #asm
    nop
    nop        
        #endasm
}


void Write_1621(u8 addr,u8 data)
{  
   DisableInterrupts();
   
     ClrBit(PBDR,4);
     
   SendBit(0xa0,3);
     SendBit(addr<<2,6);
     SendDataBit_1621(data,4);
     #asm
     nop
     #endasm
     SetBit(PBDR,4);
     #asm
     nop
     nop
     #endasm
     EnableInterrupts();
}     

void lcdinit(void)
{ u8 i,j;
  SetBit(PADDR,6);          //data
  SetBit(PAOR,6);
    SetBit(PADR,6);
  SetBit(PBDDR,4);          //不选中1621
  SetBit(PBOR,4);
    SetBit(PBDR,4);
    SetBit(PCDDR,6);          //WR
  SetBit(PCOR,6);
    ClrBit(PCDR,6);
    for(i=0;i<200;i++)
     for(j=0;j<65;j++)
       ;
    SendCmd(0x0e3);        //NORMAL*/
    
    SendCmd(0x18);         //RC256K
    SendCmd(BIAS);
    SendCmd(SYSEN);
    
    
    
    SendCmd(LCDON);
    
    
    
}
void main(void)
{u8 m,Temp,Adr;
 u8 n;
 u8 baiwei,shiwei,gewei;
 
 
  lcdinit();
 TACSR=0;
 WDGCR=0;
 EnableInterrupts();
 
    
        while(1)
 {    
 
  
 for(m=0;m<7;m++)
    Write_1621(DisNumber[1][m],0x08);
    for(m=0;m<7;m++)
     Write_1621(DisNumber[6][m]+0x08,0x08);
     for(m=0;m<7;m++)
     Write_1621(DisNumber[4][m]+0x10,0x08);
     for(m=0;m<7;m++)
     Write_1621(DisNumber[9][m]+0x18,0x08);
   for(m=0;m<200;m++)
      for(n=0;n<65;n++)
        ;
        
        for(m=0;m<7;m++)
    Write_1621(DisNumber[2][m],0x08);
    for(m=0;m<7;m++)
     Write_1621(DisNumber[0][m]+0x08,0x08);
     for(m=0;m<7;m++)
     Write_1621(DisNumber[5][m]+0x10,0x08);
     for(m=0;m<7;m++)
     Write_1621(DisNumber[3][m]+0x18,0x08);
   for(m=0;m<200;m++)
      for(n=0;n<65;n++)
        ;
        
   
    }
}    
    

使用特权

评论回复
5
chen3bing|  楼主 | 2007-3-7 17:14 | 只看该作者

请教

程序贴出来了,请yezhenyu多指教。

使用特权

评论回复
6
chen3bing|  楼主 | 2007-3-8 18:16 | 只看该作者

ok

搞定了。

使用特权

评论回复
7
yuzq2001| | 2007-3-15 11:23 | 只看该作者

怎么还有汇编的。。。

使用特权

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

本版积分规则

438

主题

2521

帖子

2

粉丝