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 function module that can be called, and the displayed text can be highlighted. The corresponding header file is also provided.
1. Convert the P3.0, P3.1, and P3.2 interfaces provided by the routine to P3.4, P3.5, and P3.6
2. Added a parameter to indicate whether to display in reverse video in the display call parameter: 0 = no reverse video, 1 = reverse video
3. For the 5X8 display with highlighted text, one more column is added to eliminate the spaces between characters, making the characters clearer.
The microcontroller source program is as follows:
#ifndef __JLX1286486PC_H_
#define __JLX1286486PC_H_
/**********************************
JLX12864G-086S-PC uses SPI serial port, communication, with font library, a total of 12 pins
1 ROM_IN Font IC interface SI serial data input
2 ROM_OUT Font IC interface SO serial data output
3 ROM_SCK Font IC interface SCLK serial clock input
4 ROM_CS Font IC interface CS# Chip select input
5 LEDA Backlight power Backlight power positive pole, same as VDD voltage (5V or 3.3V)
6 VSS Ground 0V
7 VDD Circuit power supply 5V, or 3.3V optional
8 SCLK I/O Serial clock
9 SDA I/O Serial data
10 RS Register selection signal H: Data register 0: Instruction register (written as "A0" on IC data)
11 RESET Reset low level reset, after reset is completed, return to high level, the LCD module starts working
12 CS Chip select low level chip select
*********************************/
/**********************************
Include header files
**********************************/
#include #include //---Redefine keywords---// #ifndef uchar #define uchar unsigned char #endif #ifndef uint #define uint unsigned int #endif #ifndef ulong #define ulong unsigned long #endif /********************************** PIN port definition **********************************/ sbit lcd_sclk =P3^6; //in the example =P3^2; Interface definition: lcd_sclk is the SCLK of the LCD sbit lcd_sid =P3^5; //in the example =P3^1; Interface definition: lcd_sid is the SDA of the LCD sbit lcd_rs = P3^4; // in the example = P3^0; Interface definition: lcd_rs is the RS of LCD, also called "CD" sbit lcd_reset=P1^0; //Interface definition: lcd_reset is the LCD RESET sbit lcd_cs1 =P1^1; //Interface definition: lcd_cs1 is CS1 of LCD sbit Rom_IN =P1^2; //Font IC interface definition: Rom_IN is the SI of the font IC sbit Rom_OUT=P1^3; //Font IC interface definition: Rom_OUT is the SO of font IC sbit Rom_SCK=P1^4; //Font IC interface definition: Rom_SCK is the SCK of the font IC sbit Rom_CS =P1^5; //Font IC interface definition Rom_CS is the CS of font IC# /**************************************+ Function declaration **********************************/ //Delay void lcddelay(int n_ms); //Short delay void lcddelay_us(int n_us); //Write instructions to the LCD module void transfer_command_lcd(int data1); //Write data to LCD module void transfer_data_lcd(int data1); //LCD module initialization void initial_lcd(); void lcd_address(uint page,uint column); //Clear the entire screen void clear_screen(); //Display 128x64 dot matrix image void display_128x64(uchar *dp); //Display 16x16 dot matrix images, Chinese characters, rare characters or other icons of 16x16 dot matrix void display_graphic_16x16(uchar page,uchar column,uchar *dp); //Display 8x16 dot matrix images, ASCII, or 8x16 dot matrix self-made characters, other icons void display_graphic_8x16(uchar page,uchar column,uchar *dp); //Display 5X8 dot matrix images, ASCII, or 5x8 dot matrix self-made characters, other icons void display_graphic_5x8(uchar page,uchar column,uchar *dp); //Send instructions to the Jinglianxun font library IC void send_command_to_ROM( uchar datu ); //Get Chinese characters or character data (1 byte) from the Jinglianxun character library IC static uchar get_data_from_ROM() ; // Read data from the specified address and write it to the specified (page, column) coordinates of the LCD screen, uchar fb specifies whether to display in reverse video void get_and_write_16x16(ulong fontaddr,uchar page,uchar column,uchar fb); // Read data from the specified address and write it to the LCD screen at the specified (page, column) coordinates uchar fb specifies whether to display in reverse video void get_and_write_8x16(ulong fontaddr,uchar page,uchar column,uchar fb); // Read data from the specified address and write it to the LCD screen at the specified (page, column) coordinates uchar fb specifies whether to display in reverse video void get_and_write_5x8(ulong fontaddr,uchar page,uchar column,uchar fb); //uchar fb specifies whether to display in reverse video void display_GB2312_string(uchar page,uchar column,uchar *text,uchar fb); //uchar fb specifies whether to display in reverse video void display_string_5x8(uchar page,uchar column,uchar *text,uchar fb); #endif
Previous article:16*64LED dot matrix clock (moving + page turning display) MCU source program
Next article:The single-chip LCD12864G has independent functions with fonts, which can be called
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- [Review of Arteli Development Board AT32F421] + Simple application of timer
- Share a book about Cortex M3 core
- MicroPython v1.10 released
- Fudan Micro FM33LC046N Evaluation + ADC Collection Alarm
- MSP430FR235x-based pulse oximeter system solution
- CCS compilation error: Solution for missing header file
- Help chip F28377D to establish SYS/BIOS routines
- LWIP uses UDP to send data continuously
- It was very popular in the past, and now it is back, how should this button position be designed?
- Implementing USB source code with Verilog (FPGA)