Serial communications: protocol selection
SPLat controllers support a variety of communications protocols. This chapter describes the mechanisms for selecting which protocol is to be “in charge”. Subsequent chapters provide the details of each protocol.
Switching protocols
Current SPLat controllers have one serial communications port, which was originally intended only for programming the controller. It is not possible to operate more than one protocol on the serial port at any one time. SPLat therefore provides a mechanism for switching between protocols. The same mechanism provides control over the lower level settings like bit rate (a.k.a. baud rate) and character profiles. This “Protocol selection” chapter is about that mechanism.
What is a “protocol”
The serial port on a SPLat controller is capable of sending and receiving a stream of data bit, 1’s or 0’s, one at a time. Several consecutive bits (typically 10) grouped together form a character. A protocol defines how those characters are to be interpreted. In effect the protocol is the language used for communications between the SPLat and say a computer.
In a typical protocol information is exchanged in the form of messages or datagrams. A datagram consists of a discrete collection of characters, transmitted in sequence, that as a whole convey a particular meaning, command or item of data. A datagram usually also contains some form of error detection, so a corrupted datagram can be detected and retransmitted. The details vary from protocol to protocol. The terminology can also vary from protocol to protocol. For example, in the ModBus protocol the datagrams are normally called queries and responses.
What is NOT a protocol
There tends to be some confusion and mis-information about what constitutes a protocol. These mistakes can lead to serious misunderstandings and ultimately costly mistakes.
- Most common is the assertion that RS232 and RS485 are protocols. They are not. RS232 and RS485 are electrical interface standards. They define voltage and current levels, and in the case of RS232, connector types and pinouts. Nothing more! They do not define bit rates, character profiles or the structure of datagrams.
- Another common mistake is to confuse the character profile with the protocol. The character profile defines the number of data bits, stop bits and a parity bit. Those things define the low level makeup of a single character, not what the character is to mean. Think of the character profile as being the font, like Arial or Times New Roman. While the character profiles must match between two devices that are to communicate, they are not the protocol.