MCU drives 19264 LCD to display Chinese characters C program

Publisher:blazingsLatest update time:2012-08-24 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

19264 LCD is a monochrome LCD slightly larger than 12864. Here I will introduce to you the principle of using STC series microcontroller to drive it to display Chinese characters.
Click to browse the next page

Effect diagram Due to limited space on the web page, this article only lists part of the code. Please download the full version from http://www.51hei.com/f/19264.rar
Click to browse the next page

#include
#include 
#define uchar unsigned char
#define uint unsigned int
uint ee;
uchar f;
sbit lcd_cs3=P1^0; //Chip select signal right low valid
sbit lcd_cs2=P1^1; //Chip select signal low effective
sbit lcd_cs1=P1^2; //Chip select signal left low valid
sbit lcd_e =P1^3; //enable signal
sbit lcd_rw = P1^4; // read and write selection
sbit lcd_rs = P1^5; //Data command selection terminal H data L command
sbit lcd_rst=P1^6; // LCD reset pin is active low, if it is low, it will be reset all the time
//P2 eight-bit data line
uchar code cc[]={


/*---------------Small----------------*/
0xFF,0xFF,0xFF,0xFF,0xBF,0xDF,0xEF,0xE7,0xF3,0xF9,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFE,0xFE,0xFE,0xFE,0xF6,0xF2,0xE6,0xEE,0xDE,0xBE,0x7E,0xFE,0xFE,0xFE,0xFA,0xFD,

/*---------------Peng----------------*/
0xEF,0xDF,0x83,0x9B,0xAB,0xAB,0xB3,0xBF,0x81,0xFD,0xFD,0x05,0xFD,0xEB,0xF7,0xFF,
0xFF,0x88,0xAA,0xAA,0x88,0xAA,0xAA,0xAA,0x88,0xAA,0xAA,0xAA,0xAA,0x46,0xEC,0xFF,

/*---------------work----------------*/
0xFF,0xFF,0xFF,0xF7,0xF7,0xF7,0xF7,0x07,0xFB,0xFB,0xFB,0xFB,0xFF,0xFF,0xFF,0xFF,
0xFF,0xEF,0xEF,0xEF,0xEF,0xEF,0xEF,0xF0,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0xFF,0xFF,
/*---------------do----------------*/
0x7F,0xBF,0xDF,0x07,0xF8,0xBF,0xCF,0xE3,0x0C,0x6F,0x6F,0xB7,0xB7,0xF7,0xFF,0xFF,
0xFF,0xFF,0xFF,0x80,0xFF,0xFF,0xFF,0xFF,0x80,0xFB,0xFB,0xFD,0xFD,0xFD,0xFF,0xFF,
/*---------------room----------------*/
0xFF,0xFF,0xE7,0xD7,0x57,0x97,0xD6,0xD9,0x6B,0x6B,0x2B,0x73,0xFB,0xFF,0xFF,0xFF,
0xFF,0xBF,0xBF,0xB6,0xB6,0xB6,0xB6,0xC0,0xDB,0xDB,0xDB,0xDE,0xDF,0xFF,0xFF,0xFF,

/*---------------open----------------*/
0xFF,0x7F,0x7F,0x7B,0x7B,0x03,0xBD,0xBD,0xBD,0x01,0xBD,0xBD,0xBF,0xBF,0xFF,0xFF,
0xFF,0xBF,0xDF,0xEF,0xF3,0xFC,0xFF,0xFF,0xFF,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

/*---------------hair----------------*/
0xFF,0xFF,0xDF,0xC1,0xDF,0x1F,0x60,0x6F,0x6F,0xAD,0x2B,0xEF,0xEF,0xFF,0xFF,0xFF,
0xDF,0xEF,0xB7,0xBB,0xDC,0xDD,0xEB,0xF7,0xF3,0xED,0xDE,0xBF,0xBF,0xBF,0xFF,0xFF,

/*----------------------------------*/
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

};
uchar code dd[]={

/*---------------Small----------------*/
0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x18,0x0C,0x06,0x04,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x09,0x0D,0x19,0x11,0x21,0x41,0x81,0x01,0x01,0x01,0x05,0x02,

/*---------------Peng----------------*/
0x10,0x20,0x7C,0x64,0x54,0x54,0x4C,0x40,0x7E,0x02,0x02,0xFA,0x02,0x14,0x08,0x00,
0x00,0x77,0x55,0x55,0x77,0x55,0x55,0x55,0x77,0x55,0x55,0x55,0x55,0xB9,0x13,0x00,

/*---------------work----------------*/
0x00,0x00,0x00,0x08,0x08,0x08,0x08,0xF8,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,
0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,

/*---------------do----------------*/
0x80,0x40,0x20,0xF8,0x07,0x40,0x30,0x1C,0xF3,0x90,0x90,0x48,0x48,0x08,0x00,0x00,
0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x7F,0x04,0x04,0x02,0x02,0x02,0x00,0x00,
/*---------------room----------------*/
0x00,0x00,0x18,0x28,0xA8,0x68,0x29,0x26,0x94,0x94,0xD4,0x8C,0x04,0x00,0x00,0x00,
0x00,0x40,0x40,0x49,0x49,0x49,0x49,0x3F,0x24,0x24,0x24,0x21,0x20,0x00,0x00,0x00,

/*---------------open----------------*/
0x00,0x80,0x80,0x84,0x84,0xFC,0x42,0x42,0x42,0xFE,0x42,0x42,0x40,0x40,0x00,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
/*---------------hair----------------*/
0x00,0x00,0x20,0x3E,0x20,0xE0,0x9F,0x90,0x90,0x52,0xD4,0x10,0x10,0x00,0x00,0x00,
0x20,0x10,0x48,0x44,0x23,0x22,0x14,0x08,0x0C,0x12,0x21,0x40,0x40,0x40,0x00,0x00,

};
void lcd_init();
void wrile_com(uchar com);
void wrile_data(uchar dat);
void QPCZ(uchar TT,rg); //LCD screen clearing operation
void XYZ(uchar q1,q2,q3);

