1. Field of the Invention
The invention relates in general to an electronic device, and more particularly to an electronic device with multiple buttons.
2. Description of the Related Art
In a conventional electronic device, a common design of button circuit is to have buttons directly connected to pins of the microprocessor's general purpose input output (GPIO) for determining the state of buttons by the microprocessor directly.
Although such a button circuit design has the advantages of being direct and simple, a large number of GPIO pins will be required when more buttons are needed. Since each button uses a specific GPIO pin, and the microprocessor has a limited number of GPIO pins, such button circuit design is not suitable for an electronic device with a large number of buttons.
To save the use of the GPIO pins, an analog-to-digital converter (ADC) keypad is used. Referring to FIG. 1, a partial circuit diagram of a conventional electronic device with an ADC keypad is shown. In electronic device 10, the ADC keypad 20 includes a resistor combination 16, M buttons SW1˜SWM, and an output node 30.
The resistor combination 16 has M+1 serially connected resistors R0˜RM, and the two ends of the resistor combination 16 are respectively electrically connected with a high voltage Vcc and a grounding voltage. The two ends of each button are respectively electrically connected with the grounding voltage and the node between two adjacent resistors. The output node 30 is disposed between the resistor R0 and the resistor R1 for outputting an analog voltage. The analog voltage corresponds to the state of M buttons. The analog voltage of the output node 30 is converted to a corresponding digital signal via the ADC 50, and then the electronic device's microprocessor 60 further processes the digital signal to execute the function corresponding to the state of M buttons.
It can be seen from above that the ADC keypad 20 can use less GPIO pins by the I/O port of the ADC. Although the ADC keypad can use less GPIO pins of the microprocessor, the ADC keypad 20 does not have any multi-key function. For example, when buttons SW1 and SW2 are both pressed, the microprocessor 60 will determine that only the button SW1 has been pressed. Therefore, when the button of the electronic device needs to use more than two multi-keys, more ADC I/O ports will be needed. How to equip the electronic device with multi-key function without adding more ADC I/O ports has become an urgent aim to achieve.