A kind of IO mouth testing circuit
Technical field
The utility model relates to integrated circuit fields, particularly a kind of IO mouth (general input/output port) testing circuit that can reduce power consumption.
Background technology
We use the IO mouth to do the detection whether signal or voltage exist through regular meeting in product is used, and when using the IO mouth to do to detect, use the method for dividing potential drop or sampling to come detection signal if desired, and general structure as shown in Figure 1.
The IO mouth detection method that designs under this structure is running into the structure that is equivalent to Fig. 2 when there are pull-up resistor or any pull-up resistor that cannot avoid in IO mouth inside.
Structure shown in Figure 2, because the pull-up resistor that exists is generally tens K, then Wai Bu divider resistance value can not be got too greatly, then under this structure, can produce bigger lasting electric leakage, the service time of minimizing battery.
For this existing IO mouth detection method, the resistance clamper is arranged running into (when the pull-up resistor that can not lack out being arranged, as above figure) such as chip internal, when can not strengthen resistance value arbitrarily, can produce the electric leakage that continues, increase the power consumption of system, reduce the service time of battery.
The utility model content
The utility model purpose is to provide a kind of IO mouth testing circuit that can reduce power consumption, can solve the lasting electric leakage when detecting with the IO mouth, reduces the power consumption of system.
The technical solution of the utility model is as follows:
A kind of IO mouth testing circuit is characterized in that: comprise the divider resistance that is used for input, the pull down resistor of described divider resistance correspondence connects IO mouth or switch.
Joint detection branch road behind the described pull down resistor connection IO mouth.
After described pull down resistor connects switch, the other end ground connection of switch, other end joint detection branch road.
Described divider resistance can be made up of a plurality of resistance.
The control flow of this testing circuit is as follows:
Control IO mouth is set to input state or exports high state, and detection branch is earth-free; Need detection signal the time, control the IO mouth and be set to export low state, detection branch is worked; After discharging control IO, control IO is multiplexed with other functions, not occupying system resources separately.
The control flow of this testing circuit is as follows:
In the ordinary course of things switch is disconnected, because detection branch does not have ground connection, so can not produce electric leakage; Only when needs detect switch is closed, make detection branch ground connection like this, resistance plays the effect of dividing potential drop.
The beneficial effects of the utility model are as follows:
This circuit utilizes the not continuation of detection time, has adopted new detection control method, and stake resistance is carried out temporal control, has reached the effect that reduces leakage current, has increased the service time of battery, and can not increase cost of products.
Description of drawings
Fig. 1 comes the electrical block diagram of detection signal for the method for employing dividing potential drop in the background technology or sampling
Fig. 2 is the synoptic diagram that is equivalent to structure shown in Figure 1 in the background technology
Fig. 3 is a structural representation of the present utility model
Fig. 4 is the control flow chart of Fig. 3 of the present utility model
Fig. 5 is a structural representation of the present utility model
Fig. 6 is the control flow chart of the utility model Fig. 5
Embodiment
As Fig. 3 or shown in Figure 5, a kind of IO mouth testing circuit is characterized in that: comprise the divider resistance that is used for input, the pull down resistor of described divider resistance correspondence connects IO mouth or switch.
Joint detection branch road behind the described pull down resistor connection IO mouth.
After described pull down resistor connects switch, the other end ground connection of switch, other end joint detection branch road.
Described divider resistance can be made up of a plurality of resistance.
As shown in Figure 4, the control flow of this testing circuit is as follows:
Can control the IO mouth in the ordinary course of things and be set to input state or export high state, detection branch is earth-free, so can not produce electric leakage; Only controlling the IO mouth in the needs detection signal is set to export low state, and detection branch is worked; After discharging control IO, control IO is multiplexed with other functions, not occupying system resources separately.
As shown in Figure 6, the control flow of this testing circuit is as follows:
In the ordinary course of things switch is disconnected, because detection branch does not have ground connection, so can not produce electric leakage; Only when needs detect switch is closed, make detection branch ground connection like this, resistance plays the effect of dividing potential drop.
For example: adopt the MCU of the inner band of IO mouth 64K pull-up resistor, detect whether connecting system of external 3V power supply, promptly the 3V power supply is our detected signal
System detected in per 1 minute, and whether external power supply inserts.
Input mouth after we use P2.1 as the external power supply dividing potential drop, the inner band of this IO mouth 64K pull-up resistor.
We use a button to detect the multiplexing IO as control of IO mouth (P2.0).
P2.0 is set is that input pin detects button to program after initialization, and when whether program loop need detect external power supply and insert, P2.0 was set to low, and whether use P2.1 to detect is high, and height represents that then external power supply inserts.Otherwise then do not insert.It is that input pin continues to detect button that P2.0 is set after detection finishes immediately.
Total system, because just detected and once power on not in per 1 minute, and it is quite of short duration to detect the duration, so electric leakage seldom.Can obviously reduce power consumption.