Full Transcript

Digital Design EE200 Ms. Lana Altarteer Lecture Objectives • Learn the number systems and conversion methods. Decimal Numbers The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal numbers is ten, because only te...

Digital Design EE200 Ms. Lana Altarteer Lecture Objectives • Learn the number systems and conversion methods. Decimal Numbers The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal numbers is ten, because only ten symbols (0 through 9) are used to represent any number. The column weights of decimal numbers are powers of ten that increase from right to left beginning with 100 =1: …105 104 103 102 101 100 For fractional decimal numbers, the column weights are negative powers of ten that decrease from left to right: 102 101 100. 10-1 10-2 10-3 10-4 … Decimal Numbers Decimal numbers can be expressed as the sum of the products of each digit times the column value for that digit. Thus, the number 9240 can be expressed as (9 x 103) + (2 x 102) + (4 x 101) + (0 x 100) or 9 x 1,000 + 2 x 100 + 4 x 10 + 0 x 1 Example: Express the number 480.52 as the sum of values of each digit. Solution: 480.52 = (4 x 102) + (8 x 101) + (0 x 100) + (5 x 10-1) +(2 x 10-2) Binary Digits and Logic Levels • Digital electronics uses circuits that have two states, which are represented by two different voltage levels called HIGH and LOW. The voltages represent numbers in the binary system. • In binary, a single number is called a bit .A bit can have the value of either a 0 or a 1, depending on if the voltage is HIGH (ON) or LOW (OFF). • Binary numbers have a base of 2 Convert Decimal Number to Binary Number: There are two methods for this type of conversion: 1. Subtract Method 2. Successive division Binary Numbers For digital systems, the binary number system is used. Binary has a radix of two and uses the digits 0 and 1 to represent quantities. The column weights of binary numbers are powers of two that increase from right to left beginning with 20 =1: …25 24 23 22 21 20 For fractional binary numbers, the column weights are negative powers of two that decrease from left to right: 22 21 20. 2-1 2-2 2-3 2-4 … Binary Conversions The decimal equivalent of a binary number can be determined by adding the column values of all of the bits that are 1 and discarding all of the bits that are 0. Example: Convert the binary number 100101.01 to decimal. Solution: Start by writing the column weights; then add the weights that correspond to each 1 in the number. 25 24 23 22 21 20. 2-1 2-2 32 16 8 4 2 1 . ½ ¼ 1 0 0 1 0 1. 0 1 32 +4 +1 +¼ = 37¼ Binary Conversions • Exercieses: Convert Binary Number to Decimal Number: • 110110.112 • 10110100.112 Binary Conversions You can convert a decimal whole number to binary by reversing the procedure. Write the decimal weight of each column and place 1ʼs in the columns that sum to the decimal number. This is called the subtraction method. Example: Convert the decimal number 49 to binary. Solution: The column weights double in each position to the right. Write down column weights until the last number is larger than the one you want to convert. 26 25 24 23 22 21 20. 49 – 32 = 17 17 – 16 = 1 64 32 16 8 4 2 1. 1– 1 =0 0 1 1 0 0 0 1. Binary Conversions • Division method: if we divide an even number by 2, it will be completely divisible, and the remainder will be 0. ! Example: " = 4 → 0 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 Example: #! " = 9 → 0 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 • But when we divide an odd number by 2, the remainder is 1 #$ Example: " "% Example: " = 9 → 1 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 12 → 1 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 You will always get a remainder of 1 Binary Conversions You can convert decimal to any other base by repeatedly dividing by the base. For binary, repeatedly divide by 2: Example: Convert the decimal number 49 to binary by repeatedly dividing by 2. Solution: You can do this by “reverse division” and the answer will read from left to right. Put quotients to the left and remainders on top. Binary Conversions Binary Conversions You can convert a decimal fraction to binary by repeatedly multiplying the fractional results of successive multiplications by 2. The carries form the binary number. Example: Convert the decimal fraction 0.188 to binary by repeatedly multiplying the fractional results by 2. Hexadecimal Numbers • Hexadecimal is a weighted number system. The column weights are powers of 16, which increase from right to left. • Hex is useful because large numbers can be represented using fewer digits. Programmers often use hex to represent binary values as they are simpler to write and check than when using binary. • Large binary number can easily be converted to hexadecimal by grouping bits 4 at a time and writing the equivalent hexadecimal character. Hexadecimal Numbers Example: Express 1001 0110 0000 11102 in hexadecimal Answer: Group the binary number by 4-bits starting from the right. Thus, 960E Example: Express 1A2F16 in decimal. Answer: Start by writing the column weights: 4096 256 16 1 Octal Numbers • Octal uses eight characters the numbers 0 through 7 to represent numbers. There is no 8 or 9 character in octal. • Binary number can easily be converted to octal by grouping bits 3 at a time and writing the equivalent octal character for each group. Example: Express 1 001 011 000 001 1102 in octal: Answer: Group the binary number by 3-bits starting from the right. Thus, 1130168 Octal Numbers • Octal is also a weighted number system. The column weights are powers of 8, which increase from right to left.

Use Quizgecko on...
Browser
Browser