1 / 26

Digital Logic Chapter 2

Digital Logic Chapter 2. Number Conversions Digital Systems by Tocci. Binary  Decimal. Convert a binary number, 100101 2 , to a decimal number by summing the positional weights that contain “1”. 32 + 0 + 0 + 4 + 0 + 1 = 37 10. How about Decimal  Binary?.

keaira
Download Presentation

Digital Logic Chapter 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci

  2. Binary  Decimal • Convert a binary number, 1001012, to a decimal number by summing the positional weights that contain “1”. 32 + 0 + 0 + 4 + 0 + 1 = 3710 How about Decimal  Binary?

  3. Decimal  Binary • Userepeated division: • Divide the decimal number by 2. The remainder of this division is the LSB • Continue dividing the results, adding the remainders to the left of the LSB until a quotient of zero is obtained. • The last division is always two into 1 giving a result of 0 with a remainder of 1. This 1 is the MSB. • Additional zeros can be added padding the binary number so the total digits are some multiple of 8.

  4. Repeated Division: Example 1 Until a quotient of “0” is obtained

  5. Repeated Division: Example 2

  6. Repeated Division: Flow Chart • Similar procedure can be used to convert from decimal to other number systems. Check your solutions by converting back to decimal.

  7. Hexadecimal Number System • Hexadecimal number system uses base-16 • The characters used in hex are: • Digits 0~9 • Letters A, B, C, D, E, F • The digit positions are weighted as powers of 16, rather than as powers of 10 as in the decimal system

  8. Counting in Hex • Why Hexadecimal? • It is useful to represent long strings of bits. Each character in hex can represent 4 bits reducing the length of a number to a quarter of the original size. It makes binary numbers more “readable”. • Counting in hex restarts at zeroand produces a carry after the count reaches F in order to increment to the next value.

  9. Hex  Decimal Conversion Multiplying each hex digit by its positional weight. Example:

  10. Decimal  Hex Conversion • Remember the repeated division? • Divide the decimal number by 16 • The 1st remainder is the LSB and the last is the MSB. • Note, when done on a calculator, a decimal remainder can be multiplied by 16 to get the result. • If the remainder is greater than 9, the letters A~F are used. Until a quotient of “0” is obtained

  11. Decimal  Hex Conversion

  12. Hex  Binary Conversion • Hex  Binary: • Each Hex digit is converted to its four-bit binary equivalent • 9F216 = 9 F 2 • 1001 1111 0010 = 1001111100102 • Binary  Hex: • Convert from binary to hex by grouping bits in four starting with the LSB. • Each group is then converted to the hex equivalent • Leading zeros can be added to the left of the MSB to fill out the last group. • Example: 11101001102 = 0011 1010 0110 = 3 A 6 = 3A616 Note the addition of leading zeroes

  13. http://www.learn-programming.za.net/articles_decbinhexoct.htmlhttp://www.learn-programming.za.net/articles_decbinhexoct.html Conversion among Decimal, Binary, Hex Decimal Binary Hexadecimal ? How to do all the conversions

  14. BCD Code • Binary Coded Decimal (BCD) is another way to present decimal numbers in binary form. • BCD is widely used and combines features of both decimal and binary systems. • Each BCD digit is converted to a binary equivalent.

  15. Decimal  BCD • To convert the number 87410 to BCD: 8 7 4 0100 0111 0100 = 010001110100BCD • 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

  16. BCD • BCD is NOT a number system. • BCD is a decimal number with each digit encoded to its binary equivalent. • The primary advantage of BCD: easy to convert to and from binary. • A BCD number is NOT the same as a straight binary number.

  17. BCD Review Questions Is “1001 1011 0101” a valid BCD?

  18. BYTE, Nibble, WORD • Byte: • Most microcomputers handle and store binary data in groups of 8 bits. • So, special name is given to a string of 8 bits, called a byte. • Two common questions: • How many bytes in a 32-bit string (a string of 32 bits)? • What is the largest decimal number that can be represented in binary using two bytes?

  19. BYTE, Nibble, WORD • Byte = 8 bits • Nibble = 4 bits • Word: • Word size in a simple system may be one byte (8 bits) • Word size in a PC is 8 bytes (64 bits) • Word size is specific to particular machines.

  20. Alphanumeric Codes – ASCII Code • Represents characters and functions found on a computer keyboard. • ASCII – American Standard Code for Information Interchange. • Seven bit code: 27 = 128 possible code groups • Table 2-4 lists the standard ASCII codes • Applications: • To transfer information between computers, between computers and printers, and for internal storage.

  21. Parity Method for Error Detection • Binary data and codes are frequently moved between locations. • For example: • Digitized voice over a microwave link. • Storage and retrieval of data from hard disks. • Communication between computer systems over telephone lines using a modem. • Electrical noise can cause errors during transmission. • Many digital systems employ methods for error detection (and sometimes correction).

  22. Parity Method for Error Detection • The parity method of error detection requires the addition of an extra bit to a code group. • This extra bit is called the parity bit. • The bit can be either a 0 or 1, depending on the number of 1s in the code group. • There are two methods: even and odd.

  23. Parity Method for Error Detection • Even Parity Method: • The total number of “1”s in a group, including the parity bit, must add up to an even number. • The binary group 1 0 1 1 would require the addition of a parity bit 11 0 1 1 • The parity bit may be added at either end of a group. • Odd Parity Method: • The total number of “1”s in a group, including the parity bit, must add up to an odd number.

  24. Parity Method for Error Detection • The transmitter and receiver must “agree” on the type of parity-checking being used. • Two bit errors would not indicate a parity error. • Both odd and even parity methods are used, but even seems to be used more often.

  25. Schematic for Even Parity Generator

More Related