Matrix keying circuit and electric meter

By designing grounding button units and scanning button units in the matrix button circuit, and combining them with the controller's level recognition technology, it is possible to recognize N*N matrix buttons using N input/output ports. This solves the problem of low I/O port utilization in traditional designs and improves the efficiency of the button circuit.

CN224401515UActive Publication Date: 2026-06-23CLOU GLOBAL TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
CLOU GLOBAL TECH CO LTD
Filing Date
2025-06-12
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Traditional matrix keypad circuit designs have low I/O port utilization, requiring M+N I/O ports to identify M*N matrix keys.

Method used

By designing a grounding button unit, a scanning button unit, and a controller, the recognition of an N*N matrix button is achieved using N input/output ports. The controller sequentially selects the input/output ports as level input ports and identifies the level of the level output ports to determine the state of the matrix buttons.

Benefits of technology

The I/O port utilization of the matrix keypad circuit is improved, requiring only N input/output ports to recognize N*N matrix keys, thus avoiding the need for M+N I/O ports in the traditional method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN224401515U_ABST
    Figure CN224401515U_ABST
Patent Text Reader

Abstract

This application discloses a matrix keypad circuit and a meter, relating to the field of keypad circuit technology. It includes a grounding keypad unit comprising N grounding keys, each grounding key's first end connected to an input / output port, and the second end of each grounding key being connected to a common ground. It also includes N scanning keypad units, each comprising N-1 scanning keys and a first diode. The scanning keys and the first diode within the same scanning keypad unit are connected to different input / output ports, and are shared. The first diodes in the N scanning keypad units are connected to different input / output ports. A controller, connected to the input / output ports, is used to sequentially select one input / output port as a level input port and identify the level of the level output port and the level of the level input port to determine the matrix keypad state. The level output port is one of the N-1 non-level input ports among the input / output ports. This application improves the utilization rate of the I / O ports on the matrix keypad circuit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of button circuit technology, and in particular to a matrix button circuit and a meter. Background Technology

[0002] As various button devices are used in more and more scenarios, users are also putting forward higher requirements for the design of matrix button circuits.

[0003] Traditional matrix keypad circuits are designed by connecting I / O (Input / Output) ports horizontally and vertically respectively, and scanning the key state based on the I / O ports. That is, for an M*N (MN can be equal) matrix keypad, M+N I / O ports are needed. This design method of matrix keypad circuit has certain drawbacks. The phenomenon that an M*N matrix keypad requires M+N I / O ports results in low utilization of the I / O ports on the matrix keypad circuit.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Utility Model Content

[0005] The main purpose of this application is to provide a matrix keypad circuit and a meter, which aims to solve the technical problem of low utilization of I / O ports on the matrix keypad circuit.

[0006] To achieve the above objectives, this application provides a matrix keypad circuit, the matrix keypad circuit comprising:

[0007] A grounding button unit, comprising N grounding buttons, wherein the first end of each grounding button is connected to an input / output port, and the second end of each grounding button is connected to ground, wherein N is greater than 2;

[0008] There are N scanning button units, each of which includes N-1 scanning buttons and a first diode. The N-1 scanning buttons and the first diode in the same scanning button unit are all connected to different input / output ports, and the scanning buttons and the first diode are connected together. The first diodes in the N scanning button units are all connected to different input / output ports.

[0009] A controller is connected to the input / output port. The controller is used to sequentially select one of the input / output ports as a level input port and identify the level of the level output port and the level of the level input port to determine the state of the matrix keypad. The level output port is N-1 non-level input ports among the input / output ports.

[0010] In one embodiment, in the same scanning button unit, the second end of all scanning buttons is connected to the anode of the first diode, the first end of one scanning button is connected to a first input / output port, and the cathode of the first diode is connected to a second input / output port. The first input / output port and the second input / output port are both input / output ports, and the input / output ports are not shared.

[0011] In one embodiment, when the first end of the scan button in the scan button unit is connected to the second end of the scan button in the scan button unit, the second input / output port connected to the first diode in the scan button unit is connected to the first input / output port connected to the scan button in the scan button unit.

[0012] In one embodiment, the matrix keypad circuit further includes:

[0013] There are N expansion button units, each of which includes an expansion button and N-1 second diodes. The expansion button and the N-1 second diodes in the same expansion button unit are connected to different input / output ports, and the expansion button and the second diodes are shared. The expansion buttons in the N expansion button units are all connected to different input / output ports.

[0014] In one embodiment, in the same extended button unit, the second end of the extended button is connected to the anode of all the second diodes, the first end of the extended button is connected to a third input / output port, and the cathode of one of the second diodes is connected to a fourth input / output port. The third input / output port and the fourth input / output port are both input / output ports, and the input / output ports are not shared.

[0015] In one embodiment, when the first end of the extended button in the extended button unit is connected to the second end of the extended button in the extended button unit, the fourth input / output port connected to the second diode in the extended button unit is connected to the third input / output port connected to the extended button in the extended button unit.

[0016] In one embodiment, the matrix keypad circuit further includes:

[0017] A pull-up button unit, comprising N pull-up buttons, wherein the first end of one pull-up button is connected to an input / output port;

[0018] A pull-up resistor is provided, the first end of which is connected to the second end of each of the pull-up buttons, and the second end of which is connected to the pull-up power supply.

[0019] In one embodiment, when the first end of the grounding button in the grounding button unit is connected to the second end of the grounding button in the grounding button unit, the input / output port connected to the grounding button in the grounding button unit is grounded;

[0020] When the first end of the pull-up button in the pull-up button unit is connected to the second end of the pull-up button in the pull-up button unit, the input / output port connected to the pull-up button in the pull-up button unit is connected to the pull-up power supply.

[0021] In one embodiment, the matrix keypad circuit further includes:

[0022] There are N port resistors, with the first end of one port resistor connected to one input / output port, and the second end of one port resistor connected to the first end of a ground button, the first ends of N-1 scan buttons, and the cathode of a first diode. The N-1 scan buttons and the first diode belong to different scan button units.

[0023] There are N port capacitors, with the first end of each port capacitor connected to the second end of a port resistor, and the second end of each port capacitor connected to ground.

[0024] In addition, to achieve the above objectives, an electricity meter is also provided, which includes the matrix keypad circuit described above.

[0025] This application provides a matrix keypad circuit, including a grounded keypad unit comprising N grounded keys, each grounded key having its first end connected to an input / output port, and its second end connected to ground. It also includes N scanning keypad units, each including N-1 scanning keys and a first diode. The N-1 scanning keys and the first diode within the same scanning keypad unit are connected to different input / output ports, and the scanning keys and the first diode are shared. The first diodes in the N scanning keypad units are connected to different input / output ports. A controller is connected to the input / output ports and is used to sequentially select one input / output port as a level input port, and to identify the level of the level output port and the level of the level input port to determine the matrix keypad state. The level output port is one of the N-1 non-level input ports among the input / output ports. This matrix keypad circuit uses N grounded keys in the grounded keypad unit, and the N... The grounding button is connected one-to-one with the input / output port, meaning there are N input / output ports. Each of the N scanning button units includes N-1 scanning buttons and a first diode (i.e., N scanning button units contain N components, each connected to one input / output port, for a total of N input / output ports). The first diodes in each of the N scanning button units are connected to different input / output ports, thus forming an N*N matrix button. The controller can sequentially select one input / output port as a level input port and identify the level of the level output port and the level of the level input port to determine the matrix button state. This means that N input / output ports can recognize N*N matrix buttons, avoiding the need for M+N IOs (i.e., N+N IOs) required for an M*N matrix button. This matrix button circuit can recognize N*N matrix buttons through N input / output ports, thereby improving the utilization rate of IO ports on the matrix button circuit. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of the framework of the first embodiment of the matrix keypad circuit of this application;

[0027] Figure 2 This is a connection diagram of an existing matrix keypad circuit;

[0028] Figure 3 This is a connection diagram of the first embodiment of the matrix keypad circuit of this application;

[0029] Figure 4 This is a schematic diagram of the control logic of the first embodiment of the matrix keypad circuit of this application;

[0030] Figure 5 This is a schematic diagram of the framework of the second embodiment of the matrix keypad circuit of this application;

[0031] Figure 6 This is a connection diagram of the second embodiment of the matrix keypad circuit of this application;

[0032] Figure 7 This is a schematic diagram of the control logic of the second embodiment of the matrix keypad circuit of this application;

[0033] Figure 8 This is a schematic diagram of the framework of the third embodiment of the matrix keypad circuit of this application.

[0034] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings.

[0035] Explanation of icon numbers:

[0036] 10. Grounding button unit; 201-20N. First scan button unit - Nth scan button unit; 30. Controller; IO1-ION. First input / output port - Nth input / output port; KG1-KGN. First grounding button - Nth grounding button; KX1-KXN-1. First scan button - N-1th scan button; D1. First diode; R. Port resistor; C. Port capacitor; K1-K12. First on - twelfth switch; KK1. Extended button; D2. Second diode; KL1-KLN. First pull-up button - Nth pull-up button; 501-50N. First extended button unit - Nth extended button unit; 40. Pull-up button unit; RX. Pull-up resistor; VCC. Pull-up power supply; 2-KX1. First scan button in the second scan button unit; 3-KX1. First scan button in the third scan button unit; 4-KX1. First scan button in the fourth scan button unit; 1-KK1. Extended button in the first extended button unit. Detailed Implementation

[0037] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0038] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0039] To control a matrix keypad (primarily controlling the pressed state), a common approach is to connect each row and column of the keypad to an I / O port for identification. See [reference needed]. Figure 2 , Figure 2This is a connection diagram of an existing matrix keypad circuit. Taking the existing handheld meter reader device with 12 keys as an example, it generally uses 7 IOs in a 3×4 manner to scan and identify a key (that is, if the matrix keypad is 3*4, then 3+4 IO ports are needed). This scanning method occupies a lot of IO ports and chip resources, reduces the availability of the chip, and increases the cost to a certain extent.

