- +1-530-264-8006
- info@tutorsglobe.com

18,76,764

Questions

Asked

21,311

Experts

9,67,568

Questions

Answered

Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!

Submit Assignment
## Number system and codes, Physics tutorial

Binary number system:Consider familiar decimal system. In this system there are 10 distinct and different digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). For magnitudes greater than 9, convention is to arrange digits in rows starting with most significant on left and concluding with least significant on right. Significance is determined by what is known as weighting of digit.

Therefore concept of tens, hundreds, thousands, etc arises. For instance 3458 = (3x10

^{3}) + (4x10^{2}) + (5x10^{1}) + (8x10^{0}). Each digit is one of the symbols 0 to 9 and is multiplied by the power of ten, depending on position of digit. Therefore, decimal numbers are said to have base of ten and multiplying powers 10^{0}, 10^{1}, 10^{2},10^{3}, etc. are known as weight or positional values.In binary number system (base of 2), there are only two digits: 0 and 1 and place values are 2

^{0}, 2^{1}, 2^{2}, 2^{3}etc. Binary digits are abbreviated as bits. For instance 1101 is binary number of 4 bits (i.e., it is binary number containing four binary digits.)The binary number may have any number of bits. Consider number 11001.011. Note binary point in this number. The bit on extreme right is known as least significant bit (LSB) and bit on extreme left is known as most significant bit (MSB). Each bit has its positional value as shown below:

2

^{4}2^{3}2^{2}2^{1}2^{0}2^{-1}2^{-2 }2^{-3}Positional values or weight1 1 0 0 1 . 0 1 1

↑ ↑ ↑

MSB Binary point LSB

Bits on left of binary point are positive powers of 2 and bits on right of binary point are negative powers of 2. The decimal equivalent of this number is found by summing the products of each bit and its positional value as follows:

11001.0112 = (1x2

^{4}) + (1x2^{3}) + (0 x 2^{2}) + (0 x 2^{1}) + (1 x 2^{0}) + (0 x^{ -1}) + (1 x 2^{-2}) + (1 x 2^{-3})= 16 + 8 + 0 + 0+1+0 + 0.250 + 0.125 = 25.375

_{10}.The benefit of binary system is that it has made job of designing digital circuitry very simple as only two different states or levels of voltages have to be managed. For instance ON state of the bulb may be signified by bit 1 and OFF state by 0. In terms of voltages, 0 V or a LOW voltage may signify bit 0 and 5V or a HIGH voltage may represent bit 1. Actually, it is not essential also to have precise voltages allotted to each bit. In analogue system exact value of voltage is very significant that makes design of accurate analogue circuitry very difficult. Though, in digital systems exact value of voltage is not significant because voltage of 3.9 V means same thing as voltage of 4.4 V or 5 V.

Binary to Decimal Conversion:A binary number can be converted into its decimal equivalent by just adding weights of different positions in binary number that have bit 1. For instance, consider conversion of 100011.101

_{2}.1 0 0 0 1 1. 1 0 1

2

^{5}+ 0 + 0 + 0 + 2^{1}+ 2^{0}+ 2^{-1}+ 0 + 2^{-3}= 32 + 2 + 1 + 0.5 + 0.125 = 35.625

_{10}Consider another example of conversion of 11100111.0101

_{3}.1 1 1 0 0 1 1 1. 0 1 0 1

2

^{7}+ 2^{6}+ 2^{5}+ 0 + 0 + 2^{2}+ 2^{1 }+ 2^{0}+ 0 + 2^{-2 }+ 0 + 2^{-4}= 128 + 64 + 32 + 4 + 2 + 1 + 0.250 + 0.0625 = 231.3125

_{10}.Now consider the following examples.

111.100 = 7.5

11.1100 = 3.75

1.11100= 1.875

From given examples it is apparent that if binary point is shifted towards left side, then value of number is halved.

