Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Binary Codes Digital systems use 2-state devices that understand only 2 binary values (0 and 1). But we communicate using various symbols and methods.

Similar presentations


Presentation on theme: "1 Binary Codes Digital systems use 2-state devices that understand only 2 binary values (0 and 1). But we communicate using various symbols and methods."— Presentation transcript:

1 1 Binary Codes Digital systems use 2-state devices that understand only 2 binary values (0 and 1). But we communicate using various symbols and methods. Codes are needed to allow us to communicate. Codes translate our language into the computers language and vice versa. Lecture #2 EGR 277 – Digital Logic Reading Assignment: Chapters 1 and 2 in Digital Design, 3 rd Edition by Mano How many bits are needed to encode a set of elements? In general, N bits are needed to encode up to 2 N elements N = log 2 (number of elements)

2 2 Lecture #2 EGR 277 – Digital Logic Examples: Determine the number of bits required and develop a code to encode each of the following: A) 8 symbols B) 10000 symbols C) the 366 days of the year in order D) the 366 days of the year using the month and day

3 3 byte – group of 8 bits word – an n-bit code forms n-bit words. In a computer system, a certain number of bytes may form a word. For example, a 16-bit system might refer to words as consisting of 2 bytes. Lecture #2 EGR 277 – Digital Logic Decimal Codes – codes used to encode the digits 0 – 9 Several examples are shown below (Table 1-5 from the text) The BCD code is the most common. Know the BCD code for tests. Other codes will be given if needed.

4 4 Lecture #2 EGR 277 – Digital Logic Gray Code The Gray code is a 4-bit binary code (different from a BCD code in that it encodes all 16 4-bit combinations, not just 10 combinations). This code is interesting in that successive code words only change by one bit. This code is sometimes used with stepper motors. Each time the code increases, only one bit changes, and the stepper motor turns a specified amount (angle).

5 5 Lecture #2 EGR 277 – Digital Logic Example: Show how a digital voltmeter would convert binary information into BCD format, including the use of binary-to-BCD converters and BCD-to-7- segment decoders. Application: BCD codes are routinely used on equipment to display numerical values. Digital circuits work in binary, but people prefer to read numbers in base 10, so BCD codes are used to convert the data to base 10.

6 6 Lecture #2 EGR 277 – Digital Logic Error Detection and Correction Codes Extra bits are often added to codewords (using sometimes complex schemes) so that when the word is transmitted, the received can detect if errors occurred in the transmission and possibly correct some of the errors. Parity – perhaps the simplest error detection code involves the addition of a parity bit Discuss even parity vs odd parity Example: Show a BCD code with a trailing odd parity bit. Error Correction Codes - Discuss. Example: Show a simple 2-bit code with extra bits added for error correction.

7 7 Lecture #2 EGR 277 – Digital Logic Alphanumeric codes Used to encode keyboard symbols and control characters. ASCII and EBCDIC codes are the most common alphanumeric codes. The ASCII code is shown below in Table 1-7 from the text. Since the ASCII code is a 7-bit code, a parity bit is commonly added. Example: Write the word “Digital” using an ASCII code with an even leading parity bit.

8 8 Lecture #2 EGR 277 – Digital Logic Chapter 2 - Boolean Algebra - comparison to regular algebra Any algebra is built upon: 1) A set of elements 2) A set of operators 3) A set of postulates Boolean Algebra is built upon: 1) A set of elements: {0, 1} 2) A set of operators: {+, } – Define these in class 3) A set of postulates: the Huntington Postulates are the most common Huntington Postulates – The following 6 postulates, along with the set of elements and set of operators shown above, uniquely and completely define Boolean algebra. 1) Closure for the operations {+, } - Discuss

9 9 Lecture #2 EGR 277 – Digital Logic 2) Two identity elements: - Illustrate by considering all possible values for x A) 0: 0 + x = x + 0 = x B) 1: 1 x = x 1 = x 3) Commutative Laws: - Illustrate by considering all possible values for x and y A) x + y = y + x B) xy = yx 4) Distributive Laws: - Prove by truth table A) x (y + z) = xy + xz B) x + yz = (x + y) (x + z)

10 10 Lecture #2 EGR 277 – Digital Logic 5) Existence of a Complement: - Illustrate by considering all possible values for x Define by the following truth table: xx’ 01 10 A) x + x’ = 1 B) x x’ = 0 6) At least two non-equal elements: {0, 1} - Discuss Common Theorems Boolean algebra has already been completely defined. Additional theorems are also often used, not because they are required, but because they are useful. Some of the most common theorems are shown below. Note that each theorem could be formally proven using the postulates. 1) Idempotency: (“same power”) A) x + x = x – Prove this using the postulates B) x x = x Example: Show related examples using this theorem.

11 11 Lecture #2 EGR 277 – Digital Logic 2) (no name) – Discuss A) x + 1 = 1 B) x 0 = 0 3) Involution: – Discuss x’’ = = x 4) Associative Laws: – Discuss (show logic gate application) A) x + (y + z) = (x + y) + z B) x(yz) = (xy)z 5) DeMorgan’s Theorems: - Prove 5A by truth table A) B) Example: Show related examples using DeMorgan’s theorem.

12 12 Lecture #2 EGR 277 – Digital Logic 6) Absorption: A) x + xy = x B) x (x+y) = x Example: Show related examples using this theorem. 7) (no name) A) x + x’y = x + y B) x (x’ + y) = xy Example: Show related examples using this theorem. 8) Concensus: A) xy + x’z + yz = xy + x’z B) (x + y)(x’ + z)( y + z) = (x + y)(x’ + z) Example: Show related examples using this theorem.

13 13 Lecture #2 EGR 277 – Digital Logic Order of operations Example: f = a  b+c  d Note: spacing is often used to make it clearer: f = ab + cd OperationPrecedence ParenthesesHigher NOT  AND  ORLower Boolean Functions – Simplifying Boolean functions corresponds to minimizing the amount of circuitry (logic gates) to be used. Truth table  Boolean function  minimized with Boolean algebra  implement with logic circuits Minimizing Boolean functions No specific rules. In general we use Boolean algebra (postulates and theorems) to reduce the number of terms, literals, logic gates, or IC’s. Literal – a primed (complemented) or unprimed variable Example: How many literals are in the expression f = ab + a’c + bc’d ?

14 14 Lecture #2 EGR 277 – Digital Logic Examples – Minimize the following Boolean functions: 1) F = AB + A(B + C) + B(B + C) 2) F = AB’(C + BD) + A’B’ 3) F(A,B,C,D) = A + A’BC + C’

15 15 Lecture #2 EGR 277 – Digital Logic Examples – Minimize the following Boolean functions (continued): 4) F = [(x’y)’ + z’]’ 5)

16 16 Lecture #2 EGR 277 – Digital Logic Examples – Minimize the following Boolean functions (continued): 6) f(x,y,z) = x’y(z + y’x) + y’z 7)


Download ppt "1 Binary Codes Digital systems use 2-state devices that understand only 2 binary values (0 and 1). But we communicate using various symbols and methods."

Similar presentations


Ads by Google