Xbee and 16F690 (pic) does not communicate on USART

Hi all, I linked a xbee 802.15.4 (series 1) to a PIC16F690 trying to get them communicate over USART.

I am using this mikroC code:

char buff = 0;

void main(){

  ANSEL = 0;
  ANSELH = 0;

UART1_Init(9600); // init USART
Delay_ms(100);


while (1) {                    // Endless loop
   if (UART1_Data_Ready())

   {     // If data is received,
     buff = UART1_Read();     //   read the received data,
     UART1_Write((char)'K');       //   and send data via UART
   }
   
   }
}

and I adapted from 5V (pic supply) to 3.3V (xbee supply) the voltage from pic’s tx to xbee’s rx port. Do I have to adapt from xbee’s tx to pic’s rx too?

This is the scheme of my circuit:



Another thing that may help: the xbee is working fine linked to another… they can exchange info between them without problems.

The pic is working well with the USART configuration (tested with a USART terminal and it’s responding).

The problem is pic and xbee won’t communicate. Pic can’t even see when data is ready on the xbee. Am I missing something?

Problem solved, it was the TX voltage level of the Xbee to be brought at 5V!

Thanks for posting the solution - it’s always helpful when people can do that. I’ve now added a brief section in the cookbook on this topic, which will appear when I next publish the cookbook.