Decimal to Binary Conversion:The decimal number is converted in its binary equivalent by its repeated divisions by 2. Division is continued till we get the quotient of 0. Then all remainders are set in sequence with first remainder taking position of LSB and last one taking position of MSB. Let conversion of 27 in its binary equivalent. If number also has some figures on right of decimal point, then this part of number is to be treated individually. Multiply this part repetitively by 2. After first multiplication by 2, either 1 or 0 will appear on left of decimal point. Keep this 1 or 0 separately and don't multiply it by 2 subsequently. This must be followed for every multiplication. Carry on multiplication by 2 till you get all 0s after decimal point or up to level of accuracy desired. Consider conversion of 27.625

_{10}in binary equivalent.As 27 already converted into binary equivalents that is 110112. Now for conversion of 0.625, multiply it by 2 repeatedly as follows:

Representing numbers in binary is very tiresome as binary numbers frequently comprise of large chain of 0's and 1's. Imagine length of binary equivalent of 10 digit decimal number. So, suitable shorthand forms for representing binary numbers are developed like octal system and hexadecimal system. With such number systems long strings of 0's and 1's can be decreased to manageable form.

Octal number system:Octal number system has base-8 that is there are 8 digits in this system. These digits are 0, 1, 2, 3, 4, 5, 6, and 7. Weight of each octal digit is some power of 8 depending on position of digit.

8

^{4}8^{3}8^{2}8^{1}8^{0}8^{-1}8^{-2}Weights1 0 6 2 7 . 4 5 Octal Number

↑ ↑ ↑

MSB Octal point LSB

Octal number doesn't comprise decimal digits 8 and 9. If any number comprises decimal digits 8and 9, then number can't be octal number.

In octal counting, if n is number of digits then total number of counts is 8

^{n}. Largest decimal number represented by the octal number having n digits is 8^{n}-1. Therefore with n = 4, total number of counts is 8^{4}= 4096 and largest decimal number represented is 4096 - 1 = 4095_{10}.Octal to Decimal Conversion:An octal number can be converted in its decimal equivalent by multiplying octal digit by positional value. For instance,

126.258 = (1 x 8

^{3}) + (2 x 8^{1}) + (6 x 8^{0}) + (2 x 8^{-1}) + (5 x 8^{-2})= 64 + 16 + 6 + 0.25 + 0.078 = 86.32810

Now convert 36.48 in decimal number.

36.48 = 3 x 8

^{1}+ 6 x 8^{0}+ 4 x 8^{-1}= 24 + 6 + 0.5 = 30.510

Decimal to Octal Conversion:The decimal number can be converted by repeated division by 8 in equivalent octal number. This method is like that adopted in decimal to binary conversion. If decimal number has some digits on right of decimal point, then this part of number is converted in its octal equivalent by repeatedly multiplying it by 8. The procedure is same as has been followed in binary number system. Consider conversion of 126.38

_{10}in decimal equivalent. Divide it in two parts that is 126 and .38.Therefore 126.38

_{10 }= 176.3024_{8}Octal to Binary Conversion:In octal number system the highest octal digit, i.e., 7 can be stated as a 3-bit binary number. Therefore, all octal digits have to be represented by the 3-bit binary number. Main benefit of octal number system is easiness with which any octal number can be converted in its binary equivalent.

Using this conversion of octal digit in 3-bit binary number, any octal number can be converted in its binary equivalent by simply replacing each octal digit by a 3-bit binary number. For instance, conversion of 5678 in its binary equivalent is:

567

_{8}= 101 110 111= 101110111

_{2}Thus 567

_{8}= 101110111_{2}Binary to Octal Conversion:The binary number can be converted in its octal equivalent by first making groups of 3-bits starting from LSB side. If MSB side doesn't have 3 bits, then add 0s to make last group of 3 bits. Then by replacing each group of 3 bits by octal equivalent, binary number can be converted in its binary equivalent. For instance, consider conversion of 1100011001

_{2}into its octal equivalent as follows:1100011001

