Похожие презентации:
Number System 1-2
1. ICT
2. Системы счисления и преобразования из одной системы в другую.
Четыре системы счисления:
Двоичный [ 2 ] .
§ Использует 2 символа: цифры 0 и 1.
§ Некоторые числа в этой системе: 0, 000, 1010.
Десятичный [ 10 ]
§ Использует 10 символов: цифры 0, 1, 2,…, 9.
§ Некоторые числа в этой системе: 111, 0, 1010.
Восьмеричный[ 8 ]
§ Использует 8 символов: цифры 0, 1, 2, 3, 4, 5, 6, 7.
Шестнадцатеричный [ 16 ]
§ Использует 16 символов: 0, 1, 2, …., 9, A, B, C, D, E, F.
3. Системы счисления. Перенос чисел из одной системы счисления в другую. Арифметика в системах счисления
4.
Компьютерная системасчисления
5. Система счисления
Двоичная система счисленияЧтобы преобразовать данные в строки чисел, компьютеры используют
двоичную систему счисления.
Люди используют десятичную систему счисления («деци» означает
«десять»).Humans use the decimal system (“deci” stands for “ten”).
•Элементарными запоминающими устройствами внутри компьютера являются
электронные переключатели. Каждый переключатель удерживает одно из двух
состояний: включено (1) или выключено (0).
OFF
ON
• Мы используем бит (двоичную цифру) 0 или 1 для представления
состояния.
Двоичная система счисления работает
так же, как десятичная, но имеет только
два доступных символа (0 и 1), а не
десять (0, 1, 2, 3, 4, 5, 6, 7, 8 и 9).
0 (00)
1 (01)
2 (10)
3 (11)
6. Система счисления
Биты и байтыЕдиничная единица данных называется битом и имеет значение 1 или 0.
Компьютеры работают с наборами битов, группируя их для представления более крупных
фрагментов данных, таких как буквы алфавита.
Восемь бит составляют один байт. Байт — это объем памяти, необходимый для хранения
одного буквенно-цифрового символа.
С помощью одного байта компьютер может представлять один из 256 различных символов
или символов.
1 01
10
1 01
01 1 01
7. Общие системы счисления
СистемаБаза
Символы
Десятичный
10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Двоичный
2
0, 1
Восьмеричный
8
0, 1, 2, 3, 4, 5, 6, 7, 10, ….
Шестнадцатер
ичный
16
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
A, B, C, D, E, F, 10, …
8. Quantities/Counting
DecimalBinary
Octal
Hexadecimal
Decimal
Binary
Octal
Hexadecimal
1000
1001
1010
10
11
12
8
9
A
0
1
0
1
0
1
0
1
2
10
2
2
8
9
10
3
11
3
3
11
1011
13
B
4
100
4
4
12
1100
14
C
5
101
5
5
6
110
6
6
13
14
1101
1110
15
16
D
E
7
111
7
7
15
1111
17
F
9. Conversion Among Bases
• The possibilities:Decimal
Octal
Binary
Hexadecimal
10.
Decimal to Decimal (just for meaning)Weight
12510 =>
5 x 100
2 x 101
1 x 102
Base
=
5
= 20
= 100
125
11. Decimal to Binary
Repeated Division-by-2 Method (for whole number)To convert a whole number to binary, use
successive division by 2 until the quotient is 0. The
remainders form the answer, with the first
remainder as the least significant bit (LSB) and the
last as the most significant bit (MSB).
(43)10 = (101011)2
2
2
2
2
2
2
43
21 rem 1
10 rem 1
5 rem 0
2 rem 1
1 rem 0
0 rem 1
LSB
MSB
Repeated Multiplication-by-2 Method (for fractions)
To convert decimal fractions to binary, repeated
multiplication by 2 is used, until the fractional
product is 0 (or until the desired number of decimal 0.3125 2=0.625
places). The carried digits, or carries, produce the 0.625 2=1.25
answer, with the first carry as the MSB, and the last 0.25 2=0.50
as the LSB.
(0.3125)10 = (.0101)2
0.5 2=1.00
Carry
0
MSB
1
0
1
LSB
12. Example
12510 = ?22 125
2 62
2 31
2 15
7
2
3
2
1
2
1
0
1
1
1
1
12510 = 11111012
13. Binary to Decimal
• Technique– Multiply each bit by 2n, where n is the “weight” of
the bit
– The weight is the position of the bit, starting from
0 on the right
– Add the results
14. Example
Bit “0”1010112 =>
1 x 20 =
1 x 21 =
0 x 22 =
1 x 23 =
0 x 24 =
1 x 25 =
1
2
0
8
0
32
4310
15. Decimal to Octal
• Technique– Divide by 8
– Keep track of the remainder
16. Example
123410 = ?88
8
8
8
1234
154
19
2
2
2
3
123410 = 23228
17. Octal to Decimal
• Technique– Multiply each bit by 8n, where n is the “weight” of
the bit
– The weight is the position of the bit, starting from
0 on the right
– Add the results
18. Example
7248 =>4 x 80 =
2 x 81 =
7 x 82 =
4
16
448
46810
19. Decimal to Hexadecimal
• Technique– Divide by 16
– Keep track of the remainder
20. Example
123410 = ?1616
16
16
1234
77
4
2
13 = D
123410 = 4D216
21. Hexadecimal to Decimal
• Technique– Multiply each bit by 16n, where n is the “weight”
of the bit
– The weight is the position of the bit, starting from
0 on the right
– Add the results
22. Example
ABC16 =>C x 160 = 12 x
1 =
12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
23. Binary to Octal
• Technique– Group bits in threes, starting on right
– Convert to octal digits
24. Example
10110101112 = ?81 011 010 111
1
3
2
7
10110101112 = 13278
25. Octal to Binary
• Technique– Convert each octal digit to a 3-bit equivalent
binary representation
26. Example
7058 = ?27
0
5
111 000 101
7058 = 1110001012
27. Binary to Hexadecimal
• Technique– Group bits in fours, starting on right
– Convert to hexadecimal digits
28. Example
10101110112 = ?1610 1011 1011
2
B
B
10101110112 = 2BB16
29. Hexadecimal to Binary
• Technique– Convert each hexadecimal digit to a 4-bit
equivalent binary representation
30. Example
10AF16 = ?21
0
A
F
0001 0000 1010 1111
10AF16 = 00010000101011112
31. Octal to Hexadecimal
• Technique– Use binary as an intermediary
32. Example
10768 = ?161
0
7
6
001
000
111
110
2
3
E
10768 = 23E16
33. Hexadecimal to Octal
• Technique– Use binary as an intermediary
34. Example
1F0C16 = ?81
F
0
C
0001
1111
0000
1100
1
7
1
4
4
1F0C16 = 174148
35. Exercise – Convert ...
Decimal33
Binary
Octal
Hexadecimal
1110101
703
1AF
Don’t use a calculator!
Skip answer
Answer
36. Exercise – Convert …
AnswerHexadecimal
Decimal
33
Binary
100001
Octal
41
117
1110101
165
75
451
111000011
703
1C3
431
110101111
657
1AF
21