A digital electronic scale matrix keyboard simulator and method

By designing a digital electronic scale matrix keyboard simulator, the MCU and analog switch chip simulate the key learning and input process of the electronic scale matrix keyboard, automatic key input is realized, solving the problem of inefficient detection of electronic scale cheats and improving detection efficiency.

CN111426370BActive Publication Date: 2025-08-15XIAN INST OF METROLOGY & TECH +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010382521.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-08
Publication Date
2025-08-15
Estimated Expiration
2040-05-08

AI Technical Summary

Technical Problem

In the prior art, electronic scales are easily converted into cheat scales. Detection of cheating requires artificial input of a large number of cheat code sequences, which is inefficient.

Method used

Design a digital electronic scale matrix keyboard simulator to simulate the key learning and input process of the electronic scale matrix keyboard through the MCU and analog switch chip, and use a PC to automatically input the key.

Benefits of technology

It improves the efficiency of typing cheat code sequences and improves the efficiency of cheat detection of electronic scales.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111426370B_ABST
    Figure CN111426370B_ABST
Patent Text Reader

Abstract

The present invention discloses a digital electronic scale matrix keyboard simulator, comprising an analog module connected to an electronic scale matrix keyboard, the analog module being connected to a personal computer (PC). The analog module comprises an microcontroller (MCU), the MCU being connected to four analog switch chips and an external clock. The MCU is connected to the PC, and the electronic scale matrix keyboard is connected to the MCU. The digital electronic scale matrix keyboard simulator is used to simulate the electronic scale matrix keyboard, including two processes: key learning and key input. The digital electronic scale matrix keyboard simulator of the present invention can effectively improve the efficiency of entering cheat code sequences. A digital electronic scale matrix keyboard simulation method is also provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology, and in particular relates to a digital electronic scale matrix keyboard simulator and a digital electronic scale matrix keyboard simulation method. Background Art

[0002] Currently, electronic scales are easily converted into cheating scales due to their low cost and simple structure. These scales are frequently used in markets. To detect cheating, relevant measurement units must constantly input possible cheating code sequences, which is time-consuming and laborious. Therefore, the present invention designs a device that can simulate input using a computer, effectively improving the efficiency of entering cheating code sequences. Summary of the Invention

[0003] The purpose of the present invention is to provide a digital electronic scale matrix keyboard simulator, which can effectively improve the typing efficiency of cheat code sequences.

[0004] Another object of the present invention is to provide a digital electronic scale matrix keyboard simulation method.

[0005] The technical solution adopted by the present invention is a digital electronic scale matrix keyboard simulator, comprising a simulation module connected to the electronic scale matrix keyboard, the simulation module being connected to a PC;

[0006] The analog module includes an MCU, which is connected to four analog switch chips and an external clock. The MCU is connected to a PC, and the electronic scale matrix keyboard is connected to the MCU.

[0007] The digital electronic scale matrix keyboard simulator is used to simulate the electronic scale matrix keyboard, including two processes: key learning and key input:

[0008] When learning a keystroke:

[0009] Determine when each key on the electronic scale matrix keyboard is pressed, and the MCU scans the electronic scale matrix keyboard in rows and columns. The MCU scans the electronic scale matrix keyboard timing, and sends the corresponding key command to the PC through the serial port. The key is named on the PC to form a level value-key value-key name table;

[0010] When key input is performed:

[0011] The MCU controls four analog switch chips to simulate the corresponding timing, and sends the timing signal to the electronic scale SOC through the cable to complete the analog input.

[0012] The present invention is also characterized in that

[0013] The MCU model is STC15WK16S.

[0014] The model of the four analog switch chips is CD4051B.

[0015] Another technical solution adopted by the present invention is a digital electronic scale matrix keyboard simulation method, which adopts the above-mentioned simulator and specifically includes the following steps:

[0016] Step 1: Key learning

[0017] Determine when each key on the electronic scale matrix keyboard is pressed, and the MCU scans the electronic scale matrix keyboard in rows and columns. The MCU scans the electronic scale matrix keyboard timing, and sends the corresponding key command to the PC through the serial port. The key is named on the PC to form a level value-key value-key name table;

[0018] Step 2: Key input

[0019] The corresponding function is called on the PC, and the key value information is transmitted to the MCU through the serial port. The MCU controls the four analog switch chips to simulate the corresponding timing, and sends the timing signal to the electronic scale SOC through the cable, thereby completing the analog input.

[0020] The present invention is also characterized in that

[0021] Step 1 is implemented as follows:

[0022] Specifically: There are 10 cables for the 24-key electronic scale matrix keyboard, and the 10 cables are named separately. The 10 cables include 4 row lines and 6 column lines. Each row line is used to connect one port of the 6 keys in each row in series, and each column line is used to connect another port of the 4 keys in each column in series. From top to bottom, the four row lines are named L1, L2, L3, and L4; from left to right, the six column lines are named L5, L6, L7, L8, L9, and L10; L1 to L4 are set to the high four bits, and L5 to L10 are set to the low six bits. To confirm that a key is pressed, the MCU is used to scan the rows and columns of the matrix keyboard through the 10 cables; Figure 3 As shown, the MCU first sets the four lines L1 to L4 to input mode, and sets the six lines L5 to L10 to output low level. At this time, the levels of the four lines L1 to L4 are read and saved in a variable tmp. The upper four bits and the lower six bits are reversed. The upper four bits are output mode and output low level. The lower six bits are input mode. The high and low level values of the six lower six bits are read and appended to tmp. At this time, tmp is a 10-bit binary value. If this value is 1111111111, it means that no key is pressed. If a 0 appears in both the upper four bits and the lower six bits, it means that a key is pressed.

[0023] The corresponding key values of the corresponding positions on the matrix keyboard are as follows:

[0024] The key values of the 6 keys from left to right in the first row of the matrix keyboard are "01110000", "01110001", "01110010", "01110011", "01110100", and "01110101" respectively;

[0025] The key values of the 6 keys from left to right in the second row of the matrix keyboard are "01101000", "01101001", "01101010", "01101011", "01101100", and "01101101" respectively;

[0026] The key values of the six keys from left to right in the third row of the matrix keyboard are "01011000", "01011001", "01011010", "01011011", "01011100", and "01011101" respectively;

[0027] The corresponding key values of the six keys from left to right in the fourth row of the matrix keyboard are "00111000", "00111001", "00111010", "00111011", "00111100", and "00111101" respectively.

[0028] When a key on the matrix keyboard is pressed, the MCU confirms that a key has been pressed, and the high and low levels of the ten cables L1 to L10 are as follows:

[0029] The levels corresponding to the key values of the 6 keys from left to right in the first row of the matrix keyboard are "0111011111", "0111101111", "0111110111", "0111111011", "0111111101", and "01111111101".

[0030] The levels corresponding to the key values of the 6 keys from left to right in the second row of the matrix keyboard are "1011011111", "1011101111", "1011110111", "1011111011", "1011111101", and "10111111101".

[0031] The levels corresponding to the key values of the 6 keys from left to right in the third row of the matrix keyboard are "1101011111", "1101101111", "1101110111", "1101111011", "1101111101", and "11011111110".

[0032] The levels corresponding to the key values of the six keys from left to right in the fourth row of the matrix keyboard are "1110011111", "1110101111", "1110110111", "1110111011", "1110111101", and "1110111110".

[0033] Step 2 is implemented as follows:

[0034] With the correspondence table of level value-key value-key name, when the computer is ready to simulate typing a key, the keyPress() function will be called. The parameter of the keyPress() function is the key name. The keyPress() function will find the corresponding key value through the key name and send it to the MCU in the simulation module through the serial port. After receiving the key value, the MCU will parse the key value. The principle is to convert the hexadecimal key value into an eight-bit binary value, and the first bit of the eight-bit binary key value is not used. The second bit is used to control the enable of the fourth analog switch chip; the third bit is used to control the enable of the third analog switch chip; the fourth bit is used to control the enable of the second analog switch chip; the fifth bit is used to control the enable of the first analog switch chip. The enable signal is low level. The sixth, seventh, and eighth bits are used to control the eight-selection switch on the enabled analog switch chip, thereby simulating the level signal when the matrix keyboard signal is output, thereby achieving the purpose of simulating human input keystrokes.

