The basic working principle of the keyboard is to monitor the keys in real time and send the key information to the computer. The internal design of the keyboard includes a key scanning circuit that locates the key position, an encoding circuit that generates the key code that is pressed, and an interface circuit that sends the generated code to the computer, etc. These circuits are collectively referred to as keyboard control circuits. According to the working principle of the keyboard, computer keyboards can be divided into encoding keyboards and non-encoding keyboards. The function of the keyboard control circuit is completely completed automatically by hardware. This type of keyboard is called an encoding keyboard, which can automatically send the encoding information of the pressed key to the computer. Another type of keyboard, whose keyboard control circuit function depends on both hardware and software, is called a non-encoding keyboard. The response speed of this keyboard is not as fast as that of the encoding keyboard, but it can redefine some of the keyboard keys through software, which provides great convenience for expanding the functions of the keyboard, and thus has been widely used.
Line-by-line scanning method
The program scans the keyboard line by line and determines the closed key by the detected column output state.
One input port and one output port need to be set.
Row-column scanning method
Closed keys are identified by scanning rows and columns in reverse order. When scanning each row, read the column line; then scan the output to the column line in turn and read the row line.
Two programmable bidirectional input/output ports are required.
Assume that there is a 3×4 matrix keyboard connected to a microcomputer via a parallel interface chip 8255A. Port A of 8255A is defined as an output port, connected to the row line of the keyboard; port B is defined as an input port, connected to the column line of the keyboard. Assume that the address of port A of 8255A is 40H, the address of port B is 41H, and the address of the control register is 43H.
MOV AL, 82H
OUT 43H, AL
BEGIN: MOV AL, 0
OUT 40H, AL
WAIT : IN AL, 41H
AND AL, 0FH
CMP AL, 0FH
JZ WAIT
MOV CX, 7FFH
L0: LOOP L0
ST: MOV BL, 3
MOV BH , 4
MOV AL, 0FEH
MOV CL, 0FH
MOV CH, 0FFH
L1: OUT 40H, AL
ROL AL
MOV AH, AL
IN AL, 41H
AND AL, CL
CMP AL, CL
JNZ L2
ADD CH, BH
MOV AL, AH
DEC BL
JNZ L1
JMP BEGIN
L2: INC CH
RCR AL
JC L2
MOV AL, CH
JMP KEYTABLE
Figure 12-1 Non-encoded keyboard interface hardware block diagram
Previous article:3×4 matrix keyboard circuit diagram and assembly language source program
Next article:How an optical mouse works
- Popular Resources
- Popular amplifiers
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- Broadband millimeter-wave digital-analog hybrid beamforming
- There are many types of field effect tubes, and their output characteristics and transfer characteristics are different.
- test
- [GD32L233C-START Review] 2. Transplantation of rtthread + finsh components
- FPGA basics and how it works
- This old Skyworth LCD TV again
- The difference and usage of passive crystal and active crystal oscillator
- [AT-START-F425 Review] CAN Communication of Stacking Blocks
- Transformer driven half bridge
- It’s Chinese New Year! I wish you all a happy new year and all the best!