lpcware

GPIO-issues

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by monem on Wed Jan 29 09:06:25 MST 2014
Hello everyone,
after study th GPIO-Chapter in User Manual, i have started to write my first Blinky-Program on LPCXpresso 1769. At first i was glad when i saw the LED Blinking, but on the secund view, when i observe the Debuger. It shew me, that after steping over the "LPC_GPIO0->FIOCLR = (1<<17);"  the led ist still ligting, and otherwise when i step over "LPC_GPIO0->FIOSET = (1<<17);" the led turns of; so that the Program works conversely!! which is not comprehensible for a beginner like me. Can anyone please explain this behavior. (the code below shows my Program from main line).
Thanks in advance

int main(void)
{

// TODO: insert code here

unsigned int i;

LPC_GPIO0->FIODIR= (1<<17);
LPC_GPIO0->FIOCLR = (1<<17);
LPC_GPIO0->FIOSET = (1<<17);
// Enter an infinite loop, just incrementing a counter
while(1)
{
LPC_GPIO0->FIOSET = (1<<17);;
for(i=0; i<10000000; i++);

LPC_GPIO0->FIOCLR = (1<<17);;
for(i=0; i<10000000; i++);
}

return 0 ;
}

Outcomes