CN109213040A - Control circuit, electronic equipment and its control method - Google Patents
Control circuit, electronic equipment and its control method Download PDFInfo
- Publication number
- CN109213040A CN109213040A CN201811057175.0A CN201811057175A CN109213040A CN 109213040 A CN109213040 A CN 109213040A CN 201811057175 A CN201811057175 A CN 201811057175A CN 109213040 A CN109213040 A CN 109213040A
- Authority
- CN
- China
- Prior art keywords
- control unit
- output port
- control
- port
- value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 22
- 238000004891 communication Methods 0.000 claims abstract description 39
- 230000006870 function Effects 0.000 claims description 63
- 230000008859 change Effects 0.000 claims description 21
- 238000013507 mapping Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 6
- 238000012545 processing Methods 0.000 claims description 2
- 238000013461 design Methods 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 11
- 230000005611 electricity Effects 0.000 description 9
- 238000001514 detection method Methods 0.000 description 3
- 239000004973 liquid crystal related substance Substances 0.000 description 3
- 238000000151 deposition Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 229910000831 Steel Inorganic materials 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 239000010959 steel Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 238000009941 weaving Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/042—Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
- G05B19/0423—Input/output
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B2219/00—Program-control systems
- G05B2219/20—Pc systems
- G05B2219/25—Pc structure of the system
- G05B2219/25257—Microcontroller
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Input From Keyboards Or The Like (AREA)
Abstract
The invention discloses a kind of control circuit, electronic equipment and its control methods, wherein control circuit is used to control the communication between n control unit and a keyboard, and each control unit includes at least m universal input and output port.Wherein, control circuit includes: a decoder, and m input port of decoder is respectively used to be connected with m universal input and output port of each control unit;N control switch, an input/output terminal and another input/output terminal for n control switch is connected with n control unit and keyboard by communication bus respectively, its control terminal is connected with the wherein n output port of decoder, to be controlled such that in n control unit of any moment having and only one is communicated with keyboard to control switch according to the output valve of the corresponding port of decoder.Based on circuit design of the invention, it can be achieved that with the purpose of the compatible multiple control units of a keyboard, thus the complete machine appearance of escapable cost and improvement electronic equipment.
Description
Technical field
The invention belongs to technical field of electric equipment more particularly to a kind of control circuits, electronic equipment and its control method.
Background technique
Frequency converter is more and more wider in many aspect applications such as steel, petrochemical industry, weaving, carpenter, electric power at present, every field pair
The reliability requirement of frequency converter is also higher and higher, and this requires frequency converters data can real-time and accurately be sent to keyboard, allows use
The current operating status of frequency converter is known at family, and user can be adjusted according to the current operating status of frequency converter, it is ensured that
Frequency converter stable operation.
Frequency converter keyboard is divided by display mode at present, is divided into LCD liquid crystal display keyboard and LED charactrons show keyboard two
Kind;By whether dividing comprising main control chip MCU (Microcontroller Unit, also known as micro-control unit), it is main to be divided into band
Control chip and without two kinds of main control chip.Taking cost into account, general LED charactrons show that keyboard cost is lower than LCD liquid crystal
Show keyboard, is significantly lower than the keyboard with main control chip without the cost of main control chip.It is longer or more complex in numerous production lines
Occasion, it is often necessary to more frequency converters are used, at this time from the point of view of saving cost and being easily installed debugging, by more frequency conversions
The place that device can share on hardware and structure shares together, forms for the dedicated All-in-One frequency converter of certain industry.But
From the point of view of control, this All-in-One special converter still maintains the control unit of original every frequency converter, therefore right
Each control unit needs to carry out data monitoring and control and regulation.
Existing to be designed to All-in-One frequency converter, the application scheme of used keyboard can be divided into two classes: one kind be to
Each control unit independently matches a keyboard, and this scheme is simple, but brings the increase of cost, while being also unfavorable for complete machine
Design.Another kind of is to only use a keyboard, and connection topological structure is divided into two kinds: one kind is the increase master control core in keyboard
Piece and circuit, using keyboard as the main website of bus communication, as slave station, the program has the control unit in All-in-One frequency converter
The more complex disadvantage of higher cost, control mode;Another kind is that keyboard is connected with a control unit of frequency converter, the control list
Member is connected using relatively abundant peripheral hardware or the control chip of universaling I/O port, other control units with aforementioned control unit, keyboard and its
The data interaction of his control unit need to be converted by aforementioned control unit, equally have higher cost and control mode complicated
The shortcomings that.
Summary of the invention
The invention proposes a kind of control circuit, electronic equipment and its control methods, it is intended to realize a keyboard multiple
Free switching between control unit achievees the purpose that save cost while being conducive to the design of complete machine.
In a first aspect, being used to control between n control unit and a keyboard the invention proposes a kind of control circuit
Communication, each control unit include at least m universal input and output port, the control circuit includes: a decoder, described
Decoder includes k input port and 2kA output port, the wherein m input port of the decoder be respectively used to it is each
M universal input and output port of control unit is connected, wherein 2m>=(n+1) and m≤k;N control switch, n control are opened
The input/output terminal closed is respectively used to be connected to n control unit by communication bus, another input/output terminal difference
For being connected to keyboard by communication bus, the control terminal of n control switch is connected with the wherein n output port of decoder,
To be controlled such that any moment n control to n control switch according to the output valve of n output port in decoder
Have in unit and only one control unit is communicated with keyboard.
Second aspect, the invention proposes a kind of electronic equipment comprising a keyboard, n control unit and a control
Circuit processed, wherein the control circuit is control circuit described in above-mentioned first aspect.
Its further technical solution is that the electronic equipment is All-in-One frequency converter.
Its further technical solution is that the electronic equipment is three-in-one frequency converter, and the three-in-one frequency converter includes 3
A control unit, the decoder are 38 decoders.
Its further technical solution is that described control unit is micro-control unit.
Its further technical solution is that the keyboard is the LED charactrons display keyboard without main control chip.
The third aspect, the invention also provides a kind of control methods, are applied to any one of above-mentioned second aspect electronics and set
Each control unit in standby, the control method include:
Function code is initialized, obtains the initial value of the function code, and m universal input and output port is arranged
For input state, so that the corresponding output port of the decoder exports the first level value, so that with current control unit
Corresponding control switch disconnects;
Whether the initial value for judging the function code is target value;
If the initial value of the function code is not target value, the return value of communication bus is obtained, if the return value includes the
One preset value sets output state for m universal input and output port, and the level of m universal input and output port is arranged
Group is combined into the first level combinations, so that the corresponding output port of the decoder exports second electrical level value, so that with current
The corresponding control switch conducting of control unit;
If the initial value of the function code is target value, output state is set by m universal input and output port, and set
The level combinations for setting m universal input and output port are the first level combinations, so that the corresponding output port of the decoder is defeated
The second electrical level value out, so that control switch corresponding with current control unit is connected;Obtain the return of communication bus
Value;If the return value includes the change information of the function code, the value of the function code is repaired according to the change information
The target control unit switched needed for changing and determining;
Output state is set by m universal input and output port according to the change information and preset mapping relations,
And the output level group that m universal input and output port is arranged is combined into second electrical level combination, so that the output end of the decoder
In mouthful, the port being turned on or off for controlling the control switch being connected with the target control unit exports second electrical level value,
So that control switch conducting corresponding with the target control unit;
If reaching the first prefixed time interval, input state is set by m universal input and output port, so that described translate
Code device is controlled by the target control unit.
Its further technical solution is, described to set input state for m universal input and output port, so that described translate
After code device is by target control unit control, further includes:
Whether the level combinations for detecting m universal input and output port still combine for the second electrical level;
If the level combinations of m universal input and output port are not the second electrical level combination, judge whether to reach second
Prefixed time interval;
If reaching second prefixed time interval, exports failure prompting message and restore the value of the function code to first
Initial value.
Its further technical solution is, if the level combinations of the m universal input and output port are not second electricity
Flat combination, after judging whether to reach the second prefixed time interval, further includes:
If not up to described second prefixed time interval, sets output state for m universal input and output port, and set
The level combinations of m universal input and output port are set to combine for second electrical level, if reaching the first prefixed time interval described in returning,
Input state is set by m universal input and output port, so that the step that the decoder is controlled by the target control unit
Suddenly.
Fourth aspect, the invention also provides a kind of electronic equipment, which includes a keyboard, n control list
Member and a control circuit, the control circuit are the control circuit of above-mentioned first aspect, wherein each control unit includes depositing
Reservoir and processor, computer program is stored in the memory, and the processor can be real when executing the computer program
Existing following steps:
Function code is initialized, obtains the initial value of the function code, and m universal input and output port is arranged
For input state, so that the corresponding output port of the decoder exports the first level value, so that with current control unit
Corresponding control switch disconnects;
Whether the initial value for judging the function code is target value;
If the initial value of the function code is not target value, the return value of communication bus is obtained, if the return value includes the
One preset value sets output state for m universal input and output port, and the level of m universal input and output port is arranged
Group is combined into the first level combinations, so that the corresponding output port of the decoder exports second electrical level value, so that with current
The corresponding control switch conducting of control unit;
If the initial value of the function code is target value, output state is set by m universal input and output port, and set
The level combinations for setting m universal input and output port are the first level combinations, so that the corresponding output port of the decoder is defeated
The second electrical level value out, so that control switch corresponding with current control unit is connected;Obtain the return of communication bus
Value;If the return value includes the change information of the function code, the value of the function code is repaired according to the change information
The target control unit switched needed for changing and determining;
Output state is set by m universal input and output port according to the change information and preset mapping relations,
And the level combinations of m universal input and output port are set for second electrical level combination, so that in the output port of the decoder,
The port being turned on or off for controlling the control switch being connected with the target control unit exports second electrical level value, thus
So that control switch conducting corresponding with the target control unit;
If reaching the first prefixed time interval, input state is set by m universal input and output port, so that described translate
Code device is controlled by the target control unit.
A kind of control circuit, electronic equipment and its control method proposed by the present invention, by control unit and keyboard
Decoder and control switch are provided in connection, with by the setting to control unit so that decoder exports corresponding level value
To making corresponding control switch be turned on or off, so that having in n control unit of any moment and only one control
Unit is communicated with keyboard.Using control method of the invention, it can be achieved that a keyboard is free between multiple control units
Switching achievees the purpose that save cost while being conducive to the design of complete machine.
Detailed description of the invention
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description
Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, general for this field
For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is that the control circuit that the embodiment of the present invention proposes is applied in the communication of three control units and a keyboard
Schematic block diagram;
Fig. 2 is the circuit diagram of control circuit shown in FIG. 1;
Fig. 3 is the flow diagram for the control method that the embodiment of the present invention proposes;
Fig. 4 is the flow diagram for the control method that another embodiment of the present invention proposes;
Fig. 5 is the schematic block diagram for the electronic equipment that the embodiment of the present invention proposes.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall within the protection scope of the present invention.
It in embodiments of the present invention, be 3, m value with n value is 2, k value for 3, it is right for decoder is 38 decoders
The present invention explains.
It is respectively the control circuit of proposition of the embodiment of the present invention applied to three control units and one referring to Fig. 1 and Fig. 2
Schematic block diagram and circuit diagram in the communication of a keyboard.As shown, the control circuit 10 that the embodiment of the present invention proposes is used
In controlling the communication between n control unit 20 and a keyboard 30, it is a general defeated that each described control unit 20 includes at least m
Enter output port, the control circuit 10 includes: a decoder 100 and n control switch 200;Wherein, the decoder 100
Including k input port and 2kA output port, the wherein m input port of the decoder 100 are respectively used to and each institute
M universal input and output port for stating control unit 20 is connected, wherein 2m>=(n+1) and m≤k;The n control switches 200
An input/output terminal be respectively used to be connected to n described control unit 20, another input/output by communication bus 300
End is respectively used to be connected to the keyboard 30 by the communication bus 300, the control terminal of a control switch 200 of n and institute
The wherein n output port for stating decoder 100 is connected, according to the output valve pair of n output port in the decoder 100
The n control switches 200, which are controlled such that in n described control unit of any moment 20, to be had and only one control is single
Member 20 is communicated with the keyboard 30.
Decoder is the combinational logic circuit device of a kind of multiple-input and multiple-output, can be divided into two classes: variable decoder and aobvious
Show decoder.Wherein, usually a kind of less input of variable decoder becomes the device compared with multi output.In the present embodiment, it adopts
It is variable decoder.In embodiments of the present invention, by being set in connection of the described control unit 20 with the keyboard 30
Set the decoder 100 and the control switch 200, with by the setting to described control unit 20 so that the decoding
Device 100 exports corresponding level value to make the corresponding control switch 200 be turned on or off, so that any moment n
Have in a described control unit 20 and only one control unit 20 is communicated with the keyboard 30.
As shown in Figures 1 and 2, the electronic equipment 40 that the embodiment of the present invention proposes includes a keyboard 30, n control unit
20 and a control circuit 10.Wherein, the control circuit 10 includes: a decoder 100 and n control switch 200;It is described to translate
Code device 100 includes k input port and 2kA output port, the wherein m input port of the decoder 100 be respectively used to
M universal input and output port of each described control unit 20 is connected, wherein 2m>=(n+1) and m≤k;The n controls
One input/output terminal of switch 200 is respectively used to be connected to n described control unit 20 by communication bus 300, another defeated
Enter/output end is respectively used to be connected to the keyboard 30 by the communication bus 300, the control of the n control switches 200
End is connected with the wherein n output port of the decoder 100, according to the defeated of n output port in the decoder 100
Be worth out n control switches 200 are controlled such that in n described control unit of any moment 20 have and only one
Control unit 20 is communicated with the keyboard 30.
Specifically, in the present embodiment, the electronic equipment 40 is All-in-One frequency converter.Understandably, the All-in-One
Frequency converter further includes other circuit module and structure for realizing frequency converter function, is well known to those skilled in the art, herein
It repeats no more.The place that more frequency converters can be shared on hardware and structure shares together, forms special for certain industry
All-in-One frequency converter.Every field is higher and higher to the reliability requirement of frequency converter, it is desirable that frequency converter can be real-time data
It is accurately communicated to keyboard, lets the user know that the current operating status of frequency converter, the operation that user can be current according to frequency converter
State is adjusted, it is ensured that frequency converter stable operation.
In some embodiments, such as the present embodiment, the electronic equipment 40 is three-in-one frequency converter, the three-in-one change
Frequency device includes 3 control units 20, so decoder 100 is 38 decoders.38 decoders, which refer to, passes through electricity for 3 for 2 system numbers
Road is converted into the decoder of the output of 8 road different conditions.38 common decoders have arithmetic logic as shown in Table 1:
1 38 decoder truth table of table
Wherein, H is high level, and L is low level, and A0 to A2 is 3 input ports of 38 decoders, and Y0 to Y7 is 38 decodings
8 output ports of device.
The decoder 100 is 38 decoders, including 3 input ports and 8 output ports.Wherein, the decoder
100 2 input ports are respectively used to be connected with 2 universal input and output ports of each control unit 20.In the present embodiment
In, each control unit 20 includes at least 2 universal input and output ports.Such as select each control unit 20 wherein 2 it is logical
With the port input/output port GPIO_i and the port GPIO_j, as the port being connected with the input port of decoder 100.Its
In, the port GPIO_i is i-th of port of control unit 20, and the port GPIO_j is j-th of port of control unit 20, and i and j
Value it is unequal.Each control unit 20 can optional wherein 2 universal input and output ports, as with decoder 100
The connected port of input port.In the present embodiment, the port GPIO_i of each control unit 20 is connected to the A0 of decoder 100
Port, the port GPIO_j is connected to the port A1 of decoder, and the port A0 and the port A1 pass through pull-up resistor R1 and pull-up respectively
Resistance R2 is connected to VCC power end, and the port A2 is grounded.It takes 3 in 8 output ports of the decoder 100 to be used as to divide
The port not being connected with 3 control switches 200.In the present embodiment, select decoder 100 the port Y0 to Y2 as respectively with
The connected port of the control terminal of 3 control switches 200, and Y3 to the port Y7 is grounded.The control of 3 control switches 200
Port is respectively the port EN1, the port EN2 and the port EN3, and the port Y0 of decoder 100 is connected with the port EN1, the port Y1 with
The port EN2 is connected, and the port Y2 is connected with the port EN3.
38 decoder truth tables shown in circuit diagram and table 1 according to Fig.2, are it is found that if by 3 control units 20
The port GPIO_i and the port GPIO_j be disposed as input state, the port A0 and the port A1 of decoder 100 are high level,
And the port A2 is low level, at this point, the port Y0 to Y2 of decoder 100 exports high level, 3 control switches 200 are
It disconnects;And if the port GPIO_i of wherein 2 control units 20 of 3 control units 20 and the port GPIO_j are set as inputting
State sets output state for the port GPIO_i of another control unit 20 and the port GPIO_j, then the port A0 and the end A1
The level value of mouth is determined by the port GPIO_i of the control unit 20 and the output level value of the port GPIO_j, such as the port GPIO_i
Low level is exported, then the port A0 is low level, and the port GPIO_j exports low level, then the port A1 is low level.According to GPIO_i
The level combinations of port and the output of the port GPIO_j, can correspondingly control the disconnection or conducting of 3 control switches 200.
In some embodiments, such as the present embodiment, described control unit 20 is micro-control unit.Micro-control unit, again
Claim one chip microcomputer or single-chip microcontroller, be the frequency and specification of central processing unit are done appropriate reduction, and by memory, count
Device, USB, analog-digital converter, UART (Universal Asynchronous Receiver/Transmitter, abbreviation UART,
The entitled asynchronous receiving-transmitting transmitter of Chinese), (Programmable Logic Controller, abbreviation PLC, Chinese is entitled can by PLC
Programmed logic device), the peripheries such as DMA (Direct Memory Access, abbreviation DMA, Chinese entitled direct memory access) connect
Mouth or even LCD driving circuit all integrate the computer for forming chip-scale on a single chip, do not for different applications
With combination control.
In some embodiments, such as the present embodiment, the keyboard 30 is the LED charactrons display key without main control chip
Disk.The LED charactrons display keyboard without main control chip can be used in keyboard, and keyboard or LCD with main control chip can also be used
The keyboard of liquid crystal display.In the present embodiment, it is based on cost consideration, the preferential LED charactrons using without main control chip are shown
Keyboard.
Referring to Fig. 3, for the flow diagram for the control method that the embodiment of the present invention proposes.As shown, the present invention is real
A kind of control method for applying example proposition can be applied in each control unit 20 of above-mentioned electronic equipment 40, the control method
The following steps are included:
S1: initializing function code, obtains the initial value of the function code, and by m universal input and output port
It is set as input state, so that the corresponding output port of the decoder exports the first level value, so that with current control
The corresponding control switch of unit disconnects.
This is the power-on initialization operation carried out to the electronic equipment 40, i.e., by the function of representing its own address
Code is initialized, and the m universal input and output port that each described control unit 20 is arranged is input state, so that described
N output port in decoder 100 exports the first level value, so that the n control switches 200 disconnect.
To three described control units 20 shown in Fig. 2, respective function code is initialized as 1,2,3 respectively.
To circuit shown in Fig. 2, the port GPIO_i of each described control unit 20 and the port GPIO_j are disposed as
Input state;First level value is low level.At this point, two ports input port A0 of decoder 100 and the port A1
Because pull-up resistor R1 and pull-up resistor R2 are connected to VCC power end, and the port GPIO_i of three control units 20 and GPIO_
The port j is all input state, then the port A0 and the port A1 are all high level, and the port A2 is then low level because being grounded, according to upper
Table 1 is stated it is found that three output ports of decoder 100 at this time, the port Y0 to the port Y2 is high level, then three control switches
200 control port, the port EN1, the port EN2 and the port EN3 are also high level, and three control switches 200 disconnect,
Therefore the keyboard 30 and three described control units 20 are at off-state.
To 3 control units 20 in the present embodiment, function code value and the level value of m universal input and output port have
Just like preset mapping relations shown in following table:
The preset mapping table of table 2
Function code value | GPIO_i level value | GPIO_j level value |
1 | L | L |
2 | H | L |
3 | L | H |
Wherein, H is high level, and L is low level.
If set output state for 2 universal input and output ports of first control unit 20, and the port GPIO_i and
The port GPIO_j all exports low level, according to above-mentioned table 1 it is found that in three input ports of decoder 100, the port A0, the end A1
Mouth and the port A2 are low level, at this point, three output ports of decoder 10, the port Y0 is low level, the port Y1 and Y2
Port is high level, the control terminal EN1 of the first control switch 200, the control terminal EN2 of the second control switch 200 and third
The control terminal EN3 of control switch 200 is connected with the port Y0, the port Y1 and the port Y2 respectively, then the level value of control terminal EN1 is
Low level, control terminal EN2 and control terminal EN3 are high level, therefore, the conducting of the first control switch 200, the second control switch
200 and third control switch 200 disconnect.
If setting output state for 2 universal input and output ports of the second control unit 20, and the port GPIO_i is defeated
High level out, the port GPIO_j export low level, according to above-mentioned table 1 it is found that in three input ports of decoder 100, the end A0
Mouth is high level, and the port A1 and the port A2 are low level, at this point, three output ports of decoder 10, the port Y1 is low electricity
Flat, the port Y0 and the port Y2 are high level, the control of the control terminal EN1 of the first control switch 200, the second control switch 200
End EN2 and the control terminal EN3 of third control switch 200 are connected with the port Y0, the port Y1 and the port Y2 respectively, then control terminal
The level value of EN2 is low level, and control terminal EN1 and control terminal EN3 are high level, therefore, the conducting of the second control switch 200,
First control switch 200 and third control switch 200 disconnect.
If setting output state for 2 universal input and output ports of third control unit 20, and the port GPIO_i is defeated
Low level out, the port GPIO_j export high level, according to above-mentioned table 1 it is found that in three input ports of decoder 100, the end A1
Mouth is high level, and the port A0 and the port A2 are low level, at this point, three output ports of decoder 10, the port Y2 is low electricity
Flat, the port Y0 and the port Y1 are high level, the control of the control terminal EN1 of the first control switch 200, the second control switch 200
End EN2 and the control terminal EN3 of third control switch 200 are connected with the port Y0, the port Y1 and the port Y2 respectively, then control terminal
The level value of EN3 is low level, and control terminal EN1 and control terminal EN2 are high level, and therefore, third control switch 200 is connected,
First control switch 200 and the second control switch 200 disconnect.
S2: whether the initial value for judging the function code is target value.
The initial value of function code is compared with target value, for choosing one of control from multiple control units 20
The unit that unit 20 processed is communicated as first with keyboard 30.In the present embodiment, setting target value be 1, that is, default with
The initial value of function code is the control unit 20 of " 1 " as first control unit communicated with keyboard 30 20.
In the present embodiment, 3 described control units 20 respectively carry out the initial value of respective function code and target value 1
It compares, wherein the control unit 20 and target value 1 that the initial value of function code is " 1 " unanimously, execute step S4;And for function
The initial value of code is the control unit 20 of " 2 " or " 3 ", all inconsistent with target value 1, executes step S3.
S3: if the initial value of the function code is not target value, obtaining the return value of communication bus, if the return value includes
First preset value sets output state for m universal input and output port, and the electricity of m universal input and output port is arranged
Flat group is combined into the first level combinations, so that the corresponding output port of the decoder exports second electrical level value, so that with working as
The preceding corresponding control switch conducting of control unit.
If the communication bus 300 is in an off state, the return value of communication bus 300 is fixed value Q;If described logical
It interrogates bus 300 to be in the state of connection, in the case where no manual key triggers, the return value of communication bus 300 is to fix
Value P;If the communication bus 300 is in the state of connection, in the case where there is manual key triggering, communication bus 300
Return value is key-press input value.
In the present embodiment, if reaching third prefixed time interval, the return value of communication bus is obtained.According to the institute of acquisition
The return value for stating communication bus 300 can determine whether the connection status of the keyboard 30 with corresponding described control unit 20.In this reality
It applies in example, sets the first preset value for fixed value P, if then the return value of the communication bus 300 includes described first default
Value, that is, described control unit 20 and the keyboard 30 are connection status, and are triggered without manual key.
It is the control unit 20 of " 2 " for function code, when executing this step S3, if the communication bus return value obtained is
Fixed value P sets output state for its 2 universal input and output ports, and the electricity of m universal input and output port is arranged
Flat group is combined into the first level combinations, and first level combinations are that the port GPIO_i exports high level, and the output of the port GPIO_j is low
Level.According to above-mentioned table 1 it is found that in 3 output ports of decoder 100, the port Y0 exports high level, and the port Y1 exports low electricity
Flat, the port Y2 exports high level, and output port corresponding with the decoder 100 is the port Y1, and the second electrical level value is low
Level.It follows that the level value of the port EN2 is low level, then second control switch 200 is connected.
It is the control unit of " 3 " for function code, when executing this step S3, if the communication bus return value obtained is solid
Definite value P sets output state for its 2 universal input and output ports, and the level of m universal input and output port is arranged
Group is combined into the first level combinations, and first level combinations are that the port GPIO_i exports low level, the high electricity of the port GPIO_j output
It is flat.According to above-mentioned table 1 it is found that in 3 output ports of decoder 100, the output of the port Y0 is high level, and the output of the port Y1 is height
Level, the output of the port Y2 are low level, and output port corresponding with the decoder 100 is the port Y2, the second electrical level
Value is low level.It follows that the level value of the port EN3 is low level, then third control switch 200 is connected.
S4: if the initial value of the function code is target value, setting output state for m universal input and output port,
And the level combinations that m universal input and output port is arranged are the first level combinations, so that the corresponding output end of the decoder
Mouth exports the second electrical level value, so that control switch corresponding with current control unit is connected;Obtain communication bus
Return value;If the return value includes the change information of the function code, according to the change information to the value of the function code into
The target control unit that row is modified and switched needed for determining.
In 3 control units 20, only the initial value of function code is that the control unit 20 of " 1 " is consistent with target value 1, is executed
This step.Initial value for function code is the control unit 20 of " 1 ", sets defeated for its 2 universal input and output ports
It does well, and the level combinations that m universal input and output port is arranged are the first level combinations, first level combinations are
The port GPIO_i exports low level, and the port GPIO_j exports low level.According to above-mentioned table 1 it is found that 3 of decoder 100 export
In port, the output of the port Y0 is low level, and the output of the port Y1 is high level, and the output of the port Y2 is high level, with the decoder
100 corresponding output ports are the port Y0, and the second electrical level value is low level.It follows that the level value of the port EN1 is
Low level, then the first control switch 200 is connected.
By obtaining the return value of communication bus 300, it can determine whether that the initial value of the keyboard 30 and function code is the control of " 1 "
The connection status of unit 20 processed.If the return value include the function code change information, such as user's operation keyboard 30 with to
The initial value of function code be " 1 " 20 sending function code of control unit change information, the change information for by function code by
" 1 " is changed to " 2 ", then is changed the function code for the control unit 20 that the initial value of function code is " 1 " by " 1 " according to the change information
It is the control unit 20 of " 2 " that target control unit for " 2 ", and determining required switching, which is the initial value of function code,.Later, it executes
Step S5.
S5: output shape is set for m universal input and output port according to the change information and preset mapping relations
State, and the level combinations of m universal input and output port are set for second electrical level combination, so that the output port of the decoder
In, the port being turned on or off for controlling the control switch being connected with the target control unit exports second electrical level value, from
And control switch corresponding with the target control unit is connected.
For example, for above-mentioned change information, target control unit is that the initial value of function code is the control unit of " 2 "
20, i.e. the second described control unit 20.According to above-mentioned table 2, i.e., preset mapping table, it is known that, by first control unit 20
2 universal input and output ports level combinations for being set as output state, and 2 universal input and output ports being set be second
Level combinations, the second electrical level group are combined into the port GPIO_i output high level, and the port GPIO_j exports low level.According to above-mentioned
For table 1 it is found that in three input ports of decoder 100, the port A0 is high level, and the port A1 is low level, and the port A2 is low electricity
Flat, at this point, three output ports of decoder 10, the port Y0 is high level, and the port Y1 is low level, and the port Y2 is high level.
Wherein, output port corresponding with target control unit is the port Y1 in decoder 100, and the port Y1 exports second electrical level value,
The second electrical level value is low level.It follows that the level value of the port EN2 is low level, then the second control switch 200 is led
It is logical.And the level value of the port EN1 is high level, then the first control switch 200 disconnects.
S6: if reaching the first prefixed time interval, input state is set by m universal input and output port, so that institute
Decoder is stated to be controlled by the target control unit.
By setting the first prefixed time interval, in order in first prefixed time interval, the target control
Unit executes corresponding operating.Wherein, first prefixed time interval is greater than the third prefixed time interval.
It is general defeated by 2 of first control unit 20 when reaching the first prefixed time interval for first control unit 20
Enter output port and be set as input state, at this point, the decoder 100 is controlled by the second control unit 20.
Referring to fig. 4, the flow diagram of the control method proposed for another embodiment of the present invention.As shown in figure 4, at certain
A little embodiments, such as in the present embodiment, after step S6, the method also includes:
S7: whether the level combinations of m universal input and output port of detection still combine for the second electrical level.
For first control unit 20, when the operation that it completes to switch to the second control unit 20, pass through detection first
The level value of 2 universal input and output ports of control unit 20, to judge whether the second control unit 20 is established with keyboard 30
Connection relationship.Wherein, the second electrical level group is combined into the port GPIO_i output high level, and the port GPIO_j exports low level.
S8: if the level combinations of m universal input and output port are not second electrical level combination, judge whether to reach the
Two prefixed time intervals.
If the port GPIO_i of first control unit 20 and the level combinations of the port GPIO_j are not the second electrical level groups
It closes, by setting the second prefixed time interval, can be convenient in the second prefixed time interval, to the port GPIO_i and the end GPIO_j
Mouthful level value detected again, to judge whether the second control unit 20 with keyboard 30 establishes connection relationship.
S9: it if reaching second prefixed time interval, exports failure prompting message and restores the value of the function code
To initial value.
If having reached second prefixed time interval, show in second prefixed time interval, the first control
Unit 20 can not still detect the second control unit 20 by the repeated detection of the level to the port GPIO_i and the port GPIO_j
Connection relationship is established with keyboard 30, at this point, first control unit 20 exports failure prompting message, to remind user to detect hardware
It is upper to whether there is failure, also, the function code of first control unit 20 is reverted to 1 by 2, i.e., by the function of first control unit 20
Energy code restores to initial value.
S10: if not up to described second prefixed time interval, sets output state for m universal input and output port,
And the level combinations of m universal input and output port are set for second electrical level combination, if reaching the first preset time described in returning
Interval, sets input state for m universal input and output port, so that the decoder is controlled by the target control unit
The step of.
If not up to described second prefixed time interval sets 2 universal input and output ports of first control unit 20
It being set to output state, and level combinations are second electrical level combination, it is high level that the second electrical level group, which is combined into the port GPIO_i,
The port GPIO_j is low level, reaches the first prefixed time interval if then returning, sets m universal input and output port to
Input state, so that the step of decoder 100 is controlled by the target control unit, as when not up to described second is pre-
If time interval, the port GPIO_i and the port GPIO_j are detected again.
Referring to Fig. 5, for the schematic block diagram for the electronic equipment that the embodiment of the present invention proposes.As shown, the present invention is real
The electronic equipment 50 for applying example proposition includes: a keyboard 30, n control unit 20 and a control circuit 10.Wherein, the control
Circuit 10 processed includes: a decoder 100 and n control switch 200;Wherein, the decoder 100 include k input port with
2kA output port, the wherein m input port of the decoder 100 are respectively used to and the m of each described control unit 20
Universal input and output port is connected, wherein 2m>=(n+1) and m≤k;An input/output terminal point for the n control switches 200
It Yong Yu not be connected to n described control unit 20 by communication bus 300, another input/output terminal is respectively used to pass through institute
It states communication bus 300 and is connected to the keyboard 30, the control terminal of a control switch 200 of n and the decoder 100 are wherein
N output port is connected, with according to the output valve of n output port in the decoder 100 to a control switches of n
200 are controlled such that in n described control unit of any moment 20 have and only one control unit 20 and the keyboard
30 are communicated.Wherein, each described control unit 20 includes depositing in memory 20a and processor 20b, the memory 20a
Contain computer program, the step of processor can realize above-mentioned control method when executing the computer program.
The present invention is by increasing simple logic circuit and software algorithm, it can be achieved that a keyboard is in multiple control units
Between free switching, compared to existing application scheme, control logic is simply easily achieved, meanwhile, can greatly save cost
With the design for being conducive to complete machine.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace
It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right
It is required that protection scope subject to.
Claims (10)
1. a kind of control circuit, for controlling the communication between n control unit and a keyboard, each control unit is at least wrapped
Include m universal input and output port, which is characterized in that the control circuit includes:
One decoder, the decoder include k input port and 2kA output port, the wherein m input terminal of the decoder
Mouth is respectively used to be connected with m universal input and output port of each control unit, wherein 2m>=(n+1) and m≤k;
N control switch, an input/output terminal of n control switch are respectively used to be connected to n control list by communication bus
Member, another input/output terminal are respectively used to be connected to keyboard by communication bus, the control terminal and decoding of n control switch
The wherein n output port of device is connected, to be carried out according to the output valve of n output port in decoder to n control switch
It controls and to have in n control unit of any moment and only one control unit is communicated with keyboard.
2. a kind of electronic equipment, which is characterized in that the electronic equipment includes a keyboard, n control unit and a control
Circuit, wherein the control circuit is control circuit described in claim 1.
3. electronic equipment according to claim 2, which is characterized in that the electronic equipment is All-in-One frequency converter.
4. electronic equipment according to claim 3, which is characterized in that the electronic equipment is three-in-one frequency converter, described
Three-in-one frequency converter includes 3 control units, and the decoder is 38 decoders.
5. electronic equipment according to claim 4, which is characterized in that described control unit is micro-control unit.
6. electronic equipment according to claim 4, which is characterized in that the keyboard is the LED number without main control chip
Pipe shows keyboard.
7. a kind of control method, special applied to each control unit as described in claim any one of 2-6 in electronic equipment
Sign is that control method includes:
Function code is initialized, obtains the initial value of the function code, and set defeated for m universal input and output port
Enter state, so that the corresponding output port of the decoder exports the first level value, so that opposite with current control unit
The control switch answered disconnects;
Whether the initial value for judging the function code is target value;
If the initial value of the function code is not target value, the return value of communication bus is obtained, if the return value includes first pre-
If value, sets output state for m universal input and output port, and the level combinations of m universal input and output port are arranged
For the first level combinations, so that the corresponding output port of the decoder exports second electrical level value, so that with current control
The corresponding control switch conducting of unit;
If the initial value of the function code is target value, set output state for m universal input and output port, and m is set
The level combinations of a universal input and output port are the first level combinations, so that the corresponding output port of the decoder exports institute
Second electrical level value is stated, so that control switch corresponding with current control unit is connected;Obtain the return value of communication bus;If
The return value includes the change information of the function code, is modified according to the change information to the value of the function code and true
The target control unit switched needed for fixed;
Output state is set by m universal input and output port according to the change information and preset mapping relations, and is set
The level combinations of m universal input and output port are set for second electrical level combination, so as to be used in the output port of the decoder
The port that the control switch being connected with the target control unit is turned on or off is controlled, second electrical level value is exported, so that
Control switch conducting corresponding with the target control unit;
If reaching the first prefixed time interval, input state is set by m universal input and output port, so that the decoder
It is controlled by the target control unit.
8. control method according to claim 7, which is characterized in that described to be set as inputting by m universal input and output port
State, so that after the decoder is controlled by the target control unit, further includes:
Whether the level combinations for detecting m universal input and output port still combine for the second electrical level;
If the level combinations of m universal input and output port are not the second electrical level combination, judge whether that reaching second presets
Time interval;
If reaching second prefixed time interval, exports failure prompting message and restore the value of the function code to initial
Value.
9. control method according to claim 8, which is characterized in that if the level combinations of the m universal input and output port
It is not combined for the second electrical level, after judging whether to reach the second prefixed time interval, further includes:
If not up to described second prefixed time interval, set output state for m universal input and output port, and m is set
The level combinations of a universal input and output port are second electrical level combination, if reaching the first prefixed time interval described in returning, by m
A universal input and output port is set as input state, so that the step of decoder is controlled by the target control unit.
10. a kind of electronic equipment, which is characterized in that the electronic equipment includes a keyboard, n control unit and a control
Circuit, the control circuit are control circuit described in claim 1, wherein each control unit includes memory and processing
Device is stored with computer program in the memory, and the processor can realize following steps when executing the computer program:
Function code is initialized, obtains the initial value of the function code, and set defeated for m universal input and output port
Enter state, so that the corresponding output port of the decoder exports the first level value, so that opposite with current control unit
The control switch answered disconnects;
Whether the initial value for judging the function code is target value;
If the initial value of the function code is not target value, the return value of communication bus is obtained, if the return value includes first pre-
If value, sets output state for m universal input and output port, and the level combinations of m universal input and output port are arranged
For the first level combinations, so that the corresponding output port of the decoder exports second electrical level value, so that with current control
The corresponding control switch conducting of unit;
If the initial value of the function code is target value, set output state for m universal input and output port, and m is set
The level combinations of a universal input and output port are the first level combinations, so that the corresponding output port of the decoder exports institute
Second electrical level value is stated, so that control switch corresponding with current control unit is connected;Obtain the return value of communication bus;If
The return value includes the change information of the function code, is modified according to the change information to the value of the function code and true
The target control unit switched needed for fixed;
Output state is set by m universal input and output port according to the change information and preset mapping relations, and is set
The level combinations of m universal input and output port are set for second electrical level combination, so as to be used in the output port of the decoder
The port that the control switch being connected with the target control unit is turned on or off is controlled, second electrical level value is exported, so that
Control switch conducting corresponding with the target control unit;
If reaching the first prefixed time interval, input state is set by m universal input and output port, so that the decoder
It is controlled by the target control unit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811057175.0A CN109213040B (en) | 2018-09-11 | 2018-09-11 | Control circuit, electronic device and control method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811057175.0A CN109213040B (en) | 2018-09-11 | 2018-09-11 | Control circuit, electronic device and control method thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109213040A true CN109213040A (en) | 2019-01-15 |
CN109213040B CN109213040B (en) | 2021-06-15 |
Family
ID=64987640
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811057175.0A Active CN109213040B (en) | 2018-09-11 | 2018-09-11 | Control circuit, electronic device and control method thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109213040B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112104770A (en) * | 2020-09-04 | 2020-12-18 | Tcl通讯(宁波)有限公司 | Antenna tuning switch controller, communication module and mobile terminal |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA1126869A (en) * | 1979-01-29 | 1982-06-29 | Henry C. Sibley | Vital digital control system with keyboard inputs |
JPH1057475A (en) * | 1985-06-04 | 1998-03-03 | Gambro Lundia Ab | Controller |
CN1309339A (en) * | 2001-04-02 | 2001-08-22 | 白春明 | Frequency-changing control system of fan |
CN203117722U (en) * | 2013-03-22 | 2013-08-07 | 北京经纬恒润科技有限公司 | Line switching device and system |
CN106872849A (en) * | 2017-02-24 | 2017-06-20 | 今创科技有限公司 | The device interior IO method of samplings, device and system |
CN107003653A (en) * | 2014-12-03 | 2017-08-01 | 三菱电机株式会社 | Input and output instrument |
CN107918593A (en) * | 2017-05-16 | 2018-04-17 | 烟台市迈高机器人科技有限公司 | The expansion interface circuit and communication means of the one-to-many universal serial bus of near-end |
-
2018
- 2018-09-11 CN CN201811057175.0A patent/CN109213040B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA1126869A (en) * | 1979-01-29 | 1982-06-29 | Henry C. Sibley | Vital digital control system with keyboard inputs |
JPH1057475A (en) * | 1985-06-04 | 1998-03-03 | Gambro Lundia Ab | Controller |
CN1309339A (en) * | 2001-04-02 | 2001-08-22 | 白春明 | Frequency-changing control system of fan |
CN203117722U (en) * | 2013-03-22 | 2013-08-07 | 北京经纬恒润科技有限公司 | Line switching device and system |
CN107003653A (en) * | 2014-12-03 | 2017-08-01 | 三菱电机株式会社 | Input and output instrument |
CN106872849A (en) * | 2017-02-24 | 2017-06-20 | 今创科技有限公司 | The device interior IO method of samplings, device and system |
CN107918593A (en) * | 2017-05-16 | 2018-04-17 | 烟台市迈高机器人科技有限公司 | The expansion interface circuit and communication means of the one-to-many universal serial bus of near-end |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112104770A (en) * | 2020-09-04 | 2020-12-18 | Tcl通讯(宁波)有限公司 | Antenna tuning switch controller, communication module and mobile terminal |
Also Published As
Publication number | Publication date |
---|---|
CN109213040B (en) | 2021-06-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN207352398U (en) | General digital input/output multiplexing circuit and input/output control device | |
CN109597778A (en) | A kind of multi-channel serial port signal list interface duplex output system and its implementation | |
CN104461992A (en) | Electronic device | |
CN109726059A (en) | A server test system | |
CN109213040A (en) | Control circuit, electronic equipment and its control method | |
CN204946336U (en) | The metering communication module of intelligent electric energy meter | |
CN208873142U (en) | A kind of FPGA development board | |
CN117271416B (en) | An adaptive RS232 and RS485 interface circuit | |
CN202720638U (en) | Serial conversion circuit | |
CN204515451U (en) | Learning-oriented scene panel circuit | |
CN106094560A (en) | A kind of intelligent home control system and control method thereof | |
CN203038265U (en) | General-purpose input/output (GPIO) multiplex circuit | |
CN105718414A (en) | Addressable bus structure | |
CN206075263U (en) | Multiplexing reception device based on single-chip microcomputer GPIO pins | |
CN204442329U (en) | A kind of mechanical switch remote-control module and intelligent switch | |
CN109379108A (en) | A kind of electric appliance based on power line carrier, PLC, electric control system | |
CN202886025U (en) | Intelligent pressure transmitter | |
CN108388181B (en) | Key scan apparatus and system | |
CN206601677U (en) | Keyboard circuit and keyboard control system | |
CN107704052B (en) | Fingerprint identification device and desktop based on Feiteng platform | |
CN105095033B (en) | Debugging apparatus and method on a kind of server | |
CN206892854U (en) | A kind of mainboard of raising PCIE data channel utilization rates | |
CN110123168A (en) | A kind of multi gear position toggle switch and its circuit and multi gear position identification circuit, device | |
CN203761359U (en) | Intelligent touch switch system and front and rear end control devices thereof | |
CN218768136U (en) | Device for switching I2C bus by using programmable logic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |