LED driving circuit and indicating device electronic equipment

By connecting LEDs between the IO pins of the MCU, using the combination of high and low levels and floating states, the LEDs are turned on separately, solving the problem of excessive use of MCU IO pins, reducing costs and expanding the MCU selection range.

CN119562406APending Publication Date: 2025-03-04SHENZHEN C&D ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411877652.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing LED indicator driving circuit needs to occupy a large number of IO pins of the MCU, limiting the selection of the MCU and increasing the cost.

Method used

By connecting two LEDs between the IO pins of each two MCU, the LEDs are driven by a combination of high level, low level and floating states to achieve separate lighting of the LEDs.

Benefits of technology

Reduces the MCU IO pin usage and supports the individual lighting of up to n×(n-1) LEDs, expands the MCU selection range, reduces costs, and improves the driving flexibility of LEDs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119562406A_ABST
    Figure CN119562406A_ABST
Patent Text Reader

Abstract

The invention relates to an LED drive circuit, in particular to an LED drive circuit based on IO pins of an MCU. The LED driving circuit comprises an MCU (Microprogrammed Control Unit) and n IO (Input / Output) pins, an LED is connected between every two IO pins in the IO pins, the MCU controls each IO pin to carry out high-level, low-level and floating output and drives each LED in at most n * (n-1) LEDs to be independently lightened, and n is greater than or equal to 3. The MCU is used for carrying out combination of high level, low level and floating output on a plurality of IO pins, independent lighting of n * (n-1) LEDs can be supported at most, the least required number of IO pins can be deduced reversely according to the number of the LEDs needing to be controlled actually, MCU model selection during circuit design is facilitated, the model selection requirement is reduced, the model selection range is expanded, and the circuit design efficiency is improved. The cost control of the product is facilitated, and meanwhile, the arrangement of the LEDs on the line can be correspondingly guided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an LED driving circuit, in particular to an LED driving circuit based on an IO pin of an MCU. Background Art

[0002] LED is a common type of light source. In addition to lighting, it is also commonly seen in many display demand scenarios such as the more common "8" shaped digital display. The traditional method uses a digital tube to drive the digital display. Figure 1 As shown, seven LEDs are used as background light sources to correspond to a light-transmitting strip respectively, and a specific number is displayed through the combination display of the LEDs. In this display control, a single-chip microcomputer is used to drive the LED indicator light, but this method requires 7 MCU pins, that is, each pin corresponds to driving an indicator light. This method also limits the selection of the MCU, and it is necessary to select an MCU with more pins, which is more expensive. The existing LED indicator light is also used in dynamic indication. Through a certain timing control, the LEDs are turned on and off in a certain order in turn to achieve an indication effect similar to a cyclic dynamic or linear dynamic, but the above-mentioned problem also exists in the driving circuit. Therefore, the prior art relies on the number of MCU pins for a large number of LEDs. Summary of the invention

[0003] In a first aspect, an embodiment of the present application provides an LED driving circuit based on the IO pins of the MCU, which can reduce the IO pins of the MCU occupied by driving the LEDs and can realize independent driving of the LEDs.

[0004] The LED driving circuit includes:

[0005] MCU, wherein the MCU includes n IO pins;

[0006] An LED is connected between every two IO pins of the IO pins, and the MCU controls each IO pin to output a high level, a low level, or a floating level, and drives each of a maximum of n×(n-1) LEDs to light up individually;

[0007] Where n≥3.

[0008] By combining high-level, low-level and floating outputs on multiple IO pins through the MCU, it can support the individual lighting of up to n×(n-1) LEDs. The minimum number of IO pins required can be reversely deduced based on the actual number of LEDs that need to be controlled. This is beneficial to the selection of MCU during circuit design, reduces selection requirements, expands the selection range, is beneficial to product cost control, and can also guide the arrangement of LEDs on the circuit accordingly.

[0009] In a possible implementation, two LEDs are connected between every two IO pins, and the two LEDs are connected between the two IO pins with opposite polarities.

[0010] In a possible implementation, the IO pins include a first IO pin, a second IO pin, and a third IO pin;

[0011] A first LED and a second LED are connected between the first IO pin and the second IO pin; an anode of the first LED is connected to the first IO pin, and a cathode of the first LED is connected to the second IO pin; a cathode of the second LED is connected to the first IO pin, and an anode of the second LED is connected to the second IO pin;

[0012] A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

