24 Jun 2012

Inside the Keyboard

            The processor in a keyboard has to understand several things that are important to the utility of the keyboard, such as:
• Position of the key in the key matrix.
• The amount of bounce and how to filter it.
• The speed at which to transmit the typematics.



The microprocessor and controller circuitry of a keyboard.

                 The key matrix is the grid of circuits underneath the keys. In all keyboards except for capacitive ones, each circuit is broken at the point below a specific key. Pressing the key bridges the gap in the circuit, allowing a tiny amount of current to flow through. The processor monitors the key matrix for signs of continuity at any point on the grid. When it finds a circuit that is closed, it compares the location of that circuit on the key matrix to the character map in its ROM. The character map is basically a comparison chart for the processor that tells it what the key at x,y coordinates in the key matrix represents. If more than one key is pressed at the same time, the processor checks to see if that combination of keys has a designation in the character map. For example, pressing the a key by itself would result in a small letter "a" being sent to the computer. If you press and hold down the Shift key while pressing the a key, the processor compares that combination with the character map and produces a capital letter "A."


A look at the key matrix.


              The character map in the keyboard can be superseded by a different character map provided by the computer. This is done quite often in languages whose characters do not have English equivalents. Also, there are utilities for changing the character map from the traditional QWERTY to DVORAK or another custom version.
Keyboards rely on switches that cause a change in the current flowing through the circuits in the keyboard. When the key presses the keyswitch against the circuit, there is usually a small amount of vibration between the surfaces, known as bounce. The processor in a keyboard recognizes that this very rapid switching on and off is not caused by you pressing the key repeatedly. Therefore, it filters all of the tiny fluctuations out of the signal and treats it as a single keypress.
If you continue to hold down a key, the processor determines that you wish to send that character repeatedly to the computer. This is known as typematics. In this process, the delay between each instance of a character can normally be set in software, typically ranging from 30 characters per second (cps) to as few as two cps.

Keyboard Technologies 

                Keyboards use a variety of switch technologies. It is interesting to note that we generally like to have some audible and tactile response to our typing on a keyboard. We want to hear the keys "click" as we type, and we want the keys to feel firm and spring back quickly as we press them. Let's take a look at these different technologies:
• Rubber dome mechanical
• Capacitive non-mechanical
• Metal contact mechanical
• Membrane mechanical
• Foam element mechanical




This keyboard uses rubber dome switches.



             Probably the most popular switch technology in use today is rubber dome. In these keyboards, each key sits over a small, flexible rubber dome with a hard carbon center. When the key is pressed, a plunger on the bottom of the key pushes down against the dome. This causes the carbon center to push down also, until it presses against a hard flat surface beneath the key matrix. As long as the key is held, the carbon center completes the circuit for that portion of the matrix. When the key is released, the rubber dome springs back to its original shape, forcing the key back up to its at-rest position.
Rubber dome switch keyboards are inexpensive, have pretty good tactile response and are fairly resistant to spills and corrosion because of the rubber layer covering the key matrix. Membrane switches are very similar in operation to rubber dome keyboards. A membrane keyboard does not have separate keys though. Instead, it has a single rubber sheet with bulges for each key. You have seen membrane switches on many devices designed for heavy industrial use or extreme conditions. Because they offer almost no tactile response and can be somewhat difficult to manipulate, these keyboards are seldom found on normal computer systems.
            Capacitive switches are considered to be non-mechanical because they do not simply complete a circuit like the other keyboard technologies. Instead, current is constantly flowing through all parts of the key matrix. Each key is spring-loaded, and has a tiny plate attached to the bottom of the plunger. When a key is pressed, this plate is brought very close to another plate just below it. As the two plates are brought closer together, it affects the amount of current flowing through the matrix at that point. The processor detects the change and interprets it as a keypress for that location. Capacitive switch keyboards are expensive, but do not suffer from corrosion and have a longer life than any other keyboard. Also, they do not have problems with bounce since the two surfaces never come into actual contact.
             Metal contact and foam element keyboards are not as common as they used to be. Metal contact switches simply have a spring-loaded key with a strip of metal on the bottom of the plunger. When the key is pressed, the metal strip connects the two parts of the circuit. The foam element switch is basically the same design but with a small piece of spongy foam between the bottom of the plunger and the metal strip, providing for a better tactile response. Both technologies have good tactile response, make satisfyingly audible "clicks" and are inexpensive to produce. The problem is that the contacts tend to wear out or corrode faster than on keyboards that use other technologies. Also, there is no barrier that prevents dust or liquids from coming in direct contact with the circuitry of the key matrix.