[0040] Therefore, based on the shortcomings of the above matrix keypad circuit, the matrix keypad circuit of this application is proposed: N grounding buttons are set in the grounding button unit, and each of the N grounding buttons is connected to an input / output port in a one-to-one correspondence, i.e., there are N input / output ports. Simultaneously, each of the N scanning button units includes N-1 scanning buttons and a first diode (i.e., there are N components in the N scanning button units, each component is connected to an input / output port, for a total of N input / output ports). The first diodes in the N scanning button units are all connected to different input / output ports, thus forming an N*N matrix keypad. The controller can sequentially select one input / output port as a level input port and identify the level of the level output port and the level of the level input port to determine the state of the matrix keypad. That is, N input / output ports realize the recognition of N*N matrix keypads, thereby avoiding the phenomenon that an M*N matrix keypad requires M+N IOs (i.e., an N*N matrix keypad requires N+N IOs). This matrix keypad circuit can realize the recognition of N*N matrix keypads through N input / output ports, thereby improving the utilization rate of IO ports on the matrix keypad circuit.

[0041] Based on this, the embodiments of this application provide a matrix keypad circuit, referring to... Figure 1 , Figure 1 This is a schematic diagram of the first embodiment of the matrix keypad circuit of this application.

[0042] Reference Figure 1 This application provides a matrix keypad circuit, which includes:

[0043] Grounding button unit 10 includes N grounding buttons (i.e., the first grounding button KG1 to the Nth grounding button KGN). The first end of each grounding button is connected to an input / output port (i.e., the first input / output port IO1 to the Nth input / output port ION). The second end of each grounding button is connected to the ground. N is greater than 2 (the IO ports are consistent with the existing use in the cases of N=1 and N=2).

[0044] There are N scanning button units (i.e., the first scanning button unit 201 and the Nth scanning button unit 20N). Each scanning button unit includes N-1 scanning buttons (i.e., the first scanning button KX1 to the (N-1)th scanning button KXN-1) and a first diode D1. The N-1 scanning buttons and the first diode D1 in the same scanning button unit are connected to different input / output ports, and the scanning buttons and the first diode D1 are shared. The first diode D1 in the N scanning button units is connected to different input / output ports.

[0045] The controller 30 is connected to the input / output port. The controller is used to select one input / output port as the level input port in sequence, and to identify the level of the level output port and the level of the level input port to determine the state of the matrix key. The level output port is N-1 non-level input ports among the input / output ports.

[0046] In this embodiment, a grounding button unit 10 is designed, comprising N grounding buttons. The second end of each grounding button is connected to a common ground, and the first end of each grounding button is connected to an input / output port. Thus, N input / output ports are used, each uniquely connected to the first end of one of the N grounding buttons, to achieve state identification of the grounding buttons. Simultaneously, N scanning button units are designed. Each scanning button unit includes N-1 scanning buttons and a first diode D1. The N-1 scanning buttons and the first diode D1 in the same scanning button unit are connected to different input / output ports, and the scanning buttons and the first diode D1 are shared. In other words, the N scanning button units contain N devices (N-1 scanning buttons and one first diode D1), and each of the N devices is connected to a unique input / output port. Therefore, the resulting N*N matrix button can achieve button scanning using only N input / output ports. At this point, by controlling the sequential selection of one input / output port as a level input port, and identifying the level of the level output port and the level of the level input port, the state of the matrix buttons is determined. Here, the level output port consists of N-1 non-level input ports among the input / output ports. Taking the N buttons of the first input / output port IO1 as an example, IO1 is designed as a level input port, as are IO2 and ION. Regarding the identification of the ground button KG1 in IO1, since pressing KG1 grounds IO1, regardless of the input level, IO1 will always recognize it as low, thus confirming that KG1 is pressed and its state can be identified. The identification method for the ground buttons of other input / output ports is similar. When identifying the scan button, assuming 2-KX1 is pressed, the high level input to the first input / output port IO1 will be output to the second input / output port IO2 through the first diode D1 in the second scan button unit 202. At this time, based on the second input / output port IO2 and the Nth input / output port ION, the outputs 1, 0, ... will be obtained, thus determining that 2-KX1 is pressed. When 3-KX1 is pressed, the high level input to the first input / output port IO1 will be output to the third input / output port IO3 through the first diode D1 in the third scan button unit 203. At this time, based on the second input / output port IO2 and the Nth input / output port ION, the outputs 0, 1, 0, ... will be obtained, thus determining that 3-KX1 is pressed. And so on, determining the pressed state of N-1 scan buttons.Furthermore, by selecting different input / output ports as level input ports, the state of N buttons connected to the level input ports can be identified. Thus, N*N matrix button recognition can be achieved based on N input / output ports, greatly improving the utilization rate of input / output ports in matrix buttons.

[0047] In this embodiment, a matrix keypad circuit is provided, including a grounding keypad unit 10, which includes N grounding keys. The first end of each grounding key is connected to an input / output port, and the second end of each grounding key is connected to ground. There are also N scanning keypad units, each including N-1 scanning keys and a first diode D1. The N-1 scanning keys and the first diode D1 in the same scanning keypad unit are connected to different input / output ports, and the scanning keys and the first diode D1 are shared. The first diode D1 in each of the N scanning keypad units is connected to different input / output ports. A controller 30 is connected to the input / output ports. The controller 30 is used to sequentially select one input / output port as a level input port and identify the level of the level output port and the level of the level input port to determine the matrix keypad state. The level output port is one of the N-1 non-level input ports in the input / output port. This matrix keypad circuit is configured through the grounding keypad unit 10. There are N grounding buttons, each connected to an input / output port in a one-to-one correspondence, resulting in N input / output ports. Each of the N scanning button units includes N-1 scanning buttons and a first diode (i.e., N components in the N scanning button units, each connected to an input / output port, for a total of N input / output ports). The first diodes in each of the N scanning button units are connected to different input / output ports, thus forming an N*N matrix button. The controller 30 can sequentially select one input / output port as a level input port and identify the level of the level output port and the level of the level input port to determine the matrix button state. This means that N input / output ports can recognize N*N matrix buttons, avoiding the need for M+N I / O ports required for an M*N matrix button (i.e., N+N I / O ports required for an N*N matrix button). This matrix button circuit can recognize N*N matrix buttons through N input / output ports, thereby improving the utilization rate of I / O ports on the matrix button circuit.

