简体   繁体   中英

rs-232 serial connection through ethernet cable (tcp)

I have hardware device that is controlled through an rs-232 interface (Its an ultrasound pulser-receiver). I need to write a program to send the commands to the device from my computer. Unusually, however, the device does not have a serial port (DB-9 COM port) but rather has a RJ45 receptacle (an ethernet socket). The device comes with an adapter to connect the ethernet port on the device to a serial cable for communication with a computer.

Unfortunately my computer does not have a serial port - only an ethernet port. If possible I would like to do away with the adapter and connect my computer directly to the device with the ethernet cable. This is possible physically - but I don't know how to convert the message protocol? For instance, my device does not have an ip-address with which to open a tcp socket?

So far I have been using Boost.asio (on a Ubuntu box) for sending message streams via a tcp socket to other devices that support tcp. If possible I would like to continue to use the Boost.Asio library - since it is cross platform. I do not really know where to start - I have always used the Boost.Asio library which nicely hides most of the protocol issues. I believe it is possible, however, as there are windows programs that seem to do a similar thing, see for example http://com0com.sourceforge.net/

Any guiding advice would be welcome. Many thanks

Actually it doesn't work physically. It just works mechanically. The physical electrical voltages and currents used by ethernet is very different from that used by serial ports. Not only that, the pinouts are also incompatible.

Lucky for you ethernet uses magnetically coupled signals otherwise you would have fried either your motherboard or the ultrasound device.

It is not just a matter of software protocols.

You cannot do this directly. The best thing you can do, since your computer lacks an RS-232 serial port, is to add one.

This can easily be done either via USB-to-RS232 converter/dongle, or a PCI card.

You cannot program Ethernet to act like RS-232.

There's actually another solution. There are companies which makes serial-over-ethernet devices. I've personally worked with two:

Digi

Lantronix

It's a great solution although a bit on the expensive side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM