Tuesday, August 16, 2011

Hexadecimal Addition



HexadecimalAddition

Decimalbasic concepts:
Decimalis base 10.
Thereare 10 digits in counting (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
Whenyou reach 10, you carry a “1” over to the next column
Thenumber after 9 is 10

Hexadecimalbasic concepts:
Hexadecimalis base 16.
Thereare 16 digits in counting (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D,E, F)
Whenyou reach 16, you carry a “1” over to the next column
Thenumber after F (decimal 15) is 10 in hex (or 16 in decimal)

Use thefollowing steps to perform hexadecimal addition:

1. Addone column at a time.
2. Convertto decimal and add the numbers.
3a. If the result of step two is 16 orlarger subtract the result from 16 and carry 1 to the next column.
3b. If the result of step two is lessthan 16, convert the number to hexadecimal.

Example: (Use the color code ineach step to see what’s happening)





The problem:

You are to add these numbers:











A
C
5
A
9



E
D
6
9
4









*********************************************************************************




Carry Over:








1. Add one column at a time
2. Convert to decimal & add (9 + 4 = 13)
3. Follow less than 16 rule
Decimal 13 is hexadecimal D



A
C
5
A
9



E
D
6
9
4







D


*********************************************************************************








Carry Over:





1


1. Add next column
2. Convert to decimal & add (10 + 9 = 19)
3. Follow 16 or larger than 16 rule
(19 – 16 = 3 carry a 1)



A
C
5
A
9



E
D
6
9
4






3
D


*********************************************************************************








Carry Over:





1


1. Add next column
2. Convert to decimal & add (1 + 5 + 6 = 12)
3. Follow less than 16 rule, convert to hex
Decimal 12 is hexadecimal C



A
C
5
A
9



E
D
6
9
4





C
3
D


*********************************************************************************








Carry Over:



1




1. Add next column
2. Convert to decimal & add (12 + 13 = 25)
3. Follow 16 or larger than 16 rule
(25 – 16 = 9 carry a 1)



A
C
5
A
9



E
D
6
9
4




9
C
3
D


*********************************************************************************








Carry Over:

1





1. Add next column
2. Convert and add (1 + 10 + 11 = 22)
3. Follow 16 or larger than 16 rule
(22 – 16 = 6 carry a 1)


A
C
5
A
9


B
D
6
9
4


6
9
C
3
D


*********************************************************************************








Carry Over:

1





1. Add next column
2. Convert and add (1 + 0 + 0 = 1)
3. Follow less than 16 rule

0
A
C
5
A
9

0
B
D
6
9
4

1
6
9
C
3
D





For substraction

http://www.wisc-online.com/objects/ViewObject.aspx?ID=TMH3703

complement the substraction portion and do normal addition as explained above

  569D
-  FDA

  569D
- 0FDA

Now find complement of 0FDA = convert every bit to dec and 16-val.
So, 0FDA becomes F025

No comments:

Post a Comment