Binary Codes
Binary Codes
Binary Numbers
*A binary number is a number that includes only ones
and zeroes.
*The number could be of any length or bit string.
*The following are all examples of binary numbers
101012
01010102
10111101012
01101011102
*Another name for binary is base-2 (pronounced "base
two")
What is a binary
number?
3
Binary Code
*Imagine a specie that only has two fingers. how
can they count?
* A computer is such kind of two-finger specie.
0 and 1
*Each digit of a binary number is called a bit.
*A binary number with eight bits (i.e. digits) is
called a byte.
*Bridging the Digital
Divide
1 6 23
16 6 3
63 21
935 2 3
935 72
Decimal-to-Binary
534 7275 935 935 1 534 Conversion
2 3 4 14 1 37 13
275
34 2910 = 111012
5 7 1452
01 1 00
1001 11
0 01 0 1 0010 01100
01
0
0 110 01
1 1 01
1
0 110 1 01
1 001 10
0 1 1
001
011
0 0100 010 1
0 110
0 110
001
01
01
Binary-to-Decimal 11 0110
01 101 1101 0010 0
110010 0
11
Conversion 1 1
111012 = 2910 0 1 010111101 00101011
1 001
0 1 0 1 0 01
1 0 01 11011
0
1 011 0 001011
5 00
1 0100
Conversion of Binary to
Decimal numbers
110112 = 1(24 ) + 1(23 ) + 0(22 ) + 1(21 ) + 1(20 )
= 1(16) + 1(8)+ 0(4)+ 1(2) + 1(1)
= 16 + 8+ 0+ 2 + 1
= 2710
2910 = 111012
Conversion of Decimal to Binary
number
Write the decimal 29.2510 to binary
Division by 2 Quotient Remainder
2 I 29 14 1
2 I 14 7 0
2I 7 3 1
2I 3 1 1
2I 1 0 1
29.2510 = 11101.012
OPERATIONS
OF
BINARY
NUMBER
Addition (binary)
0 + 0 = 0 ; 1 + 0 = 1 ; and 1 + 1 = 10
1 11 1
011 01
01011
11000
Subtraction (binary)
0 - 0 = 0 ; 1 - 0 = 1 ; 0 - 1 = 1 (need to borrow 1) ;
and 1 -1 = 0
0 10
111 0
1001
101
Multiplication (binary)
0 * 0 = 0 ; 1 * 0 = 0 ; and 1 * 1 = 1
1 0 01
1110
0000
1001
1001
1001
1111110
Division (binary)
111
11 10101
011
100
11
11
11
0
Error and Error
Correction
Error – case of mismatched data.
Bit Error – in a data sequence, if 1 is changed
to 0 or 0 is changed to 1.
Single Bit Error – the change in one bit in
the whole data sequence.
Multiple Bit data error – if there is a
change in two or more bits of data sequence of
transmitter to receiver.
Burst Error – the change of set of bits in
data sequence.
Parity bit – means nothing but an additional bit added
to the data at the transmitter before transmitting the
data.
Even Parity
Parity Bit Parity Bit
1000001 - 0 10001111 - 1
110000011 – 0 11100000 - 1
Odd Parity
1 0 1 1
D7 D6 D5 P4 D3 P2 P1
P1 = 1 1 1 = 1
P2 = 1 0 1 = 0
P4 = 1 0 1 = 0
Codeword: 1010101
THE END