MP Lab Report # 1
MP Lab Report # 1
LAB ASSESSMENT:
Data presentation
Experimental results
Conclusion
Date: Signature:
Lab 1
. Introduction to MikroC PRO for PIC
Objectives:
Install the MikroC Pro 6.4.0
Start up the mikroC PRO for PIC
Create A New Project
Make Schematic on Proteus and burn your hex file in PIC18F452
Hardware:
PIC18F452 microcontroller
Led Bar graph
Resistors
Introduction:
Install the compiler:
Install this software“mikroC_PRO_PIC_2014_6.4.0”
Launch the application” keygen” and then a black window will appear after waiting for 1 or 2
seconds you are done with it.
1. Main Toolbar
2. Code Explorer
3. Project Settings
4. Messages
5. Code Editor
6. Image Preview
7. Project Manger
8. Library Manager
Procedure:
Creating a New Project:
Step1: The process of creating a new project is very simple. Select the New Project option from
the Project menu as shown below. The New Project Wizard window appears. It can also be
opened by clicking the New Project icon from the Project toolbar.
Step2: Rename the project then select the directory in which you want to save your project.
Select the device for which you want to write code here I am using “PIC18f452” and then choose
the xtal oscillators value.
Click Next.
Step3: This step allows you to include additional files that you need in your project: some
headers or source files that you already wrote, and that you might need in further development.
Since we are building a simple application, we won’t be adding any files at this moment.
So just Click Next
Step4: Following step allows you to quickly set whether you want to include all libraries in your
project, or not. Even if all libraries are included, they will not consume any memory unless they
are explicitly used from within your code. The main advantage of including all libraries is that
you will have over 500 functions available for use in your code right away, and visible from
Code Assistant [CTRL+Space]. We will leave this in default configuration:
Step6: In this Step you will write a code for “LED Blinking”.
Write code as shown below and Build it
Step8: Debugging, you can add or remove registers or variables in watch window to observe
them step by step to verify your logic (as this step is not necessary)
Make Schematic in Proteus:
Make schematic shown below
Double click on pic18f452 and specify path for program hex file.
Click on play button, if you followed all the steps in correct way then blinking will be started.
You can add registers in watch window in proteus for the purpose of debugging Debug>>Watch
Window
Lab Task1:
Define Port D an input Port and Port B an Output Port. Connect led bar graph to observe output
and connect switches on Port D then write data from PortD to PortB (For writing purpose SFR
“Latx” will be being used and for reading purpose Portx will be used).
CODE:
void main() {
}}
Schematic: