This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Output of an LED set using a pull-up resistor

I just started working with the NXP LPC1768 in class and I'm struggling to understand how the internal pullup/down resistors are utilized. We have a program that changes the status(on/off) of one of the LEDs at the push of a button. My question is why does the following line of code cause the LED to light up:

LPC_PINCON->PINMODE3 = LPC_PINCON->PINMODE3 & 0xFFFFFFCF;
LPC_GPIO1->FIOSET |= (1<<18);

When the program starts, the LED is on. However, since this pin is set to pull up, I expected it to be off. If setting the 18th bit to 1 is equivalent to closing the switch, then that means that this line:

LPC_GPIO1->FIOSET |= (1<<18);

would cause the current to flow to ground, turning the LED off. I must be misunderstanding something, since the LED is obviously on with the current code. Any insights?

Parents Reply Children