## PHYS345 Electricity and Electronics

Hint for D9.3

For longer binary numbers, it is usually helpful to first convert to hex and then use the power-of-16 placeholders to make the conversion. For example, 11 1010 0110 = 3A6H.

One way to convert decimal to binary is to perform successive divisions by 2, checking for an odd or even number at each step. If odd, then record a 1 for the bit, and subtract one from the quotient. If even, then record a 0 for the bit. Continue dividing by 2 until the number become fractional.

For example:
 2001 odd 1 least significant digit sub 1, div 2 1000 even 0 div 2 500 even 0 div 2 250 even 0 div 2 125 odd 1 sub 1, div 2 62 even 0 div 2 31 odd 1 sub 1, div 2 15 odd 1 sub 1, div 2 7 odd 1 sub 1, div 2 3 odd 1 sub 1, div 2 1 odd 1 most significant digit

Answer: 0111 1101 0001

Alternatively, convert 200010 first to hex, then that number (7D1H) to binary.

In binary, 1 + 1 + 1 = 11
That is, 1 carry 1.

For binary to hex conversion, go from right to left setting up groups of 4 bits, then associate the appropriate hex digit with each nibble.

 0 1100 binary representation of 1210 1 0011 one's complement + 1 add one to find the 1 0100 two's complement

The two's complement of 0 1111 (15) is 1 0001.
The two's complement of 1 0011 (3) is 1 1101.

"http://www.physics.udel.edu/~watson/phys345/protected/exercises/hints/1022.html"
Last updated Oct. 24, 1998.
Copyright George Watson, Univ. of Delaware, 1998.