Device for switching communication mode

By using the RS485 drive circuit, communication mode identification circuit and communication logic circuit in the communication device, the RS232 drive circuit and CPU communication unit are selected according to the terminal equipment to communicate with the RS485 drive circuit, which solves the problems of multiple interface configurations and low efficiency in the traditional solution. , improve communication efficiency and protect the communication interface circuit.

CN114063506BActive Publication Date: 2024-10-29PROSE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111340933.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2024-10-29
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

The traditional communication mode switching solution requires the configuration of two sets of communication interfaces, which increases the interface installation space and production and assembly costs, reduces communication efficiency, and is not conducive to protecting the communication interface circuit.

Method used

A device is provided, including an RS485 drive circuit, a communication mode identification circuit and a communication logic circuit. It is connected to a terminal device through a communication interface. According to the terminal device, the RS232 drive circuit and CPU communication unit are selected to implement transceiver communication with the RS485 drive circuit, avoiding the need to configure two sets. Separate communication interface and plug-in operation.

Benefits of technology

It improves communication efficiency, reduces interface installation space and production and assembly costs, and effectively protects communication interface circuits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114063506B_ABST
    Figure CN114063506B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure relate to a device for switching communication modes. The device includes: an RS485 drive circuit, electrically connected to a communication mode identification circuit; a communication interface, used to connect a terminal device, the communication interface includes an RS232 drive circuit and a CPU communication unit; a communication mode identification circuit, used to select at least one of the RS232 drive circuit and the CPU communication unit according to the terminal device connected to the communication interface to realize transceiver communication with the RS485 drive circuit, the communication mode identification circuit is electrically connected to the RS485 drive circuit, the RS232 drive circuit and the communication logic circuit respectively; and a communication logic circuit, electrically connected to the communication mode identification circuit and the CPU communication unit respectively. The present disclosure can improve communication efficiency and protect the communication interface circuit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure generally relate to the field of data communications, and more particularly to a device for switching communication modes. Background Art

[0002] Traditional communication methods can only communicate with RS232 interfaces through RS485 interfaces or with CPU communication units of lower computers through RS485 interfaces through different interface circuits and communication methods. In some application scenarios, the same computing device sometimes needs to communicate with the upper computer through RS232 interfaces, and sometimes needs to communicate with the main control chip of the lower computer through CPU communication interfaces, so it is necessary to switch between the two communication methods.

[0003] The traditional solution for switching communication modes is, for example, that computing devices usually need to be configured with two sets of communication interfaces, one for RS485 interface communication with the upper computer and the other for communication with the lower computer. When switching between the communication mode with the upper computer and the communication mode with the lower computer, the corresponding communication interface needs to be plugged in and out to switch the communication mode. The need to configure two sets of communication interfaces increases the interface installation space and production assembly costs; the need to plug in and out and replace the communication interface easily reduces the communication efficiency, which is not conducive to protecting the communication interface circuit.

[0004] In summary, the disadvantages of the conventional solution for switching communication modes are that it easily increases the interface installation space and production assembly cost, reduces communication efficiency, and is not conducive to protecting the communication interface circuit. Summary of the invention

[0005] A device for switching communication modes is provided, which can improve communication efficiency and effectively protect communication interface circuits.

[0006] According to the first aspect of the present disclosure, a device for switching communication modes is provided. The device includes: an RS485 drive circuit, electrically connected to a communication mode identification circuit; a communication interface, used to connect a terminal device, the communication interface includes an RS232 drive circuit and a CPU communication unit; a communication mode identification circuit, used to select at least one of the RS232 drive circuit and the CPU communication unit according to the terminal device connected to the communication interface to realize transceiver communication with the RS485 drive circuit, the communication mode identification circuit is electrically connected to the RS485 drive circuit, the RS232 drive circuit and the communication logic circuit respectively; and a communication logic circuit, electrically connected to the communication mode identification circuit and the CPU communication unit respectively.

[0007] In some embodiments, the communication mode identification circuit includes an inverter circuit configured with multiple sets of inverters, and the RS232 driving circuit includes an RS232 transceiver.

[0008] In some embodiments, the communication logic circuit includes a logic NAND circuit, and the RS485 driving circuit includes an RS485 transceiver and a switch circuit.

[0009] In some embodiments, the output ends of a group of inverters of the inverter circuit are connected to a switch circuit for switching the levels of the receiver output enable pin and the driver output enable pin input to the RS485 transceiver, and the switch circuit is connected between the inverter circuit and the RS485 transceiver.

[0010] In some embodiments, two input ends of the logic NAND circuit are respectively connected to the second TLL or CMOS signal output pin of the RS232 transceiver and the control output of the CPU communication unit, and the output end of the logic NAND circuit is connected to the input end of the fourth group of inverters of the inverter circuit.

[0011] In some embodiments, the switch circuit includes: a first resistor, a second resistor, a third resistor and a transistor; the output end of the fourth group of inverters of the inverter circuit is connected to the first end of the second resistor, and the second end of the second resistor is grounded via the third resistor.

[0012] In some embodiments, the data transmission end of the CPU communication unit is connected to the first TLL or CMOS signal output pin of the RS232 transceiver and the driver input pin of the RS485 transceiver after two inversions of two sets of inverters of the inverter circuit.

[0013] In some embodiments, the receiving data terminal of the CPU communication unit is connected to the first RS232 input terminal of the RS232 transceiver and the receiver output of the RS485 transceiver after being inverted twice by two sets of inverters of the inverter circuit.

