EE445M RTOS
Taken at the University of Texas Spring 2015
blinky.c
Go to the documentation of this file.
1 /* -*- mode: c; c-basic-offset: 4; -*- */
2 //*****************************************************************************
3 //
4 // blinky.c - Simple example to blink the on-board LED.
5 //
6 // Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved.
7 // Software License Agreement
8 //
9 // Texas Instruments (TI) is supplying this software for use solely and
10 // exclusively on TI's microcontroller products. The software is owned by
11 // TI and/or its suppliers, and is protected under applicable copyright
12 // laws. You may not combine this software with "viral" open-source
13 // software in order to form a larger program.
14 //
15 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
16 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
17 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
19 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
20 // DAMAGES, FOR ANY REASON WHATSOEVER.
21 //
22 // This is part of revision 2.1.0.12573 of the EK-TM4C123GXL Firmware Package.
23 //
24 //*****************************************************************************
25 
26 #include <stdint.h>
27 #include "inc/tm4c123gh6pm.h"
28 
29 //*****************************************************************************
30 //
36 //
37 //*****************************************************************************
38 
39 //*****************************************************************************
40 //
41 // Blink the on-board LED.
42 //
43 //*****************************************************************************
44 int
45 main(void)
46 {
47  volatile uint32_t ui32Loop;
48 
49  //
50  // Enable the GPIO port that is used for the on-board LED.
51  //
53 
54  //
55  // Do a dummy read to insert a few cycles after enabling the peripheral.
56  //
57  ui32Loop = SYSCTL_RCGC2_R;
58 
59  //
60  // Enable the GPIO pin for the LED (PF3). Set the direction as output, and
61  // enable the GPIO pin for digital function.
62  //
63  GPIO_PORTF_DIR_R = 0x08;
64  GPIO_PORTF_DEN_R = 0x08;
65 
66  //
67  // Loop forever.
68  //
69  while(1)
70  {
71  //
72  // Turn on the LED.
73  //
74  GPIO_PORTF_DATA_R |= 0x08;
75 
76  //
77  // Delay for a bit.
78  //
79  for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
80  {
81  }
82 
83  //
84  // Turn off the LED.
85  //
86  GPIO_PORTF_DATA_R &= ~(0x08);
87 
88  //
89  // Delay for a bit.
90  //
91  for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
92  {
93  }
94  }
95 }
#define GPIO_PORTF_DEN_R
Definition: tm4c123fe6pm.h:720
#define GPIO_PORTF_DATA_R
Definition: tm4c123fe6pm.h:703
int main(void)
Definition: blinky.c:45
#define SYSCTL_RCGC2_GPIOF
Definition: hw_sysctl.h:1319
#define SYSCTL_RCGC2_R
#define GPIO_PORTF_DIR_R
Definition: tm4c123fe6pm.h:704