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