Specifications

Appendix B - Numeric Systems
We can check whether result is correct by transferring these number to decimal numeric system
and by performing addition in it. With a transfer we get a value 10 as the first number, value 9 as
the second, and value 19 as the sum. Thus we have proven that operation was done correctly.
Trouble comes when sum is greater than what can be represented by a binary number with a
given number of binary digits. Different solutions can be applied then, one of which is expanding
the number of binary digits in the sum as in the previous example.
Subtraction, like addition is done on the same principle. The result of subtraction between two
zeros, or two ones remains a zero. When subtracting one from zero, we have to borrow one from
binary digit which has a higher value in the binary number.
Example:
By checking the result as we did with addition, when we translate these binary numbers we get
decimal numbers 10 and 9. Their difference corresponds to number 1 which is what we get in
subtraction.
B.3 Hexadecimal numeric system
Hexadecimal numeric system has a number 16 as its basis. Since the basis of a numeric system is
16, there are 16 different digits that can be found in a hexadecimal number. Those digits are "0,
1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F". Letters A, B, C, D, E and F are nothing but values 10, 11,
12, 13, 14 and 15. They are introduced as a replacement to make writing easier. As with a binary
system, here too, we can determine with same formula what is the biggest decimal number we
can represent with a specific number of hexadecimal digits.
Example: With two hexadecimal digits
Usually, hexadecimal number is written with a prefix "$" or "0x" ,or suffix"h" , to emphasize the
numeric system. Thus, number A37E would be written more correctly as $A37E, 0xA37E, or
A37Eh. In order to translate a hexadecimal number into a binary numeric system it is not
necessary to perform any calculation but simple exchange of hexadecimal digits with binary digits.
Since the maximum value of a hexadecimal number is 15, that means that it is enough to use 4
binary digits for one hexadecimal digit.
Example:
By checking, that is transferring both numbers into decimal numeric system, we get a number 228
http://www.mikroelektronika.co.yu/english/product/books/PICbook/B_Dodatak.htm (4 of 6) [4/2/2003 16:19:30]