0% found this document useful (0 votes)
56 views5 pages

TM4C123 TIVA Kit With Seven Segment Display

micro processor lab

Uploaded by

Akmal Arslan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views5 pages

TM4C123 TIVA Kit With Seven Segment Display

micro processor lab

Uploaded by

Akmal Arslan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment 10

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.

Fig 1: TM4C123 microcontroller

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).

The Tiva C Series TM4C123G LaunchPad (EK-TM4C123GXL) serves as a low-cost


evaluation platform for the TM4C123GH6PM microcontroller. It provides an accessible
entry point for developers and students looking to explore ARM-based microcontroller
programming, along with expansion headers for additional functionality.

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.

 A seven-segment display is made up of seven individual segments (labeled as a, b, c,


d, e, f, and g) arranged in the shape of an "8."
 An optional decimal point is often included to represent fractional values.
 Each segment is an LED, and by lighting the appropriate combination of these LEDs,
different characters or numbers can be formed.

Types of seven-segment displays:

1. Common cathode (CC):


 All cathodes of the LEDs are connected together and grounded.
 A HIGH signal is applied to the anodes of the desired segments to light them up.
2. Common anode (CA):
 All anodes are connected together and connected to a positive supply voltage.
 A LOW signal is applied to the cathodes of the desired segments to light them up.

Fig 2: Seven-segment display

By interfacing a microcontroller (like TM4C123) with a seven-segment display, you


can control which digits are displayed dynamically. This is achieved by programming the
microcontroller to send the correct signals to the display's pins.

Procedure:
Circuit connections:

1. Identify the type of seven-segment display (common anode or cathode).


2. Connect the common pin (cathode or anode) of the display to GND or VCC,
respectively.
3. Connect each segment pin (a-g) to a GPIO pin on the TIVA kit through a 330Ω
resistor.
4. Use jumper wires to make connections on a breadboard.

2
Following are pin configurations:

 Connect pin A of the SSD to PB0 on the TIVA board.


 Connect pin B to PB1.
 Connect pin C to PB2.
 Connect pin D to PB3.
 Connect pin E to PB4.
 Connect pin F to PB5.
 Connect pin G to PB6.
 Connect the common pin of the SSD to 3.3V from the TIVA board.

Microcontroller setup:

1. Install Code Composer Studio and set up the TivaWare library.


2. Configure the GPIO pins used for the seven-segment display as digital outputs.
Programming steps:

1. Initialize the GPIO pins for digital output.


2. Define an array for segment codes corresponding to digits 0-9 (for common cathode
or anode).
3. Write a loop to iterate through the numbers and display each digit on the seven-
segment display by outputting the segment codes to the GPIO pins.

Code:
#include <stdint.h>

#include "tm4c123gh6pm.h"

void delayMs(int n);

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) {

for(int i = 0; i < 10; i++) {

GPIO_PORTF_DATA_R = numbers[i];

delayMs(1000);

3
}

void delayMs(int n) {

int i, j;

for(i = 0; i < n; i++) {

for(j = 0; j < 3180; j++) {}

Execution:

1. Upload the code to the TIVA microcontroller using software.


2. Observe the seven-segment display showing digits sequentially from 0 to 9.
Simulation:

Fig 3: Simulation

Practical implementation:

Fig 4: 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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy