Port multiplexing circuit and electronic product
By multiplexing the control functions of the switching unit and the light-emitting unit on the same set of I/O ports, the problem of buttons and LEDs occupying independent I/O ports is solved, thereby reducing the pin resource requirements of the microcontroller and the chip cost.
Patent Information
- Application Number
- CN202520324704.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2035-02-27
AI Technical Summary
In existing technologies, buttons and LEDs each occupy independent I/O ports, which increases the number of I/O ports, consumes more microcontroller pin resources, and increases chip packaging costs.
By multiplexing the scanning function of the switching unit and the control function of the light-emitting unit on the same group of I/O ports, the number of I/O ports occupied is reduced, and the main control unit dynamically configures the level state for detection and control.
This effectively reduces the pin resource requirements of the microcontroller, reduces chip costs, simplifies the circuit structure, and reduces the risk of failure.
Smart Images

Figure CN223816253U_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of electronic circuit, and particularly relates to a port multiplexing circuit and an electronic product. BACKGROUND
[0002] At present, in many electronic products, keys and LED lamps are common functional modules. Generally, the control method and state detection of these modules need to be realized through the I / O port of a single-chip microcomputer. In the related art, keys and LED lamps respectively occupy independent I / O ports for control. However, when the number of keys and LED lamps is large, this design method will cause a large increase in the number of required I / O ports. The increase in the number of I / O ports not only occupies more single-chip microcomputer pin resources, but also requires the chip to have more pins when the single-chip microcomputer is selected. Generally, the more the number of pins of the single-chip microcomputer, the higher the packaging cost, and the relatively cheaper the chip price.
[0003] In the current environment of fierce competition in the domestic electronic industry, manufacturers of all sizes of home appliances are striving to reduce the cost of the scheme to improve market competitiveness. Generally speaking, the fewer the number of pins of the single-chip microcomputer, the lower the packaging cost, and the relatively cheaper the chip price. Therefore, how to reduce the use of I / O ports while ensuring the realization of functions has become an important direction for reducing product costs. SUMMARY
[0004] In view of the above-mentioned shortcomings of the prior art, the purpose of the present disclosure is to provide a port multiplexing circuit and an electronic product to solve the problems in the related art.
[0005] The first aspect of the present disclosure provides a port multiplexing circuit, comprising:
[0006] a master control unit, the master control unit comprising a plurality of common ports, a plurality of scan ports and a control port;
[0007] a plurality of switch units, each of the common ports is respectively coupled to each of the scan ports through one of the switch units one by one; each of the switch units is used to turn on / off the corresponding common port and scan port;
[0008] a plurality of light-emitting units, each of the common ports is coupled to the control port via at least one of the light-emitting units; wherein the common port and the control port connected to the light-emitting unit as the target to be lighted have opposite levels;
[0009] the master control unit is further configured to make the level of the common port to be detected opposite to the level of other common ports;
[0010] The detection unit is respectively coupled to each of the scan ports, and is configured to determine the conduction state of each of the switch units connected between the common port to be detected and each of the scan ports according to the voltage level of each of the scan ports.
[0011] In an embodiment of the first aspect, the switch unit comprises a key switch, and the key switch is configured to connect the corresponding common port and scan port when conducting.
[0012] In an embodiment of the first aspect, the light-emitting unit comprises a plurality of LEDs, and each of the LEDs is connected to the control port at one end and connected to each of the scan ports at the other end.
[0013] In an embodiment of the first aspect, the control port outputs a low voltage when the connected light-emitting unit is lit, and the corresponding common port outputs a high voltage.
[0014] In an embodiment of the first aspect, the common port to be detected outputs a low voltage, and the detection unit is configured to determine that the corresponding switch unit is not conducting according to the scan port outputting a high voltage, or determine that the corresponding switch unit is conducting according to the scan port outputting a low voltage.
[0015] In an embodiment of the first aspect, the master control unit further comprises a timer, and the master control unit is configured to, when detecting that the voltage level of the scan port changes, detect the voltage level of the scan port again after a preset anti-shake time according to the timing time of the timer.
[0016] In an embodiment of the first aspect, the common port is an input / output port, the scan port is an output port, and the control port is an input port.
[0017] In an embodiment of the first aspect, the electronic product further comprises a notification unit connected to the detection unit, and the notification unit is configured to generate a notification signal of the detection result according to the conduction state.
[0018] In an embodiment of the first aspect, the master control unit comprises a single-chip microcomputer, the common port and the scan port of the single-chip microcomputer are configured to detect the conduction state of the switch unit, and the common port and the control port of the single-chip microcomputer are configured to drive the light-emitting unit.
[0019] The second aspect of the present disclosure provides an electronic product, which comprises the port multiplexing circuit according to any one of the above.
[0020] The beneficial effects of the present disclosure: by multiplexing the scanning of the switch unit and the control function of the light-emitting unit on the same group of I / O ports, thereby reducing the number of single-chip microcomputer I / O port occupation. In the case of a large number of switch units and light-emitting units, the demand for single-chip microcomputer pin resources can be effectively reduced, thereby reducing the chip cost. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 The circuit connection schematic diagram of a port multiplexing circuit in an embodiment of the present disclosure is shown.
[0022] Figure 2 The circuit connection schematic diagram of a port multiplexing circuit in another embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0023] The embodiments of the present disclosure will be described in detail below with specific specific examples. Those skilled in the art can easily understand other advantages and effects of the present disclosure from the disclosed messages. The present disclosure can also be implemented or applied by different specific embodiments, and the details in the present disclosure can be modified or changed according to different views and applications without departing from the spirit of the present disclosure. It should be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0024] The embodiments of the present disclosure will be described in detail below with specific specific examples. Those skilled in the art can easily understand other advantages and effects of the present disclosure from the disclosed messages. The present disclosure can also be implemented or applied by different specific embodiments, and the details in the present disclosure can be modified or changed according to different views and applications without departing from the spirit of the present disclosure. It should be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0025] In the present disclosure, the expressions of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics expressed in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials or characteristics expressed can be combined in any one or a group of embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or features of different embodiments or examples expressed in the present disclosure without conflict.
[0026] In addition, the terms "first", "second" are only used for the purpose of expression, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features limited by "first", "second" can explicitly or implicitly include at least one of the features. In the present disclosure, the meaning of "a group" is two or more, unless otherwise specifically limited.
[0027] For the purpose of clearness of the present disclosure, devices irrelevant to the description are omitted, and the same reference numerals are assigned to the same or similar constituent elements throughout the specification.
[0028] Throughout the specification, when it is said that a certain device is "connected" to another device, this includes not only the case of "direct connection" but also the case of "indirect connection" in which other elements are interposed therebetween. In addition, when it is said that a certain device "includes" a certain constituent element, other constituent elements are not excluded unless specifically stated to the contrary, but it means that other constituent elements can also be included.
[0029] Although the terms first, second, etc. are used herein to refer to various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first interface and a second interface, etc. are denoted. Also, as used herein, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises," "comprising," "includes" and / or "including," when used herein, specify the presence of stated features, steps, operations, elements, modules, items, and / or groups thereof, but do not preclude the presence or addition of one or more other features, steps, operations, elements, modules, items, and / or groups thereof. As used herein, the terms "or" and "and / or" are construed to be inclusive, or mean either one or any combination thereof. Thus, "A, B, or C" or "A, B, and / or C" means "any of the following: A; B; C; A and B; A and C; B and C; A, B, and C." Exceptions to this definition are only present when items, components, elements, or steps are not mutually exclusive from one another in some manner.
[0030] The professional terms used herein are used only to refer to specific embodiments, and are not intended to limit the present disclosure. The singular form used herein, unless the context clearly indicates otherwise, also includes the plural form. The meaning of "include" used in the specification is to specify a certain characteristic, region, integer, step, operation, element, and / or component, and does not exclude the presence or addition of other characteristics, regions, integers, steps, operations, elements, and / or components.
[0031] Although not differently defined, all terms including technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. Terms defined in commonly used dictionaries are to be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and should not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
[0032] In the related art, the key and the LED lamp usually need to independently occupy the I / O port resources of the single-chip microcomputer. When the number of keys and LED lamps is large, the design has the following defects: each key and LED lamp needs to be independently connected to the I / O port of the single-chip microcomputer, resulting in a sharp increase in the number of I / O ports required. The increase in the number of I / O ports forces the selection of a single-chip microcomputer with more pins, and the packaging cost of the chip with a large number of pins increases significantly. The wiring of a large number of I / O ports leads to an increase in circuit complexity, increasing the number of peripheral components and the risk of failure.
[0033] To solve the above problems, an embodiment of the present disclosure provides a port multiplexing circuit, wherein Figure 1 As shown in the embodiment, the scanning and light emitting functions of the switch unit 200 and the control function of the light emitting unit 300 are multiplexed on the same set of common ports C1, reducing the number of I / O port occupied. For example, 4 common ports C1 and 4 scanning ports R1 can support 16 switch units 200 and 4 light emitting units 300, while the traditional scheme requires 20 independent I / O ports.
[0034] Specifically, in Figure 1 In an embodiment, the port multiplexing circuit comprises a master control unit 100, a switch unit 200, a light emitting unit 300, and a detection unit 400.
[0035] The master control unit 100 comprises a plurality of common ports C1, a plurality of scanning ports R1, and a control port P1. Optionally, the common port C1 is an input / output port; the scanning port R1 is an output port; and the control port P1 is an input port. Optionally, the master control unit 100 comprises a single-chip microcomputer, and the common ports C1 and the scanning ports R1 of the single-chip microcomputer are used for on / off state detection of the switch unit 200; and the common ports C1 and the control port P1 of the single-chip microcomputer are used for driving the light emitting unit 300.
[0036] The switch unit 200 can be multiple, and each common port C1 is respectively coupled to each scanning port R1 through one switch unit 200 one by one; and each switch unit 200 is used for turning on / off the corresponding common port C1 and scanning port R1.
[0037] The light emitting unit 300 can be multiple, and each common port C1 is coupled to the control port P1 via at least one light emitting unit 300; wherein the common port C1 and the control port P1 connected by the light emitting unit 300 as the target to be lighted have opposite levels.
[0038] The master control unit 100 is further configured to make the level of the common port C1 to be detected opposite to the levels of other common ports C1.
[0039] The detection unit 400 is coupled to each of the scan ports R1, and is configured to determine the conduction state of each of the switch units 200 connected between the common port C1 to be detected and each of the scan ports R1 according to the level of each of the scan ports R1.
[0040] Specifically, in some embodiments, the master control unit 100 implements the detection function of the switch unit 200 by dynamically configuring the level state of the common port C1. When all the switch units 200 need to be detected, the common port C1 is sequentially set as the common port C1 to be detected to detect the state of all the switch units 200 connected to the common port C1 to be detected. At this time, the master control unit 100 will execute a differentiated level configuration strategy: the target common port C1 to be detected is configured as a low level (logic 0) state; and other non-detection common ports C1 are simultaneously set as a high level (logic 1) state. After the above level configuration is completed, the master control unit 100 will start the scan detection sequence: in order to make the scan port R1 and the common port C1 form a conduction path when the level difference is significant, the high level signal is first applied to each of the scan ports R1, and then the actual level state of each of the scan ports R1 is monitored in real time. When a certain scan port R1 is set as a high level, and the corresponding switch unit 200 is turned on, the connected scan port R1 and common port C1 are connected, and if the common port C1 is a low level, the level of the scan port R1 will be pulled down, so that the master control unit 100 can detect which switch unit 200 is turned on. The conduction state indicates that the corresponding switch unit connected to the corresponding scan port R1 is in a normal working state. Therefore, the detection unit 400 is configured to determine that the conduction state of the corresponding switch unit 200 is on according to the output of the low level of the scan port R1. Since the common port C1 to be detected outputs a low level, the detection unit 400 is further configured to determine that the conduction state of the corresponding switch unit 200 is not on according to the output of the high level of the scan port R1.
[0041] Optionally, the switch unit 200 can include a key switch, which is used to connect the corresponding common port C1 and scan port R1 when the key switch is pressed. Further optionally, the switch unit 200 can include a mechanical key switch, which can temporarily connect the corresponding common port C1 and scan port R1 when the user presses the key. When the key is pressed, the electrical connection between the corresponding common port C1 and scan port R1 is turned on. When the key is released, the electrical connection between the common port C1 and scan port R1 is disconnected.
[0042] In combination Figure 1In an embodiment, when the light emitting unit 300 needs to be controlled, a level signal is first sent to the control port P1. Optionally, the control port P1 outputs a low level when the connected light emitting unit 300 is lit, and the corresponding common port C1 outputs a high level. In detail, when the light emitting unit 300 needs to be controlled, a low level signal is applied to the control port P1, so that the target light emitting unit 300 can be turned on, and the common port C1 connected to the target light emitting unit 300 is set to a high level, so that a level difference is formed between the two ends of the light emitting unit 300, thereby forming a loop. The advantage of this setting is that it does not affect the scanning of the switch unit 200, and the light emitting unit 300 will not be lit when it is not needed due to the level setting of the common port C1. At the same time, through the setting of the common port C1, the scanning port R1 and the control port P1, the number of ports used can be reduced on the basis of being able to complete detection and driving. At the same time, conversely, when the light emitting unit 300 needs to be controlled, a high level signal is applied to the light emitting unit 300, and at this time, a low level signal needs to be applied to the common port C1 connected to the target light emitting unit 300 to form a level difference. Optionally, the light emitting unit 300 includes LEDs, one end of each of the LEDs is connected to the control port P1, and the other end is connected to each of the scanning ports R1. When no light emitting unit 300 needs to be lit, such as when detecting the state of the switch unit 200 between R1 and C1, in one example, P1 can be in a floating state, i.e., follow the C1 level, or in another example, if the time when C1 is low and R1 is high during scanning is short and difficult to be perceived, P1 can also be fixed to a high level or a low level.
[0043] Optionally, the main control unit 100 further includes a timer, and the main control unit 100 is configured to, when detecting that the level of the scanning port R1 changes, detect the level of the scanning port R1 again after a preset anti-shake time according to the timing time of the timer. In order to prevent false detection caused by the physical characteristics (such as the bounce phenomenon) of mechanical keys or switches, a timer can be introduced in the main control unit 100, and the main control unit 100 is configured to, when detecting that the level of the scanning port R1 changes, detect the level of the scanning port R1 again after a preset anti-shake time according to the timing time of the timer. After detecting the level change, wait for a preset time (usually a few milliseconds), and then detect again to confirm whether the level change is valid.
[0044] Optionally, in Figure 2In the embodiment, the port multiplexing circuit further comprises a notification unit 500 connected to the detection unit 400, for generating a notification signal of the detection result according to the conduction state. The notification signal can be an audible prompt (such as a buzzer), a visual prompt (such as an indicator light), or a data output (such as sending a message through a serial port).
[0045] In yet another embodiment of the present disclosure, an electronic product is provided, which comprises the port multiplexing circuit according to any one of the above embodiments.
[0046] The above embodiments are only illustrative of the principles and effects of the present disclosure, and are not intended to limit the present disclosure. Any person skilled in the art can modify or change the above embodiments without departing from the spirit and scope of the present disclosure. Therefore, all equivalent modifications or changes made by those skilled in the art without departing from the spirit and technical ideas disclosed by the present disclosure shall still be covered by the protection scope of the present disclosure.
Claims
1. A port multiplexing circuit, comprising: include: The main control unit includes multiple common ports, multiple scanning ports, and one control port; Multiple switching units are provided, and each of the common ports is coupled to each of the scanning ports in a one-to-one correspondence through one of the switching units; each of the switching units is used to turn on / off the corresponding common port and scanning port; Multiple light-emitting units, each of the common ports being coupled to the control port via at least one of the light-emitting units; wherein the common port to which the light-emitting unit, which is the target to be illuminated, is connected has opposite voltage levels to the control port; The main control unit is also configured to make the voltage level of the common port to be detected opposite to the voltage levels of other common ports; The detection unit is coupled to each of the scanning ports and is used to determine the conduction state of each switching unit connected between the common port to be detected and each of the scanning ports based on the level of each scanning port.
2. The port multiplexing circuit of claim 1, wherein, The switching unit includes a push-button switch, which is used to connect the common port and the scanning port when the switch is turned on.
3. The port multiplexing circuit of claim 1, wherein, The light-emitting unit includes LEDs, with one end of each LED connected to the control port and the other end connected to each of the scanning ports.
4. The port multiplexing circuit of claim 1, wherein, The control port outputs a low level when the connected light-emitting unit is lit, and the corresponding common port outputs a high level.
5. The port multiplexing circuit of claim 1, wherein, The common port to be detected outputs a low level; the detection unit is configured to determine the conduction state of the corresponding switch unit as not conducting based on the high level output of the scanning port, or to determine the conduction state of the corresponding switch unit as conducting based on the low level output of the scanning port.
6. The port multiplexing circuit of claim 1, wherein, The main control unit further includes a timer, and the main control unit is configured to detect the level of the scanning port again after a preset anti-jitter time, according to the timing time of the timer, when a change in the level of the scanning port is detected.
7. The port multiplexing circuit of claim 1, wherein, The common port is an input / output port; the scanning port is an output port; and the control port is an input port.
8. The port multiplexing circuit of claim 1, wherein, It also includes a notification unit, connected to the detection unit, for generating a notification signal of the detection result based on the conduction state.
9. The port-multiplexing circuit of claim 1, wherein, The main control unit includes a microcontroller, the common port of the microcontroller and the scanning port are used for detecting the conduction state of the switching unit; the common port of the microcontroller and the control port are used for driving the light-emitting unit.
10. An electronic product, characterized by comprising: Includes the port multiplexing circuit as described in any one of claims 1-9 above.