How to write embedded C project in Mikro C to build .HEX file
Are you an electronics hobbyist? I will help you to write your first embedded C program. ‘Mikro C pro’ is one of the popular embedded C software for PIC microcontroller. It is more user-friendly and has a set of inbuilt functions and commands. After compiling a microcontroller program in C using ‘Mikro C pro’,you will be able to generate .HEX files from the program codes.What is .HEX file? .HEX file is a machine code that corresponds to our C language codes. Only microcontroller and microprocessor can interpret the .HEX files. After building a .HEX file, you need to write the .HEX file to the memory of micro controller. This process is called burning of microcontroller.
This article will give you an idea about getting started with ‘Mikro C’ programming for microcontrollers and how to build .HEX files.
Steps to create a PIC microcontroller project in ‘Mikro C’ (Getting started programming for microcontrollers)
- Open ‘Mikro C pro’.
- Navigate to Project>>New Project.
- ‘Welcome to the New Project Wizard’ window will appear. Click the Nextbutton.
- Choose your PIC from the drop down menu, different types of PIC microcontrollers are available. We are using PIC16F877A, then click Next.
- You will be asked to set up the device clock frequency. Look into the crystal oscillator in your PIC development board where the frequency is marked in MHz. (eg: 4.00=4MHz) Give the clock frequency and click Next.
- Now choose any folder (project location directory) to save the project by clicking the Browse button as shown below.
- Put a name to the project and click Save, then Next button.
- Now you can see ‘Add file to project’ window, right now there is no work for you just click Next button.
- Now you have successfully created the new project, click the Finish button.
For more detail: How to write embedded C project in Mikro C to build .HEX file