The microcontroller does not understand high-level programming languages as this and therefore 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 the .hex extension. It is actually the same program, just compiled into machine language which the microcontroller understands perfectly. This program is called a HEX code and forms a seemingly meaningless sequence of hexadecimal numbers. When compiled, the program should be loaded into the microcontroller by means of appropriate hardware, i.e. programmer.
To enable the program 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 process of programming is basically the same for all of them and looks as follows:
Place the microcontroller into appropriate programmer’s socket;
Use appropriate cable to connect the programmer to a PC;
Open the hex code within the programmer’s software, set a few parameters and click the appropriate icon to transfer the code. After a few seconds, a sequence of zeros and ones is to be loaded into the microcontroller.
All that’s left is to install the programmed microcontroller into the target device. If you want to make some changes in the program, the previous procedure may be repeated an unlimited number of times.