Docsity

Boolean Notes for engineering students, Lecture notes of Digital Electronics

Toggle sidebar
bg1
Number Systems:
There are infinite ways to represent a number. The four commonly associated with
modern computers and digital electronics are: decimal, binary, octal, and hexadecimal.
Decimal Number System
The number system that we use in our day-to-day life is the decimal number system.
Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal number
system, the successive positions to the left of the decimal point represents units, tens,
hundreds, thousands and so on.
Each position represents a specific power of the base (10). For example, the decimal
number 1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the
hundreds position, and 1 in the thousands position, and its value can be written as
(1Ɨ1000) + (2Ɨ100) + (3Ɨ10) + (4Ɨl)
(1Ɨ103) + (2Ɨ102) + (3Ɨ101) + (4Ɨl00)
1000 + 200 + 30 + 1
1234
As a computer programmer or an IT professional, you should understand the following
number systems which are frequently used in computers.
Binary Number System
Characteristics
Uses two digits, 0 and 1.
Also called base 2 number system
Each position in a binary number represents a 0 power of the base (2).
Last position in a binary number represents an x power of the base (2).
Example
Binary Number: 10101
Calculating Decimal Equivalent āˆ’
Step Binary
Number
Decimal Number
Step 1 10101 ((1 Ɨ 24) + (0 Ɨ 23) + (1 Ɨ 22) + (0 Ɨ 21) + (1 Ɨ 20))
Step 2 10101 (16 + 0 + 4 + 0 + 1)
Step 3 10101 21
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Boolean Notes for engineering students and more Lecture notes Digital Electronics in PDF only on Docsity!

Number Systems:

There are infinite ways to represent a number. The four commonly associated with

modern computers and digital electronics are: decimal, binary, octal, and hexadecimal.

Decimal Number System

The number system that we use in our day-to-day life is the decimal number system.

Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal number

system, the successive positions to the left of the decimal point represents units, tens,

hundreds, thousands and so on.

Each position represents a specific power of the base (10). For example, the decimal

number 1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the

hundreds position, and 1 in the thousands position, and its value can be written as

(1Ɨ1000) + (2Ɨ100) + (3Ɨ10) + (4Ɨl)

(1Ɨ103) + (2Ɨ102) + (3Ɨ101) + (4Ɨl00)

As a computer programmer or an IT professional, you should understand the following

number systems which are frequently used in computers.

Binary Number System

Characteristics

Uses two digits, 0 and 1.

Also called base 2 number system

Each position in a binary number represents a 0 power of the base (2).

Last position in a binary number represents an x power of the base (2).

Example

Binary Number: 10101

Calculating Decimal Equivalent āˆ’

Step Binary

Number

Decimal Number

Step 1 10101 ((1 Ɨ 24) + (0 Ɨ 23) + (1 Ɨ 22) + (0 Ɨ 21) + (1 Ɨ 20))

Step 2 10101 (16 + 0 + 4 + 0 + 1)

Step 3 10101 21

Octal Number System

Characteristics

Uses eight digits, 0,1,2,3,4,5,6,7.

Also called base 8 number system

Each position in an octal number represents a 0 power of the base (8).

Last position in an octal number represents an x power of the base (8).

Example

Octal Number āˆ’ 12570

Calculating Decimal Equivalent āˆ’

Step Octal

Number

Decimal Number

Step 1 12570 ((1 Ɨ 84) + (2 Ɨ 83) + (5 Ɨ 82) + (7 Ɨ 81) + (0 Ɨ 80))

Step 2 12570 (4096 + 1024 + 320 + 56 + 0)

Step 3 12570 5496

Hexadecimal Number System

Characteristics

Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.

Letters represents numbers starting from 10. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

Also called base 16 number system.

Each position in a hexadecimal number represents a 0 power of the base (16).

Last position in a hexadecimal number represents an x power of the base (16). Example 16x where x represents the last position - 1.

Example āˆ’

Hexadecimal Number: 19FDE

Calculating Decimal Equivalent āˆ’

Step Hexadecimal Decimal Number

Step 3 7 / 2 3 1

Step 4 3 / 2 1 1

Step 5 1 / 2 0 1

