The brain-single chip microcontroller (2) has described several main components of the microcontroller, which constitutes the hardware of the microcontroller. The so-called hardware is to see and touch the entity. However, there is such hardware, but it is only the possibility of implementing calculation and control functions. Single chip tools must truly calculate and control, and must have a software (Software). Software mainly refers to a variety of procedures. It can work effectively only if the various correct programs are "incominated" (deposit) single chip. Single chip microcomputer can automatically operate and control, it is because people put the steps of implementing calculation and control step by step, ie, one item instruction (INSTRUCTION) is pre-deposited into the memory, and the microcontroller is controlled by the CPU. Under, a piece of instruction is taken out and translated and executed. In addition, two numbers plus this simple operation, when the number of calculations have been stored in the memory, the following steps are needed: Step 1: Put the first number from its storage unit Take it out and send it to the operator. Step 2: Take the second number from its storage unit, send it to the operator; step 3: add; step 4: Add the result, send to the memory Unit. All of these, send numbers, add, depumeal, etc. are all operations, we write down the various operational commands that require computers to execute, which is instructions. But how can I identify and implement these operations? This is determined by the designer's instruction system given by the designer when designing the microcontroller. One instruction corresponds to a basic operation; all instructions that the single chip can perform, is the IUSTRUCTION SET, different types of microcontrollers, and its instruction system is also different. When using a single-chip microcomputer, the problem to be solved in advance should be completed into a series of instructions. These instructions must be instructions that the selected single-chip function can identify and execute. Single-chip users are called Source Program for solving their own problems. The instructions are usually divided into two parts: OPCODE and Operands. The operation code indicates what operations do, the function of the instruction; the operand represents the address of the number or operand of the operation (i.e., the number of operands stored). Because the microcontroller is a programmable device, only "recognize" binary (0, 1). To operate a single-chip microcomputer, all instructions in the microcontroller system must be represented in the form of binary coding. For example, in Intel's MCS-51 series single-chip microcomputer, the instruction code from the accumulator (in the computer, participating in the calculation, deployment of calculation results) from the memory is 74h, accumulated The code of the content plus the number of times is 24h, plus the immediate number of code, the accumulator sent to the internal RAM memory is F6H ~ F7H, etc. These instructions are a binary machine code with hexadecimal representation. The word length of the MCS-51 single-chip microcomputer is 8 bits, sometimes, to complete some of the one byte, one byte is still not fully expressed. Therefore, there is a single byte instruction in the instruction system, there are also multi-byte instructions. The machine code is made up of a series of 0 and 1, no obvious characteristics, not good memory, not easy to understand, easy to go wrong. So, use it directly to write the program is very difficult.
Thus, people use some mull moncine - usually instead of the opcode, such as the operation code, such as the transfer of MOV (Move abbreviation), add (Addition's abbreviation ) Comes as a mission. In this way, each instruction has a significant action feature, easy to memorize and understand, and it is not easy to make mistakes. The program written by the assistance is called the assembly language program. However, the procedures prepared by the help letter are for people to understand, but the microcontroller only knows the binary machine code. Therefore, in order to allow the single-chip function "Read" assembly language program must be converted to a program consisting of binary machine code, this conversion process It is called "assembly". Compilation can be achieved by means of artificial investment form, or by means of a so-called "cross assembler" by means of the PC. User program consisting of machine code Once "enters" the microcontroller, "Start" the microcontroller, allow it to perform the tasks specified by the input program.