IBM PC hardware. Types of keyboards, design and principle of operation

LAB 4

INFORMATION INPUT DEVICES into a PC – keyboard and mouse

Goal of the work

The purpose of the work is to study the principles of operation of the PC keyboard, as well as to control the parameters of the keyboard and mouse using Windows.

Basic information

A keyboard is a device designed to enter information from the user into a computer.
A typical standard keyboard for a personal computer has more than 100 keys, including alphanumeric, function, accounting and other keys.
Using the alphanumeric keys, the user can enter numbers, letters, and punctuation marks. In Russia, Russian and English layouts are most often used. However, in the computer system settings, the user can select any keyboard layout - from Chinese to Arabic. If all the necessary symbols of the layout you have chosen are not drawn on the keyboard keys, the situation can be corrected by purchasing special key stickers.
The top row of the keyboard consists of function keys - from F1 to F12. Using function keys or their combinations with other keys, you can control the computer, for example, open a help window, an explorer window, and turn the computer on and off.
On the right side of the keyboard there are so-called accounting keys - with images of numbers and mathematical symbols, the use of which speeds up typing and working with numerical information. The accounting keys also perform the function of cursor control.

Basic parameters of modern keyboards

Key mechanism. First of all, it determines the cost of the keyboard, as well as tactility (tactile sensation).

For mechanical keyboards, you can select with or without a click. A click means a clear tactile feel of a key being pressed (accompanied by a sound), which many people like.

Tactile parameters.

Tactile parameters include key hardness and stroke length.

The hardness of the keys is determined by the force of pressing the key.



The average key stroke length is 3.5 mm. For those who type text fluently, a shorter stroke is preferable.

Both parameters are determined by the user’s taste and are meaningfully selected only after accumulation personal experience. For the first time, just go over the keyboard in the store.

Another tactile parameter is click. Keyboards come with or without a click. Literally translated, click is a click. The exact translation is a tactile (i.e. tactile) barrier that appears in the middle of pressing and is overcome with a click (hence the name). It is implemented by an arched thin plate under the key, which bends “with a jerk.”

Clicking allows you to accurately feel that a key is pressed and not miss letters when typing quickly. Many users like the click.

Typically, a click occurs on mechanical keyboards, since it changes their cost little, but sometimes it occurs on other types of keyboards.

Form factor defining keys (both Shift, Backspace and Enter). When these keys have a convenient shape and location, the work is easier.

The Enter key can have the following shapes: straight, L-shaped and L-shaped (you need to make a mirror image of the letters L and G relative to the vertical to get the true shape of the key. Enter). The L-shape is the most convenient because you can hit the large Enter without looking at it.

Cyrillic layout. There are two Cyrillic alphabet layouts, one of which is more convenient.

The layout (i.e., the arrangement of letters on the keys) of the Cyrillic alphabet is of two types: Windows (recognized by the location of the letter E in the upper left corner) and typewritten (recognized by the location of the letter E in the lower right corner).

The typewritten layout, as its name suggests, replicates the keys of a typewriter. The Windows layout appeared in the Windows OS. Compared to typescript, small but very effective improvements were made. For example, the very rarely used letter E was moved to a far corner, and in its place was placed a key with the often used period and comma. In the typewritten layout, they are placed on the top row and are entered using upper case. The strange thing is that a more advanced layout was developed by a foreign company.

Some manufacturers apply only the Russian layout, some apply both, giving the user a choice.

The Cyrillic alphabet has two colors (the letters are in the lower right corner of the keys): red (for most manufacturers) and dark. In the second case, the Cyrillic alphabet is confused with the Latin alphabet even when the latter is applied with a light double outline.

Keyboard ergonomics. So-called ergonomic keyboards tire the user significantly less, although they take up more space and are more expensive.

Availability of a palm rest. Stands reduce fatigue and improve appearance.

Groups of additional keys. These can be Internet, multimedia and other groups of keys. Speed ​​up your work, allowing you to switch back and forth to the mouse less often. The location of the sleep keys should be such that they are not accidentally caught.

Interface. Associated with the development of motherboards. When talking about the interface, we mean wired keyboards. The following interfaces are used:

PS/2.. It is a thin round connector - 6-pin miniDIN. The same one is used for the PS/2 mouse, and in order not to confuse them, the PC"99 specification provides for different colors for these plugs: purple for the keyboard and green for the mouse.

USB. Can be used with all more or less new motherboards, since the latter have USB ports and BIOS support. Connector - flat, rectangular

forms. The USB interface is more modern and provides more features and has greater bandwidth than older types of ports.

How the keyboard works

The operating principle of the keyboard is illustrated in Fig. 1. Regardless of how the keypress process is mechanically implemented, the signal when a key is pressed is registered by the keyboard controller (for example, 8049) and transmitted in the form of the so-called scan code to the motherboard. A scan code is a one-byte number, the lower 7 bits of which represent the identification number assigned to each key. On the PC motherboard, a special controller is also used to connect the keyboard. For AT type PCs, a universal peripheral interface chip is usually used (Universal Peripheral Interface, UPI) 8049.

When a scan code enters the chip (8049), a hardware interrupt (IRQ 1) is initiated, the processor stops its operation and executes a procedure that analyzes the scan code. This interrupt is serviced by a special program included in the ROM BIOS. When a scan code is received from the keys , or , the status change is written to RAM. In all other cases, the scan code is transformed into a character code (so-called ASCII codes or extended codes). In this case, the processing procedure first determines the setting of the keys and switches in order to correctly obtain the entered code ("a" or "A"). The entered code is then placed into the keyboard buffer, which is an area of ​​memory that can store up to 15 characters entered until the application program can process them. The buffer is organized according to the principle FIFO(first in - first out).