[0035] When parsing the key value, the hexadecimal key value is converted to eight binary bits. The sixth, seventh, and eighth bits are used to control the eight-choice switch on the enabled analog switch chip. The specific rules are as follows:

[0036] The MCU's P0.2, P0.1, and P0.0 pins are used to control which output port is selected on a chip select analog switch chip.

[0037] When the C, B, and A pins of the analog switch chip receive 0, 0, and 0 respectively, the X0 port outputs;

[0038] When the C, B, and A pins of the analog switch chip receive 0, 0, and 1 respectively, the X1 port outputs;

[0039] When the C, B, and A pins of the analog switch chip receive 0, 1, and 0 respectively, the X2 port outputs;

[0040] When the C, B, and A pins of the analog switch chip receive 0, 1, and 1 respectively, the X3 port outputs;

[0041] When the C, B, and A pins of the analog switch chip receive 1, 0, and 0 respectively, the X4 port outputs;

[0042] When the C, B, and A pins of the analog switch chip receive 1, 0, and 1 respectively, the X5 port outputs;

[0043] The X6 and X7 pins of the four analog switch chips are left floating, the VDD, VEE, and VSS pins are connected to the corresponding power supply, and the INH pin is the chip select enable. When this interface is at a low level, it indicates that the analog switch chip is enabled.

[0044] The present invention has the beneficial effect of continuously inputting a key sequence suspected to be a cheat code into the electronic scale during cheat detection to determine whether the actual number on the electronic scale screen changes. If so, the electronic scale has a cheating function. Entering these cheat codes manually is time-consuming and laborious, resulting in extremely low detection efficiency. However, the electronic scale matrix keyboard simulator of the present invention, combined with the electronic scale matrix keyboard simulation method, uses a computer instead of manual input, significantly increasing input speed and improving detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a schematic diagram of the keyboard layout of the electronic scale matrix keyboard in the present invention;

[0046] Figure 1 The six buttons in the first row from left to right are named "7", "8", "9", "Clear", "Unit Price 1", and "Unit Price 5" respectively;

[0047] The six buttons in the second row from left to right are named "4", "5", "6", "Accumulation", "Unit Price 2", and "Unit Price 6" respectively;

[0048] The six buttons in the third row from left to right are named "1", "2", "3", "Tare", "Unit Price 3", and "Unit Price 7" respectively;

[0049] The 6 buttons from left to right in the fourth row are named "0", ".", "Save", "Reset to Zero", "Unit Price 4", and "Light" respectively;

[0050] Figure 2 This is a schematic diagram of the relationship between the keys and cables of the electronic scale matrix keyboard in the present invention;

[0051] Figure 3 is a flow chart of the key learning process in the method of the present invention;

[0052] Figure 4 It is a flow chart of the key input process in the method of the present invention;

[0053] Figure 5 This is the pin diagram of the MCU model STC15W1K16S in the simulator of the present invention;

[0054] Figure 6 This is the pin diagram of the first analog switch chip model CD4051BE in the simulator of the present invention;

[0055] Figure 7 This is the pin diagram of the second analog switch chip model CD4051BE in the simulator of the present invention;

[0056] Figure 8 This is the pin diagram of the third analog switch chip model CD4051BE in the simulator of the present invention;

[0057] Figure 9 This is the pin diagram of the fourth analog switch chip model CD4051BE in the simulator of the present invention. DETAILED DESCRIPTION

[0058] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0059] The present invention provides a digital electronic scale matrix keyboard simulator, comprising a simulation module connected to the electronic scale matrix keyboard, wherein the simulation module is connected to a PC;

[0060] The analog module includes an MCU, which is connected to four analog switch chips and an external clock. The MCU is connected to a PC, and the electronic scale matrix keyboard is connected to the MCU.

[0061] The digital electronic scale matrix keyboard simulator is used to simulate the electronic scale matrix keyboard, including two processes: key learning and key input:

[0062] When learning a keystroke:

[0063] Determine when each key on the electronic scale matrix keyboard is pressed, and the MCU scans the electronic scale matrix keyboard in rows and columns. The MCU scans the electronic scale matrix keyboard timing, and sends the corresponding key command to the PC through the serial port. The key is named on the PC to form a level value-key value-key name table;

