Explain the RS-232C interface standard

Serial communication interface standards have been used and developed, and there are currently several. But they are all based on the improvement of the RS-232 standard. Therefore, we will mainly discuss RS-232C. The RS-323C standard is a communication protocol announced in 1969 by the United States EIA (Electronic Industries Federation) and BELL and other companies. It is suitable for communication with data transmission rates ranging from 0 to 20000 b/s. This standard specifies the issues related to serial communication interfaces, such as signal line functions and electrical characteristics. Since the peripheral equipment manufacturers all produce communication equipment compatible with the RS-232C standard, it is widely used as a standard in microcomputer communication interfaces.

Before discussing the content of the RS-232C interface standard, two points are explained:

First, the RS-232-C standard was originally developed by the remote communication connection data terminal equipment DTE (Data Terminal Equipment) and the data communication equipment DCE (Data Communica TIon Equipment). Therefore, the development of this standard does not consider the application requirements of computer systems. But now it is widely borrowed for the near-end connection standard between computers (more precisely, computer interfaces) and terminals or peripherals. Obviously, some of the provisions of this standard are inconsistent and even contradictory with computer systems. With this understanding of the background, it is not difficult to understand where the RS-232C standard is incompatible with the computer.

Secondly, the "send" and "receive" mentioned in the RS-232C standard are all based on the DTE position, rather than standing in the position of the DCE. In computer systems, where information is often transferred between the CPU and the I/O device, both are DTEs, so both parties can send and receive.

First, RS-232-C

The full name of the RS-232C standard (protocol) is the EIA-RS-232C standard, in which EIA (Electronic Industry AssociaTIon) represents the American Electronics Industry Association, RS (ecommeded standard) represents the recommended standard, 232 is the identification number, and C represents the latest RS232. Modified (1969), before this, there are RS232B, RS232A. . It specifies the connection cable and mechanical, electrical characteristics, signal functions and transmission processes. Common physical standards are also EIA? RS-232-C, EIA? RS-422-A, EIA? RS-423A, EIA? RS-485. Only EIA is introduced here? RS-232-C (referred to as 232, RS232). For example, the COM1 and COM2 interfaces currently on IBM PCs are RS-232C interfaces.

RS232C pin definition

The typical representative of the serial port is the RS-232C and its compatible jacks, which are available in 9-pin and 25-pin versions. The 25-pin serial port has a 20mA current loop interface function, which is implemented with 9, 11, 18, and 25 pins. Its pin functions are as follows:

Electrical characteristics

The EIA-RS-232C specifies electrical characteristics, logic levels, and various signal line functions.

On TxD and RxD: Logic 1 (MARK) = -3V to -15V

Logic 0 (SPACE) = +3 ~ +15V

On control lines such as RTS, CTS, DSR, DTR and DCD:

Signal valid (on, ON state, positive voltage) = +3V ~ +15V

Invalid signal (open, OFF state, negative voltage) = -3V to -15V

The above provisions describe the definition of logic levels in the RS-323C standard. For data (information code): the level of logic "1" (signature) is lower than -3V, the level of logic "0" (space number) is +3V; for control signal; ON state (ON) The effective level of the signal is higher than +3V, and the off state (OFF) means that the level of the signal is invalid is lower than -3V, that is, when the absolute value of the transmission level is greater than 3V, the circuit can effectively check out, between - The voltage between 3 and +3V is meaningless. The voltage below -15V or higher than +15V is considered meaningless. Therefore, in actual operation, the level should be between ±(3~15)V. String 2

EIA-RS-232C and TTL conversion: EIA-RS-232C uses positive and negative voltages to represent logic states, and TTL to indicate logic at high and low levels.

The rules of the state are different. Therefore, in order to be able to interface with a computer interface or terminal TTL device, the level and logic relationship must be changed between the EIA-RS-232C and the TTL circuit. The method of implementing this transformation can be a discrete component or an integrated circuit chip. At present, integrated circuit conversion devices are widely used, such as MC1488 and SN75150 chips, which can convert TTL level to EIA level, while MC1489 and SN75154 can realize EIA level to TTL level conversion. The MAX232 chip performs TTL←→EIA bidirectional level shifting. Figure 1 shows the internal structure and pins of the 1488 and 1489. Pins (2), (4, 5), (9, 10), and (12, 13) of the MC1488 are connected to the TTL input. Pins 3, 6, 8, and 11 are terminated with EIA-RS-232C. The 1, 4, 10, and 13 pins of the MC1498 are connected to the EIA input, while the 3, 6, 8, and 11 pins are connected to the TTL output. The specific connection method is shown in Figure 2. On the left side of the figure is the main chip UART in the serial interface circuit of the microcomputer. It is a TTL device, and the EIA-RS-232C connector on the right requires EIA high voltage. Therefore, all output and input signals of RS-232C must pass through MC1488 and MC1498 converters respectively, and then level-converted before they can be sent to the connector or sent from the connector.

