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
  • Thanks, I was using the wrong formula all along! Still, there are only pulldown resistors work for P0.0 through P0.3. Is this because they have I2C on them as well as the A to D? I cannot seem to find where it says this in the manual. Probably just a footnote somewhere. Where does it say this so I can compensate in my program?

    Thanks,
    Ben

Reply
  • Thanks, I was using the wrong formula all along! Still, there are only pulldown resistors work for P0.0 through P0.3. Is this because they have I2C on them as well as the A to D? I cannot seem to find where it says this in the manual. Probably just a footnote somewhere. Where does it say this so I can compensate in my program?

    Thanks,
    Ben

Children