[go: up one dir, main page]

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

7SEG Interfacing

Ardiuno 7seg interfacing
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)
19 views4 pages

7SEG Interfacing

Ardiuno 7seg interfacing
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

International Islamic University Islamabad

Faculty of Engineering and Technology


Department of Electrical Engineering

MICROPROCESSORS AND MICROCONTROLLER LAB

Lab 2 : Seven Segment Display Interfacing with Arduino

Name:

Reg. No:

Date of
Experiment:

OBE Rubrics Evaluation

a) PSYCHOMOTOR (To be judged in the field/lab during experiment)


Sr. Level 1 Level 2 Level 3 Level 4 Level 5 Marks
Criteria
No. (0%) (25%) (50%) (75%) (100%) Obtained
0 1.25 2.5 3.75 5
Practical
With several With few With some Without
Implementation/
1 critical errors, errors, errors, errors,
Arrangement of Absent
incomplete incomplete complete complete
Equipment
and not neat and not neat but not neat and neat
Use of 0 0.5 1 1.5 2
Equipment or
2 Limited Some Considerable
Simulation/ Absent Competence
competence competence competence
Programming Tool

(b) COGNITIVE (To be judged on the copy of experiment submitted)


Sr. Level 1 Level 2 Level 3 Level 4 Level 5 Marks
Criteria
No. (0%) (25%) (50%) (75%) (100%) Obtained
Algorithm Design 0 0.25 0.5 0.75 1
or Data Record, Complete
3 Complete with Complete
Analysis and Absent Incorrect with few
some errors and Accurate
Evaluation errors

(c) AFFECTIVE (To be judged in the field/lab during experiment)


Sr. Level 1 Level 2 Level 3 Level 4 Level 5 Marks
Criteria
No. (0%) (25%) (50%) (75%) (100%) Obtained
Level of 0 0.5 1 1.5 2
Participation &
Good Encouraging
4 Attitude to Achieve Rare sensible Some sensible
Absent sensible sensible
Individual/Group interaction interaction
interaction interaction
Goals

5 Total Marks Obtained (Out of 10):

Lab 2: Seven Segment Display Interfacing with Arduino Page 12


Objectives:
 7 segment display interfacing and programming.
 To understand the multiplexing technique.
Introduction:
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
numerals. A single LED is used inside one segment to radiate light through it. If cathodes
of all the LEDs are common, this type of display is called common cathode and for
common anode type display, anode of all LEDs are common and connected to the
common pin.

Multiplexing:
Multiplexing is required when we want to interface more than one displays with
microcontroller. If we interface them normally, they will require lots of I/O ports. In
multiplexing, only one display is kept 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 we can switch ON and OFF
the “common” line of the displays with the Microcontroller pins. So if we wish to light
up the ‘a’ segment of display 1 we simply switch on display 1 first by applying ground
level (for common cathode display) at the common pin of the display and then send a
high signal on the I/O pin connected to segment ‘a’ to lit it.

Lab 2: Seven Segment Display Interfacing with Arduino Page 13


No. . g f e d c b a Hex
0 0 0 1 1 1 1 1 1 0x3F
1 0 0 0 0 0 1 1 0 0x06
2 0 1 0 1 1 0 1 1 0x5B
3 0 1 0 0 1 1 1 1 0x4F
4 0 1 1 0 0 1 1 0 0x66
5 0 1 1 0 1 1 0 1 0x6D
6 0 1 1 1 1 1 0 1 0x7D
7 0 0 0 0 0 1 1 1 0x07
8 0 1 1 1 1 1 1 1 0x7F
9 0 1 1 0 1 1 1 1 0x6F

Schematic:
a a

g g

PORTD Pins PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
Arduino Pins 7 6 5 4 3 2 1 0
Seven Segment Pins DP G F E D C B A

Lab 2: Seven Segment Display Interfacing with Arduino Page 14


Sketch for Two Digit 7 Segment Displays: Counting from 00 to 99

#define SEG0_PIN 8
#define SEG1_PIN 9
byte Count;
byte Seven_Segment[] = {
0x3F, 0x06, 0x5B, 0x4F, 0x66,
0x6D, 0x7D, 0x07, 0x7F, 0x6F
};
void Display(byte No)
{
byte units, tens;
tens = No / 10; // Separate tens from a number
units = No % 10; // Separate units from a number

for (int I = 0 ; I < 20 ; I++) // Show for 2 seconds


{
digitalWrite(SEG1_PIN,LOW); // Turn OFF SEG1
PORTD = Seven_Segment[units]; // Display units on SEG0
digitalWrite(SEG0_PIN,HIGH); // Turn ON SEG0
delay(50);

digitalWrite(SEG0_PIN,LOW); // Turn OFF SEG0


PORTD = Seven_Segment[tens]; // Display tens on SEG1
digitalWrite(SEG1_PIN,HIGH); // Turn ON SEG1 to show tens
delay(50);
}
}

void setup(){
DDRD = 0xFF; // OUPTPUT PORTS FOR SEVEN SEGMENT DISPLAYS
pinMode(SEG0_PIN,OUTPUT); // SELECT LINE(pin# 08) FOR SEG0
pinMode(SEG1_PIN,OUTPUT); // SELECT LINE(pin# 09) FOR SEG1
}

void loop(){
Display(Count++); // Displays two digit value on 7 segments
if(Count > 99)
Count = 0;
}

Lab Task:
Show hexadecimal numbers from 00 to FF on two seven segment displays

Lab 2: Seven Segment Display Interfacing with Arduino Page 15

You might also like