To Start With STM32 Black Pill and STM Cube IDE to Display “YOUR NAME” on 16x2 LCD Without I2C Module Using HAL Programming.
by Arshjottt in Circuits > Microcontrollers
68 Views, 1 Favorites, 0 Comments
To Start With STM32 Black Pill and STM Cube IDE to Display “YOUR NAME” on 16x2 LCD Without I2C Module Using HAL Programming.
The STM32 Black Pill, a popular STM32 development board, offers a cost-effective and versatile platform for embedded systems development. Coupled with STM32CubeIDE, an integrated development environment (IDE) from STMicroelectronics, developers can harness the power of Hardware Abstraction Layer (HAL) programming to efficiently utilize the STM32 microcontroller's capabilities.
In this guide, we'll explore how to display "YOUR NAME" on a 16x2 LCD without an I2C module using HAL programming with the STM32 Black Pill and STM32CubeIDE. This tutorial serves as a primer for beginners looking to embark on embedded development with STM32 microcontrollers.
Supplies
- STM32 Black Pill
- LCD with I2C
- Female to Female Jumpers
- STMCubeIDE
- STMCubeProgrammer
- USB C Cable
Downloading
The LiquidCrystal library simplifies the process of interfacing with character LCD displays, making it accessible for hobbyists and professionals alike. By providing an easy-to-use interface and abstracting away hardware complexities, it enables developers to focus on building creative projects without getting bogged down in low-level details. Whether you're displaying sensor data, creating custom interfaces, or adding visual feedback to your projects, the LiquidCrystal library is a valuable tool in the Arduino ecosystem.
Download the file from- https://github.com/eziya/STM32_HAL_I2C_HD44780/blob/master/Src/liquidcrystal_i2c.h
or you can download it from any search engine you like.
Configure Your STM32Cube IDE
Open the IDE and head over to a new project.Then for the target selection, specify the STM32 BlackPill board number. After that click on any column as shown in the picture above.
PIN Mode Selection
Pinout Selection
I2C Configuration
Configure the I2C mode to I2C under Connections Menu
Configuring the Clock
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("Arshjot");
HD44780_SetCursor(0,1);
HD44780_PrintStr("Singh");
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
Right click on the project and click on show in system explorer and copy its path