- 26
- 0
- 约2.4千字
- 约 6页
- 2022-07-22 发布于四川
- 举报
百进制计数器
位设计要求:在数码管上实现0-99的递增与递减循环计数。
但 设计目的:通过实验更透彻的掌握编写程序的能力,并且拓展VHDL语言的应用o
但设计原理:
但 硬件要求:主芯片EMP240T100C5, 1个拨码开关,数码管
但设计步骤:
.使用Quartus II新建一个工程ybjz,输入源程序后,进行编
译。
.进行仿真测试。
.进行引脚分配:
Node Name
Direction
Location
1
■
dk
Input
PIN_12
2
dis [6]
Output
PIN_99
3
dis [5]
Output
PIN_98
4
dis [可
Output
PIN_97
5
dis [3]
Output
PIN_96
6
dis [2]
Output
PIN_95
7
dis[l]
Output
PIN_92
8
dis[0]
Output
PIN_91
9
r[5]
Output
PIN_6
10
r[4]
Output
PIN_5
11
r[3]
Output
PIN_4
12
r[2]
Output
PIN_3
13
r[l]
Output
PIN_2
14
r[0]
Output
PIN_1
15
■
reset
Input
PIN_30
.下载结果到EMP240开发板,以及通过数码管验证结果是否
正确。
原理图:
源程序:
库library ieee;
use ieee.std_logic_l 164.all;use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;实体
entity ybjz2 isport(clk:in std」ogic;
reset:in stdjogic;加法,减法计数的控制 dis:out std_logic_vector(6 downto 0)—数码管的段选--
r:out std_logic_vector(5 downto 0));--数码管的位选-- end ybjz2;结构体
architecture one of ybjz2 issignal m,n,z:integer range 0 to 9;
signal clkl:std_logic;signal clk2:std_logic;
signal led integer range 0 to 5;begin
1000分频与100分频程序process(clk)
variable ent 1 integer range 0 to 25000;variable cnt2: integer range 0 to 1000;
beginif rising_edge(clk) then
if ent 1=25000 thencntl:=0;
clkl=not clkl;if cnt2= 1000 then
cnt2:=0;clk2=not clk2;
elsecnt2:=cnt2+l;
end if;else
cntl:=cntl+l;end if;
end if;end process;
计数process (clk2,reset)
beginif clk2!event and clk2=T then
if reset=,r thenif m=9 then
m=0;if n-9 then
n=0;else
n=n+l;end if;
elsem=m+l;
end if;end if;
if reset=,O, thenif m=0 then
m=9;if n=0 then
n=9;else
n=n-l;end if;
elsem=m-1;
end if;end if;
end if;end process;
数码管地址扫描process(clkl)
beginif rising_edge(clkl) then
if led=l thenled=0;
elseled=led+1;
end if;end if;
end process;选择
process(clkl)begin
case led iswhen 0=z=m;r=n01111 ln;
when l=z=n;r=101111;when others=〉z=0;r= 111117;
end case;end process;
七段译码process(clkl,z,led)
begincase z is when 0=dis=01111ir,;
when l=dis=0000110;when 2=dis=10110HH;
when 3=dis=H 1001 111;when 4=dis=1100110;
when 5=dis=1101101;when 6=dis=111 1101;
when
您可能关注的文档
- (3)安全情况登记表.docx
- 鲸的自述五年级作文450字3篇.docx
- 高校咖啡文化节活动意义.docx
- 面试感谢信集锦三篇.docx
- 青少年儿童防溺水工作预案.docx
- 锦纶工厂自动控制水平.docx
- 锅炉的燃煤设施.docx
- 锅炉房供暖通风.docx
- 车辆状况告知书.docx
- 路基填筑试验段技术施工方案.docx
- 税务局重磅发文!委托代征范围变啦!个人灵活就业、新个体经营被列入!.docx
- 2019年11月1日后发票丢失了怎么办.docx
- 基于MC11的声学仿真软件.pdf
- 关于贯彻实施契税法若干事项执行口径的公告的解读.docx
- 突发!增值税起征点调至5000元起!税务总局放大招了!即日起,电商缴税都按这个来,刷单补3年税!.docx
- 新旧收入准则下44项会计业务处理差异对比.docx
- 强化科技驱动乡村全面振兴:根本遵循、政策演进与对策思考.pdf
- 中国式现代化视域下推进乡村全面振兴的历史脉络、价值导向及实践要求.pdf
- 乡村全面振兴视阈下“空心村”治理路径研究——以郝家桥村为例.pdf
- 改制重组契税优惠政策延续.docx
原创力文档

文档评论(0)