<< Chapter < Page | Chapter >> Page > |
In the previous section, we saw how the numbers 0 and 1 could represent `false' and `true' and could be used in decision making. Often we want to program a computer to count with numbers. To do this we need a way of writing any number using nothing other than 0 and 1. When written in this way, numbers are called binary numbers .
A way of writing any number using only the digits 0 and 1.
In normal (denary) numbers, we write 9+1 as 10. The fact that the `1' in 10 is the second digit from the right tells us that it actually means 10 and not 1. Similarly, the `3' in 365 represents 300 because it is the third digit from the right. You could write 365 as . You will notice the pattern that the th digit from the right represents . In binary, we use the th digit from the right to represent . Thus 2 is written as 10 in binary. Similarly is written as 100 in binary, and is written as 1000 in binary.
Convert the binary number 10101 to its denary equivalent.
We start on the right. The `1' on the right does indeed represent one. The next `1' is in the third place from the right, and represents . The next `1' is in the fifth place from the right and represents . Accordingly, the binary number 10101 represents 16+4+1 = 21 in denary notation.
Convert the decimal number 12 to its binary equivalent.
Firstly we write 12 as a sum of powers of 2, so 12 = 8+4. In binary, eight is 1000, and four is 100. This means that twelve = eight + four must be 1000+100 = 1100 in binary. You could also write 12 as in binary.
How do you write numbers as a sum of powers of two? The first power of two (the largest) is the largest power of two which is not larger than the number you are working with. In our last example, where we wanted to know what twelve was in binary, the largest power of two which is not larger than 12 is 8. Thus 12 = 8 + something. By arithmetic, the `something' must be 4, and the largest power of two not larger than this is 4 exactly. Thus 12 = 8 + 4, and we have finished.
A more complicated example would be to write one hundred in binary. The largest power of two not larger than 100 is 64 (1000000 in binary). Subtracting 64 from 100 leaves 36. The largest power of two not larger than 36 is 32 (100000 in binary). Removing this leaves a remainder of 4, which is a power of two itself (100 in binary). Thus one hundred is 64 + 32 + 4, or in binary 1000000 + 100000 + 100 = 1100100.
Once a number is written in binary, it can be represented using the low and high voltage levels of digital electronics. We demonstrate how this is done by showing you how an electronic counter works.
To make a counter you need several `T flip flops', sometimes called `divide by two' circuits. A T flip flop is a digital circuit which swaps its output (from 0 to 1 or from 1 to 0) whenever the input changes from 1 to 0. When the input changes from 0 to 1 it doesn't change its output. It is called a flip flop because it changes (flips or flops) each time it receives a pulse.
Notification Switch
Would you like to follow the 'Siyavula textbooks: grade 12 physical science' conversation and receive update notifications?