Presentation is loading. Please wait.

Presentation is loading. Please wait.

2 Number Systems and Codes Edited by Jerry Bernardini.

Similar presentations


Presentation on theme: "2 Number Systems and Codes Edited by Jerry Bernardini."— Presentation transcript:

1 2 Number Systems and Codes Edited by Jerry Bernardini

2 Chapter 2 Objectives Convert decimal, binary, hexadecimal
advantages of the hexadecimal BCD and straight binary codes ASCII code Parity error detection

3 2-1 Binary to Decimal Conversion
Convert binary to decimal by summing the positions that contain a 1: An example with a greater number of bits: Ronald Tocci/Neal Widmer/Gregory Moss Digital Systems: Principles and Applications, 10e Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

4 2-1 Double-Dabble Binary to Decimal Conversion
Binary numbers verify the double-dabble method: Ronald Tocci/Neal Widmer/Gregory Moss Digital Systems: Principles and Applications, 10e Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

5 Binary-Decimal- Weight Method
27 26 25 24 23 22 21 20 weight 128 64 32 16 8 4 2 1 example sum 170

6 Decimal to Binary Weight Method
27 26 25 24 23 22 21 20 weight 128 64 32 16 8 4 2 1 decimal example 7510 -64 11 -8 3 -2 Result

7 2-2 Decimal to Binary Conversion
Repeated Division Divide the decimal number by 2. Write the remainder after each division until a quotient of zero is obtained. The first remainder is the LSB. The last is the MSB. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

8 2-3 Hexadecimal Number System
Hexadecimal allows convenient handling of long binary strings, using groups of 4 bits—Base 16 16 possible symbols: 0-9 and A-F Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

9 2-3 Hexadecimal Number System
Relationships between hexadecimal, decimal, and binary numbers. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

10 2-3 Hexadecimal Number System – Hex to Decimal
Convert from hex to decimal by multiplying each hex digit by its positional weight. In a 2nd example, the value 10 was substituted for A and 15 substituted for F. For practice, verify that 1BC216 is equal to Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

11 2-3 Hexadecimal Number System – Decimal to Hex
Convert from decimal to hex by using the repeated division method used for decimal to binary conversion. Divide the decimal number by 16 The first remainder is the LSB—the last is the MSB. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

12 2-3 Hexadecimal Number System – Decimal to Hex
Convert to hex: Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

13 2-3 Hexadecimal Number System – Decimal to Hex
Convert to hex: Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

14 2-3 Hexadecimal Number System – Hex to Binary
Divide binary number into groups of four bits (nibble) Convert nibble to hex For practice, verify that BA616 = Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

15 2-3 Hexadecimal Number System – Binary to Hex
group bits in four starting with the LSB Each group is then converted to the hex equivalent binary number is grouped into groups of four bits & each is converted to its equivalent hex digit. For practice, verify that = 15F16 Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

16 2-3 Hexadecimal Number System – Decimal to Hex to Binary
Convert decimal 378 to a 16-bit binary Perform successive division by 16 Remainder in hex is each hex value 37810 = 17A16

17 Binary Coded Decimal -BCD Code
(BCD) is a widely used each decimal digit converted to binary equivalent. The primary advantage of BCD is the relative ease of converting to and from decimal. . Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

18 2-4 BCD Code Convert the number 87410 to BCD:
Each decimal digit is represented using 4 bits. Each 4-bit group can never be greater than 9. Reverse the process to convert BCD to decimal. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

19 2-4 BCD Code Convert 0110100000111001 (BCD) to its decimal equivalent.
Divide the BCD number into four-bit groups and convert each to decimal. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

20 2-4 BCD Code Convert 0110100000111001 (BCD) to its decimal equivalent.
Divide the BCD number into four-bit groups and convert each to decimal. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

21 The forbidden group represents an error in the BCD number.
2-4 BCD Code Convert BCD to its decimal equivalent. The forbidden group represents an error in the BCD number. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

