# Community

Register

 News

 Reviews

 Guides & Tutorials

 More

HOME  EMBEDDED  HEXADECIMAL AND BINARY NUMBER SYSTEM BASICS FOR EMBEDDED PROGRAMMING

Hexadecimal and Binary Number System basics
for Embedded Programming

Search ...

Posted By Umang Gajera Posted date: June 27, 2012 in: Embedded 5 Comments
To get started in Embedded programming following things need to be absolutely clear in our heads:

SUBSCRIBE VIA EMAIL

1. Binary and Hexadecimal Number Systems.
2. Interconversion of Binary and Hexadecimal.

3. Bit Level Operations.
4. Pointers , etc..

Subscribe

This tutorial mainly deals with Hexadecimal & Binary Numbering Systems and how to inter-convert
them. This lays the foundation for bit level operations. A complete tutorial for bit level(or bitwise)
operations is located @ www.ocfreaks.com/tutorial-embedded-programming-basics-in-c-bitwiseoperations/.

Numbering Systems & Interconversion
The Hexadecimal number system is famous in computing world specially in digital electronics. Its base16 because it uses 16 symbols to represent any number and each digit has an associated multiplication
factor which is a power of 16. Its basically a ‘compact’ numbering system in which few digits are
required to represent a su䏀༠ciently big number as compared to Decimal system. A Hexadecimal
number can readily converted into a binary number and vice-verse. Digits in Hexadecimal systems are
0 to 9 and A,B,C,D,E,F. Each digit in a hexadecimal system can be represented using 4 binary digits. The
order of the digits is in increasing power of 2. We will see Hexadecimal in detail but 䎸껠rst lets go through
Decimal and Binary numbering system & its conversion from binary to decimal.

Decimal System / Base-10
Decimal Numbering system or Base-10(technically) system : This the numbering system we use in our
daily lives. Each digit in a decimal number has an associated ‘weight’ which is nothing but the base
raised to the location number of the digit. Its Base-10 because it uses a combination of 10 ‘symbols’ or
say digits(0,1,2,3,4,5,6,7,8,9) to represent any number.
Consider a decimal number 2734 : By default the digit on extreme RIGHT is called LSD or Least
signi䎸껠cant digit. In out case its ‘4’. While the digit on extreme LEFT is called MSD or Most Signi䎸껠cant Digit
i.e ‘2’ – It most signi䎸껠cant because the change in digit at that location gives big changes in value of the
number. Same argument is applicable for LSD. As you know that Units place has a multiplication factor
of 1 , Tens has that of 10 , Hundreds has that of 100 and soo on.. similar to this we have multiplication
factor for each digit in binary number system as well.

Binary System / Base-2
Binary Numbering system or Base-2 system: It used only 2 symbols(called bits) ‘0’ & ‘1’ to represent any
number. On this Numbering or Counting System is computer understandable and hence most
important for embedded programming though its very simple to understand. Binary system can be
best understood by using an example to convert Binary to Decimal.
Lets take an example and try to understand binary to decimal conversion :
Consider a binary number say : 10011 which needs to be considered into decimal. Each bit in the binary
number carries a speci䎸껠c multiplication factor or say ‘weight’ or say ‘order’. By default the bit on
extreme right is starting or the 0th bit and that on the extreme left is last bit. Hence the 1st bit
(technically – 0th since in computing counting starts from 0 and not 1 hence as called ‘0 indexed’
system) from the right will have an order of 20 , next bit will have an order of 21 and so on.
Starting form the LSB i.e Least signi䎸껠cant bit from RIGHT we multiply each bit with increasing
power of 2 i.e. Bit 0(LSB) will be multiplied with 20 , Bit 1 multiplied with 21 , Bit 2 multiplied with 22
and on.