From the Keyboard to the Computer

             As you type, the processor in the keyboard is analyzing the key matrix and determining what characters to send to the computer. It maintains these characters in a buffer of memory that is usually about 16 bytes large. It then sends the data in a stream to the computer via some type of connection.

  The most common keyboard connectors are:
  • 5-pin DIN (Deustche Industrie Norm) connector
  • 6-pin IBM PS/2 mini-DIN connector
  • 4-pin USB (Universal Serial Bus) connector
  • internal connector (for laptops)
         Normal DIN connectors are rarely used anymore. Most computers use the mini-DIN PS/2 connector; but an increasing number of new systems are dropping the PS/2 connectors in favor of USB. No matter which type of connector is used, two principal elements are sent through the connecting cable. The first is power for the keyboard. Keyboards require a small amount of power, typically about 5 volts, in order to function. The cable also carries the data from the keyboard to the computer.
         The other end of the cable connects to a port that is monitored by the computer's keyboard controller. This is an integrated circuit (IC) whose job is to process all of the data that comes from the keyboard and forward it to the operating system. When the operating system is notified that there is data from the keyboard, a number of things can happen:
   • It checks to see if the keyboard data is a system level command. A good example of this is Ctrl+Alt+Delete on a Windows computer, which initiates a reboot.
   • The operating system then passes the keyboard data on to the current application.
   • The current application understands the keyboard data as an application-level command. An example of this would be Alt+f, which opens the File menu in a Windows application.
   • The current application is able to accept keyboard data as content for the application (anything from typing a document to entering a URL to performing a calculation), or
   • The current application does not accept keyboard data and therefore ignores the information.
          Once the keyboard data is identified as either system-specific or application-specific, it is processed accordingly. The really amazing thing is how quickly all of this happens. As I type this article, there is no perceptible time lapse between my fingers pressing the keys and the characters appearing on my monitor. When you think about everything the computer is doing to make each single character appear, it is simply incredible!




A PS/2 type keyboard connector.

       

ROM Read-only memory


There are five basic ROM types:

   • ROM
   • PROM
   • EPROM
   • EEPROM
   • Flash memory
Each type has unique characteristics, but they are all types of memory with two things in common:
  • Data stored in these chips is nonvolatile -- it is not lost when power is removed.
  • Data stored in these chips is either unchangeable or requires a special operation to change (unlike RAM, which can be changed as easily as it is read).