void delay(uchar d0);

void main()
{
 

 
  
while(1)
{lcd_init();
 QPCZ(0x11,0xff);
 delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
 delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
  QPCZ(0x00,0x00);
XYZ(0xc0,0xb8,0x60);
 lcd_cs1=0;
 lcd_cs2=1;
 lcd_cs3=1;

 for(f=0;f<224;f++)
 {
if(f==64)
{lcd_cs1=1;
 lcd_cs2=0;
 lcd_cs3=1;
}
if(f==192)
{lcd_cs1=1;
 lcd_cs2=1;
 lcd_cs3=0;
}

 switch(f) // Compare the statements in the brackets with the case
{case 16:XYZ(0xc0,0xb9,0x60); //Compare the same
break;
case 32:XYZ(0xc0,0xb8,0x70); //Compare the same
break;
case 48:XYZ(0xc0,0xb9,0x70); //Compare the same
break;
case 64:XYZ(0xc0,0xb8,0x40); //Compare the same
break;
case 80:XYZ(0xc0,0xb9,0x40); //Compare the same
break;
case 96:XYZ(0xc0,0xb8,0x50); //Compare the same
break;
case 112:XYZ(0xc0,0xb9,0x50); //Compare the same
break;
case 128:XYZ(0xc0,0xb8,0x60); //Compare the same
break;
case 144:XYZ(0xc0,0xb9,0x60); //Compare the same
break;
case 160:XYZ(0xc0,0xb8,0x70); //Compare the same
break;
case 176:XYZ(0xc0,0xb9,0x70); //Compare the same
break;
case 192:XYZ(0xc0,0xb8,0x40); //Compare the same
break;
case 208:XYZ(0xc0,0xb9,0x40); //Compare the same
break;

}
// delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
 wrile_data(cc[f]);
  
 }

XYZ(0xc0,0xb8,0x60);
 lcd_cs1=0;
 lcd_cs2=1;
 lcd_cs3=1;
XYZ(0xc0,0xb8,0x60);
 lcd_cs1=0;
 lcd_cs2=1;
 lcd_cs3=1;
 for(f=0;f<224;f++)
 {
if(f==64)
{lcd_cs1=1;
 lcd_cs2=0;
 lcd_cs3=1;
}
if(f==192)
{lcd_cs1=1;
 lcd_cs2=1;
 lcd_cs3=0;
}

 switch(f) // Compare the statements in the brackets with the case
{case 16:XYZ(0xc0,0xb9,0x60); //Compare the same
break;
case 32:XYZ(0xc0,0xb8,0x70); //Compare the same
break;
case 48:XYZ(0xc0,0xb9,0x70); //Compare the same
break;
case 64:XYZ(0xc0,0xb8,0x40); //Compare the same
break;
case 80:XYZ(0xc0,0xb9,0x40); //Compare the same
break;
case 96:XYZ(0xc0,0xb8,0x50); //Compare the same
break;
case 112:XYZ(0xc0,0xb9,0x50); //Compare the same
break;
case 128:XYZ(0xc0,0xb8,0x60); //Compare the same
break;
case 144:XYZ(0xc0,0xb9,0x60); //Compare the same
break;
case 160:XYZ(0xc0,0xb8,0x70); //Compare the same
break;
case 176:XYZ(0xc0,0xb9,0x70); //Compare the same
break;
case 192:XYZ(0xc0,0xb8,0x40); //Compare the same
break;
case 208:XYZ(0xc0,0xb9,0x40); //Compare the same
break;

}
 //delay(250);delay(250);delay(250);delay(250);delay(250);delay(250);
 wrile_data(dd[f]);
  
 }

 

XYZ(0xc0,0xba,0x60);
 lcd_cs1=0;
 lcd_cs2=1;
 lcd_cs3=1;
XYZ(0xc0,0xba,0x60);
 lcd_cs1=0;
 lcd_cs2=1;
 lcd_cs3=1;
 for(f=0;f<224;f++)
 {
if(f==64)
{lcd_cs1=1;
 lcd_cs2=0;
 lcd_cs3=1;
}
if(f==192)
{lcd_cs1=1;
 lcd_cs2=1;
 lcd_cs3=0;
}

 switch(f) // Compare the statements in the brackets with the case
{case 16:XYZ(0xc0,0xbb,0x60); //Compare the same
break;
case 32:XYZ(0xc0,0xba,0x70); //Compare the same
break;
case 48:XYZ(0xc0,0xbb,0x70); //Compare the same
break;
case 64:XYZ(0xc0,0xba,0x40); //Compare the same
break;
case 80:XYZ(0xc0,0xbb,0x40); //Compare the same
break;
case 96:XYZ(0xc0,0xba,0x50); //Comparison is the same
break;
case 112:XYZ(0xc0,0xbb,0x50); //Compare the same
break;
case 128:XYZ(0xc0,0xba,0x60); //Compare the same
break;
case 144:XYZ(0xc0,0xbb,0x60); //Compare the same
break;
case 160:XYZ(0xc0,0xba,0x70); //Compare the same
break;
case 176:XYZ(0xc0,0xbb,0x70); //Compare the same
break;
case 192:XYZ(0xc0,0xba,0x40); //Comparison is the same
break;
case 208:XYZ(0xc0,0xbb,0x40); //Compare the same
break;

}
// delay(250);delay(250);delay(250);delay(250);delay(250);
delay(250);
 wrile_data(cc[f]);
 
 }  
  QPCZ(0xff,0xff);
 delay(250);delay(250);delay(250);


}


}

