Communication interface level matching circuit and single-chip microcomputer
By using voltage comparators and selectors in the microcontroller to connect to external chips to achieve level matching, it solves the problems of high cost and poor compatibility when the levels of the MCU and other chips are different, and improves economic benefits and structural utilization.
Patent Information
- Application Number
- CN202420282781.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2024-09-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, when the working levels of the MCU and other chips are different, a level conversion chip needs to be added, which results in high costs and takes up PCB space, affecting economic benefits and structural utilization.
Design a communication interface level matching circuit, using the voltage comparator in the microcontroller to connect to the external chip, achieving level matching through the selector and potentiometer, and dynamically adjusting the input voltage of the voltage comparator to be compatible with different levels.
It reduces production costs, improves economic benefits and structural utilization, enhances the compatibility and accuracy of level matching, and avoids the use of high-cost level conversion chips.
Smart Images

Figure CN221746561U
Abstract
Description
Technical Field
[0001] The utility model relates to the field of semiconductor chips, and further to a communication interface level matching circuit and a single chip computer. Background Art
[0002] When the working levels of the MCU and other chips are different, it is necessary to add a level conversion chip between the MCU and other chips. The existing level conversion chip has a high cost and is easy to reduce economic benefits. Utility Model Content
[0003] In order to solve the above technical problems, the utility model provides a communication interface level matching circuit and a single chip microcomputer, which reduce production costs and improve economic benefits.
[0004] Specifically, the technical solution of the utility model is as follows:
[0005] A communication interface level matching circuit, comprising:
[0006] at least one selector;
[0007] External chip;
[0008] A single-chip microcomputer, wherein a communication peripheral and at least one voltage comparator are arranged inside the single-chip microcomputer, and the single-chip microcomputer is connected to the external chip;
[0009] The same-direction input end of the voltage comparator is connected to the pin connected to the single-chip microcomputer and the external chip, and the reverse input end of the voltage comparator is connected to the first potentiometer inside the single-chip microcomputer, and the first potentiometer is used to set the preset voltage of the voltage comparator;
[0010] The communication peripheral device selects the input signal source as the pin connecting the single-chip microcomputer and the external chip, or the output of the voltage comparator through the selector.
[0011] Since common single-chip microcomputers are equipped with voltage comparators, by increasing the connection between the voltage comparator and the communication peripherals and external chips, the single-chip microcomputer and the external chip can be level matched, which not only greatly reduces the production cost, but also improves the economic benefits and the utilization rate of the internal structure of the single-chip microcomputer.
[0012] In some embodiments, it further comprises:
[0013] The first input end of the selector is connected between the same-direction input end of the voltage comparator and the single-chip microcomputer, the second input end of the selector is connected to the output end of the voltage comparator, and the output end of the selector is connected to the communication peripheral device;
[0014] One end of the first potentiometer is connected to the power supply of the single chip microcomputer, and the other end is grounded;
[0015] By adding a selector, different lines can be selected for operation when the levels of the microcontroller and the external chip are the same or different, thus improving the compatibility of the communication interface level matching circuit. By adding a potentiometer, the voltage set at the reverse input end of the voltage comparator can be dynamically adjusted according to actual conditions, further improving the compatibility of the communication interface level matching circuit and improving the accuracy of level matching.
[0016] In some embodiments, it further comprises:
[0017] A second potentiometer, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the external chip and the single-chip microcomputer.
[0018] In some embodiments, the number of the voltage comparators is 2, including a first voltage comparator and a second voltage comparator;
[0019] The third pin of the communication peripheral device is connected to the first pin of the external chip through the first pin of the single chip microcomputer;
[0020] The fourth pin of the communication peripheral device is connected to the second pin of the external chip through the second pin of the single chip microcomputer;
[0021] The output end of the first voltage comparator is connected to the first pin of the communication peripheral device, and the non-inverting input end of the first voltage comparator is connected between the third pin of the communication peripheral device and the first pin of the single chip microcomputer;
[0022] The output end of the second voltage comparator is connected to the second pin of the communication peripheral device, and the non-inverting input end of the second voltage comparator is connected between the fourth pin of the communication peripheral device and the second pin of the single chip microcomputer.
[0023] In some embodiments, it further comprises:
[0024] A first selector, wherein the first selector is disposed inside the communication peripheral device and connected to the first voltage comparator;
[0025] A second selector is provided inside the communication peripheral device, and the second selector is connected to the second voltage comparator.
[0026] In some embodiments, it further comprises:
[0027] A second resistor, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the first pin of the single-chip computer and the first pin of the external chip;
[0028] A third resistor, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the second pin of the single-chip microcomputer and the second pin of the external chip.
[0029] In some embodiments, the number of the voltage comparators is 1, including: a third voltage comparator, the output end of the voltage comparator is connected to the sixth pin of the communication peripheral device, and the same-direction input end of the voltage comparator is connected to the fourth pin of the single-chip microcomputer;
[0030] The fifth pin of the communication peripheral device is connected to the third pin of the external chip through the third pin of the single chip microcomputer;
[0031] The fourth pin of the single chip microcomputer is also connected to the fourth pin of the external chip.
[0032] In some embodiments, it further comprises:
[0033] A third selector is disposed inside the communication peripheral device and is connected to the third voltage comparator.
[0034] In some embodiments, it further comprises:
[0035] A fourth resistor, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the third pin of the single-chip microcomputer and the third pin of the external chip.
[0036] The utility model also provides a single chip microcomputer applied to a communication interface level matching circuit, comprising the communication interface level matching circuit described in the aforementioned implementation manner.
[0037] Compared with the prior art, the utility model has at least one of the following beneficial effects:
[0038] 1. Since common single-chip microcomputers are equipped with voltage comparators, by increasing the connection between the voltage comparator and the communication peripherals and the external chip, the single-chip microcomputer and the external chip can be level matched, which not only greatly reduces the production cost, but also improves the economic benefits and the utilization rate of the internal structure of the single-chip microcomputer.
[0039] 2. By adding a selector, different lines can be selected for operation when the microcontroller and the external chip have the same or different levels, thus improving the compatibility of the communication interface level matching circuit. By adding a potentiometer, the voltage set at the reverse input of the voltage comparator can be dynamically adjusted according to actual conditions, further improving the compatibility of the communication interface level matching circuit and the accuracy of level matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The preferred implementation modes will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present utility model.
[0041] Figure 1 It is a simplified structural diagram of an embodiment of a communication interface level matching circuit of the utility model;
[0042] Figure 2 It is a structural diagram of an embodiment of a communication interface level matching circuit of the utility model;
[0043] Figure 3 It is a structural diagram of an embodiment of a communication interface level matching circuit of the utility model;
[0044] Figure 4 It is a structural diagram of an embodiment of a communication interface level matching circuit of the utility model;
[0045] Figure 5 It is a structural diagram of another embodiment of a communication interface level matching circuit of the utility model;
[0046] Figure 6 This is a structural diagram of an existing level matching.
[0047] Description of reference numerals:
[0048] Single chip microcomputer 100; external chip 200; level conversion chip 300; communication peripheral 110; voltage comparator 120; selector 130; first potentiometer 140; second resistor 210; third resistor 220; first selector 310; second selector 320; fourth resistor 410; third selector 510. DETAILED DESCRIPTION
[0049] In order to more clearly illustrate the embodiments of the utility model or the technical solutions in the prior art, the specific implementation methods of the utility model will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the utility model. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.
[0050] In order to simplify the drawings, only the parts related to the utility model are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".
[0051] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0052] In this article, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this utility model can be understood according to specific circumstances.
[0053] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0054] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred implementations of the utility model. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the utility model, and these improvements and modifications should also be regarded as the protection scope of the utility model.
[0055] In the prior art, refer to Figure 6 When the single-chip microcomputer 100 and the external chip 200 have different working levels, a level conversion chip 300 needs to be added between the single-chip microcomputer 100 and the external chip 200. A typical 2-channel level conversion chip model is SN74LVC2T45, which costs 1.5 yuan, and using this chip will occupy more PCB area.
[0056] According to current market pricing, MCU is about 2 yuan, level conversion chip is about 1.5 yuan, other devices (inductor, capacitor, resistor) are about 1.5 yuan, PCB + patch welding is about 1 yuan, and the overall BOM cost is about 6 yuan. Due to the high price of level conversion chips, the cost is greatly increased, and some micro-electronic products may not have PCB space to place level conversion chips. In order to solve the above technical problems, the utility model provides a communication interface level matching circuit, and the specific scheme is as follows:
[0057] In one embodiment, Figure 1 As shown, the utility model provides a communication interface level matching circuit, comprising:
[0058] at least one selector 130;
[0059] External chip 200;
[0060] The single-chip microcomputer 100 has a communication peripheral 110 and at least one voltage comparator 120 disposed therein, and the single-chip microcomputer 100 is connected to an external chip 200 .
[0061] The same-direction input terminal of the voltage comparator 120 is connected to the pin connecting the single-chip microcomputer 100 and the external chip 200 , and the reverse input terminal of the voltage comparator 120 is connected to the first potentiometer inside the single-chip microcomputer 100 , and the first potentiometer is used to set the preset voltage of the voltage comparator.
[0062] The communication peripheral 110 selects the input signal source as the pin connecting the single chip 100 and the external chip 200 or the output of the voltage comparator 120 through the selector 130 .
[0063] Specifically, when the external chip 200 inputs a signal to the communication peripheral 110, and the voltage level of the external chip 200 is equal to that of the single-chip microcomputer (e.g., MCU) 100, the external chip 200 and the communication peripheral 110 can work normally when connected via the GPIO interface (in this embodiment, the communication peripheral 110 selects the input signal source as the pin connecting the single-chip microcomputer 100 and the external chip 200 through the selector 130, that is, the external chip 200 is directly connected to the communication peripheral 110 through the selector 130, and the voltage comparator 120 is not required).
[0064] When the voltage levels of the external chip 200 and the single-chip microcomputer 100 are not equal, the external chip 200 can still communicate normally with the communication peripheral 110 inside the single-chip microcomputer 100 by means of the voltage comparator 120 path.
[0065] Furthermore, when the external chip 200 inputs a signal to the communication peripheral 110, and the level of the external chip 200 is lower than the level of the single-chip computer 100, the external chip 200 is connected to the same-direction input terminal of the voltage comparator 120, and the signal is sent to the communication peripheral 110 through the voltage comparator 120 (in this embodiment, the communication peripheral 110 selects the input signal source as the output of the voltage comparator 120 through the selector 130). The specific process is that if the second level of the external chip 200 is lower than the first level of the single-chip computer 100, the voltage of the reverse input terminal of the voltage comparator 120 is set to the second level of the external chip 200 * the first preset percentage (for example, the first preset percentage is 50%, which can be set according to the actual situation and is not limited here).
[0066] When the second level of the signal output by the external chip 200 is a high level, the voltage comparator 120 compares the second level with the voltage at the reverse input terminal of the voltage comparator 120, so that a high level first level signal is output from the output terminal of the voltage comparator 120 to the communication peripheral 110. Similarly, when the second level of the signal output by the external chip 200 is a low level, the voltage comparator 120 compares the second level with the voltage at the reverse input terminal of the voltage comparator 120, so that a low level first level signal is output from the output terminal of the voltage comparator 120 to the communication peripheral 110, thereby achieving the level matching target of the single-chip microcomputer 100 and the external chip 200.
[0067] In this embodiment, since common single-chip microcomputers are all provided with a voltage comparator 120, by increasing the connection between the voltage comparator 120 and the communication peripheral 110 and the external chip, the single-chip microcomputer 100 and the external chip 200 can be level matched, which not only greatly reduces the production cost, but also improves the economic benefits and the utilization rate of the internal structure of the single-chip microcomputer.
[0068] In one embodiment, Figure 1 As shown, the utility model provides a communication interface level matching circuit. Based on the above embodiments,
[0069] The first input terminal of the selector 130 is connected between the non-inverting input terminal of the voltage comparator 120 and the single chip computer 100 , the second input terminal of the selector 130 is connected to the output terminal of the voltage comparator 120 , and the output terminal of the selector 130 is connected to the input terminal of the communication peripheral device.
[0070] One end of the first potentiometer 140 is connected to the power supply of the single chip computer 100 , and the other end is grounded.
[0071] The inverting input terminal of the voltage comparator 120 is connected to the first potentiometer 140 .
[0072] Specifically, a selector 130 is also provided inside the single-chip microcomputer 100 (of course, the selector 130 can also be set at other positions, which is not limited here), the output end of the selector 130 is connected to the communication peripheral 110, and the first input end of the selector 130 is connected between the same-direction input end of the voltage comparator 120 and the single-chip microcomputer 100, so that when the second level of the external chip 200 is equal to the first level of the single-chip microcomputer 100, the signal sent by the external chip 200 enters the communication peripheral 110 through the first input end of the selector 130 without passing through the voltage comparator 120.
[0073] Furthermore, a first potentiometer 140 is also provided inside the single-chip computer 100, and the first potentiometer 140 is connected to the reverse input terminal of the voltage comparator 120, and the voltage of the reverse input terminal of the voltage comparator 120 is adjusted by adjusting the first potentiometer 140. That is, similar to the above-mentioned embodiment, when the level of the single-chip computer 100 is greater than the level of the external chip 200, the voltage of the reverse input terminal of the voltage comparator 120 is adjusted by the first potentiometer 140 to be the second level of the external chip 200*the first preset percentage. When the second level of the output signal of the external chip 200 is a high level, the voltage comparator 120 compares the second level with the voltage of the reverse input terminal of the voltage comparator 120, so that a high level first level signal is output from the output terminal of the voltage comparator 120, and enters the selector 130 through the second input terminal of the selector 130, and is sent to the communication peripheral 110 through the output terminal of the selector 130. When the second level of the output signal of the external chip 200 is a low level, the same is true, and it will not be repeated here.
[0074] By adding the selector 130, different lines can be selected to work when the single-chip computer 100 and the external chip 200 have the same or different levels, thereby improving the compatibility of the communication interface level matching circuit. By adding the first potentiometer 140, the voltage set at the reverse input terminal of the voltage comparator 120 can be dynamically adjusted according to actual conditions, thereby further improving the compatibility of the communication interface level matching circuit and improving the accuracy of level matching.
[0075] In one embodiment, the utility model provides a communication interface level matching circuit, which, based on the above embodiment, further includes:
[0076] The second potentiometer has one end connected to the power supply of the external chip and the other end connected to the ground.
[0077] In this embodiment, when the communication peripheral 110 outputs a signal to the external chip 200, and the first level of the single-chip microcomputer is greater than the second level of the external chip, it is not necessary to set up components such as a voltage comparator, a selector, and a variable resistor inside the single-chip microcomputer. It is only necessary to set up a second potentiometer outside the single-chip microcomputer, one end of the second potentiometer is connected to the power supply of the external chip, and the other end is grounded. The voltage is divided by the second potentiometer, so that the external chip 200 and the single-chip microcomputer 100 can achieve level matching.
[0078] Furthermore, when the signal output by the communication peripheral is at a high level, the level of the signal is fixed to the second level of the external chip through the second potentiometer; when the signal output by the communication peripheral is at a low level, the signal is fixed to the ground through the output field effect transistor of the port, thereby achieving the goal of level matching.
[0079] It can be imagined that when the voltage level of the microcontroller is equal to that of the external chip, it can work normally without the need for a second potentiometer.
[0080] In one embodiment, Figure 2 As shown, the utility model provides a communication interface level matching circuit. On the basis of the above embodiment, the number of voltage comparators is 2, including a first voltage comparator and a second voltage comparator.
[0081] The third pin of the communication peripheral is connected to the first pin of the external chip through the first pin of the single chip computer.
[0082] The fourth pin of the communication peripheral is connected to the second pin of the external chip through the second pin of the single chip computer.
[0083] The output end of the first voltage comparator is connected to the first pin of the communication peripheral device, and the non-inverting input end of the first voltage comparator is connected between the third pin of the communication peripheral device and the first pin of the single chip computer.
[0084] The output end of the second voltage comparator is connected to the second pin of the communication peripheral device, and the non-inverting input end of the second voltage comparator is connected between the fourth pin of the communication peripheral device and the second pin of the single chip computer.
[0085] In this embodiment, the communication peripherals (see Appendix Figure 2 The third pin of the I2C chip in the Figure 2 SCLOUT in the microcontroller (see Appendix Figure 2 The first pin of the SYM MCU in the Figure 2 PB06 in the Figure 2 The first pin of the I2C Device chip in the Figure 2 The fourth pin of the communication peripheral (refer to the attached Figure 2 SDAOUT in the MCU) through the second pin of the MCU (refer to the attached Figure 2 PB05 in the figure) and the second pin of the external chip (refer to the attached Figure 2 in SDL) connection.
[0086] Furthermore, in this embodiment, there are two voltage comparators, namely, a first voltage comparator (see Appendix Figure 2 VC2 in the figure) and the second voltage comparator (see Appendix Figure 2 The output end of the first voltage comparator is connected to the first pin of the communication peripheral (refer to the attached Figure 2 The same-direction input terminal of the first voltage comparator is connected between the third pin of the communication peripheral and the first pin of the single-chip microcomputer (see Appendix Figure 2The PB06 pin has the I2C1_SCL function and the VC2_IN0 channel. When using it, you need to configure the digital function of PB06 to I2C1_SCL and enable open drain. The input signal source of I2C1_SCL is VC2_OUT and the positive end of VC2 is configured to CH0 (PB06 pin).
[0087] Furthermore, the output end of the second voltage comparator is connected to the second pin of the communication peripheral device (see the attached Figure 2 The same-direction input terminal of the second voltage comparator is connected between the fourth pin of the communication peripheral and the second pin of the single-chip microcomputer (see Appendix Figure 2 The PB05 pin has the I2C1_SDA function and the VC1_IN0 channel. When using it, you need to configure the digital function of PB05 to I2C1_SDA and enable open drain. You need to configure the input signal source of I2C1_SDA to VC1_OUT and the positive end of VC1 to CH0 (PB05 pin).
[0088] Furthermore, in this embodiment, a second resistor 210 and a third resistor 220 are also provided, wherein one end of the second resistor 210 is connected to the power supply of the external chip, and the other end is connected between the first pin of the microcontroller and the first pin of the external chip; one end of the third resistor 220 is connected to the power supply of the external chip, and the other end is connected between the second pin of the microcontroller and the second pin of the external chip.
[0089] By configuring the input signal source of SCL / SDA to be the output terminal of the first voltage comparator or the second voltage comparator, the communication peripheral in this embodiment can communicate with an I2C device whose operating voltage is lower than that of the chip. The inverting input terminal of the first voltage comparator and the inverting input terminal of the second voltage comparator are both configured to be the first preset level (for example, the voltage divided by the second resistor 210 and the third resistor 220) output. Figure 2 The microcontroller in the system is 3.3v, and the external chip level is 1.8v, then the first preset level is 0.825v).
[0090] For further information, see Attachment Figure 3 In this embodiment, there are two selectors 130, namely a first selector 310 and a second selector 320. The first selector 310 is arranged inside the communication peripheral device, and the first selector 310 is connected to the first voltage comparator; the second selector 320 is arranged inside the communication peripheral device, and the second selector 320 is connected to the second voltage comparator.
[0091] In this embodiment, no matter the MCU level is equal to the external chip level or the MCU level is greater than the external chip level, communication can be performed through the working principle of the communication interface level matching circuit described in the previous embodiment, which will not be elaborated here.
[0092] In one embodiment, Figure 4 As shown, the utility model provides a communication interface level matching circuit. Based on the above embodiment, the number of voltage comparators is 1, including: a third voltage comparator, the output end of the voltage comparator is connected to the sixth pin of the communication peripheral, and the same-direction input end of the voltage comparator is connected to the fourth pin of the single-chip microcomputer.
[0093] The fifth pin of the communication peripheral is connected to the third pin of the external chip through the third pin of the single chip.
[0094] The fourth pin of the single chip microcomputer is also connected to the fourth pin of the external chip.
[0095] In this embodiment, the communication peripherals (see Appendix Figure 4 The fifth pin of UART1 in Figure 4 TXD in the microcontroller) through the third pin of the microcontroller (refer to the attached Figure 4 PA06 in the Figure 4 The third pin of the UART Device in the Figure 4 RXD in the MCU) is connected; the fourth pin of the microcontroller (refer to the attached Figure 4 PA05 in the figure) is also connected to the fourth pin of the external chip (see attached Figure 4 TXD) connection in.
[0096] Furthermore, in this embodiment, the voltage comparator is a third voltage comparator (see Appendix Figure 4 The output of the voltage comparator is connected to the sixth pin of the communication peripheral (refer to the attached Figure 4 The same-direction input terminal of the voltage comparator is connected to the fourth pin of the microcontroller (see RXD in the figure). Figure 4 The PA05 pin shown is the CH1 channel of VC2; the PA06 pin is the TXD pin of UART1. When using, the function of the PA06 pin needs to be configured as UART1_TXD to enable open drain; the PA05 pin needs to be configured as an analog function, the positive end of VC2 is CH1 (PA05 pin), and the RXD input signal source of UART1 needs to be configured as VC2_OUT).
[0097] Furthermore, the present embodiment further includes a fourth resistor 410, one end of which is connected to a power supply of an external chip (see attached Figure 4 , power supply is 1.8v), and the other end is connected between the third pin of the single chip and the third pin of the external chip. The inverting input end of the third voltage comparator is configured as the second preset level (for example, the voltage output of the fourth resistor 410) Figure 4The microcontroller in the system is 3.3v, and the external chip level is 1.8v, then the second preset level is 0.825v).
[0098] For further information, see Attachment Figure 5 In this embodiment, the number of the selector 130 is one, namely, the third selector 510. The third selector 510 is arranged inside the communication peripheral device, and the third selector 510 is connected to the third voltage comparator.
[0099] In this embodiment, no matter the MCU level is equal to the external chip level or the MCU level is greater than the external chip level, communication can be performed through the working principle of the communication interface level matching circuit described in the previous embodiment, which will not be elaborated here.
[0100] It is conceivable that the communication interface level matching circuit provided by the present invention is not limited to the general MCU architecture, and may include any integrated circuit in the form of an MCU, ASIC, and MPU with a CPU.
[0101] In one embodiment, the utility model provides a single chip microcomputer applied to a communication interface level matching circuit, including the communication interface level matching circuit described in the above embodiment.
[0102] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred implementations of the utility model. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the utility model, and these improvements and modifications should also be regarded as the protection scope of the utility model.
Claims
1. A communication interface level matching circuit, characterized in that: include: at least one selector; External chip; A single-chip microcomputer, wherein a communication peripheral and at least one voltage comparator are arranged inside the single-chip microcomputer, and the single-chip microcomputer is connected to the external chip; The same-direction input end of the voltage comparator is connected to the pin connected to the single-chip microcomputer and the external chip, and the reverse input end of the voltage comparator is connected to the first potentiometer inside the single-chip microcomputer, and the first potentiometer is used to set the preset voltage of the voltage comparator; The communication peripheral device selects the input signal source as the pin connecting the single-chip microcomputer and the external chip, or the output of the voltage comparator through the selector.
2. The communication interface level matching circuit according to claim 1, characterized in that: The first input end of the selector is connected between the same-direction input end of the voltage comparator and the single-chip microcomputer, the second input end of the selector is connected to the output end of the voltage comparator, and the output end of the selector is connected to the input end of the communication peripheral device; One end of the first potentiometer is connected to the power supply of the single chip microcomputer, and the other end is grounded.
3. The communication interface level matching circuit according to claim 2, characterized in that: Also includes: A second potentiometer, one end of which is connected to the power supply of the external chip, and the other end is grounded.
4. The communication interface level matching circuit according to claim 1, characterized in that: The number of the voltage comparators is 2, including a first voltage comparator and a second voltage comparator; The third pin of the communication peripheral device is connected to the first pin of the external chip through the first pin of the single chip microcomputer; The fourth pin of the communication peripheral device is connected to the second pin of the external chip through the second pin of the single chip microcomputer; The output end of the first voltage comparator is connected to the first pin of the communication peripheral device, and the non-inverting input end of the first voltage comparator is connected between the third pin of the communication peripheral device and the first pin of the single chip microcomputer; The output end of the second voltage comparator is connected to the second pin of the communication peripheral device, and the non-inverting input end of the second voltage comparator is connected between the fourth pin of the communication peripheral device and the second pin of the single chip microcomputer.
5. The communication interface level matching circuit according to claim 4, characterized in that: The number of the selectors is 2, including a first selector and a second selector; The first selector is arranged inside the communication peripheral device, and the first selector is connected to the first voltage comparator; The second selector is arranged inside the communication peripheral device, and the second selector is connected to the second voltage comparator.
6. The communication interface level matching circuit according to claim 5, characterized in that: Also includes: A second resistor, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the first pin of the single-chip computer and the first pin of the external chip; A third resistor, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the second pin of the single-chip microcomputer and the second pin of the external chip.
7. The communication interface level matching circuit according to claim 1, characterized in that: The number of the voltage comparators is 1, including: a third voltage comparator, the output end of the voltage comparator is connected to the sixth pin of the communication peripheral device, and the same-direction input end of the voltage comparator is connected to the fourth pin of the single-chip microcomputer; The fifth pin of the communication peripheral device is connected to the third pin of the external chip through the third pin of the single chip microcomputer; The fourth pin of the single chip microcomputer is also connected to the fourth pin of the external chip.
8. The communication interface level matching circuit according to claim 7, characterized in that: The number of the selectors is 1, including: a third selector; The third selector is arranged inside the communication peripheral device, and the third selector is connected to the third voltage comparator.
9. The communication interface level matching circuit according to claim 8, characterized in that: Also includes: A fourth resistor, one end of which is connected to the power supply of the external chip, and the other end of which is connected between the third pin of the single-chip microcomputer and the third pin of the external chip.
10. A single chip microcomputer applied to a communication interface level matching circuit, characterized in that: It comprises the communication interface level matching circuit as described in any one of claims 1 to 9.
