This post was last edited by lbbook on 2022-3-1 00:49
1. Introduction to LCD display module
LM6059BCW Graphic Display Module
The main parameters are as follows
Resolution: 128 x 64
Interface: parallel port / serial port
Voltage: 3.3V
Operating temperature: -20°C to 70°C
Dimensions: 50.9mm x 40.9mm x 8.7mm
Viewport: 37.0mm x 28.0mm
The official display effect is as follows:
The front and back of the actual object are as follows (removed from an old experimental board):
2. LCD display module wiring
Since the GPIO analog serial port driver LM6059 has been ported to the STM32F103 platform before , the IO analog serial port method is also used here . First, connect the LCD module and the development board.
Serial number
|
GD32L233C
|
LM6059
|
Function
|
1
|
PB4
|
CS
|
Chip Select
|
2
|
PB5
|
RES
|
Reset
|
3
|
PB6
|
A0
|
Distinguish between display data and control commands
|
4
|
PB7
|
SCL
|
Serial port clock
|
5
|
PB8
|
SI
|
Serial port data
|
6
|
3V3
|
VDD
|
Module power positive pole 3.3V
|
7
|
GND
|
VSS
|
Module power ground
|
3. LCD display module program
3.1 Initialize GPIO
/* enable the GPIO clock */
rcu_periph_clock_enable(RCU_GPIOB);
/* configure GPIO pins */
gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8);
/* reset GPIO pin */
gpio_bit_reset(GPIOB, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8);
3.2 Initialize IO status
SET_LCD_CS();
SET_LCD_A0();
SET_LCD_CLK();
SET_LCD_MOSI();
3.3 Reset
SET_LCD_RST();
CLR_LCD_RST();
delay_1ms(1); // Keep low level for at least 2.5uS
SET_LCD_RST();
delay_1ms(1); // After restarting, it can work normally in 2.5uS at most
3.4 Initialization
SdCmd(0xab); //new
SdCmd(0xaf); // display on
SdCmd(0x40); // display start line=0
SdCmd(0xc8); // Common output mode select= reverse
SdCmd(0xa6); // normal display
SdCmd(0xa4); // Duisplay all point = off
SdCmd(0xa3); // LCD bias = 1/9 a2
SdCmd(0x2f); // Power control = all on
SdCmd(0x25); // Rab Ratio 26
SdCmd(0x81); // E-Vol setting
SdCmd(0x1A); // (2byte command)Parameter.ContrastLevel
3.5 Display Hello World !
initLCDM();
LCD_Display_12_12(0,16,(unsigned char *)"Hello World!");
LCD_DrawLine(8,4,59,4); //Y axis
LCD_DrawLine(57,2,57,124); //X axis
LCD_Display_4_5(59,6,"0"); //0
WriteScreen(DisplayBuffer);
3.6 Migration Tips
The main thing is to initialize the 5 GPIOs and pay attention to the reset delay time. The timing is generally fine, and you can also check it against the figure below.
Another thing is that you usually modify a display array, but if you don't upload the display array to the module, it won't be displayed. You should pay attention to this, otherwise you will end up like me, after modifying it for a long time and it didn't show up, and I thought I had transplanted it wrong or the LCD module was damaged, after all, it was a disassembled part.
Attached is part of the program:
LCD.c
(10.63 KB, downloads: 19)
LCD.h
(4.11 KB, downloads: 18)
font12x12.c
(7.09 KB, downloads: 15)
font12x12.h
(404 Bytes, downloads: 13)
font4x5.c
(1 KB, downloads: 14)
font4x5.h
(201 Bytes, downloads: 13)
|