Disclosure of Invention
In view of the above-mentioned drawbacks of the prior art, an object of the present invention is to provide a peripheral control circuit for a controller, which is used for solving the problem that the controller cannot be flexibly controlled in the prior art.
To achieve the above and other related objects, the present invention provides a controller peripheral control circuit comprising: the working mode control module is electrically connected with the controller and used for generating a working mode control signal according to the switching signal and sending the working mode control signal to the controller; the power supply maintaining module is electrically connected with the controller and is used for receiving a power supply maintaining signal sent by the controller; and the power supply module is electrically connected with the working mode control module and the power supply holding module and is used for judging whether to provide power supply for the controller according to the switching signal and the power supply holding signal.
In an embodiment of the present invention, the circuit further provides a charger connection interface, and the circuit further includes a charger warning module, configured to send a prompt signal for prompting the charger to be connected to the controller and enable the power module to start power supply when a charger is connected to the charger connection interface.
In an embodiment of the present invention, the operation mode corresponding to the operation mode control signal includes at least one of the following modes: a power-on mode, a single event processing mode, and a power-off mode.
In an embodiment of the present invention, when the duration of the switching signal is greater than a first preset time threshold and the power holding module receives the power holding signal sent by the controller during the duration of the switching signal, the power module is turned on to provide power for the controller, the controller enters the power-on mode, and the controller is kept in an on state.
In an embodiment of the present invention, when the controller is in an on state and the working mode control module receives the switching signal with a duration less than a first preset time threshold, the controller is caused to enter a single event processing mode.
In an embodiment of the present invention, when the controller is in an on state and the working mode control module receives the switching signal with a duration time greater than a first preset time threshold, the controller is caused to enter a shutdown mode.
In an embodiment of the present invention, the mode of executing the shutdown mode by the controller includes: and the controller executes a preset shutdown process or stops sending the power supply maintaining signal to the power supply maintaining module so as to stop the power supply of the power supply module.
In an embodiment of the present invention, the operation mode control module includes a push switch CN1; the working mode control module, the power supply holding module and the charger warning module are respectively and electrically connected with the power supply module through a voltage stabilizing tube, and the power supply module comprises a triode Q1, a triode Q2 and a voltage reduction chip U1.
In a specific embodiment of the present invention, the pin 1 and the pin 2 of the push switch CN1 are electrically connected to the power supply VSYS, and the pin 3 and the pin 4 of the push switch CN1 are connected to the ground through a capacitor C1, and the pin 3 and the pin 4 of the push switch CN1 are connected to the first end of the resistor R1, the second end of the resistor R1 is connected to the controller and sends the operation mode control signal to the controller, the second end of the resistor R1 is electrically connected to the first end of the resistor R2 and the anode of the regulator D1, the second end of the resistor R2 is grounded, the first end of the resistor R3 is electrically connected to the ground through the anode of the regulator D2, the second end of the resistor R3 is also electrically connected to the controller, for receiving the power supply holding signal sent by the controller, the cathode of the resistor D1 is electrically connected to the gate of the transistor Q1 through the resistor R4, the cathode of the resistor D2 is electrically connected to the pin 3 of the resistor U1 through the resistor U1 and the pin 2, the drain of the resistor Q1 is electrically connected to the resistor Q1 through the drain of the resistor Q6, the resistor Q1 is electrically connected to the drain of the resistor Q1 is electrically connected to the resistor Q1 through the pin of the resistor Q2, and the resistor Q6 is electrically connected to the drain of the resistor Q1 is electrically connected to the resistor Q1 through the resistor 6, and can pass through the second end of inductance L1 for the controller provides power, step-down chip U1's pin 5 pass through resistance R10 with inductance L1's second end electricity is connected, step-down chip U1's pin 5 pass through electric capacity C3 with inductance L1's second end electricity is connected, step-down chip U1's pin 5 pass through resistance R11 and electric capacity C4 that establish ties with inductance L1's second end electricity is connected.
In an embodiment of the present invention, the circuit further includes a resistor R14 electrically connected to the gate of the triode Q1, the other end of the resistor R14 is electrically connected to the cathode of the voltage regulator tube D3, the anode of the voltage regulator tube D3 is electrically connected to the first end of the resistor R12, the second end of the resistor R12 provides a charger connection interface, and can be electrically connected to an external charger, the first end of the resistor R12 is electrically connected to the controller, so as to send a prompt signal for prompting the charger to access to the controller when the charger connection interface has the charger access, and the resistor R12 is further grounded through the resistor R13.
As described above, the controller peripheral control circuit of the present invention includes: the working mode control module is electrically connected with the controller and used for generating a working mode control signal according to the switching signal and sending the working mode control signal to the controller; the power supply maintaining module is electrically connected with the controller and is used for receiving a power supply maintaining signal sent by the controller; and the power supply module is electrically connected with the working mode control module and the power supply holding module and is used for judging whether to provide power supply for the controller according to the switching signal and the power supply holding signal. The controller can be flexibly controlled according to the switching signal.
Detailed Description
Other advantages and effects of the present invention will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present invention with reference to specific examples. The invention may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present invention. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict.
It should be noted that the illustrations provided in the following embodiments merely illustrate the basic concept of the present invention by way of illustration, and only the components related to the present invention are shown in the illustrations, not according to the number, shape and size of the components in actual implementation, and the form, number and proportion of each component in actual implementation may be arbitrarily changed, and the layout of the components may be more complex.
Referring to fig. 1, a schematic diagram of a peripheral control circuit of a controller according to an embodiment of the invention is shown. The controller peripheral control circuit 1 includes an operation mode control module 11, a power supply holding module 12, and a power supply module 13. Preferably, the controller is an embedded system or a singlechip.
The working mode control module 11 is electrically connected with the controller, and is used for generating a working mode control signal according to the switching signal and sending the working mode control signal to the controller;
the power supply maintaining module 12 is electrically connected with the controller and is used for receiving a power supply maintaining signal sent by the controller;
the power module 13 is electrically connected to the working mode control module and the power holding module, and is configured to determine whether to provide power for the controller according to the switching signal and the power holding signal.
In an embodiment of the present invention, the operation mode corresponding to the operation mode control signal includes at least one of the following modes: a power-on mode, a single event processing mode, and a power-off mode.
In an embodiment of the present invention, when the duration of the switching signal is greater than a first preset time threshold and the power holding module 12 receives the power holding signal sent by the controller during the duration of the switching signal, the power module 13 is turned on to provide power for the controller, and the controller enters the power-on mode, and the controller remains in the on state.
In an embodiment of the present invention, when the controller is in an on state and the working mode control module 11 receives the switching signal with a duration less than a first preset time threshold, the controller is caused to enter a single event processing mode.
In an embodiment of the present invention, when the controller is in the on state and the working mode control module 11 receives the switching signal with the duration time greater than the first preset time threshold, the controller is caused to enter the off mode.
In an embodiment of the present invention, the mode of executing the shutdown mode by the controller includes: the controller executes a preset shutdown procedure or stops sending the power supply maintaining signal to the power supply maintaining module, so that the power supply module 13 stops supplying power.
In an embodiment of the present invention, referring to fig. 2, the peripheral control circuit 2 of the controller includes the operation mode control module 21, the power holding module 22, and the power module 23 shown in fig. 1, the peripheral control circuit 2 of the controller further provides a charger connection interface, and the circuit 2 further includes a charger warning module 24 for sending a prompt signal for prompting the charger to connect to the controller and enabling the power module to start power supply when a charger is connected to the charger connection interface.
Referring further to fig. 3, a schematic circuit diagram of a peripheral control circuit of a controller according to an embodiment of the present invention is shown. Wherein, the working mode control module 11 comprises a push switch CN1; the working mode control module 21, the power holding module 22, and the charger warning module 24 are respectively and electrically connected with the power module 23 through a voltage stabilizing tube, and the power module 23 includes a triode Q1, a triode Q2, and a buck chip U1.
The specific circuit is that the pin 1 and the pin 2 of the push switch CN1 are electrically connected with a POWER supply VSYS, the pin 3 and the pin 4 of the push switch CN1 are connected with the ground through a capacitor C1, the pin 3 and the pin 4 of the push switch CN1 are connected with the first end of a resistor R1, the second end of the resistor R1 is connected with the controller and sends the working mode control signal to the controller, namely POWER_STATE, the second end of the resistor R1 is electrically connected with the first end of a resistor R2 and the anode of a voltage regulator D1, the second end of the resistor R2 is grounded, the first end of the resistor R3 is grounded and the second end of the resistor R3 is electrically connected with the anode of a voltage regulator D2, the second end of the resistor R3 is also electrically connected with the controller for receiving a POWER supply maintaining signal sent by the controller, namely POR_KEEP, the cathode of the voltage regulator D1 is connected with the gate of the resistor Q1 through the voltage regulator R4, the voltage regulator chip is electrically connected with the first end of the resistor R2 and the resistor R2 through the resistor R4, the drain of the resistor R2 is electrically connected with the resistor R1 and the drain of the resistor Q2 through the resistor R7, the resistor R2 is electrically connected with the drain of the resistor Q1 and the resistor Q2 through the resistor Q2, the drain electrode of the resistor Q2 is electrically connected with the resistor Q1 and the resistor Q2 is electrically connected with the resistor Q2, the resistor Q2 is connected with the drain electrode of the resistor Q2 through the resistor Q2 is electrically connected with the resistor Q2, and the resistor Q2 is connected with the resistor Q2 and the resistor Q2 is electrically connected with the resistor Q2, the second end of the inductor L1 is electrically connected with the controller, the power can be supplied to the controller through the second end of the inductor L1, the pin 5 of the buck chip U1 is electrically connected with the second end of the inductor L1 through a resistor R10, the pin 5 of the buck chip U1 is electrically connected with the second end of the inductor L1 through a capacitor C3, and the pin 5 of the buck chip U1 is electrically connected with the second end of the inductor L1 through a resistor R11 and a capacitor C4 which are connected in series. The power source VSYS is a system voltage or a battery voltage, and the power source module 23 is a dc power source of 3.3V, for example, which is provided to the controller.
The circuit in fig. 3 further includes a resistor R14 electrically connected to the gate of the triode Q1, the other end of the resistor R14 is electrically connected to the cathode of the voltage regulator tube D3, the anode of the voltage regulator tube D3 is electrically connected to the first end of the resistor R12, the second end of the resistor R12 provides a charger connection interface, and can be electrically connected to an external charger, the first end of the resistor R12 is electrically connected to the controller, so as to send a prompt signal for prompting the charger to access to the controller when the charger connection interface has the charger access, that is, vbus_det in fig. 3, and the resistor R12 is further grounded through the resistor R13.
Preferably, the controller is an embedded system or a single chip microcomputer, for example.
The specific principle of operation of the circuit shown in fig. 3 is illustrated by the following four modes, specifically:
system boot mode:
when CN1 is pressed, pwr_on becomes high level, power_state is a signal for an input interface of the embedded system, which is also high level in this time, the embedded system or the single chip microcomputer is notified that a key is pressed, meanwhile, voltages are applied to the gate of Q1 (N channel MOS tube) through R1, D1 and R4, Q1 is turned ON, the gate of Q2 (P channel MOS tube) is pulled down through R6, Q2 is turned ON, the enable pin of the buck chip U1 is pulled up, and U1 outputs high level to supply POWER to the system, for example, 3.3V. If the embedded software does not do corresponding processing, the key is released, and the system is turned off immediately, then in order to KEEP the system in a starting state, the embedded system or the singlechip needs to output a high level to the POWER_KEEP after being pressed for a short period of time, so that Q1 and Q2 are kept in a conducting state. The system is always not powered off.
Single event handling mode:
after the system is started, if the power_state is not input to the embedded system or the singlechip at a low level according to CN1, if a single event is to be processed, the power_state is pressed from low to high for a short time according to CN1, and when the embedded system or the singlechip detects that the power_state is changed to high and the time for changing to high is less than the time t set by software, the single event which is required to be done by the system is triggered.
System shutdown mode:
when CN1 is pressed, power_state goes high, the system detects that power_state goes high for more than t (e.g., 3 seconds), the system goes into a shutdown process or pulls power_keep low, Q1 and Q2 are turned off, the U1 enable pin is pulled low, and the system is powered off.
Charger plug-in auto-on mode:
the charger insertion VCHG_OUT becomes high level, VBUS_DET also becomes high level to the embedded system or MCU, the system is informed of the charger insertion, Q1 and Q2 are also conducted successively, and the system is started.
The invention adopts a simple circuit to solve the processes of starting up, maintaining, single event triggering and shutting down the system. The cost is greatly saved, and the operation is stable and reliable.
In summary, the peripheral control circuit of the controller of the present invention includes: the working mode control module is electrically connected with the controller and used for generating a working mode control signal according to the switching signal and sending the working mode control signal to the controller; the power supply maintaining module is electrically connected with the controller and is used for receiving a power supply maintaining signal sent by the controller; and the power supply module is electrically connected with the working mode control module and the power supply holding module and is used for judging whether to provide power supply for the controller according to the switching signal and the power supply holding signal. The controller can be flexibly controlled according to the switching signal. Therefore, the invention effectively overcomes various defects in the prior art and has high industrial utilization value.
The above embodiments are merely illustrative of the principles of the present invention and its effectiveness, and are not intended to limit the invention. Modifications and variations may be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the invention. Accordingly, it is intended that all equivalent modifications and variations of the invention be covered by the claims, which are within the ordinary skill of the art, be within the spirit and scope of the present disclosure.