Make my ATmega 328 a stand-alone micro controller?

For my project I wanted to make my 328 a stand alone one.I did not have the 16Mhz crystal, so i connected the ones connected to arduino board's 28DIP microcontroller base(pin 9 and 10).I have powered the board and also took the 5v from the board(without microcontroller) to power up the breadboard microcontroller.I initially had only one microcontroller and I programmed it keeping it on the board.After the program was uploaded, I removed it and put it on breadboard.I have connected even the reset,RX,Tx pins to the board fromy my breadboard.But it wont work.Is it the crystal or any other problem.If I burn its bootloader again selecting its internal 8Mhz crystal, will it work.If yes then how to do it, and what will happen to program which is uploaded in the 328.
Here's my code

#define HighLevel 2
#define LowLevel 4
#define Output 3
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,10,11,12,13);

   
 void setup() {
   pinMode(HighLevel, INPUT_PULLUP);
   pinMode(LowLevel, INPUT_PULLUP);
   pinMode(Output, OUTPUT);
       lcd.begin(16, 2);
   lcd.setCursor(0, 0);
   lcd.print("WELCOME TO");
   lcd.setCursor(0, 1);
   lcd.print("PRATIBA KARANJI");
   delay(5000);
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("PROGRAMMED BY");
   lcd.setCursor(0, 1);
   lcd.print("KATHIR");
   delay(5000);
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("PROJECT DETAILS");
      delay(4200);
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("MICRO CONTROLLER");
   lcd.setCursor(0, 1);
   lcd.print("ATmega 328");
   delay(4000);
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Rs.80");
        delay(3800);
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("LCD DISPLAY");
   lcd.setCursor(0, 1);
   lcd.print("16x2 CHARACTERS");
   delay(4000);
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Rs.90");
      delay(3800);
      lcd.clear();
    lcd.setCursor(0, 0);
   lcd.print("RELAY");
   lcd.setCursor(0, 1);
   lcd.print("10 Amp - DPDT");
   delay(4000);  
    lcd.clear();
    lcd.setCursor(0, 0);
   lcd.print("Rs.100");
    delay(3800);
   lcd.clear();
    lcd.setCursor(0, 0);
   lcd.print("EXTRAS");
   lcd.setCursor(0, 1);
   lcd.print("Wires, etc...");
   delay(4000);
 lcd.clear();
    lcd.setCursor(0, 0);
   lcd.print("Rs.35");
      delay(3800);
  lcd.clear();
    lcd.setCursor(0, 0);
   lcd.print("TOTAL COST");
   lcd.setCursor(0, 1);
   lcd.print("OF PROJECT");
   delay(4000); 
 lcd.clear();
    lcd.setCursor(0, 0);
   lcd.print("80+90+100+35");
   lcd.setCursor(0, 1);
   lcd.print("Rs.305");
   delay(5000);     
   
   
 }
   
 void loop() {
int Hval = digitalRead(HighLevel);
int Lval = digitalRead(LowLevel);


if (Lval == LOW && Hval == HIGH) {
 digitalWrite(Output, HIGH);
   lcd.setCursor(0, 1);
  lcd.print("PUMP STATUS- ON");
  
}
else if (Lval == LOW && Hval == LOW) {
  digitalWrite(Output, LOW);
    lcd.setCursor(0, 1);
  lcd.print("PUMP STATUS-OFF");
}
else if (Lval == HIGH && Hval == HIGH) {
  digitalWrite(Output , HIGH);
    lcd.setCursor(0, 1);
  lcd.print("PUMP STATUS- ON");
}
 if (Lval == HIGH && Hval == HIGH) {
   lcd.setCursor(0, 0);
  lcd.print("WATER LEVEL- MIN");
 }
 else if (Lval == LOW ) {
    lcd.setCursor(0, 0);
  lcd.print("WATER LEVEL-HIGH");
 }
 else if (Hval == LOW ) {
   lcd.setCursor(0, 0);
  lcd.print("WATER LEVEL- LOW");
 }
 }

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Just to be certain I'm understanding. You originally had an Arduino that you've programmed with the above sketch, and now you've pulled the ATMega328 from the socket and are trying to get it to run on a breadboard as a standalone?

If so, does it run okay if you put the uC back into the socket on the Arduino? If that works, your problem is possibly the clock source as you suggest, but without seeing your circuit it's too soon to rule out other factors.

There are many good tutorials for creating a bare bones board - like this one from Nick Gammon to cross reference your circuit from.

It is possible for you to put a bootloader on the ATMega that doesn't require the external clock source. Were you thinking of doing that, or was the plan to ultimately source a crystal from somewhere for this?

Geoff

If I insert it into my arduino board and burn bootloader with internal crystal 8Mhz, will the program presently in it be deleted?, or will the program(the above program) run properly?, or What will happen?

InduinoX:
If I insert it into my arduino board and burn bootloader with internal crystal 8Mhz, will the program presently in it be deleted?

Yes.

If I program it again, will my program work properly?

InduinoX:
If I program it again, will my program work properly?

Yes.

Then what's the use of an external 16mhz if an internal 8mhz would do by itself?

InduinoX:
Then what's the use of an external 16mhz if an internal 8mhz would do by itself?

A microprocessor that runs at up to 16MIPS, instead of 8MIPS.

If your sketch is light load then maybe 8Mhz is fine for you. Maybe even lower, in which case there are power savings that can be made, since requirements are lower at lower speeds. You could go as far down as 1Mhz.

There's quite a few pages in the datasheet dedicated to this. One of the notes also states that the internal clock isn't as accurate as an external crystal, so the timer functions on your Arduino will drift away more from the real world time.

InduinoX:
Then what's the use of an external 16mhz if an internal 8mhz would do by itself?

The internal 8MHz isn't very accurate. It might be 7.9 or 8.1 depending on temperature and voltage.

It's good enough to run programs but if you need accurate timing or high speed serial communications (for example) then it isn't enough.