not working atmega328p-pu as a reciever

i use a atmega328p-pu as a reciever which burned by arduino uno.but it is nor working as a reciever. i mean it does the its other duties but reciever orders is not done. if i use the arduino instead of atmega, arduino does reciever orders. so what my problem could be?
reciever code

#include <VirtualWire.h>
void setup()
{
    vw_set_ptt_inverted(true); 
    vw_set_rx_pin(8);
    vw_setup(4000);  // Bits per sec
    pinMode(4, OUTPUT);
    vw_rx_start();       // Start the receiver PLL running
}
    void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;
    digitalWrite(9,HIGH);
    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
      if(buf[0]=='1'){
    digitalWrite(4,HIGH);
      }  
   if(buf[0]=='0'){
  digitalWrite(4,LOW);
    }

}
}

The ATmega328P needs a 16 MHz resonator (or crystal with loading capacitors), a 5V regulated power supply, and a pull-up on Reset to act as an Arduino. How is it wired? How did you program it?

i think all wires are correct because the led which on the 9th pin light. i programmed with arduino bootloader.
thank you

i try to use arduino's 328p-pu as a reciever but it did not work. so i think arduino has a part what i have to use if i want to 328p-pu as a reciever except crystal and capacitors. what it could be?

recokko:
i try to use arduino's 328p-pu as a reciever but it did not work. so i think arduino has a part what i have to use if i want to 328p-pu as a reciever except crystal and capacitors. what it could be?

Do you have a pull-up resistor on Reset? Do you have all of the Vcc and Gnd pins connected? Do you have AVcc connected?

I asked "How is it wired?" and you never provided an answer.

i wired 328p-pu's pin 7 and 20 to 5v, 8 and 22 to ground,9 and 10 to 16 mhz crystal then the cristal to 22 pf capacitors.
thank you

recokko:
i wired 328p-pu's pin 7 and 20 to 5v, 8 and 22 to ground,9 and 10 to 16 mhz crystal then the cristal to 22 pf capacitors.
thank you

So even after I have mentioned it TWICE you have not installed a pull-up resistor on pin 1 (Reset)?!?

How are the two capacitors connected? One should be between pin 9 and Ground and the other between pin 10 and ground.

And you don't have Pin 9 (PB1/pin 15) or Pin 4 (PD4/pin 6) connected to anything?

And your radio receiver is not connected?!? Shouldn't that got to PB3 (pin 17)?

If you don't want to bother answering in full you will have trouble getting accurate results.

you have not installed a pull-up resistor on pin 1 (Reset)?!?

no i have not installes. should i have to do it?

How are the two capacitors connected?

both capacitors between crystal and ground.

And you don't have Pin 9 (PB1/pin 15) or Pin 4 (PD4/pin 6) connected to anything?

i dont have any connection.

And your radio receiver is not connected?!?

i tested with a wire. if it passes test, i will use radio reciever.
sorry for my messages. thank you