**Digital Electronics: Binary Basics**

Digital electronic circuits rely on the binary number system. Thus, before you can understand the details of how digital circuits work, you need to understand how the binary numbering system works.

Binary* *is one of the simplest of all number systems because it has only two numerals: 0 and 1. In the decimal system (with which most people are accustomed), you use 10 numerals: 0 through 9.

In an ordinary decimal number, such as 3,482, the rightmost digit represents ones; the next digit to the left, tens; the next, hundreds; the next, thousands; and so on. These digits represent powers of ten: first 10^{0} (which is 1); next, 10^{1} (10); then 10^{2 }(100); then 10^{3 }(1,000); and so on.

In binary, you have only two numerals rather than ten, which is why binary numbers look somewhat monotonous, as in 110011, 101111, and 100001.

The positions in a binary number (called *bits *rather than *digits)* represent powers of two rather than powers of ten: 1, 2, 4, 8, 16, 32, and so on. To figure the decimal value of a binary number, you multiply each bit by its corresponding power of two and then add the results. The decimal value of binary 10111, for example, is calculated as follows:

Fortunately, converting a number between binary and decimal is something that a computer is good at — so good, in fact, that you’re unlikely ever to need to do any conversions yourself. The point of learning binary is not to be able to look at a number such as 1110110110110 and say instantly, “Ah! Decimal 7,606!”

Here are some of the most interesting characteristics of binary, which explain how the system is similar to and different from the decimal system:

**In decimal, the number of decimal places allotted for a number determines how large the number can be.**If you allot six digits, for example, the largest number possible is 999,999. Because 0 is itself a number, however, a 6-digit number can have any of 1 million different values.Similarly, the number of bits allotted for a binary number determines how large that number can be. If you allot 8 bits, the largest value that number can store is 11111111, which happens to be 255 in decimal. Thus, a binary number that is 8 bits long can have any of 256 different values (including 0).

**To quickly figure how many different values you can store in a binary number of a given length, use the number of bits as an exponent of two.**An 8-bit binary number, for example, can hold 2^{8}values. Because 2^{8}is 256, an 8-bit number can have any of 256 different values. This is why a*byte*— 8 bits — can have 256 different values.**This “powers of two” thing is why digital systems don’t use nice, even round numbers for measuring such values as memory capacity.**A value of 1k, for example, isn’t an even 1,000 bytes: It’s actually 1,024 bytes, because 1,024 is 2^{10}. Similarly, 1MB isn’t an even 1,000,000 bytes, but 1,048,576 bytes, which happens to be 2^{20}.Power Bytes Kilobytes Power Bytes k, MB, or GB 2 ^{1}2 2 ^{17}131,072 128k 2 ^{2}4 2 ^{18}262,144 256k 2 ^{3}8 2 ^{19}524,288 512k 2 ^{4}16 2 ^{20}1,048,576 1MB 2 ^{5}32 2 ^{21}2,097,152 2MB 2 ^{6}64 2 ^{22}4,194,304 4MB 2 ^{7}128 2 ^{23}8,388,608 8MB 2 ^{8}256 2 ^{24}16,777,216 16MB 2 ^{9}512 2 ^{25}33,554,432 32MB 2 ^{10}1,024 1k 2 ^{26}67,108,864 64MB 2 ^{11}2,048 2k 2 ^{27}134,217,728 128MB 2 ^{12}4,096 4k 2 ^{28}268,435,456 256MB 2 ^{13}8,192 8k 2 ^{29}536,870,912 512MB 2 ^{14}16,384 16k 2 ^{30}1,073,741,824 1GB 2 ^{15}32,768 32k 2 ^{31}2,147,483,648 2GB 2 ^{16}65,536 64k 2 ^{32}4,294,967,296 4GB