[0013] In a possible implementation, a fifth LED and a sixth LED are connected between the second IO pin and the third IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the third IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the third IO pin.

[0014] In a possible implementation, the MCU further includes a fourth IO pin;

[0015] A fifth LED and a sixth LED are connected between the second IO pin and the fourth IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the fourth IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the fourth IO pin;

[0016] A seventh LED and an eighth LED are connected between the third IO pin and the fourth IO pin; an anode of the seventh LED is connected to the third IO pin, and a cathode of the seventh LED is connected to the fourth IO pin; a cathode of the eighth LED is connected to the third IO pin, and an anode of the eighth LED is connected to the fourth IO pin.

[0017] In a possible implementation, a ninth LED and a tenth LED are connected between the second IO pin and the third IO pin; an anode of the ninth LED is connected to the third IO pin, and a cathode of the ninth LED is connected to the second IO pin; a cathode of the tenth LED is connected to the third IO pin, and an anode of the tenth LED is connected to the second IO pin.

[0018] In a possible implementation, an eleventh LED and a twelfth LED are connected between the first IO pin and the fourth IO pin, an anode of the eleventh LED is connected to the first IO pin, and a cathode of the eleventh LED is connected to the fourth IO pin; an anode of the twelfth LED is connected to the fourth IO pin, and a cathode of the twelfth LED is connected to the first IO pin.

[0019] In a second aspect, an embodiment of the present application further provides an indication device, comprising any one of the LED driving circuits based on the IO pin of the MCU in the first aspect described above.

[0020] In a third aspect, an embodiment of the present application further provides an electronic device, comprising any one of the LED driving circuits based on the IO pins of the MCU in the first aspect described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is the arrangement principle diagram of "8" shaped digital display through seven LEDs;

[0022] Figure 2 This is the circuit component diagram of LED;

[0023] Figure 3 This is the circuit diagram when the LED is turned on;

[0024] Figure 4 This is the circuit diagram when the LED is reversely connected;

[0025] Figure 5 This is the circuit diagram when both the anode and cathode of the LED are floating;

[0026] Figure 6 This is the circuit diagram when the LED anode is floating;

[0027] Figure 7 This is the circuit diagram when the LED cathode is floating;

[0028] Figure 8 A comparison table of the power-on state and the lighting state of the anode and cathode of the LED;

[0029] Fig. 9 Output status table for MCU's IO pins;

[0030] Fig.10 This is a schematic diagram of the connection between an IO pin of the MCU and the anode of an LED;

[0031] Fig.11 This is a schematic diagram of the connection between the two IO pins of the MCU and the two LEDs;

[0032] Fig.12 This is a schematic diagram of the connection between the two IO pins of the MCU and the three LEDs;

[0033] Fig.13 A comparison table of LED lighting states in the connection state of the first embodiment;

[0034] Fig.14 is a circuit diagram of a second embodiment;

[0035] Fig.15 The LED lighting status comparison table of the second embodiment;

[0036] Fig.16 is a circuit diagram of a third embodiment;

[0037] Fig.17 The LED lighting status comparison table of the third embodiment;

[0038] Fig.18 is a circuit diagram of a fourth embodiment;

[0039] Fig.19 The LED lighting status comparison table of the fourth embodiment;

[0040] Fig. 20 is a circuit diagram of a fifth embodiment;

[0041] Fig.21 The LED lighting status comparison table of the fifth embodiment;

[0042] Fig. 22 is a circuit diagram of a sixth embodiment;

[0043] Fig.23 This is a comparison table of LED lighting states of the sixth embodiment. DETAILED DESCRIPTION

[0044] The following is a further detailed description in conjunction with specific embodiments and drawings. Obviously, the described embodiments are only a part of the embodiments, not all of the embodiments. Based on the following embodiments, all other embodiments proposed by ordinary technicians in this field without creative work also fall within the scope of protection of the present invention.

[0045] It should be understood that the controllers and control circuits involved in the embodiments are conventional control technologies or units of those skilled in the art. For example, the control circuit of the controller can be implemented by ordinary technicians in the field using existing technologies.

[0046] The disclosure of the embodiments provides many different implementations or examples to implement different schemes of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described in the embodiments. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, reference numerals and / or reference letters can be repeated in different examples in the embodiments, and this repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various implementations and / or settings discussed. In addition, if various specific examples of processes and materials are provided in the embodiments, those of ordinary skill in the art can be aware of the application of other processes and / or the use of other materials.

