Tuesday 14 February 2017

PROCEDURE



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


Figure 16

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.

Figure 20

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.

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.
Figure 24

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.



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?

Monday 13 February 2017

THEORY



The term microcomputer is used to describe a system that includes at minimum a microprocessor, program memory, data memory, and an input-output (I/O) device. Some microcomputer systems include additional components such as timers, counters, and analog-to-digital converters. Thus, a microcomputer system can be anything from a large computer having hard disks, floppy disks, and printers to a single-chip embedded

controller.

In this course we are going to consider only the type of microcomputers that consist of a single silicon chip. Such microcomputer systems are also called microcontrollers, and they are used in many household goods such as microwave ovens, TV remote control units, cookers, hi-fi equipment, CD players, personal computers, and refrigerators.

Many different microcontrollers are available on the market. In this lab we shall be looking at programming and system design for the PIC (Programmable Interface Controller) series of microcontrollers manufactured by Microchip Technology Inc.

A microcontroller is a single-chip computer. Micro suggests that the device is small, and controller suggests that it is used in control applications. Another term for microcontroller is embedded controller, since most of the microcontrollers are built into (or embedded in) the devices they control.

In this lab, we will be using PIC18F45K22 microcontroller.