GPIO-issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO-issues

251 Views
lpcware
NXP Employee
NXP Employee
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 ;
}
0 Kudos
1 Reply

232 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Jan 29 09:42:52 MST 2014
After

LPC_GPIO0->FIOSET = (1<<17);

this Pin should be high,

after

LPC_GPIO0->FIOCLR = (1<<17);

this Pin should be low.

You can check (or change) this in Peripherals View.

If your LED is lighting or not is a question how you've connected this LED  ;-)

0 Kudos