0% found this document useful (0 votes)
54 views4 pages

Laboratory 2 Name: - : Dept. of Electronic Engineering EE302 - John Maloco

This document provides instructions for Laboratory 2 of the EE302 Embedded and Realtime Systems course. Students are asked to write a program for a PIC16F877 microcontroller circuit with two buttons and a 2x16 LCD display. The program should initialize the display with the lab name and number, then increment or decrement a button press counter displayed on the LCD when each button is pressed. The pseudo code design and C code implementation are to be completed as parts of the lab exercise.

Uploaded by

anthohoran
Copyright
© Attribution Non-Commercial (BY-NC)
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)
54 views4 pages

Laboratory 2 Name: - : Dept. of Electronic Engineering EE302 - John Maloco

This document provides instructions for Laboratory 2 of the EE302 Embedded and Realtime Systems course. Students are asked to write a program for a PIC16F877 microcontroller circuit with two buttons and a 2x16 LCD display. The program should initialize the display with the lab name and number, then increment or decrement a button press counter displayed on the LCD when each button is pressed. The pseudo code design and C code implementation are to be completed as parts of the lab exercise.

Uploaded by

anthohoran
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 4

Dept.

of Electronic Engineering

EE302 John Maloco

Embedded and Realtime Systems

Laboratory 2
INSTRUCTIONS

Name:____________________

This laboratory should be completed within the 3 hours allocated and handed up at the end of the lab. Be sure to include your name on all your work. Part 1 of the Laboratory exercise should be answered in the space provided. Be sure to include a printout of your source code with your answers. Dont forget to include your name. Copying will be penalised DETAILS Figure 1 below depicts a basic configuration of an embedded system based around the PIC16F877. The circuit consists of the following: Fosc : SW1 : SW2: LCD : Vdd
1
MCLR Vdd

4 Mhz Switch 1 Switch 2 2 x 16 Alphanumeric LCD display 5V


20
15pF OSC1

9
4 Mhz Xtal

SW 1

PIC16F877
OSC2 RB0 RA4

10

15pF

SW 2
Vss Vss

19
2x16 LCD Display

Vss Figure 1

0V

Dept. of Electronic Engineering

EE302 John Maloco

Embedded and Realtime Systems The desired function of the circuit is as follows: 1. On start up display a title on both lines of the LCD display i.e. Laboratory 2 EE302

2.

When SW1 is pressed a button pressed counter is incremented once per button press up to a maximum of 99. Each increment should be displayed on the LCD i.e. Button Press = xx

3.

When SW2 is pressed a button pressed counter is decremented once per button press down to a minimum of 0. Each decrement should be displayed on the LCD i.e. Button Press = xx

4.

Initial value for the button pressed counter should be 0.

Laboratory Exercise 1. Using Pseudo code, outline the design of the program for the above. (20 marks) 2. Using MPLAB create a project and write the C program for the above. Include good comments and a title section for your code. (50 marks) 3. Download your program to the PICDEM 2 board and verify the function of the program using the ICD2 debugger. Demonstrate your working program to a lab demonstrator. (30 marks)

Notes: 1. The ICD2 debugger only allows one breakpoint to be inserted at a time. 2. After creating a project in MPLAB ensure that the configuration bits are set either in the code or in MPLAB. NOT BOTH.

Dept. of Electronic Engineering

EE302 John Maloco

Embedded and Realtime Systems Answer to Laboratory Exercise 1

Dept. of Electronic Engineering

EE302 John Maloco

Embedded and Realtime Systems

Answer to Laboratory Exercise 3 Show lab demonstrator software working on PICDEM2 board. Lab demonstrator to sign off on this:

You might also like