7-Segment Displays

20
7-Segment Displays Lecture L6.1 Section 6.3

description

7-Segment Displays. Lecture L6.1 Section 6.3. Turning on an LED. Turning on an LED. This is what we use in Lab. 7-Segment Display. a. f. b. g. e. c. d. 7-Segment Display. a b c d e f g 0 1 1 1 1 1 1 0 1 0 1 1 0 0 0 0 2 1 1 0 1 1 0 1 3 1 1 1 1 0 0 1 4 0 1 1 0 0 1 1 - PowerPoint PPT Presentation

Transcript of 7-Segment Displays

Page 1: 7-Segment Displays

7-Segment Displays

Lecture L6.1

Section 6.3

Page 2: 7-Segment Displays

Turning on an LED

+5VR LED

PLD output pin

+5VR LED

PLD output pin

1

0

+5V

+0.2V+1.7V

No current

Currentlight

no light

R =voltagecurrent

=5 1.7

15 x 10 -3 = 220 ohms

Page 3: 7-Segment Displays

Turning on an LED

This is whatwe use in Lab

CPLD output pin0 V R

No Current

LED

no light

CPLD output pin+3.2 V R

Current

LED

light

R = voltage = 3.2 - 1.9 = 325 ohms current 4 x 10^-3

+1.9 V 0 V

0 V

0

1

R = 330 ohms

Page 4: 7-Segment Displays

7-Segment Display

a b c d e f g

a b c d e f g

+5V

CommonAnode

CommonCathode

a

b

c

d

e

f

g

Page 5: 7-Segment Displays

7-Segment Displaya

b

c

d

e

f g

a b c d e f g0 1 1 1 1 1 1 01 0 1 1 0 0 0 02 1 1 0 1 1 0 13 1 1 1 1 0 0 14 0 1 1 0 0 1 15 1 0 1 1 0 1 16 1 0 1 1 1 1 17 1 1 1 0 0 0 0

Page 6: 7-Segment Displays

7-Segment Displaya

b

c

d

e

f g

a b c d e f g8 1 1 1 1 1 1 19 1 1 1 1 0 1 1A 1 1 1 0 1 1 1b 0 0 1 1 1 1 1C 1 0 0 1 1 1 0d 0 1 1 1 1 0 1E 1 0 0 1 1 1 1F 1 0 0 0 1 1 1

Page 7: 7-Segment Displays

K-Map for Segment e

1

1

1 1

1

D3 D2D1 D0

00 01 11 10

00

01

11

10

11

1

1

1D3 & D2 D1 & !D0

!D2 & !D0

e = D3 & D2 # !D2 & !D0 # D3 & D1 # D1 & !D0

D3 & D1

Page 8: 7-Segment Displays

MODULE hex7segINTERFACE ([D3..D0] -> [a,b,c,d,e,f,g]);TITLE 'hex to seven segment display decoder'" a" --- hex-to-seven-segment decoder " f| g |b" --- " e| d |c" ---DECLARATIONS " Input Pins "D3..D0 PIN; D = [D3..D0]; " 4-bit input vector " Output Pins "[a,b,c,d,e,f,g] PIN ISTYPE 'com'; " 7-segment LED display segs = [a,b,c,d,e,f,g];

hex7seg.abl Makes this module available in higher-level modules

Page 9: 7-Segment Displays

a b c d e f g0 1 1 1 1 1 1 01 0 1 1 0 0 0 02 1 1 0 1 1 0 13 1 1 1 1 0 0 14 0 1 1 0 0 1 15 1 0 1 1 0 1 16 1 0 1 1 1 1 17 1 1 1 0 0 0 0 8 1 1 1 1 1 1 19 1 1 1 1 0 1 1A 1 1 1 0 1 1 1b 0 0 1 1 1 1 1C 1 0 0 1 1 1 0d 0 1 1 1 1 0 1E 1 0 0 1 1 1 1F 1 0 0 0 1 1 1

@radix 16;EQUATIONSwhen (D == 0) then segs = 7E;when (D == 1) then segs = 30;when (D == 2) then segs = 6D;when (D == 3) then segs = 79;when (D == 4) then segs = 33;when (D == 5) then segs = 5B;when (D == 6) then segs = 5F;when (D == 7) then segs = 70;when (D == 8) then segs = 7F;when (D == 9) then segs = 7B;when (D == 0A) then segs = 77;when (D == 0B) then segs = 1F;when (D == 0C) then segs = 4E;when (D == 0D) then segs = 3D;when (D == 0E) then segs = 4F;when (D == 0F) then segs = 47;

END hex7seg

hex7seg.abl (cont.)HEX

Page 10: 7-Segment Displays

ON,OFF = 1,0; " for common cathode LEDs@radix 16;EQUATIONS