[0048] Furthermore, based on the first embodiment of the matrix keypad circuit of this application described above, a second embodiment of the matrix keypad circuit of this application is proposed, with reference to... Figure 3 , Figure 3This is a connection diagram of the first embodiment of the matrix keypad circuit of this application. In the same scanning keypad unit, the second end of all scanning keys is connected to the anode of the first diode D1. The first end of one scanning keypad is connected to a first input / output port, and the cathode of the first diode D1 is connected to a second input / output port. The first input / output port and the second input / output port are both input / output ports, and the input / output ports are not shared.

[0049] Furthermore, when the first end of the scanning button in the scanning button unit is connected to the second end of the scanning button in the scanning button unit, the second input / output port connected to the first diode in the scanning button unit is connected to the first input / output port connected to the scanning button in the scanning button unit.

[0050] In this embodiment, in the same scanning button unit, the second end of all scanning buttons is connected to the anode of the first diode D1. The first end of each scanning button is connected to a first input / output port, and the cathode of the first diode D1 is connected to a second input / output port. Both the first and second input / output ports are input / output ports, and they are not shared. That is, one end of each device in the same scanning button unit is shared, and the other end of each device is connected to a unique input / output port, which is the same as the input / output port connected to the grounding button in the previous embodiment. Furthermore, each first diode D1 is connected to a different input / output port. This allows for the identification of the scanning button. When the first end of a scanning button in the scanning button unit is connected to the second end of the scanning button in the scanning button unit, the second input / output port connected to the first diode D1 in the scanning button unit is connected to the first input / output port connected to the scanning button in the scanning button unit. The actual principle is that the output of the second input / output port connected to the first diode is directly the level value of the first input / output port connected to the scanning button. Furthermore, taking a common 16-button layout as an example, 16 buttons typically require 8 I / O scans for 4x4 recognition. This necessitates a significant amount of I / O port resources, and also increases the chip size. However... Figure 3(Schematic diagram of 16-button operation) This design uses four I / O pins to detect 16 buttons. A circuit combining diodes and buttons is used to identify the 16 buttons, with each I / O pin responsible for identifying four buttons. Specifically, I / O1 identifies: 2-KX1, 3-KX1, 4-KX1, KG1; I / O2 identifies: 1-KX1, 3-KX2, 4-KX2, KG2; I / O3 identifies: 1-KX2, 2-KX2, 4-KX3, KG3; and I / O4 identifies: 1-KX3, 2-KX3, 3-KX3, KG4. The controller 30 uses a cyclic scanning method with one I / O input and three I / O outputs. The three I / O output scheme involves three I / O pins sequentially outputting a high level; after one I / O pin outputs a high level, the other two I / O pins sequentially output a low level. For example, to identify four buttons controlled by IO1: 2-KX1, 3-KX1, 4-KX1, and KG1, IO1 is set as an input IO port, and IO2, IO3, and IO4 are output IO ports. Their judgment logic corresponds to: 1 1 1 0 (grounded button KG1 recognition), 1 0 0 1 (scanning button 2-KX1 recognition), 0 1 0 1 (scanning button 3-KX1 recognition), and 0 0 1 1 (scanning button 4-KX1 recognition), respectively. The last bit is the judgment bit, and the first three bits represent the level of the three output ports. The grounded button is judged first, then the other three buttons are judged, and recognition is performed by cyclically scanning through high and low input levels. Further details can be found in [reference needed]. Figure 4 , Figure 4 This is a schematic diagram of the control logic of the first embodiment of the matrix keypad circuit of this application. When key recognition occurs on the first input / output port IO1, if IO2, IO3, and IO4 output a high level, IO1 recognizes 0, thus determining that KG1 is pressed; if IO2, IO3, and IO4 output 1, 0, 0; 0, 1, 0; 0, 0, 1 sequentially, IO1 recognizes 1, 0, 0 (i.e., if IO2, IO3, and IO4 output 1, 0, 0, IO1 recognizes 1; otherwise, it recognizes 0), then 2-KX1 is pressed; if IO2, IO3, and IO4 output 1, 0, 0 sequentially, IO1 recognizes 1, 0, 0, then 2-KX1 is pressed; if IO2, IO3, and IO4 output 1, 0, 0 sequentially, IO1 recognizes 1, 0, 0, then 2-KX1 is pressed. When the outputs are 1, 0, 0; 0, 1, 0; 0, 0, 1, IO1 is identified as 0, 1, 0 (i.e., when IO2, IO3, and IO4 are output IO ports and output 0, 1, 0, IO1 is identified as 1; otherwise, it is identified as 0), then 3-KX1 is confirmed to be pressed. When the output IO ports IO2, IO3, and IO4 output the following sequence: 1, 0, 0; 0, 1, 0; 0, 0, 1, IO1 is identified as 0, 0, 1 (i.e., when IO2, IO3, and IO4 are output IO ports and output 0, 0, 1, IO1 is identified as 1; otherwise, it is identified as 0), then 3-KX1 is confirmed to be pressed. The specific identification correspondence is shown in Table 1.

