A kind of button detection and display driving integrated circuit and control method thereof
Technical field
The present invention relates to a kind of button and detect and display driving integrated circuit, be applicable to that the button of various electric equipments detects and display driver.The present invention also comprises the control method of this integrated circuit.
Background technology
Existing control system more after a little while, can only be supported less button and LED luminotron usually at general input/output port line (being called for short GPIO), and the GPIO utilization factor is lower.The central processor MCU that for example is connected to 3 GPIO can only detect 2-3 button usually, drives 2-3 LED luminotron, and as shown in Figure 1,3 GPIO are independent separately, and 1 GPIO connects 1 key press detecting circuit and 1 display driver circuit.When Circuits System is comparatively complicated, when needing more button of expansion and luminotron, then need the more GPIO of respective extension, cost is higher.
Summary of the invention
The objective of the invention is to consider the problems referred to above and provide the less relatively button of a kind of GPIO to detect and display driving integrated circuit that another object of the present invention is to provide the control method of this integrated circuit.
To achieve these goals, the present invention includes following technical characterictic: a kind of button detects and display driving integrated circuit, comprise central processor MCU, key press detecting circuit, display driver circuit and general input/output port line GPIO, key press detecting circuit is connected MCU with display driver circuit by GPIO, it is characterized in that the multiplexing one or more GPIO of described key press detecting circuit and display driver circuit, the GPIO that connects key press detecting circuit is simultaneously as the AD conversion port.
Further, described key press detecting circuit comprises plurality of keys detection module and two or more resistance, and an end was connected with power supply after resistance was in series, and the other end connects MCU by GPIO; Per two adjacent resistor contacts connect button detection module one end, button detection module other end ground connection.
Described button detection module comprises the button and the stake resistance of series connection.
Further, described display driver circuit comprises display driver unit Q1, the Q2 of some display units and the complementation of two control polarity, the anodal display unit that links to each other with GPIO, and its negative pole links to each other with the Q1 collector, the display unit that negative pole links to each other with GPIO, its positive pole links to each other with the Q2 collector; Per two opposite polarity display units of connection connect same GPIO, and the control port of Q1, Q2 is connected same GPIO with key press detecting circuit.
Described Q1 is a NPN type triode; Described Q2 is the positive-negative-positive triode.
Or described display driver unit is a switching device.
Described display unit is the luminotron device.
The present invention comprises that also a kind of button detects and the control method of display driving integrated circuit, and the steering logic with GPIO realizes by the following method:
A. central processor MCU connects the GPIO port that button detects and is set to input state, port voltage is converted to AD value, thereby judges current key-press status, enters step b after the button judgement is finished.
B. central processor MCU connects the GPIO port that button detects and is set to output state, and high and low level is exported in timesharing, as the display driver unit control signal; Display port is exported corresponding high and low level according to the actual displayed content, thus control display unit state.
The invention solves a kind of identification problem and display driver problem that under the less situation of GPIO, increases the button amount detection, do not need to expand any other device, can under the prerequisite that does not influence properties of product, improve the service efficiency of GPIO, effectively reduce cost of products.Button favorable expandability of the present invention can detect infinite many buttons in theory.Because on system control logic, it is the mode of employing time-sharing multiplex that button detects with display driver, display tube brightness stability, button good reliability, being specially adapted to all kinds of low costs, human-computer interaction interface simply needs in the electric equipment of button detection and display circuit.
Description of drawings
Fig. 1 is the block diagram of existing button detection and display driver circuit.
Fig. 2 is the circuit block diagram of button detection of the present invention and display driver.
Fig. 3 is the circuit theory diagrams of the embodiment of the invention.
Fig. 4 detects and the display driver circuit schematic diagram for existing button.
Omitted the miscellaneous part related among the figure with coreless of the present invention.
Embodiment
Below in conjunction with accompanying drawing the specific embodiment of the present invention is described further.
As Fig. 2, shown in Figure 3, a kind of button detects and display driving integrated circuit, comprises central processor MCU, key press detecting circuit 1, display driver circuit 2 and 3 general input/output port line GPIO.
Key press detecting circuit 1 comprises 9 resistance and 4 buttons, wherein, first resistance R 1, second resistance R 2, the 3rd resistance R 3, the 4th resistance R 4,5 series connection of the 5th resistance R, first resistance R, 1 other end detects GPIO with button and is connected, and the 5th resistance R 5 other ends are connected with power supply VCC.The first button KEY1, one end connects the connection contact of first resistance R 1, second resistance R 2, and the other end is by the 6th resistance R 6 ground connection; The second button KEY2, one end connects the connection contact of second resistance R 2, the 3rd resistance R 3, and the other end is by the 7th resistance R 7 ground connection; The 3rd button KEY3 one end connects the connection contact of the 3rd resistance R 3, the 4th resistance R 4, and the other end is by the 8th resistance R 8 ground connection; The 4th button KEY4 one end connects the connection contact of the 4th resistance R 4, the 5th resistance R 5, and the other end is by the 9th resistance R 9 ground connection.
Display driver circuit 2 comprises the first triode Q1, the second triode Q2 of LED LED 1, LED2, LED3, LED4 and the complementation of control polarity, wherein LED1, LED2 positive pole are connected with GPIO2, GPIO3 respectively, and negative pole is connected with the first triode Q1 collector; LED3, LED4 negative pole are connected with GPIO2, GPIO3 respectively, and positive pole is connected with the second triode Q2 collector, and the control port of the first triode Q1, the second triode Q2 is connected with the GPIO1 that is connected key press detecting circuit.
Button detects and the control method of display driver circuit is: at first the GPIO1 of system is set to input state, converts the GPIO1 port voltage to the AD value, and by processing such as delaying time, go to tremble, detects current key-press status; Then, system GPIO1 is set to output state, the output high level, and GPIO2, GPIO3 export high or low level respectively according to actual conditions, are used to light or do not light LED1, LED2; At last, system keeps the GPIO1 output state constant, and output low level, and GPIO2, GPIO3 export low or high level respectively according to actual conditions, is used to light or does not light LED3, LED4; Like this through 3 time-sharing multiplexs, finished once to the detection of all buttons with to the driving of all LED light emitting diodes.
As shown in Figure 4, existing button detects and the display driver circuit technology, as need 4 buttons and 4 LED light emitting diodes is set, then need 5 GPIO, then only need 3 in the present embodiment, and can expand the infinite button that detects more in theory simultaneously, improved the utilization factor of GPIO greatly.