Tuesday, February 21, 2006


Conversion from decimal to binary
  1. General method of conversion:
    Conversion from decimal to binary system can be performed as the following example:
    To convert No. (13 ) from decimal to binary do the following:
    a) Divide the decimal number (13) on (2) the base number of binary system. 13/2 = 6 ( 6 × 2 =12 and the remaining number after the division operation is: 13 – 12 = 1)
    b) Divide the resultant integer number from the division operation of the previous step (6) on (2)6/2 = 3 (3 × 2 = 6 and the remaining number after the division operation is: 6 – 6 = 0 ).
    c) Divide the resultant integer number from the division operation of the previous step (3) on (2)3/2 = 1 (1 × 2 = 2 and the remaining number after the division operation is: 3 – 2 =1 ).
    d) Divide the resultant integer number from the division operation of the previous step (1) on (2)1/2 = 0 (0 × 2 = 0 and the remaining number after the division operation is: 1 – 0 =1 ).
    e) Put the remaining numbers of all the previous division operations together where the remaining number of the last step (step 4) is the first number on the left side.
    f) The resultant binary number is: 1101 equal to the decimal number 13.
    Another example to convert the decimal No. (30) to binary:
    Division Result Remaining number
    a) 30/2 15 0
    b) 15/2 7 1
    c) 7/2 3 1
    d) 3/2 1 1
    e) 1/2 0 1
    f) The resultant binary number is: 11110 equal to the decimal number 30.
  2. Convert an octet from decimal to binary system:
    An octet is 8-bit (one byte) has the following potential values:
    Bit No. = Scientific notation = Decimal notation
    1st bit = (27) = 128 "the most left bit"
    2nd bit = (26) = 64
    3rd bit = (25) = 32
    4th bit = (24) = 16
    5th bit = (23) = 8
    6th bit = (22) = 4
    7th bit = (21) = 2
    8th bit = (20) = 1
    1st bit (128)+2nd bit (64)+3rd bit (32)+4th bit (16)+5th bit (8)+ 6th bit (4)+7th bit (2)+8th bit (1) = octet total (255).
    Thus, 8-bit = One byte = 255
    For example, to convert a decimal number (172) to binary you can start from the first bit by considering its potential value (128). Because (128) doesn't exceed the target value of (172), write (1) in the first bit place. Next, move to the second bit and consider its potential value (64).
    Because 128 + 64 exceed the target value (172), write (0) in the second bit place.
    Now you still have a total of 128+0 =128. Next, move to the third bit and consider its potential value (32).
    Because 128 + 32 doesn’t exceed the target value (172), write (1) in the third bit place.
    Now you have a total of 128+0+32=160. Next, move to the fourth bit and consider its potential value (16).
    Because 160 + 16 exceed the target value (172), write (0) in the fourth bit place.
    Now you still have a total of 128+0+32+0=160. Next, move to the fifth bit and consider its potential value (8).
    Because 160 + 8 doesn't exceed the target value (172), write (1) in the fifth bit place.
    Now you have a total of 128+0+32+0+8=168. Next, move to the sixth bit and consider its potential value (4).
    Because 168 + 4 yield the target value (172), write (1) in the sixth bit place and a (0) in both seventh and eighth bit places.
    Finally, the binary notation of this octet is:
    10101100 equal to the decimal notation (172).
    Exercise: Try to convert the previous example by the general method of conversion.
  3. Conversion of a decimal fraction to binary system:
    The conversion of a decimal fraction to binary system can be performed as the following steps:
    a) Multiply the fraction by (2).
    b) Consider the integer value of the resultant multiplication operation.
    c) Repeat the multiplication operation to the resultant fraction until you get an integer value (1):
    For example: To convert No. (0.625) to binary system:
    a) 0.625 × 2 = 1.25 1 "the most left number"
    b) 0.25 × 2 = 0.50 0
    c) 0.50 × 2 = 1 1
    Finally the binary notation of (0.625) is: 101
    Another example: conversion of a decimal fraction (0.375) to a binary system:
    a) 0.375 × 2 = 0.750 0 "the most left number"
    b) 0.750 × 2 = 1.5 1
    c) 0.5 × 2 = 1 1
    The binary notation of a decimal fraction (0.375) is: 011

0 Comments:

Post a Comment

<< Home