This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FG4618 experimenters board; problem with P2IN

Other Parts Discussed in Thread: MSP430FG4618

I am MSP430FG4618 Experimenters board for my project. I am using keypad to port 2 which has interrupt capability. columns of keypad are declared as inputs and rows as outputs. By polling continuously, the pressed key is determined.  This code is working fine when used as a single program. But the same code when used as a part of the other program it is not working as expected. The problem is with P2IN. The following is the port declaration


                           P2DIR=0XF0; // OUTPUT P2.7 TO 2.4 AND INPUT P2.3 TO P2.0
                           P2OUT=0X00;
                           P2OUT|=0XF0;
                           P2IES |= 0XF0; // FLAG IS SET WITH LOW TO HIGH TRANSITION
                           P2IE |= 0X0F; // INTERRUPTS FOR INPUTS ARE ENABLED     

By the end of this block, i expect P2IN = 0xF0; so that when I press a key the lower nibble changes indicating the interrupt. But this is not happening. It randomly shows P2IN = 0xF8; or P2IN = 0xF1; or something else.

How do I proceed further?Please help.

Regards

Mythreyi   
                           

  • If the input pins are open (no button pressed) , they are high impedance inputs. You're catching radio waves then.

    You need to attach external pullup resistors. So if no key is pressed, the input will be pulled high instead of floating.

    Other MSPs, like the 5x sereis, have optional internal pullups which you can enable if you need them. The FG4618 doesn't and requires external ones to define the state of an 'open' pin.

**Attention** This is a public forum