Disclosure of Invention
The embodiment of the invention aims to provide a trigger control method for starting or closing a pen, which is used for starting and closing the pen by plugging and unplugging a pen cap.
In order to solve the above problems, the present invention provides a method for controlling pen activation or pen deactivation, the method is applied to a pen activation or pen deactivation trigger control circuit, and the pen activation or pen deactivation trigger control circuit includes: a magnetic sensor circuit, a switching circuit and a delay circuit, the method comprising:
the magnetic sensor circuit judges whether magnetic flux is induced or not, when the magnetic sensor circuit induces the magnetic flux, a first electric signal is generated and sent to the control chip, and the control chip controls the power management chip to be powered off according to the first electric signal so as to change the logic of the working state of the pen from 1 to 0;
When the sensed magnetic flux is zero, the magnetic sensor circuit generates a second electrical signal; when the pen is inserted into the pen cap, the magnetic flux is induced, and when the pen is pulled out of the pen cap, the induced magnetic flux is zero;
the switching circuit receives a second electric signal sent by the magnetic sensor circuit and controls a switching pin of the switching circuit to be pulled down according to the second electric signal so as to enable the logic of the working state of the pen to be 1;
the delay circuit receives a second electric signal sent by the magnetic sensor circuit, and sends the second electric signal to the switching circuit after delaying for a preset time;
after a preset time, the on-off circuit receives the second electric signal sent by the delay circuit, and cuts off the connection between the on-off circuit and the magnetic sensor circuit according to the second electric signal.
In one possible implementation, the magnetic sensor circuit includes a magnetic sensor and a first capacitance;
the first end of the magnetic sensor is grounded, the second end of the magnetic sensor is respectively connected with the power supply module and the first end of the first capacitor, and the second end of the first capacitor is grounded.
In one possible implementation, the delay circuit includes: a second capacitor and a reset chip;
the first end of the reset chip is respectively connected with the third end of the magnetic sensor and the first end of the second capacitor, and the second end of the reset chip is respectively connected with the second end of the second capacitor and the grounding end.
In one possible implementation, the power on/off circuit includes: the device comprises a first metal-oxide semiconductor field effect transistor (MOS) transistor, a first resistor, a second resistor, a third resistor, a fourth resistor and a second MOS transistor;
the source electrode of the first MOS tube is connected with the third end of the magnetic sensor, the first end of the reset chip and the first end of the second capacitor, the grid electrode of the first MOS tube is connected with the third end of the reset chip, the drain electrode of the first MOS tube is connected with the first end of the first resistor, the second end of the first resistor is connected with the first end of the second resistor and the grid electrode of the second MOS tube, the second end of the second resistor is grounded, the drain electrode of the second MOS tube is connected with the first end of the third resistor, the source electrode of the second MOS tube is grounded, and the second end of the third resistor is connected with the switching pin of the switching circuit of the power management chip.
In a second aspect, the present invention provides a pen on/off trigger control circuit, including:
the magnetic sensor circuit is used for judging whether magnetic flux is induced or not, generating a first electric signal when the magnetic flux is induced, and sending the first electric signal to the control chip, and the control chip controls the power management chip to be powered off according to the first electric signal so as to change the logic of the working state of the pen from 1 to 0; or, when the sensed magnetic flux is zero, generating a second electrical signal; when the pen is inserted into the pen cap, the magnetic flux is induced, and when the pen is pulled out of the pen cap, the induced magnetic flux is zero;
a first input end of the switching circuit is connected with a first output end of the magnetic sensor circuit, and is used for receiving a second electric signal sent by the magnetic sensor circuit and controlling a switching pin of the switching circuit to be pulled down according to the second electric signal so as to enable the logic of the working state of the pen to be 1;
the output end of the delay circuit is connected with the second input end of the switch circuit, and is used for receiving a second electric signal sent by the magnetic sensor circuit, outputting the second electric signal after delaying for a preset time, and sending the second electric signal to the switch circuit;
And the switching circuit receives the second electric signal sent by the delay circuit after a preset time, and controls the switching circuit to be disconnected with the magnetic sensor circuit according to the second electric signal.
In one possible implementation, the magnetic sensor circuit includes a magnetic sensor and a first capacitance;
the first end of the magnetic sensor is grounded, the second end of the magnetic sensor is respectively connected with the power supply module and the first end of the first capacitor, and the second end of the first capacitor is grounded.
In one possible implementation, the delay circuit includes: a second capacitor and a reset chip;
the first end of the reset chip is respectively connected with the third end of the magnetic sensor and the first end of the second capacitor, and the second end of the reset chip is respectively connected with the second end of the second capacitor and the grounding end.
In one possible implementation, the power on/off circuit includes: the device comprises a first metal-oxide semiconductor field effect transistor (MOS) transistor, a first resistor, a second resistor, a third resistor and a second MOS transistor;
the source electrode of the first MOS tube is connected with the third end of the magnetic sensor, the first end of the reset chip and the first end of the second capacitor, the grid electrode of the first MOS tube is connected with the third end of the reset chip, the drain electrode of the first MOS tube is connected with the first end of the first resistor, the second end of the first resistor is connected with the first end of the second resistor and the grid electrode of the second MOS tube, the second end of the second resistor is grounded, the drain electrode of the second MOS tube is connected with the first end of the third resistor, the source electrode of the second MOS tube is grounded, and the second end of the third resistor is connected with the switching pin of the switching circuit of the power management chip.
In a possible implementation manner, the trigger control circuit for pen starting or closing further comprises a fourth resistor;
and the first end of the fourth resistor is connected with the grid electrode of the first MOS tube and the third end of the reset chip.
In one possible implementation, the power supply module is embodied as a battery or a battery pack.
By applying the trigger control method for starting or closing the pen provided by the invention, after the pen is started or closed by the magnetic sensor circuit and the startup and shutdown circuit, and after the pen is started, the connection between the magnetic sensor circuit and the startup and shutdown circuit is disconnected by the delay circuit, so that the current working state of the pen cannot be influenced by the magnetic sensor circuit, the situation that the pen is started again if the magnetic sensor circuit is automatically shut down after the pen is started and is not used for a long time is avoided, the real shutdown of the pen is realized, and the power consumption is reduced.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be further noted that, for the convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a schematic flow chart of a pen startup or shutdown trigger control method according to an embodiment of the present invention, and the method is applied to a pen startup or shutdown trigger control circuit, as shown in fig. 1, and includes the following steps:
step 101, the magnetic sensor circuit judges whether a magnetic flux is induced, when the magnetic flux is induced, a first electric signal is generated and sent to the control chip, and the control chip controls the power management chip to be powered off according to the first electric signal, so that the logic of the working state of the pen is changed from 1 to 0.
102, when the induced magnetic flux is zero, generating a second electric signal by the magnetic sensor circuit; when the pen is inserted into the cap, the magnetic flux is induced, and when the pen is pulled out of the cap, the induced magnetic flux is zero.
Wherein, step 101 and step 102 are alternatively performed.
And 103, the startup and shutdown circuit receives the second electric signal sent by the magnetic sensor circuit and controls the startup and shutdown pin of the startup and shutdown circuit to be pulled down according to the second electric signal so as to enable the logic of the working state of the pen to be 1.
And 104, the delay circuit receives the second electric signal sent by the magnetic sensor circuit, and sends the second electric signal to the switch circuit after delaying for a preset time.
And 105, after the preset time, the on-off circuit receives a second electric signal sent by the delay circuit, and cuts off the connection between the on-off circuit and the magnetic sensor circuit according to the second electric signal.
When the pen cap is pulled out, the pen is not required to be automatically turned off after being placed for a period of time, and the magnetic sensor U1 in the induction switch cannot sense magnetic flux, high level can be continuously output, so that the pen after being turned off is turned on again, real turning-off cannot be realized, and the power consumption is larger.
Wherein, step 104 and step 105 are subsequent steps of step 103.
In order to specifically describe the pen start or close trigger control method of the present application, the pen start or close trigger control circuit of the present application is specifically described below.
Fig. 2 is a schematic diagram of a pen start or stop trigger control circuit according to an embodiment of the present invention. As shown in FIG. 2, the trigger control circuit for pen activation or deactivation includes: the magnetic sensor circuit comprises a magnetic sensor circuit 1, a switching-on and switching-off circuit 2 and a delay circuit 3.
A first output end of the magnetic sensor circuit 1 is connected with a first input end of the switching-on and switching-off circuit 2, a second output end of the magnetic sensor U1 is connected with an input end of the delay circuit 3, and an output end of the delay circuit 3 is connected with a second input end of the switching-on and switching-off circuit 2;
the magnetic sensor circuit 1 is used for judging whether magnetic flux is sensed or not, generating a first electric signal when the magnetic flux is sensed, and sending the first electric signal to the control chip, and the control chip controls the power management chip to be powered off according to the first electric signal so as to change the logic of the working state of the pen from 1 to 0; or, when the sensed magnetic flux is zero, generating a second electrical signal; when the pen is inserted into the pen cap, the magnetic flux is induced, and when the pen is pulled out of the pen cap, the induced magnetic flux is zero;
The switching circuit 2 receives the second electric signal sent by the magnetic sensor circuit 1, and controls the switching pin of the switching circuit 2 to be pulled down according to the second electric signal so as to control the switching pin of the power management chip to be switched on through the pulled down switching pin, so that the logic of the working state of the pen is 1;
the delay circuit 3 receives the second electrical signal sent by the magnetic sensor circuit 1, outputs the second electrical signal after delaying for a preset time, and sends the second electrical signal to the switch circuit 2;
and the switching circuit 2 receives the second electric signal sent by the delay circuit 3 after a preset time, and controls the switching circuit 2 to disconnect the connection with the magnetic sensor circuit 1 according to the second electric signal, so that the logic of the working state of the pen is not influenced by the magnetic sensor circuit 1.
The first electrical signal may be a pulse changing from 1 to 0, or a signal changing from a high level to a low level. The second electrical signal is a signal opposite to the first electrical signal, and for example, the second electrical signal may be a pulse from 0 to 1, or a signal from a low level to a high level. One end of the control chip (not shown in fig. 2) receives the first electrical signal, and the other end of the control chip is connected with the power management chip through a preset communication protocol. The POWER-ON/OFF pin of the switching circuit 2 is POWER _ ON/OFF, the POWER-ON/OFF pin controls the POWER-ON/OFF pin of the POWER management chip, and when the POWER _ ON/OFF pin is pulled down, the POWER management chip controls the pen to be powered ON.
By way of example and not limitation, the valid signal may be a high-level signal or a low-level signal as long as the signal is ensured to power down the power management chip.
The magnetic sensor circuit 1 comprises a magnetic sensor U1 and a first capacitance C1;
the first end of the magnetic sensor U1 is grounded, the second end of the magnetic sensor U1 is connected to the power supply module and the first end of the first capacitor C1, and the second end of the first capacitor C1 is grounded.
The delay circuit 3 includes: a second capacitor C2 and a reset chip U2;
the first end of the reset chip U2 is connected to the third end of the magnetic sensor U1 and the first end of the second capacitor C2, respectively, and the second end of the reset chip U2 is connected to the second end of the second capacitor C2 and the ground, respectively.
The first capacitor C1 and the second capacitor C2 are filter capacitors.
The delay time for resetting the chip U2 may be set as desired, such as 240 ms.
The switching power-on/off circuit 2 includes: a first metal-oxide semiconductor field effect transistor (MOS) transistor, a first resistor R1, a second resistor R2, a third resistor R3, and a second MOS transistor Q2;
the source of the first MOS transistor Q1 is connected to the third end of the magnetic sensor U1, the first end of the reset chip U2 and the first end of the second capacitor C2, the gate of the first MOS transistor Q1 is connected to the third end of the reset chip U2, the drain of the first MOS transistor Q1 is connected to the first end of the first resistor R1, the second end of the first resistor R1 is connected to the first end of the second resistor R2 and the gate of the second MOS transistor Q2, the second end of the second resistor R2 is grounded, the drain of the second MOS transistor Q2 is connected to the first end of the third resistor R3, the source of the second MOS transistor Q2 is grounded, and the second end of the third resistor R3 is connected to the switch pin of the power management chip.
Further, the trigger control circuit for pen starting or closing also comprises a fourth resistor R4;
a first end of the fourth resistor R4 is connected to the gate of the first MOS transistor Q1 and the third end of the reset chip U2. The fourth resistor R4 is used for voltage division.
Further, the power supply module is specifically a storage battery or a storage battery pack.
The operation of the trigger control circuit for turning on or off the pen will be described below.
When the pen cap is pulled out, the magnetic force generating device in the pen cap is far away from the magnetic sensor U1 in the magnetic sensor circuit 1, the magnetic sensor U1 senses the magnetic flux from the magnetic sensor circuit 1 to the magnetic sensor circuit, namely, the sensed magnetic flux is 0, and the pin 3 of the magnetic sensor U1 outputs a second electric signal which can be a level signal from low to high. The low-to-high level signal causes the Hall _ SW signal to change from low to high, and Q1_ G is low, so that the first MOS transistor Q1 is turned on. Since the first MOS transistor Q1 is turned on, the high level of Hall _ SW reaches the gate of the second MOS transistor Q2 through the first MOS transistor Q1, at which time Q2_ G (the gate of the second MOS transistor Q2) becomes high and the second MOS transistor Q2 is turned on. The POWER-ON pin POWER _ ON/OFF of the switching circuit 2 is pulled low, the POWER management chip is powered ON, the pen is started, and the logic of the working state of the pen is changed from 0 to 1.
Meanwhile, the reset chip U2 receives the second electrical signal sent by the magnetic sensor U1, after a preset time is delayed, the reset chip U2 outputs the second electrical signal, and sends the second electrical signal to the first MOS transistor Q1, at this time, the first MOS transistor Q1 is changed from low to high, and the first MOS transistor Q1 is turned off, thereby cutting off the connection between the magnetic sensor circuit 1 and the switching circuit 2, so that the logic of the working state of the pen is not affected by the magnetic sensor U1, that is, even if the magnetic flux sensed by the magnetic sensor U1 is 0, the second electrical signal is output, but the output second electrical signal does not affect the switching pin of the switching circuit 2 any more, that is, the power management chip continues to maintain the previous working state, and powers on or powers off, that if the pen is used, the pen continues to be used, and if the pen is not used for a long time and is automatically turned off, the pen continues to maintain the off state.
When the logic of the working state of the pen is 1, namely when the pen is in the working state, and when the pen cap is inserted, the magnetic sensor U1 senses the magnetic flux from zero to the magnetic flux, the third pin outputs a first electrical signal, the Hall _ SW signal is a second electrical signal, namely, a signal changing from high to low, for example, a level changing from 1 to 0, at this time, after the control chip receives the level changing from 1 to 0, the control chip controls the power management chip to power off through communication with the power management chip, and the logic of the working state of the pen changes from 1 to 0.
Wherein, the logic of the working state of the pen is 1, which indicates that the pen is in the working state, and the logic of the working state of the pen is 0, which indicates that the pen is in the closed state.
When the pen cap is pulled out, the pen is not required to be automatically turned off after being placed for a period of time, and the magnetic sensor U1 in the induction switch cannot sense magnetic flux, high level is continuously output, so that the pen after being turned off is turned on again, real turning-off cannot be realized, and power consumption is high.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, it should be understood that the above embodiments are merely exemplary embodiments of the present invention and are not intended to limit the scope of the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.