Menu

Monday 2 February 2015

Introduction To Digital Electronics and Logic (Chapter 1)

1.1 Analogue and Digital Systems.

All physical quantities that we deal with in our day-to-day lives can be represented numerically in two ways; Analogue and Digital form.
Analogue1 expresses numerical values of quantities as a continuous range of values between the two expected extreme values. For example, the temperature of an oven settable anywhere from 0-1000C may be measured to be 650C, 64.960C, 64.9580C or even 64.95790C and so on, depending upon the accuracy of the measuring instruments. Similarly, voltage across a certain component in an electronic circuit may be measured as 6.5V or 6.4869V.  The underlying concept in this mode of representation is that variation in the numerical value of the quantity is continuous and could have any infinite theoretically possible values between the two extremes.
Digital2 on the other hand represents numerical values of the quantity in steps of discrete values. The numerical values are mostly represented using binary numbers. For example, the temperature of the oven may be represented in steps of 10C as 640C, 650C, 660C and so on.
All of electronics are broadly divided into these two categories, one of the most familiar examples of the difference between analogue and digital device is depicted in a clock.
On analogue clock, the time is represented by hands that spin around a dial and point to a location on the dial that represents the appropriate time. On a digital clock, a numeric display indicates the exact time.
In digital electronics, quantities are counted rather than measured. There is an important distinction between counting and measuring. When you count something, you get exact result. When you measure something, you get an appropriate result.
For an illustration; lets consider a cake recipe that calls for 2 cups of flour, 1 cup of milk, and 2 eggs. To get 2 cups of flour, you scoop some flour in a 1-cup measuring cup, pour the flour into the bowl and then do it again. To get a cup of milk, you pour milk into a liquid measuring cup until the top of the milk lines up with the 1-cup line mark on the measuring cup and then pour the milk into the mixing bowl. To get 2 eggs, you count out 2 eggs crack them open, and add them to the mixing bowl.
The measurement for flow and milk in the recipe are approximated. A teaspoon too much or too little won’t affect the outcome. But the eggs are precisely counted exactly 2, not 3, not 1 or 11/2, but 2. You can’t have a teaspoon too many or too few of eggs. There are exactly two eggs because you count them. This depict that digital circuits/system tends to be more accurate in operations.   



Table 1.1:  Analogue versus Digital Comparison chart


Analogue
Digital
Signal
Analogue signal is a continuous signal which represents physical measurement
Digital signals are discrete time signals, generated by digital modulation
Representation
Uses continuous ranges of values to represent information
Uses discrete or discontinuous values to represent information
Example
Human voices in air, analogue measuring devices
Computers, CDs, DVDs, and other digital electronic devices
Technology
Analogue technology records waveforms as they are
Samples analogue waveforms into a limited set of number and record them.
Data Transmissions
Subjected to deterioration by noise during transmission and write/read cycle.
Can be noise-immune without deterioration during transmission and write/read cycle.
Response to Noise
More likely to get affected reducing accuracy
Less affected since noise response are analogue in nature
Flexibility
Analogue hardware is not flexible
Digital hardware is flexible in implementation
Uses
Can be used in analogue devices only. Best suited for audio and video transmission.
Best suited for computing data storage and processing.
Applications
Thermometer
Personal Computers(PCs) , Personal Digital Assistant (PDA)
Memory
Stored in the form of wave signal
Stored in the form of binary bits
Power
Analogue Instrument draws large power
Digital instrument draws only negligible power
Errors
Prone to considerable observation errors
Digital Instrument are free from observation errors like parallax and approximation error.


1.2       Number Systems


Data has to be represented in meaningful numbers before processing can be carried out on them by digital systems. Number systems are simply ways to count things and its concept is a very important topic in digital electronics as it discusses how data can be represented in different number systems.

Different characteristics that define a number system include;

i.                    The number of independent digits used in the number system,

ii.                  The place value of the different digits constituting the number,

iii.                The maximum number that can be written with the given number of digits.

Among the three characteristics parameters, the most fundamental is the number of independent digits or symbols used in the number system. It is known as radix/base of the system.

Let us start the discussion on number system with the decimal System which is most familiar to human but not important from the viewpoint of digital electronics. Since it is the human that build and uses the computer, we will briefly discuss the decimal system and use its concept to explain the basic concept of other number systems which are commonly employed in digital electronics such as the binary, octal and hexadecimal number systems.



1.2.1 Decimal Number System

The decimal number system is a radix/base ten (10) number system and thus has ten different digits or symbols. These are;  {“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”}. All other numeric representation in decimal uses different combinations of these ten symbols.

Place values of different digits in a mixed number can be described as bellow;


