ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING Converting between number systems - easy and with a smile. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Beginner radio amateur Let's start again with the decimal system. Let's take the same number 167 as an example (I don't know why exactly it came to my mind), and represent this number like this: 167 = 1*100 + 6*10 + 7*1 Isn't it fair? Well, the following is also true: 167 = 1*102 + 6*101 + 7*100 (any number to the 0th power is 1). What have we done? We have multiplied the value of each digit by the base of the number system, raised to a power equal to the digit number (if the least significant digit is taken as 0th). Unclear?… I explain. The number 167 has three digits. The numbering of the digits always goes from right to left, from the youngest to the oldest. All normal people count from one. Abnormal, that is - we, electronic programmers, count from scratch. Remember this. FROM SCRATCH!!! Everything and always! So, that's why the least significant digit will be zero. Total we get: 0 digit = 7 1 digit = 6 2 digit = 1 The number system is decimal. This means that its base is 10. We raise 10 to the power equal to the number of each digit and multiply by the fact that the value of the digit is obtained. Then we add it all up. It's that simple! We pass (return) to the binary system. Everything is exactly the same. The number 10100 can be represented as: 1*24 + 0*23 + 1*22 + 0*21 + 0*20 or 16 + 0 + 4 + 0 + 0. By extremely complex calculations, you can get the sum of all this. It is equal to 20. So, gentlemen. We just converted a binary number to decimal. It turned out that 101002 = 2010. This is easy to do if you know the powers of two. Personally, I immediately name all integer powers of two from 0 to 18 by heart. I don’t really need to go further, and if necessary, I can always calculate. In the meantime, remember at least until the 16th: = 20 1 = 21 2 = 22 4 = 23 8 = 24 16 = 25 32 = 26 64 = 27 128 = 28 256 = 29 512 = 210 1024 = 211 2048 = 212 4096 = 213 8192 = 214 16384 = 215 32768 = 216 65536 etc. Well now let's convert the 8-bit binary number to decimal. To do this, draw the following table:
In the top line of the table - multipliers by which you need to multiply the values of the digits. Take, for example, the number 10100111. Let's put it in the table:
Now we multiply the value of the digit by the multiplier of this digit and add the results: 1*128 + 0*64 + 1*32 + 0*16 + 0*8 + 1*4 + 1*2 + 1*1 = = 128 + 32 + 4 + 2 + 1 = 167. Oops! It turned out our dear number 167. Miracles! :) All! Transformed! Look what we ended up doing. As a result, we simply added the multipliers of those digits in which there were units. This conversion method is the easiest and simplest. And if in computer science lessons you were taught for a long time and to no avail to do a bunch of operations in a column - forget it. Everything is much easier! Transformation 10 ->2 Now we will do the same, but in the opposite direction. Let's take the same number 167 and look at it carefully. Looked? Now look at the table (or rather, remember) what is the largest power of two even less than this number. Obviously, this is 128. So, we draw the table again.
The multiplier of the most significant digit in it will be equal to 128. Further - 64, 32, etc ... In total - 8 digits. We immediately put 1 in the senior category. Further it will become clear why.
Now subtract 167 from 128. 167 - 128 = 39 Since 39 is less than the next factor (64), we write 0 in the next bit. Since nothing was taken away - the remainder is the same - 39. We look at the next factor: 32. It is less than 39, which means it can be taken away. We subtract, and put a unit in the discharge:
The remaining number is 7. It is clearly less than 16 or 8, so the next two digits will be 0:
Farther: 7 - 4 = 3 3 - 2 = 1 1 - 1 = 0
Note. In the end, we should get ZERO! If zero did not work out, then we screwed up somewhere. Publication: radiokot.ru See other articles Section Beginner radio amateur. Read and write useful comments on this article. Latest news of science and technology, new electronics: Traffic noise delays the growth of chicks
06.05.2024 Wireless speaker Samsung Music Frame HW-LS60D
06.05.2024 A New Way to Control and Manipulate Optical Signals
05.05.2024
Other interesting news: ▪ Production of hydrogen fuel from air ▪ Data transmission using fast neutrons News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the site Grounding and grounding. Selection of articles ▪ article The little mistress of the big house. Popular expression ▪ article Who managed to visit both a dwarf and a giant in his life? Detailed answer ▪ article Work on temostat. Standard instruction on labor protection ▪ article 1 + 1 is not always equal to two. Focus secret
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |