MSM1 - Number Systems and Units of Measure

Materials:
Lecture Only
Objectives:
The student should become familiar with the following:
The Binary number system,
The Hexadecimal number system,
Conversions between Decimal, Binary and Hexadecimal,
Magnitudes and measurements in the IBM PC
Competency:
The student will become familiar with the Binary and Hexadecimal number systems including how to convert between them and Decimal. The student will understand the magnitudes of various measurements used to indicate the performance of a system and how to convert these values into common units for comparison.

Procedures

  1. The Binary number system is a place value number system like Decimal. Decimal or the base 10 number system has ten possible single digits with which all numbers are constructed. These digits are 0 to 9. Each place in the system imparts a meaning to the digit so that 999 is much smaller than 1000000.

  2. In the Decimal number system a number like 1234 does not mean “ten” or the sum of the digits 1+2+3+4 = 10. It means 1 thousand, 2 hundred and thirty four because each digit falls into a position that has a weight that is multiplied to the digit:

            1 X 1000 = 1000
            2 X  100 =  200
            3 X   10 =   30
            4 X    1 =    4
                     + ____
                       1234
    
  3. Each place in the Decimal number system has a value which is an assending power of the Base of the number system as follows:

             103       102       101       100 
             1         2         3         4
             Thousands Hundreds  Tens      Ones 
    

    Because 103 = 1000, 102 = 100, 101 = 10, 100 = 1 (by definition in exponential rules)

  4. This all makes perfect sense only because one uses decimal from birth. A number system can be defined based on any other number besides ten. Binary was chosen for electronic circuits because it is easier to distinguish between two states in a wire than three or more. A digital logic circuit can be designed to treat 3 volts as a one and zero volts as a zero. But what if there is leakage in the circuit matrix so that only 2 volts arrives? The engineers can define thresholds for the circuit so that any thing from 1 volt up will be a one and any thing below that will be a zero, but all circuits in the system should attempt to adhere as close as possible to zero volts for a zero and 3 volts for a one. In this case it is almost assured that ones and zeros will never be misinterpreted.

  5. Since this is the most reliable electronic choice for creating circuits that can take these voltages inputs and perform mathematical like actions on them, then a number system must be chosen that counts only using the two digits 0 and 1. This would be Binary or the base 2 number system which has been well known in mathematics through the ages.

  6. In Binary each place value is an ascending power of the base which is 2 instead of ten:

     27     26     25     24     23     22     21     20
     128's 64's  32's   16's    8's   4's  Twos   Ones       
    

    Because 27 = 128, 26 = 64, 25 = 32, 24 = 16, 23 = 8, 22 = 4, 21 = 2, 20 = 1. The easiest way to remember the place values in binary is to start on the far right and write “1”, double that and write it to the left “2”. Double that and write it to the left: “4”, and so on up to 128. This gives you the place values of eight bits. A bit in the computer industry is a contraction for the term: binary digit.

  7. Once you know the place values of the bits in a binary number then you can convert it to decimal:

    128    64    32   16    8    4    2    1 Place values
      0     1     1    0    0    1    1    1 The binary digit
     0 X 128 =    0
     1 X  64 =   64
     1 X  32 =   32
     0 X  16 =    0
     0 X   8 =    0
     1 X   4 =    4
     1 X   2 =    2
     1 X   1 =    1
            +  ____
                103
    

    So by multiplying the digit in a each place by the weight of each place and then adding all of these values up 01100111b = 103d. We put the little “b” after the number to warn the reader that the number is binary, we put the little “d” to warn the reader that the number is decimal.

  8. Now let's convert a decimal number to its binary equivalent. To do this you must first write out the place values again and then subtract each place value from the original number. If the place is larger than the number then it cannot be subtracted from it so put a zero in the place, if it is less than the number subtract it place a one in the place value location and move to the right with the remainder of the previous subtraction. This process proceeds from the far left and works to the far right:

    128	64	32	16	8	4	2	1 Place Values
    	Original value = 103
    	Subtract 128? No
            Remainder = 103, put a zero under the 128’s place
    128	64	32	16	8	4	2	1 Place Values
     0 
    	Remainder value = 103
    	Subtract 64? Yes: 103 – 64 = 39
    	Remainder = 39, put a 1 under the 64’s place
    128	64	32	16	8	4	2	1 Place Values
     0 	 1
    	Remainder value = 39
    	Subtract 32? Yes: 39 – 32 = 7
    	Remainder = 7, put a 1 under the 32’s place
    128	64	32	16	8	4	2	1 Place Values
     0 	 1 	 1
    	Remainder value = 7
    	Subtract 16? No
    	Remainder = 7, put a 0 under the 16’s place
    128	64	32	16	8	4	2	1 Place Values
     0 	 1	 1	 0  
    	Original value = 7
    	Subtract 8? No
    	Remainder = 7, put a 0 under the 8’s place
    128	64	32	16	8	4	2	1 Place Values
     0 	 1	 1	 0	0
    	Original value = 7
    	Subtract 4? Yes: 7 – 4 = 3
    	Remainder = 3, put a 1 under the 4’s place
    128	64	32	16	8	4	2	1 Place Values
     0 	 1	 1	 0	0	1
    	Remainder value = 3
    	Subtract 2? Yes: 3 – 2 = 1
    	Remainder = 1, put a 1 under the 2’s place
    128	64	32	16	8	4	2	1 Place Values
     0 	 1	 1	 0	0	1	1
    	Remainder value = 1
    	Subtract 1? Yes: 1 – 1 = 0
    Remainder must always = 0 when done, and put a 1 under the 1’s place.
    128	64	32	16	8	4	2	1 Place Values
     0 	 1	 1	 0	0	1	1	1 
    	103d = 0 1 1 0 0 1 1 1b
    
  9. When converting a decimal number to a binary number you must never skip a place value. If the value cannot be subtracted out put a zero in the place and move over to the next place. Otherwise the above number would be 11111. Which of course is incorrect just like your paycheck would be incorrect if it was 88 instead of 808.

  10. Now let’s look at the Hexadecimal number system. This is a Base 16 number system and so has 16 single digits which are the digits 0 to 15. But “15” is a two digit number in decimal so we can’t call it “15.” We need a symbol that is equal to “15” but is written as a single digit like the digits 0 to 9 in decimal. Several different symbol sets were tried in the old days but it was finally agreed upon that the letters “A” to “F” could stand for the single digits 10 to 15 in Hexadecimal.

  11. Each place value is an ascending (right to left) power of the base which is 16. So the place values in hex look like this:

       163   162   161   160 
     4096's 256's 16's  Ones
    

    Hex can obviously represent a much larger value than decimal and is very compact. Let’s start using hex by converting a hex value back to decimal.

  12. Convert ABCDh to decimal. The “little h” notation is one standard for writing hex numbers so that they will not be confused with decimal or even binary numbers just like the “little b” notation was used earlier for representing binary numbers. After all 100 could be “one hundred” in decimal, four in binary, or 256 in hex. Another notation that is used is the “0x” prefix. So 100h may also be seen written in some texts as 0x100 and it means the same thing, the number is in hex not decimal or binary. To convert to decimal, multiply each digit by the place value:

      A x 163    is 10 x 4096 = 40960
      B x 162    is 11 x  256 =  2816
      C x 161    is 12 x   16 =   192
      D x 160    is 13 x    1 =    13
                             +  _____
                                43981d
    
  13. To convert a decimal number to hex, divide the number by the next to the largest power that will fit into it. For example, the place value 4096 cannot divide into the number 3000, but 256 can divide into it. You must keep the remainder of the division and not the decimal fraction:

      3000 ÷ 256 = 11, r = 184
    So the first digit of the number in hex is B
      184 ÷ 16 = 11, r = 8
    So the next digit of the number in hex is B
      8 ÷ 1 = 8
    So the last digit of the number is 8 and the entire number is: BB8h
    
  14. Hex was not chosen for its conversions between decimal which are somewhat awkward. It was chosen for its conversions between binary. Hex is used as a compact method of recording binary numbers that generates much easier to read values and much easier to remember values. Each hex digit directly translates into a four bit binary number and the reverse is also true: a four bit binary number will directly translate into a single hex digit.

  15. Here is the conversion chart. It is better to be able to create it than to memorize it:

    HexadecimalBinaryDecimal
    000000
    100011
    200102
    300113
    401004
    501015
    601106
    701117
    810008
    910019
    A101010
    B101111
    C110012
    D110113
    E111014
    F111115
  16. To generate the table yourself write the column of hex digits from zero to F. The start the binary column with four zeros, then add one to each value for each consecutive line. Can you add binary? Nothing could be easier. Just remember to carry the one when the total is "two"

    0	0000
        +      1
    1	0001
    
    	  1
    	0001
        +      1
    2	0010
    
    	0010
        +      1
    3	0011
    
    	 11
    	0011
        +      1
    4	0100
    
    	0100
        +      1
    5	0101
     
     ...
    
  17. To convert the earlier hex number to binary substitute each hex digit with its complete four bit equivalent from the chart:

             A    B    C    D
    ABCDh =  1010 1011 1100 1101 b
    
  18. To convert from binary to hex convert each four bit binary number into its hex equivalent digit also using he chart, but remember to group the binary digits starting from the far right and work toward the left:

    10101011011101b => 10 1010 1101 1101 
                        ?  A    D    D
    For the short group add zeros in front to make it four bits:
    	0010 1010 1101 1101
    	 2    A    D    D   =>  2ADDh
    
  19. The IBM PC community is pervaded by numbers; measurements. It is critical to the technician to be fully aware of what these measurements really mean and how to use them effectively. Buzzwords like “Pentium 4 2.2Ghz” are intended mostly for the inexperienced end user and these escalating numbers have caused most of the pressure on the public to rush out and keep buying faster and faster machines even when they don’t know what the numbers actually mean. They do know that they would much rather have a 900 whatever than a 733 whatever.

  20. Hertz is a unit of measurement that simply means Cycles or Waves passing a fixed point per second. In electronics an specifically digital electronics this means how many digits can pass through the wire per second. In which each digit is represented by either a rise in the wave of electricity, or no rise in the wave of electricity. Megahertz or Mhz measures millions of hertz or waves per second. Recently the measurement rose to Ghz or Gigahertz which measures billions of waves per second.

  21. When it is said that the processor has a core speed of 2.4 Ghz it means that there is an internal clock generator circuit that creates a wave at this frequency. Each activity of the processor core runs on the rise and fall of this signal. The original 8088 due to the way it was designed, would take about 12 clock signals to complete the average program instruction. The latest P4’s average less than one clock cycle to complete one instruction. This is as important an improvement as the actual speed. The original 8088 ran on an 8-bit bus so each instruction fetch was 8 bits. The P4 fetches 64 bit values across the bus with each instruction cycle. So the fetch alone is 8 times wider and the efficiency of execution is also about 15 times better. Therefore a P4 running on the exact same clock as the 8088 would have to be about 100 times faster.

  22. A single binary digit is a bit. An eight bit binary number is a byte. The PC has been and always will be a Byte based computer. The processor’s instructions are fetched, decoded, and executed one byte at a time. Information is stored and retrieved as bytes or multi-byte values. Data storage is therefore measured in the amount of bytes that a given device can hold. Certain multi-byte values have been given names over the years which the technician should know: a single piece of data that is two bytes wide, or in other words, a 16-bit value, is called a word. This was the size of the 8088 processor’s registers and it could perform mathematical and Boolean logical operations on words which is why it is often referred to as a 16-bit microprocessor and its programs are called 16-bit code. DOS and BIOS are examples of 16-bit code. 32-bit wide numbers are referred to as double words or more commonly dwords. The 80386DX introduced 32-bit registers meaning that it could do math and logic on 32 bit values. This is why these and all subsequent processors are referred to as 32-bit processors and their programs are called 32-bit code. Windows 9x and Windows NT are examples of 32-bit code.

  23. 16-bit code can only address up to 1MB of memory. HIMEM.SYS has embedded into it the ability to switch the processor into 32-bit mode also called protected mode. In this mode 32-bit code can address up o 4GB of memory on processors up to the P6 generation which includes the Pentium II and the Pentium III. These can address up to 64GB of RAM. Very few motherboards can support this amount of RAM and even the Windows operating systems have had internal limitations to the amount of RAM that they can effectively use. But since Windows is also a multitasking environment in which multiple programs can be loaded and appear to run simultaneously (each one takes a turn called a time slice of processor control, and this continues round-robin continuously, faster than a human can notice) the problem arises when the user activates too many programs at once. It would be rather ugly and inefficient to suddenly just blow up if the system ran out of memory. It would also be rather ugly to admonish the user and refuse to open another program. Instead, the OS can set up virtual memory in which programs in RAM that haven’t had any activity in them lately can be moved off to the hard drive to make room for newly loaded programs. If the user goes back to the other program it can be fetched from the drive, with a noticeable delay and then begin running again.

  24. The smaller the system RAM the more often this swapping happens which slows down all programs while it is occurring. This is why the more installed RAM a system has the faster it will run under heavy work loads. Under light work loads in which no swapping occurs, the difference is not noticeable at all. RAM is measured in Megabytes or MB. An MB is actually a binary multiple and the mega prefix here does not mean million. The binary prefixes are: Kilo = 1024. Mega = 1024 K or 1,048,576 and Giga = 1024 M or 1,048,576 K or 1,073,741,824. Another way to remember these is that 1024 = 210 = 1K, 1024K = 220 = 1M, 1024M = 230 = 1G. At this rate 1024G = 240 = 1T.

  25. So 1KB = 1024 bytes. 1MB = 1024KB = 1,048,576 bytes. The capital “B” is used to denote bytes and the lower case “b” is used to denote bits. Therefore 1Kb = 1024 bits. Since 8 bits equal one byte divide this by 8 = 128. So 1Kb = 128KB. If this is true then how many bits are represented by the value 1KB? In this case each byte is equal to eight bits so multiply by eight to get the number of bits: 1KB x 8bits/byte = 8Kb.

  26. In expressing transmission rates like modems and network interface cards the metric meanings of the prefixes are used. This means that a modem with a transmission rate of 33.6Kb/sec is actually transmitting 33,600bits per second. The “K” in this expression means exactly 1000 and not 1024. The 1024 is only used to express amounts of data. So RAM can hold an amount of data expressed in binary MB (1,048,576’s of bytes), but network interface cards transmit in metric Mb (1,000,000’s of bits).

  27. Here is a table of the units in computing:

