So sánh truyền thông RS232 vs RS485
Last updated
Last updated
RS-232 and RS-485 are standards for serial interfaces that each specify the transmission media and a defined set of logic levels, data rates and timings. These are some of the oldest serial interfaces around, yet they are still very widely used in control and measurement equipment, mainly due to their simplicity and low cost.
RS-232 is the simplest of the two interfaces. It is used to connect two devices as illustrated below:
That is, the transmitter of Device 1 is connected to the receiver of Device 2 and vice versa. Both lines are single-ended with a ground reference. The standard specifies a voltage between -3 and -25 V as a logic 1 and a voltage between +3 and +25 V as a logic 0. The cable used to connect Device 1 and Device 2 can be made up of either parallel wires or a twisted pair and should generally not exceed 15 meters.
Most serial devices use a Universal Asynchronous Receiver Transmitter (UART) integrated circuits to implement a communication protocol that transmits portions of data (typically 8 bits) along with a defined set of start-bits, stop-bits, and parity-bits at a specified data rate. The transmitted data is often ASCII characters. Data rates typically range from 4800 to 115.200 baud.
Very widely used
Low complexity
Supports full duplex
Only supports communication between two devices
Only works over short distances
Relatively susceptible to noise
While RS-485 and RS-232 have a lot in common regarding the data format, they differ on a very significant parameter: Where RS-232 specifies single-ended connections referenced to ground, RS-485 specifies differential signaling on two lines, called A and B. Up to 32 devices can be connected via the same RS-485 bus, though only one device can “talk” at any given time (half-duplex).
A voltage of -200 mV is specified as a logic 1, while +200 mV is specified as a logic 0. In its nature, the differential format provides common-mode noise cancellation. The differential format along with the lower voltage levels also enable higher data rates and much longer cable lengths than RS-232. Depending on the data rates, cables can be up to 1200 meters long. According to the RS-485 standard, the cables must be twisted pairs.
Supports several devices on the same bus (multi-drop)
Less susceptible to noise than RS-232
Works over longer distances
Supports faster transfer speeds than RS-232
Not as widely used as RS-232
Requires termination resistors
Only supports half-duplex
Generally, RS-232 is the simpler solution for connecting two devices over short distances. RS-485, while allowing connection of several devices on the same bus over greater distances, does require termination resistors. Also, many PCs or PLCs come with one or more RS-232 ports as standard, while RS-485 ports are often sold separately.