With the widespread application of programmable logic controllers (plc) in the field of industrial control, plc programming has become a professional skill that electrical engineering technicians must master. There are many brands of programmable controllers, and PLCs in Europe, the United States, Japan, South Korea, and Taiwan have rushed to the mainland. While providing users with a variety of choices, they have also caused users a little trouble. Because the programming cables of different brands of PLCs are not universal, buying an original cable often costs thousands of dollars. For technicians whose main purpose is learning and who often encounter PLCs of different brands, if there is a way to make a programming cable for a lower price, it will undoubtedly provide convenience for them. Although there are many brands of PLC, the programming interface of various brands of PLC is nothing more than several types. In the technical manual provided with PLC, the pin definition of the programming port is generally provided, which provides the possibility for self-made programming lines. The following small series on the serial programming interface standards and physical structure of the PLC programming port, detailed instructions on how to DIY an applicable programming cable.

One end of the programming cable is connected to the COM port of the PC, and the other end is connected to the programming port of the PLC. The COM ports on the PC end are RS232C interfaces and DB-9 pin plugs. The programming port of PLC can be generally divided into three types according to the interface standard, namely RS232, RS485, RS422. According to the physical structure, it can be divided into five types, namely eight-pin round port (DIN-8), nine-pin D-port (DB-9), twenty-five-pin D-port (DB-25), RJ11 port and special interface, Most of the former two are.

做好 In order to make a good programming cable, we must first get an overview of these three serial communication interface standards. RS-232, RS-422, and RS-485 are three serial data interface standards. The interface standard only specifies the electrical characteristics of the interface, and does not involve connectors, cables, or protocols. Therefore, the same interface standard can have Different physical structures, such as DB-9, DB-25, etc. RS-232 is the most widely used serial interface in the PC and communication industries. The RS-232C bus standard has 25 signal lines, including a main channel and an auxiliary channel. In most cases, only the main channel is used. Nine signal lines (nine-pin D-shaped port) are commonly used. The definition of each pin is shown in Table 1.

For general duplex communication, only a few signal lines are needed, such as TXD and TXD and GND. RS232C can only communicate point-to-point, with short transmission distance and poor common mode rejection. RS-485 uses balanced transmission and differential reception, so it has the ability to suppress common mode interference. It uses a pair of twisted pairs, one of which is defined as A (TXD- / RXD-) and the other as B (TXD + / RXD +). No digital ground is required. The communication distance is over 1200 meters when the speed is below 100kbps. RS-485 can be networked to form a distributed system, which allows up to 32 drivers and 32 receivers to be connected in parallel. RS-485 can only realize half-duplex communication.

RS-232 interface pin definition

pin 25-pin 9-pin abbreviation description

2 3 TXD send data

3 2 RXD receive data

4 7 RTS request transmission

5 8 CTS allow sending

6 6 DSR communication equipment is ready

7 5 GND Signal ground

8 1 CD carrier detection

20 4 DTR data terminal ready

22 9 RI Ring indicator

The RS-422 interface standard is mainly established to overcome the short communication distance and slow transmission rate of the RS-232 interface standard. The RS-422 standard is a standard for transmitting in a balanced manner. Two pairs of twisted pairs are used, and each signal is transmitted using two signal lines, that is, sending data TXD + and TXD-, and receiving data RXD + and RXD-. It is determined by the potential difference between the two transmission lines. Due to the use of dual-line transmission, the ability to resist common mode interference is greatly enhanced, so the maximum data rate can reach 10MbPs (when transmitting 15m). If the transmission rate drops to 90kbPs, the maximum distance can reach 1200m, which can realize full-duplex communication.

Making of PLC programming cable

厂家 The function of the programming cable of each manufacturer is to convert the RS485 and RS422 format data on the PLC side into the RS232C format data on the PC side. If the PLC end is RS232, it only needs to be directly connected according to the rules. Therefore, if you want to make your own PLC programming cable, you must convert the RS485 and RS422 of the PLC end to RS232C that the PC can recognize, so that the PC can communicate with the PLC and complete the download, upload, and monitoring. This involves the conversion of an interface standard. There are several ways to implement interface conversion: one is to use a simple level-shifting circuit, but one circuit can only target one type of PLC, and has incomplete functions, unreliable performance, and may even damage the serial port of the PC; The IC is converted with a special interface, but it is more complicated to implement in amateur and is not suitable for self-control. Here we use a finished communication interface converter, which can realize the conversion of RS232 / RS485 / RS422. Because it is a dedicated communication interface converter, it is convenient and reliable to use, and the price is relatively low.

There are many such products in the market. Take Sichuan Deyang Four Star Electronics’ SC-485C interface converter as an example. This converter is used for communication conversion from RS232 to RS485 / RS422. It has a small size and only two DB-9 plugs. Using serial port power stealing technology, no external power supply required. . The RS232 end is a DB-9 socket, which can be directly plugged into the COM port of a PC. The RS485 / RS422 end is a DB-9 pin socket. RS485 uses 3 pins and 8 pins, RS422 uses 3 pins, 8 pins, 1 foot and 7 feet. The SC-485C interface converter is on the left, and the programming cables are DIN-8, RJ11, DB-9, and DB25 plugs from top to bottom on the right. , The other ends are pin plugs, which respectively correspond to PLC programming ports of different physical structures.

Select the corresponding pin according to whether the PLC end is RS485 or RS422, and connect according to the rule of “send to receive, receive to send, positive to positive, negative to negative”. To make a programming cable, in addition to the interface conversion between RS232 / RS485 / RS422, you must also understand the definitions of the pins of the PLC programming port, because even if the same interface standard is used, PLCs from different manufacturers have The foot distribution is also different.

An original cable can only be used on one type of PLC, and one interface converter with different connectors can be combined into a set of programming cables, which can be used on almost any brand of PLC. Interface converters and connectors can be bought in the communication market, and the price is cheap. The total cost is only about one tenth of the original cable price, and the production is very simple. The self-made programming cable can complete program uploading, downloading, online monitoring and other functions between the PC and the PLC. It is not inferior to the original cable in terms of functionality and reliability.

Leave a Reply

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