0% found this document useful (0 votes)
13 views

Lab 1 - Digital Input-Output Interfacing and Programming

The document outlines a lab session for Digital Systems & Microprocessors focusing on interfacing and programming with PIC microcontrollers. It includes tasks to control LEDs and seven-segment displays using GPIO pins, along with simulation requirements in Proteus software. Students are also instructed to prepare a concise report detailing their experiments and findings.

Uploaded by

koinai0031
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lab 1 - Digital Input-Output Interfacing and Programming

The document outlines a lab session for Digital Systems & Microprocessors focusing on interfacing and programming with PIC microcontrollers. It includes tasks to control LEDs and seven-segment displays using GPIO pins, along with simulation requirements in Proteus software. Students are also instructed to prepare a concise report detailing their experiments and findings.

Uploaded by

koinai0031
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Digital Systems & Microprocessors Lab

Session: 2022 (AVE-8) – Spring 2024

Experiment # 1
Digital Input/Output Interfacing and
Programming

Objective
• To configure & use the GPIO pins of PIC microcontroller
• To develop a C program, to control an LED and 7-segment display using GPIO pins of PIC
microcontroller
• To simulate the whole scenario in Proteus Software for code verification

Introduction to GPIO
A microcontroller communicates with the outside world either by setting the voltage on the pin high (usually
3.3/5V) or low (usually 0V) or reading the voltage level of an input pin as being high (1) or low (0). We
refer to these pins as general purpose input output (GPIO) pins. Any GPIO pin can be configured through
software to be either a digital input or a digital output. GPIO outputs let you translate logical values within
your program to voltage values on output pins and voltage outputs help your microcontroller exert control
over the system in which it is embedded.

GPIO Registers Configuration for PIC16F877A


To deal with GPIO pins, you need to understand the registers associated with GPIO ports.
Refer to this [link] , to understand about GPIO Registers Configurations. Ask your instructor if you have any
questions.

Task#1
Interface a single LED with PIC microcontroller
a) Write a C program to blink an LED with a time interval of 0.5 seconds continuously
b) Simulate the circuit on Proteus and verify your program.
Refer to this [link] , to understand the associated concepts.

Department of Avionics Engineering Page 1|5


Institute of Space Technology, Islamabad
Digital Systems & Microprocessors Lab
Session: 2022 (AVE-8) – Spring 2024
C Program:

Simulation (Proteus):

Department of Avionics Engineering Page 2|5


Institute of Space Technology, Islamabad
Digital Systems & Microprocessors Lab
Session: 2022 (AVE-8) – Spring 2024
Task#2
Interface 8 LEDs with PIC microcontroller
a) Write a C program to blink 8 LEDs, connected on 8 different GPIO pins of microcontroller, with a
time interval of 0.5 seconds continuously.
b) Simulate the circuit on Proteus and verify your program

Seven Segment Display Construction


Seven segment display is a useful electronic component used to produce numeric, alphabetic and some non-
alphabetic symbols using a specific arrangement of LEDs as shown in Figure.

A seven-segment display consists of seven LEDs arranged in the form of a squarish ‘8’ slightly inclined to
the right and a single LED as the dot character. Different characters can be displayed by selectively glowing
the required LED segments. Seven segment displays are of two types, common cathode, and common
anode. In common cathode type, the cathodes of all LEDs are tied together to a single terminal which is
usually labeled as ‘com’ and the anode of all LEDs are left alone as individual pins labeled as a, b, c, d, e, f,
g & dot. In common anode type, the anodes of all LEDs are tied together as a single terminal and cathodes
are left alone as individual pins. Both the configurations are shown in Figure.

Department of Avionics Engineering Page 3|5


Institute of Space Technology, Islamabad
Digital Systems & Microprocessors Lab
Session: 2022 (AVE-8) – Spring 2024
Digit Drive Pattern
Digit drive pattern of a seven segment LED display is simply the different logic combinations of its
terminals. For a certain character, a combination of LED ON and LED OFF is generated to display the
character for a short period of time. The pattern is loaded alternately to display other characters. For
example, to display the number 2, LEDs a, b, d, e, and g are illuminated. Following Table provides the
display pattern for numbers (0-9) and characters A through F.

Refer to this [link], to further understand the working of 7-segment display.

Multiplexing the Seven Segments


To control more than one 7-segment displays, multiplexing can reduce the number of GPIO pins required. In
this setup, the all multiplexed seven-segment displays are turned on one at a time to output the appropriate
display. Because of the visual phenomenon known as persistence of vision, rapid switching of the seven-
segment display can appear as if all the displays are turned on.

Task#3
Interface 7-segment display with PIC microcontroller
a) Write a C program to display the all the digits from 0-9 and all those alphabets of your name that
are in the range of A-F, with a time interval of 0.3 seconds continuously. [link]
b) Simulate the circuit on Proteus and verify your program.
c) Repeat the above two steps for the following:
a. Interface the four 7-segment display units and display the first four alphabets of your name.
Use the concept of multiplexing to save the number of pins of your microcontroller.

Department of Avionics Engineering Page 4|5


Institute of Space Technology, Islamabad
Digital Systems & Microprocessors Lab
Session: 2022 (AVE-8) – Spring 2024
Task#4
• Compose a concise report for submission in the forthcoming lab session, presenting it in hard copy
format.
• It should be submitted by a group of 2 students only.
• On the title page of your report, include only the following details: Experiment number and name,
Your name, Registration number, Section, and a thumbnail (optional).
• Adhere strictly to a professional format for the entire report.
• Ensure that the report is printed on both sides of the paper.
• Include your code and simulations for all tasks within the report.

Department of Avionics Engineering Page 5|5


Institute of Space Technology, Islamabad

You might also like