Serial port, also known as serial interface or serial port, serial communication interface, COM interface, referred to as serial port. It is mainly used for serial bit by bit data transmission.

Serial communication is a very common way of communication between devices. Serial communication protocol refers to the data packet format specification (including start bit, data bit, check bit and stop bit) agreed by both parties.

1. Common electrical standards and protocols of serial port

1.1RS-232C

RS-232C standard serial port is the most commonly used serial communication interface

mechanical properties

RS-232C uses 9-pin or 25 pin D-type plug, and 9-pin plug is commonly used.

DE-9Male(PinSide)DE-9Female(PinSide)

o4YBAGAXYRWAX15iAAAIHy1owEs005.png

9-pin plug pin

pIYBAGAXYRyAMrJ4AAAU4aSFAnA074.png

Electrical characteristics

Logic level: logic 1: – 3 ~ – 15V; logic 0: 3 ~ 15V

Maximum data transmission rate: 19200bps

Maximum communication distance: 15m

1.2RS-422

RS-232 has the problems of short distance and low speed. RS-422 improves these two aspects. The maximum transmission distance is 1200m and the maximum transmission speed is 10MB / s

mechanical properties

It’s usually a 9-pin D-type plug

Electrical characteristics

Logic level: logic 1: voltage difference between two wires + 2V ~ + 6V logic 0: voltage difference between two wires – 6V ~ – 2V

Maximum data transmission rate: 10Mbps

Maximum communication distance: 1200m

1.3RS-485

On the basis of RS-422, RS-485 adds multi-point and two-way communication capability, and has networking function.

mechanical properties

It’s usually a 9-pin D-type plug

Electrical characteristics

Logic level: logic 1: voltage difference between two wires + 2V ~ + 6V logic 0: voltage difference between two wires – 6V ~ – 2V

Maximum data transmission rate: 10Mbps

Maximum communication distance: 1200m

2. Composition of serial data packet

Serial data packet consists of start bit, data bit, check bit and stop bit.

The most common serial port packet configuration is 96008n1 (9600 baud rate, 8 data bits, no check, 1 stop bit).

For example, transmit character 0 (ASCII 48, binary 110000)

01100001

explain

0 (start bit) 110000 (8 data bits) 1 (1 stop bit)

2.1 starting position

A data bit of logic 0 (low level) indicates the start

2.2 data bits

After the start bit is the data bit, and the length of the data bit is generally 5, 6, 7 and 8.

2.3 check bits

Check bits are used to check whether the data is correct.

It is generally divided into three parts

o4YBAGAXYSWADH8hAAALlXB82vk381.png

2.4 stop bit

The flag of the end of data transmission is generally represented by 1, 1.5 and 2 logic 1 (high level) data bits

Editor in charge: CC

Leave a Reply

Your email address will not be published. Required fields are marked *