void lcd_init()
{
lcd_rst=0;
delay(50);
lcd_rst=1;
delay(255); //wait for reset
 lcd_cs1=0;
 lcd_cs2=0;
 lcd_cs3=0;
 wrile_com(0x3f);
 

}

 

void wrile_com(uchar com)
{ lcd_e=0; //
  lcd_rw=0; //Read and write selection write
  lcd_rs=0; //data command
  lcd_e=1; //
  P2=com;
  _nop_();
  lcd_e=0;
  delay(5);
}

void wrile_data(uchar dat)
{ lcd_e=0; //
  lcd_rw=0; //Read and write selection write
  lcd_rs=1; //data command
  lcd_e=1; //
  P2=dat;
  _nop_();
  lcd_e=0;
  delay(5);
}

void XYZ(uchar q1,q2,q3)
{ wrile_com(q1);//Display the start line
 wrile_com(q2);//page address
 wrile_com(q3); //column address setting
}
void QPCZ(uchar TT,rg) //LCD screen clearing operation
{uchar qw,qe,er;
 lcd_cs1=0;
 lcd_cs2=0;
 lcd_cs3=0;
 er=0xb8;
XYZ(0xc0,0xb8,0x40);
for(qw=0;qw<8;qw++)
{
   wrile_com(er);//page address
 for(qe=0;qe<64;qe++)
 { wrile_data(TT);delay(rg); }
 wrile_com(er++);//page address
  
}

}
void delay(uchar d0)
{uchar d1,d2;
 for(d1=d0;d1>0;d1--)
  for(d2=110;d2>0;d2--);
}
Reference address:MCU drives 19264 LCD to display Chinese characters C program