Ports and interrupts are used to operate the keyboard. In response to the interrupt, the BIOS system routine in ROM reads the key scan code from the keyboard port (port number 96) and then sends a command to clear the keyboard processor buffer to the keyboard port. If system unit does not respond to keyboard interrupts, then scan codes accumulate in the keyboard processor buffer, although when normal operation this shouldn't happen. The special scan code 255, hexadecimal value FF, is used by the keyboard block to indicate that its buffer is full.

Note

Each key generates two types of scan codes: press code, when the key is pressed, and release code, when the key is released. For Class AT PCs, the same bitstring is used for press codes and release codes, but release codes consist of two bytes, the first of which is always 0F0H. For PC XT generation, the release code is 128 times greater than the press code (the seventh bit of 7 is 1). For example, a 7-bit key scan code<В>equals 48 or 110000 in binary number system. When a key is pressed, the keyboard controller receives code 10110000, and when released, code 00110000 is sent to the keyboard controller.

The 8049 controller is not only responsible for generating scan codes, but is also necessary for performing self-monitoring functions and checking the keys pressed during the system boot process. The self-test process is indicated by the three keypad LEDs flashing once during the POST program. Thus, a keyboard malfunction is detected already at the PC boot stage.

The controller on the motherboard can not only receive, but also transmit data to inform the keyboard of various parameters, for example, the repetition rate of the key pressed, etc.

In table Figures 1-2 show examples of scan codes that correspond to the currently most common keyboard with 102 keys.

Hexadecimal scan codes of function keys

Table 1

Hexadecimal scan codes for data entry keys

table 2


Thus, the process of processing keyboard input (Fig. 2) is provided by two microcontrollers: one is located on the computer motherboard, the second is built into the keyboard itself.

As can be seen in the diagram, all horizontal lines of the key matrix are connected through resistors to the power source. The built-in keyboard chip has two ports - output and input. The first is connected to the vertical (Y0–Y5) lines of the matrix, and the second is connected to the horizontal (X0–X4).

The keyboard controller works according to the following algorithm. By setting the voltage level corresponding to logical zero on each of the vertical lines in turn, the keyboard microcomputer continuously evaluates the state of the horizontal lines - regardless of activity on the central processor.

If no key is pressed, the voltage level on all horizontal lines corresponds to a logical one. As soon as the key is pressed, the vertical and horizontal lines corresponding to the key will close. When the processor sets the vertical line to a logical zero value, the voltage level on the horizontal line will also correspond to a logical zero.

If a logical zero level appears on one of the horizontal lines, the keyboard processor will record a key press. It will send to the computer (via an internal 16-byte buffer) an interrupt request and the key number in the matrix (called a scan code - this is a random value chosen by IBM back when it created the first keyboard for the PC). Data exchange with the computer will be repeated when the previously pressed key is released.

The scan code is uniquely associated with the keyboard wiring and does not directly depend on the markings printed on the surface of the key. But the program does not need the serial number of the pressed key, but the ASCII code corresponding to the character on this key. It is important to understand that this code does not completely depend on the scan code, because several values ​​can be assigned to the same key. This also depends on the state of other keys (for example, the 0 button is also used to enter a character when it is pressed together with the button) and system settings. This is what allows you to vary the keyboard layout (that is, the order of the keys on it).

All scan code to ASCII code conversions are performed software. As a rule, these functions are performed by the corresponding BIOS modules. To encode Cyrillic characters, these modules are extended by keyboard drivers (they are now included in operating systems).

The diagram (Fig. 3) explains the operation of the keyboard controller.

G-clock generator; MF counter; C – selector.

Fig.3. The simplest keyboard structure

The decoder sequentially queries the state of the keys located in the X columns of the keyboard matrix. If any key is pressed, the signal is sent through a closed contact to the corresponding horizontal bus Y and through a selector (register) to the input of the PLM (ROM). Signals from the decoder and selector form the address input of the PLM (ROM), in the cells of which the symbol codes (their low-order bits) are written. The character code is written to the output register. The most significant bits of the code are determined by the contents of a special register, which changes its value only when the register change key (Shift, Alt, etc.) is pressed.

Mouse

A mouse is a two-dimensional analogue pointing device connected to a personal computer and equipped with one, two or three buttons on the top cover and, possibly, a wheel.

The mouse works together with the screen, controlling the movement of the cursor (pointer) across it. The most popular are two-button mice. For example, one button can be used to start a function, and the second to cancel it. In graphics systems, one can turn on the light pencil, and the second can turn it off. There are mice with additional devices for scrolling (scrolling is scrolling up, down, left or right of a large image, such as text (or WEB page), that does not fit entirely on the screen). There are mice with two wheels, each of them “manages” scrolling along one of the axes. Some mice are equipped with an additional button on the side of the body under the thumb. This button can be reprogrammed to perform various actions. The first mice had a mechanical design. It used a small ball that protruded through the bottom surface of the device and rotated as it moved across the surface. Mechanical movements (linear or angular) are converted into binary codes. For example, mechanical mouse(Fig. 4) contains a ball that rotates when the device is moved along a flat surface.

In this diagram:

1. Control ball

2. Window for placing the ball

3. Contact roller, which allows the cursor to move along the x and y axes on the monitor screen.

4. Directional light source.

5. Stepper disc

6. Photocell

7. Electrical pulses at the output of the photocell.

8. Control buttons

9. Manipulator control unit and connection unit between the manipulator and the computer.

