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

Lab_3_Seven Segment Displays

The document outlines a lab exercise for interfacing a 7-segment display with the PIC18F4550 microcontroller, focusing on I/O programming and pin handling. It includes objectives, suggested readings, required equipment, and a detailed introduction to the 7-segment display and its connection to the microcontroller. Additionally, it provides tasks for programming the display to show digits 0-9 and includes a delay function for timing control.
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)
43 views4 pages

Lab_3_Seven Segment Displays

The document outlines a lab exercise for interfacing a 7-segment display with the PIC18F4550 microcontroller, focusing on I/O programming and pin handling. It includes objectives, suggested readings, required equipment, and a detailed introduction to the 7-segment display and its connection to the microcontroller. Additionally, it provides tasks for programming the display to show digits 0-9 and includes a delay function for timing control.
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/ 4

University of Engineering and Technology, Lahore

LAB 3: I/O INTERFACING – 7-SEG DISPLAYS


Name : Date :
Regd-No :
OBJECTIVES:
▪ Extend I/O programming to handle multiple pins at the same time.
▪ Interfacing a 7-segment display with PIC18F4550
SUGGESTED READING:
▪ PIC18F4550 Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf
▪ Microchip’s website: www.microchip.com/
▪ Assembler/Linker/Librarian’s user guide (Microchip):
ww1.microchip.com/downloads/en/DeviceDoc/33014J.pdf
▪ PIC18F4550 and Assembly Language Overview:
http://www.pic18f.com/tutorial/2007/12/04/18f4550-and-assembly-overview/
▪ Using MPLab to create hex files:
http://picprojects.org.uk/projects/mplab/mplabhowto.htm
▪ MPLab step by step with PIC18F4550:
http://www.auelectronics.com/forum/index.php?topic=203.0
▪ Microchip’s PicKit3 In-circuit debugging and programming guide:
http://ww1.microchip.com/downloads/en/DeviceDoc/52116A.pdf

Please read through all the suggested reading before you come to lab.

EQUIPMENT AND COMPONENTS:


▪ PIC18F4550 (or similar microcontroller) and associated startup circuitry
▪ Seven Segment Display
▪ Resistors (220 Ohms, 10kOhms)
▪ Capacitors (10uF, 470uF)
▪ Jumper wires
▪ Power Adapter (7.5 Volts) and voltage regulation circuit (5V)
▪ Universal Programmer or PicKit v3

SOFTWARES REQUIRED:
▪ MPLAB IDE
▪ Proteus
---------------------------------------------------------------------------------------------------------------------
University of Engineering and Technology, Lahore

INTRODUCTION:
SEVEN SEGMENT DISPLAY
A seven-segment display (abbreviation: "7-seg(ment)
display"), , is a form of electronic display device for
displaying decimal and hexadecimal numbers. Seven-
segment displays are widely used in digital clocks,
electronic meters, and other electronic devices for
displaying numerical information. A seven segment
display, as its name indicates, is composed of seven
elements. Individually on or off, they can be combined
to produce simplified representations of the numbers.

The segments of a 7-segment display are referred to by


the letters ‘A to G’, as shown to the right, where the optional decimal point (DP)
(an "eighth segment") is used for the display of non-integer numbers. The seven
elements present in a display are basically seven LED’s having cathode and anode
terminal. And individual LED gets on when a positive terminal of dc (3-5 Volts
with resistance of R > 100 ohms in series with led to limit the current) is applied to
anode and negative to cathode.
Seven segments are available in two different schemes i-e
1) Common cathode
2) Common anode
In a common cathode the cathode terminal
of all LEDs are common and a separate
anode terminal of all LEDs are available
whereas it’s vice versa for common anode.
Fig.3.2 shows the internal structure and pin
diagram of a seven-segment display made
from LEDs.
University of Engineering and Technology, Lahore
PIC18F4550 AND SEVEN SEGMENT DISPLAY:
The seven segment display LEDs can be PIC18F4550 7-Segment pin
connected to the I/O pins of PIC18F4550. Here is the pin Connection
pin mappings of the display (common cathode), note 19 (RD0) 7(A)
that common anode displays will have reversed
wiring: 20 (RD1) 6(B)
21 (RD2) 4(C)
22 (RD3) 2(D)
27 (RD4) 1(E)
28 (RD5) 9(F)
29 (RD6) 10(G)
30 (RD7) 5(DP)

Use your solder less breadboard to make the connections between the seven-
segment LED and your PIC18F4550.

Task 3.1:
Find out the Hexadecimal combination of values you need to send to PORTD in
order to display the digits correctly, and complete the table below

PORTD Value
DIGIT
Hexadecimal Binary
0
1
2
3
4
5
6
7
8
9
University of Engineering and Technology, Lahore
Task 3.2:
Write a program to display digits from 0 to 9 with a delay on the seven segment
display attached to PORTD. Use the delay function provided below.
1. Simulate it on MPLab-IDE simulator and Proteus ISIS™
2. Implement the circuit on a bread-board and program the microcontroller
using a programmer device.

Fig.2.4: Connecting a 7-segment display


Delay Function:
; Following is a delay function to generate around 1 sec delay with 20MHz
; XTAL. Define REG1, REG2, and REG3 at the start of your code using ‘EQU’
; directive.
;-------------------------------------------
ORG 300H
DELAY_1000MS
MOVLW D'80'
MOVWF REG3
BACK MOVLW D'100'
MOVWF REG2
AGAIN MOVLW D'250'
MOVWF REG1
HERE NOP
NOP
DECF REG1, F
BNZ HERE
DECF REG2, F
BNZ AGAIN
DECF REG3, F
BNZ BACK
RETURN
Bonus Task:
Make the 7-seg display digits backwards (i.e from 9 to 0)

You might also like