Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   7 segment 0-99 converter (http://www.velocityreviews.com/forums/t743749-7-segment-0-99-converter.html)

xenakis 02-17-2011 07:09 PM

7 segment 0-99 converter
 
Hi, I'm trying to make a decimal to 7 segment display converter for numbers from 0 to 99 in dataflow with synchronous clock (using a Clock process). It's my first VHDL attempt so I have some problems. My thought was to make an assignemt like this:

Code:

S(0) <= (P(0)) OR (P(2)) OR (NOT P(1) AND NOT P(3)) OR (P(1) AND P(3));
S(1) <= (NOT P(1)) OR (P(2) AND P(3)) OR (NOT P(2) AND NOT P(3));
S(2) <= (P(1) OR NOT P(2) OR P(3));
S(3) <= (P(0)) OR (NOT P(1) AND P(2)) OR (P(2) AND NOT P(3)) OR (NOT P(1) AND NOT P(2) AND NOT P(3)) OR (P(1) AND NOT P(2) AND P(3));
S(4) <= (P(2) AND NOT P(3)) OR (NOT P(0) AND NOT P(1) AND NOT P(3)) OR (P(0) AND NOT P(3));
S(5) <= (P(0)) OR (NOT P(2) AND NOT P(3)) OR (P(1) AND NOT P(2)) OR (P(1) AND NOT P(3));
S(6) <= (P(0)) OR (P(2) AND NOT P(3)) OR (P(1) AND NOT P(2)) OR (NOT P(0) AND NOT P(1) AND P(2));

where
Code:

P : in  BIT_VECTOR(0 TO 3);
S : out  BIT_VECTOR(0 TO 6));

but this is only for one 7 segment display, I need two of them and I don't know how to manage it. Moreover, how do I treat the clock process?
I'll appreciate any kind of suggestion.
Thank you.

joris 02-17-2011 11:11 PM

Unless I'm totally misunderstanding the code you have there is to translate
a binary number (0000 - 1001) into the different segments.

I'll assume you'll give it the name bin2seg

You will also need a 'counter' entity which, given a clock input, will increment such that:

Code:

inc state  next | C
0  no change    0
1  0000  0001  0
1  0001  0010  0
1  0010  0011  0
1  0011  0100  0
1  0100  0101  0
1  0101  0110  0
1  0110  0111  0
1  0111  1000  0
1  1000  1001  0
1  1001  0000  1

Assuming that's called bcd9Counter

Then you can use these entities as building parts:

Code:

bcd1map : bcd9Counter port map ( clk, b1In, '1' -- for increment
  b1Out, c1);
bcd2map : bcd9Counter port map ( clk, b2In, c1,
  b2Out, c2);

bin2seg1Map: bin2seg port map (b1In, seg1);
bin2seg2Map: bin2seg port map (b2In, seg2);



All times are GMT. The time now is 09:50 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57