Go Down

Topic: Help on serial port (Read 700 times) previous topic - next topic

Krizza

Hello

I have a depth sounder that is sending every 1 second a ASCII sentence on serial cable.
The sentence look like this: 1 0.00 0 0 0 10.1 0 0

On my mega 2560 arduino board i have a RS232 Shifter connected on pins 14, 15, 5v and GND with the following code uploaded and i try to get the data from the sounder and display it on screen but i'm not geting any data displayed even if the sounder is sending data.

Any advice is welcome, thank you.

void setup()
{
  Serial.begin(9600);
  Serial3.begin(4800);
}

void loop()
{
  serialEvent();


void serialEvent()
{
  while (Serial3.available())
  {
    Serial.println("Data incoming!");
    Serial.println(Serial3.read());
  }
}


Riva

Does the sounder use hardware flow control?

What RS232 level shifter are you using?

Sure you have the RX/TX pins the right way round?
Don't PM me for help as I will ignore it.

Krizza

I use the right RX/TX pins but i also switch them just to be sure... not working.
RS232 shifter is this one: https://www.sparkfun.com/products/449
Regarding the flow control... i have no ideea. The sounder is a Ohmex Sonarmite BTX
http://www.ohmex.com/sonarmitev4.html

Thank you.

Riva

Trying to find information on ther serial spec was not easy but it is 4800,8N1 with no flow control.

Try a slightly different sketch an see if it works. You will need to alter the serial monitor baud rate to 4800
Code: [Select]
void setup(){
  Serial.begin(4800);
  Serial3.begin(4800);
  delay(1000);
  Serial.println("Setup Complete.");
}

void loop(){
  while (Serial3.available()){
    Serial.write(Serial3.read());
    delay(1);
  }
  while (Serial.available()){
    Serial3.write(Serial.read());
    delay(1);
  }
}

Don't PM me for help as I will ignore it.

Krizza

Ok with this new sketch i'm getting this:

Setup Complete.
/¨H@ЅЄÿgÊA =Õ€ø/A ~ô€€ÿ_~Bñ€€ž/²"  ЀިA~@
ÓÑ€ðÐЀT
P Ë@PPЂÀ€÷ !ˆ¢@/ÒÀ€õ_/' ñ€€Þ~°BÀ@  ü71€    ø/A ä~ô€€ÿ_~Bñ€€ž EÇÔ€ÿ=Ý R€…Àÿ71€ @Ò€WøJí€
~ Ê€ÿ/Ý R¾P€ýZí 
¼ˆ€ÐÿDÐÑCà   ü


Riva

Are you sure the device is set for 4800 baud rate as this looks like either a baud rate mismatch or an inverted serial signal.

Try with different baud rates and see if it comes good.
Don't PM me for help as I will ignore it.

Go Up