Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

DCF-Module1

Its digital fundamental's note. Introduction and basics of digital. Helpful for students

Uploaded by

Aradhya M Anil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

DCF-Module1

Its digital fundamental's note. Introduction and basics of digital. Helpful for students

Uploaded by

Aradhya M Anil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Program : Diploma in Computer Engineering

Course Code : 3134


Course Title: Digital Computer Fundamentals
Semester :3

Module 1: Number Systems:

Important topics

1.Decimal to binary,hex,octal conversions


2.Binary to Decimal,Hex,Octal conversions
3.2’s compliment subtraction
4.BCD addition
5.Gray Code
6.Parity
7.Hamming code

Introduction to different Number Systems – Decimal, Binary, Octal

In mathematics, a “base” or a “radix” is the number of different digits or


combination of digits and letters that a system of counting uses to represent
numbers.
1.DECIMAL TO BINARY

Convert Decimal (98.46) to Binary

Ans: 1100010.01110 …

2.BINARY TO DECIMAL

Convert Binary number 11011.101 to decimal Ans:27.625


3.DECIMAL TO OCTAL

4.OCTAL TO DECIMAL
5.DECIMAL TO HEXADECIMAL

6.HEXADECIMAL TO DECIMAL

Convert Hexadecimal number 54.D2 to Decimal


7.BINARY TO OCTAL

8.OCTAL TO BINARY
9.BINARY TO HEXADECIMAL

10.HEXADECIMAL TO BINARY
OCTAL TO HEXADECIMAL

HEXADECIMAL TO OCTAL

BINARY ARITHMETIC
Negative Binary Numbers

Negative numbers can be distinguishable with the help of extra bit or flag called
sign bit or sign flag in Binary number representation system for signed numbers.
That’s why we use this extra bit called sign bit or sign flag. The value of sign bit
is 1 for negative binary numbers and 0 for positive numbers.
When an integer binary number is positive, the sign is represented by 0 and the
magnitude by a positive binary number.
When the number is negative, the sign is represented by 1 but the rest of the
number may be represented in one of three possible ways: Sign-Magnitude
method, 1’s Complement method, and 2’s complement method.
Sign-Magnitude method
In this method, number is divided into two parts: Sign bit and Magnitude. If the
number is positive then sign bit will be 0 and if number is negative then sign bit
will be 1. Magnitude is represented with the binary form of the number to be
represented.

Complements
Complements are used in digital computers to simplify the subtraction operation
and for logical manipulation. Simplifying operations leads to simpler, less
expensive circuits to implement the operations.
Generally, there are two types of complement of Binary number: 1’s complement
and 2’s complement.
1’s Complement Method:
Positive numbers are represented in the same way as they are represented in sign
magnitude method. If the number is negative then it is represented using 1’s
complement. First represent the number with positive sign and then take 1’s
complement of that number. To get 1’s complement of a binary number, simply
invert the given number.
2’s Complement Method:
Positive numbers are represented in the same way as they are represented in sign
magnitude method. If the number is negative then it is represented using 2’s
complement. First represent the number with positive sign and then take 2’s
complement of that number.

2’s compliment of a binary number is obtained by adding 1 to the 1’s compliment


2’s compliment= 1’s compliment + 1
Binary Subtraction with compliments
If we want to find the difference between M and N
ie Difference=M-N
1’s Compliment 2’s Compliment

M>N Determine 1’s compliment of ‘ N’ Determine 2’s compliment of ‘ N’


Add this to M Add this to M
Add carry to the result Ingnore Carry
Result= 1’sCompliment(N)+M+ Carry Eg: Find 1111-1010
M=1111 , N=1010
1111+
2’s Compliment→ 0 1 1 0
1 0101
Ignore Carry 1
Result: 0 1 0 1

M<N Determine 1’s compliment of ‘N’ Determine 2’s compliment of ‘N’


Add this to M Add this to M
Find 1’s compliment of result Find ’2s compliment of result
Put -ve sign in the result Put -ve sign in the result
Eg: Find 1010 - 1111 Eg: Find 1010 -1111
M=1 0 1 0 , N=1 1 1 1 M=1 0 1 0 , N=1 1 1 1
1010+ 1010+
1’s Compliment→0 0 0 0 2’s Compliment→ 0 0 0 1
1010 1011
1’s Compliment (1 0 1 0)→ 0 1 0 1 2’s Compliment (1011)→ 0 1 0 1
Put -ve Sign → - 0 1 0 1 Put -ve Sign → - 0 1 0 1
BINARY CODES

✓ Digital systems require to handle the data which may be numeric, alphabets
or special characters.
✓ As these digital systems operate in a binary system and hence the numerals
and alphabets are to be converted into binary format
✓ Process of converting into binary is called coding
✓ Codes are classified into 2 groups.

Weighted Codes Unweighted Codes


Exhibit a specific weights assigned Exhibit no specific weights
to the bit position assigned to the bit position
eg– BCD, 2421, 5211 Eg—Excess 3 code , Gray code

BCD and its ADDITION

BCD or binary-coded decimal is a special kind of representation of a decimal