[0014] In some embodiments, the input end of the first group of inverters of the inverter circuit is connected to the data sending end of the CPU communication unit, the output end of the first group of inverters of the inverter circuit is connected to the input end of the second group of inverters, and the output end of the second group of inverters of the inverter circuit is respectively connected to the first TLL or CMOS signal output pin of the RS232 transceiver and the driver input pin of the RS485 transceiver.

[0015] In some embodiments, the input end of the sixth group of inverters of the inverter circuit is respectively connected to the first RS232 input end of the RS232 transceiver and the receiver output of the RS485 transceiver, the output end of the sixth group of inverters of the inverter circuit is connected to the input end of the fifth group of inverters, and the output end of the fifth group of inverters of the inverter circuit is connected to the receiving data end of the CPU communication unit.

[0016] In some embodiments, the receiver output enable pin and the driver output enable pin of the RS485 transceiver are connected to the second end of the first resistor and the emitter set of the transistor, the first end of the first resistor is connected to the power supply, the base of the transistor is connected to the second end of the second resistor and the first end of the third resistor, and the second end of the third resistor is connected to the collector of the transistor and grounded.

[0017] In some embodiments, a receiver output of the RS485 transceiver is connected to a first RS232 input of the RS232 transceiver, and a driver input pin of the RS485 transceiver is connected to a first TLL or CMOS signal output pin of the RS232 transceiver.

[0018] In some embodiments, the inverter circuit is configured such that when receiving data via the RS485 interface, the inverter circuit outputs a level representing logic "0" via the output terminal of the fourth group of inverters, so that the level of the driver output enable pin of the RS485 transceiver represents logic "1" so that the driver of the RS485 transceiver works.

[0019] In some embodiments, the inverter circuit is configured such that when data is sent via the RS485 interface, the inverter circuit outputs a level representing logic "1" via the output end of the fifth group of inverters, so that the level of the receiver output enable pin of the RS485 transceiver represents logic "0" so that the receiver of the RS485 transceiver works.

[0020] In some embodiments, the inverter circuit is configured such that when a logic "0" is sent via the RS232 interface, the inverter circuit outputs a level representing a logic "0" via the output end of the fourth group of inverters, so that the level of the driver output enable pin of the RS485 transceiver represents a logic "1" so that the driver can work.

[0021] In some embodiments, the inverter circuit is configured such that when a logic "1" is sent via the RS232 interface, the inverter circuit outputs a level representing a logic "1" via the output end of the fourth group of inverters, so that the level of the driver output enable pin of the RS485 transceiver represents a logic "0", and the level of the receiver output enable pin represents a logic "0", so that the driver output is in a high impedance state.

[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.

[0024] Figure 1 A schematic diagram of an apparatus 100 for switching communication modes according to an embodiment of the present disclosure is shown.

[0025] Figure 2 A circuit diagram of a device 200 for switching communication modes according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0027] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same samples. Other explicit and implicit definitions may also be included below.

[0028] As described above, in the conventional solution for switching communication modes, two sets of communication interfaces need to be configured. When switching between the communication mode with the upper computer and the communication mode with the lower computer, the corresponding communication interface needs to be plugged in and out to switch the communication mode. As a result, the interface installation space and production assembly cost are increased, the communication efficiency is reduced, and it is not conducive to protecting the communication interface circuit.

[0029] In order to at least partially solve one or more of the above problems and other potential problems, an exemplary embodiment of the present disclosure proposes a device for switching communication modes. In this scheme, a communication interface includes an RS232 drive circuit and a CPU communication unit, and a communication mode identification circuit is electrically connected to an RS485 drive circuit, an RS232 drive circuit, and a communication logic circuit respectively, so as to select at least one of the RS232 drive circuit and the CPU communication unit based on the terminal device connected to the communication interface to realize the transceiver communication with the RS485 drive circuit. The present disclosure does not need to configure two sets of discrete communication interfaces, and can quickly realize the switching of communication modes without plugging and unplugging the communication interface, so that the communication efficiency can be effectively improved and the communication interface circuit is protected.

[0030] Hereinafter, specific examples of the present solution will be described in more detail with reference to the accompanying drawings.

