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.
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
#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--); }
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
- Popular Resources
- Popular amplifiers
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Repost] Learn these eight circuit design skills and your professional quality will be greatly improved
- [STM32WB55 Review] +ST's Attack
- In the TTL inverter circuit, there is no power supply on the collector of VT4. How does VT4 saturate?
- MSP430 ADC conversion + mean filter
- EEWORLD University ---- Linux Kernel Design
- TI eSMO library Fsmopos and Gsmopos parameter analysis
- Today's live broadcast: TE will explain the design trends of smart antennas and sensor application cases in the Internet of Things
- msp430 implements a key matrix scan and UART transmission
- MSP430 ADC acquisition filter
- 【GD32E231 DIY】USART0 uses DMA to send and receive, without using CPU