Binary Keyboard Mouse Notes
Binary Keyboard Mouse Notes
100 10 1
1 2 3
4 2 1
0 0 0
4 2 1
0 0 0
o We have 4 x 0 + 2 x 0 + 1 x 1 = 0 + 0 + 1 = 1
How do we represent the decimal number 2 in binary?
o We don’t need a 4, be we need a 2, and also no 1
4 2 1
0 1 0
o This gives us 4 x 0 + 2 x 1 + 1 x 0 = 0 + 2 + 0 = 2
Likewise, the number 3 would be:
4 2 1
0 1 1
o As we need a 2 and a 1
o Thus, 4 x 0 + 2 x 1 + 1 x 1 = 0 + 2 + 1 = 3
Similarly, 4 would be:
4 2 1
1 0 0
What about 7?
4 2 1
1 1 1
o Which yields 4 x 1 + 2 x 1 + 1 x 1 = 4 + 2 + 1 = 7
What about 8?
o We can’t count to 8 without another bit (binary digit)
We run into this in the real world too if we need a four-digit number vs
a 3-digit number
Start with the 1s, 10s, 100s place and add the 1000s
Here we’ll add the next power of 2, 8
8 4 2 1
1 0 0 0
8x1+4x0+2x0+1x0=8
Even though computers only use binary, they can count as high as humans can!
o They do it with a smaller vocabulary, just 1 and 0.
This is because it’s easier to represent two states in the physical world
If you think of one of these bits as being a light bulb:
0 is off
1 is on
Light bulbs just need electricity to turn on or off
Electricity is sufficient to turn a switch on or off
Inside a computer exists these switches called
transistors
Modern computers have billions!
Turned off represents 0
Turned on represents 1
Using these transistors we can store values, store data, compute, and do everything we
can with computers
So far all that we can represent is numbers
o A decision needs to be made on what pattern of 1s and 0s to represent letters,
words, and paragraphs
o All computers can store is 0s and 1s
o To represent letters, we need a mapping of 0s and 1s to characters
ASCII (American Standard Code for Information Interchange) does
this
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 1
1 x 64 + 1 x 8 1 x 64 + 1 x 8 + 1 x 1
72 73
H I
A voltage is passed through the column connectors (one at a time) of the keyboard
matrix scanner. When a key is pressed on a keyboard, it presses a switch, completing
the circuit and allowing a tiny amount of current to flow through.
When the keyboard controller finds a circuit that is closed, it reads the location of that
circuit on the key matrix and looks for the corresponding character in the character
map in its read-only memory (ROM). A character map is basically a comparison chart
or lookup table. The ASCII value of that character is then sent to the processor.
The LED installed at the bottom of the mouse emits a bright light in the downward direction.
Since a mouse is usually used on plain surfaces, the light bounces back from the surface and
enters a photocell which is also mounted on the bottom, almost next to the LED. This photocell
has a frontal lens that magnifies any light reaching it. As you move the mouse around, the
pattern of the reflected beam changes; this is then used by the light-detector chip to figure out
how and in which direction you’re moving the mouse.