[0064] When key input is performed:

[0065] The MCU controls four analog switch chips to simulate the corresponding timing, and sends the timing signal to the electronic scale SOC through the cable to complete the analog input.

[0066] The MCU model is STC15WK16S, and the pin diagram is as follows: Figure 5 shown.

[0067] The four analog switch chips are all CD4051B.

[0068] The four pins P0.3, P0.4, P0.5, and P0.6 of the MCU are respectively connected to the INH pins of four analog switch chips, all of which are CD4051BE. The CD4051BE connected to the P0.3 pin of the MCU is named the first analog switch, the CD4051BE connected to the P0.4 pin of the MCU is named the second analog switch, the CD4051BE connected to the P0.5 pin of the MCU is named the third analog switch, and the CD4051BE connected to the P0.6 pin of the MCU is named the fourth analog switch. The P0.2 pin of the MCU is simultaneously connected to the C pin of the four analog switch chips, the P0.1 pin is simultaneously connected to the B pin of the four analog switch chips, and the P0.0 pin is simultaneously connected to the A pin of the four analog switch chips.

[0069] like Figure 2 As shown, there are 10 24-key electronic scale matrix keyboard cables. The 10 cables are named separately. The 10 cables include 4 row cables and 6 column cables. Each row cable is used to connect one port of the 6 keys in each row in series, and each column cable is used to connect another port of the 4 keys in each column in series. Figure 2 As shown in the figure, from top to bottom, the four row lines are named L1, L2, L3, and L4; from left to right, the six column lines are named L5, L6, L7, L8, L9, and L10. The ten cables, L1 to L10, connect to the MCU pins through the digital circuit. The wiring rules are as follows: L1 connects to P2.0, L2 connects to P2.1, L3 connects to P2.2, L4 connects to P2.3, L5 connects to P2.4, L6 connects to P2.5, L7 connects to P2.6, L8 connects to P1.1, L9 connects to P1.2, and L10 connects to P1.3. The MCU's P0.2, P0.1, and P0.0 pins control which output port is selected on a chip select analog switch chip.

[0070] like Figure 6-9 As shown, the X0 pins on the four analog switch chips are connected to the L1 of the matrix keyboard at the same time;

[0071] The X0 pins on the four analog switch chips are connected to the LINE0 cable at the same time;

[0072] The X1 pins on the four analog switch chips are connected to the LINE1 cable at the same time;

[0073] The X2 pins on the four analog switch chips are connected to the LINE2 cable at the same time;

[0074] The X3 pins on the four analog switch chips are connected to the LINE3 cable at the same time;

[0075] The X4 pins on the four analog switch chips are connected to the LINE4 cable at the same time;

[0076] The X5 pins on the four analog switch chips are connected to the LINE5 cable at the same time;

[0077] The COM pin on the first analog switch chip is connected to the cable ROW6;

[0078] The COM pin on the second analog switch chip is connected to the cable ROW7;

[0079] The COM pin on the third analog switch chip is connected to the cable ROW8;

[0080] The COM pin on the fourth analog switch chip is connected to the cable ROW9;

[0081] The ten cables LINE0, LINE1, LINE2, LINE3, LINE4, LINE5, ROW6, ROW7, ROW / 8 to ROW9 are used as analog output ports and are connected to the SOC of the electronic scale.

[0082] Connect an 11.0592MHz external clock module input between the P1.6 and P1.7 pins of the STC15WK16S MCU. The P3.0 and P3.1 pins are used as serial communication interfaces to communicate with an external PC. Connect a 5V VCC power supply to L1 to L4 of the matrix keyboard to power the matrix keyboard.

[0083] The present invention also provides a digital electronic scale matrix keyboard simulation method, such as Figure 1-9 As shown, the above simulator is used, specifically including the following steps:

[0084] Step 1: Key learning

[0085] like Figure 1-3 As shown, it is determined that each key of the electronic scale matrix keyboard is pressed, and the MCU scans the electronic scale matrix keyboard in rows and columns. The MCU scans the electronic scale matrix keyboard timing and sends the corresponding key command to the PC through the serial port. The key is named on the PC to form a level value-key value-key name table;

