i.e i checked using run-time debug, it successfully transmits the char and then wait for the skps to receive response.
Anu idea how this issue can be resolved. Below is the code :
- CODE: SELECT_ALL_CODE
char a='d'; //check char
int main()
{
clk();
config();
INIT_UART2();
while(1)
{
if(GET_PS2(p_left)==0)
{
a='g';
while(1);
}
}
/////
void TRANSMIT_C2(unsigned char value)
{
while(!U2STAbits.TRMT);
U2TXREG = value;
__delay32(100); //Little Delay
while(!U2STAbits.TRMT);
_U2RXIF=0;
__delay32(100); //Little Delay
}
/////// stucks in this function /////
unsigned char GET_C2(void)
{
__delay32(100); //Little Delay
while (_U2RXIF==0); // Wait and Receive One Character /// Here in this loop
_U2RXIF=0;
return U2RXREG;
__delay32(100); //Little Delay
}
unsigned char GET_PS2(unsigned char value)
{
TRANSMIT_C2(value);
return GET_C2();
}
Thanks