trouble with arduino standalone circuit and xbee

I have an application that sends data from 1 XBee connected to a computer to another Xbee connected to a microprocessor(ATMEGA328P-PU). I programmed the program into the microprocessor using a arduino board and everything work as programmed on the board itself. However, when brought over to connect everything on the breadboard, it is not working as programmed. I tried loading the microprocessor with a simple blink led program and it works on the breadboard. What is wrong?

What I've connected to the microprocessor on the breadboard: pull up resistor between pin 1 and vcc DataOut and DataIn to rx and tx of microprocessor VCC to pin 7,20 and 21. Gnd to 8 and 22 20Mhz crystal with 2 22pF capacitors to pin 9 and 10.

I've tested communication between the 2 xbees using x-ctu and they are communicating properly.

Thanks in advance for your help!

Why the change from 16 MHZ to 20 MHz? That will change the data rate between devices.

That is because I do not have access to 16Mhz crystal as the supplier does not have stock and i have a 20Mhz crystal on hand right now. Could it be because of the crystals that i am unable to run the program as per normal ( as in on the arduino board). Thanks for your reply!

Well, if one side is sending at 9600 * 20/16, or 12000, and the other side is receiving at 9600, then that could be a problem.

Thanks a lot for your help. My transmitting side is transmitting at 9600 baud rate and my receiving side is the xbee with the 20Mhz crystal. I've change my program from serial.begin(9600) to 7680 ( 9600 x 16 / 20) and it seems to work. Is there however any hidden issue with me changing the value to 7680. Once again thank you for your help!

If you haven't set the 20Mhz MCU up properly then everything will be running 25% faster; all your timers etc, which will affect PWM, millis(), micros() etc. You'll end up with other problems of a similar nature.

To save any other issues you should either get yourself a 16Mhz crystal or configure the MCU properly to run at 20Mhz so all the dividers are set properly and correct timing is restored.

If your sketch is using any kind of timing at the moment then every 1ms you expect is only going to be about 0.8ms really.

The only issue would be the timing issue? I'm not going to use anything regarding time except for delay() and I dont really need it to delay for exactly 1 second for example. I'm going to source for the 16Mhz crystal soon. Thanks for all your help.