You are on page 1of 8

NAME: Muhammad Omar Janjua

ROLL NUMBER: 200708

DATE: 11/12/2022

TITLE: LAB # 10

SUBMITTED TO: SIR ALI RAZA


LABORATORY
EXPERIMENT
NO.10

Analog-to-Digital Converter (ADC) in PIC18F452


Objectives:
• Familiarizing students with ADC in PIC18F452 and writing codes in MikroC to convert
analog values to digital values.
Equipment:
➢ PIC18F452 microcontroller
➢ 2x16 LCD
➢ DMM
➢ RIMS Trainer
➢ mikroC Pro
➢ SmartPRO 5000U
➢ Proteus
Discussion:
ADC is a great tool to convert analog data to digital data as most of the devices work
in digital communication, but if we interface a microcontroller with an external
sensor, we must digitalize the data because the microcontroller cannot interpret
analog data.
Procedure:

1. Launch mikroC for PIC.


2. When new window shows up, select new project.
3. A dialog box appears to name the project, save the project file in appropriate
directory, the PIC microcontroller required for this project and the device
clock.
4. Always confirm the supported frequency for the controller before
proceeding, which in this case is 4MHz. Click Next once you have filled in
all the fields.
5. After including all of the libraries, we write our code in the main window,
which appears.
6. After debugging the code and building the targets, the hex file appears in the
folder, which can be then burned on the PIC18F452 in proteus.
7. Set the smartpro5000u burner.
8. Open its software (smart pro5000u burner*) and connect it to burner.
9. If in software, all lights are green, they are connected. We can also verify if
from bottom left screen where it would be mentioned whether they are
connected or not.
10.From above menu, click devices, select “PIC Fxxxx” from there, and check
mcu/mpu.
11.Now, click on file and from there load the already created hex. file there.
12.After a new window is opened, select Intel hex from there.
13.Set the IC on burner and tighten it. Click AUTO from bottom left menu and
so our code will be burned/uploaded in IC.
14.Set the IC on burner and tighten it. Click AUTO from bottom left menu and
so our code will be burned/uploaded in IC.
15.Remember to give 5V dc to first pin.
16.Now connect 2x16 LCD with PIC microcontroller as required in circuit and
desired output will be shown on LCD.

LAB TASK 1:
CODE:

SIMULATION:

HARDWARE:
TASK 2:

CODE:
SIMULATION:
TASK 3:

CODE:

SIMULATION:
CONCLUSION:
In this lab we learned about Analog to Digital Convertor (ADC) in pic programming.
We interfaced a potentiometer to depict the analog input coming from a sensor and
digitalized it followed by its display on LCD and LEDs both. For this purpose we
used built-in A to D converter in MikroC and also we did it manually without using
the built in libraries.

You might also like