[0086] Step 1 is implemented as follows:

[0087] Specifically: There are 10 24-key electronic scale matrix keyboard cables, and the 10 cables are named separately. The 10 cables include 4 row cables and 6 column cables. Each row cable is used to connect one port of the 6 keys in each row in series, and each column cable is used to connect another port of the 4 keys in each column in series. Figure 2 As shown, from top to bottom, the four row lines are named L1, L2, L3, and L4; from left to right, the six column lines are named L5, L6, L7, L8, L9, and L10; L1 to L4 are set to the high four bits, and L5 to L10 are set to the low six bits. To confirm that a key is pressed, the MCU is used to scan the rows and columns of the matrix keyboard through 10 cables; as shown Figure 3 As shown, the MCU first sets the four lines L1 to L4 to input mode, and sets the six lines L5 to L10 to output low level. At this time, the levels of the four lines L1 to L4 are read and saved in a variable tmp. The upper four bits and the lower six bits are reversed. The upper four bits are output mode and output low level. The lower six bits are input mode. The high and low level values of the six lower six bits are read and appended to tmp. At this time, tmp is a 10-bit binary value. If this value is 1111111111, it means that no key is pressed. If a 0 appears in both the upper four bits and the lower six bits, it means that a key is pressed.

[0088] The corresponding key values of the corresponding positions on the matrix keyboard are as follows:

[0089] The key values of the 6 keys from left to right in the first row of the matrix keyboard are "01110000", "01110001", "01110010", "01110011", "01110100", and "01110101" respectively;

[0090] The key values of the 6 keys from left to right in the second row of the matrix keyboard are "01101000", "01101001", "01101010", "01101011", "01101100", and "01101101" respectively;

[0091] The key values of the six keys from left to right in the third row of the matrix keyboard are "01011000", "01011001", "01011010", "01011011", "01011100", and "01011101" respectively;

[0092] The corresponding key values of the six keys from left to right in the fourth row of the matrix keyboard are "00111000", "00111001", "00111010", "00111011", "00111100", and "00111101" respectively.

[0093] When a key on the matrix keyboard is pressed, the MCU confirms that a key has been pressed, and the high and low levels of the ten cables L1 to L10 are as follows:

[0094] The levels corresponding to the key values of the 6 keys from left to right in the first row of the matrix keyboard are "0111011111", "0111101111", "0111110111", "0111111011", "0111111101", and "01111111101".

[0095] The levels corresponding to the key values of the 6 keys from left to right in the second row of the matrix keyboard are "1011011111", "1011101111", "1011110111", "1011111011", "1011111101", and "10111111101".

[0096] The levels corresponding to the key values of the 6 keys from left to right in the third row of the matrix keyboard are "1101011111", "1101101111", "1101110111", "1101111011", "1101111101", and "11011111110".

[0097] The levels corresponding to the key values of the six keys from left to right in the fourth row of the matrix keyboard are "1110011111", "1110101111", "1110110111", "1110111011", "1110111101", and "1110111110".

[0098] Step 2: Key input

[0099] like Figure 4 As shown, the corresponding function is called on the PC, and the key value information is transmitted to the MCU through the serial port. The MCU controls the four analog switch chips to simulate the corresponding timing, and sends the timing signal to the electronic scale SOC through the cable, thus completing the analog input;

[0100] Step 2 is implemented as follows:

[0101] With the correspondence table of level value-key value-key name, when the computer is ready to simulate typing a key, the keyPress() function will be called. The parameter of the keyPress() function is the key name. The keyPress() function will find the corresponding key value through the key name and send it to the MCU in the simulation module through the serial port. After receiving the key value, the MCU will parse the key value. The principle is to convert the hexadecimal key value into an eight-bit binary value, and the first bit of the eight-bit binary key value is not used. The second bit is used to control the enable of the fourth analog switch chip; the third bit is used to control the enable of the third analog switch chip; the fourth bit is used to control the enable of the second analog switch chip; the fifth bit is used to control the enable of the first analog switch chip. The enable signal is low level. The sixth, seventh, and eighth bits are used to control the eight-selection switch on the enabled analog switch chip, thereby simulating the level signal when the matrix keyboard signal is output, thereby achieving the purpose of simulating human input keystrokes.