[0047] In order to more clearly illustrate the implementation principle of this embodiment, the working relationship between the IO pins of the MCU and the connected LEDs is first described in detail.

[0048] like Figure 2 As shown, the LED indicator light is divided into an anode and a cathode, also called positive and negative poles.

[0049] like Figure 3 As shown, when the positive pole of the power supply is connected to the anode of the LED and the cathode is connected to the negative pole of the power supply, a current loop is formed, the LED is in the forward conduction state, and the LED lights up.

[0050] like Figure 4 As shown, the cathode of the LED is connected to the positive pole of the power supply, and the anode is connected to the negative pole of the power supply. The LED is in a reverse cut-off state and cannot light up.

[0051] like Figure 5 As shown in the figure, the anode and cathode of the LED are not connected, and are in a floating state, so the LED does not light up. The floating state here means that it is neither connected to the power supply nor to the ground, that is, the anode and cathode are not connected, which does not only mean that there is no circuit connection. When the anode and cathode of the LED are connected to the circuit, if there is no access to the electrical signal, it is in a floating state, the circuit is open, and the LED does not light up.

[0052] like Figure 6 As shown, if the anode of the LED is in a floating state, no matter whether the cathode is connected to the positive or negative pole of the power supply, the circuit composed in this way cannot make the LED form a loop circuit, so the LED cannot light up.

[0053] like Figure 7As shown, if the cathode of the LED is in a floating state, no matter whether the anode is connected to the positive or negative pole of the power supply, the circuit composed in this way cannot make the LED form a loop circuit, so the LED cannot light up.

[0054] Therefore, the relationship between applying positive and negative power terminals to the anode and cathode of the LED, or leaving them floating, is abstracted into a table as follows: Figure 8 As shown. Therefore, according to the above principle of LED lighting and non-lighting states, a minimalist circuit is set up, which can effectively control the electronic cost of PCBA;

[0055] After understanding the relationship between the connection and lighting of the anode and cathode of the LED, since the embodiments of the present application involve connecting and driving the LED through the IO pin of the MCU, the level status of the IO pin interface of the MCU is further introduced.

[0056] IO pins are the basic functions of MCU, such as Fig. 9 As shown in the figure, the level of an IO pin interface of MCU can have three states: the first state is a high level state, the second state is a low level state, and the third state is a floating input state. The floating state is also called a suspended state or a suspended state, which means that the IO pin does not output any level signal, that is, when the IO pin is connected to the anode or cathode of the LED, the anode and cathode of the LED are in an open circuit state, and the LED cannot light up no matter what the other pole of the LED is connected to.

[0057] According to the three states of IO and the above table of whether the LED can be lit, we can get the following: Fig.10 The wiring diagram of an IO port with three states and an LED is shown. It should be noted that the three LEDs 1 in the figure are actually presented to represent the three states and are actually the same LED.

[0058] Fig.10 LED1 is used to describe the different wiring methods of the LED on the PCBA to explain the logic of LED lighting and failure to light up:

[0059] When IO1 outputs high level:

[0060] If IO1 is set to high level 1 (LED anode is high level), then if the cathode of LED1 is connected to the ground wire of the circuit board, then LED1 can light up;

[0061] If IO1 is set to high level 1 (LED anode is high level), then if the cathode of LED1 is connected to the power supply of the circuit board, then LED1 cannot light up, because the anode and cathode levels of the LED are both high and cannot form a conduction loop;

[0062] If IO1 is set to high level 1 (LED anode is high level), and the cathode of LED1 is connected to another IO port of MCU, such as IO2, the following situations can be extended:

[0063] If IO2 is set to low level, LED1 can light up;

[0064] If IO2 is set to high level, LED1 cannot light up;

[0065] If IO2 is set to floating, LED1 cannot light up;

[0066] When IO1 is low level:

[0067] If IO1 is low, and the cathode of LED1 is connected to the ground wire of the circuit board, then LED1 cannot light up;

[0068] If IO1 is low, then if the cathode of LED1 is connected to the power supply of the circuit board, then LED1 cannot light up;

[0069] If IO1 is low, then the cathode of LED1 is connected to another IO port of the MCU, such as IO2, and the following situations can be extended:

[0070] If IO2 is set to low level, LED1 cannot light up;

[0071] If IO2 is set to high level, LED1 can light up;

[0072] If IO2 is set to floating, LED1 cannot light up;