Hundreds
Tens
Ones
Decimal point
Tenths
Hundredths
102
101
100
.
10-1
10-2
4
6
2

1
5


The value of this number is calculated as:
 4*102 = 4*100  = 400
6*101  = 6*10    =   60
2*100  = 2*1      =     2
1*10-1 = 1*0.1   =     0. 1
5*10-2 = 5*0.01 =  + 0. 0 5
                                 462.15

1.2.2 Binary Number System
The binary number system is a radix/base two (2) number system with symbol {0, 1} as the only two independent symbols. Any numerical value can be represented in binary number system with combinations of these two symbols.
e.g 210 ≡ (1 0)2, 310 ≡ (1 1)2, 1510 ≡ (1 1 1 1)2  and so on.

The place value in digits in binary numbers system is as described in the case of decimal; i.e.
 













As logic operation is the backbone of digital electronics, although solving a problem on computer could involve arithmetic operation too. Binary number system is advantageous in this context by the introduction of mathematics of logic by George Boole that laid the foundation for the modern digital computer. He reduced the mathematics of logic to a binary notation of “0” and 1”.
As the mathematics of logic was well established and had proved itself to be quite useful in solving all kinds of logical problem, and also the mathematics of logic (also known as Boolean algebra) had been reduced to a binary notation, the binary number system had a clear edge over other number systems for use in computer systems.
Yet another significant advantage of this number system was that all kinds of data could be conveniently represented in terms of “0s” and “1s”. Also, basic electronic devices used for hardware implementation could conveniently and efficiently be operated in two distinctly different modes for example, a switch can be “off” or “on”, and a bipolar transistor could be operated either in “cut-off” or in “saturation”.
Lastly on the advantages of binary number system, the circuit required for performing arithmetic operation such as addition, subtraction, multiplication, division, e.t.c., become a simple affair when the data involved are represented in the form of “0’s” and “1’s” only.
Digits of data/values presented in a binary system are called bits. For example 1 bit representation in binary can either be “0” or “1”.  Data of four bits is known as a nibble e.g. “1010”, 8 bits of data is called byte and depending of the computer or digital system architecture 16-bit, 32-bit or 64-bit is called a word.


1.2.3 Octal Number System

The octal, or radix/base 8, number system is a common system used with computers because of its relationship with the binary system; it is useful in programming some types of computers.

Being a radix/base 8 number system it has eight independent symbols to represent any value i.e. {“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”}. 


Place values of digits in the system are similar to that of decimal and binary;

  









1.2.3 Hexadecimal Number System
One main disadvantage of binary number is that the binary string equivalent of a large decimal (base 10) number can be quite long. When working with large digital systems, such as computers. It is common to find binary numbers consisting of 8, 16 and even 32 digits which makes it difficult to both read and write without producing errors especially when working with lots of 16 or 32-bit binary numbers.
One common way of overcoming this problem is to arrange the binary numbers into groups or sets of four bits (4-bits). These groups of 4-bits uses another type of numbering system also commonly used in computer and digital system called Hexadecimal Numbers.
The hexadecimal or simple “Hex” numbering system is a radix/base 16 number system and thus has 16 symbols to represent any variable value in the system, these symbols are; {“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “A”, “B”, “C”, “D”, “E”, “F”}. 
Hex number system provides a condensed way of representing large binary numbers store and processes them in the computer. Example of this is in representing addresses of different memory locations.
For example, a machine having 63Kb of memory has approximately (216 = 65536) memory locations and needs 65, 536 different addresses. These addresses can be designated as 0 – 65, 533 in the decimal number system and  00000000 00000000 – 11111111 11111111 in binary number system. Since the decimal number system is not useable in computers and the binary number shown here appears too cumbersome and inconvenient to handle.
In hexadecimal number system, the different addresses described in the example can be expressed with four digits from 0000 – FFFF. This representation is simpler and a better option.


1.2.4   Conversion from Other bases ( i.e. 2, 8, 16) to decimal
Representation of a number in different radix/bases are said to be equivalent if they have the same decimal representation.
For example, 00118 ≡ 10012, because both are equivalent to 910.
The conversion of number from any base to decimal is done by expanding the number in a power series and adding all the terms.

Binary-to-Decimal Conversion
Converting a number from binary to decimal is quite easy. All that is required is to find the decimal value of each binary digit position and multiply with the digit i.e. “1” or “0” and add then up.
Let’s illustrate this with some examples;

Example 1;  Convert 101102 to decimal (i.e. base 10).
 







=  1*24 + 0*23 + 1*22 + 1* 21 + 0*20 
 =   16 + 0 + 4 + 2 + 0  =  2210
           
Example 2:  Convert 1101.0102 to decimal








 

