Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views2 pages

Lab 2

This document outlines a practical workshop for 1st-year electrical engineering students focusing on interrupt handling using the PIC16F877 microcontroller. It includes two main tasks: implementing an external interrupt to toggle an LED with a push-button and using interrupt-on-change functionality for multiple inputs. Students are required to write Embedded C code, simulate their designs in Proteus, and document their findings along with reflection questions and debugging tasks.

Uploaded by

Oussama Chouker
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)
10 views2 pages

Lab 2

This document outlines a practical workshop for 1st-year electrical engineering students focusing on interrupt handling using the PIC16F877 microcontroller. It includes two main tasks: implementing an external interrupt to toggle an LED with a push-button and using interrupt-on-change functionality for multiple inputs. Students are required to write Embedded C code, simulate their designs in Proteus, and document their findings along with reflection questions and debugging tasks.

Uploaded by

Oussama Chouker
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/ 2

Practical Workshop

Embedded C
Program Electrical Engineering
Level 1st year
Supervisor : Pr. JENKAL Wissam

Lab 2: Interrupt Handling on PIC16F877

Introduction
This lab aims to evaluate your ability to design, implement, and simulate interrupt-based systems using
the PIC16F877 microcontroller. You are expected to write the embedded C code yourself based on the
problem scenarios described below, simulate your work in Proteus, and document your results.

Tools and Software


- MikroC (for Embedded C programming and compilation)

- Proteus (for circuit design and simulation)

Part 1: External Interrupt on RB0


Design and implement a system where a push-button connected to pin RB0 triggers an external
interrupt. When the button is pressed, the system should toggle the state of an LED connected to RB1.

You are required to:


- Write your own Embedded C code to implement this behaviour.
- Properly configure RB0 as input and RB1 as output.
- Ensure the interrupt is triggered on a rising edge.
- Debug the program and explain the process.
- Simulate the system using Proteus and demonstrate the LED toggling on button press.
- Document and explain your implementation.

Part 2: Interrupt-on-Change on RB4–RB7


Develop a system that uses interrupt-on-change functionality on pins RB4 to RB7. Each time a change is
detected on any of these pins, an LED connected to RB0 should toggle its state.

You are required to:


- Write your own Embedded C code to handle the interrupt-on-change.
- Properly configure RB4 to RB7 as inputs and RB0 as output.
- Debug the program and explain the process.
- Simulate your circuit in Proteus using push-buttons on RB4–RB7.

1
- Show the toggling of the LED on RB0 whenever any of the buttons is pressed or released.
- Document your observations and explanation of your design choices.

Deliverables
- Complete, well-commented Embedded C source code for each part.

- Proteus circuit files showing working simulation.

- Screenshots of simulation results.

- A short report explaining your implementation and answers to reflection questions.

Reflection Questions
1. What are the main differences between external interrupt and interrupt-on-change?

2. Why is it important to clear interrupt flags manually?

3. What are the challenges of handling multiple interrupts in embedded systems?

Debugging Tasks
As part of the lab, you are required to debug your own code and circuit implementation. Here are some
common scenarios to test and document:

1. What happens if you do not enable the global interrupt?

2. What if you forget to clear the interrupt? For each debugging case:
- Describe what went wrong.
- Explain how you identified the issue.

You might also like