0% found this document useful (0 votes)
70 views13 pages

MP & MC Lab Task 9-200708

This lab report describes interfacing a keypad and LCD with a PIC18F452 microcontroller. The objectives were to interface a keypad to display results on an SSD and interface an LCD. The report discusses the procedure, which includes using MikroC Pro to write code, debugging it, and burning the hex file onto the PIC using a burner. Four tasks are described: 1) interfacing an LCD, 2) using a 7-segment display code generator, 3) interfacing a keypad to display on LCD, and 4) displaying a custom character on the LCD. The conclusion states the key lessons learned about interfacing an LCD and keypad with a microcontroller.

Uploaded by

Omar Janjua
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views13 pages

MP & MC Lab Task 9-200708

This lab report describes interfacing a keypad and LCD with a PIC18F452 microcontroller. The objectives were to interface a keypad to display results on an SSD and interface an LCD. The report discusses the procedure, which includes using MikroC Pro to write code, debugging it, and burning the hex file onto the PIC using a burner. Four tasks are described: 1) interfacing an LCD, 2) using a 7-segment display code generator, 3) interfacing a keypad to display on LCD, and 4) displaying a custom character on the LCD. The conclusion states the key lessons learned about interfacing an LCD and keypad with a microcontroller.

Uploaded by

Omar Janjua
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

NAME: MUHAMMAD OMAR JANJUA

ROLL NUMBER: 200708

DATE: 04/12/2022

TITLE: LAB # 9

SUBMITTED TO: SIR ALI RAZA


LABORATORY
EXPERIMENT
NO.9

Interfacing Keypad and LCD with PIC18F452


Objectives:
• Familiarizing students to interface keypad with PIC18F452 and display results
on SSD
• Familiarizing students to interface LCD with PIC18F452 and display data on
the LCD
• Familiarizing students to interface a 4x3 keypad with PIC18F452 and
display results on LCD
Equipment:
➢ PIC18F452 microcontroller
➢ 2x16 LCD
➢ Keypad
➢ RIMS Trainer
➢ mikroC Pro
➢ SmartPRO 5000U
➢ Proteus
Discussion:
In this a lab we learned how to interface a 16x2 LCD with pic.

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 and Keypad with PIC microcontroller as required in
circuit and desired output will be shown on LCD.

TASK 1

CODE:
sbit LCD_RS at RC2_bit;
sbit LCD_EN at RC3_bit;
sbit LCD_D4 at RC4_bit;
sbit LCD_D5 at RC5_bit;
sbit LCD_D6 at RC6_bit;
sbit LCD_D7 at RC7_bit;

sbit LCD_RS_Direction at TRISC2_bit;


sbit LCD_EN_Direction at TRISC3_bit;
sbit LCD_D4_Direction at TRISC4_bit;
sbit LCD_D5_Direction at TRISC5_bit;
sbit LCD_D6_Direction at TRISC6_bit;
sbit LCD_D7_Direction at TRISC7_bit;
// End LCD module connections
void main()
{
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,"—OMAR-- "); // Write text
Lcd_Out(2,1,"--JANJUA--");
}

HARDWARE:
We have printed following names while doing hardware:
TASK 2:

CODE:

SIMULATION:
TASK3:

We used built in 7 segment code generator for this code in mikroc.


CODE:
RESULT:
TASK 4
Write a code to interface a 16x2 LCD with PIC18F452 microcontroller, which displays a custom character
on LCD.

We used built in custom character generator for this code in mikroc.


SIMULATION:
CONCLUSION:
In this lab we learned how to interface a 16x2 LCD with PIC18F452 and how to send
a display to it. We also used built-in keypad functions to interface a 4x3 keypad with
the lcd and print whatever number is sent by the keypad, we also displayed it on
common anode SSD. We used the built-in 7 segment editor to generate a hex code.
We also used built-in custom character generator to help in our last code.

You might also like