To communicate with instruments and devices, the sender and the recipient need to use the same hardware protocol to physicall receive the message and the same software protocol to create and interprete the message. These protocols describe the standard how to send and receive messages. As often hardware protocol and software protocols are used in certain combinations, both are often mixed up or used as a representative for the other one.
In this article, we will give a brief overview over commonly used protocols.
Hardware protocols are those that describe the physical transmission of a signal, e.g. electrically or optically. The description of the standard can include several things like
- the number of signal lines and their meaning
- the electrical signal strength and discriminator levels to identify a high or a low signal
- the possibility to do bus communication (to talk to multiple instruments at one communication line)
Sometimes the protocol also defines the type of the physical connector.
RS-232 is commonly found in conjunction with COM port. It allow for a direct conversation with single instrument. Bus like communication is not supported. Instruments
RS-485 is a transmission protocol that allows to add multiple devices to the same communication line and thus allow bus communication. It always requires an appropriate software protocol where the address of the receiver is sent.
IEEE-488 / GPIB
Today this port cannot be found anymore at modern computers. It typically comes wth a DB-25 connector. In contrast to serial communication protocols like RS-232, one can change the state of 8 data pins to and thus represent one byte at the time. This port was very practical to use as a port to apply an electrical signal, e.g. to switch a relais. Nowadays, this functionality can easily be done with Arduino.
In any case, a communication with an instruments relies on sending and receiving bytes, which are represented by changes of a physical quantity e.g. a voltage. The order of these bytes and their meaning is described by the software protocol. Most instrument manufacturer use sequences of bytes that can be, by using an encoding table, changed to a human readable, sense making, sequence of characters. Typically the encoding relies on the ASCII encoding table which is why an ASCII based communication protocol is synonym for a human-readable protocol. Other software protocols just use sequences of bytes that always represent a certain command but the bytes itself do not have an understandable meaning.
The SCPI standard is a ASCII based protcol that defines the assembly of messages in a certain format. It comprises a bunch of commands that have to be implemented to comply with the standard. A typical standard command is the well known "*IDN?" that can be sent to ask for the identification string of the instrument. Other commands can be freely defined as long as they fulfill the style requirements. SCPI is most often used in confunction with GPIB/IEEE488.2 but can also be found at instruments that use RS-232.
Modbus is a protocol to read and write memory registers. It is a protocol that supports bus communication as each message contains an address number in the range 0-255. Each value is represented by two bytes in the memory of the instruments and for each value a memory position is described that can be read and sometimes also set. 2 bytes are 16 bits that can represent numbers in the range 0 - 65535. For each value, the number of decimal positions is defined in the programming guide. For example, the number 12345 can represent the voltage 12.345 V if the value is defined to have three decimal positions. It means that both communication partners need to know the the decimal positions of each value beforehand as this information is not transmitted. Furthermore, each value can be interpreted as signed integer. In that case the two bytes correspond to a number between -32768 and 32767 including these numbers. Modbus can be most often found together with RS-485 but can also be found with Ethernet.
Some protocols are neither pure hardware nor pure software protocols that are listed here.
TCP/IP is a network control that does not describe a set of available command messages and therefore is no software protocol as defined above. It is network protocol that handle the sending of message packages (frames) and to make sure these frames reach the recipient. At the same time, it is not a hardware protocol.