The characteristic is that there are many io ports, so we can drive this LCD screen in parallel to increase the speed of the bus. This program is collected from the Internet, but it has been verified by me and can be used, so it is published here. When you apply it, you only need to change the corresponding io.
Keywords:ATmega128
Reference address:ATmega128 parallel control with font library 12864 program
Software: GCC V4.20 -------------------------------------------------- ------------- Experimental content: Write Lcd12864_ST7920. -------------------------------------------------- ------------- Hardware Connection: LCD12864_ST7920 ATmega128 1.GND -------- GND 2.VCC -------- VCC 3.V0 -------- NC 4.RS(CS) -------- PD7 5.R/W(SID) -------- PG0 6.E(SCLK) -------- PG1 7.D0 -------- PC0 8.D1 -------- PC1 9.D2 -------- PC2 10.D3 -------- PC3 11.D4 -------- PC4 12.D5 -------- PC5 13.D6 -------- PC6 14.D7 -------- PC7 15.PSB -------- VCC 16.NC -------- NC 17.RST -------- VCC 18.NC -------- NC 19.LED+ -------- VCC 20.LED---------GND The following is the program source code: -------------------------------------------------- -------------*/ #include#include #include #define E_set PORTG|=_BV(PG1) //LCD enable #define E_clear PORTG&=~_BV(PG1) #define RW_set PORTG|=_BV(PG0) //LCD read and write #define RW_clear PORTG&=~_BV(PG0) #define RS_set PORTD|=_BV(PD7) //LCD data #define RS_clear PORTD&=~_BV(PD7) //LCD instruction unsigned char j=0; unsigned char yb=0x80; unsigned char name00[] PROGMEM={"Flying and shooting white deer in the snowy sky,"}; unsigned char name01[] PROGMEM={"Xiaoshu Shenxia Yibiyuan."}; unsigned char name02[] PROGMEM={"Heroes have always been extraordinary and eccentric since ancient times."}; unsigned char name03[] PROGMEM={"Mr. Jin writes with all his might."}; unsigned char name10[] PROGMEM={"Li Bai is about to set off on a boat,"}; unsigned char name11[] PROGMEM={"Suddenly I heard singing on the shore."}; unsigned char name12[] PROGMEM={"The water depth of Taohuatan is a thousand feet,"}; unsigned char name13[] PROGMEM={"Not as good as the love Wang Lun gave me."}; unsigned char name20[] PROGMEM={"this is a 12864 "}; unsigned char name21[] PROGMEM={"display program,"}; unsigned char name22[] PROGMEM={"welcome to commu"}; unsigned char name23[] PROGMEM={"nicate with me! "}; void wr_com(unsigned char); void wr_data(unsigned char); void reset (void); void outChinese(unsigned char, unsigned char, unsigned char *point); void ydgb(void); void outchar(unsigned char, unsigned char, unsigned char *point); void wr_com(unsigned char value)//Write instruction, RS=0;RW=0 must be used when writing instruction; { E_clear; RS_clear; RW_clear; _delay_ms(1); PORTC=value; //Incorporate character data E_set; _delay_ms(2); //If there is no delay, a busy check instruction must be added E_clear; } void wr_data(unsigned char sj)//Write data, RS=1;RW=0 must be set when writing data; { E_clear; RS_set; RW_clear; _delay_ms(1); PORTC=sj; E_set; _delay_ms(1); //If there is no delay, a busy check instruction must be added E_clear; } void reset (void) { wr_com(0x01);//Clear screen wr_com(0x08); //Display off wr_com(0x03);//Return wr_com(0x30); //Function setting wr_com(0x0f); //Open the display wr_com(0x01);//Clear screen } //**************** //outChinese is the function name //place is the first address of the displayed address //unit character length //charcode[] to display the data content void outChinese(unsigned char place,unsigned char unit,unsigned char *point) { unsigned char i,progdata; wr_com(place); for(i=0;i
Previous article:SPI display program of AVR microcontroller and 74HC595
Next article:4*4 matrix keyboard scanning and LED display program based on AVR
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
MoreDaily News
- 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
Guess you like
- DSP Interrupt System and Its Application
- The Enlightenment of Passive Optical Networks
- There is a problem adding USB CDC function in the official demo application SDDataLog
- Audio decoding
- Things to pay attention to when learning TMS320C2000
- How is the pin address determined?
- Using FPGA to realize accurate time keeping when GPS is out of step
- From millimeter wave to low frequency band, what you should know about 5G basic technology
- 125KHz low frequency wake-up wireless receiver chip - Si3933
- Remember! Don’t take these nine types of microcontroller projects!