What is the hexadecimal number system in computer science. Binary octal hexadecimal number system

The hexadecimal number system has an alphabet consisting of 16 digits:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, b, c, d, e, f.

When writing a number in the hexadecimal system, the letters A, B, C, D, E, F are used respectively to write the digits denoting the numbers 10, 11, 12. 13, 14. 15.

Converting numbers from hexadecimal to decimal

You can convert any hexadecimal number to decimal using the already known formula

Examples.

    AE07 16 =10∙16 3 +14∙16 2 +0∙16 1 +7∙16 0 =44551 10 .

    100 16 =1∙16 2 +0∙16 1 +0∙16 0 =256 10 .

    58 16 =5∙16 1 +8∙16 0 =.88 10 .

    2A 16 =2∙16 1 +10∙16 0 =42 10.

Converting a number from the decimal system to hexadecimal is carried out in the same way as to binary.

Converting numbers from hexadecimal to binary and vice versa

You can convert any hexadecimal number to binary as follows. Each digit of a hexadecimal number is written as a four-digit binary number - notebook. After this, the zeros on the left can be discarded.

2) 2A= 0010 1010 2 = 101010 2 .

3) 58 16 = 0101 1000 2 = 1011000 2 .

Conversely, you can convert any binary number to hexadecimal in the same way. Every four binary digits, counting from right to left, are written as one hexadecimal digit. These numbers are also located from right to left.

Examples.

2. 101010 2 = 10 1010 2 = 2A.

3. 1011000 2 = 101 1000 2 = 58 16 .

Octal number system

The octal number system has an alphabet consisting of 8 digits:

0, 1, 2, 3, 4, 5, 6, 7.

Converting a number from the decimal system to octal and back is carried out in the same way as converting to/from binary.

Converting numbers from octal to binary and back

Each digit of an octal number is written as a three-digit binary number - triad.

Examples.

2563 8 = 010 101 110 011 2 =10101110011 2 .

1001101 2 = 001 001 101 2 = 115 8 .

Methodological materials for laboratory lesson No. 1

Topic of the laboratory lesson: Number systems. Measuring information.

Number of hours: 2.

Examples with solutions

    Translation fromp -ary system to 10-ary system. Suppose we need to convert a number in a certain number system to decimal. To do this, you need to represent it in the form

11100110 2 = 1∙2 7 + 1∙2 6 + 1∙2 5 + 0∙2 4 + 0∙2 3 + 1∙2 2 + 1∙2 1 + 0∙2 0 = 128 + 64 + 32 + 4 + 2 = 230 10 .

2401 5 = 2∙5 3 + 4∙5 2 + 0∙5 1 + 1∙5 0 = 250 + 100 + 0 + 1 = 351.

    Conversion from 10-digit system top -ichnaya.

2.1 98 10 → X 2.

We divide the number by 2. Then we divide the incomplete quotient by 2. We continue until the incomplete quotient becomes less than 2, i.e. equal to 1.

    98: 2 = 49. Remainder - 0 .

    49: 2 = 24. Remainder - 1 .

    24: 2 = 12. Remainder - 0 .

    12: 2 = 6. Remainder - 0 .

    6: 2 = 3. Remainder - 0 .

    3: 2 = 1 . 1 .

Since the last partial quotient is 1, the process is over. We write down all the remainders from bottom to top, starting with the last incomplete quotient, and we get the number 1100010. So 98 10 = 1100010 2.

2.2 2391 10 → X 16.

Divide the number by 16. Then divide the partial quotient by 16. Continue until the partial quotient is less than 16.

    2391: 16 = 149. Remainder - 7 .

    149: 16 = 9 . 5 .

Since the last partial quotient (9) is less than 16, the process is over. We write down, starting from the last incomplete quotient, all the remainders from bottom to top and we get the number 957. So 2391 10 = 957 16.

2.3 12165 10 → X 2.

If you convert by division to the binary system, you get a rather cumbersome process. You can first convert the number to octal, and then replace the octal digits from right to left with triads.

12165 10 = 27605 8 = 010 111 110 000 101 = 10111110000101.

    Determining the base of a number systemp .

One boy wrote about himself: “I have 24 fingers, 5 on each hand, and 12 on my feet.” How can this be?

