0% found this document useful (0 votes)
14 views1 page

GPIO Blinking LED Example Code

The document is a C program for a microcontroller that sets up GPIO pins on port F for output. It continuously toggles the state of the pins with a delay, doubling the pin data value each cycle until it reaches 8, at which point it resets to 2. The program uses system control functions to configure the clock and enable the GPIO peripheral.

Uploaded by

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

GPIO Blinking LED Example Code

The document is a C program for a microcontroller that sets up GPIO pins on port F for output. It continuously toggles the state of the pins with a delay, doubling the pin data value each cycle until it reaches 8, at which point it resets to 2. The program uses system control functions to configure the clock and enable the GPIO peripheral.

Uploaded by

eternal misery
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <stdint.

h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"

uint8_t ui8PinData=2;

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

while(1)
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,
ui8PinData);
SysCtlDelay(2000000);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x00);
SysCtlDelay(2000000);
if(ui8PinData==8) {ui8PinData=2;} else {ui8PinData=ui8PinData*2;}
}
}

You might also like