Learning Development Environment and Programming Language: A Comparison of Assembly Language and C Language

Learn development environments and programming languages ​​today.

CPU-aware machine language

The CPU of the microcontroller reads the program from memory, but can only read one instruction at a time, then interpret each instruction and execute it. The content stored in memory, whether it is a program or data, is a string of binary codes "0" and "1." The instruction binary tells the CPU what to do, and the data binary is the value to be used when the CPU operates or processes the instruction. The operation of the CPU includes instructions such as addition and subtraction operations. These "0" and "1" strings arranged like a password are machine language. For example, the left side of Figure 1 shows a machine language instruction, which means "put 2 into register A (the register is the storage area inside the CPU).

The CPU always reads instruction code in the order of memory addresses unless a jump instruction is encountered. For example, if the reset address is 0000, instructions are read and executed starting from 0000 in the order of 0001, 0002, and 0003. It can also be said that a program is to arrange a series of machine languages ​​according to the processing requirements.

The CPU can only understand the machine language as described above. Therefore, in order for the CPU to operate, it is necessary to use a machine language program. However, machine language is not easy for people to identify and read and write. Therefore, people use a more simple and easy-to-understand string instead of machine language. This is assembly language. For example, in the process of "Assigning register A to 2", if it is represented in assembly language, it is very simple. Please see the right part of FIG. In assembly language, assignments are expressed using MOV strings, so the process of “assigning 2 to register A” can be represented by “MOV A, #02”.

Figure 1: Comparison of machine language and assembly language

Although assembly language is easier and more understandable than machine language, people still find it difficult to read. Moreover, there is another problem with assembly language, that is, different CPU, machine language description is also different. Therefore, if you replace the CPU, you must rewrite the assembly language that is inextricably linked to the machine language, and the workload is relatively large. (The machine language and assembly language in the above example are all languages ​​in Renesas's RL78 family of microcontrollers.)

As mentioned above, every time the CPU is replaced, the program must be adapted. This not only results in low productivity, but also burdens the programmer.

Humanized C language

The programming language that can solve this problem is C language. C language has the characteristics of not relying on a specific CPU, but also has high program portability. In addition, the C language is the easiest programming language for programmers because it can use familiar English words. Below we will make a simple comparison between C language and assembly language.

Figure 2: Comparison of assembly language and C language

Although the C language is not dependent on the CPU and is the most easily used programming language, for the CPU, the C language is a totally unintelligible language. Therefore, there is a need for software that can translate C language into machine language. This is software called compiler (compiler). The file format of the program translated by the compiler is called the target file format. If the target file format is not finally configured into memory, the CPU cannot execute the program.

In addition, recently, as programs have become more and more complicated, almost all have taken a structure of dividing a program into a plurality of C language program files. Therefore, there is also a need for a tool to aggregate a plurality of object file formats into a machine language and configure them into a memory. A link editor (also referred to as a "linker") can perform this task.

CAT6 Surface Mount Box

Our Surface Mount Box could include the CAT5E CAT6 CAT6A RJ45 Connectors

The surface mount box is an ideal for wall box and wire installation, we design many junction box, back mount box, blank mount box, loaded surface mount box.

Mateiral: ABS, PBT UL94V-0

1~8 ports and colors supply for your choice, they are an ideal for low voltage application for your security, data, networking solutions and telecom projects.

CAT6 Surface Mount Box,Category 6 surface mount box,cat6 surface mount jack,cat6 wall mount box

NINGBO UONICORE ELECTRONICS CO., LTD , https://www.uonicore.com