Solution. It is necessary to determine the base of the number system p. Since we know that there are only 10 toes 10, then 12 p =1∙p+2 = 10 10 . From here we get the equation p + 2 = 10  p= 8. So the boy meant numbers in the octal system. Indeed, there are 24 8 = 2∙8+4 = 20 10 toes, and 12 8 = 1∙8+2 = 10 10 toes.

Hexadecimal number system(also known as hexadecimal code) is a positional number system with an integer base of 16. The term hex (pronounced hex, short for English hexadecimal) is also sometimes used in the literature. The digits of this number system are usually used in Arabic numerals 0-9, as well as the first characters of the Latin alphabet A-F. The letters correspond to the following decimal values:

  • * A -10;
  • *B—11;
  • *C—12;
  • * D -13;
  • * E - 14;
  • * F - 15.

Thus, ten Arabic numerals, coupled with six Latin letters, make up the sixteen digits of the system.

By the way, on our website you can convert any text into decimal, hexadecimal, binary code using the Online Code Calculator.

Application. Hex code widely used in low-level programming as well as in various computer reference documents. The popularity of the system is justified by the architectural solutions of modern computers: they have a byte (consisting of eight bits) as the minimum unit of information - and the value of a byte is conveniently written using two hexadecimal digits. The byte value can range from #00 to #FF (0 to 255 in decimal notation) - in other words, using hexadecimal code, you can write any state of the byte, while there are no “extra” digits not used in the recording.