Principle of operation.

When you move the mouse along a horizontal surface, the control ball rotates and transfers rotation to one of the contacting rollers of the x or y axis. The stepping disk rotates together with the rollers. When rotated, it blocks access to the light flux to the photocell (photodiode, phototransistor or photoresistor). This mode creates a group of electrical pulses at the output of the photocell, which are sent to the control unit of the manipulator. Thus, the rotation of the ball is converted into angles of rotation of the stepper disk along the axes X And Y and are recorded by two counters. Since the distance traveled by the mouse is proportional to these angles, the counter codes determine the position of the mouse on the surface. The same codes transmitted to the processor control the position of the marker on the monitor screen.

In addition to counters, the mouse contains buttons, information from which is also included in the code transmitted to the processor.

The disadvantages of mechanical mice include the fact that they require space to operate (usually there is always not enough space on desktops). In addition, mechanical parts often break down. Mice have a tendency to collect dirt, which reduces the reliability of their functioning. Therefore, this device needs to be cleaned periodically, although it appears to operate on a clean table surface. The cheapness and simplicity of mechanical mice made them the most common devices.

An alternative to a mechanical mouse is an optical mouse.

In modern optical mouse a completely different principle is used (Fig. 5).

In this diagram:

1. Table surface.

2. Manipulator body.

3.4. Control buttons.

5. Directional monochrome light source.

6. Window in the manipulator body to illuminate the table surface.

Principle of operation.

An optical mouse uses a miniature video camera to scan a surface, running at 1,500 pictures per second. An LED is used to illuminate the surface. Frames of the table surface converted into binary code are recorded in the memory of the manipulator.

The processor sequentially selects frames from memory, compares them with each other and, based on the comparison, calculates the route for moving the cursor on the monitor screen along the x and y axis. The processor also monitors the signal coming from the control buttons. All data is transmitted to the PC through the communication unit.

The absence of moving parts and high accuracy are the advantages of this method.

The quality of a mouse is determined by its resolution, which is measured by the number of dots or counts per inch (1 inch = 25.4 mm). If the mouse has a resolution of 1000 counts/inch and moves one inch, then the electronic circuit generates 1000 pulses (the usual resolution of an optical mouse is about 400 counts/inch). The mouse driver, having received this information, averages it depending on the graphic resolution of the monitor and positions the cursor on its screen accordingly.

Keyboard– a keyboard control device for a personal computer. Serves to enter alphanumeric (character) data, as well as control commands. The monitor and keyboard combination provides the simplest user interface. The keyboard is used to control the computer system, and the monitor is used to receive feedback from it.

Exists three main types key mechanism: membrane, semi-mechanical And mechanical. Membrane keyboards are usually several times cheaper than mechanical ones.

Membrane keyboards

The name comes from the fact that when a key is pressed, two membranes close. The key returns using a rubber dome (with a “shaft” in the center). An intermediate film with holes is used to separate the membranes.

Since the membranes are located on the inner sides of the films, the structure is well protected, for example, from spilled coffee.

In a more secure implementation, everything looks like a single rubber mat with protruding domes located under the keys.

Pros membrane type keys are security, low noise And price.

Minus of this type - fragility.

Semi-mechanical keyboards

These keyboards use more durable, wear-resistant metal contacts. All this is placed on a printed circuit board. The key returns with a rubber dome.

Mechanical keyboards

In mechanical on keyboards, the key is returned by a spring.

Mechanical keyboards do not require a full press to register a signal, so the force to move the key is the only force you need to apply to register a signal. It is no longer necessary to hit a key on the keyboard frame.

Minuses such a mechanism: lack of tightness, price.

Plus is durability And reliability, especially when the contacts are gold plated.

Durability (number of presses to ensure reliable contact):

for membrane keyboards: 10-30 million;

for mechanical (semi-mechanical): 50 million and even 100 million for gold-plated contacts.

For an ordinary user, 20 million during normal work will be enough for 10 years or more. During this time, at least 2 generations of keyboards will change.

Operating principle.

Basic keyboard functions do not require driver support.

The necessary software to start working with a computer is already available in the ROM (Read Only Memory) chip as part of the basic input/output system (BIOS), and therefore the computer responds to key presses immediately after turning on.

The processor controller scans the key switches and when you press any key, a unique one-byte scan code is transmitted. When the scan code enters the processor, a hardware interrupt is initiated. The scan code is analyzed by the processor and converted into a character code. The resulting character code is then placed in a small memory area known as the keyboard buffer. The entered character is stored in the keyboard buffer until it is retrieved from there by the program for which it was intended, such as a text editor or word processor. If characters enter the buffer more often than they are taken out, a buffer overflow occurs. In this case, entering new characters stops for a while. In practice, at this moment, when we press a key, we hear a warning sound and do not observe data entry.

Each key is assigned a unique digital code and there are special keyboard encoding tables; as a rule, they are recorded in a special chip - the processor’s character generator. To change the keyboard encoding, use special programs– keyboard drivers. Modern keyboards are capable of not only transmitting data to the processor, but also receiving commands from it.

Keyboard composition.

ALPHABETICAL - NUMERIC KEYS

Designed for entering character information and commands typed by letter. Each key can operate in several modes (registers) and, accordingly, can be used to enter several characters.

FUNCTION KEYS (F1- F12)

The functions assigned to these keys depend on the properties of the specific program currently running, and in some cases, on the properties of the operating system. F1 calls up the help system, where you can find help about the actions of other keys.

SERVICE KEYS

SHIFT; ENTER; ALT; CTRL; TAB; ESC; BACKSPACE;