[0051]

[0052] Table 1

[0053]

[0054] Table 2

[0055] When recognizing a button on the second input / output port IO2, if IO1, IO3, and IO4 output a high level, IO2 will recognize 0, indicating that KG2 is pressed. If IO1, IO3, and IO4 output 1, 0, 0; 0, 1, 0; 0, 0, 1 sequentially, IO2 will recognize 1, 0, 0 (i.e., if IO1, IO3, and IO4 output 1, 0, 0, IO2 will recognize 1; otherwise, it will recognize 0), then 1-KX1 is pressed. If IO1, IO3, and IO4 output 1, 0, 0; 0, 1, 0 sequentially, IO2 will recognize 1. When the output is 0, 0, 1, IO2 is identified as 0, 1, 0 (i.e., IO1, IO3, IO4 are output IO ports and output 0, 1, 0, IO2 is identified as 1, and other cases are identified as 0), then 3-KX2 is confirmed to be pressed; when IO1, IO3, IO4 are output IO ports and output 1, 0, 0; when the output is 0, 1, 0; when the output is 0, 0, 1, IO2 is identified as 0, 0, 1 (i.e., IO1, IO3, IO4 are output IO ports and output 0, 0, 1, IO2 is identified as 1, and other cases are identified as 0), then 4-KX1 is confirmed to be pressed. The specific identification correspondence is shown in Table 2.

[0056]

[0057] Table 3

[0058] When recognizing a button on the third input / output port IO3, if IO1, IO2, and IO4 output a high level, IO3 will recognize 0, indicating that KG3 is pressed; if IO1, IO2, and IO4 output 1, 0, 0; 0, 1, 0; 0, 0, 1 sequentially, IO3 will recognize 1, 0, 0 (i.e., if IO1, IO2, and IO4 output 1, 0, 0, IO3 will recognize 1; otherwise, it will recognize 0), then 1-KX2 is pressed; if IO1, IO2, and IO4 output 1, 0, 0; 0, 1, 0 sequentially... When the output is 0, 0, 1, IO3 is identified as 0, 1, 0 (i.e., IO1, IO2, and IO4 are output IO ports and output 0, 1, 0, IO3 is identified as 1, and other cases are identified as 0), then 2-KX2 is confirmed to be pressed; when IO1, IO2, and IO4 are output IO ports and output 1, 0, 0; 0, 1, 0; 0, 0, 1, IO3 is identified as 0, 0, 1 (i.e., IO1, IO2, and IO4 are output IO ports and output 0, 0, 1, IO3 is identified as 1, and other cases are identified as 0), then 4-KX3 is confirmed to be pressed. The specific identification correspondence is shown in Table 3.

[0059]

[0060]

[0061] Table 4

[0062] When recognizing a button on the fourth input / output port IO4, if IO1, IO2, and IO3 output a high level, IO4 will recognize 0, indicating that KG4 is pressed. If IO1, IO2, and IO3 output 1, 0, 0; 0, 1, 0; 0, 0, 1 sequentially, IO4 will recognize 1, 0, 0 (i.e., if IO1, IO2, and IO3 output 1, 0, 0, IO3 will recognize 1; otherwise, it will recognize 0), then 1-KX3 is pressed. If IO1, IO2, and IO3 output 1, 0, 0; 0, 1, 0 sequentially, IO4 will recognize 1, 0, 0 (i.e., if IO1, IO2, and IO3 output 1, 0, 0, IO3 will recognize 1; otherwise, it will recognize 0), then 1-KX3 is pressed. When the output is 0, 0, 1, IO4 identifies it as 0, 1, 0 (i.e., IO1, IO2, and IO3 output 0, 1, 0, IO4 identifies it as 1, and other cases identify it as 0), then 2-KX3 is confirmed to be pressed. When IO1, IO2, and IO3 output 1, 0, 0 in sequence; 0, 1, 0; 0, 0, 1, IO4 identifies it as 0, 0, 1 (i.e., IO1, IO2, and IO3 output 0, 0, 1, IO4 identifies it as 1, and other cases identify it as 0), then 3-KX3 is confirmed to be pressed. The specific identification correspondence is shown in Table 4. It is worth noting that in this case, each control has a control that does not output 0 at all. In this case, each level input port will identify 0, which will not be repeated here. At this time, a 4*4 matrix key recognition can be realized based on 4 input and output ports, which greatly expands the utilization of input and output ports.

[0063] Furthermore, based on the first and / or second embodiments of the matrix keypad circuit described above, a third embodiment of the matrix keypad circuit of this application is proposed, with reference to... Figure 5 , Figure 5 This is a schematic diagram of the framework of the second embodiment of the matrix keypad circuit of this application. The matrix keypad circuit further includes:

