You are on page 1of 3

Embedded System Lab Manual

Experiment 1
To Blink an LED with TIVA GPIO
INTRODUCTION:
To blink the GREEN on-board LED (PF3) using C Language.
Objective:-
The main objective of this experiment is to blink the Green on-board using GPIO. This
experiment will help you to learn and understand the procedure for basic programming the
TM4C123GH6PM LaunchPad digital I/O pins.
Component Requirements:-
Software Requirement -
1. Code Composer Studio,
Hardware Requirement -
1. TM4C123GH6PM Launch-Pad
2. USB cable
Hardware Connection:
Embedded System Lab Manual

Flowchart:-

Figure: Flowchart to Blink the LED Using TIVA GPIO

C Program Code to Blink the LED with GPIO


#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
Embedded System Lab Manual

int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_
OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,
GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x08);
SysCtlDelay(20000000);
while(1) {
}
}

Result:-
In this experiment, we have learnt to configure and program the digital I/O pins of
TM4C123GH6PM and have successfully programmed to blink the on-board green LED of
TM4C123GH6PM LaunchPad.

You might also like