Symbol-UnitTypeDefinitionRange
b-bitnumericbinary digit0 or 1
B-bytenumeric8-bit binary number0-255
W-wordnumeric16-bit binary number0-65,535
dword-double wordnumeric32-bit binary number0-4,294,967,296
Kb-KilobitCapacity1024 bits128 bytes
KB-kilobyteCapacity1024 bytes8192 bits
Mb-megabitCapacity1,048,576 bits128KB
MB-megabyteCapacity1,048,576 bytes1024KB
Gb-gigabitCapacity1,073,741,824 bits128MB
GB-gigabyteCapacity1,073,741,824 bytes1024MB
TB-terabyteCapacity1,099,511,627,776 bytes1024GB
PB-PetabyteCapacity1,125,899,906,842,624 bytes1024TB
EB-exabyteCapacity1,152,921,504,606,846,976 bytes1024PB
ZB-zettabyteCapacity1,180,591,620,717,411,303,424 bytes1024EB
YB-yottabyteCapacity1,208,925,819,614,629,174,706,176 bytes1024ZB
hz-hertzFrequency1 cycle/sec-
Khz-kilohertzFrequency1000 cycles/sec(not 1024)
Mhz-megahertz Frequency1,000,000 cycles/sec1000Khz
Ghz-gigahertzFrequency1,000,000,000 cycles/sec1000Mhz
bps-bits per secondTransfer ratebits/sec-
Kbps-kilobits per secondTransfer ratekilobits/sec1000 bits/sec
Mbps-megabits per secondTransfer ratemegabits/sec1,000,000 bits/sec
Gbps-gigabits per secondTransfer rategigabits/sec1,000,000,000 bits/sec
KBps or KB/secTransfer ratekilobytes/sec1000 bytes/sec
MBps or MB/secTransfer ratemegabytes/sec1000KB/sec
GBps or GB/secTransfer rategigabytes/sec1000MB/sec
msTimemillisecond1/1000th second
µsTimemicrosecond1/1,000,000th second
nsTimenanosecond1/1,000,000,000th second
psTimepicosecond1/1,000,000,000,000th second

