Abstract: Introduced the design method of serial port circuit using programmable logic array to expand 1 RS232 to 4 RS422. The expansion circuit does not occupy PC system resources, and at the same time has the characteristics of simple structure, convenient use, versatility and strong complementability, and can be widely used in master-slave multi-computer communication systems. Because the RS-422 bus has the characteristics of strong anti-interference ability, high communication speed, long communication distance, and communication with multiple slaves, the bus is used in the master-slave multi-machine communication of data acquisition, monitoring management and distributed control systems. It is widely used in the system. However, if too many slaves are connected to an RS-422 communication bus, the bus may be overloaded and the reliability of the system will deteriorate, and sometimes the entire system may not work properly. In order to solve the problems that may occur in the actual application of the RS422 bus, the author designed a serial port expansion circuit with the programmable logic array GAL16V8 as the core. It can expand one RS232 serial port of the microcomputer to four RS-422 serial ports. The circuit can program the DTR and RTS control signals through the host software, and can communicate with the slaves with optional communication interfaces; it can also directly realize the communication between the host and the slaves of all communication interfaces without the DTR and RTS control signals. Data communication can be plug and play without changing the original software. In the actual gas leakage inspection system, the author uses the master-slave multi-machine communication network composed of the expansion circuit to realize the data communication between the host and more than 40 data acquisition devices, and to ensure the stability and reliability of the communication performance. Figure 1 shows the block diagram of this RS-422 serial port expansion circuit. The entire expansion circuit is divided into 4 parts, of which, the first part is the DC-DC isolated power supply. In order to improve the anti-interference ability of the entire system, this circuit uses an isolated power supply for power supply. The second part is the RS-232 interface circuit, which is used to realize the conversion between the RS-232 level and the TTL level of each signal; the third part is the RS485/RS422 interface circuit, which mainly realizes the RS485/RS422 level and TTL of each signal Level conversion; The fourth part is a decoding control circuit with a programmable logic array GAL16V8 as the core, which is mainly used to switch the communication interface. 2.1 DC-DC isolated power supply In order to improve the anti-interference ability of the whole system, this circuit adopts isolated power supply. The working principle of DC-DC isolated power supply is shown in Figure 2. The MAX761 DC-DC conversion chip in the circuit is operated by PFM (Pulse Frequency Modulation Mode), and the highest modulation frequency is 300kHz. The chip contains an error amplifier, a frequency modulator and a power drive tube. The MAX761 only needs a few peripheral components to form a DC-DC power conversion circuit. The LT431 chip in the circuit is an open-collector error amplifier, which contains a 2.5V reference source. When the output voltage drops, R4 voltage, error, LT431 output, optocoupler output current, and R1 voltage all decrease accordingly. When the R1 voltage is less than 1.5V reference voltage, during the positive half cycle of the modulating pulse, the LX terminal outputs a low level? The initial pole current of the pulse transformer increases linearly, and the reverse bias of D1 is cut off. At this time, there is no current in the secondary pole and the pulse transformer starts. Store energy; and in the negative half cycle of the modulated pulse, the LX terminal outputs a high level, the pulse transformer releases energy, and the induced voltage is output through D1 (forward conduction) to increase the output voltage. So that the output voltage remains stable. In fact, when the output voltage rises, the voltage and error on the R4 resistor, the output current of the LT431 output to the optocoupler, and the voltage on R1 all rise accordingly. When the R1 voltage is greater than the 1.5V reference voltage, the When modulating the negative half cycle of the pulse, the LX terminal outputs a high level, and the pulse transformer does not generate voltage. At this time, the load consumption will cause the output voltage to drop. So that the output voltage remains stable. 2.2 RS-232 interface circuit The circuit connection of the serial port expansion circuit is shown in Figure 3. The MAX238 interface chip in the figure contains four RS-232 interface circuits, one of which is used for level conversion of RXD and TXD communication signals, and the other two are used for level conversion of DTR and RTS signals. The status of DTR and RTS can be set through the host software to select the communication interface, so as to realize the data communication between the host and the slave connected to this communication interface. The RS422/RS485 interface circuit consists of 4 (U3~U6) MAX489 chips. The MAX489 chip contains a set of receiving and sending level conversion circuits. This chip is a RS422 interface chip with full-duplex communication. The RE enable terminal (active low) on the chip is used to control data reception, and the DE enable terminal (active high) controls data transmission. In order to facilitate the debugging of the communication system, a light-emitting tube can be installed at the receiving end, the sending end and the sending end of each channel to observe the communication status of each channel. 2.4 Decoding control circuit U1 (GAL16V8) in the circuit is a programmable logic array. Decoding control can be realized by using this chip and programming. Input the communication port selection signals DTR and RTS sent by the host from IN5 and IN6 to U1, and at the same time connect the setting switch K1 to U1 from IN1? In this way, when K1, DTR and RTS are decoded, they can be output from OUT1 to OUT5. The sending enable terminal of U3~U6 can respectively control the data transmitter of the 4 communication ports to complete the data transmission from the host to the selected communication bus; in addition, output to the receiving enable terminal of U3~U6 via OUT5~OUT8, Then the data receivers of the 4 communication ports can be controlled separately, so that the host can finally complete the data receiving function of the slave through the communication bus. The choice of its communication port is listed in Table 1. 3 concluding remarks All chips in the circuit are powered by a +5V single power supply, so the circuit structure is very simple. In addition, the circuit adopts DC-DC isolated power supply for power supply, and the high-speed optocoupler is used for photoelectric isolation between the host and the communication interface, which also enhances the anti-interference ability of the host system. The circuit also has the characteristics of not occupying system resources, simple structure, easy to use, strong versatility and reliable performance. It can be widely used in a master-slave multi-computer communication system in a duplex communication mode. Multi-Port Charger Usb,5V2A Usb Charger,Mobile Phone Charger,Multi Ports Usb-A Charging Hub shenzhen ns-idae technology co.,ltd , https://www.szbestchargers.com
This circuit uses DC-DC isolated power supply, and high-speed optocoupler is used between the host and the communication interface to achieve photoelectric isolation, thereby enhancing the anti-interference ability of the host system. In addition, the extended circuit also has the characteristics of not occupying system resources, simple structure, convenient use, strong versatility and reliable performance. Therefore, it can be widely used in a master-slave multi-computer communication system in a full-duplex communication mode.
1 The overall structure of the circuit
2 The working principle of the circuit
The DC-DC isolated power supply mainly keeps the output voltage stable by adjusting the frequency of the output pulse (adjusting the intermittent time of the pulse). The principle of the voltage stabilization process is:
image 3
2.3 RS422/RS485 interface circuit
Table 1 Communication port selection table K1 DTR RTS Communication port 0 0 0 0 0 0 1 1 0 1 0 2 0 1 1 3 1 X X All