2024-09-15 15:51:57 +05:30
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "tm4c123gh6pm.h"
|
2024-09-15 15:48:02 +05:30
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2024-09-15 15:51:57 +05:30
|
|
|
SYSCTL_RCGC2_R |= 0x00000020; /* enable clock to GPIOF */
|
|
|
|
GPIO_PORTF_LOCK_R = 0x4C4F434B; /* unlock commit register */
|
|
|
|
GPIO_PORTF_CR_R = 0x1F; /* make PORTF0 configurable */
|
|
|
|
GPIO_PORTF_DEN_R = 0x1E; /* set PORTF pins 4 pin */
|
|
|
|
GPIO_PORTF_DIR_R = 0x0E; /* set PORTF4 pin as input user switch pin */
|
|
|
|
GPIO_PORTF_PUR_R = 0x10; /* PORTF4 is pulled up */
|
|
|
|
|
|
|
|
|
|
|
|
long int x;
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
//TURN ON LED
|
|
|
|
x=0;
|
|
|
|
GPIO_PORTF_DATA_R = 0x02;
|
|
|
|
//WAIT FOR 500ms
|
2024-09-15 16:14:01 +05:30
|
|
|
while(x<6677)
|
2024-09-15 15:51:57 +05:30
|
|
|
x++;
|
|
|
|
|
|
|
|
//TURN OFF LED
|
|
|
|
x=0;
|
|
|
|
GPIO_PORTF_DATA_R = 0x00;
|
|
|
|
//WAIT FOR 500ms
|
2024-09-15 16:14:01 +05:30
|
|
|
while(x<6677)
|
2024-09-15 15:51:57 +05:30
|
|
|
x++;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-09-15 15:48:02 +05:30
|
|
|
}
|