Overview of RS232
The RS-232 interface complies with the serial data communication interface standard established by the Electronic Industries Alliance (EIA). The original designation is EIA-RS-232 (abbreviated as 232, RS232). It is widely used for connecting computer serial interface peripherals. This includes connection cables as well as mechanical, electrical, signal, and transmission processes.
The RS-232-C standard specifies data transmission rates of 50, 75, 100, 150, 300, 600, 1200, 2400, 4800, 9600, 19200 baud per second.
Characteristics of RS232
RS-232 is one of the mainstream serial communication interfaces. Due to the early emergence of the RS232 interface standard, it inevitably has shortcomings, mainly including the following four points:
- The interface signal levels are high, which can easily damage the interface circuit chips. The voltage of any signal line on the RS232 interface is in a negative logic relationship. That is: logic “1” is -3 ~ -15V; logic “0” is +3 ~ +15V, with a noise margin of 2V. This means that the receiver needs to recognize signals above +3V as logic “0” and signals below -3V as logic “1”, while recognizing 5V TTL levels as logic positive and 0 as logic negative. It is incompatible with TTL levels and requires a level conversion circuit to connect to TTL circuits.
- Low transmission rate. In asynchronous transmission, the bit rate is 20Kbps; therefore, in the 51CPLD development board, the integrated program baud rate can only be 19200, which is also the reason.
- The interface uses signal lines and signal return lines, forming a common ground transmission form. This standard ground transmission is susceptible to common-mode interference, resulting in weaker noise resistance.
- Limited transmission distance. The maximum transmission distance is 50 feet, which is approximately 15 meters.
Overview of RS485
The RS-485 serial bus is widely used when communication distances must range from several meters to several kilometers. RS-485 uses balanced transmission and differential reception, which can suppress common-mode interference. In addition to the high sensitivity of the bus transceiver, it can detect voltages as low as 200mV, allowing the transmitted signal to be recovered over distances exceeding kilometers. RS-485 operates in half-duplex mode, meaning that only one point can transmit at any given time. Therefore, the transmission circuit must be controlled by an enable signal.
Characteristics of RS485
RS-485 is very convenient for multipoint interconnection, saving many signal lines. RS-485 applications can be networked to form a distributed system, allowing up to 32 drivers and 32 receivers to be connected in parallel. Addressing the shortcomings of RS-232, the new standard RS-485 has the following features:
- The electrical characteristics of RS-485: logic “1” is represented by a voltage difference of +2V to +6V between the two lines, while logic “0” is represented by a voltage difference of -6V to -2V between the two lines. The interface signal levels are lower than those of RS-232, making it less likely to damage interface circuit chips. This level is compatible with TTL levels, facilitating connection with TTL circuits.
- The maximum data transmission rate is: 10Mbps
- The RS-485 interface uses a combination of balanced drivers and differential receivers, providing good resistance to common-mode interference, i.e., good noise performance.
- The maximum transmission distance of the RS-485 interface is 4000 feet, practically reaching up to 3000 meters.
- RS-232 interfaces only allow one transceiver to be connected to the bus, i.e., single-station functionality. In contrast, RS-485 interfaces allow up to 128 transceivers to be connected on the bus, i.e., multi-station capability. Users can quickly establish a device network using a single RS-485 interface.
Differences Between RS232 and RS485
- Operating mode: RS232 is full-duplex, while RS485 is half-duplex.
- Transmission method: RS485 and RS232 are merely physical protocol communications (i.e., interface standards); RS485 uses differential transmission, while RS232 uses single-ended transmission, but the communication protocols are not significantly different.
- Signal lines: A half-duplex network formed by RS485 interfaces generally requires only two signal lines. The RS-232 interface typically uses three lines: RXD, TXD, and GND.
- Interference resistance: The RS485 interface uses a combination of balanced drivers and differential receivers, providing good noise resistance. The RS232 interface uses one signal line and one signal return line, forming a common ground transmission form, which is prone to common-mode interference.
- Transmission distance: The maximum standard transmission distance for RS485 is 1200 meters (at 9600bps), practically reaching 3000 meters. RS232 has a limited transmission distance, with a maximum standard value of 50 meters, practically usable only up to about 15 meters.
- Communication capability: The RS485 interface allows up to 128 transceivers to be connected on the bus, enabling users to easily establish a device network with a single RS485 interface. RS232 only allows one-to-one communication.
- Transmission rate: RS232 has a lower transmission rate, with a baud rate of 20Kbps in asynchronous transmission. RS485 has a maximum data transmission rate of 10Mbps.
- Electrical level values: In RS485, logic “1” is represented by a voltage difference of +(2-6)V between the two lines; logic “0” is represented by a voltage difference of -(2-6)V. In RS-232, the voltage of any signal line is in a negative logic relationship. That is: logic “1” is -(5-15)V; logic “0” is +(5-15)V.
PCs are already equipped with RS232 and can be used directly. If using RS485 communication, it is only necessary to connect an RS232 to RS485 converter to the RS232 port without modifying the program.
RS232 is a standard interface, which is a D-shaped 9-pin connector. The signal definitions of the connected devices’ interfaces are the same. The signal definitions are as follows:
RS232 only allows one-to-one communication (single-station functionality).
RS485 interfaces allow up to 128 transceivers on the bus (multi-station functionality).
The communication distance: the theoretical maximum distance between the farthest device (controller) and the computer is 1200 meters. It is recommended to keep it within 800 meters, ideally within 300 meters. If the distance is too long, a 485 repeater (expansion) can be used, with the repeater placed in the middle or at the beginning of the bus. Theoretically, the repeater can extend up to 3000 meters.
The number of loads: The number of devices (controllers) that the 485 bus can support depends on the communication chips of the controllers and the 485 converters. Typically, there are 32, 64, 128, and 256. These numbers are theoretical. In practical applications, the number of loads may not reach the specified numbers due to factors such as environmental conditions and communication distances.
The 485 communication bus (must be twisted pair or one of the network cables) should not use ordinary wires (non-twisted), as this will cause significant interference, making communication difficult or even impossible.
Each controller device must work in tandem, and there should be no star connections or branches. If there are star connections or branches, interference will be significant, communication will be poor, and transmission may even be impossible.