[0064] There are N extended button units (i.e., the first extended button unit 501 to the Nth extended button unit 50N). Each extended button unit includes an extended button KK1 and N-1 second diodes D2. The extended button KK1 and the N-1 second diodes D2 in the same extended button unit are connected to different input / output ports, and the extended button KK1 and the second diodes D2 are shared. Among them, the extended buttons KK1 in the N extended button units are all connected to different input / output ports.

[0065] In this embodiment, the matrix keypad circuit further includes N extended keypad units. Each extended keypad unit includes an extended keypad KK1 and N-1 second diodes D2. The extended keypad KK1 and N-1 second diodes D2 in the same extended keypad unit are connected to different input / output ports, and the extended keypad KK1 and the second diodes D2 are shared. The extended keypad KK1 in the N extended keypad units are all connected to different input / output ports. That is, the connection method of the extended keypad units is roughly the same as that of the scanning keypad units. The extended keypad unit has only one key, while the scanning keypad unit has a first diode D1. In other words, the extended keypad unit can extend the entire matrix keypad circuit with N keys to form N*N+1 keys. At this time, N input / output ports can still be used for scanning and recognition, so as to expand the functionality of the input / output ports and improve the utilization rate of the input / output ports.

[0066] In one embodiment, within the same extended button unit, refer to Figure 6 , Figure 6 This is a connection diagram of the second embodiment of the matrix keypad circuit of this application. The second end of the extended keypad KK1 is connected to the anode of all the second diodes D2. The first end of the extended keypad KK1 is connected to a third input / output port, and the cathode of one of the second diodes D2 is connected to a fourth input / output port. The third input / output port and the fourth input / output port are both input / output ports, and the input / output ports are not shared.

[0067] Furthermore, when the first end of the extended button KK1 in the extended button unit is connected to the second end of the extended button KK1 in the extended button unit, the fourth input / output port connected to the second diode D2 in the extended button unit is connected to the third input / output port connected to the extended button KK1 in the extended button unit.

[0068] In this embodiment, the second end of the extended button KK1 is connected to the anode of all the second diodes D2. The first end of the extended button KK1 is connected to a third input / output port, and the cathode of one second diode D2 is connected to a fourth input / output port. Both the third and fourth input / output ports are input / output ports, and they are not shared. That is, one end of each device in the same extended button unit is connected, and the other end of each device is connected to a unique input / output port, which is the same input / output port connected to the ground button in the previous embodiment. At this time, the extended button is identified. When the first end of the extended button KK1 in the extended button unit is connected to the second end of the extended button KK1 in the extended button unit, the fourth input / output port connected to the second diode D2 in the extended button unit is connected to the third input / output port connected to the extended button KK1 in the extended button unit. The actual principle is that the output of the fourth input / output port connected to the second diode D2 is directly the level value of the second input / output port connected to the extended button. Furthermore, taking a common 12-button layout as an example, 12 buttons typically require 7 I / O scans for 3x4 recognition. This necessitates a significant amount of I / O port resources, and also increases the chip size. However... Figure 6 (Schematic diagram of 12-button design) The left side has 3 I / O ports, and the right side uses diodes and buttons to form a circuit that recognizes 12 buttons. Each I / O port is responsible for recognizing 4 buttons. Specifically, I / O1 recognizes: 1-KK1, 2-KX1, 3-KX1, KG1; I / O2 recognizes: 2-KK1, 1-KX1, 3-KX1, KG2; I / O3 recognizes: 3-KK1, 1-KX2, 2-KX2, KG3. The controller 30 is designed with one I / O input and two I / O outputs for cyclic scanning. The two output I / O ports have four output schemes: both I / O ports output high level sequentially, both I / O ports output low level sequentially, one I / O port outputs low level and then the other I / O port outputs high level, and one I / O port outputs high level and then the other I / O port outputs low level. For example, to identify four buttons controlled by IO1: 1-KK1, 2-KX1, 3-KX1, and KG1, IO1 is set as an input IO port, and IO2 and IO3 are output IO ports. Their judgment logic corresponds to: 1 1 0 (grounded button KG1 recognition), 0 0 1 (extended button 1-KK1 recognition), 1 0 1 (scanning button 2-KX1 recognition), and 0 11 (scanning button 3-KX1 recognition). The last bit is the judgment bit; first, the grounded button is judged, then the previous three buttons are judged, and recognition is performed by cyclically scanning through high and low input levels. Further details can be found in [reference needed]. Figure 7 , Figure 7This is a schematic diagram of the control logic of the second embodiment of the matrix keypad circuit of this application (this embodiment takes a 3*4 matrix keypad as an example, but it can also be other types of matrix keypads). When key recognition is performed on the first input / output port IO1, when IO2 and IO3 are output IO ports, IO1 is recognized as 0, thus determining that KG1 is pressed; when IO2 and IO3 are output IO ports, sequentially outputting 1, 0; 0, 1, IO1 is recognized as 0 (that is, when IO2 and IO3 are output IO ports, outputting 1, 0; 0, 1, IO1 is recognized as 0), thus determining that 1-KK1 is pressed. When IO2 and IO3 output 1 and 0 respectively, and IO1 is identified as 1 and 0 respectively (i.e., when IO2 and IO3 output 1 and 0 respectively, IO1 is identified as 1; otherwise, it is identified as 0), then 2-KX1 is confirmed to be pressed. The specific identification correspondence is shown in Table 5.

[0069]

