Showing posts with label working. Show all posts
Showing posts with label working. Show all posts

How Computer Keyboards Work?

Thursday, 15 August 2013


When you look at all the extras and options that are available for new computer keyboards, it can be hard to believe that their original design came from mechanical typewriters that didn't even use electricity. Now, you can buy ergonomic keyboards that bear little resemblance to flat, rectangular models with ordinary square keys. Some flashier models light up, roll up or fold up, and others offer options for programming your own commands and shortcuts.
But no matter how many bells and whistles they offer, most keyboards operate using similar technology. They use switches and circuits to translate a person's keystrokes into a signal a computer can understand. In this article we will explore keyboard technology along with different key layouts, options and designs.

Keyboard Basics

 

A keyboard's primary function is to act as an input device. Using a keyboard, a person can type a document, use keystroke shortcuts, access menus, play games and perform a variety of other tasks. Keyboards can have different keys depending on the manufacturer, the operating system they're designed for, and whether they are attached to a desktop computer or part of a laptop. But for the most part, these keys, also called keycaps, are the same size and shape from keyboard to keyboard. They're also placed at a similar distance from one another in a similar pattern, no matter what language or alphabet the keys represent.
Most keyboards have between 80 and 110 keys, including:
  • Typing keys
  • A numeric keypad
  • Function keys
  • Control keys
The typing keys include the letters of the alphabet, generally laid out in the same pattern used for typewriters. According to legend, this layout, known as QWERTY for its first six letters, helped keep mechanical typewriters' metal arms from colliding and jamming as people typed. Some people question this story -- whether it's true or not, the QWERTY pattern had long been a standard by the time computer keyboards came around.
Keyboards can also use a variety of other typing key arrangements. The most widely known is Dvorak, named for its creator, August Dvorak. The Dvorak layout places all of the vowels on the left side of the keyboard and the most common consonants on the right. The most commonly used letters are all found along the home row. The home row is the main row where you place your fingers when you begin typing. People who prefer the Dvorak layout say it increases their typing speed and reduces fatigue. Other layouts include ABCDE, XPeRT, QWERTZ and AZERTY. Each is named for the first keys in the pattern. The QWERTZ and AZERTY arrangements are commonly used in Europe.
The numeric keypad is a more recent addition to the computer keyboard. 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, arranged in the same configuration found on adding machines and calculators, was added to the keyboard.
The Apple keyboard's control keys include the "Command" key.
In 1986, IBM further extended the basic keyboard with the addition of function and control keys. Applications and operating systems can assign specific commands to the function keys. Control keys provide cursor and screen control. Four arrow keys arranged in an inverted T formation between the typing keys and numeric keypad move the cursor on the screen in small increments.
Other 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. Apple keyboards, on the other hand, have Command (also known as "Apple") keys. A keyboard developed for Linux users features Linux-specific hot keys, including one marked with "Tux" the penguin -- the Linux logo/mascot.


Inside the Keyboard

 