=  1*23 + 1*22 + 0*21 + 1*20 + 0*2-1 + 1*2-2 + 0*2-3

=  8 + 4 + 0 + 1 + 0 + ¼ + 0  =   13 + 0.25  = 13.2510



Octal-to-Decimal Conversion

Similar to the steps carried out in binary-to-decimal conversion, we can likewise convert an octal number to decimal, let’s illustrate with examples.


Example 3:  Convert 17638 to decimal.
           
             = 1*83 + 7*82 + 6*81 + 3*80 
            = 512 + 448 + 48 + 3
            = 101110

Example 4:  127.7328 to decimal

            = 1*82 + 2*81 + 7*80 + 7*8-1 + 3*8-2 +2*8-3
            =  64 + 16 + 7 + 7/8 + 3/64 + 2/512
            = 87 +  0.875 +  0.046875 + 0.0039
            = 87 +  0.926 = 87.92610


Hexadecimal-to-Decimal Conversion

Example 5: Convert F 1 A16 to decimal

= 15*162 + 1*161 + 10*160
            = 3840 + 16 + 10 = 386610

Example 6:  Convert C28.F1A16 to decimal
            = 12*162 + 2*161 + 8*160 + 15*16-1 + 1*16-2 + 10*16-3
            = 3072 + 32 + 8 + 0.9375 + 0.0039 + 0.00244
            = 3112.9438

1.2.5 Conversion from Decimal-to-binary
To convert decimal numbers to binary the integer and fractional part are treated separately. For the integer parts the binary equivalent can be found by successively dividing the integer part of the number by 2 and recording the remainder until the quotient becomes “0”.
The remainder written in reverse order constitute the binary equivalent.
For fractional part, it is found by successively multiplying the fractional part of the decimal number by 2 and recording the carry until the result of multiplication is ‘0’.
The carry sequence written in forward order constitutes the binary equivalent of the fractional part of the decimal number. If the result of multiplication does not seem to be heading towards zero in the case of the fractional part, the process may be continued only until the requisite number of equivalent bits has been obtained.
 
Example 7:
            Convert 13.37510 to binary.



Integer part => 13

            Divisor            Dividend                     Remainder
2                                            13                               
2                      6                                  1
2                      3                                  0
2                      1                                  1
-                       0                                  1

            1 1 0 12
 Note: That the answer (i.e. remainder) is read from down-up for the integer part, while answer (i.e. the carry) for the fractional part is read up-down.
Fractional part =>
            0.375*2  =  0.75          C         0
            0.75*2    =  1.5            C         1
            0.5*2     =  1.0             C         1

            0.011

Answer:  13.37510  =  1101.0112

Example 8:

            Convert 41.687510 to binary.

Integer part =>  41

           

            Divisor            Dividend                     Remainder

2                                            41                                -

2                                            20                                1

2                                            10                                0

2                                            5                                  0

2                                            2                                  1
2                                            1                                  0
 0                                  1


1010012
 

0.6875*2 =  1.375       C         1
0.375*2   =  0.75         C         0
0.75*2     =  1.5           C         1
0.5*2       =  1.0           C         1

Answer=>  101001.10112

The value of decimal number that can be represented by N bits of binary is given by; 0 - (2N-1), that is, for example, a 3 bit binary can only represent decimal number
  0 -   (23 – 1) =  0 – (8-1) = 0 - 7


Decimal-to-Octal Conversion
Converting decimal-to-octal is similar to that of decimal-to-binary conversion. The progressive division in the case of the integer part and the progressive multiplication while working on the fractional part will be by “8” which is the radix of the octal number system.

Example 9: 
Convert 73.7510 to octal.
 
Fractional part =>  0.75
         0.75*8 = 6.0    C   6
                 =    6
73.7510 = 111.68

Example 10:
Convert 153.51310 to octal

Integer part =>  153

            Divisor                        Dividend                     Remainder
            8                                  153                              -
            8                                  19                                1
            8                                  2                                  3
            -                                   0                                  2

Fractional part => 0.513

0.513*8  =  4.104        C         4
0.104*8  =  0.832        C         0
0.832*8  =  6.656        C         6
0.656*8  =  5.248        C         5
0.248*8  =  1.948        C         1
0.948*8  =  7.872        C         7 ..

Answer: 153.51310  =>  231.406517…8

Decimal-to-Hexadecimal Conversion
With the same procedure as described above, we can convert decimal numbers to hexadecimal.

Example 11:
Convert 82.2510 to hexadecimal

Integer part => 82

Divisor                        Dividend                     Remainder
16                                82                                -
16                                5                                  2
-                                   0                                  5

0.25*16 =  4.0             C         4      
      0

