| |
Bits and Bytes
The BIT
A bit is the name given to a single
piece of information representing a 0 or a 1. Because the bit is limited to only
two values (0 or 1) it is sometimes called a binary bit and it is the basis of
the binary number system.
Using 0's and 1's as building
blocks is the simplest design for computers as the 0 can be represented by a
negative voltage and the 1 can be represented by a positive voltage.
Because a single bit on its own is
not much use, computer designers group the bits together so that they represent
more useful numerical information. For example using one bit only two
combinations (0 and 1) can be constructed, but string two bits together and four
combinations (0,1,2 and 3) can be constructed, string three bits together and
eight combinations (0,1,2,3,4,5,6 and 7) can be constructed and so on.
In the following table, to
calculate the decimal value (in black after the = sign) of the binary number (
in blue and yellow): Add up the column headings (in gray) where the individual
bits = 1. As new bit is added to the left, its binary-position-value multiplies
by 2. This multiplication factor is where the binary number system gets its
name.
1 bit
|
2 bits
|
3 bits
|
4 bits
|
 |
 |
 |
 |
The BYTE
At the heart of all electronic,
digital computers is the CPU (Central Processing Unit). In the case of the
GM-ECM/PCM it is (usually) the Motorola 68hc11 or a derivative of the 68hc11
microprocessor.
A CPU's power is normally
determined by how many instructions it can execute (usually in the megahertz,
or millions of instructions per second range) and how much information it can
process during each cycle.
- An 8 bit microprocessor can
process 8 bits at a time (the 68hc11 is an 8-16Mhz, 8 bit processor).
- A 16 bit microprocessor can
process 8 or 16 bits at a time (the Intel 80286 is an 4-8Mhz, 16 bit
processor).
- A 32 bit microprocessor can
process 8, 16 or 32 bits at a time (the Intel Pentium is a 75-500Mhz, 32
bit processor).
- A 64 bit microprocessor can
process 8, 16, 32 or 64 bits at a time (the Hewlett Packard PA-RISC chip
is a 240-550Mhz, 64 bit processor).
As you can see the 68hc11 is one
of the least powerful computers available today but it still manages the
computations required for EFI with ease.
Just for interest, the 68hc11 is
a similar CPU to the 6510 which powered the (much loved) Commodore 64 and the
6502 which powered the Apple ][ and Apple //e series of computers.
Because the 68hc11 is an 8 bit
processor it processes bits in groups of 8. Extending the tables above we see
that with 8 bits, 256 different values can be represented. The actual formula
for determining the number of distinct values is 2^b, where b is the number of
bits. So for 8 bits the formula is 2^8 (2 to the power of 8) which is of
course 256. This is where the strange number 256 comes from. With 256
different values you can represent the numbers from 0 to 255. Just like with
10 digits you can represent the values form 0 to 9.
By far the most common grouping
of bits is groups of 8 called bytes (they are sometimes called octets, for the
obvious reason). Other common groupings are 4 bits called nybbles, 16 bits
called words, 32 bits called long words and 64 bits called various,
non-standard names because they aren't used that often (yet!).
Byte values are not restricted to
representing the values from 0 to 255, they could represent the values from
-128 to +127 which is still 256 different values, count them if you don't
believe it. When a byte represents the values from 0 to 255 it is called an
unsigned byte. When a byte represents the values from -128 to +127 it is
called a signed byte, because of the plus/minus sign at the front.
The WORD
Some values are just too large to
be represented by a single byte so the designers of the 68hc11 added
extensions that allow two bytes to be joined together to make a 16 bit word.
With a 16 bit word there are 2^16 = 65,536 different values that can be
represented. A word may be unsigned, representing the values from 0 to 65,535
or signed, representing the values from -32,768 to 32,767.
The following table summarises
bits, bytes and words.
Name |
Number of
bits |
Minimum |
Maximum |
Bit |
1
|
0
|
1
|
Byte |
8
|
0
|
255
|
Signed Byte |
8
|
-128
|
127
|
Word |
16
|
0
|
65,535
|
Signed Word |
16
|
-32,768
|
32,767
|
|