Lab 1-4 - Reports
Lab 1-4 - Reports
CLO 1: Imitate different assembly language programs on MPLABX IDE and PROTEUS to
apply various commands. (Level: P-2)
CLO 2: Develop PIC microcontroller-based programs to interface LCD, keyboard and stepper
motors with PIC. (Level: P-4)
CLO 3: Design microcontroller-based project for practical applications. (Level P-5)
Mapping of Course Learning Outcomes (CLO) to Program Learning Outcomes (PLO) / Graduate
Attribute
Course CLOs/ PLO1 PLO2 PLO3 PLO4 PLO5 PLO6 PLO7 PLO8 PLO9 PLO 10 PLO 11 PLO 12
Code PLOs
CLO 1 x
CLO 2 x
EE-342
CLO 3 x
List of Experiments
Sr. NO. Title Level of Inquiry CLO
A. Familiarization with MPLABX Compiler 0 1
Experiment 1
B. Familiarization with Proteous VSM
Simulator
Experiment 2 Introduction to Computer Architecture and LED 0 1
Interfacing using Arduino and PIC
Experiment 3 Interfacing LEDs with Arduino and PIC 0 1
microcontroller
Experiment 4 Branching statements in Arduino, PIC18 1 1
Microcontroller
Experiment 5 1 1
Time delay in Arduino and PIC microcontroller
Experiment 6 Perform arithmetic instructions inn in Arduino and 1 1
PIC microcontroller
Experiment 7 Logic/compare instructions and addressing modes in 1 1
Arduino, PIC microcontroller
Experiment 8 Hardware experimentation in Arduino and PIC 2 2
microcontroller
Experiment 9 1 2
C language in Arduino and PIC microcontroller
Experiment 10 Timers, counters and interrupt in Arduino and PIC 2 2
microcontroller
Experiment 11 LCD interfacing with Arduino and PIC 2 2
microcontroller
Interfacing 16×2 LCD and Keyboard 2 2
Experiment 12 A. With PIC18
B. Arduino
C. Raspberry Pi
Experiment 13 LCD interfacing with Arduino UNO 2 2
DC motor interfacing with Arduino UNO
Stepper/Servo Motor Control 2 2
Experiment 14
A. Using PIC18
B. Using Raspberry Pi
Experiment 15 3 3
PIC microcontroller-based project
Department of Electrical Engineering
Faculty of Engineering & Applied Sciences
Riphah International University, Islamabad, Pakistan
Introduction:
1. MPLABx IDE:
➢ C/C++
➢ Shell Scripts
➢ Make file
➢ SQL
➢ Assembly
➢ HTML
➢ Java Script
➢ XML
Procedure:
Steps for creating a basic C++ code in MPLABx IDE:
1. Create a new Project in the MPLABx IDE Program by selecting Standalone Project in
options given.
2. Select Family ➔ Advanced 8-bit MCUs
Select Device ➔ PIC18F458
Introduction to Proteus.
Objectives
iv) Introduction and Familiarization with Proteus software.
v) Basic Understanding of how to install and create project in Proteus.
vi) To interface LEDs with PIC microcontroller using Proteus.
Introduction
4. Proteus Software
The micro-controller simulation in Proteus works by applying either a hex file or a debug file
to the microcontroller part on the schematic. It is then co-simulated along with any analog and
digital electronics connected to it. This enables its use in a broad spectrum of project
prototyping in areas such as motor control, temperature control and user interface design, since
no hardware is required, is convenient to use as training or teaching tool. Support is available
for co-simulation of:
• Microchip Technologies PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC33
Microcontrollers.
• Atmel AVR (and Arduino), 8051 and ARM Cortex-M3 Microcontrollers
• NXP 8051, ARM7, ARM Cortex-M0 and ARM Cortex-M3 Microcontrollers.
• Texas Instruments MSP430, PICCOLO DSP and ARM Cortex-M3 Microcontrollers.
• Parallax Basic Stamp, Freescale HC11, 8086 Microcontrollers
Procedure:
Steps for creating a basic code for interfacing LEDs with microcontroller:
11. Open the Proteus Software installed in your system, a starting Main page will appear.
12. Create a new Project in the Proteus Software by selecting New Project in File options
given and give your project a Name and Location.
16. The following dialogue box gives a summary of all the options selected.
Click Finish to create the project.
17. Select the following devices form PICK DEVICES
PIC18F458 , LED BODY
Connect the PIC controller with a 5V source and connect the LED on output Port. Write
a program using assembly language for a Blinking LED on the PIC firmware.
Introduction:
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a
Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing
something online.
There are many other microcontrollers and microcontroller platforms available for physical
computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many
others offer similar functionality. All of these tools take the messy details of microcontroller
programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of
working with microcontrollers, but it offers some advantage for teachers, students, and interested
amateurs over other systems:
2. Lilypad Arduino
3. Arduino Mega
4. Arduino Leonardo
Conclusion:
For the electronic project, there are number of Arduino products available in the market.
And the selection of the Arduino product is completely based on the requirement of project and
budget of the project. All the products have different features, uses and selection of right product
is completely dependent on user requirements.
Department of Electrical Engineering
OBJECTIVES:
• To create a program to interface LEDs with Arduino and PIC microcontroller Introduction
and Familiarization with Proteus and Thinkercad software.
• Basic Understanding of how to install and create project in Proteus.
• To interface LEDs with Arduino and PIC microcontroller using Assembly and C language.
Code:
void setup()
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
void loop()
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(1000);
}
Conclusion:
The goals that we set out to achieve in the purpose were all achieved as we proved in the
video. Similarly, the whole process was documented in the schematic and theory sections. These
all prove that the Arduino platform is indeed beginner friendly (even though it came without
instructions!) and that getting the hardware equivalent of a "hello, world" program of blinky
LEDs resulted in few hassles.
Department of Electrical Engineering
Faculty of Engineering & Applied Sciences
Riphah International University, Islamabad, Pakistan
Introduction:
This simple little project uses an Arduino and some LEDs to replicate a traffic light. It uses code
as an internal timer and continues to run until you cut the Arduino's power supply. This project is
done to give you an idea of how the traffic light controller works. This is not the real time traffic
light controller. So, at start, green light of signal 1 and red lights at other signals will light up to
give time to the vehicles at signal 1 to pass. After 5 seconds, the yellow light at signal 1 will light
up to give an indication that the red light at signal 1 is about to come up and also to give an
indication to the vehicles at signal 2 that the green light is about to light up. So, after 2 seconds,
red light at signal 1 will come up and green light at signal will come up meaning vehicles at signal
1 must stop and vehicles at signal 2 can move. Similarly, the traffic light controller will work for
the signal 3, signal 4 and the system will keep looping.
Tinkercad Schematics:
Code:
void setup()
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
void loop()
digitalWrite(13, 0);
digitalWrite(12, 0);
digitalWrite(11, 1);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 1);
digitalWrite(6, 0);
digitalWrite(5, 0);
digitalWrite(4, 1);
digitalWrite(3, 0);
digitalWrite(2, 0);
delay(4000);
digitalWrite(13, 0);
digitalWrite(12, 1);
digitalWrite(11, 0);
digitalWrite(10, 0);
digitalWrite(9, 1);
digitalWrite(8, 0);
digitalWrite(7, 1);
digitalWrite(6, 0);
digitalWrite(5, 0);
digitalWrite(4, 1);
digitalWrite(3, 0);
digitalWrite(2, 0);
delay(2000);
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 0);
digitalWrite(10, 0);
digitalWrite(9, 0);
digitalWrite(8, 1);
digitalWrite(7, 1);
digitalWrite(6, 0);
digitalWrite(5, 0);
digitalWrite(4, 1);
digitalWrite(3, 0);
digitalWrite(2, 0);
delay(4000);
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 0);
digitalWrite(10, 0);
digitalWrite(9, 1);
digitalWrite(8, 0);
digitalWrite(7, 1);
digitalWrite(6, 0);
digitalWrite(5, 0);
digitalWrite(4, 0);
digitalWrite(3, 1);
digitalWrite(2, 0);
delay(2000);
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 0);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 1);
digitalWrite(6, 0);
digitalWrite(5, 0);
digitalWrite(4, 0);
digitalWrite(3, 0);
digitalWrite(2, 1);
delay(4000);
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 0);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 0);
digitalWrite(6, 1);
digitalWrite(5, 0);
digitalWrite(4, 0);
digitalWrite(3, 1);
digitalWrite(2, 0);
delay(2000);
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 0);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 0);
digitalWrite(6, 0);
digitalWrite(5, 1);
digitalWrite(4, 1);
digitalWrite(3, 0);
digitalWrite(2, 0);
delay(4000);
digitalWrite(13, 0);
digitalWrite(12, 1);
digitalWrite(11, 0);
digitalWrite(10, 1);
digitalWrite(9, 0);
digitalWrite(8, 0);
digitalWrite(7, 0);
digitalWrite(6, 1);
digitalWrite(5, 0);
digitalWrite(4, 1);
digitalWrite(3, 0);
digitalWrite(2, 0);
delay(2000);
}
Conclusion:
There are total of 12 LEDs used in this project. Each signal has 3 LEDs (Red, Yellow and
Green) connected to it through the 220-ohm resistors. The resistors are used to limit the current
that is going to pass through the LEDs. If you won’t use the resistors then the LEDs may burn due
to excessive current.