[0070] Table 5

[0071]

[0072] Table 6

[0073] When recognizing buttons on the second input / output port IO2, if IO1 and IO3 output a high level, IO2 recognizes 0, indicating that KG2 is pressed; if IO1 and IO3 output 1, 0; 0, 1 sequentially, IO2 recognizes 0 (i.e., if IO1 and IO3 output 1, 0; 0, 1, IO2 recognizes 0), indicating that 2-KK1 is pressed; if IO1 and IO3 output 1, 0; 0, 1 sequentially, IO2 recognizes 1, 0 (i.e., if IO1 and IO3 output 1, 0, IO2 recognizes 1, otherwise it recognizes 0), indicating that 1-KX1 is pressed; if IO1 and IO3 output 1, 0; 0, 1 sequentially, IO2 recognizes 1 (i.e., if IO1 and IO3 output 0, 1, IO2 recognizes 1, otherwise it recognizes 0), indicating that 3-KX1 is pressed. The specific recognition correspondence is shown in Table 6.

[0074]

[0075] Table 7

[0076] When recognizing buttons on the third input / output port IO3, if IO1 and IO2 output a high level, IO3 will recognize 0, indicating that KG3 is pressed; if IO1 and IO2 output 1, 0, 0, 1 in sequence, IO3 will recognize 0 (i.e., if IO1 and IO2 output 1, 0, 0, 1, IO3 will recognize 0), indicating that 3-KK1 is pressed; if IO1 and IO2 output 1, 0, 0, 1 in sequence, IO3 will recognize 1, 0 (i.e., if IO1 and IO2 output 1, 0, IO3 will recognize 1, otherwise it will recognize 0), indicating that 1-KX2 is pressed; if IO1 and IO2 output 1, 0, 0, 1 in sequence, IO3 will recognize 1 (i.e., if IO1 and IO2 output 0, 1, IO3 will recognize 1, otherwise it will recognize 0), indicating that 2-KX2 is pressed. The specific recognition correspondence is shown in Table 7. It's worth noting that each control at this point contains controls that output no 0. In this case, each level input port will recognize 0, which will not be explained again here. This allows for 3x4 matrix key recognition based on the three input / output ports, significantly expanding the utilization of the input / output ports.

[0077] Based on the first, second, and / or third embodiments of the matrix keypad circuit described above, a fourth embodiment of the matrix keypad circuit of this application is proposed, with reference to... Figure 8 , Figure 8 This is a schematic diagram of the framework of the third embodiment of the matrix keypad circuit of this application. The matrix keypad circuit further includes:

[0078] The pull-up button unit 40 includes N pull-up buttons (i.e., the first pull-up button KL1 to the Nth pull-up button KLN), and the first end of each pull-up button is connected to an input / output port.

[0079] Pull-up resistor RX, the first end of pull-up resistor RX is connected to the second end of each ground button, and the second end of pull-up resistor RX is connected to pull-up power supply VCC.

[0080] Furthermore, when the first end of the grounding button in the grounding button unit is connected to the second end of the grounding button in the grounding button unit, the input / output port connected to the pull-up button in the grounding button unit is grounded;

[0081] When the first end of the pull-up button in the pull-up button unit is connected to the second end of the pull-up button in the pull-up button unit, the input / output port connected to the pull-up button in the pull-up button unit is connected to the pull-up power supply VCC.

[0082] In this embodiment, the matrix keypad circuit also includes a pull-up keypad unit 40 and a pull-up resistor RX. When the pull-up key in the pull-up keypad unit 40 is pressed, the corresponding connected input / output port will recognize a high level, thereby determining that the key on that input / output port is pressed. That is, when the first end of the pull-up key in the pull-up keypad unit is connected to the second end of the pull-up key in the pull-up keypad unit, the input / output port connected to the pull-up key in the pull-up keypad unit is connected to the pull-up power supply VCC. This is the same as the recognition method of the ground keypad unit, that is, when the first end of the ground key in the ground keypad unit is connected to the second end of the ground key in the ground keypad unit, the input / output port connected to the pull-up key in the ground keypad unit is grounded. In other words, the N*N matrix keypad can be expanded into an N*N+1 matrix keypad through the pull-up keypad unit, which can increase the number of keys and improve the utilization rate of the input / output ports.

[0083] In one embodiment, the matrix keypad circuit further includes:

[0084] There are N port resistors R. The first end of one port resistor R is connected to an input / output port. The second end of one port resistor R is connected to the first end of a ground button, the first end of N-1 scan buttons, and the cathode of a first diode D1. The N-1 scan buttons and the first diode D1 belong to different scan button units.

[0085] There are N port capacitors C. The first end of each port capacitor C is connected to the second end of a port resistor R. The second end of each port capacitor C is connected to ground.

[0086] In this embodiment, the matrix keypad circuit also includes N port resistors R and N port capacitors C. The N port resistors R are connected between the N input / output ports and the keys or diodes, respectively, and are generally used to ensure the stability of the output level. At the same time, each input / output port is also grounded through a port capacitor C, thereby realizing the function of stable output. Of course, the entire matrix keypad circuit may also include other devices, such as overcurrent protection and output voltage regulation devices, which will not be described in detail here.

[0087] This application also provides an electricity meter, which includes the matrix keypad circuit described above.