As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that the first remainder becomes the Least Significant Digit (LSD) and the last remainder becomes the Most Significant Digit (MSD).

Decimal Number āˆ’ 29= Binary Number āˆ’ 11101

Other Base System to Decimal System

Steps

  • Step 1 āˆ’ Determine the column (positional) value of each digit (this depends on the position of the digit and the base of the number system).
  • Step 2 āˆ’ Multiply the obtained column values (in Step 1) by the digits in the corresponding columns.
  • Step 3 āˆ’ Sum the products calculated in Step 2. The total is the equivalent value in decimal.

Example

Binary Number āˆ’ 11101

Calculating Decimal Equivalent āˆ’

Step Binary

Number

Decimal Number

Step 1 11101 ((1 Ɨ 24) + (1 Ɨ 23) + (1 Ɨ 22) + (0 Ɨ 21) + (1 Ɨ 20))

Step 2 11101 (16 + 8 + 4 + 0 + 1)

Step 3 11101 29

Binary Number āˆ’ 11101= Decimal Number āˆ’ 29

Other Base System to Non-Decimal System

Steps

  • Step 1 āˆ’ Convert the original number to a decimal number (base 10).
  • Step 2 āˆ’ Convert the decimal number so obtained to the new base number.

Example

Octal Number āˆ’ 25

Calculating Binary Equivalent āˆ’

Step 1 āˆ’ Convert to Decimal

Step Octal

Number

Decimal Number

Step 1 25 ((2 Ɨ 81) + (5 Ɨ 80))

Step 2 25 (16 + 5 )

Step 3 25 21

Octal Number āˆ’ 25= Decimal Number āˆ’ 21

Step 2 āˆ’ Convert Decimal to Binary

Step Operation Result Remainder

Step 1 21 / 2 10 1

Step 2 10 / 2 5 0

Step 3 5 / 2 2 1

Step 4 2 / 2 1 0

Step 5 1 / 2 0 1

Decimal Number āˆ’ 21= Binary Nuber āˆ’ 10101

Octal Number āˆ’ 25= Binary Number āˆ’ 10101

Shortcut method - Binary to Octal

Steps

  • Step 1 āˆ’ Divide the binary digits into groups of three (starting from the right).
  • (^) Step 2 āˆ’ Convert each group of three binary digits to one octal digit.

Example

Binary Number āˆ’ 10101

Calculating Octal Equivalent āˆ’

Step Binary

Number

Octal Number

Step 1 10101 010 101

Step 2 10101 2 5

Step 3 10101 25

Binary Number āˆ’ 10101= Octal Number āˆ’ 25

Shortcut method - Octal to Binary

Steps

Example

Hexadecimal Number āˆ’ 15

Calculating Binary Equivalent āˆ’

Step Hexadecimal

Number

Binary Number

Step 1 15 1 5

Step 2 15 0001 0101

Step 3 15 00010101

Hexadecimal Number āˆ’ 15 = Binary Number āˆ’ 10101

Binary Code

In the coding, when numbers, letters or words are represented by a specific group of symbols, it is said that the number, letter or word is being encoded. The group of symbols is called as a code. The digital data is represented, stored and transmitted as group of binary bits. This group is also called as binary code. The binary code is represented by the number as well as alphanumeric letter.

Advantages of Binary Code

Following is the list of advantages that binary code offers.

  • Binary codes are suitable for the computer applications.
  • Binary codes are suitable for the digital communications.
  • Binary codes make the analysis and designing of digital circuits if we use the binary codes.
  • Since only 0 & 1 are being used, implementation becomes easy.

Classification of binary codes

The codes are broadly categorized into following four categories.

  • Weighted Codes
  • Non-Weighted Codes
  • Binary Coded Decimal Code
  • Alphanumeric Codes
  • Error Detecting Codes
  • Error Correcting Codes

Weighted Codes

Weighted binary codes are those binary codes which obey the positional weight principle. Each position of the number represents a specific weight. Several systems of the codes are used to express the decimal digits 0 through 9. In these codes each decimal digit is represented by a group of four bits.

Non-Weighted Codes

