Beruflich Dokumente
Kultur Dokumente
A number system is a code that uses symbols to refer to a number of items. Many number systems are in use in digital system. The most common are the decimal, binary, octal and hexadecimal systems.
Decimal system:
The decimal number system contains 10 symbols and is sometimes called the base 10 system. The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Binary system: The binary number system uses only two symbols 0 and 1 is sometimes called the base 2 system. Bit and Byte:
A bit is an abbreviation for binary digits. A binary number like 1100 has 4 bits, 110011 has 6 bits.
A byte is a group of eight bits. The byte is the basic unit of binary information. Most computers process data with a length of 8 bits or multiple of 8 bits.
MSB and LSB: LSB: The right most bit of a number is known as LSB or least significant bit. MSB: The left most bit of a number is known as MSB or most significant bit. Conversion from decimal to binary: For understanding conversion system considering the number 25.
1 0 0 1 1
LSB
MSB
11011 2 4 1 + 23 1 + 0 22 + 1 21 + 1 20 2 = 16 + 8 + 2 + 1 = 2710
Prob: Convert 1000110110 112 to its decimal equivalent. Binary number with decimal point: In general, a number with a decimal point is represented by a series of coefficients as follows:
a a a a a ao a a a 5 4 3 2 1 1 2 3
Prob: Convert 1010.0112 to decimal equivalent
1 23 + 0 22 + 1 21 + 0 2o + 0 2 1 + 1 2 2 + 1 2 3
1
= (10.375) 10
Prob: Convert
(5.625) to binary number 10 5 = 4 + 1 = 1 22 + 0 21 + 1 2o = 101 0.625 2 = 1.250 b = 1 1 0.250 2 = 0.500 b =0 2 0.500 2 = 1.000 b =1 3 b b bo b b b 2 1 1 2 3 = (101.101) 2
Octal numbers: Some older computer systems use octal numbers to represent binary information. The octal numbers uses the eight symbols 0, 1, 2, 3, 4, 5, 6 and 7. Octal numbers are also referred to as base 8 numbers. Decimal 0 1 2 3 4 5 6 7 Binary 000 001 010 011 100 101 110 111 Octal 0 1 2 3 4 5 6 7
Prob: Convert
(498) 10
to octal number. 2 7 6 7 6 28
Prob: Convert (0.513) to octal 0.513 8 = 4.104 0.104 8 = 0.832 0.832 8 = 6.656 0.656 8 = 5.248 0.248 8 = 1.984 0.984 8 = 7.872 (0.513)10 = (0.406517)8 Binary to Octal: Converting from binary to octal is simply a matter of grouping the binary positions in groups of three and write down octal equivalent. Prob: (a) Convert 0111012 to octal
2
(b) 101110012 to octal Solution: 011 3 101 5 10 add a leading zero 010 2 7 1 = 2718 = 358 111 001
Prob:
Soln:
(a)
(b)
(ii)
Hexadecimal Numbers: Hexadecimal numbers are extensively used in microprocessor work. Hexadecimal means 16. This system has a base 16. This means that it uses 16 digits to represent all numbers. It uses the digits 0 through 9 plus the letters A, B, C, D, E and F. The usefulness in converting directly from a 4 bit binary number. Hexadeccimal 0 1 2 3 4 5 6 7 8 9 A B C D E F Hex Conversion: Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
To convert from binary to hex, group the binary number in groups of four.
3
1101 D = 6D16
(c)
(d)
Convert 2A616 to binary and decimal 2 0010 1010 0010101001102 = 0 = 2 = 4 = 0 = 0 = 32 = 0 = 128 = 0 = 512 67810 Convert 15110 to hex. 151 16 = 9 9 16 = 0 15110 = 9716 remainder remainder 7 9 0 1 1 0 0 4 0 1 0 1 2o 21 22 23 24 25 26 27 28 29 A 0110 6
(e)
151
Binary Addition: The four basic rules for adding binary digits are as follows: 0+0=0 Sum of 0 with a carry of 0 0+1=1 Sum of 1 with a carry of 0 1+0=1 Sum of 1 with a carry of 0 1 + 1 = 10 Sum of 0 with a carry of 1 Example: Carry Carry 1 1
4
0 0 1
1 0 0
1 1 0
When there is a carry of 1, you have a addition in which three bits are being added. These situations are as follows: Carry 1 + 0 + 0 = 0 1 Sum of 1 with a carry of 0 1 + 1 + 0 = 1 0 Sum of 0 with a carry of 1 1 + 0 + 1 = 1 0 Sum of 0 with a carry of 1 1 + 1 + 1 = 1 1 Sum of 1 with a carry of 1
Prob: Add the following binary numbers (a) 11 + 11 (b) + 6 100 + 10 3 3 110 (c) (b) 100 + 10 111 + 11 (c) + 1010 (d) 110 + 100 111 11
11 + 11 110
Binary Subtraction: The four basic rules for subtracting binary digits are as follows: 0 1 1 10 0 1 0 1 = = = = 0 0 1 1
0 - 1 with a borrow of 1.
Prob: Perform the following binary subtractions: (a) (a) 11 - 01 (b) 11 - 01 10 111 - 100 011 3 -1 2 11 - 10 (c) (b) 111 - 100 11 - 10 01 101 011 010 2 (d) 101 - 010 3 -2 1 5 -3
(c)
(d)
Binary Multiplication: The four basic rules for multiplying binary digits are as follows: 0 0 1 1 0 1 0 1 = = = = 0 0 0 1
Prob: Perform the following binary multiplication: (a) 1 11 (a) 11 1 11 (b)11 11 3 1 3 (b) (c) 101 111 (c) (d) 1001 1011 101 111 101 101 + 101 100011
(b)
(e)
Binary division: Division in binary follows the same procedure as division in decimal. Prob: Perform the following binary divisions: (a) (a) 110 11 10 11) 110 110 000 (b) 110 10 3) 2 6 6 0 11 (b) 10) 110 10 10 00
1S and 2S Complement of binary number: 1S and 2S complement are import because they permit the representation of negative numbers. 2S complement is commonly used in comp. To handle negative numbers. 1S complement of a binary number is found by simply changing all 1s to Os and all Os to 1s, as illustrated below 1 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 binary number 1s complement
2S Complement of a Binary number: The 2s complement of a binary number is found by adding 1 to the LSB of the 1s complement 2S Complement = 1s complement + 1 Prob: Find the 2s complement of a binary number. 10110010 10110010 01001101 + 1 01001110 binary number 1s complement Add 1 2s complement
Prob: Determine the 2s complement of 11001011. 11001011 00110100 + 1 00110101 binary number 1s complement 2s complement