This means that removing the power source from the chip will not cause it to lose any data.
  • ROM

   Similar to RAM, ROM chips contain a grid of columns and rows. But where the columns and rows intersect, ROM chips are fundamentally different from RAM chips. While RAM uses transistors to turn on or off access to a capacitor at each intersection, ROM uses a diode to connect the lines if the value is 1. If the value is 0, then the lines are not connected at all.
   
   A diode normally allows current to flow in only one direction and has a certain threshold, known as the forward breakover, that determines how much current is required before the diode will pass it on. In silicon-based items such as processors and memory chips, the forward breakover voltage is approximately 0.6 volts. By taking advantage of the unique properties of a diode, a ROM chip can send a charge that is above the forward breakover down the appropriate column with the selected row grounded to connect at a specific cell. If a diode is present at that cell, the charge will be conducted through to the ground, and, under the binary system, the cell will be read as being "on" (a value of 1). The neat part of ROM is that if the cell's value is 0, there is no diode at that intersection to connect the column and row. So the charge on the column does not get transferred to the row.
   As you can see, the way a ROM chip works necessitates the programming of perfect and complete data when the chip is created. You cannot reprogram or rewrite a standard ROM chip. If it is incorrect, or the data needs to be updated, you have to throw it away and start over. Creating the original template for a ROM chip is often a laborious process full of trial and error. But the benefits of ROM chips outweigh the drawbacks. Once the template is completed, the actual chips can cost as little as a few cents each. They use very little power, are extremely reliable and, in the case of most small electronic devices, contain all the necessary programming to control the device. A great example is the small chip in the singing fish toy. This chip, about the size of your fingernail, contains the 30-second song clips in ROM and the control codes to synchronize the motors to the music.

  • PROM


   Creating ROM chips totally from scratch is time-consuming and very expensive in small quantities. For this reason, mainly, developers created a type of ROM known as programmable read-only memory (PROM). Blank PROM chips can be bought inexpensively and coded by anyone with a special tool called a programmer. 
   PROM chips have a grid of columns and rows just as ordinary ROMs do. The difference is that every intersection of a column and row in a PROM chip has a fuse connecting them. A charge sent through a column will pass through the fuse in a cell to a grounded row indicating a value of 1. Since all the cells have a fuse, the initial (blank) state of a PROM chip is all 1s. To change the value of a cell to 0, you use a programmer to send a specific amount of current to the cell. The higher voltage breaks the connection between the column and row by burning out the fuse. This process is known as burning the PROM.
    PROMs can only be programmed once. They are more fragile than ROMs. A jolt of static electricity can easily cause fuses in the PROM to burn out, changing essential bits from 1 to 0. But blank PROMs are inexpensive and are great for prototyping the data for a ROM before committing to the costly ROM fabrication process.

  • EPROM


   Working with ROMs and PROMs can be a wasteful business. Even though they are inexpensive per chip, the cost can add up over time. Erasable programmable read-only memory (EPROM) addresses this issue. EPROM chips can be rewritten many times. Erasing an EPROM requires a special tool that emits a certain frequency of ultraviolet (UV) light. EPROMs are configured using an EPROM programmer that provides voltage at specified levels depending on the type of EPROM used.
   Once again we have a grid of columns and rows. In an EPROM, the cell at each intersection has two transistors. The two transistors are separated from each other by a thin oxide layer. One of the transistors is known as the floating gate and the other as the control gate. The floating gate's only link to the row (wordline) is through the control gate. As long as this link is in place, the cell has a value of 1. To change the value to 0 requires a curious process called Fowler-Nordheim tunneling. Tunneling is used to alter the placement of electrons in the floating gate. An electrical charge, usually 10 to 13 volts, is applied to the floating gate. The charge comes from the column (bitline), enters the floating gate and drains to a ground.         
   This charge causes the floating-gate transistor to act like an electron gun. The excited electrons are pushed through and trapped on the other side of the thin oxide layer, giving it a negative charge. These negatively charged electrons act as a barrier between the control gate and the floating gate. A device called a cell sensor monitors the level of the charge passing through the floating gate. If the flow through the gate is greater than 50 percent of the charge, it has a value of 1. When the charge passing through drops below the 50-percent threshold, the value changes to 0. A blank EPROM has all of the gates fully open, giving each cell a value of 1.
   To rewrite an EPROM, you must erase it first. To erase it, you must supply a level of energy strong enough to break through the negative electrons blocking the floating gate. In a standard EPROM, this is best accomplished with UV light at a frequency of 253.7. Because this particular frequency will not penetrate most plastics or glasses, each EPROM chip has a quartz window on top of it. The EPROM must be very close to the eraser's light source, within an inch or two, to work properly.
   An EPROM eraser is not selective, it will erase the entire EPROM. The EPROM must be removed from the device it is in and placed under the UV light of the EPROM eraser for several minutes. An EPROM that is left under too long can become over-erased. In such a case, the EPROM's floating gates are charged to the point that they are unable to hold the electrons at all.
  • EEPROMs and Flash Memory 

    Though EPROMs are a big step up from PROMs in terms of reusability, they still require dedicated equipment and a labor-intensive process to remove and reinstall them each time a change is necessary. Also, changes cannot be made incrementally to an EPROM; the whole chip must be erased. Electrically erasable programmable read-only memory (EEPROM) chips remove the biggest drawbacks of EPROMs.