[0088] It is worth noting that the matrix keypad circuit can be set on the meter by setting N ground buttons in the ground button unit, and each of the N ground buttons is connected to an input / output port in a one-to-one correspondence, i.e., there are N input / output ports. At the same time, the N scanning button units include N-1 scanning buttons and a first diode (i.e., there are N components in the N scanning button units, and each component is connected to an input / output port, for a total of N input / output ports). The first diodes in the N scanning button units are all connected to different input / output ports, which can form an N*N matrix keypad. The control can sequentially select one input / output port as a level input port and identify the level of the level output port and the level of the level input port to determine the state of the matrix keypad. That is, the N input / output ports realize the recognition of N*N matrix keypads, thereby avoiding the phenomenon that an M*N matrix keypad requires M+N IO (i.e., an N*N matrix keypad requires N+N IO). This matrix keypad circuit can realize the recognition of N*N matrix keypads through N input / output ports, thereby improving the utilization rate of IO ports on the matrix keypad circuit.

[0089] It is worth noting that the electricity meter can also include other hardware, such as the above matrix key circuit set on the handheld reading device on the electricity meter. The handheld reading device is set on the electricity meter, which will not be described in detail here. The entire matrix key circuit can be set on the electricity meter or on other products that require matrix keys, which is not limited here.

[0090] The device provided in this application can solve the technical problem of low utilization of I / O ports in matrix keypad circuits. Compared with the prior art, the beneficial effects of the meter provided in this application are the same as those of the matrix keypad circuit provided in the above embodiments, and will not be repeated here.

[0091] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A matrix keypad circuit, characterized in that, The matrix keypad circuit includes: A grounding button unit, comprising N grounding buttons, wherein the first end of each grounding button is connected to an input / output port, and the second end of each grounding button is connected to ground, wherein N is greater than 2; There are N scanning button units, each of which includes N-1 scanning buttons and a first diode. The N-1 scanning buttons and the first diode in the same scanning button unit are all connected to different input / output ports, and the scanning buttons and the first diode are connected together. The first diodes in the N scanning button units are all connected to different input / output ports. A controller is connected to the input / output port. The controller is used to sequentially select one of the input / output ports as a level input port and identify the level of the level output port and the level of the level input port to determine the state of the matrix keypad. The level output port is N-1 non-level input ports among the input / output ports.

2. The matrix keypad circuit as described in claim 1, characterized in that, In the same scanning button unit, the second end of all scanning buttons is connected to the anode of the first diode. The first end of one scanning button is connected to a first input / output port, and the cathode of the first diode is connected to a second input / output port. The first input / output port and the second input / output port are both input / output ports, and the input / output ports are not shared.

3. The matrix keypad circuit as described in claim 2, characterized in that, When the first end of the scan button in the scan button unit is connected to the second end of the scan button in the scan button unit, the second input / output port connected to the first diode in the scan button unit is connected to the first input / output port connected to the scan button in the scan button unit.

4. The matrix keypad circuit as described in claim 1, characterized in that, The matrix keypad circuit also includes: There are N expansion button units, each of which includes an expansion button and N-1 second diodes. The expansion button and the N-1 second diodes in the same expansion button unit are connected to different input / output ports, and the expansion button and the second diodes are shared. The expansion buttons in the N expansion button units are all connected to different input / output ports.

5. The matrix keypad circuit as described in claim 4, characterized in that, In the same extended button unit, the second end of the extended button is connected to the anode of all the second diodes, the first end of the extended button is connected to a third input / output port, and the cathode of one of the second diodes is connected to a fourth input / output port. The third input / output port and the fourth input / output port are both input / output ports, and the input / output ports are not shared.

6. The matrix keypad circuit as described in claim 5, characterized in that, When the first end of the extended button in the extended button unit is connected to the second end of the extended button in the extended button unit, the fourth input / output port connected to the second diode in the extended button unit is connected to the third input / output port connected to the extended button in the extended button unit.

7. The matrix keypad circuit as described in claim 1, characterized in that, The matrix keypad circuit also includes: A pull-up button unit, comprising N pull-up buttons, wherein the first end of one pull-up button is connected to an input / output port; A pull-up resistor is provided, the first end of which is connected to the second end of each of the pull-up buttons, and the second end of which is connected to the pull-up power supply.

8. The matrix keypad circuit as described in claim 7, characterized in that, When the first end of the grounding button in the grounding button unit is connected to the second end of the grounding button in the grounding button unit, the input / output port connected to the grounding button in the grounding button unit is grounded; When the first end of the pull-up button in the pull-up button unit is connected to the second end of the pull-up button in the pull-up button unit, the input / output port connected to the pull-up button in the pull-up button unit is connected to the pull-up power supply.

9. The matrix keypad circuit according to any one of claims 1 to 8, characterized in that, The matrix keypad circuit also includes: There are N port resistors, with the first end of one port resistor connected to one input / output port, and the second end of one port resistor connected to the first end of a ground button, the first ends of N-1 scan buttons, and the cathode of a first diode. The N-1 scan buttons and the first diode belong to different scan button units. There are N port capacitors, with the first end of each port capacitor connected to the second end of a port resistor, and the second end of each port capacitor connected to ground.

10. An electricity meter, characterized in that, The meter includes the matrix keypad circuit according to any one of claims 1 to 9.