[0102] When parsing the key value, the hexadecimal key value is converted to eight binary bits. The sixth, seventh, and eighth bits are used to control the eight-select switch on the enabled analog switch chip. The specific rules are as follows:

[0103] The MCU's P0.2, P0.1, and P0.0 pins are used to control which output port is selected on a chip select analog switch chip.

[0104] When the C, B, and A pins of the analog switch chip (model: CD4051BE) receive 0, 0, and 0 respectively, the X0 port outputs;

[0105] When the C, B, and A pins of the analog switch chip (model: CD4051BE) receive 0, 0, and 1 respectively, the X1 port outputs;

[0106] When the C, B, and A pins of the analog switch chip (model: CD4051BE) receive 0, 1, and 0 respectively, the X2 port outputs;

[0107] When the C, B, and A pins of the analog switch chip (model: CD4051BE) receive 0, 1, and 1 respectively, the X3 port outputs;

[0108] When the C, B, and A pins of the analog switch chip (model: CD4051BE) receive 1, 0, and 0 respectively, the X4 port outputs;

[0109] When the C, B, and A pins of the analog switch chip (model: CD4051BE) receive 1, 0, and 1 respectively, the X5 port outputs;

[0110] The X6 and X7 pins of the four analog switch chips (model: CD4051BE) are left floating, the VDD, VEE, and VSS pins are connected to the corresponding power supply, and the INH pin is the chip select enable. When this interface is at a low level, it indicates that the analog switch chip is enabled.

Claims

1. A digital electronic scale matrix keyboard simulator, characterized in that: It includes a simulation module connected to the electronic scale matrix keyboard, and the simulation module is connected to a PC; The analog module includes an MCU, which is connected to four analog switch chips and an external clock. The MCU is connected to a PC, and the electronic scale matrix keyboard is connected to the MCU. The digital electronic scale matrix keyboard simulator is used to simulate the electronic scale matrix keyboard, including two processes: key learning and key input: When learning a keystroke: Determine when each key on the electronic scale matrix keyboard is pressed, and the MCU scans the electronic scale matrix keyboard in rows and columns. The MCU scans the electronic scale matrix keyboard timing, and sends the corresponding key command to the PC through the serial port. The key is named on the PC to form a level value-key value-key name table; When key input is performed: The MCU controls four analog switch chips to simulate the corresponding timing, and sends the timing signal to the electronic scale SOC through the cable to complete the analog input; The model of the MCU is STC15WK16S; The model of the four analog switch chips is CD4051B.

