This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LED blinks on PF2 until the switch SW1 is pressed

Hi I am trying to write a code where the blue LED will blink unless i press the SW1.

TExaS_Init(SW_PIN_PF4, LED_PIN_PF2);

GPIO_PORTF_AMSEL_R=~0X14//DISABLE ANALOG PF2,PF4
GPIO_PORTF_PCTL_R=~0X000F0F00//CLEAR PF2,PF4 BIT FIELDS IN PCTL
GPIO_PORTF_AFSEL_R=~0X14//ALTERNATE FUNCITON OFF PF2,PF4
GPIO_PORTF_DEN_R=0X14//DIGITAL ENABLED PF2,PF4
GPIO_PORTF_PUR_R=0X10//PUR ON PF4
GPIO_PORTF_DATA_R=0X04//LED ON

Delay100ms(100);//DELAY FOR 100 MS
If(SW_PIN_PF4==1){//Read the switch and test if the switch is pressed
while(1){
GPIO_PORTF_DATA_R^0x04

}
}

void Delay100ms(unsigned long time){
unsigned long i;
while(time > 0){
i = 1333333; // this number means 100ms
while(i > 0){
i = i - 1;
}
time = time - 1; // decrements every 100 ms
}
}

Am  i doing anything wrong? It's not showing the desired output

Thanks

Thanks

Nabila