[0031] Figure 1 FIG. 1 is a schematic diagram of an apparatus 100 for switching a communication mode according to an embodiment of the present disclosure. Figure 1 As shown, the system 100 includes an RS485 drive circuit 140, a communication mode identification circuit 110, a communication logic circuit 120 and a communication interface ( Figure 1 The communication interface includes an RS232 driving circuit 130 and a CPU communication unit 170.

[0032] Regarding the communication interface, it is used to connect the terminal device. The terminal device connected to the communication interface includes, for example, a host computer connected via an RS232 drive circuit and a main control chip of a slave computer connected via a CPU communication unit. Regarding the main control chip, it is, for example, at least one of MCU, FPGA, DSP, ARM, etc.

[0033] Regarding the RS232 driving circuit, it includes, for example, an RS232 transceiver. The RS232 transceiver is used, for example, to convert the signal level (e.g., -10, +10v) of the RS232 interface into the TTL signal level (e.g., 0, +5) used by the single-chip microcomputer. In some embodiments, the RS232 transceiver may be a ZT3232LEEA transceiver. It should be understood that the RS232 driving circuit may also include other types of transceiver chips. Figure 1 As shown, the RS232 driving circuit is electrically connected to the RS485 driving circuit 140 and the communication logic circuit 120. For example, the TLL or CMOS signal output pin (for example but not limited to the second TLL or CMOS signal output pin R2OUT) of the RS232 transceiver in the RS232 driving circuit 130 is connected to an input (for example, the first input terminal, terminal A) of the communication logic circuit 120.

[0034] About RS485 driving circuit 140, it for example comprises RS485 transceiver and switch circuit.In certain embodiments, RS485 transceiver can be ZT3485LEEN transceiver.It should be understood that RS485 transceiver can also be transceiver chip of other models.Switch circuit is connected between inverter circuit and RS485 transceiver.

[0035] The RS485 drive circuit 140 is electrically connected to the communication mode identification circuit 110. The RS485 drive circuit 140 can also be electrically connected to the RS232 drive circuit 130. For example, the receiver output pin (RO) of the RS485 transceiver in the RS485 drive circuit 140 is connected to the first transmission input terminal (T1IN) of the RS232 transceiver 232 in the RS232 drive circuit 130; and the driver input pin (DI) of the RS485 transceiver in the RS485 drive circuit 140 is connected to the first TLL or CMOS signal output pin (R1OUT) of the RS232 transceiver 232 in the RS232 drive circuit 130.

[0036] Regarding the communication mode identification circuit 110, it is used to select at least one of the RS232 drive circuit 130 and the CPU communication unit 170 according to the terminal device connected to the communication interface 160 to realize the transceiver communication with the RS485 drive circuit 140. In some embodiments, the communication mode identification circuit 110 may include an inverter circuit configured with multiple sets of inverters. For example, the communication mode identification circuit 110 includes a 74HC04D chip configured with six sets of inverters. It should be understood that the communication mode identification circuit 110 may also include multiple sets of inverters of other models.

[0037] The communication mode identification circuit 110 is electrically connected to the RS485 driving circuit 140 , the CPU communication unit 170 and the communication logic circuit 120 , respectively.

[0038] Regarding the electrical connection between the communication mode identification circuit 110 and the CPU communication unit 170, for example, an input of an inverter of the communication mode identification circuit 110 (for example, but not limited to, the input end of the first set of inverters, 1A) is connected to a data transmission end (for example, TX_CPU, Figure 1 and the output of another inverter of the communication mode identification circuit 110 (for example, but not limited to, the output terminal of the fifth set of inverters, 5Y) is connected to the receiving data terminal 274 (for example, RX_CPU, Figure 1 not shown).

[0039] Regarding the electrical connection between the communication mode identification circuit 110 and the RS485 drive circuit 140, for example, the output end of an inverter (for example, but not limited to, the fourth inverter) of the communication mode identification circuit 110 is connected to the switch circuit for switching the level of the receiver output enable pin and the driver output enable pin of the RS485 transceiver. For example, through the switching of the switch circuit, the receiver output enable pin (for example, ) and the driver output enable pin (e.g., DE) vary between logic "0" and logic "1" to respectively enable or disable the receiver or driver of the RS485 transceiver, thereby realizing data reception and transmission of the RS485 transceiver, so as to realize transceiver communication with at least one of the RS232 drive circuit and the CPU communication unit. In some embodiments, the output end of an inverter of the communication mode identification circuit 110 (e.g., but not limited to, the output end of the second group of inverters, 2Y) is connected to the driver input pin (DI) of the RS485 transceiver in the RS485 drive circuit 140; and the input end of another inverter of the communication mode identification circuit 110 (e.g., but not limited to, the input end of the sixth group of inverters, 6A) is connected to the receiver output pin (RO) of the RS485 transceiver in the RS485 drive circuit 140.

[0040] Regarding the electrical connection between the communication mode identification circuit 110 and the communication logic circuit 120 , for example, the output end of the logic circuit 120 is connected to the input end of an inverter of the communication mode identification circuit 110 (for example but not limited to the input end 4A of the fourth inverter).

[0041] In some embodiments, the communication logic circuit 120 can be a logic NAND circuit. Regarding the communication logic circuit 120, it is electrically connected to the communication mode identification circuit 110 and the CPU communication unit 170, respectively. For example, the two input terminals of the logic NAND circuit (for example, the first input terminal, terminal A; the second input terminal, terminal B) are respectively connected to the second TLL or CMOS signal output pin of the RS232 transceiver and the control output of the CPU communication unit (for example, 485_CONTROL_CPU). Thus, the communication logic circuit 120 can control the output terminal signal of the communication logic circuit 120 according to the signal of the TLL or CMOS signal output pin in the RS232 drive circuit and the control output signal of the CPU communication unit 170. The output of the logic circuit 120 is connected to the switch circuit via an inverter output of the communication mode identification circuit 110, so as to switch the receiver output enable pin (for example, 485_CONTROL_CPU) of the input RS485 transceiver. ) and the level of the driver output enable pin (e.g., DE) to respectively enable the receiver or driver of the RS485 driver circuit 140. Thus, data transmission and reception between the RS485 driver circuit 140 and the RS232 driver circuit 130 or the CPU communication unit 170 is realized.

[0042] Figure 2 FIG. 2 shows a circuit diagram of a device 200 for switching communication modes according to an embodiment of the present disclosure. It should be understood that Figure 2 The illustrated apparatus 200 may further include additional components not shown and / or may omit illustrated components, and the scope of the present disclosure is not limited in this respect.

[0043] like Figure 2 As shown, the device 200 includes a communication mode identification circuit 210, a communication logic circuit 220, an RS232 drive circuit 230, an RS485 drive circuit 240 and a CPU communication unit 270. The RS232 drive circuit and the CPU communication unit are integrated in a communication interface (not shown).

[0044] Regarding the communication mode identification circuit 210, it includes, for example, an inverter circuit 212 and a first capacitor C1. The inverter circuit 212 is, for example but not limited to, a 74HC04D chip configured with six sets of inverters. The input ends of the six sets of inverters are indicated by 1A, 2A, 3A, 4A, 5A and 6A respectively, and the output ends of the corresponding six sets of inverters are indicated by 1Y, 2Y, 3Y, 4Y, 5Y and 6Y respectively.

[0045] Regarding the CPU communication unit 270, it includes, for example, a data transmission terminal 274 (eg, TX_CPU), a data reception terminal 272 (eg, RX_CPU), and a control output (eg, Figure 2 The data transmission terminal 274 (e.g., TX_CPU) of the CPU communication unit 270 is connected to the first TLL or CMOS signal output pin (R1OUT) of the RS232 transceiver 232 and the driver input pin (DI) of the RS485 transceiver after being inverted twice by two sets of inverters (e.g., a first set of inverters and a second set of inverters) of the inverter circuit 212. Specifically, the input end (1A) of the first group of inverters of the inverter circuit 212 is connected to the data transmission end 274 (TX_CPU) of the CPU communication unit 270, and the output end (1Y) of the first group of inverters of the inverter circuit 212 is connected to the input end (2A) of the second group of inverters; the output end (2Y) of the second group of inverters of the inverter circuit 212 is respectively connected to the first TLL or CMOS signal output pin (R1OUT) of the RS232 transceiver 232 and the driver input pin (DI) of the RS485 transceiver 242.

[0046] The receiving data terminal 272 (RX_CPU) of the CPU communication unit 270 is connected to the first transmitting input terminal (T1IN) of the RS232 transceiver 232 and the receiver output pin (RO) of the RS485 transceiver 242 after two inversions of two sets of inverters (e.g., the fifth set of inverters and the sixth set of inverters) of the inverter circuit 212. Specifically, the output terminal (5Y) of the fifth set of inverters of the inverter circuit 212 is connected to the receiving data terminal 272 (RX_CPU) of the CPU communication unit. The input terminal (5A) of the fifth set of inverters of the inverter circuit 212 is connected to the output terminal (6Y) of the sixth set of inverters, and the input terminal (6A) of the sixth set of inverters of the inverter circuit 212 is respectively connected to the first RS232 input terminal (T1IN) of the RS232 transceiver 232 and the receiver output (RO) of the RS485 transceiver 242.

[0047] Regarding the communication logic circuit 220, it includes, for example, a logic NAND circuit 222, a seventh resistor R7, an eighth resistor R8, and a tenth capacitor C10. The logic NAND circuit 222 is, for example, a logic NAND circuit, which is used to perform an AND operation on the signals received by two input terminals (for example, the A terminal and the B terminal), and then perform a NAND operation on the AND operation result, so as to output the calculation result through the output terminal (for example, the Y terminal). The following is a logical expression of the logic NAND circuit 222 in combination with formula (1).

[0048]

[0049] In the above formula (1), X A represents the input signal of the first input terminal (eg, terminal A) of the logic NAND circuit 222. B represents an input signal of the second input terminal (eg, terminal B) of the logic NAND circuit 222. Y represents an output signal of the output terminal (eg, terminal Y).

[0050] The two input terminals (eg, terminal A and terminal B) of the logic NAND circuit 222 are respectively connected to the second TLL or CMOS signal output pin (R2OUT) of the RS232 transceiver 232 and the control output (eg, Figure 2 For example, the first input terminal (eg, terminal A) of the logic NAND circuit 222 is connected to the power supply (eg, Figure 2 The first input terminal (e.g., terminal A) of the logic NAND circuit 222 is also connected to the second TLL or CMOS signal output pin (R2OUT) of the RS232 transceiver 232. The second input terminal (e.g., terminal B) of the logic NAND circuit 222 is connected to the power supply (e.g., terminal 10) via the resistor R7. Figure 2MCU_3V3); the second input terminal (eg, terminal B) of the logic NAND circuit 222 is also connected to the control output (eg, terminal B) of the power supply CPU communication unit. Figure 2 It should be understood that when the CPU communication unit sends data, the control output of the CPU communication unit (for example, Figure 2 485_CONTROL_CPU) output represents the logic "0" level. When the CPU communication unit does not send data, the control output of the CPU communication unit (for example, Figure 2 The 485_CONTROL_CPU) output represents the level of logic "1".

[0051] The output terminal (e.g., Y terminal) of the logic NAND circuit 222 is connected to the input terminal (e.g., 4A) of the fourth group of inverters of the inverter circuit 212. The output terminal (e.g., 4Y) of the fourth group of inverters of the inverter circuit 212 is connected to the first terminal of the second resistor of the switch circuit, and the second terminal of the second resistor is grounded via the third resistor. The switch circuit includes a first resistor R1, a second resistor R2, a third resistor R3 and a transistor. The first terminal of the first resistor R1 is connected to a power supply, the base of the transistor is connected to the second terminal of the second resistor R2 and the first terminal of the third resistor R3, and the second terminal of the third resistor R3 is connected to the collector of the transistor and grounded. The power supply terminal (e.g., VCC) of the logic NAND circuit 222 is connected to a power supply (e.g., Figure 2 MCU_3V3), the power supply terminal (for example, VCC) of the logic NAND circuit 222 is also grounded via the tenth capacitor C10. Regarding the RS485 drive circuit 240, it includes, for example: an RS485 transceiver 242, a first resistor R1, a second resistor R2, a third resistor R3, a triode, a fourth resistor R4, a fifth resistor R5, a sixth resistor R6, a seventh capacitor C7, and an RS485 interface (or template) of an RS485 interface (or template) (for example, a first connection terminal 262, a second connection terminal 264 of the RS485 interface (or template)). The RS485 transceiver 242 is, for example, an RS485 transceiver chip, which is, for example but not limited to, a ZT3485LEEN transceiver.

[0052] like Figure 2 As shown, the RS485 transceiver 242 includes 8 pins, which are a receiver output pin (e.g., RO), a receiver output enable pin (e.g., ), driver output enable pin (e.g., DE), driver input pin (e.g., DI), ground GND, driver output / receiver input (in-phase) pin (e.g., A / Y), driver output / receiver input (inverting) pin (e.g., B / Z), and power supply Vcc.

[0053] The power supply Vcc of the RS485 transceiver 242 is connected to a power supply (eg, Figure 2 MCU_3V3), the power supply Vcc of the RS485 transceiver 242 is also grounded via the seventh capacitor C7. The ground GND of the RS485 transceiver 242 is grounded. The driver output / receiver input (inverting) pin (e.g., B / Z) of the RS485 transceiver 242 is grounded via the sixth resistor R6. A fifth resistor R5 is connected between the driver output / receiver input (inverting) pin (e.g., B / Z) and the driver output / receiver input (in-phase) A / Y of the RS485 transceiver 242. The driver output / receiver input (in-phase) A / Y is connected to the power supply (e.g., Figure 2 The driver output / receiver input (in phase) A / Y of the RS485 transceiver 242 is connected to the first connection terminal 262 of the RS485 interface (or template). The driver output / receiver input (in phase) pin (e.g., B / Z) of the RS485 transceiver 242 is connected to the second connection terminal 264 of the RS485 interface (or template).

[0054] The RS485 transceiver 242 includes a driver and a receiver. A logic high level on the driver output enable pin (e.g., DE) enables the driver to work, i.e., the driver differential output; if the driver output enable pin (e.g., DE) is low, the driver output presents a high impedance state. The following describes the transmit function truth table of the RS485 transceiver 242 in conjunction with Table 1.

[0055] Table 1

[0056]

[0057] The receiver (e.g., R) input is a differential input that is enabled through the receiver output enable pin (e.g., ) to enable the receiver, when the receiver output enables the pin (for example, ) is low, the receiver is enabled (or working); when the receiver output enable pin (for example, ) is high, the receiver is disabled. The following describes the receiving function truth table of the RS485 transceiver 242 in conjunction with Table 2.

[0058] Table 2

[0059]

[0060] like Figure 2 As shown, the receiver output enable pin (eg, ) and a driver output enable pin (e.g., DE) are connected to the second end of the first resistor R1 and the emitter of the transistor, the first end of the first resistor R1 is connected to the power supply, the base of the transistor is connected to the second end of the second resistor R2 and the first end of the third resistor R3, the second end of the third resistor R3 is connected to the collector of the transistor and grounded. The receiver output pin (e.g., RO) of the RS485 transceiver 242 is connected to the first TLL or CMOS signal input pin (e.g., T1IN) of the RS232 driver circuit, the driver input pin (e.g., DI) of the RS485 transceiver 242 is connected to the first TLL or CMOS signal output pin (e.g., R1OUT) of the RS232 transceiver 232.

[0061] The receiver output pin (e.g., RO) of the RS485 transceiver 242 is connected to the first TLL or CMOS signal input pin (e.g., T1IN) of the RS232 transceiver 232, and the driver input pin (e.g., DI) of the RS485 transceiver 242 is connected to the first TLL or CMOS signal output pin (e.g., R1OUT) of the RS232 transceiver 232. In addition, the receiver output pin (e.g., RO) of the RS485 transceiver 242 is also connected to the input end (e.g., 6A) of the sixth inverter of the inverter circuit 212, and the driver input pin (e.g., DI) of the RS485 transceiver 242 is also connected to the output end (e.g., 2Y) of the second inverter of the inverter circuit 212.

[0062] The RS232 driving circuit 230 includes, for example, an RS232 transceiver 232, a second capacitor C2, a third capacitor C3, a fourth capacitor C4, a fifth capacitor C5, a sixth capacitor C6, and RS232 input and output signal terminals (for example, RS232 output signal terminal 252, RS232 input signal terminal 254). The RS232 transceiver 232 is, for example, an RS232 transceiver chip, which is used to convert the RS232 interface signal level (10, +10V) into a TTL signal level (0, +5V) used by the single-chip microcomputer. The RS232 transceiver 232 is, for example, but not limited to, a ZT3232LEEA transceiver.

[0063] like Figure 2 As shown, the power supply Vcc of the RS232 transceiver 232 is connected to a power supply (eg, Figure 2MCU_3V3), the power supply Vcc is also grounded via the second capacitor C2. The V+ pin of the RS232 transceiver 232 is grounded via the third capacitor C3. The V- pin of the RS232 transceiver 232 is grounded via the sixth capacitor C6. The GND pin of the RS232 transceiver 232 is grounded. A fourth capacitor C4 is connected between the C1+ pin and the C1- pin of the RS232 transceiver 232. A fifth capacitor C5 is connected between the C2+ pin and the C2- pin of the RS232 transceiver 232. A first RS232 output (e.g., T10UT) pin of the RS232 transceiver 232 is connected to the RS232 output signal terminal 252, and a first RS232 input (e.g., R1IN) pin of the RS232 transceiver 232 is connected to the RS232 input signal terminal 254. A second RS232 input (R2IN) pin of the RS232 transceiver 232 is also connected to the RS232 input signal terminal 254 .

[0064] The following combination Figure 2 Describes the process of sending data via the RS485 interface.

[0065] When sending data via RS485 interface, data is sent from RS485 interface end to terminal device, and receiver output pin (e.g., RO) of RS485 transceiver 242 outputs TTL level data. Because receiver output pin (e.g., RO) of RS485 transceiver 242 is connected to first TLL or CMOS signal input pin (T1IN) of RS232 transceiver 232. At this time, if terminal device is terminal device connected via RS232 interface, because RS232 transceiver 232 is in receiving state, data will not be sent. According to protocol RS232 protocol output high level, that is, logic "1". The level of output of first TLL or CMOS signal output pin (R1OUT) of RS232 transceiver 232 represents logic "1" (i.e., high level), and second TLL or CMOS signal output pin (R1OUT) of RS232 transceiver 232 outputs the level representing logic "1".

[0066] It should be understood that the receiver output pin (e.g., RO) of the RS485 transceiver 242 outputs TTL level data and is also connected to the input end (e.g., 6A) of the sixth group of inverters of the inverter circuit 212, and is connected to the receiving data end 272 of the CPU communication unit via two groups of inverters and the output end (e.g., 5Y) of the fifth group of inverters.

[0067] In addition, when sending data via the RS485 interface, the control output of the CPU communication unit (for example, Figure 2485_CONTROL_CPU) outputs a level representing a logic "1". In addition, the second TLL or CMOS signal output pin (R1OUT) of the RS232 transceiver 232 outputs a level representing a logic "1". The first input terminal (e.g., terminal A) and the second input terminal (e.g., terminal B) of the logic NAND circuit 222 are both levels representing a logic "1". The level representing a logic "0" is output via the output terminal (e.g., terminal Y) of the logic NAND circuit 222, and the level representing a logic "0" is input to the input terminal (e.g., 4A) of the fourth group of inverters of the inverter circuit 212. After being inverted by the fourth group of inverters, the output terminal (e.g., 4Y) of the fourth group of inverters outputs a level representing a logic "1". The logic "1" makes the voltage value of the second terminal of the second resistor R1 greater than the conduction voltage of the transistor, and therefore, the transistor is turned on. The level of the driver output enable pin (eg, DE) of the RS485 transceiver 242 represents a logic "0" (ie, a low level), and the receiver output enable pin (eg, ) represents a logic "0", at which time, the receiver (e.g., R) of the RS485 transceiver 242 works. The data from the RS485 interface outputs TTL level data via the receiver output pin (e.g., RO) of the RS485 transceiver 242, and the TTL level data is sent to the CPU communication unit via the first TLL or CMOS signal input pin (T1IN) of the RS232 transceiver 232, and is sent to the CPU communication unit via the receiving data terminal 272 of the CPU communication unit.

[0068] Thus, when the present disclosure sends data via the RS485 interface, the communication mode identification circuit outputs a logic "1" through the output end of the fifth set of inverters, so that the receiver output enable pin (e.g., ) represents a logic "0" so that the receiver (eg, R) of the RS485 transceiver 242 works, thereby realizing data reception and transmission between the CPU communication unit and the RS232 transceiver 232 and the RS485 driving circuit.

[0069] The following combination Figure 2 Describes the process of receiving data via the RS485 interface.

[0070] When receiving data via the RS485 interface, the data is received from the driver input pin (e.g., DI) of the RS485 transceiver 242 at a TTL level. If it is determined that the connected terminal device is a terminal device connected via the CPU communication unit, and it is determined that the CPU communication unit sends data, the control output of the CPU communication unit (e.g., Figure 2485_CONTROL_CPU) for example, the level determined represents a logic "0". The level representing the logic "0" of the control output of the CPU communication unit is input to the second input terminal (for example, the B terminal) of the logic NAND circuit 222, and then, the level representing the logic "1" is output through the output terminal (for example, the Y terminal) of the logic NAND circuit 222. After that, the output representing the logic "1" level is input to the input terminal (for example, 4A) of the fourth group of inverters of the inverter circuit 212. After being inverted by the fourth group of inverters, the output terminal (for example, 4Y) of the fourth group of inverters outputs a level representing a logic "0". The logic "0" makes the voltage value of the second end of the second resistor R1 less than the conduction voltage of the transistor, so the transistor is not turned on. The level of the driver output enable pin (for example, DE) of the RS485 transceiver 242 represents a logic "1", and the receiver output enable pin (for example, ) represents logic "1", at this time, the driver (e.g., D) of RS485 transceiver 242 works. It should be understood that the output data of the send data terminal 274 of the CPU communication unit is input to the input terminal (e.g., 1A) of the first group of inverters of the inverter circuit 212, and after two inversions by the first group of inverters and the second group of inverters, the output terminal (e.g., 2Y) of the second group of inverters is connected to the driver input pin (e.g., DI) of the RS485 drive circuit, and the driver (e.g., D) of the RS485 transceiver 242 works, and the driver input pin (e.g., DI) of the RS485 transceiver 242 can receive TTL level data to be sent to the RS485 interface. Therefore, the RS485 transceiver 242 receives the output data sent by the send data terminal 274 of the CPU communication unit.

[0071] Therefore, when the inverter circuit 212 of the present invention receives data via the RS485 interface, the communication mode identification circuit can output a level representing logic "0" via the output end of the fourth group of inverters, so that the level of the driver output enable pin (for example, DE) of the RS485 transceiver 242 represents logic "1", so that the driver (for example, D) of the RS485 transceiver 242 works, and then the CPU communication unit and the RS485 drive circuit are selected to respectively realize data sending and receiving.

[0072] The following combination Figure 2 Describes the process of sending data via the RS232 interface.

[0073] When sending data via the RS232 interface, if logic "0" is sent via the RS232 interface, according to the RS232 protocol, the outputs of the first TLL or CMOS signal output pin (R1OUT) and the second TLL or CMOS signal output pin (R2OUT) of the RS232 transceiver 232 are both low levels representing logic "0". The output of the second TLL or CMOS signal output pin (R2OUT) represents the level of logic "0" and is input to the first input terminal (e.g., terminal A) of the logic NAND circuit 222, and outputs the level of logic "1" through the output terminal (e.g., terminal Y) of the logic NAND circuit 222. Then, the logic "1" is input to the input terminal (e.g., 4A) of the fourth group of inverters of the inverter circuit 212, and after being inverted by the fourth group of inverters, the output terminal (e.g., 4Y) of the fourth group of inverters outputs the level of logic "0". The logic "0" makes the voltage value of the second terminal of the second resistor R1 less than the conduction voltage of the transistor, so the transistor is not turned on. The level of the driver output enable pin (e.g., DE) of the RS485 transceiver 242 represents logic "1", and the receiver output enable pin (e.g., ) represents a logic "1", at which time, the driver D of the RS485 transceiver 242 works. The driver input pin (eg, DI) of the RS485 transceiver 242 can correctly receive the data logic "0".

[0074] Thereby, when the inverter circuit 212 of the present invention sends a logic "0" via the RS232 interface, the inverter circuit 212 can output a level representing a logic "0" via the output end of the fourth group of inverters (e.g., 4Y), so that the level of the driver output enable pin (e.g., DE) of the RS485 transceiver 242 represents a logic "1", so that the driver D can be connected to work, and then the RS232 drive circuit and the RS485 drive circuit are selected to respectively realize the sending and receiving of the logic "0".

[0075] If RS232 sends a logic "1", according to the RS232 protocol, the first TLL or CMOS signal output pin (R1OUT) and the second TLL or CMOS signal output pin (R2OUT) of the RS232 transceiver 232 both output a level representing a logic "1". The logic "1" is input to the first input terminal (e.g., terminal A) of the logic NAND circuit 222. At this time, the control output (e.g., terminal A) of the CPU communication unit Figure 2The level of 485_CONTROL_CPU in the RS485_CONTROL_CPU represents a logic "1", and the level representing a logic "0" is outputted through the output terminal (e.g., Y terminal) of the logic NAND circuit 222. The logic "0" is inputted to the input terminal (e.g., 4A) of the fourth inverter group of the inverter circuit 212. After being inverted by the fourth inverter group, the output terminal (e.g., 4Y) of the fourth inverter group outputs a level representing a logic "1". The logic "1" is connected to the first terminal of the second resistor R1, so that the voltage value of the second terminal of the second resistor R1 is greater than the conduction voltage of the transistor. Therefore, the transistor is turned on, and the level of the driver output enable pin (e.g., DE) of the RS485 transceiver 242 represents a logic "0", and the receiver output enable pin The level represents logic "0". According to Table 1 and Table 2 above, at this time, the driver output is in high impedance state, and when the 485 bus is in high impedance state, the result received is logic "1". This is exactly the logic "1" sent by RS232.

[0076] Therefore, when RS232 sends logic "1", the inverter circuit 212 of the present disclosure can make the driver output of the RS485 transceiver 242 present a high impedance state, and then select the RS232 drive circuit and the RS485 drive circuit to respectively realize the sending and receiving of logic "1".

[0077] In the above scheme, the communication interface includes an RS232 drive circuit and a CPU communication unit, and the communication mode identification circuit is electrically connected to the RS485 drive circuit, the RS232 drive circuit, and the communication logic circuit respectively, so as to select at least one of the RS232 drive circuit and the CPU communication unit based on the terminal device connected to the communication interface to realize the transceiver communication with the RS485 drive circuit. The present disclosure does not need to configure two sets of discrete communication interfaces, and can quickly realize the switching of communication modes without plugging and unplugging the communication interface, so it can effectively improve the communication efficiency and protect the communication interface circuit. .

[0078] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A device for switching a communication mode, comprising: RS485 driving circuit, electrically connected to the communication mode identification circuit; A communication interface, used to connect to a terminal device, the communication interface comprising an RS232 drive circuit and a CPU communication unit; A communication mode identification circuit, used for selecting at least one of the RS232 drive circuit and the CPU communication unit to realize transceiver communication with the RS485 drive circuit according to the terminal device connected to the communication interface, wherein the communication mode identification circuit is electrically connected to the RS485 drive circuit, the RS232 drive circuit and the communication logic circuit respectively; and The communication logic circuit is electrically connected to the communication mode identification circuit and the CPU communication unit respectively; The communication mode identification circuit includes an inverter circuit configured with a plurality of sets of inverters; The RS485 driving circuit comprises a switch circuit and an RS485 transceiver; The input end of one inverter of the communication mode identification circuit is connected to the data transmission end of the CPU communication unit, and the output end of the other inverter is connected to the data reception end of the CPU communication unit; The output end of an inverter of the communication mode identification circuit is connected to the switch circuit, the output end of an inverter of the communication mode identification circuit is connected to the driver input pin of the RS485 transceiver in the RS485 drive circuit, and the input end of another inverter of the communication mode identification circuit is connected to the receiver output pin of the RS485 transceiver in the RS485 drive circuit; The input end of the communication logic circuit is connected to the RS232 drive circuit and the control output end of the CPU communication unit respectively, and the output end is connected to the switch circuit via the output of an inverter of the communication mode identification circuit.

2. The device of claim 1, wherein the RS232 driver circuit comprises an RS232 transceiver.

3. The device of claim 2, wherein the communication logic circuit comprises a logic NAND circuit.

4. device according to claim 3, two input ends of wherein said logical and non-circuit are connected respectively to the second TLL or CMOS signal output pin of RS232 transceiver and the control output of CPU communication unit, and the output end of said logical and non-circuit is connected to the input end of the fourth group of inverters of said inverter circuit.

5. The apparatus according to claim 3, wherein the switch circuit comprises: A first resistor, a second resistor, a third resistor and a triode; The output end of the fourth group of inverters of the inverter circuit is connected to the first end of the second resistor, and the second end of the second resistor is grounded via the third resistor.

6. device according to claim 3, wherein the transmission data end of CPU communication unit is connected to first TLL or CMOS signal output pin of described RS232 transceiver and the driver input pin of described RS485 transceiver after twice inversion of two groups of inverters of described inverter circuit.

7. The device according to claim 3, wherein the receiving data end of the CPU communication unit is connected to the first RS232 input end of the RS232 transceiver and the receiver output of the RS485 transceiver after being inverted twice by two sets of inverters of the inverter circuit.

8. device according to claim 6, the input end of the first group of inverters of wherein said inverter circuit connects the transmission data end of CPU communication unit, the output end of the first group of inverters of said inverter circuit connects the input end of the second group of inverters, and the output end of the second group of inverters of said inverter circuit connects a first TLL or CMOS signal output pin of said RS232 transceiver and the driver input pin of said RS485 transceiver respectively.

9. device according to claim 7, the input end of the sixth group of inverters of wherein said inverter circuit is connected respectively to the first RS232 input end of said RS232 transceiver and the receiver output of said RS485 transceiver, the output end of the sixth group of inverters of said inverter circuit is connected to the input end of the fifth group of inverters, and the output end of the fifth group of inverters of said inverter circuit is connected to the receiving data end of a CPU communication unit.

10. The device according to claim 5, wherein the receiver output enable pin and the driver output enable pin of the RS485 transceiver are connected to the second end of the first resistor and the emitter set of the triode, the first end of the first resistor is connected to a power supply, the base of the triode is connected to the second end of the second resistor and the first end of the third resistor, and the second end of the third resistor is connected to the collector of the triode and grounded.

11. device according to claim 1, wherein the receiver output of RS485 transceiver is connected to a first RS232 input terminal of RS232 transceiver, and the driver input pin of RS485 transceiver is connected to a first TLL or CMOS signal output pin of RS232 transceiver.

12. device according to claim 2, wherein inverter circuit is configured to: when receiving data via RS485 interface, the inverter circuit outputs the level of representative logic "0" via the output terminal of the 4th group of inverters, so that the level of the driver output enable pin of RS485 transceiver represents logic "1", so that the driver of RS485 transceiver works.

13. device according to claim 2, wherein inverter circuit is configured to: when sending data via RS485 interface, the inverter circuit outputs the level of logic "1" via the output terminal of the fifth group of inverters, so that the level of the receiver output enable pin of RS485 transceiver represents logic "0", so that the receiver of RS485 transceiver works.

14. The device according to claim 2, wherein the inverter circuit is configured to: when sending a logic "0" via the RS232 interface, the inverter circuit outputs a level representing a logic "0" via the output terminal of the fourth group of inverters, so that the level of the driver output enable pin of the RS485 transceiver represents a logic "1" to connect the driver to work.

15. The device according to claim 2, wherein the inverter circuit is configured to: when sending a logic "1" via the RS232 interface, the inverter circuit outputs a level representing a logic "1" via the output terminal of the fourth group of inverters, so that the level of the driver output enable pin of the RS485 transceiver represents a logic "0", and the level of the receiver output enable pin represents a logic "0", so that the driver output presents a high-impedance state.

Citation Information

Patent Citations

  • Charging base of adaptive switching communication interface

    CN107565632A

  • Intelligence switch circuit based on two 485 communications

    CN206805214U