Step by Step Guidance for Interfacing 16X2 LCD Without I2C
by Jasleen_kaur in Circuits > Microcontrollers
264 Views, 0 Favorites, 0 Comments
Step by Step Guidance for Interfacing 16X2 LCD Without I2C
Introducing the STM32 Black Pill, a compact and robust microcontroller board leveraging the power of the STM32F103C8T6 ARM Cortex-M3 processor. With its extensive range of peripherals like GPIOs, UARTs, SPIs, I2Cs, and more, it proves its versatility across various applications. This tutorial will enlighten us on utilizing the STM32 Black Pill and STM Cube IDE to exhibit the text "Name" on a 16x2 LCD display. Interestingly, we'll accomplish this without relying on an I2C module, but by harnessing the potential of HAL (Hardware Abstraction Layer) programming. Embrace this exciting journey of discovery!
Supplies
- STM32 Black Pill board
- 16x2 LCD module
- Jumper wires
- STM Cube IDE
- STM32 Cube Programming
- C-type Cable
Creating a New Project
- Open STM32CubeIDE>Goto files>click New>select STM32 Project
Adding MCU/MPU Selector Features for STM32 Project
- Enter the Commerical Number of STM32 you want to work with( used Commerical Number in this project:STM32F401CCU6)
- Select the required type of configuration of STM32.
- Then click next.
- A dialogue box appears >type the name of the project
- The project file is created to work on it.
Pinout Configuration
- Select RCC from System Core.
- Select the Bypass Clock Source in High speed clock.
- Select the Pins to which the LCD pins are connected and set them as "GPIO_Output".
Clock Configuration
- Select clock configuration.
- Select HSE and PLLCLK in PLL Source MUX & System Clock MUX respectively.
- Then select resolve clock issues
Generating the Code
- Select the project from dialogue box.
- Select generate code option from it.
- The code gets generated.
Creating .Ioc File
- Select the file you working on (from the left side)>right click on it.
- A option box appears>select properties.
- Then the dialogue box opens >select the C/C++ Build (from left side of it).
- Select settings>MCU Post build Ouput
- Choose the options shown in the image.
- Then apply and close.
- The .ioc file is created
Main.c
- Select the core from the File .
- Go to Src>select main.c.
- Main.c gets open to write code.(A code is generated already to help you in the configuration and to identify pin numbers you selected as output pins)
Writing Code
- Write the according to the photograph and in while loop.
- Change the Chitkara Univeristy with your name.
Debug the Code
- Select Build >select option 1.debug
Copying the Path Of.elf File
- After debuging the ;if any error arises then remove all the error and if no error comes then go to .ioc file.
- Select .ioc file right click on it ,a option box appears.
- Select show in>system explorer.
- Files will be opened.
- Select the .elf file and copy its path.
Adding the .elf on STM32CubeProgramer
- Open the STM32CubeProgrammer.
- Select the Open file option >paste the path copied of .elf file there.
- File is added.
Breadboard Connection
- Connect the LCD with STM32 Black Pill similarly to the given connections.
Connect the STM32
- Connect the STM32 Black pill with Laptop.
- Connect it with STM32CubeProgrammer by USB.
- BOOT the STM32 to connect it.
- After connecting click on Connect
Download the File
- Goto Download>paste the copied of .elf file here also
- Click on Start Automatic Mode.
LCD Start Interfacing
- Disconnect the STM32.
- You will see your name on the LCD.