INTRODUCTION TO DIGITAL ELECTRONICS
The difference between digital and analogue electronics is in the nature
of the signals that are being processed. Analogue signals can contain
any value from the lowest to the highest in the range, and vary smoothly
from one value to the next.
An example of an analogue quantity is temperature as displayed on a
mercury thermometer. The position of the top of the mercury column,
within the glass tube, indicates the temperature. The accuracy of
measurement can be improved by magnifying the image of the mercury
column to allow its position to be measured with greater precision. A
digital thermometer is limited in accuracy, however, to size of the
quanta, or range analogue values, being used as the smallest unit of
measurement. For example, if the digital values change at half degree
intervals, then that is the limit of accuracy of that device.
The conversion from analogue to digital signal involves the dividing up
of the total analogue range of values into sections, with each section
being given a number. If there are only two numbers being used, say 0
and 1, then the range can only be divided into two sections. The value
at which the number changes from 0 to 1, the "threshold", would be set
at half the maximum value, normally. Below this level would be given
the number 0, and above 1.
Some electronic components are naturally digital, for example a simple
switch. This device has two states, ON or OFF, and can be used to give
a digital voltage in the following way.
In position 1, the output is connected, via a resistor, to the +5 Volt
supply. In the 0 position it is connected to 0 Volts. This resistor is
called a "pull-up" resistor because it "pulls up" the output to +5 Volts
when the switch is in the 1 position. Obviously if whatever is connected
to the output draws current, then voltage will be "dropped" across the
resistor, and the output will be less than +5 Volts. Normally this
current is arranged to be small so that the 1 level is very much higher
than the half maximum voltage point 0f 2.5 Volts.
A number base is the number of separate symbols used in a counting
system. Take Decimal, the system with which we are most familiar,
known as base 10. There are only ten symbols used, 0, 1, 2, 3, 4, 5, 6,
7, 8 and 9. If 1 is added to 9 the result is 10. This is actually a
process of 1 + 9 = 0, i.e. back to the start of the symbols, and "carry"
1 to the next position or "place". These "places" have values according
their position, as in thousands, hundreds, tens and units for the first
four places of the decimal system. The example below shows how the place
values can be calculated, using the column number as the power to which
the number base is raised, starting at zero.
2 1 0
10 = 10 x 10 10 = 10 10 = 1
1 7 9
So 179 decimal actually means 1 x (10 x 10) + 7 x (10) + 9 x (1)
The binary system of base 2, on the other hand, has only two symbols, 0
and 1. If we add 1 to 1 we get 10, which is 1 + 1 = 0, i.e. back to the
start of the symbols, and "carry" 1 to the next position or "place".
2 1 0
2 = 2 x 2 2 = 2 2 = 1
1 1 0
So 110 binary actually means 1 x (2 x 2) + 1 x (2) + 0 x (1), i.e. 6 decimal.
The final number base that is used regularly in digital electronics is
Hexadecimal, or base 16, often called Hex. According to our earlier definition,
the number base is the number of separate symbols used in the counting system,
so we would expect 16. They are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 of the decimal
system and then A, B, C, D, E and F. So F must have the value of 15 decimal. If
we add 1 to F we get 10, which is 1 + F = 0, i.e. back to the start of the symbols,
and "carry" 1 to the next position or "place". The place values in this case are
16 to the power 0, 16 to the power 1, 16 to the power 2 etc., giving decimal
quantities of 1, 16, 256 etc.
2 1 0
16 = 16 x 16 16 = 16 16 = 1
4 D 9
So 4D9 hexadecimal means 4 x (16 x 16) + 13 x (16) + 9 x (1), i.e. 4 x256
+ 13 x 16 + 9 = 1024 + 208 + 9 = 1241 decimal.
A table showing Hexadecimal, Decimal and 4 bit Binary equivalents.
HEXADECIMAL DECIMAL BINARY
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
DECIMAL arithmetic is, like all arithmetic, based on place values as
noted above. We are so use to the operations in this base that we are
not often aware of it. The same system is used in BINARY arithmetic as
the following example will show.
DECIMAL 34 +
27
--
carry 1
--
61
BINARY 11 +
10
--
carry 1
---
101
****CHECK**** 11 binary = 3 and 10 binary = 2, so 3 + 2 = 5 and 101 is
binary equivalent of 5.
The binary system looks extremely tedious compared to the "normal"
decimal system, but as we shall see later, the construction of digital
circuits to work in binary is much simpler than trying to work in base
ten. The extra work caused by all the extra digits needed to code numbers
is offset by the extremely fast speed at which these devices can be made
to operate.
The key to converting between the number bases is to remember how they
are "encoded" using the number bases. Conversions from BINARY to DECIMAL
and from HEXADECIMAL to DECIMAL can both be achieved using place values.
The conversion between HEADECIMAL and BINARY uses the table of equivalents
shown above. Remember the BINARY column is just a four bit count from
0000 to 1111.
Each HEXADECIMAL digit is replaced with its equivalent 4 bit BINARY
value, as in this next example.
Convert AD hexadecimal to binary.
A = 1010 and D = 1101, so AD must be 10101101.
The reverse, conversion from BINARY to HEXADECIMAL, uses the table in
a similar way, but this time groups of 4 BINARY digits are converted to
the equivalent HEXADECIMAL digit, as in the next example.
Convert 110111101 binary to hexadecimal.
First group binary digits into 4's from the right, 1/1011/1101, now add
extra 0's to the left hand side to make a complete 4 bit value.
This makes 0001/1011/1101, and can be converted as follows. 0001 = 1,
1011 = B and 1101 = D giving the result that 110111101 binary is 1BD
in hexadecimal.
Here are some examples to try for next time.
- (a) AD13 HEXADECIMAL to DECIMAL.
- (b) AD1C HEXADECIMAL to BINARY.
- (c) 0111011 BINARY to HEXADECIMAL.
- (d) 1001110 BINARY to DECIMAL.
The solutions to the above examples are HERE