HT1621 display driver chip MCU source code

Publisher:MagicGardenLatest update time:2020-11-26 Source: 51heiKeywords:HT1621 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

HT1621 is a 128-dot memory-imaged and multi-function LCD driver. The software configuration feature of HT1621 makes it suitable for a variety of LCD applications, including LCD modules and display subsystems. There are only 4 or 5 pins for connecting the main controller and HT1621. HT1621 also has a power-saving command to reduce system power consumption. In this system made by Hufeng, HT1621 is used to drive a static LCD liquid crystal display. The liquid crystal display mode is divided into static display and dynamic display. The difference between static and dynamic is that static display is continuously powered, while dynamic display uses the visual retention effect of people to quickly scan the various segments of the digital tube, so that people visually feel that the digital tube is displayed simultaneously.
0.jpg 0.jpg

Good afternoon, everyone. I use STC12C5204 MCU to control 1621 to drive LCD.
I have been adjusting the program for several days but there is no progress. I don't know what mess is displayed. It seems that the command can't be written in at all. COM0 and com1 are less than 1V, com3 is 3.5V, and com4 sometimes has waveforms. The program I wrote is like this. Part of SEGMENT has waveforms, and the rest is just a level. I

called Hetai Technology and asked me to use their examples, so I modified it, but it's still the same. Please help me find out what the problem is. Thank you. The following is the example downloaded from Hetai. I modified it slightly. The

MCU source program is basically intact as follows:

Good afternoon, everyone. I use STC12C5204 microcontroller to control 1621 drive LCD

I have been debugging the program for a few days but there is no progress. I don't know what all the mess is displayed, as if the command can't be written in at all. COM0 and COM1 are at a level of less than 1V, COM3 is at a level of 3.5V, and COM4 sometimes has a waveform

This is how I flashed my own program. Part of the SEGMENT has a waveform, and the rest is just a level.


I called Hetai Technology and they asked me to use their sample, so I modified it, but it was still the same.

Please help me find out what the problem is, thank you.

The following is an example downloaded from Hetai.com. I modified it slightly, but it is basically the same as before.


//STC12C5204AD MCU controls HT1621B to drive LCD

#include

#include

#include

#define BIAS 0X52 //1/3 bias, 4 back pole

#define RC256K 0X30 //System clock selection is the on-chip RC oscillator

#define WDTDIS1 0X0A //Disable WDT overflow flag output

#define TIMERDIS 0X08 //Time base output disabled

#define SYSEN 0X02 //Turn on the system clock

#define SYSDIS 0X00 // Turn off the system clock and bias generator

#define LCDON 0X06 //Turn on the LCD bias generator

#define LCDOFF 0X04 // Turn off LCD bias generator

#define TONEON 0X12 //Turn on audio output

#define TONEOFF 0X10 //Turn off audio output  

#define CS P3_2

#define WR P3_4

#define DATA P3_5


#define uchar unsigned char

#define uint unsigned int

/***************************Delay sub-function******************************/

void delay(uchar i) //j=12 delay about 4.3us

{


  while(i--)

  {

   flying j=0;

   while(j<8)

   j++;

  }

}

void SendBit_1621(uchar dat ,uchar cnt)