PRINT SCREEN– printing the current screen state on a printer (for MS-DOS) or saving it in a special area random access memory called the clipboard (for Windows).

SCROLL LOCK– switching the operating mode in some (usually outdated) programs.

PAUSE/BREAK– pause/interrupt the current process.

CURSOR CONTROL

Cursor- a screen element indicating the location for entering character information, used when working with programs that enter data and commands from the keyboard. The cursor keys allow you to control the input position.

UP / DOWN / LEFT / RIGHT

HOME And END move the cursor to the beginning or end of the current line, respectively. Their action is also modified by register keys.

INSERT switches the data input mode (switching between insert and replace modes). If the text cursor is located inside existing text, then in insert mode new characters are entered without replacing existing characters (the text is, as it were, moved apart). In replace mode, new characters replace the text that was previously present at the input position.

DELETE is intended to delete characters located to the right of the current cursor position. The position of the input position remains unchanged.

ADDITIONAL PANEL

duplicates the action of the numeric and some symbolic keys of the main panel.

Keyboard settings.

Personal computer keyboards have a character repetition property, which is used to automate the input process. It consists in the fact that when you hold down a key for a long time, the automatic entry of the code associated with it begins.

Keyboard is a keyboard control device for a personal computer. Used to enter alphanumeric (sign) data as well as control commands. The monitor and keyboard combination provides the simplest user interface. WITH Using the keyboard, they control the computer system, and using the monitor, they receive feedback from it.

Operating principle. The keyboard belongs to standard means personal computer. Its main functions do not require support from special system programs (drivers). The necessary software to start working with a computer is already available in the ROM chip as part of the basic input/output system (BIOS) and therefore the computer responds to key presses immediately after turning on. The principle of operation of the keyboard is as follows.

10) When you press a key (or combination of keys), a special chip built into the keyboard produces a so-called scan code

11) The scan code enters the microcircuit that performs the functions port keyboards. (Ports are special hardware-logical devices responsible for connecting the processor with other devices.) This chip is located on the main board of the computer inside the system unit.

12) The keyboard port issues an interrupt to the processor ( Interrupt- temporary stop of the execution of one program for the purpose of prompt execution of another, currently more important (priority) program) with a fixed number. For the keyboard, the interrupt number is 9 (Interrupt 9, Int9).

13) Having received an interrupt, the processor postpones the current work and, using the interrupt number, accesses a special area of ​​RAM, which contains the so-called interrupt vector. An interrupt vector is a list of address data with a fixed entry length. Each entry contains the address of the program that must service the interrupt with the number matching the entry number.

14) Having determined the address of the beginning of the program that processes the interrupt that has arisen, the processor proceeds to its execution. The simplest program keyboard interrupt processing is “hardwired” into the ROM chip, but programmers can “substitute” their program instead if they change the data in the interrupt vector.

15) The interrupt handler program directs the processor to the keyboard port, where it finds the scan code, loads it into its registers, then, under the control of the handler, determines which character code corresponds to this scan code.

17) The processor stops processing the interrupt and returns to the deferred task.

The entered character is stored in the keyboard buffer until it is retrieved from there by the program for which it was intended, such as a text editor or word processor. If characters enter the buffer more often than they are taken out, a buffer overflow occurs. In this case, entering new characters stops for a while. In practice, at this moment, when we press a key, we hear a warning sound and do not observe data entry.

Along with the mouse or touchpad, the keyboard is the main device for inputting information from the user.

Modern keyboards, also called PC/AT keyboards, have 101 keys, although some models, particularly those intended for use in laptops, may have some missing keys.

The arrangement of keys on the keyboard is called the keyboard layout. The keyboard layout is slightly different for each language, but the basic key blocks are always kept the same.

So, any keyboard contains function keys, alphanumeric keys, numeric keypad keys, cursor control keys and various service and control keys. Let's look at them in more detail and at the same time find out where they are placed on the keyboard.

The function keys are the F1 to F12 keys. They are located horizontally at the top of the keyboard. They are used to quickly call certain functions of the current application. Depending on the application, their purpose may change completely.

The alphanumeric keys are located below the function keys and occupy 4 horizontal rows on the left and center of the keyboard. These keys are used to enter text, text characters and numbers. It is this block that changes depending on the language in which it is printed. Usually this block contains keys for English and national languages ​​(for our country - English and Russian layouts, sometimes also Ukrainian).

The numeric keypad keys duplicate the numeric keys and some control keys. This is made for more convenient work with calculations. The block of these keys is located on the far right side of the keyboard. A number of laptops do not have this block to save space.

The cursor keys are used to move the cursor to a specified position. These are the Home, End keys, arrow keys and others. They are located between the alphanumeric block and the number pad.

Service and control keys are keys that control text input modes and various functions of the operating system. They are located in the lower corners of the number pad (Alt, Shift, Windows keys), in the left column of the number pad (Caps Lock, Tab), near the function keys and cursor control keys.

The design and principle of operation of the keyboard

If you imagine the keyboard as a grid, then the keys will be located at the intersection of the vertical and horizontal bars.

It works as follows. Current is supplied to the horizontal lines. If there is no pressure, the horizontal and vertical lines do not close and there will be a logical one signal on the horizontal lines (there is voltage on the lines). A logical zero will be supplied alternately on the vertical lines.

Horizontal lines are interrogated one by one. If the key is pressed, it will close the vertical and horizontal lines and the horizontal line will receive a logical zero signal received from the vertical line.

Knowing which vertical line a zero was sent to and which horizontal line sent a zero signal instead of a one, you can accurately determine the key pressed.

