How does the code control the computer to run the program?

Author: Feng

Link:/question/20492284/answer/15279863

Source: Zhihu.

The copyright belongs to the author. Please contact the author for authorization for commercial reprinting, and please indicate the source for non-commercial reprinting.

How did I find that the person who got the most votes didn't really answer the question? ....

Here is my answer:

Say the code first:

We use the computer keyboard to input commands, and each command corresponds to an ASCII code, and the ASCII code here is the ordered voltage level (or whether there is current, just the voltage level below), that is, the input voltage level, and the code you see is the image displayed by these voltage-controlled monitors. In fact, the computer doesn't know what it is, only how to display it.

Conclusion: Code is actually the level of ordered voltage stored in memory (memory, hard disk or flash memory, etc.). ).

In addition to compiling:

Compilation is the conversion process from one ordered voltage level to another. Let's take 52 single chip microcomputer as an example. Our compilation is from the ordered voltage level representing ASCII code to another specified ordered voltage level that can be recognized by 52 single chip microcomputer, that is, the voltage level representing HEX file.

Conclusion: The compiled result is still the ordered voltage stored in the computer.

Burn to MCU:

The next two are burning, and it is easy to understand the following after understanding the above two points. Burning is to transmit the ordered voltage in the computer to the ROM in the single chip microcomputer through the data line.

Then, the ROM can release the voltage to control the peripheral circuits.

Summary: From the code editing to the final control of the circuit, voltage is at work, but it is different for us. Its essence is voltage, so there is no conversion.

There is no software in the world, software is only a reflection of hardware, just as consciousness is a reflection of the world!

I believe this is easy to understand.

I'm glad to see someone agree with me. I want to add one more point on this topic:

As long as 0/ 1 and software are mentioned, this problem cannot be understood ... because there is always an insurmountable gap between software and hardware including 0/ 1;

You said you wrote 0 in the microcontroller. How is 0 written? Knock a 0 on the keyboard? The actual level has nothing to do with the figures we understand. That 0 is just a representation of your level on the computer monitor. The so-called 0, in essence, is that the level can be transmitted to the ROM in the single chip microcomputer. There is no doubt about the level control level, so output a low level. ...

Please point out any mistakes.