Specifications

mikroElektronika | Free Online Book | PIC Microcontrollers | Introduction: World of Microcontrollers
Fig. 0-4 Binary and Hexadecimal number
The largest number that can be represented by 4 binary digits is the number 1111. It corresponds to the number 15 in decimal system. That
number is in hexadecimal system represented by only one digit F. It is the largest onedigit number in hexadecimal system. Do you see how
skillfully it is used? The largest number written with eightdigits is at the same time the largest twodigit hexadecimal number. Bear in mind that
the computer uses 8-digit binary numbers.
BCD Code
BCD code is actually a binary code for decimal numbers only. It is used to enable electronic circuits to communicate in a decimal number system
with peripherals and in a binary system within “their own world”. It consists of fourdigit binary numbers which represent the first ten digits (0, 1,
2, 3 ... 8, 9). Even though four digits can give a total of 16 possible combinations, only the first ten are used.
Number System Conversion
The binary numbering system is the most commonly used, the decimal system is the most understandable while the hexadecimal system is
somewhere between them. Therefore, it is very important to learn how to convert numbers from one numbering system to another, i.e. how to
turn a series of zeros and units into values understandable to us.
Binary to Decimal Number Conversion
Digits in a binary number have different values depending on their position in that number. Additionally, each position can contain either 1 or 0
and its value may be easily determined by its position from the right. To make the conversion of a binary number to decimal it is necessary to
multiply values with the corresponding digits (0 or 1) and add all the results. The magic of binary to decimal number conversion works...You
doubt? Look at the example:
110 = 1*2^2 + 1*2^1 + 0*2^0 = 6
It should be noted that for decimal numbers from 0 to 3 you only need two binary digits. For greater values, extra binary digits must be added.
Thus, for numbers from 0 to 7 you need three digits, for numbers from 0 to 15- four digits etc. Simply speaking, the largest binary number
consisting of n digits is obtained when the base 2 is raised by n. The result should be then subtracted by 1. For example, if n=4:
2^4 - 1 = 16 - 1 = 15
Accordingly, using 4 binary digits it is possible to represent decimal numbers from 0 to 15, including these two digits, which amounts to 16
different values in total.
Hexadecimal to Decimal Number Conversion
http://www.mikroe.com/en/books/picmcubook/ch0/ (6 of 30)5/3/2009 11:28:39 AM