Topic: NUMBER SYSTEM Objectives : At the end of topic, students will be able to: 1. Identify type of number system used 2. Differentiate one number system from the other 3. Convert from one number system to another number system 4. Perform addition and subtraction using the different number system Digital systems are designed to store, process, and communicate information in digital form. They are found in a wide range of applications, including process control, communication systems, digital instruments, and consumer products. The digital computer, more commonly called the computer, is an example of a typical digital system. A computer manipulates information in digital, or more precisely, binary form. A binary number has only two discrete values — zero or one. Each of these discrete values is represented by the OFF and ON status of an electronic switch called a transistor. All computers, therefore, only understand binary numbers. Any decimal number (base 10, with ten digits from 0 to 9) can be represented by a binary number (base 2, with digits 0 and 1). The basic blocks of a computer are the central processing unit (CPU), the memory, and the input/output (I/O). The CPU of the computer is basically the same as the brain of a human. Computer memory is conceptually similar to human memory. A question asked to a human is analogous to entering a program into the computer using an input device such as the keyboard, and answering the question by the human is similar in concept to outputting the result required by the program to a computer output device such as the printer. The main difference is that human beings can think independently, whereas computers can only answer questions that they are programmed for. (https://www.oreilly.com/library/view/fundamentals-ofdigital/9781118969304/9781118969304c01.xhtml ) Digital as well as Analog System, both are used to transmit signals from one place to another like audio/video. Digital system uses binary format as 0 and 1 whereas analog system uses electronic pulses with varying magnitude to send data. Following are some of the important differences between Digital System and Analog System. Sr. No. Key Digital System Analog System 1 Signal Type Digital System uses discrete signals as on/off representing binary format. Off is 0, On is 1. Analog System uses continous signals with varying magnitude. 2 Wave Type Digital System uses square waves. Analog system uses sine waves. 3 Technology Digital system first transform the analog waves to limited set of numbers and then record them as digital square waves. Analog systems records the physical waveforms as they are originally generated. 4 Transmission Digital transmission is easy and can be made noise proof with no loss at all. Analog systems are affected badly by noise during transmission. 5 Flexibility Digital system hardware can be easily modulated as per the requirements. Analog system's hardwares are not flexible. 6 Bandwidth Digital transmission needs more bandwidth to carry same information. Analog tranmission requires less bandwidth. 7 Memory Digital data is stored in form of bits. Analog data is stored in form of waveform signals. 8 Power requirement Digital system needs low power as compare to its analog counterpart. Analog systems consume more power than digital systems. 9 Best suited for Digital system are good for computing and digital electronics. Analog systems are good for audio/video recordings. 10 Cost Digital system are costly. Analog systems are cheap. 11 Example Digital system are: Computer, CD, DVD. Analog systems are: Analog electronics, voice radio using AM frequency. (source: https://www.tutorialspoint.com/differences-between-digital-and-analog-system) In the modern world of electronics, the term Digital is generally associated with a computer because the term Digital is derived from the way computers perform operation, by counting digits. For many years, the application of digital electronics was only in the computer system. But now-a-days, digital electronics is used in many other applications. Following are some of the examples in which Digital electronics is heavily used. ● Industrial process control ● Military system Television Communication system Medical equipment Radar Navigation ● ● ● ● ● Signal Signal can be defined as a physical quantity, which contains some information. It is a function of one or more than one independent variables. Signals are of two types. ● Analog Signal ● Digital Signal Analog Signal An analog signal is defined as the signal having continuous values. Analog signal can have infinite number of different values. In real world scenario, most of the things observed in nature are analog. Examples of the analog signals are following. ● ● ● ● ● ● ● Temperature Pressure Distance Sound Voltage Current Power Graphical representation of Analog Signal (Temperature) The circuits that process the analog signals are called as analog circuits or system. Examples of the analog system are following. ● Filter ● Amplifiers Television receiver Motor speed controller ● ● Disadvantage of Analog Systems ● Less accuracy ● Less versatility ● More noise effect ● More distortion ● More effect of weather Digital Signal A digital signal is defined as the signal which has only a finite number of distinct values. Digital signals are not continuous signals. In the digital electronic calculator, the input is given with the help of switches. This input is converted into electrical signal which have two discrete values or levels. One of these may be called low level and another is called high level. The signal will always be one of the two levels. This type of signal is called digital signal. Examples of the digital signal are following. ● ● ● Binary Signal Octal Signal Hexadecimal Signal Graphical representation of the Digital Signal (Binary) The circuits that process the digital signals are called digital systems or digital circuits. Examples of the digital systems are following. ● ● Registers Flip-flop ● ● Counters Microprocessors Advantage of Digital Systems ● More accuracy ● More versatility ● Less distortion ● Easy communicate ● Possible storage of information Comparison of Analog and Digital Signal S.N. Analog Signal Digital Signal 1 Analog signal has infinite values. Digital signal has a finite number of values. 2 Analog signal has a continuous nature. Digital signal has a discrete nature. 3 Analog signal is generated by transducers and signal generators. Digital signal is generated by A to D converter. 4 Example of analog signal − sine wave, triangular waves. Example of digital signal − binary signal. Source: https://www.tutorialspoint.com/computer_logical_organization/overview.htm Number systems The technique to represent and work with numbers is called number system. Decimal number system is the most common number system. Other popular number systems include binary number system, octal number system, hexadecimal number system, etc. Decimal Number System Decimal number system is a base 10 number system having 10 digits from 0 to 9. This means that any numerical quantity can be represented using these 10 digits. Decimal number system is also a positional value system. This means that the value of digits will depend on its position. The weightage of each position can be represented as follows − In digital systems, instructions are given through electric signals; variation is done by varying the voltage of the signal. Having 10 different voltages to implement decimal number system in digital equipment is difficult. So, many number systems that are easier to implement digitally have been developed. Let’s look at them in detail. Binary Number System The easiest way to vary instructions through electric signals is two-state system – on and off. On is represented as 1 and off as 0, though 0 is not actually no signal but signal at a lower voltage. The number system having just these two digits – 0 and 1 – is called binary number system. Each binary digit is also called a bit. Binary number system is also positional value system, where each digit has a value expressed in powers of 2, as displayed here. In any binary number, the rightmost digit is called least significant bit (LSB) and leftmost digit is called most significant bit (MSB). Computer memory is measured in terms of how many bits it can store. Here is a chart for memory capacity conversion. ● ● ● ● ● ● ● ● 1 byte (B) = 8 bits 1 Kilobytes (KB) = 1024 B 1 Megabyte (MB) = 1024 KB 1 Gigabyte (GB) = 1024 MB 1 Terabyte (TB) = 1024 GB 1 Exabyte (EB) = 1024 PB 1 Zettabyte = 1024 EB 1 Yottabyte (YB) = 1024 ZB Octal Number System Octal number system has eight digits – 0, 1, 2, 3, 4, 5, 6 and 7. Octal number system is also a positional value system with where each digit has its value expressed in powers of 8, as shown here − Hexadecimal Number System Hexadecimal number system has 16 symbols – 0 to 9 and A to F where A is equal to 10, B is equal to 11 and so on till F. Hexadecimal number system is also a positional value system with where each digit has its value expressed in powers of 16, as shown here − Number System Relationship The following table depicts the relationship between decimal, binary, octal and hexadecimal number systems. HEXADECIMAL DECIMAL OCTAL BINARY 0 0 0 0000 1 1 1 0001 2 2 2 0010 3 3 3 0011 4 4 4 0100 5 5 5 0101 6 6 6 0110 7 7 7 0111 8 8 10 1000 9 9 11 1001 A 10 12 1010 B 11 13 1011 C 12 14 1100 D 13 15 1101 E 14 16 1110 F 15 17 1111 (https://www.tutorialspoint.com/basics_of_computers/basics_of_computers_number_system.ht m) Number base conversion As you know decimal, binary, octal and hexadecimal number systems are positional value number systems. To convert binary, octal and hexadecimal to decimal number, we just need to add the product of each digit with its positional value. Here we are going to learn other conversion among these number systems. A positive number, regardless of its radix or base (r), is represented by a series of digits; An An-1 An-2 …A2 A1 A0 . A-1 A-2 … A-m Where: Ai is greater than or equal to 0 and less than its radix . radix point To convert binary, octal and hexadecimal to decimal number, the general formula can be used; (number)r = ∑𝑥=0 𝑥=𝑛 𝐴𝑥 ● 𝑟 𝑥 + ∑𝑥=−𝑚 𝑥=−1 𝐴𝑥 ● 𝑟 𝑥 The first summation is for the integer part, and the second summation is for the fractional part Example 1. Convert 3678 to decimal Solution: Using the general formula 3678 = A2●82 + A1●81 + A0●80 = 3●64 + 6●8 + 7●1; any number raise to the power of 0 is equal to 1 = 192 + 48 + 7 = 247 3678 = 24710 Example 2. Convert 0.8E3F16 to decimal Solution: Using the general formula 0.8E3F16 = A-1●16-1 + A-2●16-2+ A-3●16-3 + A-4●16-4 = 8●0.0625 + 14●0.00390625 + 3●0.0002441406+15●0.0000152588 = 0.5+0.0546875+0.0007324219+0.0002288818 = 0.5556488037 0.8E3F16 = 0.555648803710 Example 3. Convert 1100101.11012 to decimal Solution: Using the general formula 1100101.11012 = A6●26+ A5●25 + A4●24 + A3●23+ A2●22 + A1●21 + A0●20 + A-1●2-1 + A-2●2-2+ A-3●2-3 + A-4●2-4 = 1●64+1●32+0●16+0●8+1●4+0●2+1●1 +1●.5+1●.25+0●.125+1●.0625 = 65+32+0+0+4+0+1+.5+.25+0+.0625 = 102.8125 1100101.11012 = 102.812510 To convert decimal to binary, octal or hexadecimal, two formulas will be used. One formula for the integer part and another formula to convert the fractional part. For the integer part, repeated division is used and for the fractional part, repeated multiplication is used. Equivalent value is by combining the results. Steps in converting the integer part 1. 2. 3. 4. 5. Divide the value by the target base or radix. Record the answer in two different columns (quotient and remainder). Divide the quotient obtained in step 2. Repeat steps 2 and 3 until quotient is zero. The equivalent of the value is by reading the remainder’s column starting from the bottom (most significant bit) to top (least significant bit). Steps in converting the fractional part 1. 2. 3. 4. Multiply the value by the target base or radix. Record the answer in two different columns (integer part and fractional part). Multiply the fractional part obtained in step 2. Repeat steps 2 and 3 until product is equal to zero or if the desired number of fractional digit has been reached. 5. The equivalent of the value is by reading the integer part’s column starting from the top to bottom. (assume that the desired number of fractional digits is 5) Example 1. Convert 48610 to octal Since the decimal number is a whole number, only one formula will be used; converting of integer part. Since the target base is octal (8), the decimal value will be divided by 8. Quotient Remainder Step 1 486/8 Step 2 60 6 Step 3 60/8 Step 2 7 4 Step 3 7/8 Step 2 0 7 Since quotient is already equal to zero, stop the process. Therefore, 48610 is equal to 7468 lsb msb Example 2. Convert 0.972510 to hexadecimal Since the decimal number contain only fractional part, only one formula will be used; conversion of the fractional part. Since the target base is hexadecimal (16), the value will be multiplied by 16. Integer Step 1 0.9725x16 fraction Step 2 15 (F) 0.56 msb Step 3 0.56x16 Step 2 8 0.96 Step 3 0.96x16 Step 2 15 (F) 0.36 Step 3 0.36x16 Step 2 5 0.76 Step 3 0.76x16 Step 2 12 (C) 0.16 lsb Since the number of digits has been reached without having a product of zero, process can be stopped. Therefore, 0.972510 is equal to 0.F8F5C16 Example 3. Convert 115.37510 to binary The given decimal number consist of a whole number and a fractional part, therefore two formulas will be used; For the integer part Quotient Remainder Step 1 115/2 Step 2 57 1 Step 3 57/2 Step 2 28 1 Step 3 28/2 Step 2 14 0 Step 3 14/2 Step 2 7 0 Step 3 7/2 Step 2 3 1 Step 3 3/2 Step 2 1 1 Step 3 1/2 Step 2 0 1 Since quotient is already equal to zero, stop the process. Therefore, 11510 is equal to 11100112 lsb msb For the fractional part Integer fraction Step 1 0.375x2 Step 2 0 0.75 Step 3 0.75x2 Step 2 1 0.5 Step 3 0.5x2 Step 2 1 0 Since the fraction is already equal to zero, stop the process. Therefore, 0.37510 is equal to 0.0112 msb lsb The equivalent of 115.37510 in binary is by combining the result of the two process, 11100112 + 0.0112 = 1110011.0112. To convert binary to octal and hexadecimal, conversion is done by grouping. To convert binary to octal, from the binary point to the most significant bit (integer part), group the binary bits by three. If the last group does not consist of three bits, add zero(es) to the leftmost bit (it will not change the value). And from the binary point to the least significant bit (fractional part), again group the binary bits by three. If the last group does not consist of three bits, add zero(es) to the rightmost bit (it will change the value). Do not start grouping of bits from the most significant bit nor from the least significant bit, always start from the binary point. Then, get the equivalent of each group (refer to the table with relationship between different number system). To convert binary to hexadecimal, instead of groups of three bits, group by four bits and follow the same process as converting binary to octal. Example 1. Convert 1101100.110012 to octal From the binary point to the most significant bit, group by three. The last group has only one bit, add two zeroes 001 101 1 100 5 4 From the binary point to the least significant bit, again, group by three. The last group has only two bits, add one zero 110 010 6 2 Therefore, 1101100.110012 is equal to 154.628 Example 2. Convert 1011011.001012 to hexadecimal From the binary point to the most significant bit, group by four. The last group has only three bits, add one zero 0101 5 1011 11 (B) From the binary point to the least significant bit, again, group by four. The last group has only one bit, add three zeroes 0010 2 1000 8 Therefore, 1011011.001012 is equal to 5B.2816 To convert octal and hexadecimal to binary, conversion is done by representing digits by either 3 bits (for octal) and four bits (for hexadecimal). For the binary equivalent, refer to the table with relationship between different number system. Example 1. Convert 364.5028 to binary By referring to the table; 3 = 011, 6=110, 4=100, 5=101, 0=000, and 2=010 Therefore, 364.5028 is equal to 11110100.101000012 Example 2. Convert FA3.E816 to binary Again, by referring to the table; F=1111, A=1010, 3=0011, E=1110, and 8=1000 Therefore, FA3.E816 is equal to 111110100011.111012 In converting octal to hexadecimal or hexadecimal to octal, two methods can be used. For the first method (assuming octal is to be converted to hexadecimal), the octal value must first be converted to decimal, then the converted value in decimal will be converted to hexadecimal. Second method is to covert octal value to binary, then the converted value in binary will then be converted to hexadecimal. It is easier and accurate to use the second method. Exercises: Convert the following numbers 1. 2. 3. 4. 5. 175.67510 = ____________________ 8 2F8.0E516 = ____________________ 10 376.45138 = ____________________ 2 11101100.01102 = _______________ 16 5ADC.EB0516 = __________________ 8