In EEPROMs:
• The chip does not have to removed to be rewritten.
• The entire chip does not have to be completely erased to change a specific portion of it.
• Changing the contents does not require additional dedicated equipment.
Instead of using UV light, you can return the electrons in the cells of an EEPROM to normal with the localized application of an electric field to each cell. This erases the targeted cells of the EEPROM, which can then be rewritten. EEPROMs are changed 1 byte at a time, which makes them versatile but slow. In fact, EEPROM chips are too slow to use in many products that make quick changes to the data stored on the chip.
   Manufacturers responded to this limitation with Flash memory, a type of EEPROM that uses in-circuit wiring to erase by applying an electrical field to the entire chip or to predetermined sections of the chip called blocks. Flash memory works much faster than traditional EEPROMs because it writes data in chunks, usually 512 bytes in size, instead of 1 byte at a time.

Keyboard


                 A keyboard is a series of switches connected to a microprocessor that monitors the state of each switch and initiates a specific response to a change in that state. 


Types of Keyboards

           Keyboards have changed very little in layout since their introduction. In fact, the most common change has simply been the natural evolution of adding more keys that provide additional functionality.
              The most common keyboards are:
• 101-key Enhanced keyboard
• 104-key Windows keyboard
• 82-key Apple standard keyboard
• 108-key Apple Extended keyboard
            
              Portable computers such as laptops quite often have custom keyboards that have slightly different key arrangements than a standard keyboard. Also, many system manufacturers add specialty buttons to the standard layout. A typical keyboard has four basic types of keys: 
• Typing keys
• Numeric keypad
• Function keys
• Control keys

              The typing keys are the section of the keyboard that contain the letter keys, generally laid out in the same style that was common for typewriters. This layout, known as QWERTY for the first six letters in the layout, was originally designed to slow down fast typists by making the arrangement of the keys somewhat awkward! The reason that typewriter manufacturers did this was because the mechanical arms that imprinted each character on the paper could jam together if the keys were pressed too rapidly. Because it has been long established as a standard, and people have become accustomed to the QWERTY configuration, manufacturers developed keyboards for computers using the same layout, even though jamming is no longer an issue. Critics of the QWERTY layout have adopted another layout, Dvorak, that places the most commonly used letters in the most convenient arrangement.

 
                  The numeric keypad is a part of the natural evolution mentioned previously. As the use of computers in business environments increased, so did the need for speedy data entry. Since a large part of the data was numbers, a set of 17 keys was added to the keyboard. These keys are laid out in the same configuration used by most adding machines and calculators, to facilitate the transition to computer for clerks accustomed to these other machines.
                  In 1986, IBM extended the basic keyboard with the addition of function and control keys. The function keys, arranged in a line across the top of the keyboard, could be assigned specific commands by the current application or the operating system. Control keys provided cursor and screen control. Four keys arranged in an inverted T formation between the typing keys and numeric keypad allow the user to move the cursor on the display in small increments. The control keys allow the user to make large jumps in most applications. Common control keys include:
• Home
• End
• Insert
• Delete
• Page Up
• Page Down
• Control (Ctrl)
• Alternate (Alt)
• Escape (Esc)
             The Windows keyboard adds some extra control keys: two Windows or Start keys, and an Application key. The Apple keyboards are specific to Apple Mac systems.