Review Questions

  1. Convert the following numbers from decimal to binary: 10, 31, 66, 77, 117, 231

  2. Convert from binary to decimal: 10, 1101, 10101, 110110, 01011010, 11100111.

  3. Convert the following numbers from decimal to hex: 10, 29, 56, 87, 113, 221

  4. Convert the following numbers from hex to decimal: A, 11, 27, 3E, 66, ED, BAD

  5. Convert the following numbers from hex to binary: A, 21, 34, 5A, 80, B1, BEE

  6. Convert the following numbers from binary to hex: 1010, 10111, 110011, 01010101, 101010101, 11011011, 110110101101, 11000011110000.

  7. How many bytes are in a Quadword? How many bits are in a QWORD?

  8. Calculate how much faster PC100 RAM is over a hard drive given that PC100 has an average access time of 8.5ns and a hard drive has an average access time of 8.5ms.

  9. The core of the latest processors has an average clock cycle of about 350ps. How many time faster is this than the same PC100 RAM in question 8?

  10. A DSL modem has a maximum sustained transmission rate of 1.54Mb/sec. How many times faster is it over a regular voice line 56Kb/sec modem?

  11. A 100BaseTX network interface card has a maximum sustained transfer rate of 100Mb/sec. How many times faster is it than the DSL modem in question 10?

  12. Express this amount of data: 6656 bytes, in KB. Express this amount of data: 100,139,008 bytes, in MB.

  13. A hard drive box claims it is 200GB. But the G here is metric not binary. Calculate how much smaller it is, expressed in bytes, because of this change in the meaning.

Copyright©2000-2007 Brian Robinson ALL RIGHTS RESERVED