The programming language and development environment of single chip microcomputer

In "embedded programming of the basic structure of the microcontroller, working principle" and "embedded peripheral circuit of embedded programming microcontroller" we introduced the knowledge of the microcontroller hardware. This article will introduce the development environment and programming language of the microcontroller.

CPU language language

The CPU of the microcontroller reads the program from the memory, but can only read one instruction at a time, then interpret each instruction and execute it. The contents stored in the memory, whether it is a program or data, are strings of binary codes "0" and "1". The instruction binary code tells the CPU what to do, and the data binary code 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. These "0" and "1" strings arranged like passwords are machine languages. 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 the instruction code in the order of the memory address unless a jump instruction is encountered. For example, if the address after reset is 0000, the instructions are read and executed in the order of 0001, 0002, and 0003 from 0000. It can also be said that a program is to arrange a series of machine languages ​​according to processing requirements.

The CPU can only understand the machine language as described above. Therefore, in order for the CPU to run, it is necessary to use a machine language program. However, machine language is not easy to recognize and read and write. Therefore, people use a simpler and easier to understand string instead of machine language, which is assembly language. For example, in the case of "assigning register A to value 2", if it is expressed in assembly language, it is very simple, see the right part of Figure 1. In assembly language, the assignment is represented by a MOV string, 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

Figure 1: Comparison of machine language and assembly language

Although assembly language is much simpler and easier to understand than machine language, it is still difficult to understand. Moreover, there is another problem with assembly language, that is, different CPUs, machine language descriptions are also different. Therefore, if the CPU is replaced, it is necessary to rewrite the assembly language that is inseparable from the machine language, and the workload is relatively large. (The machine language and assembly language in the above examples are the languages ​​in Renesas' RL78 family of microcontrollers.)

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

Humanized C language

The programming language that solves the above problems is the C language. The C language has the characteristics of not depending on the specific CPU and high program portability. In addition, C is the easiest programming language for programmers because of the familiar English words that can be used for programming. Below we make a simple comparison between C and assembly language. (figure 2)

Figure 2: Comparison of assembly language and C language

Figure 2: Comparison of assembly language and C language

Although the C language does not depend on the CPU and is the easiest programming language for people, the C language is a completely incomprehensible language for the CPU. Therefore, there is a need for software that can translate the C language into a machine language, which is called a compiler (compiler). The file format of a 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 adopted a structure in which one program is divided into a plurality of C language program files. Therefore, a tool is also needed to aggregate multiple object file formats into one machine language and configure them on the memory. The main thing that can do this is the link editor (also called "linker").

A debugger that can find bugs in the program

Applications that are programmed by people will inevitably have bugs. The tools used to discover and help people fix bugs are called debuggers. The following is a brief introduction to the type of debugger.

In-Circuit Emulator (IC): ICE can replace the actual single-chip microcomputer, and connect with the simulation-specific evaluation single-chip (evaluaTIon chip, evaluation chip) and debug. Among them, "In-Circuit Emulator" is a registered trademark of Intel Corporation of the United States, and Renesas named it "Full-spec Emulators" and provided it to the market.

J-TAG emulator: The J-TAG emulator uses the debug circuitry reserved in advance in the microcontroller for debugging. That is to say, through the actual use of the microcontroller to debug. Compared to ICE, the price of the J-TAG emulator is lower. Renesas named it "On-chip Debug Emulator" and made it available to the market.

Simple emulator: The simple emulator is to make the monitoring program for debugging run on the MCU and debug while communicating with the PC. In addition to the program to debug the object, other monitors need to be started, so the simple emulator program runs slower and has various functional limitations compared to the ICE or J-TAG emulator. Its biggest advantage is that the price is very low.

Integrated development environment

As mentioned above, in the software development of the single chip microcomputer, various tools such as the above compiler, connection editing program, and debugger are used. Previously, these softwares were provided separately as a single piece of software, typically by calling up a program through a command prompt or by using a batch program. However, it has recently been offered in the form of a comprehensive development environment. The integrated development environment integrates various programs into one package, and the program can be easily called out by using Renesas CS+ or the like.

For example, Renesas provides a comprehensive development environment for “RL+” of “simple”, “fast” and “safe” for RL78 products. In a comprehensive development environment, you can take advantage of a variety of functions with a simple operation. Therefore, a comprehensive development environment is best suited to improve the efficiency of software development.

* Released on October 1, 2014, the product name of the Renesas Electronics Integrated Development Environment CubeSuite+ has been changed from V3.00.00 to "C++".

KNB6-40 Miniature Circuit Breaker

KNB6-40 Mini Circuit breakers, also named as the air switch which have a short for arc extinguishing device. It is a switch role, and also is a automatic protection of low-voltage electrical distribution. Its role is equivalent to the combination of switch. Fuse. Thermal Relay and other electrical components. It mainly used for short circuit and overload protection. Generally, According to the poles, mini Circuit breaker can be divided into 1P , 1P+N , 2P, 3P and 4P.


KNB6-40 Miniature Circuit Breaker,Electronics Miniature Circuits Breaker,Automatic Miniature Circuit Breaker,Mini Circuit Breaker

Wenzhou Korlen Electric Appliances Co., Ltd. , https://www.zjaccontactor.com