"[ a , b , c , d , e , f , g ]when (D == 0) then segs = [ ON, ON, ON, ON, ON, ON, OFF];when (D == 1) then segs = [OFF, ON, ON, OFF,OFF,OFF,OFF];when (D == 2) then segs = [ ON, ON, OFF,ON, ON, OFF, ON];when (D == 3) then segs = [ ON, ON, ON, ON, OFF,OFF, ON];when (D == 4) then segs = [OFF, ON, ON, OFF,OFF,ON, ON];when (D == 5) then segs = [ ON, OFF,ON, ON, OFF,ON, ON];when (D == 6) then segs = [ ON, OFF,ON, ON, ON, ON, ON];when (D == 7) then segs = [ ON, ON, ON, OFF,OFF,OFF,OFF];when (D == 8) then segs = [ ON, ON, ON, ON, ON, ON, ON];when (D == 9) then segs = [ ON, ON, ON, ON, OFF,ON, ON];when (D == 0A) then segs = [ ON, ON, ON, OFF,ON, ON, ON];when (D == 0B) then segs = [OFF, OFF,ON, ON, ON, ON, ON];when (D == 0C) then segs = [ ON, OFF,OFF,ON, ON, ON, OFF];when (D == 0D) then segs = [OFF, ON, ON, ON, ON, OFF, ON];when (D == 0E) then segs = [ ON, OFF,OFF,ON, ON, ON, ON];when (D == 0F) then segs = [ ON, OFF,OFF,OFF,ON, ON, ON];

END hex7seg

Alternate form of EQUATIONS

Page 11: 7-Segment Displays

