Binary and BCD Tutorial
Binary and BCD Tutorial
This tutorial should be used in conjunction with the Oxford book page 30 and the Skeete & Skeete page
33.
64 32 16 8 4 2 1
The base 2 number is written under the headings, then the base 10 numbers under which a 1 fall are
added. `e.g. 110101 is calculated as 32+16+4+1 = 5310
To convert from base 10 to base 2, the base 10 number is divided by 2 repeatedly until 0 R 1 is
reached. The remainders are then copies from bottom up and written Left to Right.
Adding in base 2
All additions surround the following basics: 0+0=0; 0+1=1; 1+1= 10; 1+1+1=11
With these numbers memorized, here is the BCD conversion of the number 635 without considering the
whether it is positive or negative.
You must however note that the computer cannot assume anything. Therefore you must tell the
computer whether the number is positive or negative. To do this you must use a 4 bit code. There are
two formats which are accepted by CXC. Here there are:
For positive used either 1010 or 1110 For negative (minus) use either 1011 or 1111
So, to rewrite 635, which we assumed is a positive number, we must write either 1010 or 1110 to
represent the sign BEFORE writing the code for each digit.
Here it is: 1010 0110 0011 0101 correctly written: 1010011000110101
The alternative: 1110 0110 0011 0101 correctly written: 1110011000110101
If the number was -635 then the result would be 1011 0110 0011 0101 or 1111 0110 0011 0101
Key to remember: you MUST always write the sign bit First then the bits for each digit.
You will be asked to present your books at the next class to show that you have completed the tutorial.