Go Down

Topic: Serial Port Progrmming (Read 225 times) previous topic - next topic

alikapatibabu

Hello,

I am trying to user Serial port 1 in Ardunio Mega 2560, I have referred example in following link with small modifications. But i could not see any data other end (Connected to PC Tera term) of the serial port.

https://www.arduino.cc/en/Tutorial/MultiSerialMega


Simple Code


void setup() {

   Serial1.begin(9600);
   delay(100);

}

void loop() {
   Serial1.print("Hello");
   delay(1000);
}

Thank You
Babu a


PaulS

Quote
But i could not see any data other end (Connected to PC Tera term) of the serial port.
Connected how? The Serial1 port is not connected to the USB cable.
The art of getting good answers lies in asking good questions.

alikapatibabu

Connected how? The Serial1 port is not connected to the USB cable.
Host machine connected over USB-Serial Converter with common ground. Typical Block Diagram attached.

sterretje

You connected to RX and TX on the Arduino; you need to connect to RX1 and TX1.

You might have done that correctly but it does not show and hence typical diagram does not work; make an exact drawing with the USB-Serial in there.

Is it a USB-to-TTL or USB-to-RS232? Please provide link to the specs of the USB-Serial.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

alikapatibabu

You connected to RX and TX on the Arduino; you need to connect to RX1 and TX1.

It was type mistake, Actually connected to RX1 and TX1

You might have done that correctly but it does not show and hence typical diagram does not work; make an exact drawing with the USB-Serial in there.

Is it a USB-to-TTL or USB-to-RS232? Please provide link to the specs of the USB-Serial.
It is USB-RS232,

USB-Serial converter details:
http://www.bafo.com/index.php/products/adapter/usb-cable-adapter/bf-812-usb-to-serial-adapter-db9.html


Regards
Babu A

sterretje

You can not directly connect RS232 levels to an Arduino.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

alikapatibabu

You can not directly connect RS232 levels to an Arduino.
If not, how should i connect ..?

sterretje

#7
Sep 19, 2018, 04:46 pm Last Edit: Sep 19, 2018, 04:46 pm by sterretje
With your current setup, use e.g. a MAX232 to convert the RS232 signals back to TTL levels.

Or get a USB-to-TTL cable instead of USB-to-RS232.



Note1:
RS232 uses -3 to -18V for a logic one and +3 to +18V for a logic zero; usual levels probably -12V and +12V

Note2:
From note 1, you might have damaged your mega RX1 pin; it does not really like negative signals nor can it handle voltages above 5V. You will have to test it and actually have to test the complete Mega.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

alikapatibabu

With your current setup, use e.g. a MAX232 to convert the RS232 signals back to TTL levels.

Or get a USB-to-TTL cable instead of USB-to-RS232.



Note1:
RS232 uses -3 to -18V for a logic one and +3 to +18V for a logic zero; usual levels probably -12V and +12V

Note2:
From note 1, you might have damaged your mega RX1 pin; it does not really like negative signals nor can it handle voltages above 5V. You will have to test it and actually have to test the complete Mega.

Thank You very much for detailed information..
I will verify the Mega and buy the USB-TTL converter.

Thank You
Babu A

Go Up