Encoded Unicode Four hexadecimal digits are used to record the character number. The RGB color notation (Red, Green, Blue) also often uses hexadecimal code (for example, #FF0000 is a bright red color notation).

A method for writing hexadecimal code.

Mathematical way of writing. In mathematical notation, the base of the system is written in decimal form as a subscript to the right of the number. The decimal notation of the number 3032 can be written as 3032 10, in the hexadecimal system this number will have the notation BD8 16.

In the syntax of programming languages. The syntax of different programming languages ​​sets differently the format for writing a number using hexadecimal code:

* The syntax of some varieties of assembly language uses the Latin letter “h”, which is placed to the right of the number, for example: 20Dh. If a number begins with a Latin letter, then a zero is placed in front of it, for example: 0A0Bh. This is done in order to distinguish values ​​using constants from constants. hexadecimal code;

* Other types of assembler, as well as Pascal (and its variants such as Delphi) and some Basic dialects, use the "$" prefix: $A15;

* In the HTML markup language, as well as in cascading CSS files, the prefix “#” is used to specify a color in RGB format with a hexadecimal notation: #00DC00.

How to convert hexadecimal code to another system?

Convert from hexadecimal to decimal. To perform a conversion operation from the hexadecimal system to the decimal system, you need to represent the original number as the sum of the products of the digits in the digits of the hexadecimal number and the power of the base.

Binary SS

hex SS

For example, you need to translate the hexadecimal number A14: it has three digits. Using the rule, we write it as a sum of powers with a base of 16:

A14 16 = 10.16 2 + 1.16 1 + 4.16 0 = 10.256 + 1.16 + 4.1 = 2560 + 16 + 4 = 2580 10

Converting numbers from binary to hexadecimal and vice versa.

A notebook table is used for translation. To convert a number from the binary to the decimal system, you need to split it into separate tetrads from right to left, and then, using the table, replace each tetrad with the corresponding hexadecimal digit. Moreover, if the number of digits is not a multiple of four, then it is necessary to add the corresponding number of zeros to the right of the number so that the total number of binary digits becomes a multiple of four.

Table of notebooks for translation.

To convert from hexadecimal to binary, you need to perform the reverse operation: replace each digit with a tetrad from the table.

Binary SS

Octal SS

Example conversion from hexadecimal to binary: A5E 16 = 1010 0101 1110 = 101001011110 2

Example conversion from binary to hexadecimal: 111100111 2 = 0001 1110 0111 = 1E7 16

In this example, the number of digits in the original binary number was not four (9), so leading zeros were added for a total number of digits of 12.

Automatic translation. A quick conversion from the hexadecimal number system to one of the three popular systems (binary, octal and decimal), as well as the reverse conversion, can be performed using a standard calculator included with Windows OS. Open the calculator, select View -> Programmer from the menu. In this mode, you can set the number system currently in use (see menu on the left: Hex, Dec, Oct, Bin). In this case, changing the current number system automatically produces a translation.

To write programs in Assembly, you need to understand the hexadecimal number system. There is nothing complicated about it. We use the decimal system in life. I'm sure you all know it, so I'll try to explain the hexadecimal system using an analogy with the decimal system.

So, in the decimal system, if we add a zero to any number on the right, then this number will increase by 10 times. For example: 1 x 10 = 10; 10 x 10 = 100; 100 x 10 = 1000, etc. In this system we use numbers from 0 to 9, i.e. ten different numbers (in fact, that’s why it’s called decimal).

In the hexadecimal system, we use sixteen "digits". I specifically wrote the word “digits” in quotation marks, because... It doesn't just use numbers. And really, how can that be? Let me explain: from 0 to 9 we count in the same way as in decimal, but then it will be like this: A, B, C, D, E, F. The number F is not difficult count, it will be equal to 15 in the decimal system (see Table 1).

Decimal number

Hexadecimal number

Table 1. Decimal and hexadecimal systems.

Thus, if we add a zero to the right of any number in the hexadecimal system, then this number will increase by16 once.

Example 1: 1 x 16 = 10; 10 x 16 = 100; 100 x 16 = 1000, etc.

Were you able to distinguish hexadecimal numbers from decimal numbers in Example 1? And from this series: 10, 12, 45, 64, 12, 8, 19? These can be either hexadecimal or decimal. In order to avoid confusion and the computer to be able to clearly distinguish one number from another, in assembler it is customary to place the symbol h or H after a hexadecimal number ( H is an abbreviation for English. hexadecimal (hexadecimal). For brevity, it is sometimes simply called Hex ) . And don’t put anything after the decimal. Because numbers from 0 to 9 in both systems have the same meanings, then the numbers written as 5 and 5h are the same.

That. Example 1 (see above) would be more correct to write like this: 1 x 16 = 10h; 10h x 16 = 100h; 100h x 16 = 1000h. Or like this: 1h x 10h = 10h; 10h x 10h = 100h; 100h x 10h = 1000h.

We will look at why the hexadecimal system is needed in subsequent issues. For now, for our example program, which will be discussed below, we need to know about the existence of hexadecimal numbers.

So, let's summarize. The hexadecimal number system consists of 10 digits (from 0 to 9) and 6 letters of the Latin alphabet (A, B, C, D, E, F). If we add a zero to the right of any number in the hexadecimal system, then this number will increase by16 once. It is very important to understand this topic, since we will constantly use it when writing programs.

Now a little about how I will build examples in Assembly. It is not entirely convenient to present them in HTML format, so first there will be the program code itself with numbered lines, and immediately after it there will be explanations and notes.

Like that:

lines Program code
(1) mov ah,9

Explanations:

In line (1) we do this, and in line (15) we do that.

Huge request: DO NOT copy programs from a page to the clipboard and then paste them into Notepad (or anywhere else)! Retype them manually in a text editor. If you have a printer, then select the program, print the selected fragment, and then transfer it into the editor from paper. All examples must be typed yourself! This will speed up the memorization of operators.

And further. There is no difference between lowercase and UPPERCASE letters in assembler. Records of the form:

The assembler perceives them the same way. You can, of course, force the assembler to distinguish between lowercase and UPPERCASE characters, but we will not do this for now. To make the program easier to read, it is best to type operators in lowercase letters, and start the names of subroutines and labels in uppercase letters. But it depends on who will be comfortable.

So, let's move on to our first program:

(1) CSEG segment

(2)org 100h

(4)Begin:

(6) mov ah,9

(7) mov dx,offset Message

(8)int 21h

(10) int 20h

(11)

(12) Message db "Hello, world!$"

(13)CSEG ends

(14) end Begin

In order to explain all the operators in this example, we will need several editions. Therefore, we will simply omit the description of some commands at this stage. Just assume that this is how it should be. We will look at these operators in detail in the very near future. So, lines numbered (1), (2) and (13) you simply ignore.

Lines (3), (5), (9) and (11) remain empty. This is done for clarity. The assembler will simply omit them.

Now let's move on to consider the remaining operators. The program code begins with line (4). This is a mark that tells the assembler to the beginning of the code. Line (14) contains the operators end Begin ( Begin English Start; end end). This is the end of the program. In general, instead of the word Begin something else could have been used. For example, Start:. In this case, we would have to end the program End Start (14).

Lines (6) (8) display the message Hello, world!. Here we will have to briefly talk about processor registers (we will look at this topic in more detail in the next issue).

A processor register is a specially allocated memory for storing a number.

For example:

If we want to add two numbers, then in mathematics we write it like this:

A, B and C these are a kind of registers (if we talk about a computer) in which some data can be stored. A=5 can be read as: Assign A the number 5 .

To assign a register a value, there is a mov operator in Assembler (from the English move load). Line (6) should be read like this: Loading into the register A.H.number 9 (in other words, we assign A.H.number 9). Below we will look at why this is necessary.

In line (7) we load into the register DX message address for output (in this example it will be the stringHello, world!$).

Interrupts will be covered in detail in subsequent issues. Here I will say a few words.

Interrupt MS-DOS it is a kind of subroutine (part MS-DOS), which resides permanently in memory and can be called at any time from any program.

Let's consider the above using an example (Notes in small print):

Program for adding two numbers

HomePrograms

A=5 We enter the value 5 into variable A

B=8 into variable B the value 8

Calling Subroutines Addition

now C equals 13

A=10 same thing, just different numbers

B=25

Calling Subroutines Addition

now C is equal to 35

End of the Program

Subroutine Addition

C=A+B

ReturnFromSubroutine we return to the place from which we called

EndSubroutine

In this example, we called the subroutine twice Addition, which added two numbers passed to it in variables A and B . The result is placed in the variable C. When a subroutine is called, the computer remembers where it was called from, and then, when the subroutine has finished running, the computer returns to the place from which it was called. That. You can call subroutines an indefinite number of times from anywhere.

When executing line (8) of an Assembly program, we call a subroutine (in this case called an interrupt), which displays the line on the screen. For this purpose, we, in fact, place the necessary values ​​in registers. All the necessary work (outputting a line, moving the cursor) is taken over by the subroutine. This line can be read like this: call the twenty-first interrupt ( int from English interrupt interrupt). Please note that after the number 21 there is a letter h . This, as we already know, is a hexadecimal number (33 in decimal). Of course, nothing prevents us from replacing the line int 21h to int 33. The program will work correctly. It's just common practice in Assembler to indicate the interrupt number in hexadecimal.

In line (10) we, as you may have guessed, call interrupt 20 h . To call this interrupt, you do not need to specify any values ​​in the registers. It performs only one task: exiting the program (exiting to DOS). As a result of the execution of interrupt 20h, the program will return to where it was launched from (loaded, called). For example, in Norton Commander or DOS Navigator.

Line (12) contains the message to be output. First word ( message message) message title. It can be anything (for example, mess or string, etc.). ABOUT Pay attention to line (7), in which we load into the register DX our message address.

We can create another line, which we will call Mess2. Then, starting from line (9), insert the following commands:

(10) mov dx,offset Mess2

(13) Message db "Hello, world!$"

(14) Mess2 db "It's ME! $"

and reassemble our program. I hope you can guess what will happen

Pay attention to the last character in the lines Message and Mess2 - $. It points to the end of the line. If we remove it, then 21 h the interrupt will continue outputting until it encounters a character somewhere in memory $. On the screen we will see garbage .

If you have a debugger, you can see how our program will work.

The purpose of this issue was not to understand in detail with each operator. This is impossible, because you don't have enough knowledge yet. I believe that after 3-4 releases you will understand the principle and structure of an Assembly program. Perhaps the Assembly language seemed extremely complicated to you, but believe me, this is at first glance.

Hexadecimal number system. our first program.

To write programs in Assembly, you need to understand the hexadecimal number system. There is nothing complicated about it. We use the decimal system in life. I'm sure you all know it, so I'll try to explain the hexadecimal system using an analogy with the decimal system.

So, in the decimal system, if we add a zero to any number on the right, then this number will increase by 10 times. For example: 1 x 10 = 10; 10 x 10 = 100; 100 x 10 = 1000, etc. In this system we use numbers from 0 to 9, i.e. ten different numbers (in fact, that’s why it’s called decimal).

In the hexadecimal system, we use sixteen "digits". I specifically wrote the word “digits” in quotation marks, because... It doesn't just use numbers. And really, how can that be? Let me explain: from 0 to 9 we count in the same way as in decimal, but then it will be like this: A, B, C, D, E, F. The number F is not difficult count, it will be equal to 15 in the decimal system (see Table 1).

Decimal number

Hexadecimal number

Table 1. Decimal and hexadecimal systems.

Thus, if we add a zero to the right of any number in the hexadecimal system, then this number will increase by16 once.

Example 1: 1 x 16 = 10; 10 x 16 = 100; 100 x 16 = 1000, etc.

Were you able to distinguish hexadecimal numbers from decimal numbers in Example 1? And from this series: 10, 12, 45, 64, 12, 8, 19? These can be either hexadecimal or decimal. In order to avoid confusion and the computer to be able to clearly distinguish one number from another, in assembler it is customary to place the symbol h or H after a hexadecimal number ( H is an abbreviation for English. hexadecimal (hexadecimal). For brevity, it is sometimes simply called Hex ) . And don’t put anything after the decimal. Because numbers from 0 to 9 in both systems have the same meanings, then the numbers written as 5 and 5h are the same.

That. Example 1 (see above) would be more correct to write like this: 1 x 16 = 10h; 10h x 16 = 100h; 100h x 16 = 1000h. Or like this: 1h x 10h = 10h; 10h x 10h = 100h; 100h x 10h = 1000h.

We will look at why the hexadecimal system is needed in subsequent issues. For now, for our example program, which will be discussed below, we need to know about the existence of hexadecimal numbers.

So, let's summarize. The hexadecimal number system consists of 10 digits (from 0 to 9) and 6 letters of the Latin alphabet (A, B, C, D, E, F). If we add a zero to the right of any number in the hexadecimal system, then this number will increase by16 once. It is very important to understand this topic, since we will constantly use it when writing programs.

Now a little about how I will build examples in Assembly. It is not entirely convenient to present them in HTML format, so first there will be the program code itself with numbered lines, and immediately after it there will be explanations and notes.

Like that:

lines Program code
(1) mov ah,9

Explanations:

In line (1) we do this, and in line (15) we do that.

Huge request: DO NOT copy programs from a page to the clipboard and then paste them into Notepad (or anywhere else)! Retype them manually in a text editor. If you have a printer, then select the program, print the selected fragment, and then transfer it into the editor from paper. All examples must be typed yourself! This will speed up the memorization of operators.

And further. There is no difference between lowercase and UPPERCASE letters in assembler. Records of the form:

The assembler perceives them the same way. You can, of course, force the assembler to distinguish between lowercase and UPPERCASE characters, but we will not do this for now. To make the program easier to read, it is best to type operators in lowercase letters, and start the names of subroutines and labels in uppercase letters. But it depends on who will be comfortable.

So, let's move on to our first program:

(1) CSEG segment

(2)org 100h

(4)Begin:

(6) mov ah,9

(7) mov dx,offset Message

(8)int 21h

(10) int 20h

(11)

(12) Message db "Hello, world!$"

(13)CSEG ends

(14) end Begin

In order to explain all the operators in this example, we will need several editions. Therefore, we will simply omit the description of some commands at this stage. Just assume that this is how it should be. We will look at these operators in detail in the very near future. So, lines numbered (1), (2) and (13) you simply ignore.

Lines (3), (5), (9) and (11) remain empty. This is done for clarity. The assembler will simply omit them.

Now let's move on to consider the remaining operators. The program code begins with line (4). This is a mark that tells the assembler to the beginning of the code. Line (14) contains the operators end Begin ( Begin English Start; end end). This is the end of the program. In general, instead of the word Begin something else could have been used. For example, Start:. In this case, we would have to end the program End Start (14).

Lines (6) (8) display the message Hello, world!. Here we will have to briefly talk about processor registers (we will look at this topic in more detail in the next issue).

A processor register is a specially allocated memory for storing a number.

For example:

If we want to add two numbers, then in mathematics we write it like this:

A, B and C these are a kind of registers (if we talk about a computer) in which some data can be stored. A=5 can be read as: Assign A the number 5 .

To assign a register a value, there is a mov operator in Assembler (from the English move load). Line (6) should be read like this: Loading into the register A.H.number 9 (in other words, we assign A.H.number 9). Below we will look at why this is necessary.

In line (7) we load into the register DX message address for output (in this example it will be the stringHello, world!$).

Interrupts will be covered in detail in subsequent issues. Here I will say a few words.

Interrupt MS-DOS it is a kind of subroutine (part MS-DOS), which resides permanently in memory and can be called at any time from any program.

Let's consider the above using an example (Notes in small print):

Program for adding two numbers

HomePrograms

A=5 We enter the value 5 into variable A

B=8 into variable B the value 8

Calling Subroutines Addition

now C equals 13

A=10 same thing, just different numbers

B=25

Calling Subroutines Addition

now C is equal to 35

End of the Program

Subroutine Addition

C=A+B

ReturnFromSubroutine we return to the place from which we called

EndSubroutine

In this example, we called the subroutine twice Addition, which added two numbers passed to it in variables A and B . The result is placed in the variable C. When a subroutine is called, the computer remembers where it was called from, and then, when the subroutine has finished running, the computer returns to the place from which it was called. That. You can call subroutines an indefinite number of times from anywhere.

When executing line (8) of an Assembly program, we call a subroutine (in this case called an interrupt), which displays the line on the screen. For this purpose, we, in fact, place the necessary values ​​in registers. All the necessary work (outputting a line, moving the cursor) is taken over by the subroutine. This line can be read like this: call the twenty-first interrupt ( int from English interrupt interrupt). Please note that after the number 21 there is a letter h . This, as we already know, is a hexadecimal number (33 in decimal). Of course, nothing prevents us from replacing the line int 21h to int 33. The program will work correctly. It's just common practice in Assembler to indicate the interrupt number in hexadecimal.

In line (10) we, as you may have guessed, call interrupt 20 h . To call this interrupt, you do not need to specify any values ​​in the registers. It performs only one task: exiting the program (exiting to DOS). As a result of the execution of interrupt 20h, the program will return to where it was launched from (loaded, called). For example, in Norton Commander or DOS Navigator.

Line (12) contains the message to be output. First word ( message message) message title. It can be anything (for example, mess or string, etc.). ABOUT Pay attention to line (7), in which we load into the register DX our message address.

We can create another line, which we will call Mess2. Then, starting from line (9), insert the following commands:

(10) mov dx,offset Mess2

(13) Message db "Hello, world!$"

(14) Mess2 db "It's ME! $"

and reassemble our program. I hope you can guess what will happen

Pay attention to the last character in the lines Message and Mess2 - $. It points to the end of the line. If we remove it, then 21 h the interrupt will continue outputting until it encounters a character somewhere in memory $. On the screen we will see garbage .

If you have a debugger, you can see how our program will work.

The purpose of this issue was not to understand in detail with each operator. This is impossible, because you don't have enough knowledge yet. I believe that after 3-4 releases you will understand the principle and structure of an Assembly program. Perhaps the Assembly language seemed extremely complicated to you, but believe me, this is at first glance.

Hexadecimal notation ("Hex")- a convenient way to represent binary values. Just as the decimal number system has a base of ten and the binary number system has a base of two, the hexadecimal number system has a base of sixteen.

The base 16 number system uses the numbers 0 to 9 and the letters A to F. The figure shows the equivalent decimal, binary, and hexadecimal values ​​for the binary numbers 0000 to 1111. We find it easier to express a value as one hexadecimal digit than as four bits

Understanding Bytes

Given that 8 bits (bytes) are the standard binary grouping, the binary numbers 00000000 to 11111111 can be represented in hexadecimal notation as the numbers 00 to FF. Leading zeros are always displayed to complete the 8-bit representation. For example, the binary value 0000 1010 in hexadecimal would be 0A.

Representation of Hexadecimal Values

Please note: It is important to distinguish hexadecimal values ​​from decimal values ​​for characters 0 through 9, as shown in the figure.

Hexadecimal values ​​are usually represented in text by a value preceded by 0x (such as 0x73), or by using a subscript of 16. Less commonly, they may be followed by the letter H, such as 73H. However, because subscript text is not recognized on the command line or in programming environments, they are preceded by "0x" (zero X) in the technical representation of hexadecimal numbers. Therefore, the examples above would be shown as 0x0A and 0x73 respectively.

Hexadecimal notation is used to represent Ethernet MAC addresses and IP Version 6 addresses.

Hexadecimal Conversions

Converting numbers between decimal and hexadecimal values ​​is simple, but quickly dividing or multiplying by 16 is not always convenient. If such conversions are necessary, it is usually easier to convert a decimal or hexadecimal value to binary, and then convert the binary value to decimal or hexadecimal, depending on what you want to get.

With practice, it is possible to recognize the binary bit patterns that correspond to decimal and hexadecimal values. The figure shows these patterns for some 8-bit values.