22 Three bit binary and Gray code equivalents.
2-5 The Gray Code The Gray code is used in applications where numbers change rapidly. Only one bit changes from each value to the next. Three bit binary and Gray code equivalents. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

23 2-5 The Gray Code Binary to Gray Gray to Binary
Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

24 Decimal-Binary-Hex-BCD-Gray
Decimal numbers 1 – 15 in binary, hex, BCD, Gray Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

25 2-7 The Byte, Nibble, and Word
Most microcomputers handle and store binary data and information in groups of eight bits. 8 bits = 1 byte. A byte can represent numerous types of data/information. Binary numbers are often broken into groups of four bits. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

26 Byte-Nibble-Word 1 nibble = 4 bits
1 byte = 8 bits 1 nibble = 4 bits 1 word = Variable ( 8, 16, 32, 64 bits ) Word size depends upon the digital system PC word size could be 32 or 64 bits

27 American Standard Code for Information Interchange -ASCII
Represents characters and functions on a computer keyboard 26 lowercase 26 uppercase letters 10 digits 7 punctuation marks 20 to 40 other characters. Seven bit code: 27 = 128 possible codes use: transfer information between computers; computers & printers; Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

28 ASCII – Codes Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

29 ASCII – Codes Examples example Keyboard “A” = 4116 = 6510
Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

30 Transmission Errors Electrical noise can cause errors during transmission. (Spurious fluctuations in voltage or current present in all electronic systems) Noise can change one or more “1” to “0” or “0” to “1” You want detect the errors and possibly correct the errors Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

31 Error Detection and Correction
Digital systems should first detect errors Then correct errors if possible Parity is a simple method of detection errors Parity method requires the addition of an extra bit to a code group

32 Parity Method for Error Detection
The added bit is the parity bit It can be either a 0 or 1, depending on the number of 1s in the code group There are two parity methods Even or odd The transmitter and receiver must “agree” on the type of parity checking Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

33 Parity Method for Error Detection
Even parity method—the total number of bits in a group including the parity bit must add up to an even number. The binary group would require the addition of a parity bit 1, making the group The parity bit may be added at either end of a group. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

34 2-9 Parity Method for Error Detection
Odd parity method—the total number of bits in a group including the parity bit must add up to an odd number. The binary group would require the addition of a parity bit 1, making the group The parity bit becomes a part of the code word. Adding a parity bit to the seven-bit ASCII code produces an eight-bit code. Copyright ©2007 by Pearson Education, Inc. Columbus, OH All rights reserved.

35 ASCII Transmission there must be a way to tell the receiver a new character is coming. There is often a need to detect errors in the transmission as well. The method of transfer is called asynchronous data communication. An ASCII character must be “framed” so the receiver knows where the data begins and ends.

36 2-10 Applications ASCII code is sent LSB first and MSB last.
The first bit must always be a start bit (logic 0). ASCII code is sent LSB first and MSB last. After the MSB, a parity bit is appended to check for transmission errors. Transmission is ended by sending a stop bit (logic 1).

37 Boolean Algebra and Common Logic
Boolean constants and variables are “1” and “0” “1” could be 2 to 5 volts “0” could be 0 to 0.8 volts

38 OR Gates x = A + B x = = 1 x = A + B is read as “x equals A OR B

39 AND Gate x = A B expression x = A B is read as “x equals A AND B

40 NOT Gate NOT gate is Inverter or Complementer
“1” input produces a “0” output “0” input produces a “1” output

41 Combining Logic Gates

42 Operator Precedence If an expression contains both AND and OR operations, the AND operations are performed first Unless there are parentheses in the expression, in which case the operation inside the parentheses is to be performed first. This is the same rule that is used in ordinary algebra to determine the order of operations


Download ppt "2 Number Systems and Codes Edited by Jerry Bernardini."

Similar presentations


Ads by Google