Your Name Display on 16X2
![Screenshot 2024-05-06 200205.png](/proxy/?url=https://content.instructables.com/FG1/4YKL/LVUZ18X0/FG14YKLLVUZ18X0.png&filename=Screenshot 2024-05-06 200205.png)
To Get Start With STM32 Black Pill and STM Cube IDE to Display “YOUR NAME” on 16x2 LCD Without I2C Module Using HAL Programming.
Supplies
- STM32 Black Pill
- LCD
- Female to Female Jumpers
- STMCubeIDE
- STMCubeProgrammer
- USB C Cable
Downloading
In the landscape of embedded systems, efficient communication between microcontrollers and peripherals is essential. The liquidcrystal_i2c.h library serves as a vital tool in facilitating this communication, particularly when interfacing I2C LCDs with microcontrollers like the STM32 Black Pill. By abstracting the complexities of low-level I2C protocol implementation, this library streamlines the development process, allowing developers to focus on higher-level functionality and user experience. Its inclusion simplifies code maintenance and promotes code reusability, making it an indispensable asset for projects requiring reliable and efficient LCD control.
Download the file from-
https://github.com/eziya/STM32_HAL_I2C_HD44780/blob/master/Src/liquidcrystal_i2c.h
Configure Your STM Cube IDE
![Screenshot 2024-05-06 194915.png](/proxy/?url=https://content.instructables.com/FSN/03IA/LVUZ18H7/FSN03IALVUZ18H7.png&filename=Screenshot 2024-05-06 194915.png)
We will use STM32Cube IDE to program our STM32 board. Open the IDE and head over to a new project.
PIN Mode Selection Select Pin B6 and B7 for SCL and SDA Respectively
![Screenshot 2024-05-06 195043.png](/proxy/?url=https://content.instructables.com/FVE/Q1VC/LVUZ18HX/FVEQ1VCLVUZ18HX.png&filename=Screenshot 2024-05-06 195043.png)
I2C Configuration
![Screenshot 2024-05-06 195216.png](/proxy/?url=https://content.instructables.com/FV7/Y8SS/LVUZ18II/FV7Y8SSLVUZ18II.png&filename=Screenshot 2024-05-06 195216.png)
Configuring the Clock
![Screenshot 2024-05-06 195313.png](/proxy/?url=https://content.instructables.com/FH3/UBU8/LVUZ18JF/FH3UBU8LVUZ18JF.png&filename=Screenshot 2024-05-06 195313.png)
Adding the Code
#include "main.h"
#include "liquidcrystal_i2c.h"
I2C_HandleTypeDef hi2c1;
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_I2C1_Init(void);
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_I2C1_Init();
HD44780_Init(2);
HD44780_Clear();
HD44780_SetCursor(0,0);
HD44780_PrintStr("jai nandan");
HD44780_SetCursor(0,1);
HD44780_PrintStr("2310994528");
HAL_Delay(2000);
}
Debug and Building Binary File
Click on debug (On top left corner) to debug and generate binary file.
Opening the .elf File Created in System Explorer
![Screenshot 2024-05-06 195641.png](/proxy/?url=https://content.instructables.com/F2S/84DX/LVUZ18PC/F2S84DXLVUZ18PC.png&filename=Screenshot 2024-05-06 195641.png)
Open STMCubeProgrammer and Connect to STM Board Via USB
![Screenshot 2024-05-06 195731.png](/proxy/?url=https://content.instructables.com/FMN/XB10/LVUZ18QJ/FMNXB10LVUZ18QJ.png&filename=Screenshot 2024-05-06 195731.png)
Click on Open File and Paste the Copied Path
![Screenshot 2024-05-06 195821.png](/proxy/?url=https://content.instructables.com/FX0/2C09/LVUZ18S1/FX02C09LVUZ18S1.png&filename=Screenshot 2024-05-06 195821.png)