A.2 Program Compilation
The microcontroller does not understand higher programming languages as such, so that it is necessary to compile the program into machine language. A single click on the appropriate icon within the compiler results in creating a new document with .hex. It is actually the same program, only compiled into machine language which the microcontroller perfectly understands. Such a program is usually called ahex code and forms a seemingly meaningless sequence of hexadecimal numbers. When compiled, the program should be loaded into the chip. And you need appropriate hardware to make this happen. In other words, you need a programmer.
As mentioned, to enable a
hex code to be loaded into the microcontroller it is necessary to provide a special device, called the programmer, with appropriate software. A large number of programs and electronic circuits used for this purpose can be found on the Internet. The procedure is basically the same for all of them and looks as follows:
- Place the microcontroller in appropriate programmer’s socket;
- Use an adequate cable to connect the programmer to a PC;
- Open hex code document within the programmer’s software, set a few parameters and click the icon to transfer the code. After a few seconds, a sequence of zeros and ones is to be programmed into the microcontroller.
All that’s left is to install the programmed chip into the target device. If it is necessary to make some changes in the program, the previous procedure may be repeated an unlimited number of times.