完整word版数电实验实验报告Quartus数码管循环显示.docx
- 文档编号:7590071
- 上传时间:2023-01-25
- 格式:DOCX
- 页数:13
- 大小:362.44KB
完整word版数电实验实验报告Quartus数码管循环显示.docx
《完整word版数电实验实验报告Quartus数码管循环显示.docx》由会员分享,可在线阅读,更多相关《完整word版数电实验实验报告Quartus数码管循环显示.docx(13页珍藏版)》请在冰豆网上搜索。
完整word版数电实验实验报告Quartus数码管循环显示
实验10
1、结果:
同时显示012345
代码:
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYsweepIS
PORT(
clk,clr:
INSTD_LOGIC;--clk输入时钟;clr状态清零
a:
OUTSTD_LOGIC_VECTOR(6DOWNTO0);--输出数码管相同段
sweep:
OUTSTD_LOGIC_VECTOR(5DOWNTO0)--输出cat(数码管选通控制信号)端
);
ENDsweep;
ARCHITECTUREsweep_archOFsweepIS
SIGNALsweep_arc:
STD_LOGIC_VECTOR(5DOWNTO0);--声明内部信号(选通控制信号)
SIGNALb:
STD_LOGIC_VECTOR(6DOWNTO0);--声明内部信号(相同段信号)
BEGIN
PROCESS(sweep_arc)
BEGIN
IF(clk'eventandclk='1')THEN
IFclr='0'THEN--状态清零
sweep_arc<="011111";b<="0000000";
ELSE
casesweep_arcIS--选通控制信号
WHEN"011111"=>sweep_arc<="111110";
WHEN"111110"=>sweep_arc<="111101";
WHEN"111101"=>sweep_arc<="111011";
WHEN"111011"=>sweep_arc<="110111";
WHEN"110111"=>sweep_arc<="101111";
WHEN"101111"=>sweep_arc<="011111";
WHENOTHERS=>sweep_arc<="011111";
ENDCASE;
CASEsweep_arcIS--相同段信号
WHEN"011111"=>b<="1011011";
WHEN"101111"=>b<="0110011";
WHEN"110111"=>b<="1111001";
WHEN"111011"=>b<="1101101";
WHEN"111101"=>b<="0110000";
WHEN"111110"=>b<="1111110";
WHENOTHERS=>b<="0000000";
ENDCASE;
ENDIF;
ENDIF;
sweep<=sweep_arc;
a<=b;
ENDPROCESS;
END;
仿真:
管脚:
2、
(1)结果:
循环显示:
012345—123450—234501—345012—450123—501234—012345
代码:
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYsweep2IS
PORT(clk:
INSTD_LOGIC;--clk输入时钟
sweep2:
OUTSTD_LOGIC_VECTOR(5DOWNTO0);--输出数码管相同段
a:
OUTSTD_LOGIC_VECTOR(6DOWNTO0)--输出cat(数码管选通控制信号)端
);
ENDsweep2;
ARCHITECTUREarc_sweep2OFsweep2IS
SIGNALnumber:
INTEGERRANGE0TO6;--状态声明(6种状态,7种状态值)
SIGNALn:
INTEGERRANGE0TO6;--声明数码管(6个管,7个值)
SIGNALflag:
INTEGERRANGE0TO50;--同一状态运行次数
BEGIN
PROCESS(clk)
BEGIN
IF(clk'eventANDclk='1')THEN
IFn>5THEN
n<=0;
ELSEn<=n+1;
flag<=flag+1;
ENDIF;
IFflag>20THEN
flag<=0;
number<=number+1;
ENDIF;
IFnumber>5THEN
number<=0;
ENDIF;
CASEnumberIS
WHEN0=>--状态0,输出012345
CASEnIS
WHEN0=>sweep2<="011111";a<="1111110";
WHEN1=>sweep2<="101111";a<="0110000";
WHEN2=>sweep2<="110111";a<="1101101";
WHEN3=>sweep2<="111011";a<="1111001";
WHEN4=>sweep2<="111101";a<="0110011";
WHEN5=>sweep2<="111110";a<="1011011";
WHENOTHERS=>sweep2<="111111";
ENDCASE;
WHEN1=>----状态1,输出123450
CASEnIS
WHEN0=>sweep2<="011111";a<="0110000";
WHEN1=>sweep2<="101111";a<="1101101";
WHEN2=>sweep2<="110111";a<="1101101";
WHEN3=>sweep2<="111011";a<="1111001";
WHEN4=>sweep2<="111101";a<="0110011";
WHEN5=>sweep2<="111110";a<="1111110";
WHENOTHERS=>sweep2<="111111";
ENDCASE;
WHEN2=>--状态2,输出234501
CASEnIS
WHEN0=>sweep2<="011111";a<="1101101";
WHEN1=>sweep2<="101111";a<="1111001";
WHEN2=>sweep2<="110111";a<="0110011";
WHEN3=>sweep2<="111011";a<="1011011";
WHEN4=>sweep2<="111101";a<="1111110";
WHEN5=>sweep2<="111110";a<="0110000";
WHENOTHERS=>sweep2<="111111";
ENDCASE;
WHEN3=>--状态3,输出345012
CASEnIS
WHEN0=>sweep2<="011111";a<="1111001";
WHEN1=>sweep2<="101111";a<="0110011";
WHEN2=>sweep2<="110111";a<="1011011";
WHEN3=>sweep2<="111011";a<="1111110";
WHEN4=>sweep2<="111101";a<="0110000";
WHEN5=>sweep2<="111110";a<="1101101";
WHENOTHERS=>sweep2<="111111";
ENDCASE;
WHEN4=>--状态4,输出450123
CASEnIS
WHEN0=>sweep2<="011111";a<="0110011";
WHEN1=>sweep2<="101111";a<="1011011";
WHEN2=>sweep2<="110111";a<="1111110";
WHEN3=>sweep2<="111011";a<="0110000";
WHEN4=>sweep2<="111101";a<="1101101";
WHEN5=>sweep2<="111110";a<="1111001";
WHENOTHERS=>sweep2<="111111";
ENDCASE;
WHEN5=>--状态5,输出501234
CASEnIS
WHEN0=>sweep2<="011111";a<="1011011";
WHEN1=>sweep2<="101111";a<="1111110";
WHEN2=>sweep2<="110111";a<="0110000";
WHEN3=>sweep2<="111011";a<="1101101";
WHEN4=>sweep2<="111101";a<="1111001";
WHEN5=>sweep2<="111110";a<="0110011";
WHENOTHERS=>sweep2<="111111";
ENDCASE;
WHENOTHERS=>sweep2<="111111";
ENDCASE;
ENDIF;
ENDPROCESS;
ENDarc_sweep2;
仿真:
仿真时将循环次数改为1方便观察波形,共6种状态
管脚:
2、
(2)结果:
循环显示:
012345—12345X—2345XX—345XXX—45XXXX—5XXXXX—XXXXXX—XXXXX0—XXXX01—XXX012—XX0123—X01234—012345
代码:
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYsweep3IS
PORT(clk:
INSTD_LOGIC;--clk输入时钟
sweep3:
OUTSTD_LOGIC_VECTOR(5DOWNTO0);--输出数码管相同段
a:
OUTSTD_LOGIC_VECTOR(6DOWNTO0)--输出cat(数码管选通控制信号)端
);
ENDsweep3;
ARCHITECTUREarc_sweep3OFsweep3IS
SIGNALnumber:
INTEGERRANGE0TO12;--状态声明(12种状态,13种状态值)
SIGNALn:
INTEGERRANGE0TO6;--声明数码管(6个管,7个值)
SIGNALflag:
INTEGERRANGE0TO50;--同一状态运行次数
BEGIN
PROCESS(clk)
BEGIN
IFclk'eventANDclk='1'THEN
IFn>5THEN
n<=0;
ELSEn<=n+1;
flag<=flag+1;
ENDIF;
IFflag>20THEN
flag<=0;
number<=number+1;
ENDIF;
IFnumber>11THEN
number<=0;
ENDIF;
CASEnumberIS
WHEN0=>--状态0,输出012345
CASEnIS
WHEN0=>sweep3<="011111";a<="1111110";
WHEN1=>sweep3<="101111";a<="0110000";
WHEN2=>sweep3<="110111";a<="1101101";
WHEN3=>sweep3<="111011";a<="1111001";
WHEN4=>sweep3<="111101";a<="0110011";
WHEN5=>sweep3<="111110";a<="1011011";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN1=>--状态1,输出12345X
CASEnIS
WHEN0=>sweep3<="011111";a<="0110000";
WHEN1=>sweep3<="101111";a<="1101101";
WHEN2=>sweep3<="110111";a<="1101101";
WHEN3=>sweep3<="111011";a<="1111001";
WHEN4=>sweep3<="111101";a<="0110011";
WHEN5=>sweep3<="111111";a<="1111110";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN2=>--状态2,输出2345XX
CASEnIS
WHEN0=>sweep3<="011111";a<="1101101";
WHEN1=>sweep3<="101111";a<="1111001";
WHEN2=>sweep3<="110111";a<="0110011";
WHEN3=>sweep3<="111011";a<="1011011";
WHEN4=>sweep3<="111111";a<="1111110";
WHEN5=>sweep3<="111111";a<="0110000";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN3=>--状态3,输出345XXX
CASEnIS
WHEN0=>sweep3<="011111";a<="1111001";
WHEN1=>sweep3<="101111";a<="0110011";
WHEN2=>sweep3<="110111";a<="1011011";
WHEN3=>sweep3<="111111";a<="1111110";
WHEN4=>sweep3<="111111";a<="0110000";
WHEN5=>sweep3<="111111";a<="1101101";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN4=>--状态4,输出45XXXX
CASEnIS
WHEN0=>sweep3<="011111";a<="0110011";
WHEN1=>sweep3<="101111";a<="1011011";
WHEN2=>sweep3<="111111";a<="1111110";
WHEN3=>sweep3<="111111";a<="0110000";
WHEN4=>sweep3<="111111";a<="1101101";
WHEN5=>sweep3<="111111";a<="1111001";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN5=>--状态5,输出5XXXXX
CASEnIS
WHEN0=>sweep3<="011111";a<="1011011";
WHEN1=>sweep3<="111111";a<="1111110";
WHEN2=>sweep3<="111111";a<="0110000";
WHEN3=>sweep3<="111111";a<="1101101";
WHEN4=>sweep3<="111111";a<="1111001";
WHEN5=>sweep3<="111111";a<="0110011";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN6=>--状态6,输出XXXXXX
CASEnIS
WHEN0=>sweep3<="111111";a<="1111110";
WHEN1=>sweep3<="111111";a<="0110000";
WHEN2=>sweep3<="111111";a<="1101101";
WHEN3=>sweep3<="111111";a<="1111001";
WHEN4=>sweep3<="111111";a<="0110011";
WHEN5=>sweep3<="111111";a<="1011011";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN7=>--状态7,输出XXXXX0
CASEnIS
WHEN0=>sweep3<="111111";a<="0110000";
WHEN1=>sweep3<="111111";a<="1101101";
WHEN2=>sweep3<="111111";a<="1101101";
WHEN3=>sweep3<="111111";a<="1111001";
WHEN4=>sweep3<="111111";a<="0110011";
WHEN5=>sweep3<="111110";a<="1111110";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN8=>--状态8,输出XXXX01
CASEnIS
WHEN0=>sweep3<="111111";a<="1101101";
WHEN1=>sweep3<="111111";a<="1111001";
WHEN2=>sweep3<="111111";a<="0110011";
WHEN3=>sweep3<="111111";a<="1011011";
WHEN4=>sweep3<="111101";a<="1111110";
WHEN5=>sweep3<="111110";a<="0110000";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN9=>--状态9,输出XXX012
CASEnIS
WHEN0=>sweep3<="111111";a<="1111001";
WHEN1=>sweep3<="111111";a<="0110011";
WHEN2=>sweep3<="111111";a<="1011011";
WHEN3=>sweep3<="111011";a<="1111110";
WHEN4=>sweep3<="111101";a<="0110000";
WHEN5=>sweep3<="111110";a<="1101101";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN10=>--状态10,输出XX0123
CASEnIS
WHEN0=>sweep3<="111111";a<="0110011";
WHEN1=>sweep3<="111111";a<="1011011";
WHEN2=>sweep3<="110111";a<="1111110";
WHEN3=>sweep3<="111011";a<="0110000";
WHEN4=>sweep3<="111101";a<="1101101";
WHEN5=>sweep3<="111110";a<="1111001";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHEN11=>--状态11,输出X01234
CASEnIS
WHEN0=>sweep3<="111111";a<="1011011";
WHEN1=>sweep3<="101111";a<="1111110";
WHEN2=>sweep3<="110111";a<="0110000";
WHEN3=>sweep3<="111011";a<="1101101";
WHEN4=>sweep3<="111101";a<="1111001";
WHEN5=>sweep3<="111110";a<="0110011";
WHENOTHERS=>sweep3<="111111";
ENDCASE;
WHENOTHERS=>sweep3<="111111";
ENDCASE;
--ENDIF;
ENDIF;
ENDPROCESS;
ENDarc_sweep3;
仿真:
仿真时将循环次数改为1方便观察波形,共12种状态
管脚:
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 完整 word 版数电 实验 报告 Quartus 数码管 循环 显示