UART and 74HC595 7-Segment Display Control with STM32

by Marwen Maghrebi

In this article, we explore UART communication with the 74HC595 display to create an efficient 7-segment display system.

74HC595 shift register interfaced with a 7-segment display to control multiple digits using fewer GPIO pins.

Things used in this project

Software apps and online services

1- STMicroelectronics STM32CubeMX

2- STMicroelectronics STM32CubeIDE

3- Proteus 8

Using 74HC595 Shift Registers to Control Multiple 7-Segment Displays

In this article, we delve into the intricacies of using the UART and 74HC595 7-Segment Display to control a 7-segment display. We explore the configuration and integration of the 74HC595 Shift Register within embedded systems, specifically focusing on how to efficiently utilize UART communication to cycle through numbers 0 to 9. This approach not only demonstrates the power and flexibility of the 74HC595 but also showcases how to achieve precise control of multiple 7-segment displays through UART.

 7-Segment Display :

The 7-segment display, a ubiquitous component in electronics, offers a simple yet effective means of visualizing numerical data. Comprising seven segments arranged in a pattern resembling the number “8,” each segment can be independently illuminated to represent numeric digits ranging from 0 to 9.

 Its straightforward design makes it a popular choice for displaying numeric information in various applications, from digital clocks and timers to electronic meters and counters.

Exploring the 74HC595 Shift Register : 

The 74HC595 Shift Register serves as a fundamental element in expanding GPIO capabilities for driving multiple 7-segment displays within our project. We offer a comprehensive insight into its operational principles, emphasizing its serial-in, parallel-out architecture. Moreover, we highlight its effectiveness in driving a common anode 7-segment display, showcasing its adaptability and efficiency in our project setup.

To kickstart this project, we’ll begin by configuring the GPIO pins (PA3 to PA7) as output pins. Specifically, we define the following pins: SER (PA3), RCLK (PA4), SRCLK (PA5), OE (PA6), and SRCLR (PA7). These definitions set the groundwork for our interface, allowing the microcontroller to communicate effectively with the 74HC595 Shift Register.

Next, we’ll delve into setting up the interface, focusing on using a counter to cycle through numbers 0 to 9 and display them on the 7-segment display. This approach demonstrates how to efficiently and effectively use the 74HC595 Shift Register in embedded systems.

STM32CubeMX Configuration:

  • Open CubeMX & Create New Project Choose The Target MCU STM32F103C6 & Double-Click Its Name
  • In Tab System Core Set High Speed Clock : Crystal/Ceramic Resonator
  • Go To The Clock Configuration & Set The System Clock To 72MHz

Configuration for the GPIO Mode:

  • Configure The GPIO Pins [PA3..PA7] as Output Pin
  • Set User Label : PA3 -> SER && PA4 -> RCLK && PA5 -> SRCLK && PA6 -> OE && PA7 -> SRCLR.
  • Generate The Initialization Code & Open The Project In CubeIDE

STM32CubeIDE Configuration:

  • Write The Application Layer Code
  • main.c

Proteus Configuration :

  • Open Proteus & Create New Project and click next

  • Click on Pick Device
  • Search for STM32F103C6 & 74HC595 & 7-SEG
  • Click on Virtual Instruments Mode then choose

  • Click on Terminal Mode then choose (DEFAULT & POWER &GROUND)
  • finally make the circuit below and start the simulation
STM32 connected to 74HC595 shift register for controlling 7-segment display

That’s all!

If you have any questions or suggestions don’t hesitate to leave a comment below

You Might Also Like

Leave a Comment


Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00