number in binary numbers. In binary-coded decimal each individual digit of a
number is converted into a binary number, and then by combining them all, the
BCD code is generated. But always remember that a binary-coded decimal is not
a binary representation of a decimal number.

DECIMAL BCD
8 4 2 1
(weights)
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 0001 0000
11 0001 0001
. .
. .
. .
Example:The BCD or binary-coded decimal of the number 15 is 00010101.
The 0001 is the binary code of 1 and 0101 is the binary code of 5.

Any single decimal numeral [0-9] can be represented by a four bit pattern. The
procedure of encoding digits is called "Natural BCD" (NBCD), where each
decimal digit is represented by its corresponding four-bit binary value

• Step 1: Add the two BCD numbers using the rules for binary addition.
• Step 2: If a 4-bit sum is equal to or less than 9, it is a valid BCD number.
• Step 3: If a 4-bit sum is greater than 9 or if a carry-out of the 4-bit group
is generated, it is an invalid result. Add 6 (0110) to the 4-bit sum in order
to skip the six invalid BCD code words and return the code to 8421. If a
carry results when 6 is added, simply add the carry to the next 4-bit group.

Example 1: Find the sum of the BCD numbers 01000011 + 00110101

01000011BCD = 4310 and 00110101BCD = 3510

In the above example, all the 4-bit BCD additions generate valid BCD numbers,
which means less than 9. So, the final correct result is 7810 = 01111000BCD.

Let’s take an example where the addition generates an invalid BCD number.

Example 2: Find the sum of the BCD numbers 01110101 + 00110101

Solution:

The decimal number of the given BCD numbers are as below:

01110101BCD = 7510 and 00110101BCD = 3510


In the above example, both the BCD code addition generated result larger than 9,
so invalid. To get the correct result, we added 6 (0110 2) to both the invalid sum.
Notice that the carry generated from the left group is forwarded to the right group.

The final correct result is 11010 = 000100010000BCD

GRAY CODE

The code which exhibits only a single bit change from one code number to the
next. As there are no specific weight assigned to the bit positions and hence this
code is an unweighted code

Convert binary to Gray code

First MSB in the binary code as that of the corresponding digit in the gray code
and next perform ex-or operation

Gray to Binary

First MSB in the gray code as that of the corresponding digit in the binary code
and next perform ex-or operation in diagonal manner
ALPHA NUMERIC CODE

Digital system require the handling of data that consist not only of numbers but
also letters of the alphabet and certain special characters (= ,+,-,*,#)

A code which contains letters, numbers and other symbols known as Alpha
numeric codes

2 types of alpha numeric codes are there;

1. ASCII:(American Standard Code for Information Interchange)

It is a 7 bit code in which the decimal digits are represented by 8421coded


preceded by 011

eg: Letter B is represented by 1000010 - (42)16

“esc” is represented by 0011011 - (1B)16

2. EBCDIC:(Extended Binary Coded Decimal Interchange Code)

It is an 8 bit alpha numeric code , the decimal digits are represented by 8421 code
preceded by 111

Error Correction

What is Error?

✓ Error is a condition when the output information does not match with the
input information.
✓ During transmission, digital signals suffer from noise that can introduce
errors in the binary bits travelling from one system to other.
✓ That means a 0 bit may change to 1 or a 1 bit may change to 0.
Parity Method for Error Detection Code

Whenever a message is transmitted, it may get scrambled by noise or data may


get corrupted.

To avoid this, we use error-detecting codes which are additional data added to a
given digital message to help us detect if an error occurred during transmission of
the message.

A simple example of error-detecting code is parity check.

A parity bit is attached to a group of bits to make the total number of 1s in a


group always even or always odd

How to Detect and Correct Errors?

✓ To detect and correct the errors, additional bits are added to the data bits
at the time of transmission.
✓ The additional bits are called parity bits. They allow detection or
correction of the errors.
✓ The data bits along with the parity bits form a code word.
✓ There are 2 types of parity, even parity & odd parity
✓ Even parity : no. of 1’s should be even including parity bit (Fig.(a))
✓ Odd parity : no. of 1’s should be odd including parity bit (Fig.(b ))

How Does Error Detection Take Place?

✓ Parity checking at the receiver can detect the presence of an error if the
parity of the receiver signal is different from the expected parity.
✓ That means, if it is known that the parity of the transmitted signal is
always going to be "even" and if the received signal has an odd parity ,
then the receiver can conclude that the received signal is not correct.
✓ If an error is detected, then the receiver will ignore the received byte and
request for retransmission of the same byte to the transmitter.

Error correction --- Hamming Code

✓ Hamming code is a set of error-correction codes that can be used to detect


and correct the errors that can occur when the data is moved or stored
from the sender to the receiver.
✓ It is a technique developed by R.W. Hamming for error correction
✓ It is a 7 bit code in which 4 data bits can be transmitted
✓ This code contains 4 data bits (D3, D5, D6, D7) and 3 parity bits (P4, P2,
P1)

D7 D6 D5 P4 D3 P2 P1

You might also like