How do I convert my non-standard protocol to a standard protocol?

It is common for devices to have a simple serial protocol that communicates over RS-232. Often, a simple terminal emulator program such as HyperTerminal or PuTTY is all you need to interact with the device. It is also relatively simple to write a program on your PC to interact with the serial device. Simplicity is usually the reason for a device having such a protocol. But how do you connect such a device to a Modbus, BACnet, or SNMP network? Control Solutions has solved that problem with completely programmable serial gateways.

Converting custom or proprietary serial ASCII protocols to Modbus, BACnet, or SNMP is accomplished by writing a Script Basic program in the gateway to parse and format the character strings. We generically refer to these proprietary protocols as ASCII, but they are not always strictly ASCII. It is possible to send and receive non-printable characters, so anything that qualifies as a "serial character" protocol can be made to work.

Some applications will require that you query the serial device and listen for replies. Other applications will require that you listen for character strings from the serial device, and optionally respond to that device. It may be a "listen only" application, such as some form of data logger that just continuously spits out character stings of data. In this case, the Script Basic program would simply listen for data, figure out what it represents when a string is received, and put some meaningful numeric data into either a Modbus register or BACnet object as a result.

Protocols like Modbus usually have some concept of master and slave. The concept of master versus slave is really up to you to define when working with the proprietary protocol. It will probably boil down to some agreed rules - possibly dictated by the device you are talking to - about who talks first on the serial connection.

Getting your Script Basic program to talk serial is done by opening a special form of file, as illustrated below. This simple example will listen for a character string from the serial device, then echo the same string right back to it. This simple example makes a good initial test to confirm that you are talking to the serial port. Simply connect a PC running a terminal emulator program, and you should be interacting with the gateway.


A more complete and complex example is illustrated below. This screen shot shows the View/Edit view of an application in which a proprietery ASCII protocol is being translated to values in local registers (or objects). The line that begins with "print #1" is sending a command to the ASCII device, the "line input" retrieves the reply (waiting for up to 0.5 seconds as defined by the timeout command). Then standard Basic string functions are used to parse the reply.


What if my non-standard device connects via Ethernet?

The Script Basic in our proprietary protocol gateways can open TCP or UDP connections instead of the serial port. As long as your data is accessible via a TCP or UDP connection, and you know how the IP packets are formatted, it can be converted to Modbus, BACnet, or SNMP.

 Visit our Proprietary Gateway page for a list of gateway models with custom programming capability.