Uploaded by Brandon Cagape

Assignment 1 Cagape Logic (5)

advertisement
Brandon Sage Cagape
BECE 311L
Answer the following questions:
1.
How to convert the following?
a.
Decimal to binary and vice versa
Answer:
From Decimal to Binary- Divide the decimal number by 2 repetitively until the quotient yields a zero
value at the left side of the decimal . List all the corresponding quotients. If a specific quotient has a
remainder, write 1. If a specific quotient has no remainder, write 0. The binary value of the decimal
number is the number formed from the most recent 1 or 0 value (also called MSB) all the way up the
first 0 or 1 value (also called LSB)
Example: (42)10 to ()2
42/2 = 21..................0 (first value/ LSB)
21/2 = 10.5 ..............1
10/2 = 5...................0
5/2= 2.5...................1
2/2= 1......................0
1.2/2= 0.5................1 (recent/ MSB)
Therefore, (42)10 is equivalent to (101010)2
From Binary to Decimal- Label the binary digits (0 or 1) with its number of places away from the decimal
point. That is, the first digit at the left side of the decimal is labelled 0 and the suceeding digits are
labelled with 1,2,3, etc. whereas the first digit at the right side of the decimal is labelled -1 and the
succeeding digit are labelled -2, -3, -4 etc. The base 2 is raised to a power which is the number
corresponding to the binary digit and then multiply it to its corresponding binary digit to get a product.
Finally, add all products.
Example: (1010.11)2 to ()10
Label/Power:
3 2 1 0 -1 -2
Binary Digits: 1 0 1 0 . 1 1
So, ()10 = (23×1)+(22×0)+(21×1)+(20×0)+(2-1×1)+(2-2×1)= 10.75
Therefore (1010.11)2 is equivalent to (10.75)10
b.
Octal to Decimal and vice versa
Answer:
From Octal to Decimal- Label the octal digits (0-7) with its number of places away from the decimal
point. That is, the first digit at the left side of the decimal is labelled 0 and the suceeding digits are
labelled with 1,2,3, etc. whereas the first digit at the right side of the decimal is labelled -1 and the
succeeding digit are labelled -2, -3, -4 etc. The base 8 is raised to a power which is the number
corresponding to the octal digit and then multiply it to its corresponding octal digit to get a product.
Finally, add all products.
Example: (357.2)8 to ()10
Label/ Power: 2 1 0
Octal Digits: 3 5
-1
7 . 2
So, ()10 = (82×3)+(81×5)+(80×7)+(8-1×2)= 239.25
Therefore, (357.2)8 is equivalent to (239.25)10
From Decimal to Octal- Divide the decimal number by 8 repetitively until the quotient yields a zero value
at the left side of the decimal . List all the corresponding quotients. Multiply each number at the right
side of the decimal of each quotients by 8 to get the corresponding octal value. The octal value of the
decimal number is the number formed from the most recent value (also called MSB) all the way up the
first value (also called LSB)
Example: (366)10 to ()8
366/8 = 45.75............ (.75×8 = 6, LSB)
45/8 = 5.625.............. (.625×8 = 5)
5/8 = 0.625................(.75×8 = 5, MSB)
Therefore, (366)10 is equivalent to (556)8
c.
Binary to Hexadecimal and vice versa
Answer:
From Binary to Hexadecimal- Separate the digits into groups in which one group consists of 4 binary
digits or bits. The groupings starts from right to left. In one group, multiply each binary digit by powers
of 2 with the last binary digit being multiplied by 20. Add all products to get the hexadecimal equivalent.
If the sum of the products exceeds 9, then convert it to its corresponding hexadecimal form (10 is A, 11
is B, 12 is C, all the way to 15, which is equal to F). Do the same thing to the other groups.
Example: (10110111)2 to ()16
Group of Digits: (1
Powers:
0
1
1)
(0
1
23 22
21
20
23 22
1
1)
21 20
Sum of Groups: (23×1)+ (22×0)+(21×1)+(20×1) = 11 =B
(23×0)+ (22×1)+(21×1)+(20×1) = 7
Therefore, (10110111)2 is equivalent to (B7)16
From Hexadecimal to Binary- Separate each hexadecimal digits. If the hexadecimal digit is in alphabetical
form convert it to its corresponding numerical value (10 is A, 11 is B, 12 is C, all the way to 15, which is
equal to F). In one hexadecimal digit, determine the powers of 2 (from 20 to 23) that when added results
to that hexadecimal digit then do the same thing to other digits. The powers of 2 that are the addends
of the hexadecimal digit will be labelled 1 and the other remaining powers are labelled 0.
Example: (A9)16 to ()2
Hexadecimal Digits:
A
9
Numerical Equivalent:
10
9
Powers of 2:
23, 22, 21, 20
23, 22, 21, 20
0's and 1's:
1 0 1 0 (since 23+21= 10)
1 0 0 1 (since 20+23= 9)
The 0's and 1's being formed 10101001. Therefore (A9) 16 is equivalent to (10101001)2
d.
Hexadecimal to Decimal and vice versa
Answer:
From Hexadecimal to Decimal- Convert hexadecimal digits to its corresponding numerical digit. Multiply
each hexadecimal digit by powers of 16 with the last digit to be multiplied by 160. Add all products to get
the decimal equivalent.
Example: (23E)16 to ()10
Hexadecimal Digits:
2
3
E
Numerical Value:
2
3
14
162
161
160
Power of 16:
Sum= (162×2)+(161×3)+(160×14)= 574
Therefore, (23E)16 is equivalent to (574)10
From Decimal to Hexadecimal- Divide the decimal number by 16 repetitively until the quotient yields a
zero value at the left side of the decimal . List all the corresponding quotients. Multiply each number at
the right side of the decimal of each quotients by 16 to get the corresponding hexadecimal digit. The
hexadecimal value of the decimal number is the number formed from the most recent value (also called
MSB) all the way up the first value (also called LSB). If the hexadecimal digit is beyond 9, convert it to
hexadecimal form (10 is A, 11 is B, all the way to 15 is F)
Example: (479)10 to ()16
479/16= 29.9375........................................ (.9375×16= 15 = F)
29/16= 1.8125............................................ (.8125×16= 13 = D)
1/16 = 0.0625............................................. (.0625×16= 1)
Therefore, (479)10 is equivalent to (1DF)16
Download