Number Systems The 0s and 1s present in the logic circuits discussed in the course can be used to represent real data inside logic circuitry in, for example, microprocessors. To do this a binary format has to be adopted. The usual practise is to use so-called pure binary coding whereby each binary digit (either 0 or 1) carries a certain weight according to its position in the binary number. So, for example 1101 = 1x + 1x + 0x + 1x + 0x + 0x 00 25 24 23 22 21 20 = + + + + + 32 16 0 4 0 0 = 52 The same approach applies to non- integral numbers so, for example 110.1 = 1x2 + 1x + 0x + 1x + 0x + 1x2- 2 01 21 20 2-1 2-2 3 = + + + 0. + + 0.1 4 2 0 0 5 25 = 6.6 25 These examples illustrate binary to decimal conversion. To convert a fractional decimal number to binary then the procedure to follow is first divide the number at the decimal point and treat the two parts separately. For the integer part then repeatedly divide it by 2 and store the remainder until nothing is left. The remainders when reverse- ordered gives the first part of the binary number. The reverse-ordering comes about since the first division by 2 gives the least significant bit (lsb) and so on until the last division which gives the most significant bit (msb). For the fractional part repeatedly multiply by 2 and record the carries i.e. when the resulting number is greater than 1. Repeat this process until the desired precision is achieved. An full example of this technique is given in the Solved Problems. A useful way of expressing long pure binary coded numbers is by the use of hexadecimal numbers i.e. base 16. This is because each group of four bits (called a nibble since 2 nibbles make a byte!) can be converted into one hexadecimal number. The mapping between binary, decimal and hexadecimal (hex.) numbers is shown below. Decima Binar He Decima Binar He l y x l y x 0 0000 0 8 1000 8 1 0001 1 9 1001 9 2 0010 2 10 1010 A 3 0011 3 11 1011 B 4 0100 4 12 1100 C 5 0101 5 13 1101 D 6 0110 6 14 1110 E 7 0111 7 15 1111 F To convert a binary number into its hexadecimal equivalent first ensure that the binary number has a number of digits that is a multiple of 4, if not add zeros to the left hand side of the number until it does. Then split the number into nibbles and convert each nibble into its hexadecimal counterpart. An example of binary to hexadecimal conversion can be found in the Solved Problems.