This is what the keyboard controller does. It assigns a so-called scan code to the received signal. After that, it gives the central processor an interrupt request and sends it the scan code of the key pressed.

The keyboard also has its own buffer to store the scan code of the keys pressed. It is intended for cases when several keys are pressed simultaneously. With a buffer, the processor processes these keystrokes or combinations of pressed keys simultaneously.

There is a small nuance in the key code. The scan code transmitted to the processor is not the same letter designation that is printed on the key. This is simply the number of the key that is pressed. The value of the key itself is determined by the ASCII code of the key. The same key can have multiple values ​​in this code. The scan code is converted into ASCII code using software from the BIOS and keyboard driver.

Laptop keyboard

In a laptop, as in personal computer, there is a keyboard, but due to the fact that the laptop is a solid product, the keyboard in it is of greater value than in a regular PC.

Due to the small size of the laptop, its keyboard has its own characteristic features.
In order not to protrude higher than the keyboard unit and not to scratch the screen, the laptop keys are much thinner than usual and have a special slim device to ensure a short key travel.

To reduce the area of ​​the keyboard itself, manufacturers reduce the size of the keys. Also, some models may not have a numeric keypad on the right side of the keyboard. Some keys are placed in one compact group, especially the cursor keys and utility keys.

To provide some specific actions designed to work with laptop components, additional functions are introduced on the keys and new key combinations specific to a particular model.
These features have their pros and cons.

The advantage is the soft stroke of the keys, their almost silent operation, and pleasant tactile sensations.
The downside is the lack of a number pad in some models, a non-standard layout, and the small size of some keys.

Also a disadvantage compared to a computer keyboard is the difficulty of replacing and. Computer keyboards are inexpensive and easy to change. Its disassembly, cleaning and repair is much easier and costs much less than similar work on a laptop keyboard.
So, let's look at the main problems and breakdowns of a laptop keyboard and how to fix them.

Laptop keyboard malfunctions and repairs

As with any device, there are two main types of faults - breakdowns caused by the laptop user and hardware failures.

Failures caused by the user are the most common for this device.

The most common cause is liquid spilled on the keyboard. To prevent this from happening, do not place liquids near the laptop and do not drink anything while sitting at it. If the problem has already arisen, carefully remove the liquid from the keyboard with cotton wool and napkins and take it to the service center. It is also recommended to remove the battery from the laptop. It should be remembered that the sooner you contact the service center, the greater the chance that the liquid will not have time to get inside the laptop. If disassembled independently or by unqualified people, liquid can get inside the housing and lead to a much more serious and expensive breakdown.

The keyboard may also suffer from strong impacts on the keys. As a result, some keys break or fly off over time. If you have suitable keys, then you can replace them yourself, but if they are not there or the pressing mechanism itself is broken, then it is better to send it to a service center. The prevention of this malfunction is careful handling of the keys.

Sometimes the keys are difficult to press, stick, or stop pressing altogether. This is because when you eat food at your keyboard, it becomes clogged over time. Keys stop clicking or are hard to press due to debris underneath them. Sometimes the keyboard becomes clogged with dust. In the case of a regular keyboard, it is easy to clean, but a laptop keyboard uses its own keyboard mounts. When disassembling, you can damage the cable going to it or break the keys. Therefore, it would not hurt to regularly take the keyboard to a service center for cleaning to prevent this problem. You can combine this procedure by cleaning the laptop from dust at a service center.

Hardware failures include damage to the contacts of the cable, damage to the cable itself, failure of the keyboard controller, keyboard board, and others. It is recommended to carry out all hardware malfunctions at a service center. This is a delicate repair that cannot be carried out without experience and the necessary equipment.

It should also be taken into account that in some cases, hardware repair may cost more than replacing the keyboard with a new one. After diagnostics, it would be a good idea to compare the price for repairs and the price for a new keyboard. It is better to entrust the replacement to specialists, since a certain laptop model has its own type of keyboard mounting and its own model, which can only be selected and installed in.

Lecture 6

Keyboard: peripheral input device

Types of keyboards:

Simple keyboards with a standard set of keys (letter, numeric, function, etc.)

INmultimedia keyboards In addition to standard keys, multimedia ones have been added. These keyboards make working with multimedia easier

Gaming keyboards designed for use in games.

Also, when choosing a keyboard, you can pay attention to its technical parameters. Among these parameters is the keyboard key mechanism.

There are three main types: membrane, mechanical and semi-mechanical.

IN membrane keyboard - an electronic keyboard without separate mechanical moving parts, made in the form of a flat, usually flexible, surface with a pattern of keys printed on it. Keyboards of this type are distinguished by their very low cost, exceptional compactness (thickness is a fraction of a millimeter), bendability, high reliability and almost perfect protection from dirt and moisture. The main disadvantage is the almost complete absence of tactile feedback, which makes error-free and blind typing much more difficult. To compensate for this disadvantage, devices with membrane keyboards usually have an audible confirmation of a key press. In addition, the load on the membranes is not “metered” by the “pusher-cap” system (see below), but is determined solely by the operator’s fingers, which significantly reduces the service life of the membranes.

In the 1980s, membrane keyboards were used in some low-end home computers. Currently, they continue to be used in household appliances (for example, microwave ovens), specialized and industrial equipment. Modern computer keyboards use a combination of membrane, rubber and mechanical keyboard technology, where pressing a plastic key pushes down a rubber cap, providing tactile feedback, and presses against the membrane. Principle of operation.

