Problem with serial communication using arduino

Hello,
I am quite new to arduino, Currently i am using Arduino Uno board.I am trying to access RX and TX pins in the Arduino board, i tried to send a character using the serial monitor and the serial monitor shows the character that we exactly sends to it. But when take access of TX and connect it to pc using usb ,it shows completely different one.My program is attached along with this mail . Please help me to sort out this issue.
send recieved (TX)
a O
b '
c N
d null
e M
f &
g L

sketch_mar06a.ino (231 Bytes)

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

And, please include short programs directly in your Post like this so that people don't have to download your file

void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  while(Serial.available()==0);

   char c=Serial.read();
   Serial.write(c);
   

}

...R

thanks for your prompt replay...
Actually it works perfectly while using arduino serial monitor. The problem happens while communicating using RX and TX (0 & 1) pins with pc.

The problem happens while communicating using RX and TX (0 & 1) pins with pc.

You are using the RX and TX (0 & 1) pins to communicate with the PC when using serial monitor (through USB).

How is the problem connection different?

Are you using a USB-to-RS232 adapter?

RS232 uses different voltages to TTL Serial. You need an adapter such as a MAX232 chip to convert the voltages on pin 0 and 1.

You might even damage the Arduino without the MAX232.

richucj:
The problem happens while communicating using RX and TX (0 & 1) pins with pc.

The real problem is that you have not provided enough information about what you are doing.

...R