Answer:   52.416         
 


Binary-to-Octal and Octal-to-binary
An octal number can be converted into its binary equivalent by replacing each octal digit with its three bit binary equivalent.
                       
Decimal
Binary
0
000
1
001
2
010
3
011
4
100
5
101
6
110
7
111

Octal-to-Binary

Example 12:
Convert 374.268 to binary
           
             3     7     4    .    2     6
          (011 111 100  .  010 110)2

Example 13:
Convert 15.38 to binary
            1     5    .   3
          001 101    0112

Binary-to-Octal

Example 14:
Convert 1110100.0101102 to binary.

001 110 100 . 010 110
               1    6     4   .   2     6

Answer:  1110100.0101102 =  164.268

Example 15: 
Convert 10011100.012 to binary.

             010  011  100  .  010
               2      3      4    .    2

Answer: 10011100.012 =  234.28
Hexadecimal-to-binary and Binary-to-Hexadecimal Conversion
Hexadecimal number can be converted into its binary equivalent by replacing each hex digit with its four-bit binary equivalent. We take the four-bit equivalent because the base of the hexadecimal number system is 16 and it is the fourth power of the base of the binary number system.
All we have then to remember is the four-bit binary equivalents of the basic digits of the hexadecimal number system. A given binary number can be converted into an equivalent hexadecimal number by splitting the integer and fractional parts into groups of four-bits, starting from the binary point on both sides. The ‘0s’ can be added to complete the outside groups if needed.
           
Decimal
Binary
0
0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001
A
1010
B
1011
C
1100
D
1101
E
1110
F
1111


Hexadecimal-to-binary
Example 16:
            Convert 17E.F616 to binary.
           
            1       7       E    .    F      6
         0001 0111 1110   1111 01102

Answer:  17E.F616 =  000101111110111101102
Example 17:
            Convert CC8.E16 to binary.

            C       C        8    .    E
         1100  1100  1000    11102

Answer: CC8.E16 = 1101101000.11102

Binary-to-Hexadecimal
Example 18:
            Convert 1000011.10112 to hexadecimal.
           
            0100 0011 . 1011
               4       3    .   B

Answer:  1000011.10112 = 43.B16

Example 19: 
            Convert 111000001. 00001102 to hexadecimal

            0001 1100 0001 . 0000 1100
               1       C      1    .    0       C

Answer:  1C1.0C16




Exercise 1
1.a   List the octal and hexadecimal numbers from 16 to 32. Using A, B, and C for the last three digits, list the numbers from 8 to 30 in base 2 (binary).
  b.   What is the exact number of bits in a system that contains (i.) 32K bytes (ii.) 64M bytes and (iii.) 3.2G bytes.
  c.    Convert the following numbers with the indicated bases to decimal:
         (i)  (3723)8    (ii)  (10010)2   (ii) (C23.FE)16
         (iv.)  (712.65)8
  d.   What is the largest binary number that can be expressed with 24 bits? What are the equivalent decimal and hexadecimal number?
  e.    Determine the base/radix of the numbers in each case for the following operations to be correct:
         (i)  29 + 17 = 40    (ii) 7 + 6  = 15    (iii)  67 + 24 = 113
  f.    Covert the hexadecimal number AD54 to binary, and then convert it from binary to octal
  g.   Convert the decimal number 198 to binary in two ways: (a) convert directly to binary; (b) convert first to hexadecimal and then from hexadecimal to binary. Which method is faster?
  h.    Express the following numbers in decimal:
         (i)  (10110.0101)2         (ii)  (69.8)16     (ii)  (73.65)   (iv)  (1110.0101)2   (v)  (BEBE.C)16




Further Reading
1.  Anil K. Maini; Digital Electronics: Principles, Devices and Applications © 2007 John Wiley & Sons. Ltd. ISBN: 978-0-470-03214-5.
2.  M. Morris Mano and Michael D. Ciletti; Digital Design with An Introduction to the Verilog HDL Fifth Edition. ISBN- 13:978-0-13-277420-8, ISBN-10:  0-13-277420-8.
3.  https://www.utdallas.edu/~dodge/EE2310/lec2.pdf; The University of Texas at Dallas, Erik Jonsson School of Engineering and Computer Science.
 4.  http://www.ee.ic.ac.uk/pcheung/teaching/ee2_computing/NumSys2.pdf

Send Comments, Questions & Contributions to: tunji4physics2@gmail.com
To Book for a copy of my book "Introduction To Digital Electronics and Logic": send your name and matric number (for ND1 SLT 113) to tunji4physics2@gmail.com  







<b>1.2 Number Systems </b>

No comments:

Post a Comment

Please drop your comment here, thanks.