Hi all
I'm new here in the forum. And I have a question that I have been struggling with for about 5 Days now and I cant get an explanation.
I'm trying to interface a push button to p0.7 and have a LED on pin p1.16, p1.18, Im working on a LPC2119 board and Keil µ vision with GCC.
Here is part of my code.
This works fine!!!!
if(!(IOPIN0 & (0x00000080))) // When button is pressed => IOPIN0 7 =1;
{
IOCLR1 = (1<<16)|(1<<18);
}
else
{
IOSET1 = (1<<16)|(1<<18);
}
This does not work
if(!(IOPIN0 & (0x00000080))) // When button is pressed => IOPIN0 7 =1;
{
IOSET1 = (1<<16)|(1<<18);
}
else
{
IOCLR1 = (1<<16)|(1<<18);
}
This results in that both LEDs are always on! apparently I can't do a IOSET in my if statement ?!
What am i doing wrong, and what am I not getting