EgyEast
EgyEast

Reputation: 1572

How to make arduino communicate between 2 devices using RS232 serial port?

I'm new in Arduino. I have some medical devices that send and receive data using RS232 (DB9) serial port communication to and from the computer. Some other devices send and receive data between each other. However , some devices from different manufacturers need some formatting modification for data before being received from other devices. I used to do this through the computer to receive data from device 1 then modify formatting then resend to device 2 and this did the job, but this requires one computer between 2 devices. I'm asking if Arduino is able to do the job by connecting to 2 devices at the same time using serial port (DB9) so it can receive data from first device and resend it to another device after little modification in formatting using code. I know it is not straightforward but if it is possible even in a hard way , i would appreciate if somebody guided me how to do that. Thank you

Upvotes: 0

Views: 1107

Answers (1)

Piglet
Piglet

Reputation: 28950

For one-way forwarding this is sufficient. Feel free to add your formatting.

Serial.write(Serial.read());

Of course this needs to be embedded in a valid Arduino sketch.

If you want to forward in both directions you'll need a second hardware USART or emulate that on digital I/Os using the SoftwareSerial library for example.

Upvotes: 1

Related Questions