What are the general types of programming languages for microcontrollers
There are three types of programming languages for microcontrollers: machine language, assembly language and high-level language.
Machine language is a language that a computer can understand. (In the form of a piece of binary code)
Assembly language is a low-level language used in electronic computers, microprocessors, microcontrollers, or other programmable devices, and is also known as symbolic language. In assembly language, mnemonics are used in place of opcodes for machine instructions, and address symbols or labels are used in place of addresses for instructions or operands.
High-level languages include: C language, BASIC language and PL\M language. (Nowadays, C language is generally used for microcontroller programming, and other languages are used less frequently for microcontroller programming)
5. Since computers can only read machine language, both assembly language and high-level language need to be compiled into machine language before they can be executed.
High-Level Languages for Microcontrollers
The 51 microcontroller supports three high-level languages, PL/M, C, and BASIC.C is a general-purpose programming language with a high coding rate, a rich variety of data types and operators, and a good program structure that is suitable for the program design of a wide variety of applications, and it is the more widely used microcontroller Programming language.
Microcontroller C language using the C51 compiler (C51 for short). There are C51 generated target code short, high operating speed, the required storage space is small, in line with the ANSI standard of the C language, the generated code follows the Intel target file format, and can be mixed with the A51 assembly language or PL/M51 language target code
Microcontroller programming language in general which kinds of
Microcontroller programming language is a lot, roughly divided into three categories: machine language, assembly language, high-level language. Machine language is no longer used by most users because it is cumbersome and prone to errors.
1. Assembly language for microcontrollers
Assembly language is a symbolic language that uses textual mnemonics to represent machine instructions, and is the closest language to machine code. Its main advantage is that it occupies less resources, the program execution efficiency is high, because it corresponds to one machine code for one instruction, the execution action of each step is very clear, and the program size and stack call situation are easy to control, debugging is also more convenient. However, the assembly language of different types of microcontrollers may be a bit different, so it is not easy to port because their instruction systems are different. However, knowing assembly language can help to understand the special provisions that affect the efficiency of Kaweco language. For example, knowledge of assembly language instructions can be used to the advantage of using on-chip ram for variables, since off-chip variables require several instructions to set up accumulators and data pointers for access. Similarly, when required to use floating-point numbers and enable functions, only assembly programming experience can prevent the generation of large, inefficient programs, for which programming cannot be done without assembly language.
2. Microcontroller C language
Microcontroller C language is a compiled programming language, it takes into account the characteristics of a variety of high-level languages, and has the function of assembly language, C language has a feature-rich library function, operation adman grinding fast, high compilation efficiency, good portability, but also to realize the direct control of the system hardware. In addition, C language program has a complete program module structure, which provides a strong guarantee for the modular programming method in software development. Compared with the assembly, there are the following advantages:
The instruction system of the microcontroller does not require understanding, only requires a preliminary understanding of the memory structure of the 51, as for the allocation of registers, addressing of different memories and data types and other details are managed by the compiler. Programs have a standardized structure and can be divided into different functions. This approach allows programs to be structured in such a way that variable choices and special operations can be combined to improve program readability.
Programming and program debugging time is significantly reduced, resulting in increased efficiency. The supplied libraries contain many standard subroutines with strong data handling capabilities, and can be easily integrated into new programs because of its convenient modular programming technology.
Strong and flexible functionality, the provided library contains many standard subroutines with strong data processing capabilities, and can be easily inserted into new programs because of its convenient modular programming technology.
Microcontroller C language as a very convenient language and widely supported, (the language program itself does not depend on the machine hardware system, basically no modification can be based on the microcontroller over U are different faster to port over.
Programming with microcontroller c language, has become a mainstream of microcontroller software development, as a full range of technologies and involved in the development of larger-scale software systems, microcontroller developers should be able to master the basic C language programming.
Microcontroller, known as Single-Chip Microcomputer (English: Single-ChipMicrocomputer), also known as microcontroller (Microcontroller), is the central processor, memory, timing/counter (Timer/Counter), a variety of input and output interfaces are integrated. Input/output interfaces are integrated on an integrated circuit chip microcomputer. Compared with the general-purpose microprocessor applied in personal computers, it emphasizes more on self-supply (without external hardware) and cost saving. Its biggest advantage is that it is small enough to be placed inside the instrument, but has a small storage capacity, simple input/output interfaces, and low functionality. Because of its very rapid development, the old definition of a single-chip microcontroller can not be satisfied, so in many applications is known as a wider range of microcontrollers; due to the single chip microcomputer is commonly used when the controller is also known as singlechipmicrocontroller, but at present in mainland China is still more along the line of “single-chip microcomputer “
Single chip microcontrollers are often used as controllers.
What language is used to write programs for microcontrollers
Generally C or assembly language.
1. For the most part, the programs that a microcontroller runs are written in C. Not pure traditional C though, but a variant, C51.
Microcontroller C51 language is inherited from the C language. Unlike C, which runs on a microcontroller platform, C51 runs on a common desktop platform.C51 has the advantage of a clear C structure, which is easy to learn, as well as the hardware manipulation capabilities of assembly language. For engineers with a C programming foundation, they can easily master the program design of microcontroller C51 language.
2, assembly language:
Assembly language (assemblylanguage) is a low-level language for electronic computers, microprocessors, microcontrollers or other programmable devices, also known as symbolic language. In assembly language, mnemonics are used to replace the opcodes of machine instructions, and address symbols (Symbol) or labels (Label) are used to replace the addresses of instructions or operands. In different devices, assembly language corresponds to different sets of machine language instructions, which are converted into machine instructions through the assembly process. Generally speaking, a specific assembly language and a specific machine language instruction set are one-to-one correspondence, and are not directly portable between different platforms.
Assembly language is not as widely used for programming as most other programming languages. In today’s real-world applications, it is typically used in under-the-hood, hardware manipulation and demanding program optimization situations. Drivers, embedded operating systems and real-time running programs all require assembly language.
In some cases, C51 is not perfectly functional, so assembly language is an important complement to C51. Generally speaking, the startup part (initialization of the basic hardware), is often done by assembly language. In addition to this, some of the requirements of the timeliness is particularly strong, when the efficiency requirements are particularly high, also need to use assembly language to complete.
What language is used to write programs for microcontrollers?
Microcontrollers generally use C or assembly language to write programs.
It is recommended to learn C first, assembly language to count the address, assembly language is more difficult, so it is recommended to learn C first. Assembly language to count the address, in most cases, the microcontroller runs the program, are written in C language. But not in the general sense of the C language, but a variant of the C51 language.
Microcontroller is a typical embedded microcontroller (MicrocontrollerUnit), by the operator, controller, memory, input and output devices, etc., equivalent to a miniature computer. Compared with the general-purpose microprocessors applied in personal computers, it emphasizes more on self-supply (without external hardware) and cost saving.
What languages are mostly used for programming in microcontrollers?
I. Programming in the language used
The general contact is assembly and C. But there are other optional items, such as AVR microcontroller can use BASIC; ARM9, ARM11 and other high-end with C++.
Two, what is assembly
Assembly mostly refers to assembly language, assembly program. The process of translating assembly language into machine language is called assembly. In assembly language, the operands are replaced by mnemonics (Memoni) and the address symbols (Symbol) or labels (Label) are used instead of address codes. By replacing the binary code of the machine language with symbols, the machine language is turned into an assembly language. Thus assembly language is also called symbolic language. Programs written in assembly language, the machine can not be recognized directly, by a program to translate the assembly language into machine language, the role of this translation program is called assembly program, assembly program is the system software in the language processing system software.
Three, what is the c language
C language is a general-purpose computer programming language, widely used. c language design goal is to provide a can be compiled in an easy way, deal with low-level memory, produce a small amount of machine code, and do not need any runtime environment support can run the programming language. Although C provides many low-level processing features, it remains very cross-platform, and C programs written to a standard specification can be compiled on a wide range of computer platforms, including even some embedded processors (microcontrollers, or MCUs) and operating platforms such as supercomputers.
C is a powerful and portable graphics language with strong data processing capabilities, making it suitable for writing systems software, three-dimensional, two-dimensional graphics and animation. It is a high-level language for numerical computation.
Commonly used compiler software are MicrosoftVisualC++, BorlandC++, gcc (the most commonly used compiler under linux), WatcomC++, BorlandC++, BorlandC++Builder, BorlandC++3.1forDOS, WatcomC++11.0forDOS, WatcomC++11.0forDOS, WatcomC++11.0forDOS, WatcomC++11.0forDOS, WatcomC++11.0forDOS, WatcomC++11.0forDOS, WatcomC++11.0forDOS, WatcomC++11.1forDOS. WatcomC++11.0forDOS,GNUDJGPPC++,Lccwin32CCompiler3.1,MicrosoftC,HighC and so on.