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

[Ty pe here] [Ty pe here]

ELECTRICAL ENGINEERING DEPARTMENT


DEC40053: EMBEDDED SYSTEM APPLICATION
PRACTICAL WORK: 1 / 2 / 3 / 4 / 5 / 6
TITLE : INTRODUCTION TO MPLAB IDE v8.85 AND CIRCUIT SIMULATION
PROGRAMME:

1.

LECTURER : 2.
3.
GROUP MEMBERS NAME REGISTRATION NUMBER
STUDENT 1 1.

STUDENT 2 2.

STUDENT 3 3.

STUDENT 4 4.

PRACTICAL SKILL EVALUATION (CLO3, PLO05)


SCORE
Excellent Good Average Weak Very Weak
Scale S1 S2 S3 S4
ASPECT 5 4 3 2 1
Recognize the Shows a solid Shows Shows Shows some Shows little
practicalwork understanding to understanding considerable understanding to understanding to
properly do practical work todo practical understanding do practical work do practical work X1
(P4) correctly workproperly todo practical
work
The delay / speed The The code of The delay/ speed/ Unable to state
Able to build
/ length / logic delay/speed/leng delay/ speed/ length/ logic code delay/ speed/
speed/length
codes are very th /logic code is length/ logic is poorly stated length/ logic code
(distance)
well stated and simple to read, is readable; and very difficult X3
/ logic coding
easily with some however, it is to read
(P3)
understandable. comments alittle tricky
included. to
understand.
The code is very The code is The code is The code is poorly Unorganized code
Perform the
organized, easy to simpleto read readable; organized and
program
follow and in line and is however, it is very difficult to X4
correctly (P4)
with the supplemented by alittle tricky read
comments stated a few comments. to
understand.
• Trends/ patterns • Trends / • Trends/ • Trends/ patterns • Trends/ patterns
Display the
are logically patternsare patternsare are not analyzed are not analyzed
practical work
analyzed logically logically Analysis is not No analysis X4
task (P4)
Analysis is analyzed analyzed relevant
thoughtful Analysis is too Analysis is
general inconsistent
• Result: Excellent • Result: Clear • Result: Clear • Result: unclear, • Result:
and incredibly andlabelled, andlabelled, missing labels, Disorganized,
beautifully excellent well organized, trends are not poorly recorded
recorded, highly recording well recorded obvious, • Task: Not
structured flow. • Task: • Task: disorganized, complete
Complete • Task: Complete Completed with Completed good recording Presentation: No
task as all tasks without not more than 2 withsome but shivering introduction and
X4
assigned error errors errors • Task: Half explanation
(P4) • Presentation: Presentation:
• Presentation:
completed
Excellent very good Presentation: has
Introductions
introduction and Introductions an introduction
explanation. and anddescriptions but the
explanation. that are description is
commonly used inaccurate

80%
B. LAB REPORT ASSESSMENT

SCORE
Excellent Good Average Weak Very Weak
SCALE SCORE
5 4 3 2 1
ASPECT
Able to write Able to write Able to write Write discussion Discussion was
discussion discussion with discussion with not related not written
clearly related clearly related to related to to practical work clearly and was X1
to practical work practical work practical work objective unrelated to
Discussion objective. Use objective objective the practical
good and work
appropriate objective.
language in
writing
Accurate Accurate A statement of A statement of No conclusion
statement of the statement of the the results of the the results of the included or
results of the lab results of the lab lab indicates lab indicates shows little X1
Conclusion indicates indicates whether results whether results effort and
whether results whether results support the support the reflection on
support the support the hypothesis hypothesis the lab
hypothesis hypothesis
Excellent. All- Almost of the Almost of the Some of the Incomplete/
important results have results have results are incorrect
trends have been correctly been correctly misinterpreted interpretation.
been interpreted and interpreted and and there is no Not answer
interpreted discussed. some correctly clear answer to the question
Question X2
correctly and Answer the answer the the question
discussed. question question
Answer the correctly
question
correctly.
20%

STUDENTS S1 S2 S3 S4

Total marks 100%

Prepared by: Revised by: Approved by:


PRACTICAL WORK: 1

TITLE: INTRODUCTION TO MPLAB IDE v8.85 AND CIRCUIT SIMULATION

OBJECTIVES
Upon completion the experiment student should be able to :
a) Construct some simple C code in MPLAB (P3).
b) Assemble an output of C program using Program Memory and Disassembly Listing (P3).
c) Build and simulate PIC18 circuit in Proteus (P4).

EQUIPMENTS
1. Microchip C18 Tool suite
2. MPLAB IDE v8.85 software
3. Proteus software
4. Computer

