Many electronic and microcontroller projects require the use of a particular base numbering system, such as BCD on thumbwheel switches, hexadecimal (base-16) on hex encoders, and binary in shift registers and dip switches. Often it is necessary to convert between bases, for example, when using a decade counter and converting a BCD value of a switch into a base-10 (that is, decimal) value that can be easily displayed. In particular, all math is done in binary in digital systems, as well as at the analog/digital interface (like when you sample a waveform or measure a voltage) using only two digits: 1 and 0.
This is a brief instructable on what numbers represent and how to convert between the bases in which they are represented. This was included in one of my other guides when I realized that it should be separated out and put into its own instructable. After reading this guide you should be able to look at a binary number like "11101011" and tell that it represents the number 235 or convert the hex value "0xC0E4" to its binary equivalent of "1100000011100100" and decimal representation of 19980 without the use of a calculator (unless you suck apples at addition,subtraction,or division, in which case I feel your pain and wholly suggest keeping your favorite calculator handy).
However, no heavy math is needed and you won't need to do anything outside of basic math so don't sweat it if you're mathematically challenged. This is part of the fun side of math.
Step 1: Understanding Number Representations
As just mentioned and you probably already knew, a number's base dictates how many numbers are used in the counting system. The most common bases are discussed next, but before that a brief detour on what --conceptually--a number means. Let's take the base-10 number, 28810.
Note that I follow convention when a common base is not implied and explicitly state the base as a subscript to the number.
Decimal (base-10, or denary)
What does 28810 mean, exactly? This value explicates that this number encompasses two 100's, eight 10's, and 8 units. This can be succinctly shown as:
28810 = (2 * 100) + (8 * 10) + (8 * 1)
28810 = (2 * 102) + (8 * 101) + (8 * 100)
= 200 + 80 + 8
htun = (h * n2) + (t * n1) + (u * n0) where h=hundreds,t=tens,u=units
As read across left to right, each number increases the total value by that number * base to the power of its place. This notation will become useful when I show you how to convert any base into base-10/decimal in the next step. There's not much to say about denary until a few more steps.