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

Pullup Resistors

I am writing a GPIO input object that reads the pinstate of GPIO port 0. I am putting in a feature where the different pull resistor states can be specified. They are done so with an enum type in the header. One problem, the code has no effect. The default state of the pin does not change. I am almost certain the values in the pinmodes are right as I checked them with the debugger. I have a feeling there is something simple I am overlooking.

                switch(GetPullType()) // Connect specified pull resistor.
                {
                        case PULLDOWN:
                                LPC_PINCON->PINMODE0 |= (1 << gPinNumber);
                                LPC_PINCON->PINMODE0 |= (1 << gPinNumber + 1);
                                break;
                        case PULLUP:
                                LPC_PINCON->PINMODE0 &= ~(1 << gPinNumber);
                                LPC_PINCON->PINMODE0 &= ~(1 << gPinNumber + 1);
                                break;
                        default:
                                LPC_PINCON->PINMODE0 &= ~(1 << gPinNumber);
                                LPC_PINCON->PINMODE0 |= (1 << gPinNumber + 1);
                                break;
                }

I checked the inputs with a volt meter. Here is what I read in each mode for any specified pin:

PULLDOWN = 4.3 volts PULLUP = 4.36 volts PULLNONE = 4.35 volts

According to these voltages, the default pullup mode is not changing. I am using the LPC1768 controller with an MCB1700 development board.

Parents Reply Children