Conflict while using Software Serial and LCD

I am trying to communicate with arduino, xbee s1 and matlab. I used software serial of arduino to communicate with xbee and it was successful. And i was also able to communicate with matlab as well. But the issue if i try to include LCD in my code, i will not be able to send signal from arduino to matlab again. Here is the code

// We’ll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
SoftwareSerial XBee(10, 11); // RX, TX
LiquidCrystal lcd(8,9 , 4, 5, 6, 7);
void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
// lcd.begin(16, 2);
//lcd.print("–Vision Based----");
//lcd.setCursor(0,2);
delay(10);
//lcd.print(“Barcode Detector”);
XBee.begin(9600);
Serial.begin(9600);
}

void loop()
{

if (Serial.available())
{ // If data comes in from serial monitor, send it out to XBee
XBee.write(Serial.read());
}
if (XBee.available())
{ // If data comes in from XBee, send it out to serial monitor
delay(10);
Serial.write(XBee.read());
}
}

Where do you create an instance of the SoftwareSerial class?

Where do you declare your XBee? Your code does not compile.

PaulS: Where do you create an instance of the SoftwareSerial class?

Pls kindly check the code back. Thanks

sterretje: Where do you declare your XBee? Your code does not compile.

Pls kindly check the code back. Thanks

Pls kindly check the code back. Thanks

No. You changed the code in the first post, making those that commented on it look like idiots. Fix the problem yourself.

PaulS: No. You changed the code in the first post, making those that commented on it look like idiots. Fix the problem yourself.

You got it wrong, what i meant was that i have corrected the code i posted.I am sorry for the way you see it. And you dont have to get annoy helping others. It is the only thing that gives me joy

You got it wrong

No. YOU got it wrong. You do NOT replace code that other have commented on. You post the corrected code in a new post.

Do not connect the LCD but keep it included in the code (and don't comment it out); does it work? If yes, you might have a power problem.

I don't have a XBee but feeding the hardware RX into the software RX (simulating data received from XBee with data send from the serial monitor) works.

  if (XBee.available() > 0)
  {
    Serial.write(XBee.read());
  }

You have a 16x2 LCD; why do you try to write to the third line?

I can't help you further due to lack knowledge of the XBee and lack of a XBee.

PS please post code between code tags ([code] and [/code])