Binary Codes
Binary Codes
Binary Codes
Objectives
To be able to understand the following:
Digital Number System
Binary Number System and Operations
Binary Codes
Errors and Error Connectors
Repetition & Hamming Codes
Digital 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: 2x where x represents the last position - 1.
Example:
1101102 , 11001102, 000000000012
Decimal to Other Base System
Step 1 − Divide the decimal number to be converted by the value of the new base.
Step 2 − Get the remainder from Step 1 as the rightmost digit (least significant digit) of the new base
number.
Step 3 − Divide the quotient of the previous divide by the new base.
Step 4 − Record the remainder from Step 3 as the next digit (to the left) of the new base number.
Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes zero in Step 3.
Decimal to Binary
Example
Decimal Number: 2910
Calculating Binary Equivalent −
110111
Decimal Binary
32 100000
15 1111
40 101000
Decimal to Binary
Answer: 2910
Binary to Decimal
EXERCISE 1: Convert the following Binary to Decimal
110111
Binary Decimal
000110 6
110111 55
1111101 125
Binary Addition
110111
Binary Sum
000111 + 000100 001011
11111 + 10111 110110
101010+100011 1001101
BINARY CODES
Binary codes make the analysis and designing of digital circuits if we use the binary codes.
Error Error
Alphanumeric
Detecting Correcting
Codes
Codes Codes
BINARY CODES
Non-Weighted
Codes
BINARY CODES
Error Codes
Error There are binary code techniques available to detect
Detecting and correct data during data transmission.
Codes 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.
BINARY CODES
D7 D6 D5 P4 D3 P2 P1
1 1 0 ? 1 ? ?
HAMMING CODES
Determining the value of the parity Bits cont..
D7 D6 D5 P4 D3 P2 P1
1 1 0 ? 1 ? ?
Find P1:
= Check 1 bit skip 1 bit, check 1 bit skip 1 bit . . . . . . . .
P1 = D3 D5 D7
Find P2:
= Check 2 bit skip 2 bit, check 2 bit skip 2 bit . . . . . . . .
P2 = D3 D6 D7
Find P4:
= Check 4 bit skip 4 bit, check 4 bit skip 4 bit . . . . . . . .
P4 = D5 D6 D7
HAMMING CODES
Determining the value of the parity Bits cont..
D7 D6 D5 P4 D3 P2 P1
1 1 0 ? 1 ? ?
Find P1:
= Check 1 bit skip 1 bit, check 1 bit skip 1 bit . . . . . . . .
P1 = D3 D5 D7
Find P2:
= Check 2 bit skip 2 bit, check 2 bit skip 2 bit . . . . . . . . Parity P1 P2 P4
P2 = D3 D6 D7 101 111 011
Find P4: Parity Check (Even 0 1 0
Parity)
= Check 4 bit skip 4 bit, check 4 bit skip 4 bit . . . . . . . .
P4 = D5 D6 D7
HAMMING CODES
Determining the value of the parity Bits cont..