RS232 trouble

hi all…

i have a problem about rs232 serial communication.I connect my device to Arduino Nano on the following pin

RS232 RX ---- in MAX232 out ------ TX ARDUINO
RS232 TX ---- in MAX232 out ------ RX ARDUINO

my device baudrate 9600 8N1.
arduino baudrate 9600 8N1.

I send decimal data from my device to arduino

85 83 44 71 83 44 32 32 32 45 48 46 55 53 44 107 103 13 10

but I don’t receive data like that. i recived a strange data.

44 32 32 85 83 44 71 32 32 45 48 46 55 53 44 107 103 13 10
45 48 46 55 53 44 107 103 13 10 44 32 32 85 83 44 71 53 44
107 103 13 10 44 32 32 85 32 85 83 44 71 32 32 45 48 46 10
13 10 44 32 32 85 83 44 45 48 46 55 53 44 107 48 46 55 53

and then I raise the baud rate to 115200
and i receive data

85 83 44 71 255 83 44 32 32 32 45 48 46 55 53 44 255 107 103 13 10
85 83 44 71 83 44 255 32 32 32 45 48 46 55 255 53 44 107 103 13 10
85 83 44 71 83 44 32 255 32 32 45 48 46 55 53 44 107 103 255 13 10
85 83 44 71 83 44 32 32 32 45 48 255 46 55 53 44 107 255 103 13 10

i get a normal value but there is value 255 from my data

how i fix that.

this my code :

#include <SoftwareSerial.h>
SoftwareSerial in(2,3);

byte input [13]={};

void setup() {
in.begin(115200);
Serial.begin(9600);
}

void loop()
{
if (in.available())
{
for(int i=0;i<12;i++)
{byte inchar = in.read();
input*=inchar;*
_ Serial.print(input*);_
_
}_
_
Serial.println("-");_
_
}_
_
}_
_
[/quote]*_
i need to help thank you very much
terima kasih

SoftwareSerial will not work at 115200 baud. 38400 is about the max and 9600 is much more sensible.

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

When posting code please use the code button
codeButton.png

so your code looks like this

and is easy to copy to a text editor See How to use the Forum

...R

i have a problem about rs232 serial communication.I connect my device to Arduino Nano on the following pin

RS232 RX ---- in MAX232 out ------ TX ARDUINO
RS232 TX ---- in MAX232 out ------ RX ARDUINO

You must connect the GNDs!

pylon:
You must connect the GNDs!

Also shouldn't it look more like this?

RS232 RX ---- out MAX232 in ------ TX ARDUINO
RS232 TX ---- in MAX232 out ------ RX ARDUINO

And don't use pins 0 and 1. What pins are you using?

Paul