From 9c85be0a823b38b47d5b30b651b8e68da1be25f1 Mon Sep 17 00:00:00 2001 From: Vikram Rajput Date: Sun, 15 Sep 2024 15:51:57 +0530 Subject: [PATCH] Updated code --- main.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 75eb45b..8b5686e 100644 --- a/main.c +++ b/main.c @@ -1,9 +1,35 @@ +#include +#include +#include "tm4c123gh6pm.h" - -/** - * main.c - */ int main(void) { - return 0; + 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 + while(x<667750) + x++; + + //TURN OFF LED + x=0; + GPIO_PORTF_DATA_R = 0x00; + //WAIT FOR 500ms + while(x<667750) + x++; + + + } }