Sunday, November 13, 2022

Boolean Algebra



Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses only the binary numbers i.e. 0 and 1. It is also called as Binary Algebraor logical Algebra. Boolean algebra was invented by George Boole in 1854.

Rule in Boolean Algebra

Following are the important rules used in Boolean algebra.

  • Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.

  • Complement of a variable is represented by an overbar (-). Thus, complement of variable B is represented as B Bar. Thus if B = 0 then B Bar= 1 and B = 1 then B Bar = 0.

  • ORing of the variables is represented by a plus (+) sign between them. For example ORing of A, B, C is represented as A + B + C.

  • Logical ANDing of the two or more variable is represented by writing a dot between them such as A.B.C. Sometime the dot may be omitted like ABC.

Boolean Laws

There are six types of Boolean Laws.

Commutative law

Any binary operation which satisfies the following expression is referred to as commutative operation.

Commutative Law

Commutative law states that changing the sequence of the variables does not have any effect on the output of a logic circuit.

Associative law

This law states that the order in which the logic operations are performed is irrelevant as their effect is the same.

Associative Law

Distributive law

Distributive law states the following condition.

Distributive Law

AND law

These laws use the AND operation. Therefore they are called as AND laws.

AND Law

OR law

These laws use the OR operation. Therefore they are called as OR laws.

OR Law

INVERSION law

This law uses the NOT operation. The inversion law states that double inversion of a variable results in the original variable itself.

NOT Law

Important Boolean Theorems

Following are few important boolean Theorems.

Boolean function/theoremsDescription

Boolean Functions

Boolean Functions and Expressions, K-Map and NAND Gates realization

De Morgan's Theorems

De Morgan's Theorem 1 and Theorem 2

Hexadecimal Arithmetic



Hexadecimal Number System

Following are the characteristics of a hexadecimal number system.

  • 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). Example − 160

  • 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 − 19FDE16

Calculating Decimal Equivalent −

StepBinary NumberDecimal Number
Step 119FDE16((1 × 164) + (9 × 163) + (F × 162) + (D × 161) + (E × 160))10
Step 219FDE16((1 × 164) + (9 × 163) + (15 × 162) + (13 × 161) + (14 × 160))10
Step 319FDE16(65536 + 36864 + 3840 + 208 + 14)10
Step 419FDE1610646210

Note − 19FDE16 is normally written as 19FDE.

Hexadecimal Addition

Following hexadecimal addition table will help you greatly to handle Hexadecimal addition.

Hexadecimal Addition Table

To use this table, simply follow the directions used in this example − Add A16and 516. Locate A in the X column then locate the 5 in the Y column. The point in 'sum' area where these two columns intersect is the sum of two numbers.

A16 + 516 = F16. 

Example − Addition

Hexadecimal Addition Example

Hexadecimal Subtraction

The subtraction of hexadecimal numbers follow the same rules as the subtraction of numbers in any other number system. The only variation is in borrowed number. In the decimal system, you borrow a group of 1010. In the binary system, you borrow a group of 210. In the hexadecimal system you borrow a group of 1610.

Example - Subtraction

hexdecimal Substraction Example

Octal Arithmetic



Octal Number System

Following are the characteristics of an octal number system.

  • 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). Example: 80

  • Last position in an octal number represents an x power of the base (8). Example: 8x where x represents the last position - 1.

Example

Octal Number − 125708

Calculating Decimal Equivalent −

StepOctal NumberDecimal Number
Step 1125708((1 × 84) + (2 × 83) + (5 × 82) + (7 × 81) + (0 × 80))10
Step 2125708(4096 + 1024 + 320 + 56 + 0)10
Step 3125708549610

Note − 125708 is normally written as 12570.

Octal Addition

Following octal addition table will help you to handle octal addition.

Octal Addition Table

To use this table, simply follow the directions used in this example: Add 68and 58. Locate 6 in the A column then locate the 5 in the B column. The point in 'sum' area where these two columns intersect is the 'sum' of two numbers.

68 + 58 = 138. 

Example − Addition

Octal Addition Example

Octal Subtraction

The subtraction of octal numbers follows the same rules as the subtraction of numbers in any other number system. The only variation is in borrowed number. In the decimal system, you borrow a group of 1010. In the binary system, you borrow a group of 210. In the octal system you borrow a group of 810.

Example − Subtraction

Octal Substraction Example


Binary Arithmetic



Binary arithmetic is essential part of all the digital computers and many other digital system.

Binary Addition

It is a key for binary subtraction, multiplication, division. There are four rules of binary addition.

Addition Table

In fourth case, a binary addition is creating a sum of (1 + 1 = 10) i.e. 0 is written in the given column and a carry of 1 over to the next column.