A membrane keyboard usually consists of three layers. Two of them have conductive tracks. The third, insulating layer is separating. It has cutouts where the keys are located, allowing the tracks on the top and bottom layers to touch when pressed. The thickness of the keyboard layers is usually no more than the thickness of paper or cardboard.

INmechanical keyboards Metal springs are used to return the keys. Keyboard circuits of this type are not very protected from dust and moisture. Durability is the main advantage of mechanical keyboards.

Semi-mechanical keyboards this is something between membrane and mechanical, where a printed circuit board is used instead of a lower membrane. This design is considered more durable. The key also returns to its original position with a rubber dome. Sometimes with a small spring. In this case, a smoother stroke is ensured throughout the entire press. But the spring technology has one specific effect: the key is activated even when pressed partially, while the membrane concept allows you to change your mind mid-press. This is important for high-speed printing. The price for such devices is higher than for membrane ones, but in addition to the fact that they have some protection against contamination, these keyboards will last you longer.

Laser keyboards

It consists of a small projector box that allows you to display the image of the keyboard on any flat surface. Data transmission occurs over the air (wireless). You can adjust the brightness, key typing sound, and sensitivity. True, this does not guarantee 100% recognition of your movements, and besides, the bright light hurts your eyes. There is one more disadvantage: the keyboard is not visible in bright light. Well, the cost of this gadget is by no means small.

IN wireless keyboards Three main types of connection are used, namely Bluetooth connection, infrared connection and radio frequency connection.

RF-enabled keyboards receive power from a battery or via a USB cable, which is used to charge the keyboard. Keyboards with an infrared connection must be within range of the device receiving the signal. Keyboards with an RF connection have a longer range than keyboards with an infrared connection. Bluetooth keyboards use Bluetooth technology to provide greater range than keyboards with RF and infrared connections. Keyboards with RF connectivity offer greater portability than keyboards with Bluetooth or infrared connectivity.

Wired keyboards

PS/2 and USB are two types of wired connections that connect keyboards to computers.

