ASCII - 它有什么意义?

发布于 2025-01-14 01:09:17 字数 81 浏览 2 评论 0原文

我一直想问这个,我知道 ASCII 使用数字来表示字符,比如 65 = A

有什么意义?当我按A时计算机明白为什么我们需要转换为65?

I always wanted to ask this, I know that ASCII uses numbers to represent characters like 65 = A

Whats the point? computer understand when i press A is A why we need to convert to 65?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和影子一齐双人舞 2025-01-21 01:09:17

反过来说:由于 ASCII 等代码,计算机能够理解您何时按下 A。或者更确切地说,计算机的一部分能够告诉计算机的另一部分您按下了 A,因为它们同意二进制信号(如 ASCII)的约定。

在最低级别,计算机的每个部分“知道”它处于两种状态之一 - 也许是关闭和打开,也许是高电压和低电压,也许是两个磁力方向,等等。为了方便起见,我们将这两个状态标记为 0 和 1。然后,我们构建了复杂的(微观的)机器序列,每个序列都说“如果这个东西是 1,则执行此操作,如果它是 0,则执行此操作”。

如果我们将 1 和 0 串在一起,我们可以写出一个数字,比如 1010;我们可以制作对这些数字进行数学运算的机器,例如 1010 + 0001 = 1011。或者,我们可以将更长的序列串在一起来表示从屏幕左上角到右下角的像素亮度,顺序为 -位图图像。计算机并不“知道”哪些序列是数字,哪些是图像,我们只是告诉它“根据这个序列画出屏幕”,“根据这个序列计算我的工资”。

如果我们不想表示数字或图像,而是表示文本,则需要为每个字母和符号提供一个位序列。我们使用什么序列并不重要,我们只需要保持一致 - 我们可以说 000001 是 A,只要我们记住这是我们选择的,我们就可以编写处理该问题的程序带有文字。 ASCII 只是位序列到字母和符号的映射之一。

注意,A 在 ASCII 中并没有定义为“65”,它被定义为 7 位序列 1000001;碰巧这与我们通常用于数字 65 的位序列相同。另请注意,ASCII 是一种非常古老的映射,几乎从未在现代计算机中直接使用;然而,它非常有影响力,并且许多最近的映射被设计为对其覆盖的字母和符号使用相同或相似的序列。

You have it backwards: computers understand when you press an A because of codes like ASCII. Or rather, one part of the computer is able to tell another part of the computer that you pressed an A because they agree on conventions of binary signals like ASCII.

At its lowest level, each part of the computer "knows" that it is in one of two states - maybe off and on, maybe high voltage and low voltage, maybe two directions of magnetism, and so on. For convenience, we label these two states 0 and 1. We then build elaborate (and microscopic) sequences of machinery that each say "if this thing's a 1, then do this, if it's a 0 do this".

If we string a sequence of 1s and 0s together, we can write a number, like 1010; and we can make machinery that does maths with those numbers, like 1010 + 0001 = 1011. Alternatively, we can string a much longer sequence together to represent the brightness of pixels from the top left to bottom right of a screen, in order - a bitmap image. The computer doesn't "know" which sequences are numbers and which are images, we just tell it "draw the screen based on this sequence" and "calculate my wages based on this sequence".

If we want to represent not numbers or images, but text, we need to come up with a sequence of bits for each letter and symbol. It doesn't really matter what sequence we use, we just need to be consistent - we could say that 000001 is A, and as long as we remember that's what we chose, we can write programs that deal with text. ASCII is simply one of those mappings of sequences of bits to letters and symbols.

Note that A is not defined as "65" in ASCII, it's defined as the 7 bit sequence 1000001; it just happens that that's the same sequence of bits we generally use for the number 65. Note also that ASCII is a very old mapping, and almost never used directly in modern computers; it is however very influential, and a lot of more recent mappings are designed to use the same or similar sequences for the letters and symbols that it covers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文