PIC can do various operation by executing the instructions which were stored in the program memory(PM). The instruction which is stored at the head(0000h) of PM is executed when turning on the power. If GOTO instruction is stored there, the PIC changes the execution address of the program according to the contents of the instruction. To make software is to make the order of the operation to make PIC do. Therefore, it is necessary to decide what operation you want to make the PIC. For example, it makes an LED blink, it makes judge the condition of the input or it lets out a specific signal... To think of the order of the instruction is software creating. I will explain the following example for you to understand software creating easily.
(Only in this processing, it is empty but it is simple example.)
In the actual program, the initialization processing is necessary. However, in the example this time, it is omitted.
The PIC does following operation when writing contents like the above in the 3 words from the head of the PM and turning on the power. First, the 0Ch address of the file register is cleared in address 0 of PM and count-up in address 1 of PM. Next, the GOTO instruction is executed in address 2 and jumps to address 1. Then, it repeats the operation to count-up again. This processing doesn't end until it switches off the power. PIC recognizes the combination of "0" and "1" which was written in the PM as the instruction. The instruction which was expressed by the combination of "0" and "1" is called machine code. At the digital computer, machine code is always used. Machine code is used for the personal computer which you are using, too. However, the contents of the machine code depend on the processor. Therefore, the Pentium doesn't work by the machine code for PIC. I did contents above by the hand computation. However, it is difficult to do in the hand computation when the number of the processing(Step) increases. Therefore, the soft development tool which is called the assembler or the compiler is used for the software creating. These tools are the one to make it easy for the person to make software. The instruction can be expressed by the character. It is possible to use a character string(Label) when specifying the address of the memory. So on. Also, when working the same software in the hardware which the machine code is different from, it is sometimes possible if changing only machine code. In the such case, because the assembler or the compiler changes into the machine code which suited the hardware automatically, the person has the advantage that he can make software without being conscious of the machine code, too. It is as follows when changing above-mentioned processing into the machine code automatically using MPASM(Assembler) of the Microchip Inc.. The input file for the assembler(Source code) is made with Editor. The person makes this source code. This work is called CODEING.
|