Previous article:Using 51Hei MCU Development Board to Make AD-Based Digital Voltmeter
Next article:Issues that need attention when expanding RAM and 8255 in STC microcontroller

Recommended ReadingLatest update time:2024-11-16 18:11

Microcontroller drives radio module program
This is  a subroutine intercepted from http://www.51hei.com/bbs/dpj-20623-1.html . Please download the attachment to call the function. The radio.h file is as follows: #ifndef _RADIO_H_ #define _RADIO_H_ uint8 radio_read ; //define two five-byte arrays to store memory space for writing control registers and rea
[Microcontroller]
Design of stepper motor drive circuit based on single chip microcomputer
Stepper motors are widely used in control systems. They can convert pulse signals into angular displacements and can be used as electromagnetic brake wheels, electromagnetic differentiators, or angular displacement generators. Sometimes, if you want to use a stepper motor removed from some old equipment (this t
[Microcontroller]
Design of stepper motor drive circuit based on single chip microcomputer
Design of stepper motor drive circuit based on 51 single chip microcomputer
Stepper motors are widely used in control systems. They can convert pulse signals into angular displacements and can be used as electromagnetic brake wheels, electromagnetic differentiators, or angular displacement generators. Sometimes, if you want to use a stepper motor removed from some old equipment (this t
[Microcontroller]
Design of stepper motor drive circuit based on 51 single chip microcomputer
Design of LCD module driven by PIC microcontroller
The bias voltage is generated by using an external resistor ladder network (see the circuit diagram below). Because the resistor ladder network is connected between VDD and Vss, there will be a current flowing through the resistor ladder network, and the current is inversely proportional to the resistance. In other wo
[Microcontroller]
Design of LCD module driven by PIC microcontroller
STC89C52 MCU drives CC1101 wireless module receiving C language program
#include #include intrins.h #defineINT8Uunsigned char #defineINT16Uunsigned int #define WRITE_BURST 0x40 //Continuous writing #define READ_SINGLE 0x80 // read #define READ_BURST 0xC0 //Continuous read #define BYTES_IN_RXFIFO 0x7F //Number of valid bytes in the receive buffer #define CRC_OK 0x80 //CRC check
[Microcontroller]
51 MCU Programming Section 5: Keyboard Driver
Section 5: Keyboard Driver It means providing some functions for tasks to call, get key information, or read key values. Define a header file KEY.H to describe the available functions, as follows: Code 1. #ifndef _KEY_H_ //Prevent repeated references to the document. If the symbol _KEY_H_ has not been defined,
[Microcontroller]
Why should the microcontroller driver be set to low level valid?
Question: Are peripheral circuit designs and programming of single-chip microcomputers mostly driven by low-level effective circuits?  Answer: This is because the sinking current of the single-chip microcomputer at low level is generally larger than the source current at high level. For example, the I/O port of a gene
[Microcontroller]
HD4478U Display LCD and 51 MCU Driver
#include #include absacc.h   #include intrins.h sbit LCDRSPIN = P3^7; sbit LCDRWPIN = P3^6; sbit LCDEPIN = P2^6; #define UCHAR unsigned char void delay(unsigned int i) {     UCHAR j;     for(i; i 0; i--)         for(j = 200; j 0; j--); }       ///////////////////////////////// //control LCD unsig
[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号