Port multiplexing circuit and electric equipment
By combining the port multiplexing circuit and the comparison control circuit, the problem of insufficient controller chip interfaces is solved, the port utilization is improved, the hardware cost is reduced, and reliable control of the load is achieved.
Patent Information
- Application Number
- CN202422690308.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2034-11-05
AI Technical Summary
The controller chip has insufficient number of interfaces, which requires replacement with a chip with more interfaces, increasing costs.
The port multiplexing circuit is used to switch between the input mode and the output mode through the multiplexing port of the controller, and the time-sharing multiplexing of the signal is realized by combining the comparison control circuit and the load control circuit.
It improves the utilization of controller port resources, reduces hardware costs, and achieves reliable and precise control of loads.
Smart Images

Figure CN223348659U_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of circuit technology, and in particular to a port multiplexing circuit and an electrical device. Background Art
[0002] In electronic circuits, controllers typically handle data reception and load management. For example, a controller can receive temperature information from a temperature monitoring component and control load devices such as buzzers and relays. This process requires the controller to occupy two interfaces: one dedicated to receiving temperature information and the other to sending signals to control the load.
[0003] However, if the number of interfaces of the controller chip is insufficient to meet the demand, it will have to be replaced with a chip with more interfaces, which will increase the cost. Utility Model Content
[0004] Based on this, it is necessary to provide a port multiplexing circuit and an electrical device that can reduce the number of ports occupied by the controller chip to address the above problems.
[0005] A port multiplexing circuit, comprising:
[0006] A controller having at least one multiplex port, wherein the multiplex port is used to receive an input signal; the multiplex port is used to receive the input signal when in an input mode; and the multiplex port is also used to output a control signal when in an output mode;
[0007] a comparison control circuit, wherein the number of the comparison control circuits is the same as the number of the multiplexed ports, and each comparison control circuit is connected to one of the multiplexed ports; the comparison control circuit is configured to generate and output a state switching signal according to the control signal; and the comparison control circuit is further configured to stop outputting the state switching signal according to the input signal;
[0008] The load control circuit is configured such that the number of the load control circuits is the same as the number of the comparison control circuits, each of the load control circuits is connected to a comparison control circuit and is used to connect to a load; the load control circuit is used to control the load according to the state switching signal.
[0009] In one embodiment, the state switching signal includes a conduction signal and a disconnection signal; the comparison control circuit includes a reference voltage generation unit and a comparison unit, the input side of the comparison unit is connected to the reference voltage generation unit and the multiplexing port, and the output side of the comparison unit is connected to the load control circuit;
[0010] The reference voltage generating unit is used to generate a reference voltage signal;
[0011] The comparison unit is used to compare the voltage of the control signal and the reference voltage signal, and generate a conduction signal or a disconnection signal based on the comparison result; and is also used to generate a disconnection signal based on the input signal and the reference voltage signal.
[0012] In one embodiment, the reference voltage generating unit includes a first voltage dividing resistor and a second voltage dividing resistor; the first end of the first voltage dividing resistor is connected to a power supply, and the second end of the first voltage dividing resistor is grounded via the second voltage dividing resistor; the common end connected to the first voltage dividing resistor and the second voltage dividing resistor serves as the output end of the reference voltage generating unit, for outputting the reference voltage signal.
[0013] In one embodiment, the comparison unit includes a comparator; a first input terminal of the comparator is connected to the reference voltage generation unit, a second input terminal of the comparator is connected to the multiplexing port, and an output terminal of the comparator is connected to the load control circuit.
[0014] In one embodiment, the load control circuit includes a current limiting unit, a voltage determining unit and a switch tube; the controlled end of the switch tube is connected to the comparison control circuit via the current limiting unit, the first end of the switch tube is used to connect to the load, and the second end of the switch tube is connected to the controlled end via the voltage determining unit.
[0015] In one embodiment, the switching tube is an NPN transistor; the base of the NPN transistor serves as the controlled end of the switching tube, the collector of the NPN transistor serves as the first end of the switching tube, and the emitter of the NPN transistor serves as the second end of the switching tube.
[0016] In one embodiment, the switching tube is a PNP type transistor; the base of the PNP type transistor serves as the controlled end of the switching tube, the collector of the PNP type transistor serves as the first end of the switching tube, and the emitter of the PNP type transistor serves as the second end of the switching tube.
[0017] An electric device comprises a signal input module, a load and the port multiplexing circuit as described above; the signal input module is connected to the multiplexing port and is used to output the input signal.
[0018] In one embodiment, the signal input module includes a temperature detection resistor and a third voltage divider resistor, the first end of the temperature detection resistor is connected to the power supply, the second end of the temperature detection resistor is grounded through the third voltage divider resistor, and the common end where the temperature detection resistor and the third voltage divider resistor are connected is connected to the multiplexing port.
[0019] In one embodiment, the signal input module further includes a capacitor, and a common end connected to the temperature detection resistor and the third voltage-dividing resistor is grounded via the capacitor.
[0020] In one embodiment, the load includes a buzzer, and the buzzer is connected to the load control circuit.
[0021] The aforementioned port multiplexing circuit and electrical device include a controller, a comparison control circuit, and a load control circuit. The controller has at least one multiplexing port for receiving input signals. The number of comparison control circuits and load control circuits is equal to the number of multiplexing ports. Each comparison control circuit is connected to a multiplexing port and a load control circuit, respectively. The load control circuit is also connected to a load. The multiplexing port is configured to receive input signals when in input mode and output control signals when in output mode. The comparison control circuit generates and outputs a state switching signal based on the control signal, and the load control circuit controls the load based on the state switching signal. When the multiplexing port is in input mode, the comparison control circuit stops outputting the state switching signal based on the input signal, causing the load control circuit to stop controlling the load. Thus, by allowing the controller's multiplexing port to time-share between input and output modes, a single multiplexing port can meet both signal reception and signal output requirements, significantly improving the utilization of the controller's port resources. This effectively alleviates the need to upgrade the controller chip due to insufficient port count, thereby reducing hardware costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a structural block diagram of a port multiplexing circuit in one embodiment;
[0023] Figure 2 is a structural block diagram of a port multiplexing circuit in another embodiment;
[0024] Figure 3 A schematic diagram of the structure of a port multiplexing circuit in one embodiment;
[0025] Figure 4 A schematic structural diagram of a port multiplexing circuit in another embodiment;
[0026] Figure 5 FIG. 1 is a structural block diagram of an electrical device in an embodiment. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application pertains. The terms used herein in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application.
[0029] It will be understood that the terms "first," "second," etc. used herein may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element.
[0030] Spatially relative terms such as "under," "beneath," "beneath," "under," "above," "above," etc., may be used herein to describe the relationship of an element or feature shown in the figures to other elements or features. It should be understood that in addition to the orientations shown in the figures, spatially relative terms also include different orientations of the device in use and operation. For example, if the device in the drawings is turned over, the element or feature described as "under" or "beneath" or "beneath" the other elements will be oriented as "above" the other elements or features. Thus, the exemplary terms "under" and "under" can include both upper and lower orientations. In addition, the device can also include alternative orientations (e.g., rotated 90 degrees or other orientations), and the spatial descriptors used herein are interpreted accordingly.
[0031] It should be noted that when an element is considered to be "connected" to another element, it can be directly connected to the other element or connected to the other element through an intervening element. In addition, the "connection" in the following embodiments should be understood as "electrical connection", "communication connection", etc., if there is transmission of electrical signals or data between the connected objects.
[0032] When used herein, the singular forms "a", "an", and "the" may also include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" and the like specify the presence of stated features, integers, steps, operations, components, parts, or combinations thereof, but do not preclude the possibility of the presence or addition of one or more other features, integers, steps, operations, components, parts, or combinations thereof.
[0033] In one embodiment, a port multiplexing circuit is provided. Figure 1 As shown, the port multiplexing circuit 100 includes a controller 110 , a comparison control circuit 120 and a load control circuit 130 .
[0034] The controller 110 has at least one multiplexing port 111. The multiplexing port 111 is used to receive input signals when in input mode and output control signals when in output mode.
[0035] The number of comparison control circuits 120 is the same as the number of multiplex ports 111, and each comparison control circuit 120 is connected to a multiplex port 111. The comparison control circuit 120 is used to generate and output a state switching signal according to a control signal. The comparison control circuit 120 is also used to stop outputting the state switching signal according to an input signal.
[0036] The number of the load control circuits 130 is the same as the number of the comparison control circuits 120 . Each load control circuit 130 is connected to a comparison control circuit 120 . Each load control circuit 130 is connected to a load and is used to control the load according to the state switching signal.
[0037] The controller 110 may be selected based on actual conditions, such as an MCU (Microcontroller Unit) chip, a programmable logic device (PLD), etc. The multiplexed port 111 may be an I / O (Input / Output) port of the controller 110 .
[0038] I understand. Figure 1 The illustrated embodiment is based on the number of multiplexing ports 111, comparison control circuit 120, and load control circuit 130 of the controller 110 being one. In actual implementation, the controller 110 may have multiple I / O ports, each of which can be used only in input mode or only in output mode, or can be used as a time-division multiplexing multiplexing port 111. When used as a time-division multiplexing multiplexing port 111, each multiplexing port 111 must be connected to a corresponding comparison control circuit 120 and a load control circuit 130. Each multiplexing port 111 can receive the same input signal or different input signals. Each load control circuit 130 can be connected to the same load device or different load devices.
[0039] The input signal may be a signal transmitted by an external signal input module. The structure and type of the signal input module are not limited and may be configured according to actual use needs. For example, the signal input module may be a module capable of sampling signals, such as a temperature detection module or a humidity acquisition module, or an input module capable of receiving external signals, such as a button or a central control screen.
[0040] The structure and type of the load do not need to be limited and can be set according to actual use needs. For example, the load can be a buzzer, a fan, a relay, and other equipment.
[0041] Specifically, multiplex port 111 is used to receive input signals or output control signals in a time-sharing manner. It will be appreciated that I / O port configuration is typically achieved through programming, during which the operating mode of the I / O port (e.g., input mode, output mode, etc.) can be specified. In this embodiment, the I / O port can receive input signals when in mode and can output control signals when in output mode. The timing of multiplex port 111 receiving input signals and outputting control signals is not necessarily limited and can be programmed and configured by those skilled in the art according to actual usage requirements.
[0042] The control signal is transmitted to the comparison control circuit 120. The comparison control circuit generates and outputs a state switching signal based on the control signal, causing the load control circuit 130 to control the load based on the state switching signal. Specifically, the load control circuit 130 controls the load to be in a first state or a second state based on the state switching signal. One of the first and second operating states can be an on-state, and the other can be a stopped state. For example, if the load is a buzzer, its first state can be an on-state, and its second state can be a stopped state. The load control circuit 130 can control the buzzer to sound or stop sounding based on the state switching signal.
[0043] Since the comparison control circuit 120 is connected to the multiplex port 111, it also receives the input signal input by the multiplex port 111. Therefore, the comparison control circuit 120 is also used to stop outputting the state switching signal according to the input signal, and the load stops running at this time, so that the state of the load is not affected by the input signal.
[0044] The port multiplexing circuit 100 includes a controller 110, a comparison control circuit 120, and a load control circuit 130. The controller 110 has at least one multiplexing port 111, which is used to receive input signals. The number of comparison control circuits 120 and load control circuits 130 is the same as the number of multiplexing ports 111. Each comparison control circuit 120 is connected to a multiplexing port 111 and a load control circuit 130, respectively. The load control circuit 130 is also used to connect to a load. The multiplexing port 111 is used to receive input signals when in input mode and output control signals when in output mode. The comparison control circuit 120 generates and outputs a state switching signal based on the control signal, and the load control circuit 130 controls the load based on the state switching signal. When the multiplexing port 111 is in input mode, the comparison control circuit 120 stops outputting the state switching signal based on the input signal, causing the load control circuit 130 to stop controlling the load. Thus, by enabling the multiplexed port 111 of the controller 110 to be in input mode and output mode in a time-sharing manner, a single multiplexed port 111 can meet both the signal receiving and signal output requirements, significantly improving the utilization rate of the port resources of the controller 110. This effectively alleviates the situation where the controller chip needs to be upgraded due to insufficient port numbers, thereby reducing hardware costs.
[0045] In one embodiment, the state switching signal includes an on signal and an off signal. The load control circuit is used to control the load according to the on signal, control the load according to the off signal, or control the load according to the on signal and the off signal. The on signal and the off signal can correspond to two level states of the state switching signal. For example, when the state switching signal is at a high level, it serves as an on signal, and when the state switching signal is at a low level, it serves as an off signal. It is not necessary to specify which of the on signal and the off signal is a high level signal and which is a low level signal. In actual application, it can be combined with the structural setting of the subsequent load control circuit 130.
[0046] In actual implementation, in some implementations, the on signal can be used to enable the load control circuit 130 to control the load to work, and the off signal can be used to enable the load control circuit 130 to control the load to stop working.
[0047] In other embodiments, when the control signal output by the controller 110 is a PWM signal, the on-signal and the off-signal also have the same frequency as the PWM signal. Therefore, the on-signal and the off-signal can be used to control a load driven by the PWM signal, such as a buzzer. By adjusting the duty cycle of the on-signal and the off-signal, the volume of the buzzer can be controlled.
[0048] like Figure 2As shown, the comparison control circuit 120 may include a reference voltage generating unit 121 and a comparison unit 122 , wherein the input side of the comparison unit 122 is connected to the reference voltage generating unit 121 and the multiplexing port 111 , and the output side of the comparison unit 122 is connected to the load control circuit 130 .
[0049] The reference voltage generating unit 121 is used to generate a reference voltage signal Vref. The voltage level of the reference voltage signal Vref can be set according to specific circumstances and is not limited here.
[0050] The comparison unit 122 is used to compare the voltage of the control signal and the reference voltage signal Vref, and generate a turn-on signal or a turn-off signal based on the comparison result. The comparison unit 122 is also used to generate a turn-off signal based on the input signal and the reference voltage signal Vref.
[0051] In an exemplary embodiment, the high level of the control signal is 5V, and the low level is 0V. The voltage range of the input signal is 2.2V-4.1V. The reference voltage signal Vref is 2V. When the multiplexing port 111 is in input mode, the comparison unit 122 can output a disconnection signal when the high level of the control signal is greater than the voltage of the reference signal Vref; and output a conduction signal when the low level of the control signal is less than the voltage of the reference signal Vref. The load control circuit 130 controls the load to operate according to the conduction signal and controls the load to stop operating according to the disconnection signal, thereby achieving precise control of the load 300 according to the control signal output by the controller 110 in the case of port multiplexing.
[0052] When the multiplex port 111 is in output mode and no control signal is received, the comparison unit 122 will also output a disconnection signal when the input signal is greater than the reference voltage Vref. The disconnection signal turns off the load, thereby ensuring that the load 300 is not disturbed by the input signal.
[0053] In this embodiment, reliable and precise control of the load is achieved through the coordinated comparison between the reference voltage generating unit 121 and the comparing unit 122. This design not only ensures the multiplexing function of the multiplexing port 111, but also ensures the stability and reliability of the load state when the multiplexing port 111 is in different modes.
[0054] The structures of the reference voltage generating unit 121 and the comparison unit 122 can be configured according to specific circumstances. In one embodiment, the comparison unit 122 may include a comparator, the input side of the comparison unit 122 includes a first input terminal and a second input terminal of the comparator, and the output side of the comparison unit 122 includes an output terminal of the comparator. Specifically, the first input terminal of the comparator is connected to the reference voltage generating unit 121, the second input terminal of the comparator is connected to the multiplexing port 111, and the output terminal of the comparator is connected to the load control circuit 130.
[0055] One of the first and second input terminals of the comparator is a non-inverting input terminal, and the other is an inverting input terminal. Whether the non-inverting input terminal serves as the first input terminal or the inverting input terminal serves as the first input terminal can be set according to specific circumstances, for example, according to the circuit structure of the subsequent load control circuit 130.
[0056] For example, Figure 3-4 As shown, in Figure 3 In the embodiment shown, the inverting input terminal of the comparator U1 is connected to the reference voltage generating unit 121 as the first input terminal; the non-inverting input terminal of the comparator U1 is connected to the multiplexing port 111 as the second input terminal; and the output terminal of the comparator U1 is connected to the load control circuit 130. Figure 4 In the embodiment shown, the non-inverting input terminal of the comparator U1 is connected to the reference voltage generating unit 121 as the first input terminal; the inverting input terminal of the comparator U1 is connected to the multiplexing port 111 as the second input terminal; and the output terminal of the comparator U1 is connected to the load control circuit 130.
[0057] In this embodiment, the comparison unit 122 adopts the design of the comparator U1 . The functions of the comparator U1 are more integrated, so that the circuit structure is simple, and the circuit is reliable and stable.
[0058] Understandably, Figure 3-4 In the embodiment shown, the controller 110 uses an MCU chip, which has multiple I / O pins. Figure 3-4 In the embodiment, only the I / O pin 11 is used as an example of a multiplexed port for time-division multiplexing.
[0059] In actual implementation, there is no unique way to implement the reference voltage generating unit 121. In one embodiment, please continue to refer to Figure 3-4 The reference voltage generating unit 121 includes a first voltage-dividing resistor R1 and a second voltage-dividing resistor R2. The first end of the first voltage-dividing resistor R1 is connected to the power supply VCC, and the second end of the first voltage-dividing resistor R1 is grounded via the second voltage-dividing resistor R2. The common end of the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2 serves as the output end of the reference voltage generating unit 121 for outputting the reference voltage signal Vref.
[0060] The common connection point of the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2 is used as the output terminal of the reference voltage generating unit 121 to provide a stable reference voltage signal Vref to the comparing unit 122 .
[0061] Specifically, when the power supply VCC provides a voltage, current flows to ground through the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2, and divides the power supply voltage according to the ratio of the resistance values of the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2. The result of this voltage division is the output voltage of the reference voltage generation unit 121, i.e., the reference voltage signal Vref. The first voltage-dividing resistor R1 and the second voltage-dividing resistor R2 can be implemented using resistor elements or equivalent circuits, and the resistance values of the first voltage-dividing resistor R1 and the second voltage-dividing resistor R2 can be set according to actual conditions.
[0062] In this embodiment, the reference voltage generating unit 121 is implemented using two voltage-dividing resistors, which utilize the power supply voltage to generate a desired reference voltage signal Vref. Because resistors have good stability, the reference voltage signal Vref generated by the voltage division between the first and second voltage-dividing resistors R1 and R2 is stable and reliable. This, in turn, makes control based on the reference voltage signal Vref more reliable, thereby making the on / off signal output by the comparison unit 122 more reliable, and thus, making control of the load 300 more reliable.
[0063] In other embodiments, the reference voltage generating unit 121 may also adopt a chip integrating a reference voltage source, or a reference voltage generating circuit constructed by transistors, and those skilled in the art may make settings with reference to common technologies in the art.
[0064] In one embodiment, the load control circuit 130 includes a current limiting unit 131, a voltage determining unit 132, and a switch Q1. The controlled terminal of the switch Q1 is connected to the comparison control circuit 120 via the current limiting unit 131. The first terminal of the switch Q1 is connected to the load 300, and the second terminal of the switch Q1 is connected to the controlled terminal via the voltage determining unit 132.
[0065] The type of the switch tube Q1 can be selected according to actual conditions, such as a triode, a MOS tube, etc. The controlled end, the first end, and the second end of the switch tube Q1 need to be determined according to the type of the switch tube Q1.
[0066] In one embodiment, Figure 3 As shown, the switch tube Q1 is a PNP transistor; the base of the PNP transistor serves as the controlled end of the switch tube Q1 , the collector of the PNP transistor serves as the first end of the switch tube Q1 , and the emitter of the PNP transistor serves as the second end of the switch tube Q1 .
[0067] In this embodiment, voltage determination unit 132 is a pull-up unit, and the common terminal connecting the second terminal of switch Q1 and voltage determination unit 132 is connected to power supply VCC. The pull-up unit can provide a stable high voltage level to the controlled terminal of switch Q1 when the switch Q1 is not conducting, thereby preventing the controlled terminal of switch Q1 from being in an uncertain state and improving circuit reliability.
[0068] In one embodiment, Figure 4 As shown, the switch tube Q1 is an NPN transistor; the base of the NPN transistor serves as the controlled end of the switch tube Q1, the collector of the NPN transistor serves as the first end of the switch tube Q1, and the emitter of the NPN transistor serves as the second end of the switch tube Q1.
[0069] In this embodiment, the voltage determination unit 132 is a pull-down unit, and the common terminal connecting the second terminal of the switch Q1 and the voltage determination unit 132 is grounded. The pull-down unit can provide a stable low level to the controlled terminal of the switch Q1 when the switch Q1 is not conducting, thereby preventing the controlled terminal of the switch Q1 from being in an uncertain state, thereby improving circuit reliability.
[0070] The voltage determination unit 132 may include a resistor R4. When the switch tube Q1 is a PNP transistor, the resistor R4 plays a pull-up role; when the switch tube Q1 is an NPN transistor, the resistor R4 plays a pull-down role.
[0071] The primary function of current limiting unit 131 is to limit the current flowing into the base of the transistor to prevent damage to the transistor caused by excessive current, thereby protecting the transistor and stabilizing the circuit. Current limiting unit 131 may include a current limiting resistor R3. The controlled terminal of switch Q1 is connected to comparison control circuit 120 via current limiting resistor R3.
[0072] In this embodiment, the load control circuit 130 achieves effective control of the load 300 through the coordinated use of the current limiting unit 131, the voltage determining unit 132, and the switch tube Q1. The circuit is simple, reliable, and highly flexible.
[0073] In order to better understand the above embodiments, Figure 3-4 The embodiments are explained in detail. Figure 3-4 In the illustrated embodiment, the input signal is provided by signal input module 200, which is a temperature detection module. Load 300 includes a buzzer (BUZ). Temperature detection module 200 and buzzer (BUZ) time-share an I / O port (i.e., multiplexed port 111) of the MCU chip. This I / O port is configured by software to operate in either input or output mode. In input mode, it functions as an analog-to-digital (A / D) detection port; in output mode, it outputs control signals.
[0074] The voltage range of the temperature signal (i.e., "input signal") output by the signal input module 200 is 2.2V-4.1V, and the reference voltage signal Vref is 2V. The MCU outputs a PWM signal as a control signal, with a high level of 5V and a low level of 0V.
[0075] exist Figure 3 In the embodiment shown, when the time-multiplexed I / O port is configured as an AD detection port, the reference voltage signal input to the inverting input of the comparator U1 is 2V, which is lower than the voltage of the temperature signal input to the non-inverting input 2.2V-4.1V. At this time, the comparator U1 outputs a high-level (5V) disconnect signal, the switch tube Q1 is turned off, and the buzzer BUZ does not sound.
[0076] When the buzzer is activated (BUZ), the software changes the I / O port from the default AD detection port to an output port, outputting a PWM signal of a specific frequency. When the PWM signal is high (5V), comparator U1 outputs a high (5V) disconnect signal, turning off switch Q1. When the PWM signal is low (0V), the voltage at comparator U1's non-inverting input (0V) is lower than the voltage at its inverting input (2V), causing comparator U1 to output a low (0V) connect signal, turning on switch Q1 and causing the buzzer to sound. When the buzzer stops, the software changes the I / O port back to the AD detection port.
[0077] exist Figure 4 In the embodiment shown, when the time-multiplexed I / O port is configured as an AD detection port, the reference voltage signal input to the non-inverting input of the comparator U1 is 2V, which is lower than the voltage of the temperature signal connected to the inverting input 2.2V-4.1V. The comparator U1 outputs a low-level disconnect signal, the switch tube Q1 is cut off, and the buzzer BUZ does not sound.
[0078] When the buzzer is activated, the software changes the IO port from the default AD detection port to an output port, outputting a PWM signal of a certain frequency. When the PWM signal is high (5V), comparator U1 outputs a low-level disconnect signal, turning off switch Q1. When the PWM signal is low (0V), the voltage at comparator U1's non-inverting input (2V) is higher than the voltage at its inverting input (0V), causing comparator U1 to output a high-level (5V) turn-on signal, turning on switch Q1 and causing the buzzer to sound. When the buzzer stops, the software changes the IO port back to the AD detection port.
[0079] This circuit can be used for ambient temperature detection and buzzing. Usually, the ambient temperature changes slowly, and the buzzer typically only lasts 1-2 seconds. During the buzzing process, the MCU can memorize the temperature before the buzzing, assuming the ambient temperature is still the same as before. When the buzzing stops, AD detection is performed immediately, effectively achieving the required ambient temperature detection and buzzing functions. This allows the AD detection and buzzer driver to share a single I / O port, saving an MCU chip I / O port and bringing greater flexibility and cost-effectiveness to the circuit design.
[0080] Based on the same concept, the embodiment of the present application also provides an electrical device, such as Figure 5 As shown, the electric device includes a signal input module 200, a load 300 and a port multiplexing circuit 100. The signal input module 200 is connected to the multiplexing port 111 for outputting input signals.
[0081] Since the electric device includes the port multiplexing circuit 100 provided in the above embodiment, the electric device also has the beneficial effects of the port multiplexing circuit 100 in the above embodiment. The similarities can be understood by referring to the above explanation of the port multiplexing circuit 100 and will not be repeated below.
[0082] In one embodiment, the signal input module 200 is a temperature detection module. Figure 3-4 The temperature detection module may specifically include a temperature detection resistor R5 and a third voltage divider resistor R6. A first end of the temperature detection resistor R5 is connected to the power supply VCC, a second end of the temperature detection resistor R5 is grounded via the third voltage divider resistor R6, and a common end of the temperature detection resistor R5 and the third voltage divider resistor R6 is connected to the multiplexing port 111.
[0083] The temperature detection resistor R5 is a thermistor or other type of temperature-sensitive resistor whose resistance changes with temperature. The third voltage divider resistor R6 forms a voltage divider circuit with the temperature detection resistor R5 to adjust the voltage range of its output signal (i.e., input signal).
[0084] In this embodiment, when the ambient temperature changes, the resistance value of temperature detection resistor R5 changes accordingly. Because the third voltage-dividing resistor R6 forms a voltage-dividing circuit with temperature detection resistor R5, changes in the resistance value of temperature detection resistor R5 cause changes in the voltage at the common terminal (i.e., multiplexed port 111). In this case, multiplexed port 111 functions as an analog-to-digital (AD) detection port, converting the current voltage signal at the port into a digital signal, thereby enabling accurate temperature measurement.
[0085] In actual implementation, the signal input module may further include a capacitor C1 , and a common end connected to the temperature detection resistor R5 and the third voltage-dividing resistor R6 is grounded via the capacitor C1 .
[0086] When temperature changes cause the resistance value of the temperature detection resistor R5 to change, capacitor C1 can absorb or release charge, thereby slowing down transient voltage changes and making the voltage of the multiplexed port 111 more stable. In addition, in some cases, the temperature detection module may be subject to interference from other circuits or power supplies. Capacitor C1 can act as a decoupling capacitor to prevent these interference signals from entering the temperature detection circuit through the common terminal, thereby improving the circuit's anti-interference capability.
[0087] In one embodiment, the load 300 includes a buzzer BUZ connected to the load control circuit 130. This implements a circuit design in which AD detection and buzzer BUZ driving share one I / O port, thereby saving one chip I / O port resource of the MCU.
[0088] In actual implementation, the buzzer BUZ can be connected in parallel with resistor R7. This is because the impedance of the piezoelectric passive buzzer itself is very small and is easily affected by external interference and problems. By connecting resistor R7 in parallel at both ends of the buzzer BUZ, the current is limited, the voltage is limited, and the amplitude is stabilized, making the sound quality of the buzzer BUZ better and more stable. In addition, a suitable parallel resistor 7 can control the volume of the buzzer BUZ. According to Ohm's law, current and resistance are inversely proportional. The smaller the current, the smaller the amplitude of the sound and the lower the volume. By adjusting the resistance value of the parallel resistor R7, the current passing through the buzzer BUZ can be controlled, thereby achieving the purpose of adjusting the volume.
[0089] In a specific embodiment, when the temperature of 0° C. to 40° C. needs to be detected, the resistance range of the temperature detection resistor R5 is 325KΩ to 53KΩ, and the voltage range generated by the temperature detection resistor R5 is 2.2V to 4.1V.
[0090] When the I / O port is configured as an AD detection port, the voltage range of the temperature signal output by the signal input module 200 is 2.2V-4.1V, and the reference voltage signal Vref is 2V. At this time, the comparator U1 outputs a disconnect signal to control the switch tube Q1 to be cut off, and the I / O port can perform normal AD detection function.
[0091] When the buzzer is required to sound, the I / O port is changed from an AD detection port to an output port, outputting a PWM signal of a certain frequency as a control signal. Comparator U1 controls the on / off state of switch Q1 based on the on / off signals corresponding to the PWM signal output frequency, thereby causing the buzzer to sound. When the buzzer stops, the I / O port can be changed back to an AD detection port.
[0092] This electrical device can be used for ambient temperature detection and buzzing. Typically, ambient temperature changes are slow, and the buzzer typically only lasts 1-2 seconds. During the buzzing process, the MCU can memorize the temperature immediately before the buzzing sound, assuming the ambient temperature is still the same. When the buzzing sound ends, AD detection is immediately performed, effectively implementing the required ambient temperature detection and buzzing functions. This allows a circuit design in which AD detection and buzzer driver share a single I / O port, saving an MCU chip I / O port resource and increasing the design flexibility and cost-effectiveness of the electrical device.
[0093] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0094] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the utility model patent. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A port multiplexing circuit, characterized in that: include: A controller having at least one multiplexing port, wherein the multiplexing port is used to receive an input signal; The multiplex port is used to receive input signals when in input mode; the multiplex port is also used to output control signals when in output mode; a comparison control circuit, wherein the number of the comparison control circuits is the same as the number of the multiplexed ports, and each comparison control circuit is connected to one of the multiplexed ports; the comparison control circuit is configured to generate and output a state switching signal according to the control signal; and the comparison control circuit is further configured to stop outputting the state switching signal according to the input signal; The load control circuit is configured such that the number of the load control circuits is the same as the number of the comparison control circuits, each of the load control circuits is connected to a comparison control circuit and is used to connect to a load; the load control circuit is used to control the load according to the state switching signal.
2. The port multiplexing circuit according to claim 1, wherein: The state switching signal includes a conduction signal and a disconnection signal; the comparison control circuit includes a reference voltage generation unit and a comparison unit, the input side of the comparison unit is connected to the reference voltage generation unit and the multiplexing port, and the output side of the comparison unit is connected to the load control circuit; The reference voltage generating unit is used to generate a reference voltage signal; The comparison unit is configured to compare the voltage of the control signal with the voltage of the reference voltage signal, and generate an on signal or an off signal based on the comparison result; It is also configured to generate a disconnection signal based on the input signal and the reference voltage signal.
3. The port multiplexing circuit according to claim 2, characterized in that: The reference voltage generating unit includes a first voltage dividing resistor and a second voltage dividing resistor; the first end of the first voltage dividing resistor is connected to a power supply, and the second end of the first voltage dividing resistor is grounded via the second voltage dividing resistor; the common end connected to the first voltage dividing resistor and the second voltage dividing resistor serves as the output end of the reference voltage generating unit, for outputting the reference voltage signal.
4. The port multiplexing circuit according to claim 2, characterized in that: The comparison unit includes a comparator; a first input end of the comparator is connected to the reference voltage generation unit, a second input end of the comparator is connected to the multiplexing port, and an output end of the comparator is connected to the load control circuit.
5. The port multiplexing circuit according to any one of claims 1 to 4, characterized in that: The load control circuit includes a current limiting unit, a voltage determining unit and a switch tube; the controlled end of the switch tube is connected to the comparison control circuit via the current limiting unit, the first end of the switch tube is used to connect to the load, and the second end of the switch tube is connected to the controlled end via the voltage determining unit.
6. The port multiplexing circuit according to claim 5, characterized in that: The switching tube is an NPN transistor; the base of the NPN transistor serves as the controlled end of the switching tube, the collector of the NPN transistor serves as the first end of the switching tube, and the emitter of the NPN transistor serves as the second end of the switching tube.
7. The port multiplexing circuit according to claim 5, characterized in that: The switching tube is a PNP type transistor; the base of the PNP type transistor serves as the controlled end of the switching tube, the collector of the PNP type transistor serves as the first end of the switching tube, and the emitter of the PNP type transistor serves as the second end of the switching tube.
8. An electrical device, characterized in that: It comprises a signal input module, a load and the port multiplexing circuit according to any one of claims 1 to 7; the signal input module is connected to the multiplexing port and is used to output the input signal.
9. The electrical equipment according to claim 8, characterized in that: The signal input module includes a temperature detection resistor and a third voltage divider resistor, the first end of the temperature detection resistor is connected to the power supply, the second end of the temperature detection resistor is grounded through the third voltage divider resistor, and the common end where the temperature detection resistor and the third voltage divider resistor are connected is connected to the multiplexing port.
10. The electrical equipment according to claim 9, characterized in that: The signal input module further includes a capacitor, and a common end connected to the temperature detection resistor and the third voltage-dividing resistor is grounded via the capacitor.
11. The electrical equipment according to claim 8, characterized in that: The load includes a buzzer, and the buzzer is connected to the load control circuit.