##
Bits and Bytes

####
What is a "bit"?

A bit is the smallest possible piece of information. If you have
heard someone say that "everything in the computer is all one's and zero's,"
they are actually referring to bits. __A bit can have only two possible
states: 1 or 0.__ As humans, we may find it useful to think of
this in terms of "yes or no," "true or false," "on or off," and so
on. They all mean the same thing. * The key is that there
are only two possibilities, and nothing in between.*

####
What is a "byte"?

Although a single bit can have only one of two possible values, by gathering
groups of bits together, we can make much more complicated (and interesting)
information. A byte is simply a group of 8 bits. How many different
possible values can a byte have? There turns out to be a simple
way of calculating this:

1 bit --> 2^1 = 2 different possible values

2 bits --> 2^2 (2x2) = 4 different possible values

3 bits --> 2^3 (2x2x2) = 8 different possible
values

...

__8 bits (one byte) --> 2^8 (2x2x2x2x2x2x2x2) = 256
possibilities__
So now we have a useful "chunk" of information: a byte, which
can have 256 different values. All bytes are composed of 8 bits,
and each bit is either a 0 or a 1.

####
But what does all this have to do with the real world?

Remember that "0 or 1" can mean "off or on"-- and it turns out that the
way computers actually use zero's and one's is by turning on and off tiny
amounts of electricity. If no electricity (voltage) is present, this
means "0," and if the electricity is on (a small voltage), this means "1."
We can easily send a group of 8 of these small electrical signals (bits)
to 8 wires coming out of the parallel port, by sending a byte of information
to the port. From there, it is an easy task to amplify the tiny signals
so that they can turn on and off any electrical device.

####
How do we send a byte to the parallel port?

We do this using the same tool used to tell the computer to do everything
it does-- we write a program. This sounds like it might be difficult,
but is actually very easy. We need only a single command in BASIC
to turn any combination of our 8 wires on or off. In the next section,
we'll learn about that command.

next-- the parallel port

home

######

######
Copyright © 2000 Bruce Shapiro