2, the mechanical characteristics of the connector:

Connector: Since RS-232C does not define the physical characteristics of the connector, various types of connectors of DB-25, DB-15 and DB-9 have appeared, and the definition of the pins is also different. The two connectors are described below.

(1) DB-25: PC and XT machines use DB-25 type connectors. The DB-25 connector defines 25 signal lines divided into 4 groups:

1 9 voltage signals for asynchronous communication (including signal ground SG) 2,3,4,5,6,7,8,20,22

String 6

12 mA current loop signals (12, 13, 14, 15, 16, 17, 19, 23, 24)

3 empty 6 (9,10,11,18,21,25)

4 protective ground (PE), as the equipment ground (1 pin)

The outline and signal line assignment of the DB-25 connector is shown in Figure 3. Note that the 20mA current loop signal is only available on IBM PCs and IBM PC/XT machines, and is not supported on AT machines and beyond.

Cable length: The maximum physical distance to which the RS-232C is directly connected is 15m (50 feet) at communication rates below 20kb/s.

Maximum direct transmission distance specification: The RS-232C standard stipulates that if MODEM is not used, the maximum transmission distance between DTE and DCE is 15m (50 feet) when the symbol distortion is less than 4%. It can be seen that this maximum distance is given on the premise that the symbol distortion is less than 4%. In order to ensure that the symbol distortion is less than 4%, the interface standard specifies in the electrical characteristics that the load capacitance of the driver should be less than 2500pF.

3, RS-232C interface signal

The RS-232C standard interface has 25 lines, 4 data lines, 11 control lines, 3 timing lines, 7 spare and undefined lines, and only 9 are commonly used. They are:

(1) Contact control signal line:

Data set ready (DSR) - Active (ON) state, indicating that the MODEM is in a usable state.

Data set ready (DTR) - Active (ON) state, indicating that the data terminal is available.

These two signals are sometimes connected to the power supply and are effective as soon as they are powered up. The two device status signals are valid, only indicating that the device itself is available, and does not indicate that the communication link can start communication. Whether or not communication can be started is determined by the following control signals.

Request to send-RTS - Used to indicate that the DTE requests the DCE to send data, that is, when the terminal wants to send data, make the signal valid (ON state) and request transmission to the MODEM. It is used to control whether the MODEM is going to enter the transmission state.

Clear to send (CTS) - used to indicate that the DCE is ready to receive data sent by the DTE, which is a response signal to the request to send signal RTS. When the MODEM is ready to receive the data transmitted from the terminal and transmit it forward, the signal is validated, and the terminal is notified to start transmitting data along the transmission data line TxD.

The pair of RTS/CTS request response contact signals is used for switching between the transmission mode and the reception mode in the half-duplex MODEM system. In full

Switching between the transmitting mode and the receiving mode in the duplex system. In a full-duplex system, because the bidirectional channel is configured, the RTS/CTS contact signal is not required to make it high.

Received Line DetecTIon-RLSD - Used to indicate that the DCE is connected to the communication link, informing the DTE that it is ready to receive data. When the local MODEM receives the carrier signal sent by the MODEM at the other end of the communication link (remote), the RLSD signal is valid, the terminal is notified to prepare for reception, and the received carrier signal is demodulated into digital two data by the MODEM. Then, it is sent to the terminal along the receiving data line RxD. This line is also called the Data Carrier dectecTIon-DCD line.

Ringing-RI—When the MODEM receives the ringing call signal from the switching station, it makes the signal valid (ON state), notifying the terminal that it has been called.

(2) Data transmission and reception lines:

Transmitted data-TxD - Sends serial data to the MODEM via the TxD terminal, (DTE→DCE).

Received data (RxD) - Receives serial data from the MODEM via the RxD line terminal (DCE → DTE).

(3) Ground wire

There are two lines SG, PG - signal ground and protective ground signal line, no direction.

