This serial line connects a 25-pin serial port to a 9-pin serial port, and the PC end is the mother plug of the 9-pin:
Connect to the male with 25-pin serial device:
Definition of 25-pin to 9-pin Serial Line Signal |
|
9-pin |
25-pin |
Carrier detect |
1 |
8 |
Receive data |
2 |
3 |
Transmit data |
3 |
2 |
Data Terminal ready |
4 |
20 |
System ground |
5 |
7 |
Data Set ready |
6 |
6 |
Request to send |
7 |
4 |
Clear to send |
8 |
5 |
Ring indicator |
9 |
22 |
The following is the search content:
Usually we for Video Server, video recorder, switch station direct broadcast, switching control mainly use serial port, mainly used to RS-232, RS-422 and RS-485 three interface control. The following describes the interface standards and usage of the serial port and the external plug-ins and cables.
RS-232, RS-422 and RS-485 standards only regulate the electrical characteristics of the interface, and do not involve connectors, cables or protocols, on the basis of which users can establish their own high-level communication protocol. For example, the video server has multiple rs422 serial communication interfaces. Each interface can be recorded and played by an external computer through the rs422 communication line. In addition to various control hardware interfaces, the video server also provides protocol interfaces. For example, the rs422 interface not only supports the profile protocol of rs422, but also supports protocols controlled by rs422, such as Louth, odetics, and BVW.
RS-232, RS-422 and RS-485 are serial data interface standards, are developed and released by the Electronic Industry Association (EIA), RS-232 released in 1962. RS-422 developed from RS-232, to improve the shortcomings of short RS-232 communication distance, low rate, RS-422 defines a balanced communication interface, the transmission rate is increased to 10 Mbps, the transmission distance is extended to 4000 feet (when the speed is lower than Kbps), and a maximum of 10 receivers can be connected on a balanced bus. RS-422 is a kind of single-machine transmission, multi-machine receive one-way, balanced transmission specification, named as TIA/EIA-422-A standard. In order to expand the scope of application, EIA also established RS-422 standards on the basis of RS-485 in 1983, added multi-point, two-way communication capability, that is, allow multiple transmitters to connect to the same bus, at the same time, the driving capability and conflict protection characteristics of the transmitter are added, and the common mode range of the bus is extended, which is named Tia/EIA-485-A standard.
1. S-232 Serial Interface Standard
At present, RS-232 is one of the most widely used serial interfaces in PC and communication industry. A RS-232 is defined as a single-ended standard that increases communication distances in low-rate serial communication. The RS-232 adopts the unbalanced transmission mode, that is, the so-called single-ended communication. The data signal that is received and initiated is relative to the signal location. Typical RS-232 signals swing between positive and negative levels, while sending data, the sender drive outputs positive and negative flat at + 5 ~ + 15 V. The negative value ranges from-5 ~ -15 V level. When there is no data transfer, the online is TTL, from the beginning to the end of the data transfer, the online level from the TTL level to the RS-232 level and then return the TTL level. The typical operating level of the receiver is + 3 ~ + 12 V and-3 ~ -12 V. Because the difference between the transmission level and the receiving level is only 2 V to 3 V, the common mode suppression capability is poor. In addition, the distribution capacitor on the twisted pair wires can provide a maximum transfer distance of about 15 meters, the maximum speed is 20 kbps. RS-232 is designed for point-to-point (that is, only one pair of receiving, sending equipment) communication, its drive load is 3 k Ω ~ 7kb. So RS-232 is suitable for communication between local devices.
2. RS-422 and RS-485 Serial Interface Standard
(1) Balanced Transmission
RS-422, RS-485 and RS-232 is not the same, the data signal using differential transmission, also known as balanced transmission, it uses a pair of twisted pair, the first line is defined as a, the other line is defined as B. Normally, the power plane between drive a and drive B is equal to + 2 ~ + 6 V is a logical state with a negative level ranging from-2 V ~ 6 V is another logical state. Another signal C, there is a "enable" side in the RS-485, and in the RS-422 this is available can be used. The enable end is used to control the disconnection and connection between the transmission drive and the transmission line. When the enable device acts, the sending drive is in a high-impedance state, called the "third State", that is, it is a third State different from the logic "1" and "0.
(2) RS-422 electrical Regulations
Since the receiver adopts a high input impedance and a transmission drive with a stronger drive capability than RS232, multiple receiving nodes can be connected over the same transmission line, and up to 10 nodes can be connected. That is, a master device, the rest is the slave device (Salve), the slave device cannot communicate, so the RS-422 supports two-way communication to multiple. RS-422 4-line interface because of the use of a separate transmission and receiving channel, so do not control the direction of data, any necessary signal exchange between the device can be in the form of software (Xon/xoff handshake) or hardware (a pair of individual twisted pair wires. The maximum transmission distance of the RS-422 is 4000 feet (about 1219 meters), and the maximum transmission rate is 10 Mbps. The length of the balanced twisted pair is inversely proportional to the transmission rate. The maximum transmission distance can be reached only when the transmission rate is below kbps. The maximum transmission rate can be obtained only within a short distance. Generally, the maximum transmission rate of a 100-meter twisted pair is only 1 Mbps. RS-422 needs a final resistance, the resistance value is equal to the characteristic impedance of the transmission cable. When the moment distance is transmitted, the final resistance is not required, that is, the final resistance is generally less than 300 meters. The final resistance is connected to the far end of the transmission cable.
(3) RS-485 electrical Regulations
Because the RS-485 is developed from the basis of the RS-422, so many RS-485 electrical regulations and RS-422 is similar. For example, the balanced transmission mode is adopted, and the final resistance must be connected to the transmission line. RS-485 can adopt two-line and four-line mode, two-line can realize real multi-point bidirectional communication. RS-485 bus, widely used RS-485 serial bus standard when the communication distance is dozens of meters to kilometers. The RS-485 adopts balanced transmission and differential reception, so it has the ability to suppress common mode interference. In addition, the bus transceiver is highly sensitive and can detect voltage as low as 200mV. Therefore, the transmission signal can be recovered from kilometers away. RS-485 uses half duplex mode, at any time only a little in the sending State, therefore, the sending circuit must be controlled by the enabling signal. RS-485 for Multi-Point interconnection is very convenient, can save a lot of signal lines. The application RS-485 can be networked to form a distributed system that allows up to 32 drivers and 32 receivers in parallel. The difference between RS-485 and RS-422 is also that the common mode output voltage is different, the RS-485 is-7 V to + 12 V, and the RS-422 is between-7 V to + 7 V; RS-485 meets all RS-422 specifications, so RS-485 drives can be used in RS-422 networks. Like a RS-485, The RS-422 has a maximum transmission distance of about 1219 meters and a maximum transmission rate of 10 Mbps. The length of the balanced twisted pair is inversely proportional to the transmission rate. The maximum cable length can be used only when the speed is below kbps. The maximum transmission rate can be obtained only within a short distance. Generally, the maximum transmission rate of 100-meter long twisted pair wires is only 1 Mbps.
(4) RS-422 and RS-485 network installation notes
The RS-422 supports 10 nodes and the RS-485 supports 32 nodes, So multiple nodes constitute a network. Generally, the network topology adopts a bus-type structure that matches the terminal, and does not support ring or star networks. Pay attention to the following points when building a network:
* A twisted pair cable is used as the bus to connect each node. The length of the egress from the bus to each node should be as short as possible, so that the reflected signal in the egress has the lowest impact on the bus signal.
* Attention should be paid to the continuity of the impedance of the bus characteristics, and signal reflection will occur at the impedance discontinuous points. The following situations are prone to this kind of continuity: different segments of the bus use different cables, or there are too many receivers installed together on a certain bus, in addition, long branch lines are routed to the bus.
In short, a single, continuous signal channel should be provided as the bus.
Type and conversion of two serial ports
The serial port is an interface standard that specifies the electrical standard of the interface. Simply put, it is only a standard of the physical layer. There is no interface plug-in cable and the protocol used, so as long as the interface plug-in cable we use complies with the serial port standards, it can be used flexibly in practice, various protocols are used in serial port interface standards for communication and Device Control.
We have learned about the serial port protocol. In our daily work, we are most exposed to the external interfaces of some actual devices. How can we know from the shape that this interface is? How do I define each pin of a cable? Above we know the serial RS-232, RS-422 and RS-485 standards only to interface electrical characteristics to make provisions, and does not involve connectors, cables or protocols, on the basis of which users can establish their own high-level communication protocol. The most frequently used plug-in our actual work involves three DB9 db25 RJ45 plug-ins. The above three plug-ins can be used as serial port plug-ins, or switch between plug-ins through cables. Next we will describe the pin definitions of the three plug-ins separately. The conversion between the three plug-ins is also required to jump the cables defined by the plug-in.
* DB9 (9-pin socket), 2. The nine-pin serial port function is shown in table 1.
* Db25 (25-pin socket), 3. The 25-pin serial port function is shown in table 2.
* Another type of plug-in port is RJ45. For example, The SNI high mss1600 and mss700 Video Server encoding and decoding board control ports used by Hubei TV station are all serial ports. The plug-in ports are RJ45 and the serial port of the broadcasting controller is DB9, therefore, we need to use a conversion cable. Pin Definition 4 of the conversion cable.
RS485 half-duplex method: RX + and Tx + are connected to Data +; RX-and TX-are connected to data -. RS485 full duplex/rs422 connection method: Full And Gnd transient; signal line: RX +, Tx +, RX-, TX-, Gnd can be connected as needed.
Expansion of three serial ports
We know that a computer usually has two serial ports. For a broadcasting control computer, there are far more than two devices to be controlled. We need to control the video server at the same time, video Recorder, switch-over platform, text recorder, and other devices. So we need to expand the serial port, we can use the serial port expansion card to expand the serial port, such as the serial port expansion card moxa CI-134 we use in the broadcasting control system.
Moxa CI-134 is a RS-422/485 quad serial port card designed for Industrial communication applications. It supports 4 independent RS-422/485 serial ports and can control up to 128 devices in One-to-multiple-point communication applications. To make the RS-485 2-wire half duplex operation easier, each CI-134 card has an automatic flow control (ADDC) with no software operation required. Therefore, in Windows applications, RS-485 half-duplex protocols can be controlled without additional encoding. To meet industrial requirements for high-reliability products, this series of products provide optional photoelectric isolation (2 kV) and Surge Protection (25 kV ESD) functions.
This product features: Optional photoelectric isolation (2kv) and Surge Protection (25kv ESD) features; automatic control of data flow ADDC (Automatic Data Direction Control) features; RS-485 Data Control L: ADDC can be controlled by using RTS, built-in terminal resistance, chip hardware traffic control to ensure no data loss, advanced ASIC design, low rework rate, and support for many common operating systems.
Application of Four serial ports in the broadcast Control System
We know that the effective transmission distance of the serial port RS232 is 15 meters, the maximum transmission distance of the RS-422 is 4000 feet (about 1219 meters), the maximum transmission rate is 10 Mbps. The video recorders used in broadcasting control, such as dvcpro and IMX, have RS232 and rs422 interfaces for selection. If pin9 is used, rs422 interfaces are used, and rs422 interfaces are used for Video Server encoding and decoding ports, only if the socket port is RJ45 and not DB9, the cable needs to be switched. Therefore, we can flexibly use the above features in the control. The rs422 switch is selected for switching between the master and slave nodes and for distance consideration, the RS232 control interface is used to control the rs422 switching switch, which is directly controlled by the COM port of the broadcasting controller, other control video recorders, switching servers, and video server encoding/decoding cards use the rs422 interface extended by the moxa card to switch to the rs422 switch. Figure 5.
In the whole system, only the rs422 switch opening control is the COM (RS232) Port Control of the broadcasting control machine. Others are the rs422 interfaces extended by the moxa card, as the emergency switch requires RS232, an rs422 to RS232 converter is added in front of the emergency switch. Through the control line broadcasting controller, you can issue broadcasting control commands in a timely manner, or read the status of video recorders, switches, and video servers at any time. The above is only the system control diagram of the broadcasting control data center. The system control of the upload and general control data centers is basically the same.
The rs422 bus, RS485, and rs422 have the same principle. They are sent and accepted in a differential manner and do not require a digital ground. Differential operation is the root cause of long transmission distance at the same rate. This is the fundamental difference between the two and RS232, because RS232 is a single-ended input and output, during duplex operation, at least three lines (asynchronous transmission) are required: The digital ground wire, the transmission line, and the receiving line. You can also add other control lines to complete synchronization and other functions. Rs422 can work in full duplex mode without affecting each other through two pairs of twisted pair wires, while RS485 can only work in half duplex mode, but it only needs one pair of twisted pair wires. The preceding three interfaces have their own shortcomings and can be flexibly selected as needed in actual work.
Computer control is increasingly widely used in broadcasting and broadcasting control systems. With the continuous development of computer technology, intelligence will also increase, and the system will become larger, this requires us to have a better understanding of the basic theory of computers, so that we can have a better understanding of the system, maintain the system, ensure the safe and stable operation of the system, and better ensure secure broadcast.
Serial port connection: DB9 & db25
Currently, the commonly used serial ports include 9-pin serial ports (DB9) and 25-pin serial ports (db25). When the communication distance is close (<12 m ), you can use a cable to directly connect to the standard RS232 port (rs422, RS485 far). If the distance is far, a modem must be attached ). The simplest and most common method is the three-line method, that is, connecting the ground, receiving data and sending data. This article only involves the most basic method and is directly connected with RS232.
1. Description of common signal ports of DB9 and db25
9-pin serial port (DB9) 25-pin serial port (db25)
PIN number Function Description
1. Data Carrier Detection DCD 8. Data Carrier Detection DCD
2 receive data rxd 3 receive data rxd
3 send data txd 2 send data txd
4. Prepare the DTr 20 data terminal for the DTr
5 signal ground Gnd 7 signal ground Gnd
6 data equipment ready DSR 6 Data ready DSR
7. Send the RTS 4 request to send the RTS
8. Clear sending CTS 5. Clear sending cts
9. The ringing command is Dell 22. The ringing command is Dell.
2. rs232c Serial Communication Connection method (three-line)
First, as long as there are receive data pins and send pins for data transmission through the serial port, the receiving pin and sending pin of the same serial port can be directly connected by a line, connect two or more serial ports
· The receiving pin and sending pin of the same serial port are directly connected to the 9-pin serial port and the 25-pin serial port, both of which are 2 and 3;
· Two different serial ports (whether the two serial ports of the same computer or the serial ports of different computers)
The above table is for the standard serial port of the microcomputer, and there are many non-standard devices, such as receiving GPS data or electronic compass data, as long as you remember one principle: receiving data pins (or wires) it is connected to the data transmission pins (or wires), crossover, and signal-to-signal connection.
3. Notes for serial port debugging:
When debugging the serial port, prepare a handy debugging tool, such as the serial port debugging assistant and serial port genie, to get twice the result with half the effort. It is strongly recommended that you do not use the serial port with live connections, and that at least one end is powered off, otherwise, the serial port may be damaged.
Definition of Single-work, half-duplex, and full-duplex
If, at any time in the communication process, information can only be transmitted from one Party A to another, it is called a ticket.
If at any time, the information can be transmitted from A to B and from B to A, but it can only be transmitted in one direction, which is called half-duplex transmission.
If there is a bidirectional signal transmission from A to B and from B to a at any time, it is called full duplex.
The telephone line is the second-line full-duplex channel. Because the echo offset technology is used, two-way transmission signals are not ambiguous. Duplex channels sometimes separate the receiving and sending channels, and transmit signals in the opposite direction using a separate line or band, such as a return line.
Parity
During the transmission of serial data, information error may occur due to interference. For example, the transmission character 'E' is as follows:
0100,0101 = 45 h
D7 D0
Due to interference, the bit may change to 1. In this case, we call it an error code ". We call how to find an error during transmission as "check error ". After an error is found, how to eliminate it is called "error correction ".
The simplest error checking method is "parity", that is, one odd/even parity bit is transferred out of all characters. Odd or even verification can be used.
Odd check: the number of "1" in all transmitted digits (each digit containing characters and the check bit) is odd, for example:
1 0110,0101
0 0110,0001
Even verification: the number of "1" in all transmitted digits (each digit containing characters and the check bit) is an even number, for example:
1 0100,0101
0 0100,0001
The parity check can detect part of the error code in the information transmission process (one-bit error can be detected, and two or more digits cannot be detected). At the same time, it cannot correct the error. After an error is found, you must resend it. However, its implementation is simple and still widely used.
Some methods for checking errors are capable of automatic error correction. Such as cyclic Verification Code (CRC) check errors.
Serial Communication Flow Control
In serial communication processing, we often see two options, namely, RTS/CTS and Xon/xoff. These are two traffic control options. Currently, traffic control is mainly used in modem data communication, however, it is advantageous to know more about General RS232 programming. So what is the role of Stream Control in serial communication?ProgramHow to apply it? Here we will talk about this issue.
1. Role of Stream Control in Serial Communication
The "stream" mentioned here, of course, refers to data streams. When data is transmitted between two serial ports, data loss often occurs, or the processing speed of the two computers is different, such as the communication between the desktop and the single chip microcomputer, the data buffer at the receiving end is full, in this case, the sent data will be lost. Now we can transmit data through modem on the network, which is particularly prominent. Stream Control can solve this problem. When the receiving end cannot process data, it sends a "no longer received" signal, and the sending end stops sending until it receives the "can continue sending" signal and then sends data. Therefore, flow control can control the data transmission process to prevent data loss. Two common traffic control methods in PC are hardware traffic control (including RTS/CTS, DTR/CTS, etc.) and software traffic control Xon/xoff (continue/Stop.
2. Hardware Traffic Control
Hardware traffic control is commonly used, including RTS/CTS traffic control and DTR/DSR (Data Terminal ready/data set ready) Traffic Control.
The hardware traffic control must be connected to the corresponding cable. When you use the RTS/CTS (request sending/clearing sending) traffic control, the RTS and CTS lines at both ends of the communication should be connected accordingly, data Terminal devices (such as computers) Use RTS to start data streams from a modem or other data communication devices, while data communication devices (such as a modem) use CTS to start and pause data streams from the computer. The hardware handshaking process is: we set a high flag (75% of the buffer size) and a low flag (25% of the buffer size) based on the buffer size at the receiver end during programming ), when the data volume in the buffer reaches a high level, we set the CTS line to a low level (send logic 0) at the receiving end. When the sending end detects that the CTS is low, it stops sending data, until the data volume in the acceptor buffer is lower than the low level, CTS is set to a high level. RTS indicates whether the receiving device is ready to receive data.
Common traffic control methods include DTR/DSR (Data Terminal ready/Data ready ). We will not detail it here. Due to the diversity of flow control, I personally think that when the software uses flow control, we should give a detailed description of how to connect and how to apply it.
3. Software Flow Control
Due to the limitations of cables, we generally use software flow control instead of hardware flow control in general control communication. Generally, Xon/xoff is used to implement software flow control. The common method is: when the data volume in the input buffer of the receiving end exceeds the set high, xoff (19 in decimal or control-s in decimal format) is sent to the data sending end, the device programming specification should be described in detail). After receiving the xoff character, the sender immediately stops sending data. When the data volume in the input buffer of the receiver is less than the set low level, send the Xon character (17 or control-Q in decimal format) to the data sender. The sender starts sending the data immediately after receiving the Xon character. Generally, you can find the characters sent from the source program of the device.
It should be noted that if binary data is transmitted, the flag characters may also occur in the data stream and cause misoperations. This is a defect in software flow control, and hardware flow control will not have this problem.