Arduino communication with a device on RS-232 protocol

Here's what I've been using as test code to read the startup message the device provides.

#include <AltSoftSerial.h>

static const uint8_t RS_RX = 9; // UNO reads here  (to MAX3232 RXD)
static const uint8_t RS_TX = 8; // UNO writes here (to MAX3232 TXD)
AltSoftSerial inst(RS_RX, RS_TX); // RX, TX

void setup() {
  Serial.begin(9600);        // USB debug
  inst.begin(9600);            // set to delay line's baud
  delay(200);

  Serial.println("Probing delayline...");
  inst.listen();

  inst.write("Q?\r\n");
  delay(200);

  while (inst.available()) {
    Serial.write(inst.read());
  }
}

void loop() { }

So you know that your Arduino send / receive code works, at least to some extent, and you know that the tx/rx/gnd pins are correctly connected between the Arduino and the RS232 module.

The next most common error, in my experience, is not having the tx/rx connected correctly in the cable. There’s 2 types of cables

  1. “cross over” or “null modem” where pins 3,2 on one end go to pins 2,3 on the other end.
  2. “straight through” where pins 3,2 on one end go to pins 3,2 on the other end.

Which type of cable you need depends on how the RS232 device that you want to talk to is wired.

Are you sure you’ve got the correct cable type?

The Optical Delay Line does not use a DB9 connector. It uses a 16 pin Hirose connector.

It will need a custom built cable.
The transmit pin needs to be connected to the receive pin at the RS232 - TTL converter, and vice versa.

Here's the manual, I've removed the password protection:
OP-ODL-650-330PS.pdf (5.4 MB)

eddier234,
The code that you posted in post #22 doesn't look very useful to me.

Everything happens in setup(), so it only runs once.

I think that you would be better off using something like the 'Echo' example that comes with the AltSoftSerial library.

Using that you can continually send and receive data from the Serial Monitor to the Optical Delay Line.
You might have to try different line endings until you find the correct one.

Right, the levels are defined by RS-232.