How to burn or program PIC Microcontroller?

How to program or burn .HEX file to a PIC microcontroller? The method of transferring compiled .HEX (machine code) file to the memory of microcontroller using microcontroller burning software is called burning or programming of a microcontroller. Once a program is burned into the memory of the microcontroller, it then works with respect to the program logic.

What is a compiler? Which compiler is suitable for PIC microcontroller environment? A compiler is a software like ‘Mikro C’ which provides an environment to develop embedded program, test, debug and build .Hex for the microcontroller. And for the second question, surely I can say ‘Mikro C Pro’ is the best microcontroller software for PIC family. The advantage of ‘Mikro C’ is that it has so many inbuilt functions to perform different tasks along with microcontroller programming software (Boot loader- burning tool or burning software). It is the better Integrated Development Environment (IDE) for PIC family of microcontrollers and allows C language for code development. Finally the compiler converts the embedded C codes in to .HEX file.

Tools required to burn/ program a PIC Microcontroller

  1. PIC programmer (burner) or development board. If you don’t have the programmer, read how to build your own USB PIC programmer.
  2. Serial port cable (Latest laptops don’t have serial port, if you are using laptop you need a USB to serial port converter cable- costs about $5)
  3. Microcontroller burning software like Bootloader in ‘Mikro C

Burn PIC Microcontroller

  • Our aim is to transfer this .HEX file to the memory of PIC microcontroller.
  • To program a microcontroller you need a device called a burner/programmer and a software (Boot loader).
  • The burner and the dedicated software perform the function of transferring .HEX file into the PIC.
  • The burner is connected to the PC via a serial port cable. For laptops we use USB to serial port cable.
  • Mikro C’ has inbuilt ‘boot loader’ tool to burn your PIC microcontroller. Connect your PIC programmer to the PC and navigate to Tools>>mikroBootloader in Mikro C. Then a Bootloader window will appear.
  • You can see ‘Setup Port’ button on the right top corner. If you are using PC and serial port cable select ‘COM1’.
  • For laptop and USB to serial port cable you need to verify the port number via system Device manager. For this open Control panel>>Device manager and check the COM port number (eg: COM9) as shown in figure.
  •  Select the same port from the port setup window after setting the specific port and click the OK button.
  • Now click ‘Connect’ button, a message will appear in the ‘History window’ box with “Waiting PIC response; Disconnected”. Then you will have to ‘Reset‘ to get connected.
  • For that look at your development board or PIC burner and press the ‘Reset’ button of PIC. Then rapidly click the connect button in the mikroBootloader window. Now you will be able see “Connected” in the history window.
  • Now click ‘Open HEX file’ button and select the .HEX file that you had built in the folder (project directory) before.
  • Then click ‘Start Bootloader’ button to burn the PIC microcontroller. You will be able to see the burning process via the ‘Terminal window’.
  • After the burning process a message box will appear saying “Reset PIC”. Click OK and now you are  finished with the PIC microcontroller burning…!
Was this tutorial helpful to you? Let us know through the comment box below.

Related PIC articles

26 thoughts on “How to burn or program PIC Microcontroller?

  1. I know Mikro C programming but don't know the burning tool 'mikroBootloader' is new to me, Thanks. This article is easy to understand

  2. Hi good day!
    I'm thankful for this article and I'm waiting for more…
    btw, can you teach to build my own pic programmer…
    I'm hoping for your reply
    thanks a lot bro.

    • Hi Zack,

      In response to your request,we have published an article on how to build your own pic programmer. See How to build your Own USB Pic programmer?

  3. Hi i try to connect the programmer with USB converter but no response the programmer like JDM or which type of programmer with the micro C loader

  4. hello sir, may i ask u about if i just use the bootloader provided by cytron (PICkit) for burning program into PIC with your PIC USB programming circuit . is that the circuit provided by u could run using PICkit Software (cytron)??

    thank you sir.

  5. I very much enjoyed your design and information! I am looking forward to building the circuit! I will need to modify the circuit a little for the PIC16F1825 & PIC16F1829 since they use a lower programming voltage of about 8.4 volts. Can you tell me if you basic circuit will work for the chips I will use?

    Thank You again! And Keep up the good work!

    Mike Arquilla N8SD

  6. sir i want to know once the hex file is successfully loaded inside pic will the pic start the execution of the program itself or some command needs to be given to initiate the execution

  7. Hi , If i want to use software in production line that should be produce 100 part in 1 hour .
    please help me and advice.

  8. Sir as you said that i had to reset our pic burner for connection but i have not such reset button in my burner and thatswhy i am not able to connect my pic burner with PC kindly tell me what should i do??

  9. Hi,
    MikroC is too cost, as I am a beginner and a hobby activist. Any other free softwares, can be replaced in the place of MikroC.

  10. Hi All,

    I am working on PIC18f series and i want to download my Application in program memory via inbuilt CAN Controller.
    My question is?
    1. Is there any inbuilt bootloder?
    2. Is there any tools like converter to download my application file into the program memory. without using bootloader?
    3. Or, is there available on CAN bootloader at microchip?

    Siva J

Leave a Reply

Your email address will not be published. Required fields are marked *