Sie sind auf Seite 1von 2

Binary to 7-Segment Decoder

We will be implementing a Binary Coded Decimal (BCD) to 7-Segment decoder. These


decoders are commonly used when using a 7-segment display as seen in igure !.
"ach #"D$ labeled a-g$ ta%es a high or a low &alue. 'sing these #"Ds$
we can create numbers that are easily readable. or this lab$ we will be
ta%ing a ( bit BCD input and outputting the 7-segment e)ui&alent to our
#"Ds.
The *e+ys , board has ( se&en segment displays. We will only be using
one o- these displays -or this lab. There are details -or using it on page , o-
this document.
igure !. 7-segment display
/ere is the truth table -or the decoder -or an acti&e high de&ice. The display column represents
what number it would appear as on a 7-segment display. The outputs a-g correspond to the sames
&alues in igure !.
While this de&ice can be implemented using combination logic$ it is -ar easier to implement
using a case statement. We ha&e used these be-ore$ but here is an e+ample.
case input is
when 010 23 output 42 0!05
when 0!0 23 output 42 0105
end case5
Binary a b c d e f g Display
0000 1 1 1 1 1 1 0 0
0001 0 1 1 0 0 0 0 1
0010 1 1 0 1 1 0 1 2
0011 1 1 1 1 0 0 1 3
0100 0 1 1 0 0 1 1 4
0101 1 0 1 1 0 1 1 5
0110 1 0 1 1 1 1 1 6
0111 1 1 1 0 0 0 0 7
1000 1 1 1 1 1 1 1 8
1001 1 1 1 0 0 1 1 9
1010 1 1 1 0 1 1 1 a
1011 0 0 1 1 1 1 1 b
1100 0 0 0 1 1 0 1 c
1101 0 1 1 1 1 0 1 d
1110 1 0 0 1 1 1 1 e
1111 1 0 0 1 0 0 1 f
This would simply chec% the &alue o- a one bit input$ and set the output to be the in&erse o- the
input. 'sing the case statement$ you can chec% the input and set the output accordingly.
or this lab$ you must implement the decoder on your board and generate a wa&e-orm.
*e+ys , Se&en Segment Display
igure ,. 6inout -or *e+ys , se&en segment display
igure , is ta%en -rom the *e+ys , re-erence manual. This shows the mapping o- the se&en
segment displays to the 678. 9ou will need this in-ormation to write your uc- -ile. The way it wor%s
is that all o- the :a; lines are connected together -or all o- the displays$ and so -orth -or lines a-g. The
lines labeled :8*1; through :8*<; are select lines -or each display. The other piece o- in-ormation
that is %ey to using the se&en segment displays is that they are acti&e low de&ices.
/ere is a simple e+ample. =- = wanted to display an > on the le-t most se&en segment display$ the
-irst thing = would do is chec% the truth table. 8n > corresponds to the &alue :!!!!!!!!; on an acti&e
high de&ice. Since we are using acti&e low$ it is in&erted to :1111111;. = would set my output to this
&alue$ so a 2 1$ b 2 1$ an so on. 8lternati&ely = could set output(?) 2 1$ output(@) 2 1$ etc assuming that
output(?) corresponds to the a line and output(1) to the g line.
*ow$ to select the le-t most display$ = would set 8*1 2 1$ 8*! 2 !$ 8*, 2 !$ 8*< 2 !. Since it
is an acti&e low de&ice$ setting 8*!- 8*< to ! deacti&ates them.
=n summary$ to display an >$ = would set output 2 :1111111;$ 8*1 2 1$ 8*! 2 !$ 8*, 2 !$
8*< 2 !.

Das könnte Ihnen auch gefallen