[0073] If IO1 is in input floating state:

[0074] No matter where the cathode of LED1 is connected, LED1 cannot be lit.

[0075] From the above description, we can know that an indicator light is controlled by a combination of two IO pin output levels. If one IO pin uses one level, such as a high level, there are three ways to control the LED to achieve the state of the LED being on and off.

[0076] Based on the above relationship between the IO pin output level and the lighting of LED1, Fig.11As mentioned above, when the cathode and anode of the LED are connected between two IO pins to control the lighting of two LED lights, IO2 is also used to connect an indicator light to IO1, so that two IO ports can control two indicator lights. It can be concluded that two IO controls can control the lighting of two lights. There is only one logic to light up LED1, that is, IO1 level is 1 and IO2 level is 0; there is also only one logic to light up LED2, that is, IO1 level is 0 and IO2 level is 1; other logic level combinations will not light up.

[0077] Based on the above principle, combined with the output control of MCU, LED1 and LED2 can be lit at the same time. Since the human eye cannot distinguish the light changes in a very short time, the time-sharing method is used to light up LED1 and LED2 to achieve the purpose of lighting them at the same time. At the same time, the main frequency of MCU is usually at the ns (nanosecond) and us (microsecond) level, which can execute a piece of code in a very short time.

[0078] The MCU drives LED1 and LED2 to light up at the same time by executing the following code in a loop:

[0079] Light up LED1, drive IO1 level to 1, IO2 level to 0;

[0080] Light up LED2, drive IO1 level to 0, and IO2 level to 1.

[0081] The above describes the method and principle of controlling two indicator lights with two IO ports, lighting up one indicator light respectively, and lighting up two indicator lights at the same time.

[0082] like Fig.12 As shown in the figure, when three indicator lights need to be controlled, two indicator lights are already connected to IO1, then connect another indicator light LED3 to IO1. As shown in the figure, the anode of LED3 is connected to IO1, so the cathode of LED3 cannot be connected to the ground wire of the circuit board and IO2. If it is connected, IO1 will control LED3 at the same time when controlling LED1. That is, in this connection state, if LED1 is lit, LED3 will also be lit accordingly, and the effect of controlling LED1 and LED3 separately cannot be achieved.

[0083] In order to achieve individual control of multiple LEDs, the first embodiment of the present application provides a driving circuit for driving multiple LEDs to light up individually through three IO pins of an MCU.

[0084] In the above Fig.12 After the cathode of LED3 in the circuit is connected to an IO3 pin, LED1, LED2 and LED3 can be lit separately. The following describes the logic of separately lighting LED1, LED2 and LED3.

[0085] IO1 high level 1, LED1, LED3 may light up; because LED1, LED3 are connected to IO2, IO3, then LED1, LED3 can be controlled to light up separately. As long as IO2 is set to low level, IO3 is set to high level or floating, then LED1 is lit, LED3 is not lit.

[0086] Similarly, as long as IO2 is set to a high level or floating, and IO3 is set to a low level, only LED3 can light up.

[0087] like Figure 3 As shown, the MCU driving logic of using three IOs to control three indicator lights is as follows:

[0088] LED1 lights up: IO1=1; IO2=0; IO3=floating;

[0089] LED2 lights up: IO1=0; IO2=1; IO3=floating;

[0090] LED3 lights up: IO1=1; IO2=floating; IO3=0;

[0091] If two or three lamps need to be lit at the same time, the MCU driving code is allowed to execute the driving of the two lamps or the driving of the three lamps in a loop.

[0092] For example, when LED1 and LED2 light up at the same time, the driver loop executes two statements:

[0093] IO1=1; IO2=0; IO3=floating;

[0094] IO1=0; IO2=1; IO3=floating;

[0095] While lighting up LED1, LED3 can also be used

[0096] IO1=1, IO2=0; IO3=0;

[0097] Abstract the logical relationship between IO1, IO2, IO3 lighting LED1, LED2, LED3 into Fig.13 The chart shown.

[0098] Based on the basic principle of the first embodiment, Fig.14 As shown, the second embodiment of the present application discloses a driving circuit for driving four LEDs to light up individually through three IO pins of an MCU, wherein IO1 in the figure corresponds to the first IO pin, IO2 corresponds to the second IO pin, IO3 corresponds to the third IO pin, and LED1 to LED4 represent the first LED to the fourth LED.

[0099] In a second embodiment, the LED driving circuit comprises:

[0100] MCU, including a first IO pin IO1, a second IO pin IO2, and a third IO pin IO3;

[0101] A first LED-LED1 and a second LED-LED2 are connected between the first IO pin and the second IO pin; the anode of the first LED-LED1 is connected to the first IO pin IO1, and the cathode of the first LED-LED1 is connected to the second IO pin IO2; the cathode of the second LED LED2 is connected to the first IO pin IO1, and the anode of the second LED is connected to the second IO pin;

[0102] A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

[0103] When working, Fig.15 The output level relationship of IO1 to IO3 shown in the diagram can control the individual lighting of the four LEDs LED1 to LED4.

[0104] The third embodiment of the present application discloses a driving circuit for driving six LEDs through three IO pins, such as Fig.16 As shown, IO1 in the figure corresponds to the first IO pin, IO2 corresponds to the second IO pin, IO3 corresponds to the third IO pin, and LED1 to LED6 represent the first LED to the sixth LED.

[0105] The driving circuit of the third embodiment includes:

[0106] MCU, including a first IO pin, a second IO pin, and a third IO pin;

[0107] A first LED and a second LED are connected between the first IO pin and the second IO pin; an anode of the first LED is connected to the first IO pin, and a cathode of the first LED is connected to the second IO pin; a cathode of the second LED is connected to the first IO pin, and an anode of the second LED is connected to the second IO pin;

[0108] A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

[0109] A fifth LED and a sixth LED are connected between the second IO pin and the third IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the third IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the third IO pin.

[0110] like Fig.17 The level relationship of each IO pin in can realize the individual lighting of LED1 to LED6. Therefore, through the above discussion, three IO ports can be used to drive up to 6 indicator lights; thus, the use efficiency of the IO ports is improved, and a small number of IO ports can be used to drive multiple indicator lights, so as to achieve effective use of resources, thereby reducing the use cost and avoiding resource waste.

[0111] Furthermore, the fourth embodiment of the present application provides a driving circuit for driving eight LEDs using four IO pins, such as Fig.18 As shown, IO1 in the figure corresponds to the first IO pin, IO2 corresponds to the second IO pin, IO3 corresponds to the third IO pin, IO4 corresponds to the fourth IO pin, and LED1 to LED8 represent the first LED to the eighth LED.

[0112] The driving circuit of the fourth embodiment comprises:

[0113] MCU, including a first IO pin IO1, a second IO pin IO2, a third IO pin IO3 and a fourth IO pin;

[0114] A first LED and a second LED are connected between the first IO pin and the second IO pin; an anode of the first LED is connected to the first IO pin, and a cathode of the first LED is connected to the second IO pin; a cathode of the second LED is connected to the first IO pin, and an anode of the second LED is connected to the second IO pin;

[0115] A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

[0116] A fifth LED and a sixth LED are connected between the second IO pin and the fourth IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the fourth IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the fourth IO pin;

[0117] A seventh LED and an eighth LED are connected between the third IO pin and the fourth IO pin; an anode of the seventh LED is connected to the third IO pin, and a cathode of the seventh LED is connected to the fourth IO pin; a cathode of the eighth LED is connected to the third IO pin, and an anode of the eighth LED is connected to the fourth IO pin.

[0118] When working, according to Fig.18 The output level relationship of each IO pin of the MCU shown in the figure can light up 8 LEDs individually. By making full use of the arrangement of LEDs on the PCB, the 8 LEDs can be arranged into digital shapes according to the LED and MCU routing in the figure, thereby controlling the purpose of digital display.

[0119] Further, the fifth embodiment of the present application provides a driving circuit for driving ten LEDs to light up individually through four IO pins of an MCU, such as Fig.19 As shown, IO1 in the figure corresponds to the first IO pin, IO2 corresponds to the second IO pin, IO3 corresponds to the third IO pin, IO4 corresponds to the fourth IO pin, and LED1 to LED10 represent the first LED to the tenth LED. The LED driving circuit of the fifth embodiment includes:

[0120] MCU, the MCU comprising a first IO pin, a second IO pin, a third IO pin and a fourth IO pin;

[0121] A first LED and a second LED are connected between the first IO pin and the second IO pin; an anode of the first LED is connected to the first IO pin, and a cathode of the first LED is connected to the second IO pin; a cathode of the second LED is connected to the first IO pin, and an anode of the second LED is connected to the second IO pin;

[0122] A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

