集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 6757|回复: 17

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

[复制链接]
encounter 发表于 2010-6-26 01:19:54 | 显示全部楼层 |阅读模式
想用四个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
       
ut std_logic_vector(6 downto 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;cs
       
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 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-6-24 15:31 , Processed in 0.093949 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表