A microcontroller is a good-natured ‘genie in the bottle’ and no extra knowledge is required to use it. In order to create a device controlled by the microcontroller, it is necessary to provide a PC, a program for compiling and a simple device to transfer code from the PC to the microcontroller itself. Even though this process is quite logical, there are often some dilemmas, not because it is complicated, but for numerous variations. Let’s take a look.
Specialized Windows programs (compilers) are used for writing a programs for microcontrollers. One of them called mikroBasic PRO for PIC is described herein. The main advantage of this program is that it features many additional tools installed to aid in the development process.
If you have ever written a program then you know that the point is to write all instructions in such an order they should be executed by the microcontroller and observe the program rules. In other words, the program you are writing just has to adhere to your idea. That’s all!

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.

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:
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.
This section briefly describes the way of using the mikroBasic PRO for PIC compiler and PICflash programmer software. It’s very simple...
You have already installed the compiler, haven’t you? Start it up, open a new project and a new document with the .mbas extension within it. Write your program...

OK. The program has been written and tested by means of the simulator. No errors have been reported during the process of compiling into the HEX code? It seems that everything is under control...
Yes, the program has been successfully compiled. All that’s left to do is load it into the microcontroller. Now you need the PICflash programmer (consisting of software and hardware). Start up the PICflash program.
All the settings are easily performed and there is no need for additional explanations (the type of the microcontroller, frequency of clock oscillator etc.). Now, the final step:

That’s it! The microcontroller is programmed and everything is ready for its operation. If you are not satisfied, make some changes in the program and repeat the procedure. Until when? Until you are satisfied...
A device, which in the testing program phase can simulate any device is called a development system. In addition to the programmer's hardware, the power supply unit and the microcontroller’s socket, the development system is also provided with on-board components for input pin activation and output pin monitoring. The simplest development systems have every pin connected to one push button and one LED. High quality versions have pins connected to LED displays, LCD displays, temperature sensors and all other components that can be found on the target device the program is written for.
If needed, all these peripheral modules can be connected to the microcontroller using jumpers. This enables the whole program to be tested in practice even during its development stage, because the microcontroller doesn’t know or care whether its input is activated by a push button or a sensor built into a true device. Concerning that the compiler (on your PC) and the programmer's hardware (on your development system) cooperate perfectly, the process of compiling a program and programming the microcontroller is performed in a single step - by clicking the appropriate icon within the compiler. Now, any change in the program will immediately affect the operation of the appropriate on-board components.
It’s time for fun?