0% found this document useful (0 votes)
55 views6 pages

Lab 3

This document describes an experiment involving interfacing multiple 7-segment displays to an AT89C51 microcontroller using a multiplexing technique. It explains the working of 7-segment displays and how multiple displays can be connected using common anodes or cathodes. The document then discusses the concept of multiplexing to interface multiple displays using a single microcontroller and provides code to multiplex two 7-segment displays.

Uploaded by

anonymous bunny
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)
55 views6 pages

Lab 3

This document describes an experiment involving interfacing multiple 7-segment displays to an AT89C51 microcontroller using a multiplexing technique. It explains the working of 7-segment displays and how multiple displays can be connected using common anodes or cathodes. The document then discusses the concept of multiplexing to interface multiple displays using a single microcontroller and provides code to multiplex two 7-segment displays.

Uploaded by

anonymous bunny
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/ 6

Experiment No.

3
7-Segment Display Interfacing and Programming

Objective
1. Working principle of 7-segment displays.
2. Interfacing multiple 7 segments together using multiplexing technique.
3. Programming the multiplexed array of 7-segment displays.

Introduction
A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display
device for displaying decimal numbers that is widely used in digital clocks, electronic meters,
and other electronic devices for displaying numerical information. The light emitting diodes
in seven segments are arranged as a rectangle as shown in figure. The segments of a 7-segment
display are referred to by the letters A to G, where the optional DP decimal point (an "eighth
segment") is used for the display of non-integer numbers.

In a simple LED package, typically all the cathodes (negative terminals) or all of the anodes
(positive terminals) of the segment LEDs are connected and brought out to a common pin; this
is referred to as a "common cathode" or "common anode" device. Hence a 7-segment plus
decimal point package will only require nine pins but they usually have more pins due to
packaging standards.
Multiplexing

In this experiment, we will study the basic multiplexing technique of interfacing an array of
four 7-segment displays with AT89C51 microcontroller. Multiplexing is required when we
want to interface 3 or 4 or even more such displays with MCUs since it we go for normal
way it will require lots of I/O ports. So the smart way is multiplexing.

Multiplexing achieved by tricking our eyes. Only one display is active at a time but we see all
of them active. For multiplexing all the displays are connected in parallel such that if you
activate any segment, say ‘a’ the ‘a’ segment of all displays glows up. But the trick is that we
can switch on and off the “common” line of the displays under MCU control. So if we wish to
light up the ‘a’ segment of display 2 we simply switch on display 2 first by applying proper
level at the base of its driving transistor as shown in figure.

If we like to display the digit say “123” on three displays first we select disp-3 by applying a
“low” level at the base of transistor Q1 and output the code of required digit at the data input
terminals. Since display 3 is selected “1” is displayed in disp-3 then we wait for some time and
select disp-2 and output code of digit “2”. This “2” will be shown in disp-2. Then we select
display-1 and output code for digit “3”.

If we repeat this step fast enough (not a problem with MCUs !) what we get due to persistence
of vision is that we see the number “123” displayed “still” in the display as if all the displays
are active simultaneously.
C code for multiplexing two seven segment displays
/*
* seven_seg.c
*
* Created: 2/27/2019 2:21:06 AM
* Author : abc
*/

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRD=0xFF;
unsigned char i;

while (1)
{
for (i=0; i<=99; i++)
{
PORTD =i;
_delay_ms(500);

return 0;
}
Simulation
Lab Task
Advanced digital calculator using seven segments
Design an advanced version of the digital calculator using microcontroller and seven segments.
Microcontroller based digital calculator has two inputs A and B. You may use any port or pins of
your choice. Both input A and B should operate on numbers in a range 0 to 7. Your calculator
should be able to perform Addition, Subtraction and Multiplication, OR, AND, and XOR
operations. The operations are controlled by OP input. This input is of 3-bit width. The result of
computation is displayed on any port (pins) of your choice. The results of computation should be
displayed on 7-segment which is interfaced on PORTD.
Requirements:
• Make the complete block diagram of the system indicating input/outputs. (10)
• Make a circuit of your complete design by indicating discrete components. (10)
• Perform the simulation in software (Atmel studio + Proteus ISIS), attach printed
screenshots of successful simulations. (20)
• Write down the codes in your lab report (No typed code will be accepted). (30)
• Use of optimized hardware resources like Pins, Ports, Memory etc is encouraged. (10)

Bonus:
A reset/clear button can be added to the existing system. By pressing that pushbutton, the system
will again go the ‘ready’ state and will take new inputs. (20)

Submission:
• Perform all simulations/hardware implementation before next lab.
• Submit the report of this task before next lab.
Lab Report

Q1: Write embedded C Code for creating delay of approximately 0.5 seconds using for
loop?
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

Q2: How system will behave when the multiplexing time of 7-segments is increased too
much?
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

Q3: What are the different components of Embedded Systems?


__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

Q4: How much RAM and ROM is available in atmega32 microcontroller, also state the
difference between them?
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

You might also like