About
#include "TM4C123GH6PM.h"
unsigned int value;
void delayMs(int n)
{
int i, j;
for(i = 0 ; i < n; i++)
for(j = 0; j < 3180; j++)
{} /* do nothing for 1 ms */
}
int main(void)
{
RCGCGPIO |= 0x20;
//or SYSCTL->RCGCPIO |= 0x20;
GPIOF ->DIR = 0x0E;
GPIOF ->DEN = 0x1E; /* and PORTF4 as input, SW1 is on PORTF4 */
/* set PORTF pins 4-3 as digital pins */
GPIOF->PUR = 0x10; /* enable pull up for pin 4 */
while(1)
{
value = GPIOF->DATA; /* read data from PORTF */
if(!value){
GPIOF->DATA = 0x02;
delay(500);
GPIOF->DATA = 0x08;
delay(500);
GPIOF->DATA = 0x04;
delay(500);
GPIOF->DATA = 0x00;
delay(500);
GPIOF->DATA = 0x04;
delay(500);
GPIOF->DATA = 0x08;
delay(500);
GPIOF->DATA = 0x02;
delay(500);
GPIOF->DATA = 0x00;
delay(500);
}
}
}
void SystemInit(void)
{
SCB->CPACR |= 0x00F00000;
}