[0123] A fifth LED and a sixth LED are connected between the second IO pin and the fourth IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the fourth IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the fourth IO pin;

[0124] A seventh LED and an eighth LED are connected between the third IO pin and the fourth IO pin; an anode of the seventh LED is connected to the third IO pin, and a cathode of the seventh LED is connected to the fourth IO pin; a cathode of the eighth LED is connected to the third IO pin, and an anode of the eighth LED is connected to the fourth IO pin.

[0125] A ninth LED and a tenth LED are connected between the second IO pin and the third IO pin; an anode of the ninth LED is connected to the third IO pin, and a cathode of the ninth LED is connected to the second IO pin; a cathode of the tenth LED is connected to the third IO pin, and an anode of the tenth LED is connected to the second IO pin.

[0126] When working, Fig. 20 As shown, according to Fig. 20 The output level relationship of each IO pin of the MCU shown can light up ten LEDs individually.

[0127] Furthermore, the sixth embodiment of the present application provides a driving circuit for driving twelve LEDs to light up individually through four IO pins of an MCU.

[0128] like Fig.21 As shown, IO1 in the figure corresponds to the first IO pin, IO2 corresponds to the second IO pin, IO3 corresponds to the third IO pin, IO4 corresponds to the fourth IO pin, and LED1 to LED12 represent the first LED to the twelfth LED. The driving circuit in the fourth embodiment includes:

[0129] MCU, the MCU comprising a first IO pin, a second IO pin, a third IO pin and a fourth IO pin;

[0130] A first LED and a second LED are connected between the first IO pin and the second IO pin; an anode of the first LED is connected to the first IO pin, and a cathode of the first LED is connected to the second IO pin; a cathode of the second LED is connected to the first IO pin, and an anode of the second LED is connected to the second IO pin;

[0131] A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

[0132] A fifth LED and a sixth LED are connected between the second IO pin and the fourth IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the fourth IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the fourth IO pin;

[0133] A seventh LED and an eighth LED are connected between the third IO pin and the fourth IO pin; an anode of the seventh LED is connected to the third IO pin, and a cathode of the seventh LED is connected to the fourth IO pin; a cathode of the eighth LED is connected to the third IO pin, and an anode of the eighth LED is connected to the fourth IO pin.

[0134] A ninth LED and a tenth LED are connected between the second IO pin and the third IO pin; an anode of the ninth LED is connected to the third IO pin, and a cathode of the ninth LED is connected to the second IO pin; a cathode of the tenth LED is connected to the third IO pin, and an anode of the tenth LED is connected to the second IO pin.

[0135] An eleventh LED and a twelfth LED are connected between the first IO pin and the fourth IO pin, the anode of the eleventh LED is connected to the first IO pin, and the cathode of the eleventh LED is connected to the fourth IO pin; the anode of the twelfth LED is connected to the fourth IO pin, and the cathode of the twelfth LED is connected to the first IO pin.

[0136] When working, Fig.21 As shown, according to Fig.21 The output level relationship of each IO pin of the MCU shown can light up twelve LEDs individually.

[0137] It can be seen from the above first to sixth embodiments that:

[0138] When the high level, low level and floating state outputs of the MCU's IO pins are used to control the connected multiple LEDs to light up individually, when the number of IO pins is three, the maximum number of LEDs that support individual control lighting is 3×(3-1)=6, and when the number of IO pins is four, the maximum number of LEDs that support individual control lighting is 4×(4-1)=12. By analogy, when the number of IO pins is five, the maximum number of LEDs that support individual control lighting is 5×(5-1)=20. Therefore, the seventh embodiment can be summarized. In the seventh embodiment, when the number of IO pins is n, the maximum number of LEDs that support individual control lighting is n×(n-1).

[0139] By establishing the calculation relationship between the number of MCU pins and the maximum number of LEDs that can be individually controlled and lit, the MCU that supports the corresponding number of IO pins can be selected based on the number of LEDs that need to be supported, or the maximum number of LEDs that can be individually lit can be inferred based on the number of MCU IO pins. This makes circuit design and component selection more flexible and efficient, and is conducive to the rapid design of related products.

[0140] By controlling the individual lighting of multiple LEDs through the high level, low level and floating state output of the MCU's IO pins, you can set the program to make the controlled LEDs light up in a certain order, and produce a control that gradually lights up along a certain path, such as progress indication, direction indication, and light flow effects. It can also be combined with the MCU's output control to achieve simultaneous lighting of multiple LEDs through fast output control, as long as the non-lighting time is less than the time that the human eye can recognize, the purpose of simultaneous lighting can be achieved. The LED lighting mode is also more flexible and adaptable to a wider range of usage scenarios.

