encounter 发表于 2010-6-26 01:19:54

用VHDL写一个动态显示?想用四个LED动态显示我的数据输入是11位BCD码现在想显示

想用四个LED动态显示我的数据输入是11位BCD码现在想显示

usd 发表于 2010-6-26 02:52:36

论坛怎摸这样了.没人回铁,只好自己顶了

ANG 发表于 2010-6-26 03:24:47

很正常啊白雪皑皑

CHANG 发表于 2010-6-26 03:40:45

原帖由 sky_xue 于 2006-5-26 16:24 发表<br>
我现在想用四个LED动态显示我的数据输入是11位BCD码现在想显示!我的信箱:sky-wangxue@163.com<br>
请会的大侠帮一下 看起来楼主打算全程让别人代劳,为什么不自己思考着尝试去做,遇到具体问题在具体请教呢?学习态度可不是很端正哦!

ANG 发表于 2010-6-26 05:11:26

这个问题应该没人回答

encounter 发表于 2010-6-26 05:30:17

慢慢等吧!!!

inter 发表于 2010-6-26 06:11:59

library ieee;<br>
use ieee.std_logic_1164.all;<br>
use ieee.std_logic_unsigned.all;<br>
use ieee.std_logic_arith.all;<br>
entity shaomiao is<br>
&nbsp; &nbsp;generic(size:integer:=4);<br>
&nbsp; &nbsp;port(d0,d1,d2,d3:in std_logic_vector(3 downto 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;clk:in std_logic;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;dout
        http://bbs.vibesic.com/images/smilies/default/shocked.gif
ut std_logic_vector(6 downto 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;cs
        http://bbs.vibesic.com/images/smilies/default/shocked.gif
ut std_logic_vector(size-1 downto 0));<br>
end shaomiao;<br>
architecture behavior of shaomiao is<br>
type state is (s0,s1,s2,s3);<br>
signal prestate,nexstate:state;<br>
signal A:std_logic_vector(3 downto 0);<br>
begin<br>
&nbsp; &nbsp;process(clk)<br>
&nbsp; &nbsp;&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;&nbsp; &nbsp; if(clk'event and clk='1')then<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;prestate&lt;=nexstate; <br>
&nbsp; &nbsp;&nbsp; &nbsp; end if;<br>
&nbsp; &nbsp;end process;<br>
&nbsp; &nbsp;process(prestate)<br>
&nbsp; &nbsp;&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;case prestate is<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when s0=&gt;nexstate&lt;=s1;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when s1=&gt;nexstate&lt;=s2;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when s2=&gt;nexstate&lt;=s3;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when others=&gt;nexstate&lt;=s0;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;end case;<br>
&nbsp; &nbsp;end process;<br>
&nbsp; &nbsp;process(prestate)<br>
&nbsp; &nbsp;&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;case prestate is<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when s0=&gt;A&lt;=d0;cs&lt;="0111";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when s1=&gt;A&lt;=d1;cs&lt;="1011";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when s2=&gt;A&lt;=d2;cs&lt;="1101";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when others=&gt;A&lt;=d3;cs&lt;="1110";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;end case;<br>
&nbsp; &nbsp;end process;<br>
&nbsp; &nbsp;process(A)<br>
&nbsp; &nbsp;&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;case A is<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0000"=&gt;dout&lt;="1111110";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0001"=&gt;dout&lt;="0110000";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0010"=&gt;dout&lt;="1101101";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0011"=&gt;dout&lt;="1111001";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0100"=&gt;dout&lt;="0110011";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0101"=&gt;dout&lt;="1011011";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0110"=&gt;dout&lt;="0011111";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"0111"=&gt;dout&lt;="1110000";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"1000"=&gt;dout&lt;="1111111";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when"1001"=&gt;dout&lt;="1111011";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;when others =&gt;dout&lt;="0000000";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;end case;<br>
&nbsp; &nbsp;end process;<br>
end behavior;

UFP 发表于 2010-6-26 08:05:28

恩,不错&nbsp; &nbsp;<br>
当然还得看硬件啦,LED是共阴或是共阳,程序肯能就要改改啦<br>
这程序真的不错啊

VVC 发表于 2010-6-26 09:43:55

顶了换钱~~~

usd 发表于 2010-6-26 10:06:37

最好自己先写出来,大家再来讨价了.
页: [1] 2
查看完整版本: 用VHDL写一个动态显示?想用四个LED动态显示我的数据输入是11位BCD码现在想显示