RS232 value reading Arduino mega

thanks so much, i rejigged the pin 2 and 3 on the rs232 and switched from an arduino mega to uno and used a code i got from another post which you also contributed to this post, and it just worked. here is my results.


But i still wonder why does my mega dont work? i have checked with an serial moniter on my pc and its getting no results at all.

void setup()
{
  Serial.begin(9600);     // USB Serial monitor
  Serial1.begin(9600);    // Serial1: TX1/RX1 (pins depend on your board)
}

void setup()
{
  Serial.begin(9600);                       // USB Serial Monitor
  Serial1.begin(9600, SERIAL_8N2);          // Serial1 with 8N2
}

void loop()
{
  if (Serial1.available())
  {
    char x = Serial1.read();
    Serial.print(x);                        // Echo to Serial Monitor
  }
}