HOLTEK MCU-LCD

Publisher:GoldenHarmonyLatest update time:2015-07-23 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Function Description:

16X2 character LCD displays "LCD TEST OK"

Circuit Description:

        The circuit diagram is shown below:      Port A of the HT48R50A-1 is connected to D0-D7 (data bus) of the character LCD, using the 8-bit data interface of the character LCD.


        Connect PC1 of the HT48R50A-1 to the read/write pin of the LCD. When the read/write pin of the LCD is at a high level, it means that data will be read from the LCD, and when the read/write pin of the LCD is at a low level, it means that data will be written into the LCD.

        Connect PC2 of the HT48R50A-1 to the LCD’s E pin. When the LCD’s E pin is at a high level, the data on the LCD’s D0-D7 pins will be written into the LCD. Normally, the LCD’s E pin remains at a low level.

        Connect the PC0 of the HT48R50A-1 to the RS pin of the LCD. When the RS pin of the LCD is low and the LCD is read or written, the LCD command can be written into the LCD command register. If the LCD is read or written, the LCD busy flag and address counter can be read. The LCD busy flag is 1 bit, the address counter is 7 bits, a total of 8 bits. When the RS pin of the LCD is high, the LCD data register can be read or written.

        Connect the CO pin of the character LCD to GND. The VO pin is the brightness adjustment voltage input pin of the character LCD. Usually, the characters on the character LCD are clearest when the VO pin is grounded. You can also connect the VO pin to a variable resistor to adjust the contrast of the character LCD.

The complete version of the program source code download address:  http://www.51hei.com/f/htlcd.rar  , the main.c file is listed below:
 

#include "HT46F49E.H"

 

#define lcd_en    _pc1

#define lcd_rs    _pc0

#define lcd_date   _pa

 

unsigned char table1[]="LCD 1602";

unsigned char table2[]="TEST IS OK!";

unsigned char num;

void delayms(unsigned int n) //ms delay

{

    while(n>0)

    {

        _delay(984);

        n--;  

    }  

}

 

void write_com(unsigned char com) // write command

{

    lcd_rs=0; //lcdrs=0, select write command mode

    delayms(5);

    lcd_date=com; // Command word sent to data bus

    delayms(5);

    lcd_en=1; //lcden=1, enable, already set low during init initialization

    delayms(5);

    lcd_en=0;

}

 

void write_date(unsigned char date) // write data

{

    lcd_rs=1;

    delayms(5); 

    lcd_date=date;

    delayms(5);

    lcd_en=1;

    delayms(5);

    lcd_en=0;

}

 

void lcd_init()

{  

    write_com(0x38);

    delayms(2);

    write_com(0x0c);

    delayms(2);

    write_com(0x06);

    deleyms(2);

    write_com(0x01);

    delayms(2);

}

 

void main()

{  

    lcd_init();

    write_com(0x80);

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

    {

        write_date(table1[num]);

        delayms(2); 

    }

    write_com(0x80+0x40);

    for(num=0;num<11;num++)

    {

        write_date(table[num]);

        delayms(2);

    }

    while(1);

} 
Reference address:HOLTEK MCU-LCD

Previous article:Some summary of embedded memory and BootLoader
Next article:HOLTEK MCU-Interrupt Priority Test

Latest Microcontroller Articles
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
    Since development under LINUX is still quite troublesome, is there a more convenient and simple development method under WINDOWS? The answer is yes. Of course, it is not a development tool like ADS, because it ...
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
  • Learn ARM development(18)
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号