To Display “YOUR NAME” on 16x2 LCD Without I2C Module Using HAL Programming.

by khushpreet in Circuits > Microcontrollers

64 Views, 2 Favorites, 0 Comments

To Display “YOUR NAME” on 16x2 LCD Without I2C Module Using HAL Programming.

FTMZ3HGLFNZF1AY.png

" Welcome to a place where everything fits together perfectly and is carefully engineered. Every tiny dot on the screen has a story to tell and every line of computer instructions brings our hardware to life. " Today, we start learning about how to connect a STM32 Black Pill with STM32CubeIDE to control LCD's. It will help us become experts in this area. 

In this detailed guide, we explore how to display your name on LCD using STM32 Black Pill microcontroller in HAL Programming, explaining everything in a clear and easy-to-understand way.  Whether you are an experienced developer looking to learn new things or just someone interested in learning about embedded systems, this blog is designed to help and motivate you. 

We use STM32CubeIDE to help us work creatively and professionally with hardware and software. Together, we'll use this special computer setup to create beautiful stories from data. 

Get ready to discover all the amazing things your STM32 Black Pill can do as we learn and explore together. Let's go beyond limits, combine new ideas with old ones, and create new ways to control displays. The canvas is empty, we have all the tools we need; it's time to create something amazing that connects and works well. 

Come with us as we start this journey of discovering new things. Together, we will figure out how embedded systems work and understand what is going on inside them. Welcome to a place where creativity meets smart ideas, where every computer code creates the future, and where the adventure itself is just as exciting as reaching the goal. 

Supplies

  1. STM32 Black Pill
  2. LCD with I2C
  3. Female to Female Jumpers
  4. STMCubeIDE
  5. STMCubeProgrammer
  6. USB C Cable

Downloading

You will need a black pill board and STM cube IDE for this project. If you don't have the IDE yet, you can get it from the STMicroelectronics website. After you install the IDE, you will need to set up your project.

Creating New Project

FYQDFSILTMYDVKN.png

In the cube IDE program, go to "File" and then choose "New Project. " Pick "STM32F401CCU6" from the list and click "Next. "

Downloading Library

Pin Configuration

Screenshot 2024-05-06 at 6.47.08 PM.png

Select Pin B6 and B7 for SCL and SDA respectively

I2C Configuration

Screenshot 2024-05-06 at 6.48.23 PM.png

Configure the I2C mode to I2C under Connections Menu

Configuring the Clock

FI9U5UVLTMYDVSV.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("KHUSHPREET");

HD44780_SetCursor(0,1);

HD44780_PrintStr("KAUR");

HAL_Delay(2000);

}

Creating Hex File

FZBGA57LUZJCWCZ.jpg

Click on file>properties>hex file and create a hex file

Implementation of Hex File

FQZHB98LTMYDW9S.png

Open hex file in cube programmer and execute it using STM 32

Congrats!

IMG_3228.jpeg