THEORY
MPLAB IDE
MPLAB IDE (Integrated Development Environment) is professional software implemented by
Microchip, compatible with Windows 7, Vista and XP. MPLAB IDE is used as a powerful aid to
the development of systems based on PIC microcontrollers. Its distribution is free. Download
may be made from Microchip site.

Figure 1: MPLAB IDE v8.85 Shortcut

C18 COMPILER
The C18-MPLAB ® IDE, is a C compiler for PIC18 professional MCU, and a powerful tool for ANSI compatible
PIC18 family of PICmicro ® 8-bit MCU. The C18 compiler is a 32-bit Windows ® environment fully integrated with
Microchip MPLAB IDE and allows developing and debugging programs using their software tools. MPLAB C18
compiler makes development of embedded systems applications easier because it uses the C standard language.
The advantage of the C language is that it is widely used, is portable across different architectures, has many
references and textbooks, and is easier to maintain and extend than assembly language. Additionally, MPLAB
C18 can compile extremely efficient code for the PIC18XXXX microcontrollers.’

PROTEUS
ISIS provides the means to enter the design in the first place, the architecture for real time interactive level
simulator. This software combines mixed mode circuit simulation, micro-processor models and interactive
component models to allow the simulation of complete micro-controller-based designs.

Major features of PROTEUS VSM include:

a) Simulation and a system for managing the source and object code associated with each project. In
addition, a number of graph objects can be placed on the schematic to enable conventional time,
frequency and swept variable simulation to be performed.
b) True Mixed Mode simulation based on Berkeley SPICE3F5 with extensions for digital simulation and true
mixed mode operation.
c) Support for both interactive and graph-based simulation.
d) CPU Models available for popular microcontrollers such as the PIC and 8051 series.
e) Interactive peripheral models include LED and LCD displays, a universal matrix keypad, an RS232 terminal
and a whole library of switches, pots, lamps, LEDs etc.

Figure 2: Proteus 8 Professional Shortcut


PROCEDURE A: MPLAB IDE v8.85 EDITOR

1) At desktop, create a folder named PW1. In the folder, create subfolder PROGRAM and CIRCUIT. Then run the
MPLAB IDE v8.85.
2) Select menu Project – Project Wizard – Select Device: PIC18F458 – Select Active Tool suite as
below:

Figure 3: Project Wizard Pop-up Window

3) Browse the folder that was created at the desktop and give file name as project.mcp.
4) Click Next button until Finish.
5) Double-clicks at MPLAB IDE shortcut and workspace window will display as below and then create a new file editor.

Figure 4: MPLAB Workspace


6) Write a source code as below in the editor windows and save file as C file (*.c) in your folder at the desktop.

//project.c

void main(void)

TRISB = 1; //PORTB as input


TRISCbits.TRISC1 = 0; //Pin C1 as output
PORTB = 0; //Clear all Port B
PORTC = 0; //Clear all Port C

if (PORTB == 1) {
PORTCbits.RC1 = 1; //Pin C1 as ON

PORTCbits.RC1 = 0;

7) Right click at Source Files folder in Project.mcp and add your C file.

Figure 5: Add Files in Source File

8) Compile (Build All) the source code until “Build Succeeded”.


PROCEDURE B: PROGRAM MEMORY AND DISASSEMBLY LISTING

1) Select menu View – Program Memory and Disassembly Listing.


2) Observe contains of the Program Memory and fill the table below.

Line Address Opcode Disassembly

Table 1: Program Memory

PROCEDURE C: CIRCUIT SIMULATION USING PROTEUS 8.

1) Double click Proteus 8 Professional icon as Figure 2.

2) Click New Project icon.

Figure 7: Proteus 8 workspace

3) Choose CIRCUIT folder that you created earlier. Then give file name as project.pdsprj. Then click Next. Choose
DEFAULT template for schematic circuit and choose Do not create PCB layout.
4) Choose Create Firmware Project. Choose Family>PIC18, Controller>PIC18F458, Compiler>MPLAB C18. Then click
Next, and Finish.

5) Schematic capture and source code work area will appear as below. Write source code in source code editor as
below. Then compile (build project) source code until compiled successfully.
6) Connect the circuit shown in the figure below. Select button P or Pick parts from libraries icon. Pick Device
window will appear. Type the components name in Keyword box or select in Category option.

7) Simulate the circuit by click Play button and observe the output at the circuit

RESULT

TASK

1. Modify the above source code to make the push button:


a. Press – ON
b. Release – OFF

2. Modify the connection and Task 1 source code to make the push button:
a. Press – LED and Buzzer ON
b. Release – LED and Buzzer OFF
DISCUSSIONS

CONCLUSIONS

You might also like