BETHEL HIGH DATA Data is represented using binary numbers
SCHOOL
0,1
REPRESENTATION These binary digits are known as bits
8 of these bits make up a byte
A byte represents an alphabetical letter or
some other character (one of the many
symbols on the keyboard)
Eg. A is 01000001
a is 01100001
a space is 00100000
CONVERTING DECIMALS TO
Binary Digits BINARY DIGITS
0= 0 This is done by continually dividing by 2
1= 1 and using the remainders (including 0)
2 = 10 from the bottom up to form the binary
3 = 11 number
4 = 100
5 = 101
6 = 110
7 = 111
8 = 1000
Convert 56 to binary number Convert 25 to binary number
Divide 56 continually by 2 until it cannot be
divided keeping the remainders in mind
2 56 2 25
2 28 + 0 2 12 + 1
2 14 + 0 2 6 +0
2 7 +0 2 3 +0
2 3 +1 111000 2 1 +1 11001
1 +1 therefore 56 = 111000 therefore 25 = 11001
1
Converting Binary numbers to
Convert the following to decimal
Decimal numbers
The place value of binary numbers is as 11001 is
follows:
1x16 1x8 0x4 0x2 1x1 = 16+8+0+0+1=25
32s 16s 8s 4s 2s 1s
Ie multiply by 2 to get the next place
111000 is
value on the left
1x32 1x16 1x8 0x4 0x2 0x1 =
32+16+8+0+0+0=56
Adding Binary Digits Example 2
1+0= 1 0+1=1 0+0=0 111
1+1=10 1+1+1=11 11101 1+1+1 = 3
1
+ 1111 3 = 11
eg 1001 1+1 = 10 100 place 1 in answer
+ 101 place 0 in answer and carry the 1
0 carry the 1
1
1001
+ 101
111 0
Example 2 contd Example 2 contd
1111 1111
11101 1+1+1 = 3 11101 1+1 = 10
+ 1111 3 = 11 + 1111
1100 place 1 in answer 101100 place 10 in answer
and carry the 1 since there is no more
digit to be added
Ans = 101100
2
Negative Numbers What is -25 ( using 8 bits)?
Twos Complement From slide no. six 25 was 11001
1. Switch all digits With 8 bits this will be 00011001
2. Add 1 to final digit Switch the digits 11100110
Eg Twos complement of 00010101 Add 1 to final digit +1
a) Switch the digits to get 11101010 11100111
b) Then add 1 to final digit +1
11101011 Therefore -25 is 11100111
Negative numbers BCD- Binary Coded Decimal
Sign and Magnitude Each decimal digit is represented by a four
The first digit represents the sign while the digit binary number
other 7 digits represent the number
0 represents a positive number Eg the BCD of 128 is
1 = 0001
1 represents a negative number
2 = 0010
8 = 1000
Eg 25 is 00011001 Therefore 128 = 0001 0010 1000
-25 is 10011001 000100101000
BCD- Binary Coded Decimal
ASCII ( pronounced askey)
If we need to represent a negative BCD
we must use 1111 in front of the positive Most popular method of representing
BCD
characters in the computer
For example 128 = 0001 0010 1000
A(merican) S(tandard) C(ode for)
Therefore -128 = 1111 0001 0010 1000
I(nformation) I(nterchange).]
For the positive BCD we may put 1110 in
front of the positive BCD or leave it as it is For eg A is 01000001
For example 128 = 0001 0010 1000 a is 01100001
or 128 = 1110 0001 0010 1000 a space is 00100000