TM4C123 TIVA Kit With Seven Segment Display
TM4C123 TIVA Kit With Seven Segment Display
Objective:
“To interface TM4C123 TIVA kit with seven segment display and display 0-9”
Apparatus required:
TM4C123 TIVA launchpad
Seven-segment display
Resistors (330Ω)
Connecting wires
Breadboard
Theory:
TM4C123 microcontroller:
The TM4C123 microcontroller, part of the Texas Instruments Tiva C Series, is a
versatile and widely used microcontroller for embedded systems. It is based on the ARM
Cortex-M4 architecture, making it a powerful yet energy-efficient choice for a wide range of
applications including robotics, IoT, industrial control systems, and automotive applications.
This microcontroller features a 32-bit processor capable of running at speeds up to 80 MHz
and incorporates a floating-point unit (FPU) for efficient mathematical computations. It is
equipped with a variety of peripherals, making it versatile for various embedded applications.
The interfacing process involves connecting the display to the TIVA board's GPIO
(General Purpose Input/Output) pins and writing code to control which segments light up
based on the desired output. Each segment of the SSD corresponds to a specific GPIO pin on
the TIVA board, when programming, a binary representation is used where each bit
corresponds to a segment being on (1) or off (0).
1
Seven- segment display:
A seven-segment display is a widely used electronic display device for representing
decimal numerals and, in some cases, a limited range of alphabetic characters. It's popular in
devices such as digital clocks, calculators, and electronic meters.
Procedure:
Circuit connections:
2
Following are pin configurations:
Microcontroller setup:
Code:
#include <stdint.h>
#include "tm4c123gh6pm.h"
int main(void) {
SYSCTL_RCGCGPIO_R |= 0x20;
GPIO_PORTF_DIR_R = 0xFF;
GPIO_PORTF_DEN_R = 0xFF;
uint8_t numbers[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F};
while(1) {
GPIO_PORTF_DATA_R = numbers[i];
delayMs(1000);
3
}
void delayMs(int n) {
int i, j;
Execution:
Fig 3: Simulation
Practical implementation:
4
Code explanation:
1. #include <stdint.h>
Includes the standard library for fixed-width integer types, such as uint8_t and
int32_t.
Used to ensure portable and efficient code.
2. #include "tm4c123gh6pm.h"
Includes the header file specific to the TM4C123 microcontroller.
This file contains definitions for all registers and macros related to the
microcontroller.
3. GPIO_PORTF_DIR_R = 0xFF
Configures all pins of Port F as output by setting their direction.
0xFF means all 8 bits of the direction register are set to output mode.
4. GPIO_PORTF_DEN_R = 0xFF
Enable the digital function for all pins of Port F.
Without this step, the pins won’t function as digital I/O.
5. delayMs(1000);
Creates a delay of 1000 milliseconds (1 second) between each digit.
This allows each digit to be visible for a second before switching to the next.
Summary:
The code initializes GPIO Port F on the TM4C123 TIVA microcontroller for digital
output and defines binary codes to control a seven-segment display. It uses an array to store
segment patterns for digits 0-9, sending these patterns to the display via Port F pins. A delay
function creates a visible 1-second interval between each digit. The program loops infinitely,
sequentially displaying the digits 0 to 9.
Safety precautions:
Ensure all connections are made properly before powering up the Arduino to avoid
short circuits.
Use resistors in series with seven-segment displays to limit current and prevent
damage.
Conclusion:
In this experiment, we successfully interfaced a seven-segment display with the
TM4C123 TIVA microcontroller. By controlling the GPIO pins, we displayed digits from 0
to 9. This lab not only reinforces understanding of GPIO operations but also provides
practical experience in embedded systems design. Future enhancements could include
implementing more complex displays or integrating user inputs to change displayed values
dynamically. The interfacing of a seven-segment display with the TM4C123 TIVA
Launchpad demonstrates fundamental principles of digital electronics and microcontroller
programming.