2. A digital electronic scale matrix keyboard simulation method, using the simulator according to claim 1, characterized in that: The specific steps include: Step 1: Key learning Determine when each key on the electronic scale matrix keyboard is pressed, and the MCU scans the electronic scale matrix keyboard in rows and columns. The MCU scans the electronic scale matrix keyboard timing, and sends the corresponding key command to the PC through the serial port. The key is named on the PC to form a level value-key value-key name table; Step 1 is implemented as follows: Specifically: There are 10 cables for the 24-key electronic scale matrix keyboard. Each of the 10 cables is named separately. The 10 cables include 4 row lines and 6 column lines. Each row line is used to connect one port of the 6 keys in each row in series, and each column line is used to connect another port of the 4 keys in each column in series. From top to bottom, the four row lines are named L1, L2, L3, and L4; from left to right, the six column lines are named L5, L6, L7, L8, L9, and L10; L1~L4 are set to the high four bits, and L5~L10 are set to the low six bits. To confirm that a key is pressed, the MCU is used to scan the rows and columns of the matrix keyboard through the 10 cables. The MCU first sets the four lines L1 to L4 to input mode, and sets the six lines L5 to L10 to output low. At this time, the levels of the four lines L1 to L4 are read and saved in a variable tmp. The upper four bits and the lower six bits are inverted. The upper four bits are in output mode and output low level, and the lower six bits are in input mode. The high and low level values of the six lower six bits are read and appended to tmp. At this time, tmp is a 10-bit binary value. If this value is 1111111111, it means that no key is pressed. If a 0 appears in both the upper four bits and the lower six bits, it means that a key is pressed. The corresponding key values of the corresponding positions on the matrix keyboard are as follows: The key values of the six keys from left to right in the first row of the matrix keyboard are "01110000", "01110001", "01110010", "01110011", "01110100", and "01110101" respectively; The key values of the six keys from left to right in the second row of the matrix keyboard are "01101000", "01101001", "01101010", "01101011", "01101100", "01101101"; The key values of the six keys from left to right in the third row of the matrix keyboard are "01011000", "01011001", "01011010", "01011011", "01011100", "01011101"; The key values of the six keys on the fourth row from left to right on the matrix keyboard are "00111000", "00111001", "00111010", "00111011", "00111100", and "00111101" respectively. When a key on the matrix keyboard is pressed and the MCU confirms that a key has been pressed, the high and low levels of the ten cables L1 to L10 are as follows: The levels corresponding to the key values of the 6 keys from left to right in the first row of the matrix keyboard are "0111011111", "0111101111", "0111110111", "0111111011", "0111111101", and "01111111101"; The levels corresponding to the key values of the 6 keys from left to right in the second row of the matrix keyboard are "1011011111", "1011101111", "1011110111", "1011111011", "1011111101", and "101111111101"; The levels corresponding to the key values of the six keys from left to right in the third row of the matrix keyboard are "1101011111", "1101101111", "1101110111", "1101111011", "1101111101", and "11011111110". The levels corresponding to the key values of the six keys from left to right in the fourth row of the matrix keyboard are "1110011111", "1110101111", "1110110111", "1110111011", "1110111101", and "11101111101"; Step 2: Key input The corresponding function is called on the PC, and the key value information is transmitted to the MCU through the serial port. The MCU controls the four analog switch chips to simulate the corresponding timing, and sends the timing signal to the electronic scale SOC through the cable, thus completing the analog input; Step 2 is implemented as follows: With the corresponding table of level value-key value-key name, when the computer is ready to simulate typing a key, it will call the keyPress() function. The keyPress() function parameter is the key name. The keyPress() function will find the corresponding key value through the key name and send it to the MCU in the simulation module through the serial port. After receiving the key value, the MCU will parse the key value by converting the hexadecimal key value into an eight-bit binary value. The first bit of the eight-bit binary key value is not used, and the second bit is used to control the fourth analog switch chip to enable; The third bit is used to control the enable of the third analog switch chip; the fourth bit is used to control the enable of the second analog switch chip; the fifth bit is used to control the enable of the first analog switch chip, and the enable signal is a low level. The sixth, seventh, and eighth bits are used to control the eight-select-one switch on the enabled analog switch chip, thereby simulating the level signal when the matrix keyboard signal is output, achieving the purpose of simulating human input keystrokes; When parsing the key value, the hexadecimal key value is converted to eight binary bits. The sixth, seventh, and eighth bits are used to control the eight-choice switch on the enabled analog switch chip. The specific rules are as follows: The MCU's P0.2, P0.1, and P0.0 pins are used to control which output port is selected on a chip select analog switch chip. When the C, B, and A pins of the analog switch chip receive 0, 0, and 0 respectively, the X0 port outputs; When the C, B, and A pins of the analog switch chip receive 0, 0, and 1 respectively, the X1 port outputs; When the C, B, and A pins of the analog switch chip receive 0, 1, and 0 respectively, the X2 port outputs; When the C, B, and A pins of the analog switch chip receive 0, 1, and 1 respectively, the X3 port outputs; When the C, B, and A pins of the analog switch chip receive 1, 0, and 0 respectively, the X4 port outputs; When the C, B, and A pins of the analog switch chip receive 1, 0, and 1 respectively, the X5 port outputs; The X6 and X7 pins of the four analog switch chips are left floating, the VDD, VEE, and VSS pins are connected to the corresponding power supply, and the INH pin is the chip select enable. When this interface is at a low level, it indicates that the analog switch chip is enabled.

Citation Information

Patent Citations

  • Novel three-terminal tact switch

    CN104898853A

  • Electronic scale cheating detecting system

    CN207816449U

  • Digital electronic scale matrix keyboard simulator

    CN212206335U