_{2}= 1 100 011 001[As the MSB side does not have 3 bits, we have added two 0's to make the last group of 3 bits]

= 001 100 011 001

= 1 4 3 1

Therefore 1100011001

_{2}= 1431_{8}Hexadecimal number system:Hexadecimal number system has base-16 that is it has 16 digits (Hexadecimal means 16). The digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The digits A, B, C, D, E, and F have equivalent decimal values 10, 11, 12, 13, 14, and 15 respectively. Each Hex (hexadecimal is popularly called as hex) digit in hex number has positional value that is some power of 16 depending on position in number.

16

^{4}16^{3}16^{2}16^{1}16^{0}16^{-1}16^{-2}Weights1 2 4 A F . B 9 Hex number

↑ ↑ ↑

MSB Binary point LSB

Hex to Decimal Conversion:Hex to decimal conversion is done in same way as in cases of binary and octal to decimal conversions. Hex number is converted in its equivalent decimal number by summing products of weights of each digit and their values. This is clear from example of conversion of 514.AF16 in decimal equivalent.

514.AF

_{16}= 5x16^{2}+ 1x16^{1}+ 4x16^{0}+ 10x16^{- 1}+ 15x16^{-2}= 1280 + 16 + 4 + 0.625 + 0.0586

= 1300.6836

^{10}Another example:

3BE.1A16 = 3x16

^{2}+ 11x16^{1}+ 14x16^{0}+ 1x16^{- 1}+ 10x16^{- 2}= 768 + 176 + 14 + 0.0625 + 0.0391

= 958.1016

_{10}Decimal to Hex Conversion:The decimal number is converted in hex number in same way as decimal number is converted in its equivalent binary and octal numbers. Part of the number on left of decimal point is to be divided repetitively by 16 and part on right of decimal point is to be repeatedly multiplied by 16. This will be clear from examples of conversion of 579.26

_{10}in hex equivalent. Divide number into two parts 579 and .26.Therefore 579

_{10}= 243_{16}.Now .26 is converted into hex number as follows:

Hex to Binary Conversion:As in octal number system, hex number is converted in its binary equivalent by replacing each hex digit by equivalent 4-bit binary number. This is clear from following example:

BA6

_{16}= B A 6= 1011 1010 0110

= 101110100110

_{2}Binary to Hex Conversion:Binary number can be converted into hex equivalent. Starting from LSB side, group the binary number bits into groups of four bits. If towards MSB side, numbers of bits is less than four then add zeros on left of MSB so that group of four is complete. Replace each group by its equivalent hex digit. This is clear from the given example:

1001101110

_{2}= 0010 0110 1110= 2 6 E

= 26E

_{16}Hex to Octal Conversion:Each digit of hex number is first converted in its equivalent four bit binary number. Then bits of equivalent binary number are grouped in groups of three bits. Then each group is replaced by its equivalent octal digit to get octal number. For instance,

5AF

_{16}= 0101 1010 1111= 010110101111

= 010 110 101 111

= 2 6 5 7

= 2657

_{8}Octal to Hex Conversion:For octal to hex conversion, just reverse process described above. This is clear from the given example:

5457

_{8}= 101 100 101 111= 1011 0010 1111

= B 2 F = B2F

_{16}This method can also be applied to hex to decimal and decimal to hex conversions. For instance

Consider conversion of 3C

_{16}in its decimal equivalent:3C

_{16 }= 0011 1100 = 111 100_{2}Check conversion.

3C16 = 3x16

^{1}+ Cx16^{0}= 3x16

^{1}+ 12x16^{0}= 48 + 12

= 60

_{10}1111002 = 2

^{5 }+ 2^{4}+ 2^{3}+ 2^{2}= 32+16 + 8 + 4 Thus 3C

_{16 }= 1111002 = 60_{10}Codes:For any number system with the base B and digits N

_{0}(LSB), N_{1}, N_{2}, ...... N_{m }(MSB), decimal equivalent N_{10}is given byN

_{10}= N_{m}x B^{m}+.....+N_{3 }x B^{3}+ N_{2}x B^{2}+ N_{1}x B^{1 }+ N_{0}x B^{0}N_{3}x B^{3}....................Eq.1A number code is the relationship between binary digits and number represented. Therefore, all number systems are codes and decimal equivalent is given by Eq1. But there are other relationships or codes that relate decimal numbers and groups of binary digits that don't obey Eq.1. These relationships are known as codes.

BCD Code:In BCD (BCD stands for binary coded decimal) code, each digit of the decimal number is converted in its four bit binary equivalent. Largest decimal digit is 9; thus largest binary equivalent is 1001. This is explained as follows:

951

_{10}= 1001 0101 0001= 100101010001

_{BCD}Conversion of a decimal number in its binary equivalent and BCD equivalent leads to two different numbers. For instance:

158

_{10}= 0001 0101 1000= 10I011000

_{BCD}158

_{10}= 10011110_{2}(obtained by repeated division method).It is easy to convert from BCD to decimal than from straight binary to decimal, as we only have to count up to 9 in binary to do so. Though, it takes more bits to represent number in BCD than in binary.

BCD number is converted in its decimal equivalent by reverse process. For instance:

101010111001O

_{BCD}= 0001 0101 0111 0010= 1 5 7 2

= 1572

_{10}Though main function of the computer is to carry out arithmetic operations, it also processes messages and information in the language which uses letters of alphabet (e.g. English) and data of other kinds. Computers operate by coding letters of alphabet, other symbols, and data in binary form. Code used for this reason is ASCII code.

ASCII Code:Word ASCII is the acronym of American Standard Code for Information Interchange. This is the alphanumeric code most extensively utilized in computers. Alphanumeric code is one that represents alphabets, numerical numbers, punctuation marks and other special characters recognized by the computer. ASCII code is 7-bit code representing 26 English alphabets, 0 through 9 digits, punctuation marks, etc. A 7-bit code has 2

^{7}= 128 possible code groups that are rather enough.The ASCII code for a is 110 0001.

Binary arithmetic:Addition:Digital computers can carry out arithmetic operations using only binary numbers. There are four simple cases and apply same ideas to addition system.

Case 1: When nothing is combined with nothing, we get nothing. Binary representation of this is 0 + 0 = 0 provides 0 + 1 = 1.

Case 3: Combining 1 with nothing gives. Binary equivalent of this is 1 + 0 = 1.

Case 4: When we combine 1 with 1, the result is 10 using binary numbers, like: 1 + 1 = 10.

Suppose we want to add 563 and 146. We start adding the digits in the least significant column. We get,

Subtraction:Binary subtraction is done in same way as in decimal system. To subtract binary numbers, First need to explain four simple cases.

Case 1: 0 - 0 = 0

Case 2: 1 - 0 = 1

Case 3: 1 - 1 = 0

Case 4: 10 - 1 = 1

Multiplication and Division:Multiplication of binary numbers is also done in same manner as in decimal system. It is quite easier, as multiplication table for binary has only four cases.

Case 1: 0x 0 = 0

Case 2: 0x1 = 0

Case 3: 1x0 = 0

Case 4: 1x1 = 1

For example, in multiplying 1101 by 1001, we proceed as follows:

In beginning first partial product is written. Then, each partial product is written below previous one by shifting one place towards left relative to previous place. Though, digital circuits or computers add only two binary numbers at a time. Thus, to sum of first two partial products is added third partial product. To this sum is added third partial product to give final sum. Process of dividing binary number is once again the same as followed in decimal system. To divide 1100 by 10, we proceed as follows.

Tutorsglobe: A way to secure high grade in your curriculum (Online Tutoring)Expand your confidence, grow study skills and improve your grades.

Since 2009, Tutorsglobe has proactively helped millions of students to get better grades in school, college or university and score well in competitive tests with live, one-on-one online tutoring.

Using an advanced developed tutoring system providing little or no wait time, the students are connected on-demand with a tutor at www.tutorsglobe.com. Students work one-on-one, in real-time with a tutor, communicating and studying using a virtual whiteboard technology. Scientific and mathematical notation, symbols, geometric figures, graphing and freehand drawing can be rendered quickly and easily in the advanced whiteboard.

Free to know our price and packages for online physics tutoring. Chat with us or submit request at info@tutorsglobe.com