{

flying i;

for(i =0; i {

  if((dat&0x80)==0)

  DATA=0;

  else DATA=1;

  WR=0;

  delay(2);  

  WR=1;

        that=that<<1;

}

}


void SendDataBit_1621(float dat, float cnt)

{

flying i;

for(i =0; i {

  if((dat&0x01)==0) DATA=0;

  else DATA=1;

  WR=0;

  delay(2);

  WR=1;

  that=that>>1;

}

}

void SendCmd(uchar command)

{

CS=0;

_nop_();

_nop_();

SendBit_1621(0x80,4);

SendBit_1621(command,8);

CS=1;

}

void Write_1621(uchar addr,uchar dat)

{

CS=0;

_nop_();

_nop_();

SendBit_1621(0xa0,3);

SendBit_1621(addr,6);

SendDataBit_1621(dat,4);

CS=1;

}

void WriteAll_1621(fly addr,fly *p,fly cnt)

{

flying i;

CS=0;

_nop_();

_nop_();

SendBit_1621(0xa0,3);

SendBit_1621(addr,6);

for(i =0; i {

  SendDataBit_1621(*p,8);

}

CS=1;

}

/*******************************Main function******************************/

main()                                    

{

float a[10];

a[0]=0xFF;a[1]=0xFF;a[2]=0xFF;a[3]=0xFF;a[4]=0xFF;

a[5]=0xFF;a[6]=0xFF;a[7]=0xFF;a[8]=0xFF;a[9]=0xFF;

a[10]=0xFF;a[11]=0xFF;a[12]=0xFF;a[13]=0xFF;a[14]=0xFF;

a[15]=0xFF;


SendCmd(BIAS);

SendCmd(SYSEN);

SendCmd(LCDON);

// SendCmd(RC256K);

WriteAll_1621(0,a,16);

// SendCmd(LCDOFF);  



}

LCD Driver for HT1621

//=============================================================================

#define Lcd_Delay _nop_();_nop_();_nop_();_nop_();_nop_();_nop_()

void Lcd_Data(float Start, float cData)

//Synchronize the bytes in the data with those on the LCD

// Start -- To start with the same page address, each page has 4 valid bits, totaling 32X4 bytes

// Length -- the number of pages to be synchronized

{

        flying i;

        LCD_CS=0;

        Lcd_Delay;

        Lcd_Delay;

        Lcd_Delay;

          //Send ID 101B

          LCD_CLK=0;

          Lcd_Delay;

          LCD_IO=1;

          Lcd_Delay;

          LCD_CLK=1;

          Lcd_Delay;

          LCD_CLK=0;

          Lcd_Delay;

          LCD_IO=0;

          Lcd_Delay;

          LCD_CLK=1;

          Lcd_Delay;

          LCD_CLK=0;

          Lcd_Delay;

          LCD_IO=1;

          Lcd_Delay;

          LCD_CLK=1;

          Lcd_Delay;

          //Send Address 6bit

          Start=Start*2;

          for(i=0;i<6;i++)

    {

              if(Start&0x20) LCD_IO=1;

              else LCD_IO=0;

              Lcd_Delay;

              LCD_CLK=0;

              Lcd_Delay;

              Start=Start<<1;

              LCD_CLK=1;

              Lcd_Delay;

    }

    //Send data 8bit

    for(i=0;i<8;i++)

    {

              if(cData&0x01) LCD_IO=1;

              else LCD_IO=0;

              Lcd_Delay;

              LCD_CLK=0;

              Lcd_Delay;

              cData=cData>>1;

              LCD_CLK=1;

              Lcd_Delay;

    }

        LCD_CS=1;

        Lcd_Delay;

}

//=============================================================================

void  Lcd_Command(uchar Command)

//Write a command to the specified LCD

//Each command should start with 100 bits, the command length is 9 bits, and the actual effective bits are 8 bits, so add a 0 at the end

// LcdSelect--LCD chip selection, value is 0,1,2

// Command----8-bit command to be written

{

        flying i;

        LCD_CS=0;

        Lcd_Delay;

        Lcd_Delay;

        Lcd_Delay;

          //Send ID 100B

          LCD_CLK=0;

          Lcd_Delay;

          LCD_IO=1;

          Lcd_Delay;

          LCD_CLK=1;

          Lcd_Delay;

          LCD_CLK=0;

          Lcd_Delay;

          LCD_IO=0;

          Lcd_Delay;

          LCD_CLK=1;

          Lcd_Delay;

          LCD_CLK=0;

          Lcd_Delay;

          LCD_IO=0;

          Lcd_Delay;

          LCD_CLK=1;

        Lcd_Delay;

          for(i=0;i<8;i++)

    {

            LCD_CLK=0;

            Lcd_Delay;

              if(Command&0x80) LCD_IO=1;

              else LCD_IO=0;

              Command=Command<<1;

              Lcd_Delay;

              LCD_CLK=1;

              Lcd_Delay;

    }

    ///Fill in a 0 at the end

           LCD_CLK=0;

           Lcd_Delay;

          LCD_IO=0;

          Lcd_Delay;

          LCD_CLK=1;

          Lcd_Delay;

        LCD_CS=1;

        Lcd_Delay;

}

//=============================================================================

void Lcd_Refresh(void) //Refresh the LCD screen

{

        flying i;

        for(i=0;i                Lcd_Data(i,lcd.buff[i]);

……………………



Keywords:HT1621 Reference address:HT1621 display driver chip MCU source code

Previous article:HT1621 source code to drive LCD
Next article:STC89 MCU + TM1638 Super Stopwatch Program

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号