Professional Documents
Culture Documents
He Dem
He Dem
nhau:
00…000 = 0
11…111 = 2n - 1
Dạng tổng quát của số nhị phân
Có một số nhị phân A như sau:
A = apap-1…a1a0,a-1a-2…a-q
Giá trị của A được tính như sau:
A = ap2p + ap-12p-1 + … + a121 + a020 + a-12-
1
+ … + a-q2-q
A = a i2 i
Ví dụ số nhị phân
Hệ đếm Octal
HÖ ®Õm b¸t ph©n (cßn gäi lµ hÖ 8) lµ hÖ thèng ghi ®äc c¸c
con sè sè biÓu diÔn b»ng 8 ch÷ sè: 0, 1, 2,3, 4, 5, 6,7.
LuËt ®Õm vµ quy t¾c lµm tÝnh còng tư¬ng tù như hÖ 10 nhưng
dïng c¸c b¶ng céng, trõ vµ nh©n cña hÖ 8.
VÝ dô: 7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
§Õm: 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21,22 ...
Lµm tÝnh: 6 + 3 = 11 (v× 910 = 118); 2 x 6 = 14 (v× 1210 = 148);...
Hệ đếm Hexadecimal
Cơ số 16
16 chữ số: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A,
B, C, D, E, F
Decimal Octal
Binary Hexadecimal
Ví dụ
123410 = ?8
8 1234
8 154 2
8 19 2
8 2 3
0 2
123410 = 23228
Ví dụ
123410 = ?16
16 1234
16 77 2
16 4 13 = D
0 4
123410 = 4D216
Octal to Binary
Technique
Convert each octal digit to a 3-bit
equivalent binary representation
Ví dụ
7058 = ?2
7 0 5
7058 = 1110001012
Hexadecimal to Binary
Technique
Convert each hexadecimal digit to a 4-bit
equivalent binary representation
Ví dụ
10AF16 = ?2
1 0 A F
10AF16 = 00010000101011112
Binary to Octal
Technique
Group bits in threes, starting on right
Convert to octal digits
Ví dụ
10110101112 = ?8
1 3 2 7
10110101112 = 13278
Binary to Hexadecimal
Technique
Group bits in fours, starting on right
Convert to hexadecimal digits
Ví dụ
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
Octal to Hexadecimal
Technique
Use binary as an intermediary
Ví dụ
10768 = ?16
1 0 7 6
2 3 E
10768 = 23E16
Hexadecimal to Octal
Technique
Use binary as an intermediary
Ví dụ
1F0C16 = ?8
1 F 0 C
1 7 4 1 4
1F0C16 = 174148
Bài tập
Exercise – Convert ...
Hexa-
Decimal Binary Octal decimal
33
1110101
703
1AF
Hexa-
Decimal Binary Octal decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
Các phép tính
Counting in Base 2
Binary Equivalent Decimal
Number 8’s (23) 4’s (22) 2’s (21) 1’s (20) Number
0 0 x 20 0
1 1 x 20 1
10 1 x 21 0 x 20 2
11 1 x 21 1 x 20 3
100 1 x 22 4
101 1 x 22 1 x 20 5
110 1 x 22 1 x 21 6
111 1 x 22 1 x 21 1 x 20 7
1000 1 x 23 8
1001 1 x 23 1 x 20 9 3-44
Base 10 Addition Table
310 + 610 = 910
+ 0 1 2 3 4 5 6 7 8 9
0 0 1 2 3 4 5 6 7 8 9
1 1 2 3 4 5 6 7 8 9 10
2 2 3 4 5 6 7 8 9 10 11
3 3 4 5 6 7 8 9 10 11 12
4 4 5 6 7 8 9 10 11 12 13
etc 3-45
Base 8 Addition Table
38 + 68 = 118
+ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7 (no 8 or 9,
of course)
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16 3-46
Base 10 Multiplication Table
310 x 610 = 1810
x 0 1 2 3 4 5 6 7 8 9
0 0
1 1 2 3 4 5 6 7 8 9
2 2 4 6 8 10 12 14 16 18
3 3 6 9 12 15 18 21 24 27
4 0 4 8 12 16 20 24 28 32 36
5 5 10 15 20 25 30 35 40 45
6 6 12 18 24 30 36 42 48 54
7 7 14 21 28 35 42 49 56 63
3-47
Base 8 Multiplication Table
38 x 68 = 228
x 0 1 2 3 4 5 6 7
0 0
1 1 2 3 4 5 6 7
2 2 4 6 10 12 14 16
3 0 3 6 11 14 17 22 25
4 4 10 14 20 24 30 34
5 5 12 17 24 31 36 43
6 6 14 22 30 36 44 52
7 7 16 25 34 43 52 61
3-48
Addition
6
Decimal +3 9
6
Octal +1 7
6
Hexadecimal +9 F
1
Binary +0 1
3-49
Addition
6
Octal +2 Carry the 8 10
6
Hexadecimal +A Carry the 16 10
1
Binary +1 Carry the 2 10
3-50
Bài tập
Làm một số bài tập trong giáo trình
Biểu diễn thông tin trong
MTĐT
Một bit (Binary Digit- số nhị phân) là một chữ số
0 hoặc 1.
Tất cả các ký tự (chữ cái, chữ số, ký hiệu) đều
có thể được đặt tương ứng 1-1 theo một quy ước
nào đó với những dãy số 0,1 gọi là “mã nhị
phân” của ký tự.
Hệ mã ASCII (American Standard Code for
Information Interchange) (tr 387) và hệ EBCDIC
(Extended Binary Coded Decimal Interchange
Code)
Theo hệ ASCII, một ký tự được biểu diễn bởi một
mã gồm 8 chữ số 0,1 viết gọn lại thành hai số
của hệ 16. Ví dụ ‘A’ <-> 6510 = 0100 00012 =
4116
52
Đơn vị đo dữ liệu số
ASCII Features
Developed by ANSI (American National Standards Institute)
Defined in ANSI document X3.4-1977
7-bit code
8th bit is unused (or used for a parity bit or to indicate “extended”
character set)
27 = 128 different codes
Two general types of codes:
95 are “Printing” codes (displayable on a console)
33 are “Control” codes (control features of the console or
communications channel)
Represents
Latin alphabet, Arabic numerals, standard punctuation characters
Plus small set of accents and other European special characters (Latin-I
ASCII)