51 single chip microcomputer controls LCD12864 to display Chinese characters

Publisher:MengyunLatest update time:2019-11-26 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

程序:
#include
#define DATA_PORT P0
sbit LCD12864_EN   = P1^2;
sbit LCD12864_RSET = P1^3;
sbit LCD12864_RS   = P1^0;
sbit LCD12864_RW   = P1^1;
sbit LCD12864_PSB  = P1^6;


void delay(unsigned int xms)  //延时//
{
        unsigned char i,j;
        for(j = 0; j < xms; j++)
        {
                for(i = 0;i < 110;i++);
        }
}
bit LcdBusyCheck(){
          bit result;
          LCD12864_RS = 0;
          LCD12864_RW = 1;
          LCD12864_EN = 1;
          result = (bit)(DATA_PORT&0x80);
          LCD12864_EN = 0;
          return result;
}

void WriteCmdToLCD(unsigned char cmd)
{
                //        while(LcdBusyCheck());
        delay(10);
          LCD12864_RS = 0;
          LCD12864_RW = 0;
          LCD12864_EN = 1;
          DATA_PORT = cmd;
          delay(5);
        LCD12864_EN = 0;
        delay(5);
        LCD12864_EN = 1;

}




void WriteDatToLcd(unsigned char dat)
{
                //while(LcdBusyCheck());
                delay(10);
                LCD12864_RS = 1;
          LCD12864_RW = 0;
          LCD12864_EN = 1;
          DATA_PORT = dat;
          delay(5);
        LCD12864_EN = 0;
        delay(5);
        LCD12864_EN = 1;

}


void WriteStrToLcd(unsigned char *str)
{
        while(*str != '')
        {
                WriteDatToLcd(*str++);
                delay(5);
        }
}





void LcdPos(unsigned char x,unsigned char y)
{
        unsigned char pos;
        if(x == 1)
        {
                x = 0x80;
        }else if(x == 2)
        {
                x = 0x90;
        }else if(x == 3)
        {
                x = 0x88;
        }else if(x == 4)
        {
                x = 0x98;
        }
        pos = x + y - 1;
        WriteCmdToLCD(pos);
}


void LcdInit()
{
        LCD12864_PSB = 1;
         LCD12864_RSET = 0;
         delay(10);
        LCD12864_RSET = 1;

        WriteCmdToLCD(0x30);
        delay(5);
        WriteCmdToLCD(0x30);
        delay(5);
        WriteCmdToLCD(0x18);
        delay(5);
        WriteCmdToLCD(0x10);
        delay(5);
        WriteCmdToLCD(0x01);

        delay(5);
        WriteCmdToLCD(0x06);
        delay(5);
         WriteCmdToLCD(0x0c);
        delay(5);


}
int main()
{
                P0 = 0xff;
                P1 = 0xff;
           LcdInit();
           while(1)
           {
                     LcdPos(1,1);
                         WriteStrToLcd("  榆林学院  ");
                        delay(5);

                LcdPos(2,1);
                         WriteStrToLcd("能源工程学院");
                        delay(5);
                LcdPos(3,1);
                         WriteStrToLcd("51控制LCD12864");
                        delay(5);
                LcdPos(4,1);
                         WriteStrToLcd("加油吧朋友们!!!");
                        delay(500);
           }
}

Reference address:51 single chip microcomputer controls LCD12864 to display Chinese characters

Previous article:51 single chip temperature control alarm and time display program + Proteus simulation
Next article:Course Design of Single Chip Microcomputer 00 to 99 Stopwatch

Recommended ReadingLatest update time:2024-11-15 17:44

The single-chip LCD12864G has independent functions with fonts, which can be called
When I used LCD12864, I used JLX12864G-086-pc, which is an LCD12864 screen with font library. I adopted the SPI serial port method and modified it according to the standard routines provided by the manufacturer. It was made into an independent module that can be called, and the displayed text can be highlighted. The c
[Microcontroller]
51 single chip microcomputer MPU6050 digital gyroscope and LCD12864 display
#include REG52.H #include math.h       #include stdio.h     #include INTRINS.H typedef unsigned char  uchar; typedef unsigned short ushort; typedef unsigned int   uint; #define DataPort P0      sbit    SCL=P2^6;            sbit SDA=P2^5;          sbit LCM_RS   = P3^7;    sbit LCM_RW   = P3^6;               sbi
[Microcontroller]
51 single chip microcomputer MPU6050 digital gyroscope and LCD12864 display
LCD12864 key menu setting with Chinese character library, single chip microcomputer experimental program
The actual picture of the LCD12864 button menu setting reverse white experiment sharing with Chinese character library is as follows: I am using Puzhong's development board. If you have the same model of Puzhong development board, you can't display it by downloading it directly because my development board h
[Microcontroller]
LCD12864 key menu setting with Chinese character library, single chip microcomputer experimental program
STC52 serial port information is displayed on LCD12864 screen
/***************************************************************************************** * : Please short-circuit the J2 jumper cap before use, and set the serial port assistant to a bit rate of 9600, no parity bit, and a stop bit of 1. The data sent is in hexadecimal format *****************************************
[Microcontroller]
AVR LCD12864 Program
/*********************************************************************         Purpose: Create LCD12864 operation library Target system: Based on AVR microcontroller                                                  Application software: ICCAVR                                                       Version: Version 1.0
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • 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)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号