# An Introduction to Digital Logic

Topics: Binary numeral system, Decimal, Hexadecimal Pages: 40 (11822 words) Published: January 27, 2013
An Introduction to Digital Logic

Up until now the labs have dealt with electricity in its analog form where a quantity is described by the amount of voltage, or current, or charge... expressed as a real number. However a large proportion of electronic equipment, including computers, uses digital electronics where the quantities (usually voltage) are described by two states; on and off. These two states can also be represented by true and false, 1 and 0, and in most physical systems are represented by the voltages 5V and 0V, or something close to that. While the restriction to two states seems limiting it makes many things easier because problems due to noise are minimized. It is generally very easy to reliably distinguish between logic 1 or logic 0. Since many quantities cannot be represented by two states, more than one binary digit can be used to represent a number. For example the number 2510 (twenty five base 10) can be represented by the binary number 110012. It is easy to convert back and forth from binary to decimal by remembering that each digit in a binary number simply corresponds to a power of 2, as every digit in a decimal number corresponds to a power of 10. Using the previous example: 101| | 100| | 24| | 23| | 22| | 21| | 20|

(10)| | (1)| | (16)| | (8)| | (4)| | (2)| | (1)| 2| | 5| =| 1| | 1| | 0| | 0| | 1|
2*10| +| 5*1| =| 1*16| +| 1*8| +| 0*4| +| 0*2| +| 1*1| In general an n digit binary number can represent numbers from 0 to 2n-1. For instance a byte is 8 bits and can represent numbers from 0 to 255 (28-1).

Combinatorial Logic
Another advantage of digital electronics is the ability to express signals in terms of logic equations using standard terms from logic: and, or, and not. These functions can be represented by truth tables as shown below with A and B as inputs and C as output. and| | or| | not|

A| B| C| | A| B| C| | A| C|
0| 0| 0| | 0| 0| 0| | 0| 1|
0| 1| 0| | 0| 1| 1| | 1| 0|
1| 0| 0| | 1| 0| 1| | | |
1| 1| 1| | 1| 1| 1| | | |
These logic functions can be represented using a shorthand notation, and is represented by . or &, or is represented by + or #, and not is represented by ~ or ! (there are also other conventions, the most common is to put a bar over the variable). Thus the equation D equals A and B or not C can be represented as

D = A . B+ ˜C or by D = A & B # !C

Obviously this equation has different meanings depending on whether the and or the or function is performed first and parentheses can be used in the normal way to get rid of the ambiguity

D = (A . B)+ ˜C

Other functions that are common are nand and nor. The nand function is an and function followed by a not, nor is an or function followed by not. The symbols used in schematics for these functions are given below:

Logic equations, like any other, can get complicated quickly. To simplify logic equations a system called Boolean algebra (after the mathematician George Boole) was developed. A short selection of its theorems is listed. (1) A.0 = 0| (6) A+1 = 1| !A.!B| (11) (A.B).C = A.(B.C)| (2) A.1 = A| (7) A+� = 1| 1| (12) A.(B+C) = A.B+B.C| (3) A.� = 0| (8) A+A = A| 0| (13) A+(B.C)= (A+B).(A+C)| (4) A+0 = A| (9) A+B = B+A| 0| (14) !(A+B) = !A.!B|

(5) A.A = A| (10) (A+B)+C = A+(B+C)| 0| (15) !(A.B) = !A+!B|

Some of these rules are quite obvious.  For example if we make out the truth table for rule (1) we get: A| A.0|
0| 0|
1| 0|
Some of the other rules are not so obvious.  For example rule 14 yields the truth table shown below A| B| !A| !B|  | A+B| !(A+B)| !A.!B|
0| 0| 1| 1|  | 0| 1| 1|
0| 1| 1| 0|  | 1| 0| 0|
1| 0| 0| 1|  | 1| 0| 0|
1| 1| 0| 0|  | 1| 0| 0|
The truth table shows that rule 14, !(A+B) = !A.!B, is correct.

These theorems can be used to simplify equations. For example if we start...