When the above control signal lines are valid and when they are invalid, the order of the interface signals is transmitted. For example, a transfer operation between DTE and DCE can only be performed when both DSR and DTR are in the active (ON) state. If the DTE wants to transmit data, the DTR line is set to the active (ON) state in advance, and the serial data can be transmitted on the TxD line after the CTS line receives the answer of the valid (ON) state. This sequence of rules is particularly useful for half-duplex communication lines because half-duplex communication can determine that the DCE has changed from the receive direction to the transmit direction before the line can begin transmitting.

2 data signals: send TXD; receive RXD.

1 signal ground: SG.

6 control signals:

DSR? ? The digital machine (ie modem) is ready, Data Set Ready.

DTR? ? The data terminal (DTE, ie the microcomputer interface circuit, such as Intel8250/8251, 16550) is ready, Data Terminal Ready.

RTS? ? The DTE requests DCE to send (Request To Send).

CTS? ? The DCE allows DTE to send (Clear To Send), which is the answer to the RTS signal.

DCD? ? Data carrier detection, when the local DCE device (Modem) receives the carrier signal sent by the DCE device of the other party, makes the DCD valid, notifies the DTE to prepare for reception, and demodulates the received carrier signal into a digital signal by the DCE. The signal is sent to the DTE via the RXD line.

RI? ? Ringing Signal Ringing When the DCE receives the ringing call signal from the switch, it makes the signal valid and informs the DTE that it has been called.

Long distance communication

The first and second cases are examples of long-distance communication (communication with a transmission distance greater than 15 m). Therefore, the modem MODEM is generally added, so that many signal lines are used. Note: In the following figures, the DTE signal is the RS-232-C signal, and the level shift circuit between the DTE and the computer is not shown.

1. Signal connection when using Modem (DCE) and telephone network communication:

If the ordinary telephone exchange line is used for communication between the two MODEMs, in addition to the 2 to 8 signal lines, two signal lines RI (22) and DTR (20) should be added for contact, as shown in FIG.

DSR, DTR: The Digital Transmitter (DCE) is ready, the Data Terminal (DTE) is ready, and only the device itself is available.

First, the caller is dialed by the telephone, and the telephone exchange sends a dialing call signal to the other party. When the DCE receives the signal, the RI (ringing signal) is valid, and the DTE is notified that the call has been made. When the other party "off-hooks", the two parties establish a communication link.

If the computer wants to send data to the other party, it first sends an RTS (Request to Send) signal through the interface circuit (DTE). At this time, if the DCE (Modem) allows transmission, the CTS (Allow Transmission) signal is answered to the DTE. Generally, the RTS/CTS can be directly connected to the high level, that is, as long as the communication link is established, the signal can be transmitted. (RTS/CTS can be used only for switching between transmission mode and reception mode in a half-duplex system.

When the DTE obtains the CTS signal, it sends a serial signal to the DCE through the T XD line, and the DCE (Modem) modulates the digital signals into analog signals (also called carrier signals) and transmits them to the other party.

Before the computer transfers new data to the DTE "data output register", it should check that the Modem status and data output registers are empty. After the DCE of the other party receives the carrier signal, it sends a DCD signal (data carrier detection) to the DTE of the other party to inform the DTE that it is ready to receive. At the same time, the carrier signal is demodulated into a data signal and sent to the DTE from the RXD line, DTE. The received bit stream is shifted by the serial receive shift register. After receiving all the bit streams of one character, the data bits of the character are sent to the data input register, and the CPU can read the characters from the data input register. .

Near field communication:

When the communication distance is relatively short, the Modem is not needed, and the communication parties can directly connect. In this case, only a few signal lines are used. In the simplest case, RS-232C control contact signal is not needed at all in communication. Only three lines (send line, receive line, signal ground) can realize full-duplex asynchronous serial communication, which is discussed here. The first case.

When there is no Modem, the maximum communication distance is calculated as follows:

The RS-232C standard stipulates that when the bit error rate is less than 4%, the capacitance of the wire should be less than 2500 PF. For a normal wire, the capacitance is about 170 PF/M. Allowable distance L=2500PF/(170PF/M)=15M

The calculation of this distance is conservative. In practical applications, when using 9600bps, the common twisted pair shielded cable can reach a distance of 30~35 meters.

Frame For Iphone X

Frame For Iphone X,Metal Frame For Iphone X,Frame With Glue,Original Metal Frame For Iphone X

Shenzhen Xiangying touch photoelectric co., ltd. , https://www.starstp.com