What is RS485 ?
RS-485 (currently known as EIA/TIA-485) is a standard interface of the physical layer of communication, a signal transmission method, the 1st level of the OSI (Open SystEM Interconnection) model. RS-485 has been created in order to expand the physical capabilities of RS-232 interface.
The serial EIA-485 connection is done using a cable of two or three wires: a data wire, a wire with inverted data, and often a zero wire (ground, 0 V). This way, transmitters and receivers exchange data via twisted-pair cable of 22 or 24 AWG solid wires.
The main idea here is to transport one signal over two wires. While one wire transmits the original signal, the other one transports its inverse copy. Such transmission method provides high resistance to common-mode interface. The twisted-pair cable that serves as a transmission line can be shielded or unshieled.
Operational Distance
Communication network built on the RS-485 interface consists of transceivers connected by a twisted pair (two wisted wires). The basic principle of RS-485 interface is differential (balanced) data transmission. That means one signal is transported over two wires. With that, one wire of the pair transmits the original signal and the other one transports its inverse copy.
As a result of differential signal transmission there is always a potential difference between the wires. The ensures high resistance to common mode interference. In addition, the twisted pair may be shielded, which ensures the protection of transmitted data. All this allows sending data over long distance at relatively high speed, which can reach 100 kbits/s at 4000 feet.
4000 feet or about 1200 meters is the maximum cable length (in meters) and the data rate (in bits per second) should not be more than 10^8. For instance, a 20-meter cable allows a maximum data rate of 5 Mbits/s.
Modbus
One of the main features that differs RS485 communication from any other serial communicationis the format of data exchanged. While RS232 devices connect over text (ASCII) protocols, most RS485 devices use Modbus.
Modbus is a serial communications protocol that is widely used by industrial electronic devices. In Modbus, the connection is established between a master (host) and slaves (COM-based devices). Modbus helps access the configuration of the devices and read the measures.
The data exchange is initiated by a host. The host can switch its RS-485 driver to the transmission mode on its own, while the other RS485 drivers (slaves) work in the receiving mode. In order for a slave to answer the host over the communication line, the ”master“ sends it a special command, which gives the intended device the right to switch its driver into a transmission mode for a certain time.
Modbus is one of the simplest protocols for the interation of devices with each other. It is at the same time easy to implement for equipment manufacturers, which is the primary reason for its prevalence, and at the same time, it is difficulty for an engineer, programmer, because it shifts onto his shoulders all the difficulties of implementation in the final solution, requirinng him to work with multipage tables of registers and variables, their addresses, various functions of writing and reading and data conversion.