Example − Addition

Addition Example

Binary Subtraction

Subtraction and Borrow, these two words will be used very frequently for the binary subtraction. There are four rules of binary subtraction.

Subtraction Table

Example − Subtraction

Subtraction Example

Binary Multiplication

Binary multiplication is similar to decimal multiplication. It is simpler than decimal multiplication because only 0s and 1s are involved. There are four rules of binary multiplication.

Multiplication Table

Example − Multiplication

Multiplication Example

Binary Division

Binary division is similar to decimal division. It is called as the long division procedure.

Example − Division

Division Example

Complement Arithmetic



Complements are used in the digital computers in order to simplify the subtraction operation and for the logical manipulations. For each radix-r system (radix r represents base of number system) there are two types of complements.

S.N.ComplementDescription
1Radix ComplementThe radix complement is referred to as the r's complement
2Diminished Radix ComplementThe diminished radix complement is referred to as the (r-1)'s complement

Binary system complements

As the binary system has base r = 2. So the two types of complements for the binary system are 2's complement and 1's complement.

1's complement

The 1's complement of a number is found by changing all 1's to 0's and all 0's to 1's. This is called as taking complement or 1's complement. Example of 1's Complement is as follows.

1's complement

2's complement

The 2's complement of binary number is obtained by adding 1 to the Least Significant Bit (LSB) of 1's complement of the number.

2's complement = 1's complement + 1

Example of 2's Complement is as follows.

2's complement

Sunday, November 6, 2022

Codes Conversion



There are many methods or techniques which can be used to convert code from one format to another. We'll demonstrate here the following

  • Binary to BCD Conversion
  • BCD to Binary Conversion
  • BCD to Excess-3
  • 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 −

StepBinary NumberDecimal Number
Step 1111012((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10
Step 2111012(16 + 8 + 4 + 0 + 1)10
Step 31110122910

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.

StepDecimal NumberConversion
Step 1291000102 10012
Step 2291000101001BCD

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.

StepBCD NumberConversion
Step 1(00101001)BCD00102 10012
Step 2(00101001)BCD210 910
Step 3(00101001)BCD2910

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 −

StepOperationResultRemainder
Step 129 / 2141
Step 214 / 270
Step 37 / 231
Step 43 / 211
Step 51 / 201

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)2 

BCD to Excess-3

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

(9)10 + (3)10 = (12)10

Step 3 − Convert to Excess-3

(12)10 = (1100)2

Result

(1001)BCD = (1100)XS-3 

Excess-3 to BCD Conversion

Steps

  • Step 1 -- Subtract (0011)2 from each 4 bit of excess-3 digit to obtain the corresponding BCD code.

Example − convert (10011010)XS-3 to BCD.

Given XS-3 number = 1 0 0 1 1 0 1 0 Subtract (0011)2 = 0 0 1 1 0 0 1 1 -------------------- BCD = 0 1 1 0 0 1 1 1 

Result

(10011010)XS-3 = (01100111)BCD

Binary Codes



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.

Weighted Code

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 −

Excess-3 code

Example

BCD to Excess-3 code

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.

Gray code

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 code

Advantages of BCD Codes

  • It is very similar to decimal system.
  • We need to remember binary equivalent of decimal numbers 0 to 9 only.

Disadvantages of BCD Codes

  • The addition and subtraction of BCD have different rules.

  • The BCD arithmetic is little more complicated.

  • BCD needs more number of bits than binary to represent the decimal number. So BCD is less efficient than binary.

Alphanumeric codes

A binary digit or bit can represent only two symbols as it has only two states '0' or '1'. But this is not enough for communication between two computers because there we need many more symbols for communication. These symbols are required to represent 26 alphabets with capital and small letters, numbers from 0 to 9, punctuation marks and other symbols.

The alphanumeric codes are the codes that represent numbers and alphabetic characters. Mostly such codes also represent other characters such as symbol and various instructions necessary for conveying information. An alphanumeric code should at least represent 10 digits and 26 letters of alphabet i.e. total 36 items. The following three alphanumeric codes are very commonly used for the data representation.

  • American Standard Code for Information Interchange (ASCII).
  • Extended Binary Coded Decimal Interchange Code (EBCDIC).
  • Five bit Baudot Code.

ASCII code is a 7-bit code whereas EBCDIC is an 8-bit code. ASCII code is more commonly used worldwide while EBCDIC is used primarily in large IBM computers.

Error Codes

There are binary code techniques available to detect and correct data during data transmission.

Error CodeDescription

Error Detection and Correction

Error de

What is computer security?

Computer security basically is the protection of computer systems and information from harm, theft, and unauthorized use. It is the process ...