GPIO multiplexing circuit
By designing a GPIO multiplexing circuit, using time division multiplexing design and microcontroller control, the functional multiplexing of LEDs and buttons in power tools is realized, solving the problem of the high demand for GPIO pins in the existing technology, reducing costs and improving system stability.
Patent Information
- Application Number
- CN202422063850.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2034-08-26
AI Technical Summary
In the prior art, power tools such as angle grinders require multiple GPIO pins to control LED display and key functions, resulting in high demand and high cost for MCU GPIO pins.
A GPIO multiplexing circuit is designed, and the driving module, indicator light module and key module are controlled by a microcontroller, and the time division multiplexing design is adopted. The five GPIO lines logic combination realizes the function of controlling six LED lights and four keys.
The requirement of five GPIOs to control eleven inputs and outputs is realized, which greatly reduces the use of GPIOs, reduces costs and bill of materials, and improves the operating efficiency and stability of the system.
Smart Images

Figure CN222954015U_ABST
Abstract
Description
Technical Field
[0001] The utility model relates to the technical field of integrated circuits, and in particular to a GPIO multiplexing circuit. Background Art
[0002] The electric tools currently used in the market, such as brushless and sensorless angle grinders, are selling very well and are widely used in various gardening and agricultural sites. The angle grinders on the market require power indicator lights, gear indicator lights, button functions, etc. The power indicator lights generally require six light-emitting diodes, and the buttons are generally set to four, which are used to display the gear status and the circuit system start.
[0003] Traditional technologies often use a single GPIO pin to control a GPIO function, i.e., LED display requires 6 GPIOs, key detection requires 4 GPIOs, and locking the power requires 1 GPIO. This method requires more GPIO pins for the MCU, increasing application costs and material usage. Utility Model Content
[0004] In view of the above-mentioned shortcomings of the prior art, an object of the present invention is to provide a GPIO multiplexing circuit for solving the problem of high cost of using a single GPIO pin to control a GPIO function in the prior art.
[0005] In order to achieve the above-mentioned purpose and other related purposes, the utility model provides a GPIO multiplexing circuit, including a driving module, an indicator light module and a key module, wherein the driving module, the indicator light module and the key module are all controlled by a single chip microcomputer;
[0006] The driving module uses a MOS tube Q3 and a transistor Q1, the D pole of the MOS tube Q3 is connected to the base of the transistor Q1, the S pole of the MOS tube Q3 is grounded, and the emitter of the transistor Q1 is used to drive the electric tool to operate;
[0007] The indicator light module uses six light-emitting diodes LED1-LED6 to indicate different power states of the power tool;
[0008] The button module uses four buttons SW1, SW2, S1, and S2. The buttons SW1 and SW2 are used to correspond to different gear states of the power tool, and the buttons S1 and S2 are used to correspond to the application state of the circuit system.
[0009] The GPIO multiplexing circuit also uses five GPIO lines Scanline1, Scanline2, Scanline3, RL1, and RL2. The input ends of the light-emitting diodes LED1 and LED2 are connected to Scanline1, the input ends of the light-emitting diodes LED3 and LED4 are connected to Scanline2, and the input ends of the light-emitting diodes LED5 and LED6 are connected to Scanline3; the output ends of the light-emitting diodes LED1, LED3, and LED5 are connected to RL1, and the output ends of the light-emitting diodes LED2, LED4, and LED6 are connected to RL2;
[0010] The button SW1 is connected to Scanline2, the button SW2 is connected to Scanline3, the button S1 is connected to Scanline1, and the button S2 is connected to RL1;
[0011] The G pole of the MOS tube Q3 is connected to Scanline1.
[0012] In an embodiment of the present invention, a voltage stabilizing chip U1 is further provided in the driving module, and the voltage stabilizing chip U1 is connected to the collector of the transistor Q.
[0013] In one embodiment of the utility model, a storage capacitor C14 is provided between Scanline1 and the MOS tube Q3, a resistor R21 is connected between the storage capacitor C14 and Scanline1, and a resistor R24 is connected between the storage capacitor C14 and the MOS tube Q3, and the resistance value of the resistor R21 is smaller than the resistance value of the resistor R24.
[0014] In one embodiment of the present invention, a unidirectional conducting diode D5 is disposed between the Scanline1 and the resistor R21 .
[0015] In one embodiment of the present invention, a unidirectional conducting diode D6 is provided between Scanline1 and the button S1, and a unidirectional conducting diode D7 is provided between RL1 and the button S2. The output ends of the unidirectional conducting diode D6 and the unidirectional conducting diode D7 are both connected to the D pole of the MOS tube Q3.
[0016] As described above, the GPIO multiplexing circuit of the present invention has the following beneficial effects:
[0017] The utility model adopts a time-division multiplexing design concept. Through the logical combination of five GPIO lines, Scanline1, Scanline2, Scanline3, RL1, and RL2, it can realize the functions of controlling the scanning and lighting of six LED lights, reading four button input signals, and one output control, meeting the demand of five GPIOs controlling eleven inputs and outputs, greatly reducing the use of GPIOs, effectively reducing costs and reducing the bill of materials; and reducing the number of GPIOs used can also be conducive to better management and control of these nodes, thereby improving the overall operating efficiency and stability of the system; the utility model limits the execution time of a single GPIO function to between 1 and 1.5 milliseconds, and the fastest execution time of eleven inputs and outputs is only 11 milliseconds, which does not affect the visual viewing of the staff at all, can meet the use needs of power tools, and is conducive to large-scale promotion and application in the market. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Shown is a circuit schematic diagram of the GPIO multiplexing circuit disclosed in the utility model. DETAILED DESCRIPTION
[0019] The following is a description of the implementation of the present invention by means of specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification.
[0020] See also Figure 1 It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings in this specification are only used to match the contents disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the conditions under which the utility model can be implemented. Therefore, they have no substantial technical significance. Any structural modification, change in proportion or adjustment of size should still fall within the scope of the technical content disclosed by the utility model without affecting the effects and purposes that can be achieved by the utility model.
[0021] Example 1, please refer to Figure 1The present embodiment provides a GPIO multiplexing circuit, including a driving module, an indicator light module and a key module, wherein the driving module, the indicator light module and the key module are all controlled by a single chip microcomputer; the driving module adopts a MOS tube Q3 and a transistor Q1, wherein the D pole of the MOS tube Q3 is connected to the base of the transistor Q1, the S pole of the MOS tube Q3 is grounded, and the emitter of the transistor Q1 is used to drive the electric tool to operate; the driving module is also provided with a voltage stabilizing chip U1, which is connected to the collector of the transistor Q; the indicator light module adopts six light emitting diodes LED1-LED6 to indicate different power states of the electric tool; the key module adopts four keys SW1, SW2, S1, S2, keys SW1 and SW2 are used to correspond to different gear states of the electric tool, and keys S1 and S2 are used to correspond to the application state of the circuit system.
[0022] The GPIO multiplexing circuit also uses five GPIO lines Scanline1, Scanline2, Scanline3, RL1, and RL2. The input ends of the light-emitting diodes LED1 and LED2 are connected to Scanline1, the input ends of the light-emitting diodes LED3 and LED4 are connected to Scanline2, and the input ends of the light-emitting diodes LED5 and LED6 are connected to Scanline3; the output ends of the light-emitting diodes LED1, LED3, and LED5 are connected to RL1, and the output ends of the light-emitting diodes LED2, LED4, and LED6 are connected to RL2; for example, when LED1 needs to be lit alone, Scanline1 is defined as a high level, RL1 outputs 0V, Scanline2 and Scanline3 output low levels, and RL2 outputs a high level.
[0023] The button SW1 is connected to Scanline2, the button SW2 is connected to Scanline3, the button S1 is connected to Scanline1, and the button S2 is connected to RL1; when it is necessary to detect the switch state of the buttons SW1, SW2, and S1, the outputs of Scanline1, Scanline2, and Scanline3 are defined as 0, and RL1 is defined as the input state; Scanline2 detects a low level when the button SW1 is in the closed state, and a high level when the button SW1 is in the disconnected state; Scanline3 detects a low level when the button SW2 is in the closed state, and a high level when the button SW2 is in the disconnected state; RL1 detects a low level when the button S1 is in the closed state, and a high level when the button S1 is in the disconnected state; when it is necessary to detect the switch state of the button S2, detection is performed through RL1 and RL2, RL1 detects a low level when the button S2 is in the closed state, and a high level when the button S2 is in the disconnected state. A unidirectional conducting diode D6 is provided between Scanline1 and the button S1, and a unidirectional conducting diode D7 is provided between RL1 and the button S2. The output ends of the unidirectional conducting diode D6 and the unidirectional conducting diode D7 are both connected to the D pole of the MOS tube Q3.
[0024] The G pole of the MOS tube Q3 is connected to Scanline1, and an energy storage capacitor C14 is provided between Scanline1 and the MOS tube Q3; when the output of the driving module needs to be controlled, Scanline1 outputs a high level to charge the energy storage capacitor C14; a resistor R21 is connected between the energy storage capacitor C14 and Scanline1, and a resistor R24 is connected between the energy storage capacitor C14 and the MOS tube Q3. The resistance value of the resistor R21 is less than the resistance value of the resistor R24. Specifically, the resistor R21 is 4.7K, and the resistor R24 is 100K, so that the charging speed of the energy storage capacitor C14 is much greater than the discharging speed, so as to maintain the conduction of the MOS tube Q3, and then maintain the conduction of the triode Q1, and maintain the power supply of the entire circuit system. A unidirectional conducting diode D5 is provided between the Scanline1 and the resistor R21, which is used to control the unidirectional output of the driving module.
[0025] The utility model can realize the functions of controlling the scanning and lighting of six LED lights, reading four key input signals, and one output control through the logical combination application of the five GPIO lines Scanline1, Scanline2, Scanline3, RL1, and RL2, meeting the demand of five GPIOs controlling eleven inputs and outputs, greatly reducing the use of GPIOs, effectively reducing costs and reducing the bill of materials; and reducing the number of GPIOs used can also be conducive to better management and control of these nodes, thereby improving the overall operating efficiency and stability of the system.
[0026] In actual application, the five GPIO lines can be combined in pairs to expand more GPIO functions. In this embodiment, the control of the angle grinder only involves 11 GPIO functions, so this embodiment is described with respect to 11 GPIO functions, but the solution is not limited to this.
[0027] Embodiment 2: This embodiment provides a GPIO multiplexing method, including the GPIO multiplexing circuit, comprising the following steps:
[0028] S1. Nine time sequences are divided based on the time division method, and the duration of each time sequence is 1-1.5 milliseconds; only one GPIO function is executed in a single time sequence;
[0029] S2. In the first timing sequence, Scanline1 is defined to output a high level, and the energy storage capacitor C14 in the driving module is charged and discharged, so as to keep the MOS tube Q3 and the transistor Q1 turned on, thereby maintaining the power supply of the circuit system;
[0030] S3, in the second to seventh time sequences, define the high and low level states of the input and output ends of the light-emitting diodes LED1-LED6 in sequence, so that one or more of the light-emitting diodes are lit;
[0031] S4, in the eighth time sequence, the switch states of the buttons SW1, SW2, and S1 are detected through Scanline1, Scanline2, and Scanline3;
[0032] S5. In the ninth time sequence, the switch state of the key S1 is detected through RL1 and RL2;
[0033] The above steps S1 to S5 constitute a complete GPIO multiplexing process.
[0034] The utility model limits the execution time of a single GPIO function to between 1 and 1.5 milliseconds, and can execute eleven inputs and outputs in as fast as 11 milliseconds, without affecting the visual viewing of staff at all. It can meet the use requirements of power tools and is conducive to large-scale promotion and application in the market.
[0035] Embodiment: This embodiment provides a GPIO multiplexing device, including a memory and a processor, the memory is used to store a computer program, and the processor is used to implement the steps of the GPIO multiplexing method provided in Embodiment 2 when executing the computer program.
[0036] Embodiment 4, this embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor, the steps of the GPIO multiplexing method provided in Embodiment 2 are implemented. It can be understood that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory), ROM, random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0037] In summary, the utility model adopts the design concept of time division multiplexing, and realizes the functions of controlling the scanning and lighting of six LED lights, reading four button input signals, and one output control through five GPIO lines, meeting the requirements of five GPIOs controlling eleven inputs and outputs, greatly reducing the use of GPIOs, effectively reducing costs and reducing the bill of materials; and reducing the number of GPIOs used can also be conducive to better management and control of these nodes, thereby improving the overall operating efficiency and stability of the system; the utility model limits the execution time of a single GPIO function to between 1-1.5 milliseconds, and the fastest execution time of eleven inputs and outputs is only 11 milliseconds, which does not affect the visual viewing of the staff at all, can meet the use requirements of power tools, and is conducive to the large-scale promotion and application to the market. Therefore, the utility model effectively overcomes the various shortcomings of the prior art and has a high industrial utilization value.
[0038] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A GPIO multiplexing circuit, comprising a driving module, an indicator light module and a key module, wherein the driving module, the indicator light module and the key module are all controlled by a single chip microcomputer; The driving module uses a MOS tube Q3 and a transistor Q1, the D pole of the MOS tube Q3 is connected to the base of the transistor Q1, the S pole of the MOS tube Q3 is grounded, and the emitter of the transistor Q1 is used to drive the electric tool to operate; The indicator light module uses six light-emitting diodes LED1-LED6 to indicate different power states of the power tool; The button module uses four buttons SW1, SW2, S1, and S2. The buttons SW1 and SW2 are used to correspond to different gear states of the power tool, and the buttons S1 and S2 are used to correspond to the application state of the circuit system. Features: The GPIO multiplexing circuit also uses five GPIO lines Scanline1, Scanline2, Scanline3, RL1, and RL2. The input ends of the light-emitting diodes LED1 and LED2 are connected to Scanline1, the input ends of the light-emitting diodes LED3 and LED4 are connected to Scanline2, and the input ends of the light-emitting diodes LED5 and LED6 are connected to Scanline3; the output ends of the light-emitting diodes LED1, LED3, and LED5 are connected to RL1, and the output ends of the light-emitting diodes LED2, LED4, and LED6 are connected to RL2; The button SW1 is connected to Scanline2, the button SW2 is connected to Scanline3, the button S1 is connected to Scanline1, and the button S2 is connected to RL1; The G pole of the MOS tube Q3 is connected to Scanline1.
2. The GPIO multiplexing circuit according to claim 1, characterized in that: The driving module is also provided with a voltage stabilizing chip U1 , which is connected to the collector of the transistor Q.
3. The GPIO multiplexing circuit according to claim 1, characterized in that: A storage capacitor C14 is provided between Scanline1 and the MOS tube Q3, a resistor R21 is connected between the storage capacitor C14 and Scanline1, and a resistor R24 is connected between the storage capacitor C14 and the MOS tube Q3, and the resistance value of the resistor R21 is smaller than the resistance value of the resistor R24.
4. The GPIO multiplexing circuit according to claim 3, characterized in that: A unidirectional conducting diode D5 is provided between the Scanline1 and the resistor R21.
5. The GPIO multiplexing circuit according to claim 1, characterized in that: A unidirectional conducting diode D6 is provided between Scanline1 and the button S1, and a unidirectional conducting diode D7 is provided between RL1 and the button S2. The output ends of the unidirectional conducting diode D6 and the unidirectional conducting diode D7 are both connected to the D pole of the MOS tube Q3.