📚 8C Unit 3: Data Representation and Binary Logic | 8C 第3单元:数据表示与二进制逻辑
Welcome to 8C Unit 3. In this unit, you will explore how computers store and process numbers, text and instructions using binary digits, and how simple logic gates make decisions inside digital circuits. Understanding these foundations will strengthen your programming and hardware skills.
欢迎学习 8C 第 3 单元。本单元将带你探索计算机如何用二进制数字存储和处理数值、文字与指令,以及简单逻辑门如何在数字电路中作出判断。掌握这些基础将帮助你提升编程与硬件理解能力。
1. Why Computers Use Binary | 为什么计算机使用二进制
Computers use binary because electronic circuits have two reliable states: on and off. These states can be represented by 1 and 0. Using only two voltage levels makes storage, transmission and processing less prone to error.
计算机使用二进制,是因为电子电路具有两种可靠状态:开和关。这两种状态可以用 1 和 0 表示。只使用两个电压级别可以让存储、传输和处理更不容易出错。
A binary digit is the smallest unit of data in a computer system. All programs, images, sounds and videos are ultimately stored as long sequences of binary digits.
二进制数字是计算机系统中最小数据单位。所有程序、图像、声音和视频最终都以长串二进制数字存储。
2. Bits, Bytes and Storage Units | 位、字节与存储单位
kilobyte, megabyte, gigabyte and terabyte are based on powers of 1024, because 1024 = 2¹⁰.
一个二进制数字称为位。八个位组成一个字节。更大的单位如千字节、兆字节、吉字节和太字节以 1024 的幂为基础,因为 1024 = 2¹⁰。
| Unit | 中文 | Size |
|---|---|---|
| bit | 位 | 1 binary digit |
| byte | 字节 | 8 bits |
| kilobyte KB | 千字节 | 2¹⁰ bytes = 1024 bytes |
| megabyte MB | 兆字节 | 2²⁰ bytes |
| gigabyte GB | 吉字节 | 2³⁰ bytes |
| terabyte TB | 太字节 | 2⁴⁰ bytes |
3. Binary to Denary Conversion | 二进制转十进制
To convert a binary number to denary, write the column values as powers of two: 128, 64, 32, 16, 8, 4, 2, 1. Then add the values where a 1 appears.
要将二进制数转换为十进制,先写出以 2 的幂为单位的列值:128、64、32、16、8、4、2、1。然后把出现 1 的位置对应的数值相加。
1011₂ = 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰ = 8 + 0 + 2 + 1 = 11₁₀
Always label binary numbers with a subscript 2 and denary numbers with a subscript 10. This avoids confusion in explanations and exam answers.
请始终用下标 2 标记二进制数,用下标 10 标记十进制数。这样可以避免在解释和考试答案中出现混淆。
4. Denary to Binary Conversion | 十进制转二进制
To convert denary to binary, repeatedly divide the number by 2 and record the remainder from bottom to top. Continue until the quotient is 0.
要将十进制转换为二进制,可以反复将数字除以 2,并从下到上记录余数,直到商为 0。
3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1. Reading the remainders upwards gives 1101₂.
例如,将 13 转换为二进制:13 ÷ 2 = 6 余 1,6 ÷ 2 = 3 余 0,3 ÷ 2 = 1 余 1,1 ÷ 2 = 0 余 1。从下往上读取余数得到 1101₂。
Another method is to subtract the largest power of two that fits, place a 1 in that column, and repeat for smaller powers until zero remains.
另一种方法是减去能容纳的最大 2 的幂,在该列放置 1,然后对更小的幂重复操作,直到剩下 0。
5. Hexadecimal Representation | 十六进制表示法
Hexadecimal uses sixteen symbols: 0-9 and A-F. Each hexadecimal digit represents four binary bits. It is useful because long binary strings become shorter and easier to read.
十六进制使用十六个符号:0-9 和 A-F。每个十六进制数字表示四个二进制位。它很有用,因为长二进制串可以变得更短、更容易阅读。
To convert binary to hexadecimal, split the binary number into groups of four bits starting from the right, then convert each group. For example, 1101 1010₂ becomes DA₁₆.
要将二进制转换为十六进制,请从右开始将二进制数分成四位一组,然后转换每一组。例如,1101 1010₂ 变成 DA₁₆。
| Binary | Denary | Hex |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 1010 | 10 | A |
| 1111 | 15 | F |
6. Binary Addition | 二进制加法
1, and 1+1=0 with a carry of 1. When three ones are added, the sum is 1 with a carry of 1.
二进制加法遵循四个规则:0+0=0,0+1=1,1+0=1,1+1=0 并向左进 1。当三个 1 相加时,和为 1 并进位 1。
For instance, 0101₂ (5) plus 0011₂ (3) gives 1000₂ (8). Work from right to left and carry any 1 into the next column.
例如,0101₂ (5) 加 0011₂ (3) 得到 1000₂ (8)。从右向左计算,并将进位 1 带入下一列。
0101₂ + 0011₂ = 1000₂
Practice binary addition until carrying becomes automatic. This skill is often tested alongside conversion questions.
反复练习二进制加法,直到进位变得自动。这个技能经常与进制转换题一起考查。
7. Overflow and Error Detection | 溢出与错误检测
Overflow occurs when the result of a binary addition needs more bits than the system can store. In an 8-bit system, the maximum value is 11111111₂, or 255₁₀. If a carry exceeds the leftmost bit, the result is incorrect unless extra bits are available.
当二进制加法的结果需要的位数超过系统能存储的位数时,就会发生溢出。在 8 位系统中,最大值是 11111111₂,即 255₁₀。如果进位超出最左边的位,除非有额外位可用,否则结果会不正确。
A simple error-detection method is to add a parity bit so that the total number of 1s is always even or always odd. This helps identify single-bit errors during transmission.
一种简单的错误检测方法是添加奇偶校验位,使 1 的总数始终为偶数或奇数。这有助于识别传输过程中的单比特错误。
In exams, always check whether an 8-bit addition produces a ninth carry bit. If it does, label the result as overflow.
在考试中,始终检查 8 位加法是否产生第九个进位位。如果产生,请将结果标记为溢出。
8. Logic Gates: NOT, AND, OR | 逻辑门:NOT、AND、OR
Logic gates are tiny electronic switches that produce outputs based on one or more binary inputs. The NOT gate inverts its input. The AND gate outputs 1 only when all inputs are 1. The OR gate outputs 1 when at least one input is 1.
逻辑门是微小的电子开关,根据一个或多个二进制输入产生输出。NOT 门会反转输入。AND 门只有在所有输入都为 1 时才输出 1。OR 门在至少一个输入为 1 时输出 1。
- NOT A is written as ¬A. Its output is the opposite of A.
- NOT A 写作 ¬A。它的输出与 A 相反。
- A AND B is written as A · B. Its output is 1 only when A is 1 and B is 1.
- A AND B 写作 A · B。只有当 A 为 1 且 B 为 1 时,输出才为 1。
- A OR B is written as A + B. Its output is 1 when A is 1, or B is 1, or both are 1.
- A OR B 写作 A + B。当 A 为 1,或 B 为 1,或两者都为 1 时,输出为 1。
9. Truth Tables | 真值表
A truth table shows every possible input combination and the resulting output of a logic gate or circuit. For two inputs A and B, there are four combinations: 00, 01, 10 and 11.
真值表显示每种可能的输入组合以及逻辑门或电路的输出。对于两个输入 A 和 B,有四种组合:00、01、10 和 11。
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0
Published by TutorHao | Computer Science Revision Series | aleveler.com 广告 / Sponsored 正版包邮 TI-nspire CX Guide for IBDP & AP 书店 计算机与网络 书籍 畅想畅销书 计算机 备考教辅 · 正版现货 · 与本文内容相关 查看详情 / View on Taobao参考价 ¥115.0更多咨询请联系16621398022(同微信) 备考资讯每日更新,关注不错过 考纲变化 · 科目分析 · 学习方法 ![]() 在微信里长按二维码识别关注 或截图后用「扫一扫 → 相册」选择本图 公众号:tutorhao |
