How exactly does binary code work? - José Américo N L F de Freitas

1,375,955 views ・ 2018-07-12

TED-Ed


โปรดดับเบิลคลิกที่คำบรรยายภาษาอังกฤษด้านล่างเพื่อเล่นวิดีโอ

Translator: Kelwalin Dhanasarnsombut Reviewer: Rawee Ma
00:06
Imagine trying to use words to describe every scene in a film,
0
6777
4638
ลองนึกถึงการใช้คำ ในการอธิบายทุกฉากในภาพยนต์
00:11
every note in your favorite song,
1
11415
1903
ทุกตัวโน้ตในเพลงโปรดของคุณ
00:13
or every street in your town.
2
13318
2717
หรือถนนทุกสายในเมือง
00:16
Now imagine trying to do it using only the numbers 1 and 0.
3
16035
4824
ทีนี้ ลองนึกถึงการอธิบาย โดยใช้เพียงเลข 1 กับ 0
00:20
Every time you use the Internet to watch a movie,
4
20859
2895
ทุกครั้งที่คุณใช้อินเทอร์เน็ต ในการชมภาพยนต์
00:23
listen to music,
5
23754
1109
ฟังเพลง
00:24
or check directions,
6
24863
1486
หรือดูเส้นทาง
00:26
that’s exactly what your device is doing,
7
26349
2510
นั่นคือสิ่งที่อุปกรณ์ของคุณทำ
00:28
using the language of binary code.
8
28859
2953
มันใช้ภาษารหัสเลขฐานสอง
00:31
Computers use binary because it's a reliable way of storing data.
9
31812
4690
คอมพิวเตอร์ใช้เลขฐานสอง เพราะมันเป็นการจัดเก็บข้อมูลที่เชื่อถือได้
00:36
For example, a computer's main memory is made of transistors
10
36502
4075
เช่น หน่วยความจำหลักของคอมพิวเตอร์ ประกอบด้วยทรานส์ซิสเตอร์
00:40
that switch between either high or low voltage levels,
11
40577
3577
ที่เปลี่ยนไปมา ระหว่างระดับความต่างศักย์สูงและต่ำ
00:44
such as 5 volts and 0 volts.
12
44154
3490
เช่น 5 โวลต์และ 0 โวลต์
00:47
Voltages sometimes oscillate, but since there are only two options,
13
47644
4106
ความต่างศักย์บางครั้งก็แกว่งไปมา แต่เนื่องจากมันมีแค่สองแบบ
00:51
a value of 1 volt would still be read as "low."
14
51750
4001
ค่า 1 โวลต์ ก็ยังคงถูกอ่านว่ามีค่าต่ำ
00:55
That reading is done by the computer’s processor,
15
55751
2529
การอ่านค่าดังกล่าวถูกกระทำ โดยโปรเซสเซอร์ของคอมพิวเตอร์
00:58
which uses the transistors’ states to control other computer devices
16
58280
4315
ซึ่งใช้สถานะของทรานส์ซิสเตอร์ ในการควบคุมเครื่องคอมพิวเตอร์อื่น ๆ
01:02
according to software instructions.
17
62595
2196
ตามคำสั่งของซอร์ฟแวร์
01:04
The genius of this system is that a given binary sequence
18
64791
3341
ความชาญฉลาดของระบบนี้ ก็คือลำดับเลขฐานสองที่ถูกให้มา
01:08
doesn't have a pre-determined meaning on its own.
19
68132
3388
ไม่ได้มีถูกกำหนดให้ความหมายมาแต่ต้น
01:11
Instead, each type of data is encoded in binary
20
71520
3685
แต่ว่า ข้อมูลแต่ละชนิด ถูกเข้ารหัสเป็นเลขฐานสอง
01:15
according to a separate set of rules.
21
75205
2910
ตามชุดของกฎที่แตกต่างกัน
01:18
Let’s take numbers.
22
78115
1382
ลองเอาตัวเลขมาจำนวนหนึ่ง
01:19
In normal decimal notation,
23
79497
1682
ในระบบเลขฐานสิบตามธรรมดา
01:21
each digit is multiplied by 10 raised to the value of its position,
24
81179
4853
แต่ละตัวเลขถูกคุณด้วย 10 ยกกำลังด้วยค่าของตำแหน่งของมัน
01:26
starting from zero on the right.
25
86032
2451
เริ่มจากศูนย์ในทางขวา
01:28
So 84 in decimal form is 4x10⁰ + 8x10¹.
26
88483
6557
ฉะนั้น 84 ในรูปแบบเลขฐานสิบ คือ 4x10⁰ + 8x10¹
01:35
Binary number notation works similarly,
27
95040
2715
การแสดงจำนวนเลขฐานสอง ก็เป็นไปในแบบที่คล้ายกัน
01:37
but with each position based on 2 raised to some power.
28
97755
3806
แต่ว่าแต่ละตำแหน่งถูกคูณด้วยสอง ที่ยกกำลังค่าของตำแหน่งของมัน
01:41
So 84 would be written as follows:
29
101561
4012
ฉะนั้น 84 จะถูกเขียนเป็นแบบนี้
01:45
Meanwhile, letters are interpreted based on standard rules like UTF-8,
30
105573
4803
ในขณะเดียวกัน ตัวหนังสือถูกแปร ไปตามกฎมาตรฐานอย่างเช่น UTF-8
01:50
which assigns each character to a specific group of 8-digit binary strings.
31
110376
5107
ซึ่งกำหนดให้แต่ละตัวอักษร เป็นชุดจำเพาะของเลขฐานสอง 8 ตัว
01:55
In this case, 01010100 corresponds to the letter T.
32
115483
6906
ในกรณีนี้ 01010100 หมายถึงตัว T
02:02
So, how can you know whether a given instance of this sequence
33
122389
3758
แล้วเราจะรู้ได้อย่างไรว่าลำดับเลขนี้
02:06
is supposed to mean T or 84?
34
126147
2685
จะเป็นตัว T หรือ 84
02:08
Well, you can’t from seeing the string alone
35
128832
3038
คุณไม่อาจทราบได้จากการดูแค่ลำดับเลข
02:11
– just as you can’t tell what the sound "da" means from hearing it in isolation.
36
131870
4572
เหมือนกับที่คุณไม่สามารถบอกได้ว่า เสียง "ดา" เดี่ยว ๆ หมายถึงอะไร
02:16
You need context to tell whether you're hearing Russian, Spanish, or English.
37
136442
4837
คุณต้องการบริบทที่จะบอกว่า คุณกำลังได้ยินภาษารัสเซีย สเปน หรืออังกฤษ
02:21
And you need similar context
38
141279
1391
และคุณต้องการ บริบทในลักษณะที่คล้ายกัน
02:22
to tell whether you’re looking at binary numbers or binary text.
39
142670
4115
เพื่อบอกว่าคุณกำลังดูจำนวนเลขฐานสอง หรือข้อความเลขฐานสอง
02:26
Binary code is also used for far more complex types of data.
40
146785
4361
รหัสฐานสองยังถูกใช้กับข้อมูล ที่มีความซับซ้อนมากกว่านั้นอีก
02:31
Each frame of this video, for instance,
41
151146
2346
ยกตัวอย่างเช่น แต่ละฉากของวีดีโอนี้
02:33
is made of hundreds of thousands of pixels.
42
153492
2468
ถูกสร้างขึ้นจากพิกเซลนับแสน
02:35
In color images,
43
155960
1681
ในรูปสี
02:37
every pixel is represented by three binary sequences
44
157641
3454
ทุก ๆ พิกเซล ถูกแสดงด้วยลำดับฐานสองสามตัว
02:41
that correspond to the primary colors.
45
161095
2606
ที่สอดคล้องกับสีหลัก
02:43
Each sequence encodes a number
46
163701
1786
แต่ละลำดับเข้ารหัสจำนวน
02:45
that determines the intensity of that particular color.
47
165487
3184
ที่กำหนดความเข้มของแต่ละสี
02:48
Then, a video driver program transmits this information
48
168671
3929
เมื่อโปรแกรมขับวีดีโอถ่ายทอดข้อมูลนี้
02:52
to the millions of liquid crystals in your screen
49
172600
2710
ไปยังคริสตัลเหลวนับล้านในจอของคุณ
02:55
to make all the different hues you see now.
50
175310
2778
เพื่อทำให้คุณเห็นเป็นสี ที่มีความสว่างและมืดต่างกัน
02:58
The sound in this video is also stored in binary,
51
178088
3314
เสียงของวีดีโอนี้ ก็ถูกบันทึกเป็นระบบฐานสอง
03:01
with the help of a technique called pulse code modulation.
52
181402
3404
ด้วยการใช้เทคนิคที่เรียกว่า พัลส์ โค้ด มอดูเลชั่น
03:04
Continuous sound waves are digitized
53
184806
2384
คลื่นเสียงที่ต่อเนื่องกันถูกทำให้เป็นดิจิตัล
03:07
by taking "snapshots" of their amplitudes every few milliseconds.
54
187190
4392
โดยการ "ถ่ายภาพนิ่ง" ของแอมพลิจูด ของทุก ๆ สองสามมิลลิวินาที
03:11
These are recorded as numbers in the form of binary strings,
55
191582
3665
ข้อมูลเหล่านี้ถูกบันทึกเป็นตัวเลข ในรูปแบบของชุดระบบฐานสอง
03:15
with as many as 44,000 for every second of sound.
56
195247
3913
จำนวนมากถึง 44,000 ชุด สำหรับเสียงแต่ละวินาที
03:19
When they’re read by your computer’s audio software,
57
199160
2610
เมื่อพวกมันถูกอ่านโดยซอร์ฟแวร์เสียง ของคอมพิวเตอร์ของคุณ
03:21
the numbers determine how quickly the coils in your speakers should vibrate
58
201770
4354
ตัวเลขเหล่านี้กำหนดความเร็ว ในการสั่นของขดลวดในลำโพง
03:26
to create sounds of different frequencies.
59
206124
2841
เพื่อสร้างเสียงในความถี่ต่าง ๆ กัน
03:28
All of this requires billions and billions of bits.
60
208965
3695
ทั้งหมดนี้ต้องการบิทมากมายหลายพันล้าน
03:32
But that amount can be reduced through clever compression formats.
61
212660
4003
แต่จำนวนดังกล่าวสามารถถูกทำให้ลดลงได้ ด้วยรูปแบบการบีบอัด
03:36
For example, if a picture has 30 adjacent pixels of green space,
62
216663
4508
ยกตัวอย่างเช่น ถ้ารูป มีส่วนสีเขียวติด ๆ กัน 30 พิกเซล
03:41
they can be recorded as "30 green" instead of coding each pixel separately -
63
221171
4848
พวกมันสามารถถูกบันทึกได้เป็น "สีเขียว 30" แทนที่จะถูกบันทึกข้อมูลแยกกันแต่ละพิกเซล
03:46
a process known as run-length encoding.
64
226019
3175
กระบวนการนี้เรียกว่า การเข้ารหัสระยะเวลา
03:49
These compressed formats are themselves written in binary code.
65
229194
4900
เจ้ารูปแบบการบีบอัดนี้เอง ก็ถูกเขียนเป็นระบบฐานสอง
03:54
So is binary the end-all-be-all of computing?
66
234094
3070
ฉะนั้นระบบฐานสองคือทุกสิ่งทุกอย่าง สำหรับคอมพิวเตอร์สินะ
03:57
Not necessarily.
67
237164
1385
ไม่จำเป็นหรอก
03:58
There’s been research into ternary computers,
68
238549
2418
มีงานวิจัยเกี่ยวกับคอมพิวเตอร์ระบบฐานสาม
04:00
with circuits in three possible states,
69
240967
2465
ที่มีวงจรที่ให้สถานะได้สามแบบ
04:03
and even quantum computers,
70
243432
1820
และแม้แต่คอมพิวเตอร์แบบควอนตัม
04:05
whose circuits can be in multiple states simultaneously.
71
245252
3664
ที่วงจรสามารถอยู่ได้ในหลายสถานะ ในเวลาเดียวกัน
04:08
But so far, none of these has provided
72
248916
2423
แต่ถึงตอนนี้ ไม่มีคอมพิวเตอร์ใด
04:11
as much physical stability for data storage and transmission.
73
251339
3296
ที่ให้ความเสถียรทางกายภาพมากพอ สำหรับการเก็บและถ่ายทอดข้อมูล
04:14
So for now, everything you see,
74
254635
2444
ฉะนั้นในตอนนี้ ทุกอย่างที่คุณเห็น
04:17
hear,
75
257079
769
04:17
and read through your screen
76
257848
1616
ได้ยิน
และได้อ่านผ่านหน้าจอ
04:19
comes to you as the result of a simple "true" or "false" choice,
77
259464
3633
เป็นผลลัพธ์ของ "ถูก" และ "ผิด" ที่ถูกทำซ้ำเป็นพันล้านครั้ง
04:23
made billions of times over.
78
263097
2274
ที่ถูกส่งมาถึงคุณ
เกี่ยวกับเว็บไซต์นี้

ไซต์นี้จะแนะนำคุณเกี่ยวกับวิดีโอ YouTube ที่เป็นประโยชน์สำหรับการเรียนรู้ภาษาอังกฤษ คุณจะได้เห็นบทเรียนภาษาอังกฤษที่สอนโดยอาจารย์ชั้นนำจากทั่วโลก ดับเบิลคลิกที่คำบรรยายภาษาอังกฤษที่แสดงในแต่ละหน้าของวิดีโอเพื่อเล่นวิดีโอจากที่นั่น คำบรรยายเลื่อนซิงค์กับการเล่นวิดีโอ หากคุณมีความคิดเห็นหรือคำขอใด ๆ โปรดติดต่อเราโดยใช้แบบฟอร์มการติดต่อนี้

https://forms.gle/WvT1wiN1qDtmnspy7