A keyboard is a lot like a miniature computer. It has its own processor and circuitry that carries information to and from that processor. A large part of this circuitry makes up the key matrix.
The key matrix is a grid of circuits underneath the keys. In all keyboards (except for capacitive models, which we'll discuss in the next section), each circuit is broken at a point below each key. When you press a key, it presses a switch, completing the circuit and allowing a tiny amount of current to flow through. The mechanical action of the switch causes some vibration, called bounce, which the processor filters out. If you press and hold a key, the processor recognizes it as the equivalent of pressing a key repeatedly.
When the processor finds a circuit that is closed, it compares the location of that circuit on the key matrix to the character map in its read-only memory (ROM). A character map is basically a comparison chart or lookup table. It tells the processor the position of each key in the matrix and what each keystroke or combination of keystrokes represents. For example, the character map lets the processor know that pressing the a key by itself corresponds to a small letter "a," but the Shift and a keys pressed together correspond to a capital "A."
The key matrix
A computer can also use separate character maps, overriding the one found in the keyboard. This can be useful if a person is typing in a language that uses letters that don't have English equivalents on a keyboard with English letters. People can also set their computers to interpret their keystrokes as though they were typing on a Dvorak keyboard even though their actual keys are arranged in a QWERTY layout. In addition, operating systems and applications have keyboard accessibility settings that let people change their keyboard's behavior to adapt to disabilities.

Keyboard Switches

Keyboards use a variety of switch technologies. Capacitive switches are considered to be non-mechanical because they do not physically complete a circuit like most other keyboard technologies. Instead, current constantly flows through all parts of the key matrix. Each key is spring-loaded and has a tiny plate attached to the bottom of it. When you press a key, it moves this plate closer to the plate below it. As the two plates move closer together, the amount of current flowing through the matrix changes. The processor detects the change and interprets it as a key press for that location. Capacitive switch keyboards are expensive, but they 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.
All of the other types of switches used in keyboards are mechanical in nature. Each provides a different level of audible and tactile response -- the sounds and sensations that typing creates. Mechanical key switches include:
  • Rubber dome
  • Membrane
  • Metal contact
  • Foam element
This keyboard uses rubber dome switches.
Rubber dome switches are very common. They use small, flexible rubber domes, each with a hard carbon center. When you press a key, a plunger on the bottom of the key pushes down against the dome, and the carbon center presses against a hard, flat surface beneath the key matrix. As long as the key is held, the carbon center completes the circuit. 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.
Rather than having a switch for each key, membrane keyboards use a continuous membrane that stretches from one end to another. A pattern printed in the membrane completes the circuit when you press a key. Some membrane keyboards use a flat surface printed with representations of each key rather than keycaps. Membrane keyboards don't have good tactile response, and without additional mechanical components they don't make the clicking sound that some people like to hear when they're typing. However, they're generally inexpensive to make.

mmon. 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 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.
Different manufacturers have used these standard technologies, and a few others, to create a wide range of non-traditional keyboards. We'll take a look at some of these non-traditional keyboards in the next section.

Read more ...

How MAGLEV Trains Work?

Wednesday, 14 August 2013


Magnetic levitated trains are abbreviated to maglev trains. Maglev trains do not have engine to pull the train cars rather they use the basic principles of electromagnets.
What are electromagnets?
Any current carrying conductor (e.g. wire) has a magnetic field around it. It loses its magnetism when the current is turned OFF. Electromagnet is a coil of wire. It is usually wound on an iron core with many turns lying side by side. This is done because; the strength of the magnetic force produced depends on
  • the number of turns of the coil
  • the amount of current.
Hence more the no of turns more is the magnetic field. The poles of the electromagnet can be changed by changing the direction of the current.

What are maglev trains?
Maglev trains are trains which are suspended, guided and propelled (moved forward) by magnetic forces. The track of the maglev train is called the guide-way. Working of the maglev trains can be studied under the following
  • Levitation
  • Propulsion
  • Guidance
Levitation

            Maglev trains have no contacts with the rails while they move forward. They are levitated on the guide-way with the help of magnetic forces. Levitation is the process by which an object is suspended against gravity in a stable position without any physical contact.
Magnetic levitation is used based on the property (1) that “The force between two magnetic bodies is directly proportional to their magnetic moments and indirectly proportional to the square of the distance between them”. Hence, while the magnetic levitation is designed, the major factor to be considered is the distance between the train and the guide-way.
There are two types of levitation used in maglev trains namely
  • Electro Magnetic Suspension (EMS)
  • Electro Dynamic Suspension (EDS)
Electro Magnetic Suspension (EMS)

            Like poles repel each other and unlike poles attract. This is the basic principle used in EMS. The electromagnets are placed under the train and in the guide-way. The electromagnet on the guide-way repels with the magnets under the train and hence the train levitates. The levitating gap is kept as small as possible to have greater magnetic forces according to the property (1) discussed earlier. The levitating gap is usually 10mm with passengers onboard. While the train is moving, the electromagnets are magnetized and when the train has to be stopped, just the current is turned off to demagnetize the magnets. The train stops and rests on the guide-way closing the gap.
The magnets are placed in the form of C under the train. The  repulsive force acts on all the three edges of the C-shape and helps in better levitation.
The major factor to be considered while designing the magnetic strength is the earth’s gravity. As already mentioned, the magnetic strength depends on the amount of current. Hence, to make the train levitate against the gravitational pull, large current is required to create a strong repulsive magnetic force. Study shows that to maintain a gap of 50.8 mm 50,000 ampere turns of magnetic strength has to be supplied.
Magnetic intensity (strength) = N × I
Where,
N – Number of turns of the coil
I – amount of current
Hence, to maintain a gap of 50.8mm in a coil with 1000 turns (assumption) 50 amperes of current has to be supplied.
The train moves at a speed of 400 km/hr. The maintenance of a very small levitating gap at higher speed using EMS is challenging. The monitoring and control of the gap is very difficult at higher speed. Hence, higher speeds cannot be achieved in this design.
 Electro Dynamic Suspension (EDS)
EDS was discovered by Japanese while EMS by Germans. By using EDS, much higher speeds can be attained. The fastest train running in the world uses EDS principle and runs at a speed of 581km/hr. However the train has to be run on wheels till it gains a speed of 100 km/hr, only after which it can be levitated. In this system the track is called inductrack.
Electro dynamic suspension system has electromagnets on the train. The inductrack has an array of electrically shorted circuits (coils connected in series from the start of the track till the end). According to Faraday’s law of electromagnetic induction, whenever there is a change of flux linked with the coil, an emf (current) is induced in the coil. When the train starts to move on its wheels, the magnetic flux linked with the coils in the inductrack changes and hence an emf (current) is induced in the coils. As already discussed, every current carrying conductor has a magnetic field around it. Hence, there is a magnetic field developed around the coils in the inductrack. This magnetic field opposes its cause i.e. the magnetic field in the train (by Lenz’s law – when a current is induced in a conductor it is in such a way to oppose the cause). Therefore, a repulsive force is produced between the magnetic field of the train and the track and the train levitates.
The electromagnets in the train are superconducting electromagnets. Superconductors are materials whose resistivity (Resistivity is how much a material opposes the flow of current) becomes zero when they are cooled to critical temperature. Critical temperature is the temperature at which the matter has no distinction in its states. For e.g. at critical temperature of nitrogen, nitrogen is neither a gas nor a liquid, but has both the characteristics of gas and liquid. Superconducting electromagnets are used as the coils of these electromagnets can carry huge amount of current as the resistivity is almost zero. Hence, the magnetic force is higher and hence higher speed is achieved.
Here, as the power is supplied only to the electromagnets in the train, this system consumes less power compared to EMS system. In EDS system the levitation gap is 10 cm. Though the distance between the two magnetic bodies is larger, the magnetic force produced is huge because of the use of superconducting magnets. Therefore, this system does not require any control and monitoring of the levitating gap.
 Propulsion

Propulsion is moving the train forward. To propel the vehicle, the electromagnets are placed on the sides of the guide-way.  They are energized according to the time when the train reaches that particular spot and are de-energized the rest of the time.





In figure, the train is pushed due to repulsion of south poles and is pulled due to attraction of poles. So the train moves forward. Now the next set of pole comes into action and thereby a continuous motion is produced.

 Guidance

The propulsion coils are used for guidance. The propulsion coils are placed on the left and right side of the guide-way.
Emf is induced in the coils when the train is moving, the same principle on which EDS works. The coils are connected and hence the emf on either side of the train are opposite in direction. Hence, they cancel out each other. Thus the  train moves in the centre of the guide-way. When the train deviates from its centre position i.e. when it moves towards one of the walls, one of the emf is greater than the other and the resultant emf directly depends on the difference in distance. As, there is an emf, a resultant magnetic force is also produced. Hence, the magnetic force due to emf depends on the difference in distance. This resultant magnetic force called the guiding force pushes the train to the same distance and thereby putting in the centre.
Maglev trains are mainly used for transportation in china, japan, germany,etc. It is still not used by many countries. This article has just briefed the basic principles and working of the maglev trains.  Maglev trains are the best example of the modern transport means.
If solar panels are installed above the guide-way all the way along in maglev trains, they can also help in saving world resources!

for more informatin click here

Read more ...

How Ceiling Fans Work?

Wednesday, 14 August 2013

You certainly appreciate it keeping your rooms cool in during the summer heat? But do you know how your ceiling fan works? We take a look inside the breeze machine.


Installing a ceiling fan is easy, according to how-to videos and breezy online tutorials. But these instructions assume that an electrical box rated to hang 70 pounds of fan is just sitting in the ceiling, mounted to a joist on bolts strong enough for chin-ups. Sorry, but unless you’re replacing an existing fan, that box isn’t in place yet.

What is there, most likely, is a basic lighting fixture connected to someone else’s electrical work—a pile of wiry pigtails bearing a strong resemblance to a can of worms. Replacing it involves clearing out a wrist-size hole and then reaching back in to mount a metal box, clamp the wires and secure their connections, all while never once getting a clear look at what you’re doing. Now, many amateurs can hang a pot rack or an overhead planter, and most can wire a receptacle, but few can do both at the same time. If the project gets unmanageable, a licensed electrician can finish the job for around $175.

Once the box is in, the work really is easy, and a lifetime of cool breezes is within reach. 


Dust in the Wind


Fan blades attract dander, dust mites and more. Antidust products keep a fan clean, but do they bust the dust better than a wet rag? We polished a filthy old fan and a brand-new one to test four common options.


1 Endust Worked well, but an ingredient list heavy with petroleum seemed like overkill for a dirty fan.

2 Pledge Broke up thick crud with a pleasing lemon scent. Shiny, clean finish.

3 Swiffer Too flimsy for the filthy fan, but its crimped fibers found dust on the new blades.

4 Wet Rag Elbow grease and dish soap did the trick on both fans.

The Bottom Line Chemical cleaners work, but soap is cheap—and safe for skin contact.

3 Sounds of Fan Failure


Squeaking A series of squeaks suggests a loose screw. Tighten fasteners connecting the canopy, the blades and the globe.

Clicking Clicking indicates a bearing gone bad. It happens. The bearing (or motor) may be replaceable. Ask the manufacturer.

Wah-Wah It's over. This magnetic noise signals defective internal motor components, a problem in cheap fans. Replace the fan. 
 Induction motors use a rotating magnetic field to move machinery. Nikola Tesla demonstrated the technology in such devices as 1893’s Egg of Columbus. Early motors operated at a single speed; semiconductors made them more practical by enabling variable-speed operation.

1 Wires Conductors carry electrical current to sets of copper coils called windings.

2 Windings Wrapped around steel bars, or laminations, energized windings form an electromagnet called a stator.

3 Stator Fluctuating polarity creates a rotating magnetic field in the stator. The field crosses a 0.3-mm gap to induce a current in laminations in the rotor, which spins around the stationary stator.

4 Rotor The angle at which the stator faces the rotor, the physical distance between the two, and the geometry of slots carved into each set of laminations combine to create two out-of-phase magnetic fields. The rotor spins because it repels the rotating magnetic field induced by the stator.

5 Housing The motor housing envelops the rotor as it revolves on bearings around the stator. In the design shown here, known as an inside-out motor, fan blades attach to the housing bottom. Vents on top cool the motor—it needs a breeze, too.

Blade Geometry


Blade Tilt Most blades tilt between 12 and 14 degrees off horizontal. Decorative blades, such as textured palm fronds, can tilt up to 20 degrees.

Fan RPM Fans on low speed revolve 40 to 70 times per minute. Medium speeds range from 100 to 115, and high speeds hit 180 to 200.

Blade Count A high blade count cannibalizes airflow per blade, according to manufacturer Fanimation's John Moody. "Looking strictly at what moves the air most efficiently, three blades are best," he says.

Rotation Rule Blades tilt so that a counterclockwise rotation pushes air downward to cool a room. Reverse the rotation, and blades draw air upward to circulate the hot air hugging the ceiling without creating a direct draft into the room. Here's the rule: Go clockwise in cold weather.

Ideal Blade Length Per Room Size
 

For more information click here





Read more ...

How Microprocessors Work ?

Saturday, 10 August 2013
The computer you are using to read this page uses a microprocessor to do its work. The microprocessor is the heart of any normal computer, whether it is a desktop machine, a server or a laptop. The microprocessor you are using might be a Pentium, a K6, a PowerPC, a Sparc or any of the many other brands and types of microprocessors, but they all do approximately the same thing in approximately the same way.
A microprocessor -- also known as a CPU or central processing unit -- is a complete computation engine that is fabricated on a single chip. The first microprocessor was the Intel 4004, introduced in 1971. The 4004 was not very powerful -- all it could do was add and subtract, and it could only do that 4 bits at a time. But it was amazing that everything was on one chip. Prior to the 4004, engineers built computers either from collections of chips or from discrete components (transistors wired one at a time). The 4004 powered one of the first portable electronic calculators.
­ If you have ever wondered what the microprocessor in your computer is doing, or if you have ever wondered about the differences between types of microprocessors, then read on. In this article, you will learn how fairly simple digital logic techniques allow a computer to do its job, whether its playing a game or spell checking a document!

Microprocessor Progression: Intel

The first microprocessor to make it into a home computer was the Intel 8080, a complete 8-bit computer on one chip, introduced in 1974. The first microprocessor to make a real splash in the market was the Intel 8088, introduced in 1979 and incorporated into the IBM PC (which first appeared around 1982). If you are familiar with the PC market and its history, you know that the PC market moved from the 8088 to the 80286 to the 80386 to the 80486 to the Pentium to the Pentium II to the Pentium III to the Pentium 4. All of these microprocessors are made by Intel and all of them are improvements on the basic design of the 8088. The Pentium 4 can execute any piece of code that ran on the original 8088, but it does it about 5,000 times faster!
Since 2004, Intel has introduced microprocessors with multiple cores and millions more transistors. But even these microprocessors follow the same general rules as earlier chips.

Here are the differences between the different processors that Intel has introduced over the years.
Compiled from The Intel Microprocessor Quick Reference Guide and TSCP Benchmark Scores
Additional information about the table on this page:
  • The date is the year that the processor was first introduced. Many processors are re-introduced at higher clock speeds for many years after the original release date.
  • Transistors is the number of transistors on the chip. You can see that the number of transistors on a single chip has risen steadily over the years.
  • Microns is the width, in microns, of the smallest wire on the chip. For comparison, a human hair is 100 microns thick. As the feature size on the chip goes down, the number of transistors rises.
  • Clock speed is the maximum rate that the chip can be clocked at. Clock speed will make more sense in the next section.
  • Data Width is the width of the ALU. An 8-bit ALU can add/subtract/multiply/etc. two 8-bit numbers, while a 32-bit ALU can manipulate 32-bit numbers. An 8-bit ALU would have to execute four instructions to add two 32-bit numbers, while a 32-bit ALU can do it in one instruction. In many cases, the external data bus is the same width as the ALU, but not always. The 8088 had a 16-bit ALU and an 8-bit bus, while the modern Pentiums fetch data 64 bits at a time for their 32-bit ALUs.
  • MIPS stands for "millions of instructions per second" and is a rough measure of the performance of a CPU. Modern CPUs can do so many different things that MIPS ratings lose a lot of their meaning, but you can get a general sense of the relative power of the CPUs from this column.
From this table you can see that, in general, there is a relationship between clock speed and MIPS. The maximum clock speed is a function of the manufacturing process and delays within the chip. There is also a relationship between the number of transistors and MIPS. For example, the 8088 clocked at 5 MHz but only executed at 0.33 MIPS (about one instruction per 15 clock cycles). Modern processors can often execute at a rate of two instructions per clock cycle. That improvement is directly related to the number of transistors on the chip and will make more sense in the next section.

Microprocessor Logic

To understand how a microprocessor works, it is helpful to look inside and learn about the logic used to create one. In the process you can also learn about assembly language -- the native language of a microprocessor -- and many of the things that engineers can do to boost the speed of a processor.
A microprocessor executes a collection of machine instructions that tell the processor what to do. Based on the instructions, a microprocessor does three basic things:
  • Using its ALU (Arithmetic/Logic Unit), a microprocessor can perform mathematical operations like addition, subtraction, multiplication and division. Modern microprocessors contain complete floating point processors that can perform extremely sophisticated operations on large floating point numbers.
  • A microprocessor can move data from one memory location to another.
  • A microprocessor can make decisions and jump to a new set of instructions based on those decisions.
There may be very sophisticated things that a microprocessor does, but those are its three basic activities. The following diagram shows an extremely simple microprocessor capable of doing those three things:

This is about as simple as a microprocessor gets. This microprocessor has:
  • An address bus (that may be 8, 16 or 32 bits wide) that sends an address to memory
  • A data bus (that may be 8, 16 or 32 bits wide) that can send data to memory or receive data from memory
  • An RD (read) and WR (write) line to tell the memory whether it wants to set or get the addressed location
  • A clock line that lets a clock pulse sequence the processor
  • A reset line that resets the program counter to zero (or whatever) and restarts execution
Let's assume that both the address and data buses are 8 bits wide in this example.
Here are the components of this simple microprocessor:
  • Registers A, B and C are simply latches made out of flip-flops. (See the section on "edge-triggered latches" in How Boolean Logic Works for details.)
  • The address latch is just like registers A, B and C.
  • The program counter is a latch with the extra ability to increment by 1 when told to do so, and also to reset to zero when told to do so.
  • The ALU could be as simple as an 8-bit adder (see the section on adders in How Boolean Logic Works for details), or it might be able to add, subtract, multiply and divide 8-bit values. Let's assume the latter here.
  • The test register is a special latch that can hold values from comparisons performed in the ALU. An ALU can normally compare two numbers and determine if they are equal, if one is greater than the other, etc. The test register can also normally hold a carry bit from the last stage of the adder. It stores these values in flip-flops and then the instruction decoder can use the values to make decisions.
  • There are six boxes marked "3-State" in the diagram. These are tri-state buffers. A tri-state buffer can pass a 1, a 0 or it can essentially disconnect its output (imagine a switch that totally disconnects the output line from the wire that the output is heading toward). A tri-state buffer allows multiple outputs to connect to a wire, but only one of them to actually drive a 1 or a 0 onto the line.
  • The instruction register and instruction decoder are responsible for controlling all of the other components.
Although they are not shown in this diagram, there would be control lines from the instruction decoder that would:
  • Tell the A register to latch the value currently on the data bus
  • Tell the B register to latch the value currently on the data bus
  • Tell the C register to latch the value currently output by the ALU
  • Tell the program counter register to latch the value currently on the data bus
  • Tell the address register to latch the value currently on the data bus
  • Tell the instruction register to latch the value currently on the data bus
  • Tell the program counter to increment
  • Tell the program counter to reset to zero
  • Activate any of the six tri-state buffers (six separate lines)
  • Tell the ALU what operation to perform
  • Tell the test register to latch the ALU's test bits
  • Activate the RD line
  • Activate the WR line
Coming into the instruction decoder are the bits from the test register and the clock line, as well as the bits from the instruction register.

Microprocessor Memory

The previous section talked about the address and data buses, as well as the RD and WR lines. These buses and lines connect either to RAM or ROM -- generally both. In our sample microprocessor, we have an address bus 8 bits wide and a data bus 8 bits wide. That means that the microprocessor can address (28) 256 bytes of memory, and it can read or write 8 bits of the memory at a time. Let's assume that this simple microprocessor has 128 bytes of ROM starting at address 0 and 128 bytes of RAM starting at address 128.
ROM stands for read-only memory. A ROM chip is programmed with a permanent collection of pre-set bytes. The address bus tells the ROM chip which byte to get and place on the data bus. When the RD line changes state, the ROM chip presents the selected byte onto the data bus.
RAM stands for random-access memory. RAM contains bytes of information, and the microprocessor can read or write to those bytes depending on whether the RD or WR line is signaled. One problem with today's RAM chips is that they forget everything once the power goes off. That is why the computer needs ROM.

RAM chip
By the way, nearly all computers contain some amount of ROM (it is possible to create a simple computer that contains no RAM -- many microcontrollers do this by placing a handful of RAM bytes on the processor chip itself -- but generally impossible to create one that contains no ROM). On a PC, the ROM is called the BIOS (Basic Input/Output System). When the microprocessor starts, it begins executing instructions it finds in the BIOS. The BIOS instructions do things like test the hardware in the machine, and then it goes to the hard disk to fetch the boot sector (see How Hard Disks Work for details). This boot sector is another small program, and the BIOS stores it in RAM after reading it off the disk. The microprocessor then begins executing the boot sector's instructions from RAM. The boot sector program will tell the microprocessor to fetch something else from the hard disk into RAM, which the microprocessor then executes, and so on. This is how the microprocessor loads and executes the entire operating system.

Microprocessor Instructions

Even the incredibly simple microprocessor shown in the previous example will have a fairly large set of instructions that it can perform. The collection of instructions is implemented as bit patterns, each one of which has a different meaning when loaded into the instruction register. Humans are not particularly good at remembering bit patterns, so a set of short words are defined to represent the different bit patterns. This collection of words is called the assembly language of the processor. An assembler can translate the words into their bit patterns very easily, and then the output of the assembler is placed in memory for the microprocessor to execute.
Here's the set of assembly language instructions that the designer might create for the simple microprocessor in our example:
  • LOADA mem - Load register A from memory address
  • LOADB mem - Load register B from memory address
  • CONB con - Load a constant value into register B
  • SAVEB mem - Save register B to memory address
  • SAVEC mem - Save register C to memory address
  • ADD - Add A and B and store the result in C
  • SUB - Subtract A and B and store the result in C
  • MUL - Multiply A and B and store the result in C
  • DIV - Divide A and B and store the result in C
  • COM - Compare A and B and store the result in test
  • JUMP addr - Jump to an address
  • JEQ addr - Jump, if equal, to address
  • JNEQ addr - Jump, if not equal, to address
  • JG addr - Jump, if greater than, to address
  • JGE addr - Jump, if greater than or equal, to address
  • JL addr - Jump, if less than, to address
  • JLE addr - Jump, if less than or equal, to address
  • STOP - Stop execution
If you have read How C Programming Works, then you know that this simple piece of C code will calculate the factorial of 5 (where the factorial of 5 = 5! = 5 * 4 * 3 * 2 * 1 = 120):
a=1;f=1;while (a <= 5){ f = f * a; a = a + 1;}
At the end of the program's execution, the variable f contains the factorial of 5.

Assembly Language

A C compiler translates this C code into assembly language. Assuming that RAM starts at address 128 in this processor, and ROM (which contains the assembly language program) starts at address 0, then for our simple microprocessor the assembly language might look like this:
// Assume a is at address 128// Assume F is at address 1290 CONB 1 // a=1;1 SAVEB 1282 CONB 1 // f=1;3 SAVEB 1294 LOADA 128 // if a > 5 the jump to 175 CONB 56 COM7 JG 178 LOADA 129 // f=f*a;9 LOADB 12810 MUL11 SAVEC 12912 LOADA 128 // a=a+1;13 CONB 114 ADD15 SAVEC 12816 JUMP 4 // loop back to if17 STOP

ROM

So now the question is, "How do all of these instructions look in ROM?" Each of these assembly language instructions must be represented by a binary number. For the sake of simplicity, let's assume each assembly language instruction is given a unique number, like this:
  • LOADA - 1
  • LOADB - 2
  • CONB - 3
  • SAVEB - 4
  • SAVEC mem - 5
  • ADD - 6
  • SUB - 7
  • MUL - 8
  • DIV - 9
  • COM - 10
  • JUMP addr - 11
  • JEQ addr - 12
  • JNEQ addr - 13
  • JG addr - 14
  • JGE addr - 15
  • JL addr - 16
  • JLE addr - 17
  • STOP - 18
The numbers are known as opcodes. In ROM, our little program would look like this:
// Assume a is at address 128// Assume F is at address 129Addr opcode/value0 3 // CONB 11 12 4 // SAVEB 1283 1284 3 // CONB 15 16 4 // SAVEB 1297 1298 1 // LOADA 1289 12810 3 // CONB 511 512 10 // COM13 14 // JG 1714 3115 1 // LOADA 12916 12917 2 // LOADB 12818 12819 8 // MUL20 5 // SAVEC 12921 12922 1 // LOADA 12823 12824 3 // CONB 125 126 6 // ADD27 5 // SAVEC 12828 12829 11 // JUMP 430 831 18 // STOP
You can see that seven lines of C code became 18 lines of assembly language, and that became 32 bytes in ROM.

Decoding

The instruction decoder needs to turn each of the opcodes into a set of signals that drive the different components inside the microprocessor. Let's take the ADD instruction as an example and look at what it needs to do:
  1. During the first clock cycle, we need to actually load the instruction. Therefore the instruction decoder needs to: activate the tri-state buffer for the program counter activate the RD line activate the data-in tri-state buffer latch the instruction into the instruction register
  2. During the second clock cycle, the ADD instruction is decoded. It needs to do very little: set the operation of the ALU to addition latch the output of the ALU into the C register
  3. During the third clock cycle, the program counter is incremented (in theory this could be overlapped into the second clock cycle).
Every instruction can be broken down as a set of sequenced operations like these that manipulate the components of the microprocessor in the proper order. Some instructions, like this ADD instruction, might take two or three clock cycles. Others might take five or six clock cycles.

Microprocessor Performance and Trends

The number of transistors available has a huge effect on the performance of a processor. As seen earlier, a typical instruction in a processor like an 8088 took 15 clock cycles to execute. Because of the design of the multiplier, it took approximately 80 cycles just to do one 16-bit multiplication on the 8088. With more transistors, much more powerful multipliers capable of single-cycle speeds become possible.
More transistors also allow for a technology called pipelining. In a pipelined architecture, instruction execution overlaps. So even though it might take five clock cycles to execute each instruction, there can be five instructions in various stages of execution simultaneously. That way it looks like one instruction completes every clock cycle.
Many modern processors have multiple instruction decoders, each with its own pipeline. This allows for multiple instruction streams, which means that more than one instruction can complete during each clock cycle. This technique can be quite complex to implement, so it takes lots of transistors.

Trends

The trend in processor design has primarily been toward full 32-bit ALUs with fast floating point processors built in and pipelined execution with multiple instruction streams. The newest thing in processor design is 64-bit ALUs, and people are expected to have these processors in their home PCs in the next decade. There has also been a tendency toward special instructions (like the MMX instructions) that make certain operations particularly efficient, and the addition of hardware virtual memory support and L1 caching on the processor chip. All of these trends push up the transistor count, leading to the multi-million transistor powerhouses available today. These processors can execute about one billion instructions per second!


64-bit Microprocessors

Sixty-four-bit processors have been with us since 1992, and in the 21st century they have started to become mainstream. Both Intel and AMD have introduced 64-bit chips, and the Mac G5 sports a 64-bit processor. Sixty-four-bit processors have 64-bit ALUs, 64-bit registers, 64-bit buses and so on.
One reason why the world needs 64-bit processors is because of their enlarged address spaces. Thirty-two-bit chips are often constrained to a maximum of 2 GB or 4 GB of RAM access. That sounds like a lot, given that most home computers currently use only 256 MB to 512 MB of RAM. However, a 4-GB limit can be a severe problem for server machines and machines running large databases. And even home machines will start bumping up against the 2 GB or 4 GB limit pretty soon if current trends continue. A 64-bit chip has none of these constraints because a 64-bit RAM address space is essentially infinite for the foreseeable future -- 2^64 bytes of RAM is something on the order of a billion gigabytes of RAM.
With a 64-bit address bus and wide, high-speed data buses on the motherboard, 64-bit machines also offer faster I/O (input/output) speeds to things like hard disk drives and video cards. These features can greatly increase system performance.
Servers can definitely benefit from 64 bits, but what about normal users? Beyond the RAM solution, it is not clear that a 64-bit chip offers "normal users" any real, tangible benefits at the moment. They can process data (very complex data features lots of real numbers) faster. People doing video editing and people doing photographic editing on very large images benefit from this kind of computing power. High-end games will also benefit, once they are re-coded to take advantage of 64-bit features. But the average user who is reading e-mail, browsing the Web and editing Word documents is not really using the processor in that way.
For more information on microprocessors and related topics, check out the links on the next page.
Read more ...

How do optical mice work?

Friday, 9 August 2013


 I­t appears that the venerable wheeled mouse is in danger of extinction. The now-preferred device for pointing and clicking is the optical mouse. ­
Developed by Agilent Technologies and introduced to the world in late 1999, the optical mouse actually uses a tiny camera to take 1,500 pictures every second. Able to work on almost any surface, the mouse has a small, red light-emitting diode (LED) that bounces light off that surface onto a complementary metal-oxide semiconductor (CMOS) sensor.




The CMOS sensor sends each image to a digital signal processor (DSP) for analysis. The DSP, operating at 18 MIPS (million instructions per second), is able to detect patterns in the images and see how those patterns have moved since the previous image. Based on the change in patterns over a sequence of images, the DSP determines how far the mouse has moved and sends the corresponding coordinates to the computer. The computer moves the cursor on the screen based on the coordinates received from the mouse. This happens hundreds of times each second, making the cursor appear to move very smoothly.
Optical mice have several benefits over wheeled mice:
  • No moving parts means less wear and a lower chance of failure.
  • There's no way for dirt to get inside the mouse and interfere with the tracking sensors.
  • Increased tracking resolution means smoother response.
  • They don't require a special surface, such as a mouse pad.
­ Although LED-based optical mice are fairly recent, another type of optical mouse has been around for over a decade. The original optical-mouse technology bounced a focused beam of light off a highly-reflective mouse pad onto a sensor. The mouse pad had a grid of dark lines. Each time the mouse was moved, the beam of light was interrupted by the grid. Whenever the light was interrupted, the sensor sent a signal to the computer and the cursor moved a corresponding amount. This kind of optical mouse was difficult to use, requiring that you hold it at precisely the right angle to ensure that the light beam and sensor aligned. Also, damage to or loss of the mouse pad rendered the mouse useless until a replacement pad was purchased. Today's LED-based optical mice are far more user-friendly and reliable.
Read more ...

How do optical mice work?

Friday, 9 August 2013


 I­t appears that the venerable wheeled mouse is in danger of extinction. The now-preferred device for pointing and clicking is the optical mouse. ­
Developed by Agilent Technologies and introduced to the world in late 1999, the optical mouse actually uses a tiny camera to take 1,500 pictures every second. Able to work on almost any surface, the mouse has a small, red light-emitting diode (LED) that bounces light off that surface onto a complementary metal-oxide semiconductor (CMOS) sensor.




The CMOS sensor sends each image to a digital signal processor (DSP) for analysis. The DSP, operating at 18 MIPS (million instructions per second), is able to detect patterns in the images and see how those patterns have moved since the previous image. Based on the change in patterns over a sequence of images, the DSP determines how far the mouse has moved and sends the corresponding coordinates to the computer. The computer moves the cursor on the screen based on the coordinates received from the mouse. This happens hundreds of times each second, making the cursor appear to move very smoothly.
Optical mice have several benefits over wheeled mice:
  • No moving parts means less wear and a lower chance of failure.
  • There's no way for dirt to get inside the mouse and interfere with the tracking sensors.
  • Increased tracking resolution means smoother response.
  • They don't require a special surface, such as a mouse pad.
­ Although LED-based optical mice are fairly recent, another type of optical mouse has been around for over a decade. The original optical-mouse technology bounced a focused beam of light off a highly-reflective mouse pad onto a sensor. The mouse pad had a grid of dark lines. Each time the mouse was moved, the beam of light was interrupted by the grid. Whenever the light was interrupted, the sensor sent a signal to the computer and the cursor moved a corresponding amount. This kind of optical mouse was difficult to use, requiring that you hold it at precisely the right angle to ensure that the light beam and sensor aligned. Also, damage to or loss of the mouse pad rendered the mouse useless until a replacement pad was purchased. Today's LED-based optical mice are far more user-friendly and reliable.
Read more ...