Template: 2inch-LCD-Module-STM32-Guides

From Waveshare Wiki
Jump to: navigation, search

Hardware Connection

The examples are based on STM32F103RBT6 as well as the connection table. If you want to use other MCU, you need to port the project and change the connection according to the actual hardware.

Connect to STM32F103RBT6
LCD STM32
VCC 3.3V
GND GND
DIN PA7
CLK PA5
CS PB6
DC PA8
RST PA9
BL PC7

Use Waveshare XNUCLEO-F103RB as examples
XNUCLEO-F103RB-LCD-Connet.jpg

About the examples

The examples use HAL libraries. Download demo codes, unzip, and find the STM32 projects. Open LCD_demo.uvprojx which is located in STM32\STM32F103RBT6\MDK-ARM directory by Keil project
LCD STM32 CODE1.png

Open main.c file, you can configure the types for actual displays, recompile the project and download it to your board.
LCD STM32 CODE2.png

LCD_0in96_test()    0.96inch LCD example
LCD_1in14_test() 1.14inch LCD example
LCD_1in28_test() 1.28inch LCD example
LCD_1in3_test() 1.3inch LCD example
LCD_1in54_test() 1.54inch LCD example
LCD_1in8_test() 1.8inch LCD example
LCD_2in_test() 2inchLCDexample


Arduino

  • Download examples from wiki. Unzip it. The path of Arduino examples is ~/Arduino UNO/...
  • Copyt the folders in Arduino directory to 【Installation directory】/libraries/ (Generally the installation directory is C:\Program Files (x86)\Arduino\libraries)
  • Open Arduino IDE software, and click File -> Examples to check if LCD_2inch codes are there.
  • The development board used is Arduino UNO.

Hardware connection

2inch LCD UNO PLUS
VCC 5V
GND GND
DIN D11
CLK D12
CS D10
DC D7
RST D8
BL D9

Expected result

  1. The display is cleaned to white
  2. Display numbers and strings
  3. Draw a rectangle
  4. Draw a line
  5. Draw five circles
  6. Display a 70x70 image