An Introduction to Computer Bits for the
Newbie
I once heard someone describe a bit as the
smallest particle inside a computer, so let's get something straight, right
from the start. A bit is not a particle. A bit is "no-thing". A
bit is a digit - derived from the words, BInary digiT.
Binary means 2. The binary number system contains only two digits, 0 and 1.
Those digits are what we call bits. One bit, a 0 or a 1, is the
smallest unit of data a computer can work with. 0's and 1's are ALL your computer
can work with.. A computer does not understand our language.
Any data you input into your computer, whether
it be numbers, documents, graphics, sound, or video, has to be
translated into a language the computer understands which is the binary "language"
- base 2 arithmetic - nothing but zeros and ones. Your computer
is a number cruncher that is constantly doing binary calculations whenever
you use it. The binary system is the native language of your computer, often
referred to as machine language..
The idea to use binary in computers dates
back to the mid 1930's, but the idea for that idea dates back to
the mid 1800's to the time of English mathematician George Boole who
developed Boolean algebra, a system of logic that could be applied to elaborate
expressions (statements), proving them true or false and that fit perfectly
with the binary system. It took about
85 years before anyone got the idea to apply the logic to circuits -
that true or false could be replaced by on and off and 1 and 0. i.e.
“when A = 0, not A = 1, when A = 1, not A = 0”.
The first prototype computing device using
binary with Boolean logic was demonstrated in 1940 (by Professor John Atanasoff
and student Clifford Berry at Iowa State University) At that time, transistors
hadn't been invented yet, vacuum tubes were still being used but Boolean
algebra became a major guide in the development of every electronic computer
we know today. The outstanding feature of Boolean algebra that sets it apart
from other types of mathematics, is that it deals with expressions(statements),
not numbers or equations. Today, using Boolean is common in searching the
internet (and – not – or) which most computer users know, but less know
the important role Boolean played in the actual development of the computer. Good
old George, he was a brilliant self taught mathematician, but poor old George
too—he had an early and unfortunate death.
So, why binary? Why just zeros and ones? To understand that you need
to realize that a bit is a visual assignment to an electrical state. At its
core, your computer is nothing more than a vast collection of transistor switches—millions
of them compose your processor—your Central Processing Unit (CPU). For example
a Pentium 4 can have 42 million transistors. These micro transistors are constantly
being switched off and on, at incredible speeds, whenever you use your computer
.What determines how they are switched, is whatever software you are using.
Your program provides the set of instructions for the CPU to fetch and decode.
Now what does that have to do with bits? EVERYTHING.
Transistors are what give us our bits! A
single transistor can be in one of two electrical states. It can be off (open)
or it can on (closed). When current is flowing through it(voltage high)
it is ON. When current isn't flowing through it (voltage low), it is
OFF. We use 0 to represent OFF and 1 to represent ON.
0 = switch OFF , 1 = switch ON . i.e:, off-on-off-on-off-on-on-off
= 01010110 (the letter V) = 8 bits. It's a perfect match for the binary
system - simple and fast, since there's only 2 values to switch between,
as opposed to 10 (which was used in the early days of computing).
So, as you can see, a bit really is just
an assignment to an electrical or voltage condition and that a single
bit can be in one of two conditions (off or on). This represents the minimum
the computer can process or store and is what we mean when we define
a bit as the smallest unit of data a computer can work with.
Still a bit confused?
Let's use a simple analogy to make
the concept a "bit" more clear.
Think of the light switch on your wall.
Like a single transistor, it can only be in one of two states. On or off.
When you turn the switch on, current flows and the light turns ON. When
you flip the switch off, the current stops flowing and the light turns
OFF. You can think of those on and off states as bits. LIGHT ON=1 LIGHT OFF=0
Now imagine a huge billboard filled with
rows and rows of little lights each one having a separate switch and
you have a master switchbox to control them all. Each switch on the switchbox
is labeled 1 for ON and 0 for OFF. It's not hard to visualize that by
turning some switches on and some off, you might figure a combination to
display your name in lights. It would just be a light pattern
you formed by using off and on light switches which you represented
by 0s and 1's. You might then save that pattern—you could see what combination
of 0's and 1's formed your name—and perhaps make some shortcut combo switch
that would recall that light pattern with just one flip. Depending
on your intelligence, logic and electronics skills, there would
be a number of ways you could probably improve the functioning.
In the very crudest sense, you made
a computer (the worst computer ever built <lol>).
You can think of your keyboard as the switch
box, the switches themselves the transistors (your processor) and the
billboard your monitor. And working on any changes or improvements
would make you a computer programmer—your set of instructions telling the
machine what to do.
Also imagine if that was base 10 instead
of base 2. Having to put each light through 10 different settings to
find the right setting, surely would make the computer slower.
In a real computer, typing my name
VIC would have this bit pattern:
010101100100100101000011
That represents 24 bits—count them.
However, the only way the computer sees them is as electrical conditions.
off on off on off on on
off off on off off on off off on off on off off off off on on
In the light switch analogy, the 0's and
1's would represent the off and on positions needed to form VIC in lights.
A lot of bits for just 3 letters you might
be thinking.
But think about this—those 24 bits can be
rearranged to form a multitude of different patterns.
It might not seem apparent, but in fact, there are 16,777,216
unique possibilities with 24 bits! If that were a lottery ticket, your
odds of winning (getting the right combo of 24 digits) would be 1 in 16,777,216
(that's 16 MILLION....).
Obviously, the more bits you have the more
unique patterns you can form or the more instructions the computer can
process.
Let's start with a single bit. One
bit can't do very much.
As we already know, one bit can represent
only two values, 0 or 1
-
The bit can be off
-
The bit can be on
One transistor can perform
a 2 bit function. The light switch on your wall would be like one bit. It can
turn the light on or it can turn the light off. Nothing else.
With two bits, it would be like having
two light switches on your wall. Two bits can have 4 different values.
-
The first bit can be off
and the second bit on. (01)
-
The first bit can be on
and the second bit off. (10)
-
Both bits can be on. (11)
-
Both bits can be off.
(00)
The number of possible unique
values DOUBLES with EACH bit you add. (2 to the power)
It's an amazing exponential growth as you will see.
Therefore, 3 bits = 8 values. Now the
possibilities are:
- Off Off Off (000)
- Off Off On (001)
- Off On Off ( 010)
- Off On On ( 011)
- On Off Off (100)
- On Off On (101)
- On On Off (110)
- On On On (111)
4 bits = 16 values
5 bits = 32 values
6 bits = 64 values
7 bits = 128 values
8 bits = 256 values
We call a collection of 8 bits a byte and
it takes one byte to form one plain character(a number, letter or symbol).
If you count all the common printable
characters on your keyboard—26 lower case letters, 26 upper case letters,
10 numbers, and 32 punctuation keys—you come up with 94 keys. As you can see
from the bit values in the sample list above, 7 bits can have 128 unique values.
This is more than enough to display all those characters and others, and
in fact, 7 bits are enough to identify each character.
I.e., A= 1000001 (in your computer,
however, A is stored as 01000001 since 8 bits per character is the standard—read
on).
The binary values of all those keyboard
characters have been standardized into what is known as the ASCII code
(pronounced askey) which stands for American Standard Code for Information
Exchange, and each character has been assigned a decimal value to make it
easier for us to deal with the long binary values.
For example, A = 65 B=66, C=67,
D=68, and so on. Try it—open a text document and press ALT + 65
on the number pad of your keyboard (make sure to have the num lock on). It
should display the letter A. Of course, your computer only sees the binary
value, regardless if you press A directly or Alt + 65.
There are 128 characters( the complete number
of possibilities for 7 bits) in the Standard ASCII code (numbered 0
to 127). The first 32 codes represent non printable characters, many
of which are obsolete and no longer used. They date back to the days
of teletype terminals. ASCII was finalized in 1968, and in case you
are not aware, ASCII means plain text. When you hear the term "ASCII"
file, it just means a text file—plain and unformatted. ASCII is most commonly
used for transmitting data— as when you send a plain text email—and was actually
developed as a telecommunication standard.
Here's a chart I made to show you
the Standard (0 -127) ASCII character set, with their binary, hex and
decimal equivalents.
http://www.personal-computer-tutor.com/ascii.html
If you're observant, you will notice that
the chart shows 8, not 7 bits for each character. The reason for this is that
the ASCII code was later updated to an extended 8 bit set which is enough
for 256 characters. So a 0 value is usually added as the 8th bit.
For example, the character A in original
ASCII is 1000001, but you'll usually see it listed as 01000001. And
all the characters are stored in 8 bit (one byte) format in your computer.
You can see that too—open up Notepad,
type a single character and save. Then look at the File size in Properties.
That 0 bit also serves a function as an
error checking or parity bit during transmissions.
Now a bit more about this Extended ASCII Set. As I said, it's an 8 bit code
which is enough to encode 256, 8 bit characters—enough for the previous Standard
7 bit set with the extra 0 bit, and the extended characters which consist
of 128 special symbol characters that require the full 8 bits to identify.
So in total, there are 256 characters in the ASCII code (0 to 255).
However, the extended set is usually
shown separately. In other words we have the Standard set covering character
numbers 0 to 127 and an Extended set which covers character numbers 128 to
255. Also, the extended ASCII code is not a true standard in the sense that
different extended sets exist (using the same codes can give you different
characters depending on your computer), but the original was created
for the IBM PC and that's the most commonly known set. Here are a few of them,
most of which you can get in Windows by pressing Alt + the code or if that
doesn't work, use the code at an MS-Dos prompt.
128 = Ç 129 = ü 130 = é
131 = â 132 = ä 133 = à 134 = å 135 = ç 136 = ê 137 = ë 138 =
ê 139 = ï 140 = î 141 =ì 142 = Ä 143 = Å 144 = É 145 = æ 146 = Æ 147
= ô 148 = ö 149 = ò 150 = û 151 = ù 152 = ÿ 153 = Ö 154 = Ü 155
= ¢ 156 = £ 157 = ¥
To see the entire extended character set
along with decimal, hex and binary equivalents, see my extended ASCII page
here:
http://www.personal-computer-tutor.com/extended.htm
Hexadecimal Number System
Though the Decimal system is used for the
ascii code, it is not the best number system to represent binary values in
a computer. The hexadecimal system is much better and in fact, the most widely
used number system to represent binary values. Hex values are used not only
for characters, but for specifying colors, memory addresses, and in programming.
Also, If you play in the Windows registry at all, you are probably familiar
with class id (clsid) keys that follow this alpha numeric format—{441E9D47-9F52-11D6-9672-0080C88B3613}—which
are actually hex values. The source of program files are also commonly viewed
with in hex format with hex editors.
Hex stands for 6 and decimal stands for
10. Hexadecimal counts 0 to 9, and then A B C D E F Why hex you might
be asking? Because it's a compact and more logical and compatible
number system to use with binary. It's also easier to use than decimal for
mental math (but you would have to become fluent in it as you are in decimal
to know). Two hexadecimal digits neatly represent 8 bits:
Example:
00000010 = 41
01000010 = 42
01000011 = 43
One hexadecimal digit represents
one decimal digit.
You can easily confirm this:
Decimal .....
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B
C D E F
As you've learned, the highest number of
possibilities for 8 bits is 256 in DECIMAL (0 to 255)
In hex, this would translate to 00 to FF.
But still, whether you use 0 to 255, or
00 to FF, to your computer it's only binary bits: 00000000
to 11111111.
All conversions
are just man's attempt to make the binary system easier to work with.
As already mentioned, the ASCII code
only applies to plain unformatted text. It's what you use when you type a
plain text email or inside a notepad document. The one byte per character
does not apply to formatted characters such as rich text or html with
different font styles, colors and sizes. Such characters would naturally
require more than 8 bits and much more than 256 possibilities to show all
the variations possible with formatting. But, as we know, each single bit
added DOUBLES the unique values possible.
By just adding one more byte, which is made
up of 8 bits, the number of unique values jumps to 65,536!
That makes a character standard like
the 16 bit Unicode possible which can encode over 65,000 different
characters - enough to support almost every language. What a difference
a byte can make, eh?
So:
16 bits = unique
values = 2 bytes
32 bits = 4,294,967,296 unique values = 4 bytes
64 bits = 8,496,527,156,231,722 unique values = 8 bytes
Even 64 bits doesn't sound like much—only
8 bytes—the ASCII equivalent of ABCDEFGH, but the possible unique values are
mind boggling.
Because of this, computers are limited to
the number of bits they can handle at one time - 64 bits is the max, currently.
In binary that 64 bits making up the
string ABCDEFGH translates to:
0100000101000010010000110100010001000101010001100100011101001000
That shows the maximum number of bits that
can be processed at one time to calculate 8,496,527,156,231,722 possible unique
results.
And that's basically what is meant when
you hear of computers being referred to as 16 bit, 32 bit or 64 bit. The number
refers to how many bits the CPU can manipulate at one time or the amount of
data it can process per clock cycle.
If in a 32 bit processor, more than 32 bits
are needed for a job, the computer needs to do more math work breaking
down the numbers and recombining them.
For example, a 32 bit processor can add two
32 bit numbers at one time. For a 16 bit processor to do the same would
require two instructions instead of just one to come up with the same answer.
So that means the 32 bit processor can process
double the amount of data than a 16 bit processor can, in the same time (
twice as fast). Likewise, a 64 bit processor has the potential to do the job
twice as fast as a 32 bit one. The Apple Power Mac G-5 was the first widely
available 64 bit system for consumers. However, the majority of home
PC's today, are 32 bit, though it shouldn't be long before 64
bit becomes common.
Image quality is also measured by bit—by
bit depth—the number of bits used for one pixel.
The more bits per pixel, the higher the image quality. To make this
easy to understand, let's again begin with a single bit.
You now know that one bit can only be in
one of two states. But it's important to realize that the computer doesn't
care what you use to associate those off and on electrical states with. 0's
and 1's.can be Yes or No, True or False, Open or Close,
Black and White or whatever else. So with a one bit image, we can use Black
or White, Red or Blue, or any two colors, which means, all you can expect
with a one bit image is a monochrome image—a single solid color.
But add 7 more bits, and you have an 8 bit image—and as you've seen in the
ASCII section, 8 bits = 256 values. Again those values can be applied to anything
logical. So with an 8 bit image, we have an image capable of displaying 256
different colors.
A 16 bit image can have 65,536 color
variations.
A 24 bit image can have 16, 777,216 color variations (my name VIC, remember?)
Bit depth is also often specified with video
cards, i.e., 32 bit graphics which equates to
4,294,967,296 values and more than enough for realistic 3D rendering.
More bits per anything always equals better quality or performance. Same applies
to sound bits—when you hear of sound being referred to as 8 bit or 16 bit,
it refers to the sampling size. With 8 bits you can have 256 levels but with
16 bits you can have 65,536 levels. 16 bits also gives you double the dynamic
range of 8 bits. 16 bit is the CD standard. Even higher quality is DVD
audio which play 24 bit samples.
With sound cards, the bit specification
does not refer to sample size. For example, a 32 bit sound card does
not mean 32 bit sound quality!
Your CD quality remains 16 bits. 32
bits refers more to the performance of the card—the bit size of the
data path—how many bits can travel through at one time. For a 32 bit
card it's 4,294,967,296 bits (again, the maximum possibilities for 32
bits). For a 16 bit sound card, the path is 65,536 bits wide. In general,
this means the 32 bit card will play your music and sounds more smoothly.
What about bits in relation to memory and
hard drives?
In a nutshell, bits—0's and 1's
can be recorded (tape drives make this obvious). With RAM, the recording is
electrical and, as you know, when you turn off the power, the electricity
is gone, and thus so is the data in the RAM chips.
A hard drive on the other hand uses magnetism
to permanently record 0's and 1's. So the data remains.
With memory and hard drives, we are dealing
with holding and storage capacities only and we measure them in bytes.
1024 bytes = 1 kilobyte
|