21.12.2021

Binary code example. Binary code - where and how is it used? Converting a natural number from a decimal number system to a binary system


This is where you can convert binary numbers to ASCII characters, which are often simple enough in your head.

1 - Convert every 4 binary digits to one sixth digit.

Here's a diagram of the conversion in binary:

0001 = 1 0010 = 2 0011 = 3 0100 = 4 0101 = 5 0110 = 6 0111 = 7 1000 = 8 1001 = 9 1010 = a (the hex number a, not the letter a) 1011 = b 1100 = c 1101 = d 1110 = e 1111 = f

(Hexadecimal numbers a through f are decimal numbers 10 through 15. What is hexadecimal or "base 16" is instead of each digit being able to represent 10 different numbers, such as decimal or "base 10", each digit instead of this can represent 16 different numbers.)

Once you know this diagram, converting any string of binary digits to a string of hexadecimal digits is straightforward.

For instance,

01000100 = 0100 0100 = 44 hex 1010001001110011 = 1010 0010 0111 0011 = a273 hex

Simple enough, right? Simple conversion of a binary number of any length to its hexadecimal equivalent.

(This works because hexadecimal base is 16 and binary is base 2, and 16 is the 4th power of 2, so it takes 4 binary digits to get 1 hexadecimal digit. 10, on the other hand, is not a power of 2, so we are not can convert binary to decimal almost as easily.)

2 - Divide the string of hexadecimal digits into pairs.

When converting a number to ASCII, every two hexadecimal digits are characters. Thus, split the hex string into two digits.

You would divide a hexadecimal number like 7340298b392 into 6 pairs, like this:

7340298b392 = 07 34 02 98 b3 92

These are 6 pairs of hexadecimal digits, so there will be 6 letters. (Except I knew right away that 98, b3, and 92 are not letters. I'll explain why in a minute.)

3 - Convert each pair of hexadecimal digits to a decimal number.

Do this by multiplying (the decimal equivalent) of the left digit by 16 and adding the second.

For example, b3 hex = 11 * 16 + 3, which is 110 + 66 + 3, which is 179. (b hex is 11 decimal.)

4 - Convert decimal numbers to ASCII characters.

Now, to get the ASCII letters for decimal numbers, just keep in mind that in ASCII 65 is an uppercase "A" and 97 is a lowercase "a".

So what is the letter 68?

68 - 4th uppercase letter of the alphabet, right?
65 = A, 66 = B, 67 = C, 68 = D.

So 68 is D.

You take a decimal number, subtract 64 for uppercase letters if the number is less than 97, or 96 for lowercase letters if the number is 97 or greater, and the number of letters of the alphabet associated with this set is 2 hexadecimal digits.

Alternatively, if you're not afraid of some simple hex arithmetic, you can skip step 3 and just go from hex to ASCII, remembering, for example, that

Hex 41 = "A" hex 61 = "a"

So, subtract 40 hex for uppercase letters or 60 hex for lowercase letters and convert what's left to decimal to get the alphabet letter number.

for instance

01101100 = 6c, 6c - 60 = c = 12 decimal = "l" 01010010 = 52, 52 - 40 = 12 hex = 18 decimal = "R"

(It is helpful to remember, though, that "m" (or "M") is the 13th letter of the alphabet. So you can count up or down from 13 to find a letter that is closer to the middle than either end.)

I saw this on a shirt once and was able to read it in my head:

01000100 01000001 01000100

I did it like this:

01000100 = 0100 0100 = 44 hex, - 40 hex = ucase letter 4 = D 01000001 = 0100 0001 = 41 hex, - 40 hex = ucase letter 1 = A 01000100 = 0100 0100 = 44 hex, - 40 hex = ucase letter 4 = D

The shirt said "DAD" which I thought was cool as it was bought by a pregnant woman. Her husband should be like me.

How did I know right away that 92, b3 and 98 were not letters?

Because the ASCII code for the lower case "z" is 96 + 26 = 122, which is 7a in hex. 7a is the largest hexadecimal number for a letter. Anything greater than 7a is not a letter.

So how can you do this as a human being.

How do computer programs do it?

For each set of 8 binary digits, convert it to a number and find it in the ASCII table.

(This is a fairly straightforward and straightforward path. A typical programmer might think of 10 or 15 other ways in a matter of minutes. The details depend on the computer's language interface environment.)

Since it is the most simple and meets the requirements:

  • The fewer values ​​exist in the system, the easier it is to manufacture individual elements operating with these values. In particular, two digits of the binary number system can be easily represented by many physical phenomena: there is a current - there is no current, the magnetic field induction is greater than the threshold value or not, etc.
  • The fewer the number of states an element has, the higher the noise immunity and the faster it can work. For example, to encode three states through the magnitude of the magnetic field induction, you will need to enter two threshold values, which will not contribute to noise immunity and reliability of information storage.
  • Binary arithmetic is pretty straightforward. The tables of addition and multiplication, the basic operations on numbers, are simple.
  • It is possible to use the apparatus of logic algebra to perform bitwise operations on numbers.

Links

  • Online calculator for converting numbers from one number system to another

Wikimedia Foundation. 2010.

See what "Binary Code" is in other dictionaries:

    2 bit Gray code 00 01 11 10 3 bit Gray code 000 001 011 010 110 111 101 100 4 bit Gray code 0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000 Gray code is a number system in which two adjacent values ... ... Wikipedia

    Signal Point Code (SPC) of the signaling system 7 (SS7, SS7) is a unique (in the home network) node address used at the third level of MTP (routing) in telecommunication SS7 networks for identification ... Wikipedia

    In mathematics, a number that is not divisible by any square except for 1. For example, 10 is squareless, but 18 is not, since 18 is divisible by 9 = 32. The beginning of a sequence of squareless numbers is: 1, 2, 3, 5, 6, 7, ... ... Wikipedia

    To improve this article, is it desirable ?: Wikify the article. Redesign the design in accordance with the rules for writing articles. Correct the article according to the stylistic rules of Wikipedia ... Wikipedia

    This term has other meanings, see Python (disambiguation). Python Language class: mu… Wikipedia

    In the narrow sense of the word, at present, the phrase is understood as "Attempt on the security system", and tends more towards the meaning of the next term Cracker attack. This happened due to the distortion of the meaning of the word "hacker". Hacker ... ... Wikipedia

All characters and letters can be encoded using eight binary bits. The most common binary letter tables are ASCII and ANSI and can be used to write text to microprocessors. In ASCII and ANSI tables, the first 128 characters are the same. This part of the table contains codes for numbers, punctuation marks, upper and lower case Latin letters and control characters. National extensions of symbol tables and pseudo-graphic symbols are contained in the last 128 codes of these tables, therefore Russian texts in DOS and WINDOWS operating systems do not match.

At the first acquaintance with computers and microprocessors, the question may arise - "how to convert text to binary code?" However, this transformation is the easiest step! To do this, you need to use any text editor. Including the simplest program notepad, which is part of the Windows operating system, is suitable. Similar editors are present in all programming environments for languages ​​such as C, Pascal or Java. It should be noted that the most common Word text editor is not suitable for simple text-to-binary conversion. This test editor introduces a huge amount of additional information, such as letter color, slant, underline, language in which a particular phrase is written, font.

It should be noted that in fact the combination of zeros and ones, with the help of which text information is encoded, is not a binary code, since the bits in this code do not obey the laws. However, the search phrase "binary representation" is the most common search phrase on the Internet. Table 1 shows the correspondence of binary codes to letters of the Latin alphabet. For brevity, in this table, the sequence of zeros and ones is presented in decimal and hexadecimal codes.

Table 1 Binary representation table for Latin letters (ASCII)

Decimal code Hexadecimal code Displayed character Meaning
0 00 NUL
1 01 (display control word)
2 02 (First transmitted word)
3 03 ETX (Last Transfer Word)
4 04 EOT (end of transmission)
5 05 ENQ (initialization)
6 06 ACK (acknowledgment)
7 07 BEL
8 08 BS
9 09 HT (horizontal tab
10 0A LF (line feed)
11 0B VT (vertical tab)
12 0C FF (next page)
13 0D CR (carriage return)
14 0E SO (double width)
15 0F SI (compacted seal)
16 10 DLE
17 11 DC1
18 12 DC2 (Cancel Condensed Printing)
19 13 DC3 (ready)
20 14 DC4 (double-width cancellation)
21 15 § NAC (non-acknowledgment)
22 16 SYN
23 17 ETB
24 18 CAN
25 19 EM
26 1A SUB
27 1B ESC (start control last)
28 1C FS
29 1D GS
30 1E Rs
31 1F US
32 20 Space
33 21 ! Exclamation point
34 22 « Angle bracket
35 23 # Number sign
36 24 $ Currency sign (dollar)
37 25 % Percent sign
38 26 & Ampersand
39 27 " Apostrophe
40 28 ( Open parenthesis
41 29 ) Closing parenthesis
42 2A * Star
43 2B + Plus sign
44 2C , Comma
45 2D - Minus sign
46 2E . Dot
47 2F / Fractional trait
48 30 0 Digit zero
49 31 1 Digit one
50 32 2 Number two
51 33 3 Number three
52 34 4 Number four
53 35 5 Number five
54 36 6 Number six
55 37 7 Number seven
56 38 8 Number eight
57 39 9 Number nine
58 3A : Colon
59 3B ; Semicolon
60 3C < Less sign
61 3D = Equal sign
62 3E > Greater than sign
63 3F ? Question mark
64 40 @ Commercial floor
65 41 A Latin capital letter A
66 42 B Latin capital letter B
67 43 C Latin capital letter C
68 44 D Latin capital letter D
69 45 E Latin capital letter E
70 46 F Latin capital letter F
71 47 G Latin capital letter G
72 48 H Latin capital letter H
73 49 I Latin capital letter I
74 4A J Latin capital letter J
75 4B K Latin capital letter K
76 4C L Latin capital letter L
77 4D M Latin capital letter
78 4E N Latin capital letter N
79 4F O Latin capital letter O
80 50 P Latin capital letter P
81 51 Q Latin capital letter
82 52 R Latin capital letter R
83 53 S Latin capital letter S
84 54 T Latin capital letter T
85 55 U Latin capital letter U
86 56 V Latin capital letter V
87 57 W Latin capital letter W
88 58 X Latin capital letter X
89 59 Y Latin capital letter Y
90 5A Z Latin capital letter Z
91 5B [ Opening square bracket
92 5C \ Backward slash
93 5D ] Closing square bracket
94 5E ^ "Lid"
95 5 _ Underscore character
96 60 ` Apostrophe
97 61 a Latin small letter a
98 62 b Latin small letter b
99 63 c Latin small letter c
100 64 d Latin small letter d
101 65 e Latin small letter e
102 66 f Latin small letter f
103 67 g Latin small letter g
104 68 h Latin small letter h
105 69 i Latin small letter i
106 6A j Latin small letter j
107 6B k Latin small letter k
108 6C l Latin small letter l
109 6D m Latin small letter m
110 6E n Latin small letter n
111 6F o Latin small letter o
112 70 p Latin small letter p
113 71 q Latin small letter q
114 72 r Latin small letter r
115 73 s Latin small letter s
116 74 t Latin small letter t
117 75 u Latin small letter u
118 76 v Latin small letter v
119 77 w Latin small letter w
120 78 x Latin small letter x
121 79 y Latin small letter y
122 7A z Latin small letter z
123 7B { Open curly brace
124 7C | Vertical bar
125 7D } Closing curly brace
126 7E ~ Tilde
127 7F

In the classic version of the ASCII character table, there are no Russian letters and it consists of 7 bits. However, later this table was expanded to 8 bits and Russian letters in the binary code and pseudo-graphic symbols appeared in the older 128 lines. In general, the second part contains the national alphabets of different countries and Russian letters there is just one of the possible sets (855) there may be a French (863), German (1141) or Greek (737) table. Table 2 shows an example of the representation of Russian letters in binary code.

Table 2. Binary representation table for Russian letters (ASCII)

Decimal code Hexadecimal code Displayed character Meaning
128 80 A Capital Russian letter A
129 81 B Capital Russian letter B
130 82 V Capital Russian letter B
131 83 G Capital Russian letter Г
132 84 D Capital Russian letter D
133 85 E Capital Russian letter E
134 86 F Capital Russian letter Ж
135 87 Z Capital Russian letter Z
136 88 AND Capital Russian letter I
137 89 Th Capital Russian letter Y
138 8A TO Capital russian letter K
139 8B L Capital Russian letter L
140 8C M Capital russian letter M
141 8D N Capital Russian letter H
142 8E O Capital Russian letter O
143 8F P Capital Russian letter P
144 90 R Capital Russian letter P
145 91 WITH Capital Russian letter C
146 92 T Capital Russian letter T
147 93 Have Uppercase Russian letter U
148 94 F Capital Russian letter Ф
149 95 X Capital Russian letter X
150 96 C Capital Russian letter C
151 97 H Capital Russian letter H
152 98 Sh Capital Russian letter Ш
153 99 SCH Capital Russian letter Щ
154 9A B Capital russian letter b
155 9B S Capital Russian letter Y
156 9C B Capital Russian letter L
157 9D E Capital Russian letter E
158 9E YU Uppercase Russian letter Y
159 9F I AM Capital Russian letter I
160 A0 a Russian small letter a
161 A1 b Russian small letter b
162 A2 v Russian small letter b
163 A3 G Russian small letter g
164 A4 d Russian small letter d
165 A5 e Russian small letter e
166 A6 f Russian small letter z
167 A7 s Russian small letter z
168 A8 and Russian lowercase letter and
169 A9 th Russian small letter y
170 AA To Russian small letter k
171 AB l Russian small letter l
172 AC m Russian small letter m
173 AD n Russian small letter n
174 AE O Russian small letter o
175 AF P Russian small letter p
176 B0
177 B1
178 B2
179 B3 Pseudo graphic symbol
180 B4 Pseudo graphic symbol
181 B5 Pseudo graphic symbol
182 B6 Pseudo graphic symbol
183 B7 Pseudo graphic symbol
184 B8 Pseudo graphic symbol
185 B9 Pseudo graphic symbol
186 BA Pseudo graphic symbol
187 BB Pseudo graphic symbol
188 BC Pseudo graphic symbol
189 BD Pseudo graphic symbol
190 BE Pseudo graphic symbol
191 Bf Pseudo graphic symbol
192 C0 Pseudo graphic symbol
193 C1 Pseudo graphic symbol
194 C2 Pseudo graphic symbol
195 C3 Pseudo graphic symbol
196 C4 Pseudo graphic symbol
197 C5 Pseudo graphic symbol
198 C6 Pseudo graphic symbol
199 C7 Pseudo graphic symbol
200 C8 Pseudo graphic symbol
201 C9 Pseudo graphic symbol
202 CA Pseudo graphic symbol
203 CB Pseudo graphic symbol
204 CC Pseudo graphic symbol
205 CD Pseudo graphic symbol
206 CE Pseudo graphic symbol
207 CF Pseudo graphic symbol
208 D0 Pseudo graphic symbol
209 D1 Pseudo graphic symbol
210 D2 Pseudo graphic symbol
211 D3 Pseudo graphic symbol
212 D4 Pseudo graphic symbol
213 D5 Pseudo graphic symbol
214 D6 Pseudo graphic symbol
215 D7 Pseudo graphic symbol
216 D8 Pseudo graphic symbol
217 D9 Pseudo graphic symbol
218 DA Pseudo graphic symbol
219 DB
220 DC
221 DD
222 DE
223 DF
224 E0 R Russian small letter p
225 E1 With Russian small letter c
226 E2 T Russian small letter t
227 E3 at Russian small letter y
228 E4 f Russian small letter f
229 E5 X Russian small letter x
230 E6 c Russian small letter t
231 E7 h Russian small letter h
232 E8 w Russian small letter w
233 E9 SCH Russian small letter u
234 EA b Russian small letter ъ
235 EB s Russian small letter y
236 EC b Russian small letter ь
237 ED eh Russian small letter e
238 EE Yu Russian small letter y
239 EF I am Russian small letter i
240 F0 Yo Capital Russian letter Ё
241 F1 e Russian small letter ё
242 F2 Є
243 F3 є
244 F4 Ї
245 F5 Ї
246 F6 Ў
247 F7 ў
248 F8 ° Degree sign
249 F9 Multiplication sign (dot)
250 FA ·
251 FB Radical (root taking)
252 FC Number sign
253 FD ¤ Currency sign (ruble)
254 FE
255 FF

When writing texts, in addition to binary codes that directly display letters, codes are used that indicate a new line and a cursor return (carriage return) to the zero position of the line. These symbols are usually used together. Their binary codes correspond to decimal numbers - 10 (0A) and 13 (0D). As an example, below is a section of the text of this page (memory dump). This section contains its first paragraph. The following format is used to display information in a memory dump:

  • the first column contains the binary address of the first byte of the string
  • the next sixteen columns contain the bytes contained in the text file. For more convenient identification of the byte number, a vertical line is drawn after the eighth column. Bytes, for brevity, are represented in hexadecimal code.
  • in the last column, the same bytes are represented as displayed alphabetic characters
00000000: 82 E1 A5 20 E1 A8 AC A2 ¦ AE AB EB 20 A8 20 A1 E3 All characters and bu 00000010: AA A2 EB 20 AC AE A3 E3 ¦ E2 20 A1 EB E2 EC 20 A7 kvs can be 00000020: A0 AA AE A4 A8 E0 AE A2 ¦ A0 AD EB 20 AF E0 A8 20 encoded at 00000030: AF AE AC AE E9 A8 20 A2 ¦ AE E1 EC AC A8 20 A4 A2 with eight doors 00000040: AE A8 E7 AD EB E5 20 E1 ¦ A8 AC A2 AE AB AE A2 2E 00000050: 0D 0A 8D A0 A8 A1 AE AB ¦ A5 A5 20 E0 A0 E1 AF E0 ♪ ◙ Most common 00000060: AE E1 E2 E0 A0 AD A5 AD ¦ AD EB AC A8 20 E2 A0 A1 canceled tab 00000070: AB A8 E6 A0 AC A8 20 EF ¦ A2 AB EF EE E2 E1 EF 20 persons are 00000080: E2 A0 A1 AB A8 E6 EB 20 ¦ 41 53 43 49 49 20 E1 20 ASCII tables with 00000090: AD A0 E6 A8 AE AD A0 AB ¦ EC AD EB AC A8 0D 0A E0 national ♪ ◙р 000000A0: A0 E1 E8 A8 E0 A5 AD A8 ¦ EF AC A8 2C 20 AF E0 A8 with extensions, at 000000B0: AC A5 AD EF EE E9 A8 A5 ¦ E1 EF 20 A2 20 44 4F 53 changing in DOS 000000C0: 20 28 A8 20 AA AE E2 AE ¦ E0 EB A5 20 AC AE A6 AD (and which can be 000000D0: AE 20 A8 E1 AF AE AB EC ¦ A7 AE A2 A0 E2 EC 20 A4 o use d 000000E0 : AB EF 20 A7 A0 AF A8 E1 ¦ A8 0D 0A E2 A5 AA E1 E2 for writing ♪ ◙text 000000F0: AE A2 20 A2 20 AC A8 AA ¦ E0 AE AF E0 AE E6 A5 E1 s in microprocess 00000100: E1 AE E0 A0 E5 29 2C 20 ¦ A8 20 E2 A0 A1 AB A8 E6 cop), and tables 00000110: EB 20 41 4E 53 49 2C 20 ¦ AF E0 A8 AC A5 AD EF EE s ANSI, apply 000 00120: E9 A8 A5 E1 EF 20 A2 20 ¦ 57 49 4E 44 4F 57 53 2E in WINDOWS. 00000130: 20 82 20 E2 A0 A1 AB A8 ¦ E6 A0 E5 0D 0A 41 53 43 Tables ♪ ◙ASC 00000140: 49 49 20 A8 20 41 4E 53 ¦ 49 20 AF A5 E0 A2 EB A5 II and ANSI first 00000150: 20 31 32 38 20 E1 A8 AC ¦ A2 AE AB AE A2 20 E1 AE 128 characters from 00000160: A2 AF A0 A4 A0 EE E2 2E ¦ 20 82 20 ED E2 AE A9 20 fall into. In this 00000170: E7 A0 E1 E2 A8 20 E2 A0 ¦ A1 AB A8 E6 EB 20 E1 AE part of the table with 00000180: A4 A5 E0 A6 A0 E2 E1 EF ¦ 0D 0A E1 A8 AC A2 AE AB hold ♪ ◙ symbol 00000190: EB 20 E6 A8 E4 E0 2C 20 ¦ A7 AD A0 AA AE A2 20 AF s digits, signs p 000001A0: E0 A5 AF A8 AD A0 AD A8 ¦ EF 2C 20 AB A0 E2 A8 AD Latin letters 000001B0: E1 AA A8 A5 20 A1 E3 AA ¦ A2 EB 20 A2 A5 E0 E5 AD upper letters 000001C0: A5 A3 AE 20 A8 20 AD A8 ¦ A6 AD A5 A3 AE 20 E0 A5 its lower pe 000001D0: A3 A8 E1 E2 E0 AE A2 20 ¦ A8 0D 0A E3 AF E0 A0 A2 Histers and ♪ control 000001E0: AB EF EE E9 A8 A5 20 E1 ¦ A8 AC A2 AE AB EB 2E 20 Leading characters. 000001F0: 8D A0 E6 A8 AE AD A0 AB ¦ EC AD EB A5 20 E0 A0 E1 National races 00000200: E8 A8 E0 A5 AD A8 EF 20 ¦ E1 A8 AC A2 AE AB EC AD character extensions 00000210: EB E5 20 E2 A0 A1 AE AB EB 0D 0A AF E1 A5 E2 E1 EF 20 A2 20 kits contained in 00000240: AF AE E1 AB A5 A4 AD A8 ¦ E5 20 31 32 38 20 AA AE last 128 ko 00000250: A4 A0 E5 20 ED E2 A8 E5 ¦ 20 E2 A0 A1 AB A8 E6 2C dah of these tables, 00000260: 20 AF AE ED E2 AE AC E3 ¦ 20 E0 E3 E1 E1 AA A8 A5 therefore Russians 00000270: 0D 0A E2 A5 AA E1 E2 EB ¦ 20 A2 20 AE AF A5 E0 A0 ♪ ◙Text in opera 00000280 : E6 A8 AE AD AD EB E5 20 ¦ E1 A8 E1 E2 A5 AC A0 E5 in systems 00000290: 20 44 4F 53 20 A8 20 57 ¦ 49 4E 44 4F 57 53 20 AD DOS and WINDOWS n 000002A0: A5 20 E1 AE A2 AF A0 A4 ¦ A0 EE E2 2E 0D 0A е coincide. ♪ ◙

In the above example, you can see that the first line of text is 80 bytes. The first byte 82 corresponds to the letter "B". The second byte E1 corresponds to the letter "c". The third byte A5 corresponds to the letter "e". The next byte 20 displays an empty space between words (space) "". Bytes 81 and 82 contain carriage return and line feed characters 0D 0A. We find these characters at the binary address 00000050: The next line of the source text is not a multiple of 16 (its length is 76 letters), therefore, in order to find its end, we first need to find the string 000000E0: and count nine columns from it. There again are written carriage return and line feed bytes 0D 0A. The rest of the text is parsed in exactly the same way.

Date of last update of the file 12/04/2018

Literature:

Together with the article "Writing texts in binary code" read:

Representation of binary numbers in the memory of a computer or microcontroller
http: //site/proc/IntCod.php

Sometimes it is convenient to store numbers in the processor memory in decimal form
http: //site/proc/DecCod.php

Standard formats for floating point numbers for computers and microcontrollers
http: // site / proc / float /

Currently, both positional and non-positional number systems are widely used in technology and in everyday life.
.php

08. 06.2018

Dmitry Vassiyarov's blog.

Binary code - where and how is it used?

Today I am especially glad to meet you, my dear readers, because I feel like a teacher who, at the very first lesson, begins to acquaint the class with letters and numbers. And since we live in the world of digital technologies, I will tell you what binary code is, which is their basis.

Let's start with the terminology and find out what binary means. For clarification, let's return to our usual calculus, which is called "decimal". That is, we use 10 digits, which make it possible to conveniently operate with various numbers and keep a corresponding record.

Following this logic, the binary system uses only two characters. In our case, it is just "0" (zero) and "1" one. And here I want to warn you that, hypothetically, in their place there could be other conventions, but just such values, denoting the absence (0, empty) and the presence of a signal (1 or "stick"), will help us further understand the structure of the binary code.

Why do I need binary?

Before the advent of computers, various automatic systems were used, the principle of operation of which is based on receiving a signal. The sensor is triggered, the circuit is closed and a specific device is turned on. No current in the signal circuit - no actuation. It was electronic devices that made progress in processing information represented by the presence or absence of voltage in a circuit.

Their further complication led to the appearance of the first processors, which also did their job, processing already a signal consisting of pulses alternating in a certain way. We will not delve into the program details now, but the following is important for us: electronic devices turned out to be able to distinguish a given sequence of incoming signals. Of course, it is possible to describe the conditional combination like this: “there is a signal”; "no signal"; “There is a signal”; "There is a signal." You can even simplify the notation: "is"; "No"; "there is"; "there is".

But it is much easier to designate the presence of a signal by one "1", and its absence - by zero "0". Then, instead of all this, we can use a simple and concise binary: 1011.

Undoubtedly, the processor technology has made great strides forward and now chips are able to perceive not just a sequence of signals, but entire programs written in specific commands consisting of individual characters.

But for their recording, the same binary code is used, consisting of zeros and ones, corresponding to the presence or absence of a signal. Whether he is, or not, it makes no difference. For a chip, any of these options is a single piece of information called a "bit" (bit is the official unit of measurement).

Conventionally, a character can be encoded as a sequence of several characters. Only four variants can be described with two signals (or their absence): 00; 01; 10; 11. This encoding method is called two-bit. But it can be:

  • Four-bit (as in the example for the paragraph above 1011) allows you to write 2 ^ 4 = 16 character combinations;
  • Eight-bit (for example: 0101 0011; 0111 0001). At one time it was of most interest for programming, since it covered 2 ^ 8 = 256 values. This made it possible to describe all decimal digits, the Latin alphabet and special characters;
  • Sixteen-bit (1100 1001 0110 1010) and above. But records with such a length are already for modern more complex tasks. Modern processors use 32- and 64-bit architecture;

Frankly, there is no single official version, it so happened that the combination of eight characters has become the standard measure of stored information, called "byte". This could even be applied to one letter written in 8-bit binary code. So, my dear friends, please remember (if anyone did not know):

8 bits = 1 byte.

So it is accepted. Although a character written as a 2-bit or 32-bit value can also nominally be called a byte. By the way, thanks to the binary code, we can estimate the volume of files measured in bytes and the speed of information and Internet transfer (bits per second).

Binary encoding in action

To standardize the recording of information for computers, several coding systems have been developed, one of which ASCII, based on 8-bit recording, has become widespread. The values ​​in it are distributed in a special way:

  • the first 31 characters are control characters (from 00000000 to 00011111). Serve for service commands, output to a printer or screen, sound signals, text formatting;
  • the next from 32 to 127 (00100000 - 01111111) Latin alphabet and auxiliary symbols and punctuation marks;
  • the rest, up to 255th (10000000 - 11111111) - an alternative part of the table for special tasks and displaying national alphabets;

The decoding of the values ​​in it is shown in the table.

If you think that "0" and "1" are located in a chaotic order, then you are deeply mistaken. Using any number as an example, I will show you a pattern and teach you how to read numbers written in binary code. But for this we will accept some conventions:

  • We will read a byte of 8 characters from right to left;
  • If in ordinary numbers we use the digits of ones, tens, hundreds, then here (reading in reverse order) for each bit various powers of "two" are presented: 256-124-64-32-16-8-4-2-1;
  • Now we look at the binary code of a number, for example 00011011. Where there is a signal "1" in the corresponding position, we take the values ​​of this bit and sum them up in the usual way. Accordingly: 0 + 0 + 0 + 32 + 16 + 0 + 2 + 1 = 51. You can verify the correctness of this method by looking at the code table.

Now, my inquisitive friends, you not only know what a binary code is, but also know how to transform the information encrypted by it.

Language understandable to modern technology

Of course, the algorithm for reading binary code by processor devices is much more complicated. But on the other hand, you can use it to write anything you like:

  • Text information with formatting options;
  • Numbers and any operations with them;
  • Graphic and video images;
  • Sounds, including those that go beyond the limits of our audibility;

In addition, due to the simplicity of the "presentation", various ways of recording binary information are possible:

  • By changing the magnetic field to;
  • The advantages of binary coding are supplemented by almost unlimited possibilities for transmitting information over any distance. It is this method of communication that is used with spaceships and artificial satellites.

    So, today the binary number system is a language that is understood by most of the electronic devices we use. And what is most interesting, no other alternative for it is foreseen yet.

    I think that the information I have outlined for a start will be quite enough for you. And then, if such a need arises, everyone can delve into an independent study of this topic.

    I will say goodbye and after a short break I will prepare for you a new article on my blog on some interesting topic.

    It's better if you tell me it yourself;)

    See you soon.

    Binary code is text, computer processor instructions, or other data using any two-character system. Most often it is a system of 0 and 1. assigns a pattern of binary digits (bits) to each character and instruction. For example, an eight-bit binary string can represent any of 256 possible values ​​and therefore can generate many different elements. Reviews of the binary code of the world professional community of programmers indicate that this is the basis of the profession and the main law of the functioning of computing systems and electronic devices.

    Decoding binary code

    In computing and telecommunications, binary codes are used for various methods of encoding data characters into bit strings. These methods can use fixed or variable width strings. There are many character sets and encodings for translating to binary. In fixed-width code, each letter, number, or other character is represented by a bit string of the same length. This bit string, interpreted as a binary number, is usually displayed in code tables in octal, decimal, or hexadecimal notation.

    Binary code decoding: A bit string interpreted as a binary number can be converted to a decimal number. For example, the lowercase letter a, if represented by the bit string 01100001 (as in the standard ASCII code), can also be represented as decimal 97. Translating a binary code into text is the same procedure, only in reverse order.

    How it works

    What does a binary code consist of? The code used in digital computers is based on which there are only two possible states: on. and off, usually denoted by zero and one. If in the decimal system, which uses 10 digits, each position is a multiple of 10 (100, 1000, etc.), then in the binary system, each digital position is a multiple of 2 (4, 8, 16, etc.). A binary code signal is a series of electrical impulses that represent numbers, symbols, and operations that need to be performed.

    A device called a clock sends out regular pulses, and components such as transistors turn on (1) or off (0) to transmit or block the pulses. In binary, each decimal number (0-9) is represented by a set of four binary digits or bits. The four basic arithmetic operations (addition, subtraction, multiplication, and division) can be reduced to combinations of fundamental Boolean algebraic operations on binary numbers.

    A bit in communication and information theory is a unit of data equivalent to choosing between two possible alternatives in the binary number system commonly used in digital computers.

    Binary code reviews

    The nature of code and data is a fundamental part of the fundamental world of IT. This tool is used by specialists from the global IT "behind the scenes" - programmers whose specialization is hidden from the attention of an ordinary user. Feedback from developers on binary code indicates that this area requires a deep study of mathematical foundations and a lot of practice in the field of mathematical analysis and programming.

    Binary code is the simplest form of computer code or programming data. It is fully represented by the binary system of numbers. According to reviews about binary code, it is often associated with machine code, as binary sets can be combined to form source code that can be interpreted by a computer or other hardware. This is partly true. uses sets of binary digits to form instructions.

    Along with the most basic form of code, a binary is also the smallest amount of data that flows through all the complex complex hardware and software systems that handle today's data resources and assets. The smallest amount of data is called a bit. The current bit strings become code or data, which are interpreted by the computer.

    Binary number

    In mathematics and digital electronics, a binary number is a number expressed in base-2, or a binary digital system that uses only two characters: 0 (zero) and 1 (one).

    The base-2 number system is a positional notation with a radius of 2. Each digit is referred to as a bit. Due to its simple implementation in digital electronic circuits using logical rules, the binary system is used by almost all modern computers and electronic devices.

    Story

    The modern binary system of numbers as the basis for binary code was invented by Gottfried Leibniz in 1679 and presented in his article "Explaining Binary Arithmetic". Binary numbers were central to Leibniz's theology. He believed that binary numbers symbolized the Christian idea of ​​creativity ex nihilo, or creation from nothing. Leibniz tried to find a system that converts the verbal statements of logic into purely mathematical data.

    Binary systems that predate Leibniz also existed in the ancient world. An example is the Chinese binary system I Ching, where the text for prediction is based on the duality of yin and yang. In Asia and Africa, slit drums with binary tones were used to encode messages. The Indian scholar Pingala (circa 5th century BC) developed a binary system for describing prosody in his Chandashutrem.

    The inhabitants of Mangareva Island in French Polynesia used a hybrid binary-decimal system until 1450. In the 11th century, the scientist and philosopher Shao Yong developed a method for organizing hexagrams that corresponds to the sequence from 0 to 63, as represented in binary format, with yin equal to 0, yang equal to 1. Order is also a lexicographic order in blocks of elements selected from a two-element set.

    New time

    In 1605, he discussed a system in which letters of the alphabet could be reduced to sequences of binary numbers, which could then be encoded as subtle variations of the typeface in any random text. It is important to note that it was Francis Bacon who supplemented the general theory of binary coding with the observation that this method can be used with any object.

    Another mathematician and philosopher named George Boole published an article in 1847 called "The Mathematical Analysis of Logic," which describes the algebraic system of logic known today as Boolean algebra. The system was based on a binary approach, which consisted of three main operations: AND, OR, and NOT. This system was not put into operation until a graduate student at MIT named Claude Shannon noticed that the Boolean algebra he studied looked like an electrical circuit.

    Shannon wrote a dissertation in 1937 that drew important conclusions. Shannon's thesis became the starting point for the use of binary code in practical applications such as computers and electrical circuits.

    Other forms of binary code

    A bit string is not the only type of binary code. A binary system in general is any system that allows only two options, such as a switch in an electronic system, or a simple true or false test.

    Braille is a type of binary code that is widely used by blind people to read and write by touch, named for its creator Louis Braille. This system consists of grids of six points each, three per column, in which each point has two states: raised or deepened. Various combinations of dots are capable of representing all letters, numbers, and punctuation marks.

    The American Standard Code for Information Interchange (ASCII) uses a 7-bit binary code to represent text and other characters in computers, communications equipment, and other devices. Each letter or symbol is assigned a number from 0 to 127.

    Binary Coded Decimal Value or BCD is a binary coded representation of integer values ​​that uses a 4-bit graph to encode decimal digits. The four binary bits can encode up to 16 different values.

    In BCD-encoded numbers, only the first ten values ​​in each nibble are correct and encode decimal digits with a zero through nine. The other six values ​​are invalid and can cause either a machine exception or unspecified behavior, depending on the computer's implementation of BCD arithmetic.

    BCD arithmetic is sometimes preferred over floating point number formats in commercial and financial applications where complex number rounding behavior is undesirable.

    Application

    Most modern computers use a binary code program for instructions and data. CDs, DVDs, and Blu-ray Discs represent audio and video in binary form. Telephone calls are carried digitally in long distance and mobile telephone networks using pulse code modulation and in voice over IP networks.


    2021
    maccase.ru - Android. Brands. Iron. news