1.
|
To begin, create a folder named P1 on your desktop.
Inside the folder, create sub folder as Figure 1 below.
Figure 1
|
2.
|
Start MPLAB IDE software. Go to START > All Program
> Microchip > MPLAB IDE v8.63 > MPLAB IDE. MPLAB work area will
appear, as shown in Figure 2.
Figure 2
|
3.
|
To start new project, click
Project > Project Wizard, as shown in Figure 3.
Figure 3
|
4.
|
Choose device. Select PIC18F45K22 as shown in Figure 4
and click Next.
Figure 4
|
5.
|
For Active Toolsuite, select Microchip XC8 Toolsuite.
For Toolsuite Contents, select Microchip MPLAB XC8 Compiler as shown in
Figure 5. Click Next.
Figure 5
|
6.
|
Create New Project File. Click
Browse > Desktop > P1 Folder > Project sub folder and save the
project as LAB1 as shown in Figure 6 and Figure 7. Click Next.
Figure 6
Figure 7
|
7.
|
Add
existing files to your project. If you have any files to add in this project
choose the file(s), and then click Add, as shown in Figure 8. For now, just
click Next.
Figure 8
|
8.
|
Summary
window will occur. Make sure the device and the toolsuite are same as shown
in Figure 9. Click Finish.
Figure 9
|
9.
|
You have
completely created a new project. Make sure you get MPLAB window as shown in
Figure 10. Notice that your MPLAB window has the same name as your project
name in Step 6.
Figure 10
|
10.
|
To
write PIC C language program, click File > New or you can click New File
icon. New Untitled window editing will appear.
Figure 11
|
11.
|
Copy and paste program given in
Appendix A into your Untitled window. Modify the void main (void) block with the given
program in Figure 12.
Figure
12
|
12.
|
Save your program. Select
File > Save as. Go to Desktop > P1 Folder > Code sub folder and save
your program as LED.c. Thick The Add File To Project box, as shown in Figure
13.
Figure 13
Make sure LED.c file occurred below Source Files folder in LAB1.mcw
window as Figure 14.
Figure 14
|
13.
|
Click Project > Build or
click Build icon to debug your program as Figure 15. If there are no errors,
MPLAB will show ********** Build successful! ********** Output window as
Figure 16. If there are errors, **********
Build failed! ********** message will occur. Double click the errors and fix them.
Figure 15
|
14.
|
Your task in MPLAB has been
completed. When you want to open this project, select File > Open or just click
Open Project icon. Search Desktop > P1 > Project sub folder > LAB1
as Figure 17.
Figure
17
|
15.
|
Double click Proteus 8
Professional icon. Then click ISIS icon as Figure 18.
Figure
18
|
16.
|
Untitled Proteus 8
Professional-Schematic Capture work area will appear as shows in Figure 19.
Select button P or Pick parts from libraries icon.
Figure
19
|
17.
|
Pick Device window in Figure
20 will appear. This is where you can select your components for simulation.
You can type the components name in Keywords box or you can select in
Category option.
|
18.
|
Double click your left mouse
to select components below as Figure 21.
a) Microprocessor ICs > PIC18F Family > PIC18F45K22
b) Resistors > 0.6W Metal film > MINRES330R
c) Optoelectronics > LEDs > LED-RED
Figure
21
When all components are
selected, click Cancel button to go back to ISIS window.
|
19.
|
Construct circuit shown in
Figure 23. To set power and ground source, select Terminal Mode > Power
and Ground shown in Figure 22.
To save your circuit, select
File > Save Project As. Go to Desktop > P1 Folder > CIRCUIT sub
folder. Save this circuit as LAB1.
Figure
23
|
20.
|
From your working window,
double click your PIC18F45K22. Edit component window will appear as Figure 24.
Click the yellow folder at Program File option. Go to Desktop > P1 Folder
> PROJECT sub folder. Select LAB1.hex file.
At Processor Clock
Frequency, set 16MHZ. Click OK.
|
21.
|
To run your circuit, click
Debug > Run Simulation or click the Run Simulation button at the bottom
left of your ISIS window. To stop simulation, click Stop The Simulation button
as Figure 25.
Observation:
State your observation of
the circuit.
|
22.
|
Check voltage level at pin
RD0 and RD1. To measure voltage, click Probe Mode and select Voltage probes.
Put the probes at locations shown
in Figure 26.
Figure 26
Observation:
Voltage at RD0:
Voltage at RD1:
Question:
What is the voltage value
from PIC18F45K22 when LED ON and LED OFF?
|
Tuesday, 14 February 2017
PROCEDURE
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment