A kind of control method of adjusting knob, device and processing terminalTechnical field
The present invention relates to knob control methods, and in particular to the control method based on the rotary coding switch with key.
Background technique
The operation of many equipment or instruments needs clear and quickly operates certain parameters or interface, thus is compiled using rotationIt is very universal that code switch, which does adjusting knob,.Its advantages can not only be fine-tuned but also can quickly be adjusted (depending on what is turnedSpeed), and feed back clearly, it is that other devices are irreplaceable.But the code switch parameter to be adjusted in many cases,Range is very big, often there is the range of several hundred or thousands.Such parameter area is wanted to adjust in maximum value or minimum value to centreValue needs more than ten or even tens circles, just very inconvenient.Knob as shown in Figs. 1-3 is a kind of rotary coding with keySwitch, this rotary coding switch using very extensive, throughout various equipment and instruments, consumer electronics etc., but this rotationCode switch also has the shortcomings that certain, only 12-24 pulse of generally circling, therefore this kind of rotary coding switch is being adjusted greatlyWhen range data, need to rotate many circles.
Summary of the invention
For overcome the deficiencies in the prior art, one of the objects of the present invention is to provide a kind of controlling parties of adjusting knobMethod overcomes the technical problem inconvenient when adjusting broad range of data.
The second object of the present invention is to provide a kind of control device of adjusting knob, overcome when adjusting broad range of dataInconvenient technical problem.
The third object of the present invention is to provide a kind of processing terminal, overcomes the skill inconvenient when adjusting broad range of dataArt problem.
One of to achieve the above object, the technical solution adopted in the present invention is as follows:
A kind of control method of adjusting knob, comprising the following steps:
S1, it detects whether to receive pulse sequence signal, if so, S2 is thened follow the steps, if it is not, then waiting pulse train defeatedIncoming event;
Whether S2, detection key-press status are down state, if so, down state processing step is executed, if it is not, then executingRelease conditions processing step;
The down state processing step be the number of encoding bits that are rotated according to button as speed value multiplied by every times presetThe resulting numerical value of speed difference value is treated adjustment parameter and is continuously adjusted, until the down state of key is terminated;
The release conditions processing step is to treat adjustment parameter according to the number of encoding bits that button rotates to carry out single adjusting.
It preferably, further include step S0 before step S1;
S0, according to default value initialization data, data include parameter X, speed value S and every speed difference N to be regulated.
Preferably, the down state processing step includes:
S11, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula S=S+1 and holdRow step S12;If counterclockwise, then operational formula S=S-1 and step S12 is executed;
S12, operational formula X=X+S*N;
S13, judge whether key-press status is release conditions, if so, returning to step S1;If it is not, thening follow the steps14;
S14, judge whether to receive pulse train, if so, S11 is returned to step, if it is not, then returning to stepS12。
Preferably, the release conditions processing step includes:
S21, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula X=X+1 and returnReceipt row step S1;If counterclockwise, then operational formula X=X-1 and S1 is returned to step.
To achieve the above object two, the technical solution adopted in the present invention is as follows:
A kind of control device of adjusting knob, comprises the following modules:
Pulse signal detection module, for detecting whether pulse sequence signal is received, if so, executing key-press status inspectionModule is surveyed, if it is not, then waiting pulse train incoming event;
Key-press status detection module, for detecting whether key-press status is down state, if so, executing at down stateStep is managed, if it is not, then executing release conditions processing step;
The down state processing step be the number of encoding bits that are rotated according to button as speed value multiplied by every times presetThe resulting numerical value of speed difference value is treated adjustment parameter and is continuously adjusted, until the down state of key is terminated;
The release conditions processing step is to treat adjustment parameter according to the number of encoding bits that button rotates to carry out single adjusting.
It preferably, further include initialization module before pulse signal detection module;
Initialization module, for according to default value initialization data, data include parameter X to be regulated, speed value S and everySpeed difference N.
Preferably, the down state processing step includes:
S11, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula S=S+1 and holdRow step S12;If counterclockwise, then operational formula S=S-1 and step S12 is executed;
S12, operational formula X=X+S*N;
S13, judge whether key-press status is release conditions, if so, returning to step S1;If it is not, thening follow the steps14;
S14, judge whether to receive pulse train, if so, S11 is returned to step, if it is not, then returning to stepS12。
Preferably, the release conditions processing step includes:
S21, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula X=X+1 and returnReceipt row step S1;If counterclockwise, then operational formula X=X-1 and S1 is returned to step.
To achieve the above object three, the technical solution adopted in the present invention is as follows:
A kind of processing terminal, comprising:
Memory, for storing program instruction;
Processor, for running described program instruction, to execute following steps:
S1, it detects whether to receive pulse sequence signal, if so, S2 is thened follow the steps, if it is not, then waiting pulse train defeatedIncoming event;
Whether S2, detection key-press status are down state, if so, down state processing step is executed, if it is not, then executingRelease conditions processing step;
The down state processing step be the number of encoding bits that are rotated according to button as speed value multiplied by every times presetThe resulting numerical value of speed difference value is treated adjustment parameter and is continuously adjusted, until the down state of key is terminated;
The release conditions processing step is to treat adjustment parameter according to the number of encoding bits that button rotates to carry out single adjusting.
It preferably, further include step S0 before step S1;
S0, according to default value initialization data, data include parameter X, speed value S and every speed difference N to be regulated.
Preferably, the down state processing step includes:
S11, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula S=S+1 and holdRow step S12;If counterclockwise, then operational formula S=S-1 and step S12 is executed;
S12, operational formula X=X+S*N;
S13, judge whether key-press status is release conditions, if so, returning to step S1;If it is not, thening follow the steps14;
S14, judge whether to receive pulse train, if so, S11 is returned to step, if it is not, then returning to stepS12。
Preferably, the release conditions processing step includes:
S21, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula X=X+1 and returnReceipt row step S1;If counterclockwise, then operational formula X=X-1 and S1 is returned to step.
Compared with prior art, the beneficial effects of the present invention are:
The mode of operation that button is rotated by pressing the button back spin realizes a wide range of quick adjusting of parameter, by discharging keyThe mode of operation of rotation knob realizes fine-tuning for parameter, and the combination of two ways, which is met, both needed quick-speed large-scale to adjustThe dual requirements for needing to fine-tune again.
Detailed description of the invention
Fig. 1 is a kind of rotary coding switch structural schematic diagram with key;
Fig. 2 is the test circuit diagram of the rotary coding switch shown in Fig. 1 with key;
Fig. 3 is the output waveform figure of the rotary coding switch shown in Fig. 1 with key;
Fig. 4 is the control method flow chart of adjusting knob of the invention;
Fig. 5 is the control device structure chart of adjusting knob of the invention;
Fig. 6 is processing terminal structure chart of the invention.
Specific embodiment
In the following, being described further in conjunction with attached drawing and specific embodiment to the present invention:
Embodiment one:
With reference to Fig. 3, the invention discloses a kind of control methods of adjusting knob, have key applied to as shown in Figure 1Rotary coding switch, comprising the following steps:
S0, according to default value initialization data, data include parameter X, speed value S and every speed difference N to be regulated.
S1, it detects whether to receive pulse sequence signal, if so, S2 is thened follow the steps, if it is not, then waiting pulse train defeatedIncoming event.
Whether S2, detection key-press status are down state, if so, down state processing step is executed, if it is not, then executingRelease conditions processing step.
The down state processing step be the number of encoding bits that are rotated according to button as speed value multiplied by every times presetThe resulting numerical value of speed difference value is treated adjustment parameter and is continuously adjusted, until the down state of key is terminated.The release shapeState processing step is to treat adjustment parameter according to the number of encoding bits that button rotates to carry out single adjusting.Wherein, pulse train is receivedThe mode of signal can be interrupt mode or scanning mode.
Specifically, state process STEP includes:
S11, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula S=S+1 and holdRow step S12;If counterclockwise, then operational formula S=S-1 and step S12 is executed;
S12, operational formula X=X+S*N;
S13, judge whether key-press status is release conditions, if so, returning to step S1;If it is not, thening follow the steps14;
S14, judge whether to receive pulse train, if so, S11 is returned to step, if it is not, then returning to stepS12。
Release conditions processing step includes:
S21, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula X=X+1 and returnReceipt row step S1;If counterclockwise, then operational formula X=X-1 and S1 is returned to step.
The above method is described further below with reference to specific example:
Assuming that the initialization data of knob are as follows: parameter X=100 to be regulated, speed value S=0, every speed difference N=5.
When user does not have the key on push-turn key to rotate knob, release conditions processing step is executed at this time.User rotates clockwise 1 gear (i.e. 1 bits of coded), and parameter X=100+1=101 to be regulated, is further continued for revolving clockwise at this timeTurn 1 gear, at this time parameter X=101+1=102 to be regulated, another mistake hour hands rotate 1 gear, at this time parameter X=to be regulated102-1=101.
When the key on user's push-turn key rotates knob, down state processing step is executed at this time.User1 gear is rotated clockwise, at this time speed value S=0+1=1, parameter X=100+1*5=105 to be regulated, if user keeps pressingLower state rests on the gear, then can treat adjustment parameter X and be continuously adjusted, i.e., parameter X to be regulated is continuously from increasing, every timeFrom increasing 5.If parameter X to be regulated continuously Zi increasing to 150 when, user rotates clockwise a gear again, at this time speed value S=1+1=2, parameter X=150+2*5=160 to be regulated, parameter X to be regulated is every time from increasing 10 at this time, after user unclamps key, from increasingStop.
The advantages of above method is: the mode of operation that button is rotated by pressing the button back spin realizes a wide range of fast of parameterVelocity modulation section realizes fine-tuning for parameter by the mode of operation that release key rotates knob, and the combination of two ways is metNot only the dual requirements for having needed quick-speed large-scale to adjust but also need to fine-tune.
Embodiment two:
With reference to Fig. 4, the invention discloses a kind of control devices of adjusting knob, comprise the following modules:
Pulse signal detection module, for detecting whether pulse sequence signal is received, if so, executing key-press status inspectionModule is surveyed, if it is not, then waiting pulse train incoming event;
Key-press status detection module, for detecting whether key-press status is down state, if so, executing at down stateStep is managed, if it is not, then executing release conditions processing step;
The down state processing step be the number of encoding bits that are rotated according to button as speed value multiplied by every times presetThe resulting numerical value of speed difference value is treated adjustment parameter and is continuously adjusted, until the down state of key is terminated;
The release conditions processing step is to treat adjustment parameter according to the number of encoding bits that button rotates to carry out single adjusting.
It preferably, further include initialization module before pulse signal detection module;
Initialization module, for according to default value initialization data, data include parameter X to be regulated, speed value S and everySpeed difference N.
Preferably, the down state processing step includes:
S11, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula S=S+1 and holdRow step S12;If counterclockwise, then operational formula S=S-1 and step S12 is executed;
S12, operational formula X=X+S*N;
S13, judge whether key-press status is release conditions, if so, returning to step S1;If it is not, thening follow the steps14;
S14, judge whether to receive pulse train, if so, S11 is returned to step, if it is not, then returning to stepS12。
Preferably, the release conditions processing step includes:
S21, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula X=X+1 and returnReceipt row step S1;If counterclockwise, then operational formula X=X-1 and S1 is returned to step.
With reference to Fig. 5, the invention discloses a kind of processing terminals, comprising:
Memory, for storing program instruction;
Processor, for running described program instruction, to execute following steps:
S1, it detects whether to receive pulse sequence signal, if so, S2 is thened follow the steps, if it is not, then waiting pulse train defeatedIncoming event;
Whether S2, detection key-press status are down state, if so, down state processing step is executed, if it is not, then executingRelease conditions processing step;
The down state processing step be the number of encoding bits that are rotated according to button as speed value multiplied by every times presetThe resulting numerical value of speed difference value is treated adjustment parameter and is continuously adjusted, until the down state of key is terminated;
The release conditions processing step is to treat adjustment parameter according to the number of encoding bits that button rotates to carry out single adjusting.
It preferably, further include step S0 before step S1;
S0, according to default value initialization data, data include parameter X, speed value S and every speed difference N to be regulated.
Preferably, the down state processing step includes:
S11, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula S=S+1 and holdRow step S12;If counterclockwise, then operational formula S=S-1 and step S12 is executed;
S12, operational formula X=X+S*N;
S13, judge whether key-press status is release conditions, if so, returning to step S1;If it is not, thening follow the steps14;
S14, judge whether to receive pulse train, if so, S11 is returned to step, if it is not, then returning to stepS12。
Preferably, the release conditions processing step includes:
S21, judge sequence direction in the pulse sequence signal, if clockwise, then operational formula X=X+1 and returnReceipt row step S1;If counterclockwise, then operational formula X=X-1 and S1 is returned to step.
It will be apparent to those skilled in the art that can make various other according to the above description of the technical scheme and ideasCorresponding change and deformation, and all these changes and deformation all should belong to the protection scope of the claims in the present inventionWithin.