Module 13 - Introduction to Number Systems and Logic |
||||||||||||||||||||||||||||||||||||||||||||||||||
Module 13 − Introduction to Number Systems and Logic Pages i, 1−1, 1−11, 1−21, 1−31, 1−41, 1−51, 1−61, 2−1, 2−11, 2−21, 2−31, 3−1, 3−11, 3−21, 3−31, 3−41, Index
Q76. 110111.0101012.
OCTAL CONVERSION
The conversion of one number system to another, as we explained earlier, is done to simplify computer programming or interpreting of data.
Octal to Binary
For some computers to accept octal data, the octal digits must be converted to binary. This process is the reverse of binary to octal conversion.
To convert a given octal number to binary, write out the octal number in the following format. We will convert octal 5678:
Next, below each octal digit write the corresponding three-digit binary-coded octal equivalent:
Solution: 5678 equals 101 110 1112
Remove the conversion from the format:
1011101112
As you gain experience, it may not be necessary to use the block format.
An octal fraction (.1238) is converted in the same manner, as shown below:
Solution: .1238 equals .0010100112
Apply these principles to convert mixed numbers as well.
Convert 32.258 to binary:
1-51 Solution: 32.258 equals 011010.0101012
Convert the following numbers to binary:
Octal to Hex
You will probably not run into many occasions that call for the conversion of octal numbers to hex. Should the need arise, conversion is a two-step procedure. Convert the octal number to binary; then convert the binary number to hex. The steps to convert 53.78 to hex are shown below:
Regroup the binary digits into groups of four and add zeros where needed to complete groups; then convert the binary to hex.
Solution: 53.78 equals 2B.E16
Convert the following numbers to hex:
HEX CONVERSION
The procedures for converting hex numbers to binary and octal are the reverse of the binary and octal conversions to hex.
1-52 Hex to Binary
To convert a hex number to binary, set up the number in the block format you used in earlier conversions. Below each hex digit, write the four-digit binary equivalent. Observe the following example:
Convert ABC16 to binary:
Solution: ABC16 = 1010101111002
Hex to Octal
Just like the conversion of octal to hex, conversion of hex to octal is a two-step procedure. First, convert the hex number to binary; and second, convert the binary number to octal. Let's use the same example we used above in the hex to binary conversion and convert it to octal:
Convert these base 16 numbers to their equivalent base 2 and base 8 numbers:
Q87. 2316
Q88. 1B16
Q89. 0.E416
Q90. 45.A16
CONVERSION to DECIMAL
Computer data will have little meaning to you if you are not familiar with the various number systems. It is often necessary to convert those binary, octal, or hex numbers to decimal numbers. The need for understanding is better illustrated by showing you a paycheck printed in binary. a check in the amount of $10,010,101.002 looks impressive but in reality only amounts to $149.0010
1-53 Binary to Decimal
The computer that calculates your pay probably operates with binary numbers, so a conversion takes place in the computer before the amount is printed on your check. Some computers, however, don't automatically convert from binary to decimal. There may be times when you must convert mathematically.
To convert a base 2 number to base 10, you must know the decimal equivalent of each power of 2. The decimal value of a power of 2 is obtained by multiplying 2 by itself the number of times indicated by the exponent for whole numbers; for example, 24 = 2 x 2 x 2 x 2 or 1610.
For fractional numbers, the decimal value is equal to 1 divided by 2 multiplied by itself the number of times indicated by the exponent. Look at this example:
The table below shows a portion of the positions and decimal values of the binary system:
Remember, earlier in this chapter you learned that any number to the 0 power is equal to 110.
Another method of determining the decimal value of a position is to multiply the preceding value by 2 for whole numbers and to divide the preceding value by 2 for fractional numbers, as shown below:
Let's convert a binary number to decimal by using the positional notation method. First, write out the number to be converted; then, write in the decimal equivalent for each position with a 1 indicated. Add these values to determine the decimal equivalent of the binary number. Look at our example:
1-54
You may want to write the decimal equivalent for each position as we did in the following example. Add only the values indicated by a 1.
You should make sure that the decimal values for each position are properly aligned before adding. For practice let's convert these binary numbers to decimal:
Octal to Decimal
Conversion of octal numbers to decimal is best done by the positional notation method. This process is the one we used to convert binary numbers to decimal.
First, determine the decimal equivalent for each position by multiplying 8 by itself the number of times indicated by the exponent. Set up a bar graph of the positions and values as shown below:
1-55
To convert an octal number to decimal, write out the number to be converted, placing each digit under the proper position.
Example:
Next, multiply the decimal equivalent by the corresponding digit of the octal number; then, add this column of figures for the final solution:
Solution: 7438 is equal to 48310
Now follow the conversion of 265258 to decimal:
Solution: 11,60510 is the decimal equivalent of 26,5258 To convert a fraction or a mixed number, simply use the same procedure. Example: Change .58 to decimal:
1-56
Example: Convert 24.368 to decimal:
Solution: 24.368 equals 20.4687510
If your prefer or find it easier, you may want to convert the octal number to binary and then to decimal.
Convert the following numbers to decimal:
Hex to Decimal
It is difficult to comprehend the magnitude of a base 16 number until it is presented in base 10; for instance, E016 is equal to 22410. You must remember that usually fewer digits are necessary to represent a decimal value in base 16.
When you convert from base 16 to decimal, you may use the positional notation system for the powers of 16 (a bar graph). You can also convert the base 16 number to binary and then convert to base 10.
Note in the bar graph below that each power of 16 results in a tremendous increase in the decimal equivalent. Only one negative power (16-1) is shown for demonstration purposes:
1-57
Just as you did with octal conversion, write out the hex number, placing each digit under the appropriate decimal value for that position. Multiply the decimal value by the base 16 digit and add the values. (Convert a through F to their decimal equivalent before multiplying). Let's take a look at an example.
Convert 2C16 to decimal:
The decimal equivalent of 2C16 is 4410. Use the same procedure we used with binary and octal to convert base 16 fractions to decimal. If you choose to convert the hex number to binary and then to decimal, the solution will look like this:
Convert these base 16 numbers to base 10:
Q103. 2416
Q104. A516
Q105. DB16
1-58 Q106. 3E6.516
BINARY-CodeD DECIMAL
In today's technology, you hear a great deal about microprocessors. a microprocessor is an integrated circuit designed for two purposes: data processing and control.
Computers and microprocessors both operate on a series of electrical pulses called words. a word can be represented by a binary number such as 101100112. The word length is described by the number of digits or BITS in the series. a series of four digits would be called a 4-bit word and so forth. The most common are 4-, 8-, and 16-bit words. Quite often, these words must use binary-coded decimal inputs.
Binary-coded decimal, or BCD, is a method of using binary digits to represent the decimal digits 0 through 9. a decimal digit is represented by four binary digits, as shown below:
decimal digit. Since many devices use BCD, knowing how to handle this system is important. You must realize that BCD and binary are not the same. For example, 4910 in binary is 1100012, but 4910 in BCD is 01001001BCD. Each decimal digit is converted to its binary equivalent.
BCD Conversion
You can see by the above table, conversion of decimal to BCD or BCD to decimal is similar to the conversion of hexadecimal to binary and vice versa.
For example, let's go through the conversion of 26410 to BCD. We'll use the block format that you used in earlier conversions. First, write out the decimal number to be converted; then, below each digit write the BCD equivalent of that digit:
1-59
The BCD equivalent of 26410 is 001001100100BCD. To convert from BCD to decimal, simply reverse the process as shown:
BCD Addition
The procedures followed in adding BCD are the same as those used in binary. There is, however, the possibility that addition of BCD values will result in invalid totals. The following example shows this:
Add 9 and 6 in BCD:
The sum 11112 is the binary equivalent of 1510; however, 1111 is not a valid BCD number. You cannot exceed 1001 in BCD, so a correction factor must be made. To do this, you add 610 (0110BCD) to the sum of the two numbers. The "add 6" correction factor is added to any BCD group larger than 10012. Remember, there is no 10102, 10112, 11002, 11012, 11102, or 11112 in BCD:
The sum plus the add 6 correction factor can then be converted back to decimal to check the answer. Put any carries that were developed in the add 6 process into a new 4-bit word:
Now observe the addition of 6010 and 5510 in BCD:
1-60
|
||||||||||||||||||||||||||||||||||||||||||||||||||