Lab for Number Systems, Exercises of Digital Logic Design and Programming

Contains exercises for hexadecimal, octal, binary and decimal number systems

Typology: Exercises

2019/2020

Uploaded on 01/25/2020

tarviha-fatima
tarviha-fatima 🇵🇰

2 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lab Manual 01
Number Systems
Objectives
Students should be able to understand decimal, binary, octal and hexadecimal number systems.
The Binary Number System
The binary number system is a base 2 system with only two digits: 0 and 1. A binary number such as
“11010” is expressed with a string of 1s and 0s. The decimal equivalent of binary number can be
found by expanding the number into a power series with base of 2 e.g.
(11010)2 = 1x24 + 1x23 + 0x22 + 1x21 + 0x20
= 16 + 8 + 0 + 2 + 0
= (26)10
The binary system represents numbers using binary digits (bits) where each digit corresponds to a
power of two.
Another Example
Binary: 1 1 1 0 0 1 0 1
Power of two:2726 252423 222120
Decimal: 128 64 32 16 8 4 2 1
The total (in decimal) is 128 + 64 + 32 + 4 + 1 = 229
Since we begin counting from zero, n bits can represent 2n values:from 0 to 2n–1
inclusive (e.g. 256 values, from 0 to 255, for 8bits).
Groups of bits form binary words
Conversion from decimal to binary
Repeat division by 2
Example: Convert (29)10 to binary
– 29/2 = 14 remainder 1 (LSB)
– 14/2 = 7 remainder 0
– 7/2 = 3 remainder 1
– 3/2 = 1 remainder 1
– 1/2 = 0 remainder 1 (MSB)
(29)10 =>(11101)2
pf3
pf4

Partial preview of the text

Download Lab for Number Systems and more Exercises Digital Logic Design and Programming in PDF only on Docsity!

Lab Manual 01

Number Systems

Objectives

Students should be able to understand decimal, binary, octal and hexadecimal number systems.

The Binary Number System

The binary number system is a base 2 system with only two digits: 0 and 1. A binary number such as “11010” is expressed with a string of 1s and 0s. The decimal equivalent of binary number can be found by expanding the number into a power series with base of 2 e.g. (11010) 2 = 1x2 = 16 + 8 + 0 + 2 + 0^4 + 1x2^3 + 0x2^2 + 1x2^1 + 0x2^0

The binary system represents numbers using^ = (26)^10 bi nary digi ts ( bits ) where each digit corresponds to a power of two. Another Example Binary: 1 1 1 0 0 1 0 1 Power of two: 27 26 252423 222120 Decimal: 128 64 32 16 8 4 2 1   The total (in decimal) isSince we begin counting from zero, 128 + 64 + 32 + 4 + 1 = 229 n bits can represent 2 n (^) values:from 0 to 2 n – inclusive (e.g. 256 values, from 0 to 255, for 8bits).  Groups of bits form binary words

Conversion from decimal to binaryRepeat division by 2 Example: Convert (29) 10 to binary

  • 29/2 = 14 remainder 1 (LSB)
  • 14/2 = 7 remainder 0
  • 7/2 = 3 remainder 1
  • 3/2 = 1 remainder 1
  • 1/2 = 0 remainder 1 (MSB) (29) 10 =>(11101) 2

The Hexadecimal Number System

 The hexadecimal number system (HEX) is a base 16 notation. It is the most popular large-base system for representing binary numbers.  Each symbol represents 4-bits (1 nibble), that can take one of 16 different values: the values 0-9 are represented by the digits 0-9, and the values 10-15 are represented by the capital letters A-F respectively.  Conversions are performed as with the other number systems.

Example: Convert (B65F) 16 to Decimal number. (B65F) 16 = 11x16^3 + 6x16^2 + 5x16^1 + 15x16^0 = 11x4096 + 6x256 + 5x16 + 15 = 45056 + 1536 + 80 + 15 = (46687) 10

The Octal Number System

Table 1 : Numbers with Different Bases DECIMAL NUMBER (base 10)

BINARY NUMBE R (base 2) NUMBER^ OCTAL (base 8) NUMBER^ HEX 0 0 0^ (base 16) 0 1 1 1 1 2 10 2 2 3 11 3 3 4 100 4 4 5 101 5 5 6 110 6 6 7 111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F

  1. Considerable evidence suggests that base 20 has historically been used for number systems in a number of cultures. (a) Write the digits for a base 20 system, using an extension of the same digit representation scheme employed for hexadecimal. (b) Convert (2007) 10 to base 20.
  2. Represent the decimal numbers 694 and 835 in BCD.
  3. What bit position in an ASCII code must be complemented to change the ASCII letter represented from uppercase to lowercase and vice versa?
  4. Decode the following ASCII code: 1000111 1101111 0100000 1000010 1100001 1100100 1100111 1100101 1110010 1110011 0100001.
  5. Perform the following arithmetic operations. a) (1101) 2 x (1011) 2 b) (14) 5 + (43) 5 c) (327) 8 – (64) 8 Note: Perform subtraction without converting it into another base d) (101) 2 – (1101) 2 Note: Use subtraction with borrow
  6. Division is composed of multiplications and subtractions. Perform the binary division 1101010÷110 to obtain a quotient and remainder