[0141] The eighth embodiment of the present application provides an indication device, which can be used for direction indication, progress indication, time indication, digital display and other types of indication scenarios in which LEDs are individually controlled to light up in turn in a certain order or multiple LEDs are lit up in combination, such as direction signs and time signs. The indication device includes any one of the LED driving circuits based on the IO pins of the MCU in the above-mentioned first to seventh embodiments.

[0142] The ninth embodiment of the present application also provides an electronic device that performs a specific function. The electronic device includes an indicating device as in the eighth embodiment, and the electronic device includes any one of the LED driving circuits based on the IO pins of the MCU in the above-mentioned first to seventh embodiments.

[0143] The above description is only a preferred embodiment of the embodiments of the present application, and does not limit the disclosure scope of the embodiments of the present application. Any equivalent structure or equivalent process transformation made using the embodiment description and drawings of the present application, or directly or indirectly used in other related technical fields, are also included in the patent protection scope supported by the embodiments of the present application.

Claims

1. The LED driving circuit based on the IO pin of MCU is characterized in that: include: MCU, wherein the MCU includes n IO pins; An LED is connected between every two IO pins of the IO pins, and the MCU controls each IO pin to output a high level, a low level, or a floating level, and drives each of a maximum of n×(n-1) LEDs to light up individually; Where n≥3.

2. The LED driving circuit based on the IO pin of MCU as claimed in claim 1, characterized in that: Two LEDs are connected between every two IO pins, and the two LEDs are connected between the two IO pins with opposite polarities.

3. The LED driving circuit based on the IO pin of MCU as claimed in claim 2, characterized in that: The IO pins include a first IO pin, a second IO pin, and a third IO pin; A first LED and a second LED are connected between the first IO pin and the second IO pin; an anode of the first LED is connected to the first IO pin, and a cathode of the first LED is connected to the second IO pin; a cathode of the second LED is connected to the first IO pin, and an anode of the second LED is connected to the second IO pin; A third LED and a fourth LED are connected between the first IO pin and the third IO pin; an anode of the third LED is connected to the first IO pin, and a cathode of the third LED is connected to the third IO pin; a cathode of the fourth LED is connected to the first IO pin, and an anode of the fourth LED is connected to the third IO pin.

4. The LED driving circuit based on the IO pin of MCU as claimed in claim 3, characterized in that: A fifth LED and a sixth LED are connected between the second IO pin and the third IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the third IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the third IO pin.

5. The LED driving circuit based on IO pin of MCU as claimed in claim 3, characterized in that: The MCU also includes a fourth IO pin; A fifth LED and a sixth LED are connected between the second IO pin and the fourth IO pin; an anode of the fifth LED is connected to the second IO pin, and a cathode of the fifth LED is connected to the fourth IO pin; a cathode of the sixth LED is connected to the second IO pin, and an anode of the sixth LED is connected to the fourth IO pin; A seventh LED and an eighth LED are connected between the third IO pin and the fourth IO pin; an anode of the seventh LED is connected to the third IO pin, and a cathode of the seventh LED is connected to the fourth IO pin; a cathode of the eighth LED is connected to the third IO pin, and an anode of the eighth LED is connected to the fourth IO pin.

6. The LED driving circuit based on IO pin of MCU as claimed in claim 5, characterized in that: A ninth LED and a tenth LED are connected between the second IO pin and the third IO pin; an anode of the ninth LED is connected to the third IO pin, and a cathode of the ninth LED is connected to the second IO pin; a cathode of the tenth LED is connected to the third IO pin, and an anode of the tenth LED is connected to the second IO pin.

7. The LED driving circuit based on the IO pin of MCU as claimed in claim 6, characterized in that: An eleventh LED and a twelfth LED are connected between the first IO pin and the fourth IO pin, the anode of the eleventh LED is connected to the first IO pin, and the cathode of the eleventh LED is connected to the fourth IO pin; the anode of the twelfth LED is connected to the fourth IO pin, and the cathode of the twelfth LED is connected to the first IO pin.

8. An indicating device, characterized in that: The LED driving circuit comprises any one of claims 1-7.

9. An electronic device, characterized in that: The LED driving circuit comprises any one of claims 1-7.