Archive for February, 2007

Implement your own protocol, please

Thursday, February 15th, 2007

What is it with communication protocols? Why does there always have to be some secret quirk or trick to get a device to talk nicely? I remember in high school when I could never seem to figure out how to get a girl to talk to me. Couldn’t decipher the secret code. The football team did, though, which only made me more confused.

I’ve recently been working on an application which needs to communicate over TCP with an expensive radio-frequency power supply made by Dressler. For some odd reason, the device won’t just take it’s commands as ASCII strings over TCP. No no no, the makers of this device decided that Modbus, the 1979 protocol designed for reading and writing single bits in remote device memory addresses, would be co-opted and perverted in order to “facilitate” sending high-level commands to the device. No, I don’t have any idea why they came out with this design. Probably a bad mix of history and inertia.

To make matters worse, Dressler implemented the Modbus part carelessly — making it impossible to employ a standard Modbus API to soothe the protocol burn. The good folks at NModbus have put together a great .NET library for dealing with the Modbus protocol. At my prompting, the team even put in support for Function Code 23, a very flexible Modbus function which the Dressler device perverted for it’s communications. I would have loved to use it in my application. Oh, yes, I would have liked that very much. Now I’m left to hack my own odd library which none on the planet will be able to reuse.

Let’s all resolve to write sane, reusable, standardized protocols.