a = (D0 & D2 & !D3 # !D1 & !D2 & D3 # !D0 & !D2 # D1 & !D3 # !D0 & D3 # D1 & D2);

b = (D0 & D1 & !D3 # D0 & !D1 & D3 # !D0 & !D1 & !D3 # !D0 & !D2 # !D2 & !D3);

c = (D2 & !D3 # !D2 & D3 # D0 & !D1 # !D1 & !D2 # D0 & !D2);

Compiled Equations

Note they are reduced

Page 12: 7-Segment Displays

d = (D1 & !D2 & !D3 # D0 & !D1 & D2 # !D0 & D1 & D2 # D0 & !D2 & D3 # !D0 & !D1 & !D2 # !D1 & D3);

e = (!D0 & !D2 # D2 & D3 # !D0 & D1 # D1 & D3);

f = (!D1 & D2 & !D3 # !D2 & D3 # !D0 & !D1 # !D0 & D2 # D1 & D3);

g = (!D1 & D2 & !D3 # D1 & !D2 # !D0 & D1 # !D2 & D3 # D0 & D3);

Compiled Equations (cont.)

Note that d is NOTcompletely reduced

Make Karnaugh map for d

Page 13: 7-Segment Displays

EQUATIONS @radix 16;truth_table (D -> [ a , b , c , d , e , f , g ]) 0 -> [ ON, ON, ON, ON, ON, ON, OFF]; 1 -> [OFF, ON, ON, OFF, OFF, OFF, OFF]; 2 -> [ ON, ON, OFF, ON, ON, OFF, ON]; 3 -> [ ON, ON, ON, ON, OFF, OFF, ON]; 4 -> [OFF, ON, ON, OFF, OFF, ON, ON]; 5 -> [ ON, OFF, ON, ON, OFF, ON, ON]; 6 -> [ ON, OFF, ON, ON, ON, ON, ON]; 7 -> [ ON, ON, ON, OFF, OFF, OFF, OFF]; 8 -> [ ON, ON, ON, ON, ON, ON, ON]; 9 -> [ ON, ON, ON, ON, OFF, ON, ON]; 0A -> [ ON, ON, ON, OFF, ON, ON, ON]; 0B -> [OFF, OFF, ON, ON, ON, ON, ON]; 0C -> [ ON, OFF, OFF, ON, ON, ON, OFF]; 0D -> [OFF, ON, ON, ON, ON, OFF, ON]; 0E -> [ ON, OFF, OFF, ON, ON, ON, ON]; 0F -> [ ON, OFF, OFF, OFF, ON, ON, ON]; END hex7seg

Another alternate form of EQUATIONS

Page 14: 7-Segment Displays

a = (D3 & D2 & D1 & D0 # !D3 & D2 & D1 & D0 # !D3 & !D2 & D1 & D0 # !D3 & D2 & !D1 & D0 # D3 & !D2 & !D1 & D0 # D3 & D2 & D1 & !D0 # !D3 & D2 & D1 & !D0 # D3 & !D2 & D1 & !D0 # !D3 & !D2 & D1 & !D0 # D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0 # !D3 & !D2 & !D1 & !D0);

b = (!D3 & D2 & D1 & D0 # !D3 & !D2 & D1 & D0 # D3 & D2 & !D1 & D0 # D3 & !D2 & !D1 & D0 # !D3 & !D2 & !D1 & D0 # D3 & !D2 & D1 & !D0 # !D3 & !D2 & D1 & !D0 # !D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0 # !D3 & !D2 & !D1 & !D0);

Compiled Equations

Note they are NOT reducedSum of all minterms

Page 15: 7-Segment Displays

c = (!D3 & D2 & D1 & D0 # D3 & !D2 & D1 & D0 # !D3 & !D2 & D1 & D0 # D3 & D2 & !D1 & D0 # !D3 & D2 & !D1 & D0 # D3 & !D2 & !D1 & D0 # !D3 & !D2 & !D1 & D0 # !D3 & D2 & D1 & !D0 # D3 & !D2 & D1 & !D0 # !D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0 # !D3 & !D2 & !D1 & !D0);

d = (D3 & !D2 & D1 & D0 # !D3 & !D2 & D1 & D0 # D3 & D2 & !D1 & D0 # !D3 & D2 & !D1 & D0 # D3 & !D2 & !D1 & D0 # D3 & D2 & D1 & !D0 # !D3 & D2 & D1 & !D0 # !D3 & !D2 & D1 & !D0 # D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0 # !D3 & !D2 & !D1 & !D0);

Page 16: 7-Segment Displays

e = (D3 & D2 & D1 & D0 # D3 & !D2 & D1 & D0 # D3 & D2 & !D1 & D0 # D3 & D2 & D1 & !D0 # !D3 & D2 & D1 & !D0 # D3 & !D2 & D1 & !D0 # !D3 & !D2 & D1 & !D0 # D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0 # !D3 & !D2 & !D1 & !D0);

f = (D3 & D2 & D1 & D0 # D3 & !D2 & D1 & D0 # !D3 & D2 & !D1 & D0 # D3 & !D2 & !D1 & D0 # D3 & D2 & D1 & !D0 # !D3 & D2 & D1 & !D0 # D3 & !D2 & D1 & !D0 # D3 & D2 & !D1 & !D0 # !D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0 # !D3 & !D2 & !D1 & !D0);

Page 17: 7-Segment Displays

g = (D3 & D2 & D1 & D0 # D3 & !D2 & D1 & D0 # !D3 & !D2 & D1 & D0 # D3 & D2 & !D1 & D0 # !D3 & D2 & !D1 & D0 # D3 & !D2 & !D1 & D0 # D3 & D2 & D1 & !D0 # !D3 & D2 & D1 & !D0 # D3 & !D2 & D1 & !D0 # !D3 & !D2 & D1 & !D0 # !D3 & D2 & !D1 & !D0 # D3 & !D2 & !D1 & !D0);

Page 18: 7-Segment Displays

main7seg.abl

d7Lhex7seg

d7Rhex7seg

L = S6_SW(1..4)

R = S7_SW(1..4) [a,b,c,d,e,f,g]

[aa,bb,cc,dd,ee,ff,gg]

Page 19: 7-Segment Displays

MODULE main7segTITLE 'hex to seven segment display decoder'

DECLARATIONShex7seg INTERFACE([D3..D0] -> [a,b,c,d,e,f,g]);d7L FUNCTIONAL_BLOCK hex7seg;d7R FUNCTIONAL_BLOCK hex7seg;

" Input Pins "L3..L0 PIN 11,7,6,5; " Left Switches S6 - 1..4L = [L3..L0]; " 4-bit input vector

R3..R0 PIN 4,3,2,1; " Right Switches S7 - 1..4R = [R3..R0]; " 4-bit input vector

d7Lhex7seg

d7Rhex7seg

L = S6_SW(1..4)

R = S7_SW(1..4) [a,b,c,d,e,f,g]

[aa,bb,cc,dd,ee,ff,gg]

Page 20: 7-Segment Displays

" Output Pins "

[aa,bb,cc,dd,ee,ff,gg]

PIN 57,58,61,62,63,65,66 ISTYPE 'com';

"Leftmost (tens) 7-segment LED display

[a,b,c,d,e,f,g]

PIN 15,18,23,21,19,14,17 ISTYPE 'com';

" Rightmost (units) 7-segment LED display

EQUATIONS

[aa,bb,cc,dd,ee,ff,gg] = d7L.[a,b,c,d,e,f,g];

d7L.[D3..D0] = L;

[a,b,c,d,e,f,g] = d7R.[a,b,c,d,e,f,g];

d7R.[D3..D0] = R;

END main7seg

d7Lhex7seg

d7Rhex7seg

L = S6_SW(1..4)

R = S7_SW(1..4) [a,b,c,d,e,f,g]

[aa,bb,cc,dd,ee,ff,gg]