In this type of binary codes, the positional weights are not assigned. The examples of non-weighted codes are Excess-3 code and Gray code.

Excess-3 code

The Excess-3 code is also called as XS-3 code. It is non-weighted code used to express decimal numbers. The Excess-3 code words are derived from the 8421 BCD code words adding (0011)2 or (3)10 to each code word in 8421. The excess-3 codes are obtained as follows āˆ’

Example

Gray Code

It is the non-weighted code and it is not arithmetic codes. That means there are no specific weights assigned to the bit position. It has a very special feature that, only one bit will change each time the decimal number is incremented as shown in fig. As only one bit changes at a time, the gray code is called as a unit distance code. The gray code is a cyclic code. Gray code cannot be used for arithmetic operation.

Application of Gray code

  • Gray code is popularly used in the shaft position encoders.
  • A shaft position encoder produces a code word which represents the angular position of the shaft.

Binary Coded Decimal (BCD) code

In this code each decimal digit is represented by a 4-bit binary number. BCD is a way to express each of the decimal digits with a binary code. In the BCD, with four bits we can represent sixteen numbers (0000 to 1111). But in BCD code only first ten of these are used (0000 to 1001). The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.

  • BCD to Excess-
  • Excess-3 to BCD

Binary to BCD Conversion

Steps

  • Step 1 -- Convert the binary number to decimal.
  • Step 2 -- Convert decimal number to BCD.

Example āˆ’ convert (11101)2 to BCD.

Step 1 āˆ’ Convert to Decimal

Binary Number āˆ’ 111012

Calculating Decimal Equivalent āˆ’

Step Binary Number Decimal Number

Step 1 111012 ((1 Ɨ 24) + (1 Ɨ 23) + (1 Ɨ 22) + (0 Ɨ 21) + (1 Ɨ 20))

Step 2 111012 (16 + 8 + 4 + 0 + 1)

Step 3 111012 2910

Binary Number āˆ’ 111012 = Decimal Number āˆ’ 2910

Step 2 āˆ’ Convert to BCD

Decimal Number āˆ’ 2910

Calculating BCD Equivalent. Convert each digit into groups of four binary digits equivalent.

Step Decimal Number Conversion

Step 1 2910 00102 10012

Step 2 2910 00101001BCD

Result

(11101)2 = (00101001)BCD

BCD to Binary Conversion

Steps

  • Step 1 -- Convert the BCD number to decimal.
  • Step 2 -- Convert decimal to binary.

Example āˆ’ convert (00101001)BCD to Binary.

Step 1 - Convert to BCD

BCD Number āˆ’ (00101001)BCD

Calculating Decimal Equivalent. Convert each four digit into a group and get decimal equivalent for each group.

Step BCD Number Conversion

Step 1 (00101001)BCD 00102 10012

Step 2 (00101001)BCD 210 910

Step 3 (00101001)BCD 2910

BCD Number āˆ’ (00101001)BCD = Decimal Number āˆ’ 2910

Step 2 - Convert to Binary

Used long division method for decimal to binary conversion.

Decimal Number āˆ’ 2910

Calculating Binary Equivalent āˆ’

Step Operation Result Remainder

Step 1 29 / 2 14 1

Step 2 14 / 2 7 0

Step 3 7 / 2 3 1

Step 4 3 / 2 1 1

Step 5 1 / 2 0 1

As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that the first remainder becomes the least significant digit (LSD) and the last remainder becomes the most significant digit (MSD).

Decimal Number āˆ’ 2910 = Binary Number āˆ’ 111012

Result

(00101001)BCD = (11101)

BCD to Excess-

Steps

  • Step 1 -- Convert BCD to decimal.
  • Step 2 -- Add (3)10 to this decimal number.
  • Step 3 -- Convert into binary to get excess-3 code.

Example āˆ’ convert (1001)BCD to Excess-3.

Step 1 āˆ’ Convert to decimal

(1001)BCD = 910

Step 2 āˆ’ Add 3 to decimal

A ~A

NAND – AND + NOT

A B AB ~AB

NOR

A B A+B ~(A+B)

EXOR

A B A exor B

EXNOR

A B A exor B A exnor B