Sammy, when using buttons, the OUT-register is used in combination with the REN-register to set a pull-up/down-resistor. Can you show your complete code? S1 is on P1.2, S2 on P2.6 - both have no external resistor, so they both need a software set one inside the microcontroller. Since both switches short the pin to GND, you will use a pull-up resistor by setting P1OUT |= 0x04; // P1.2 resistor pulls-up P1REN |= 0x04; // P1.2 enable resistor and P2OUT |= 0x40; // P2.6 resistor pulls-up P2REN |= 0x40; // P2.6 enable resistor Dennis
↧