The PS/2 port first appeared in on computers (before this, I used to connect the keyboard . Data transfer speed is from 80 to 300 Kb/s and depends on the performance of the connected device and software .

Of the six contacts in the connector, four are used: frequency, data, power, and common. In this case, for the keyboard, the data bus contacts and frequencies used may differ from the contacts for connecting a mouse. This allows you to use both devices at once, but through a splitter.

Some can work correctly when the mouse and keyboard are connected “incorrectly” (that is, when the keyboard is connected to the connector intended for the mouse, and, conversely, the mouse is connected to the connector for the keyboard) - this is due to the fact that each connector is universal. Most motherboards if connected incorrectly (or if disconnected during operation) will require the user to “correctly” connect the devices and sometimes .

Depending on the type of housing, keyboards are divided into:

Traditional (standard)– regular AT keyboards;

Ergonomic. Keyboard designs of this type take into account the natural position of the hands while typing (in such designs, the keyboard was refracted in the center, the keys were at right angles to the natural position of the hands when typing). An ergonomic keyboard makes it possible to increase productivity and avoid the dangers of certain chronic diseases.

Flexible.- The keyboard is made of non-toxic, highly elastic silicone rubber and looks like a kind of rug with protrusions of various shapes. Letters and symbols do not wear off over time as they are printed on the back of the outer film. The outer film can be either matte or glossy. The main advantage of such keyboards is ease of transportation - they weigh only about 350 grams and can easily be rolled into a compact roll. They are well protected from dirt (waterproof), easy to clean and relatively easy to withstand shocks. They are silent and in some implementations have backlit keys.

But there are also disadvantages: in order to press a key, you need to apply slightly more force than on a regular keyboard. The pressure should be strictly in the center.

The program can use the keyboard in different ways. It can delay its execution until the operator enters a number or presses a key. While performing some work, the program can periodically check whether the operator has pressed a key that changes the operating mode of the program. Resident programs can monitor all keystrokes, activating when a predetermined combination is pressed. You can use an interrupt generated by the keyboard, for example, to terminate a program.

How the keyboard works

What's inside the keyboard? It turns out there is a computer there! Only this computer consists of a single chip and performs specialized functions. It tracks keystrokes and sends the number of the key pressed to the central computer.

The keyboard is a collection of sensors that sense pressure on the keys and close a certain electrical circuit. For a long time, keyboards with mechanical sensors were produced. Modern keyboards are membrane type. The switch is a set of membranes: active - upper, passive - lower, separating.

Inside the keyboard body, in addition to sensors, there are electronic signal decoding boards.

Data exchange between the keyboard and the motherboard is carried out in 11-bit blocks (8 bits plus service information) over a 2-wire cable (signal and ground).

The principle of operation of the keyboard is to scan the key switches. Closing and opening of any of the switches corresponds to a unique digital code (scan code) of 1 byte in size.

The keyboard is connected to the system board using a DIN or mini-DIN connector.

On the system board, signals from the keyboard are received and processed by a special chip -keyboard controller.

If we look at a highly simplified circuit diagram of the keyboard, we will notice that all the keys are located in the matrix nodes:

All horizontal lines of the matrix are connected through resistors to a +5 V power supply. The keyboard computer has two ports - output and input. The input port is connected to the horizontal lines of the matrix (X0-X4), and the output port is connected to the vertical lines (Y0-Y5).

By setting the voltage level corresponding to logical 0 on each of the vertical lines in turn, the keyboard computer polls the state of the horizontal lines. If no key is pressed, the voltage level on all horizontal lines corresponds to logical 1 (since all these lines are connected to the +5 V power supply through resistors).

If the operator presses any key, the corresponding vertical and horizontal lines will be closed. When the processor sets the value to logical 0 on this vertical line, the voltage level on the horizontal line will also correspond to logical 0.

As soon as a logical level of 0 appears on one of the horizontal lines, the keyboard processor records the key press. It sends an interrupt request and a key number in the matrix to the central computer. Similar actions are performed when the operator releases a previously pressed key.

The key number sent by the keyboard processor is uniquely related to the wiring of the keyboard matrix and does not directly depend on the designations printed on the surface of the keys. This number is called a scan code.

The word scan ("scanning") emphasizes the fact that the keyboard computer scans the keyboard to find the key pressed.

But the program does not need the serial number of the pressed key, but the ASCII code corresponding to the designation on this key. This code does not uniquely depend on the scan code, because The same key can have multiple ASCII code values. This depends on the state of the other keys. For example, the key labeled "1" is also used to enter the character "!" (if it is pressed together with the SHIFT key).

Therefore, all scan code to ASCII code conversions are performed software. Typically, these conversions are performed by BIOS modules. To use Cyrillic characters, these modules are extended with keyboard drivers.

If you press and hold a key, the keyboard will enter auto-repeat mode. In this mode, the code of the key pressed is automatically sent to the central computer after a certain period of time, called the auto-repeat period. Auto-repeat mode makes it easier to enter a large number of identical characters from the keyboard.

It should be noted that the keyboard contains an internal 16-byte buffer through which it communicates with the computer.

Driver stack for system input devices

Keyboard drivers, regardless of physical connection patterns, use system keyboard class drivers to handle hardware-independent operations. The driver data is calledclass drivers , since they provide the requirements required by the system, but independent of the hardware implementation, for a specific class of devices.

Correspondingfunction driver (port driver) provides device-specific support for performing I/O operations. Windows OS for x86 platforms implements a single driver for the system keyboard (i8042) and mouse.

Driver stack for Plug and Play PS/2 keyboard

The driver stack contains (from top to bottom):

    Kbdclass - top-level filter driver for the keyboard class;

    optional top-level keyboard class filter driver;

    i8042prt - functional keyboard driver;

    root bus driver.

In Windows 2000 and older, the keyboard class driver is the driverKbdclass , whose main objectives are:

    providing common and device-independent device class operations;

    support Plug and Play

    simultaneous execution of operations of more than one device;

    an implementation of a class service callback routine that is called by the function driver to pass data from the device's input buffer to the device class driver's data buffer.

In Windows 2000 and older, the functional driver for input devices using the PS/2 port (keyboards and mice) is the driveri8042prt , whose main functions are as follows:

    providing hardware-dependent simultaneous operations of PS/2 input devices (keyboards and mice share common I/O ports, but use different interrupts, interrupt service routines (ISRs), and interrupt completion routines);

    support Plug and Play support for power management and Windows Management Instrumentation (WMI);

    support for operations for legacy devices;

    call the class service callback routine for the keyboard and mouse classes to transfer data from the i8042prt input data buffer to the class driver data buffer;

    calling a set of callback functions that can implement high-level filter drivers for flexible device control.

In general, the device stack (it would be more correct to talk about the device object stack) of a PS/2 keyboard consists of:

    physical keyboard device object (PDO) created by the bus driver (in this case, PCI buses) – \Device\00000066;

    keyboard functional object (FDO) created and attached to the PDO by the i8042prt driver - unnamed object;

    optional keyboard device filter objects created by third-party keyboard filter drivers;

    top-level filter object of the keyboard class device created by the Kbdclass class driver – \Device\KeyboardClass0.

Handling keyboard input by applications

The Microsoft Win32 subsystem accesses the keyboard using the Raw Input Thread (RIT), which is part of the csrss.exe system process. operating system At startup, it creates a RIT and a system hardware input queue (SHIQ).

RIT opens the device object of the keyboard driver class for exclusive use and uses the ZwReadFile function to send it an input/output request (IRP) of type IRP_MJ_READ. Upon receiving a request, the Kbdclass driver marks it as pending, queues it, and returns a STATUS_PENDING return code. The raw input thread has to wait for the IRP to complete, which is done by using an Asynchronous Procedure Call (APC).

When the user presses or releases one of the keys, the system keyboard controller generates a hardware interrupt. Its handler calls a special interrupt service routine, IRQ 1 (interrupt service routine, ISR), registered in the system by the i8042prt driver. This procedure reads the appeared data from the internal queue of the keyboard controller. Handling a hardware interrupt must be as fast as possible, so the ISR queues the Deferred Procedure Call (DPC) I8042KeyboardIsrDpc and exits. As soon as this is possible (IRQL drops to DISPATCH_LEVEL), DPC will be called by the system. At this point, the KeyboardClassServiceCallback callback procedure registered by the Kbdclass driver with the i8042prt driver will be called. KeyboardClassServiceCallback will retrieve the pending IRP request from its queue, populate as many KEYBOARD_INPUT_DATA structures as possible containing all the necessary key press/release information, and complete the IRP. The raw input thread wakes up, processes the received information and again sends an IRP of type IRP_MJ_READ to the class driver, which is again queued until the next key press/release. Thus, the keyboard stack always has at least one pending IRP, and it is queued by the Kbdclass driver.

Using the IrpTracker utility, developed by the previously mentioned Open Systems Resources company, you can track the sequence of calls that occur when processing keyboard input.

How does RIT process the received information? All incoming keyboard events are placed in the system hardware input queue, after which they are sequentially converted into Windows messages(type WM_KEY*, WM_?BUTTON* or WM_MOUSEMOVE) and are placed at the end of the virtualized input queue (VIQ) of the active thread. In Windows messages, key scan codes are replaced with virtual key codes that correspond not to the location of the key on the keyboard, but to the action that the key performs. The mechanism for converting codes depends on the active keyboard layout, simultaneous pressing of other keys (for example, SHIFT) and other factors.

When a user logs on, the Windows Explorer process spawns a thread that creates the taskbar and desktop (WinSta0_RIT). This thread is tied to RIT. If the user launches MS Word, then the thread that created the window will immediately connect to the RIT. After this, the thread owned by Explorer is disconnected from the RIT, since only one thread can be associated with the RIT at a time. When you press a key, the corresponding element will appear in SHIQ, which will cause the RIT to wake up, convert the hardware input event into a message from the keyboard, and place it in the VIQ of the MS Word application thread.

Keyboard key state arrays

One of the challenges in developing the Windows hardware input model was to ensure that it was fault-tolerant. Fault tolerance is provided by allowing threads to process input independently, which prevents one thread from adversely affecting another. But this is not enough to reliably isolate threads from each other, so the system supports an additional concept - local input state. Each thread has its own input state, information about which is stored in the THREADINFO structure. This state information includes information about the thread's virtual input queue as well as a group of variables. The latter contain control information about the input state. Regarding the keyboard, the following information is supported: which window has the keyboard focus, which window is currently active, which keys are pressed, and what the state of the input cursor is.

Information about which keys are pressed is stored in a key synchronous state array. This array is included in each thread's local input state variables. At the same time, there is only one array of asynchronous key state, which contains similar information, and it is shared by all threads. The arrays reflect the current state of all keys, and the GetAsyncKeyState function allows you to determine whether a given key is currently pressed. GetAsyncKeyState always returns 0 (not pressed) if called by a thread other than the one that created the window that currently has input focus.

The GetKeyState function differs from GetAsyncKeyState in that it returns the state of the keyboard at the moment when the last keyboard message was retrieved from the thread's queue. This function can be called at any time; It doesn't matter to her which window is in focus.

Keyboard traps

In the Microsoft Windows operating system, a trap, or hook, is a mechanism for intercepting events using a special function (such as Windows message passing, mouse or keyboard input) before they reach the application. This function can then react to events and, in some cases, modify or cancel them.

Functions that receive event notifications are calledfiltering functions and differ in the types of events they intercept. For Windows to call a filter function, the function must be attached to a hook (such as a keyboard hook). Attaching one or more filter functions to a hook is called installing a hook. To install and remove filtering functions, applications use the Win32 API functions SetWindowsHookEx and UnhookWindowsHookEx. Some hooks can be installed both for the entire system and for one specific thread.

If multiple filter functions are attached to a single hook, Windows implements a queue of functions, with the last function attached at the head of the queue and the very first function at the end. The filter function queue (see Figure 8) is supported by Windows itself, which makes it easier to write filter functions and improves operating system performance.

The system maintains separate chains for each type of hook. A hook chain is a list of pointers to filter functions (special callback functions defined by the application). When some event associated with a particular hook type occurs, the system sequentially passes a message to each filter function in the hook chain. The action that a filter function can perform depends on the type of hook: some functions can only monitor the occurrence of events, others can modify message parameters or even stop message processing by blocking the call to the next filter function in the hook chain or the target window's message handling function.

When one or more filter functions are attached to a hook, and an event occurs that causes the hook to fire, Windows calls the first function in the queue of filter functions, and that's where its responsibility ends. The function is then responsible for calling the next function in the chain, using the Win32 API CallNextHookEx function.

The OS supports several types of hooks, each of which provides access to one aspect of the Windows message handling mechanism.

General processing scheme

Let us summarize all the knowledge gained above about the keyboard input procedure in a single algorithm. So, the signal flow algorithm from the user pressing keys on the keyboard to the appearance of characters on the screen can be represented as follows:

    At startup, the operating system creates a raw input stream and a system hardware input queue in the csrss.exe system process.

    The raw input stream in a loop sends read requests to the keyboard class driver, which remain in a waiting state until keyboard events occur.

    When the user presses or releases a key on the keyboard, the keyboard microcontroller records the key press/release and sends a scan code of the pressed key and an interrupt request to the central computer.

    The system keyboard controller receives the scan code, converts the scan code, makes it available on I/O port 60h, and generates a CPU hardware interrupt.

    The interrupt controller calls the interrupt handling procedure IRQ 1, - ISR, registered in the system by the i8042prt functional keyboard driver.

    The ISR procedure reads the appeared data from the internal queue of the keyboard controller, converts scan codes into virtual key codes (independent values ​​defined by the system) and queues a call to the deferred procedure I8042KeyboardIsrDpc.

    Once this is possible, the system calls the DPC, which in turn calls the KeyboardClassServiceCallback callback procedure registered by the Kbdclass keyboard class driver.

    The KeyboardClassServiceCallback procedure retrieves the pending request from the raw input stream from its queue and returns information about the key pressed in it.

    The raw input thread stores the received information in the system hardware input queue and, based on it, generates basic Windows keyboard messages WM_KEYDOWN, WM_KEYUP, which are placed at the end of the virtual input queue VIQ of the active thread.

    The thread's message loop removes the message from the queue and passes it to the appropriate window procedure for processing. In this case, the TranslateMessage system function can be called, which, based on the basic keyboard messages, creates additional “character” messages WM_CHAR, WM_SYSCHAR, WM_DEADCHAR and WM_SYSDEADCHAR.

mob_info