Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Real Time Embedded System Lab Department of Electrical & Computer Engineering

Lab 01: Introduction to Software Tools MPLAB, PROTEUS and


PIC18F4520
Task 01:
 Installing MPLAB and Xc8 compiler
 Installing Proteus

MPLAB X IDE Installation:

1. Download MPLAB® X IDE Installer

2. Run the Installer


Go to the location where you downloaded the installer. Unzip the downloaded file and run the
installer:
MPLABX-vX.XX-windows-installer.exe.

3. Setup
Click Next >.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

4. License Agreement
Click the I accept the agreement radio button.
Click Next >.

5. Installation Options
After selecting the desired Installation Location Click Next>.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

6. Select Application
If you only want to install MPLAB X IDE or MPLAB IPE, check or uncheck the appropriate
boxes. Generally, you should install both programs.
Click Next>.

7. Installing
Wait until the installer has finished installing all components of the IDE.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

8. Permit Device Driver Installation


The USB device drivers are required to communicate with Microchip's hardware development
tools.
Check the Always trust software from Microchip Technology box to prevent this dialog from
appearing in the future.

9. Finishing Installation
Leave the box checked if you want to have your web browser opened to the Microchip
MPLAB XC compiler download page to download a compiler for use with MPLAB X
IDE.
Uncheck the box if you already have a compiler or want to download one later.
Click Finish.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

MPLAB Xc8 C Compiler Installation:


1. Download MPLAB® Xc8 Installer

2. Run the Installer


Go to the location where you downloaded the installer. Unzip the downloaded file and run the
installer:
xc8-vX.XX-windows-installer.exe.

3. Setup
Click Next >.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

4. License Agreement
Click the I accept the agreement radio button.
Click Next >.

5. Installation Options
After selecting the desired Installation Location Click Next>.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

6. Finishing Installation
Click Finish.

Proteus 8 Professional Installation:


1. Open Proteus Setup File
Click Next>.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

2. License Agreement
Click the I accept the agreement radio button.
Click Next >.

3. Setup Type
Click on Use a locally installed license key
Click Next >.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

4. Choose the Installation Type


Click on Typical Block

5. Installation Progress

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

6. Finishing Installation
Click on Proteus 8 Professional Block to finish installation and run the Application.

Registration No: FA19-BSEE-040


Real Time Embedded System Lab Department of Electrical & Computer Engineering

Lab 02- How to blink an LED with PIC18F4520 Microcontroller


Task 01: Now let’s move towards our in-lab work. Make start our MPLAB first coding program
how to blink a led with XC8 compiler. And see the output on implementing the circuit on Proteus.
C Code:
#define _XTAL_FREQ 8000000
#include <xc.h>
#include <p18f4520.h>
// BEGIN CONFIG
#pragma config OSC=HS
#pragma config PWRT=OFF
#pragma config WDT=OFF
#pragma config DEBUG=OFF,LVP=OFF
void delay(int);
int n;
void main(void)
{
TRISDbits.TRISD0=0;
while(1)
{
LATDbits.LATD0=1; delay(25);
LATDbits.LATD0=0;
delay(25);
} return; }
void delay(int n)
{
for (int i=0 ; i<n ; i++)
{
for (int j=0 ; j<250 ; j++);
}
}
Output:

Registration No: FA19-BSEE-040

You might also like