You can mark it at any position. I would like to thank those kind people who explained the places where problems are likely to occur. Be sure to read DATESHEET carefully for the convenience of future generations. 1. Positioning of dot position 2. Reading currently displayed data 3. Or and shift, i.e. rewriting new data The program is as follows: void GUI_Point(uchar x,uchar y,uchar flag) { uchar x_Dyte,x_byte; //Define the byte position of the column address, and which bit in the byte uchar y_Dyte,y_byte; //Define as upper and lower screens (values are 0, 1), row address (values are 0~31) Write_command(0x36); //Drawing mode command /***X,Y coordinates are interchanged, i.e. ordinary X,Y coordinates***/ x_Dyte=y/16; //Calculate which one of the 16 bytes x_byte=y&0x0f; //Calculate which bit in the byte y_Dyte=x/32; //0 is the upper half of the screen, 1 is the lower half of the screen y_byte=x&0x1f; //Calculate which row among 0~31 Write_command(0x80+y_byte); //Set the row address (y coordinate) Write_command(0x80+x_Dyte+8*y_Dyte); //Set the column address (x coordinate), and select the upper and lower screens through 8*y_DyteRead_data (); GDRAM_hbit=Read_data(); //Read the current display high 8-bit dataGDRAM_lbit=Read_data(); //Read the current display low 8-bit datadelay_us (5); if(flag==1) { Write_command(0x80+y_byte); //Set the row address (y coordinate) Write_command(0x80+x_Dyte+8*y_Dyte); //Set the column address (x coordinate), and select the upper and lower screens through 8*y_Dytedelay_us (5); if(x_byte<8) //Judge whether it is in the upper 8 bits or the lower 8 bits { Write_data(GDRAM_hbit|(0X01<<(7-x_byte))); //Display the upper 8-bit data of GDRAM area Write_data(GDRAM_lbit); //Display the lower 8-bit data of GDRAM area } else { Write_data(GDRAM_hbit); Write_data(GDRAM_lbit|(0x01<<(15-x_byte))); } } else { Write_data(0x00)); //Clear the upper 8-bit data of GDRAM area Write_data(0x00)); //Clear the lower 8-bit data of GDRAM area } } /**********Read the LCD display data of the current address **********/ uchar Read_data() { uchar shuju; LCD_DATA_set_in; // Set port PB to input LCD_DATA_PORT=0xff; SET_DI; // D/I=1, represents data SET_RW; // R/W=1.Read delay_us(10); SET_E; delay_us(100); shuju=PINB; //Read the currently displayed data CLR_E; return(shuju); } |
Previous article:Design of arbitrary menu structure based on single chip microcomputer
Next article:STM8S interrupt priority setting
- Popular Resources
- Popular amplifiers
- The Implementation of Chinese Character Input Method Based on ROM Single Chip Microcomputer
- The Implementation of Chinese Character Input Method Based on ROM Single Chip Microcomputer
- ST7920,pdf datasheet (Chinese Fonts built in LCD controller/driver)
- ST7920 pdf,ST7920 datasheet (Chinese Fonts built in LCD controller/driver)
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
- 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
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
- How to manually add a network to a PCB in Altium
- How do you learn about the latest products and technologies in the industry? Take power supply as an example:
- EEWORLD University ---- Embedded Operating System
- EEWORLD University ---- Microchip Security Series 9: Firmware Authentication Using TrustFLEX Secure Element
- Share: How to achieve single-layer PCB layout and improve EMI?
- FPGA_Journey_Flowing Light.pdf
- 28335 Procedure
- TI Precision Labs - Motor Drivers
- TMU Introduction and Usage
- Tracking 0 ~ ± 15V regulated power supply