VHDL_3641BS四个7段数码管显示实验
来源:互联网 发布:centos 重启后ip消失 编辑:程序博客网 时间:2024/05/17 09:05
VHDL_3641BS四个7段数码管显示实验
DATE:2016/10/27
CSDN主页
硬件连接图
以上为我开发版的硬件连接图,到手就是这样没办法改.使用的数码管为3641BS(共阳极)
从上图可知,我们使用四个共阳引脚作为每个数码管的片选信号,所以在代码器件里面我写了如下信号
entity led is port ( clkin:in std_logic; clkout:out std_logic_vector(7 downto 0); enout:out std_logic_vector(3 downto 0) );
在这个实验当中,我们只能选择使用片选分别选其中某一个数码管来进行显示,所以我们这个是一个大循环,可以分频做也可以不分频做.
对于显示的内容,经过对七段数码管接线和程序管脚定义来看,我们可以算出如下列表
因为是共阳极的数码管,所以当公共脚为0,管脚为1的时候进行点亮
所以对于实体逻辑代码如下
architecture behave of led is signal mtime:std_logic_vector(15 downto 0);signal me:std_logic_vector(2 downto 0);signal m7_0:std_logic_vector(7 downto 0);signal m7_1:std_logic_vector(7 downto 0);signal m7_2:std_logic_vector(7 downto 0);signal m7_3:std_logic_vector(7 downto 0);begin process(clkin)begin if(clkin'event and clkin='1')then mtime<=mtime+1; if(mtime="1111111111111111")then mtime<=(others=>'0'); if(me="11")then me<=(others=>'0'); else me<=me+1; end if; end if; m7_0<="11000000"; m7_1<="11111001"; m7_2<="10100100"; m7_3<="10110000"; if(me="00")then enout<="1110"; clkout<=m7_0; end if; if(me="01")then enout<="1101"; clkout<=m7_1; end if; if(me="10")then enout<="1011"; clkout<=m7_2; end if; if(me="11")then enout<="0111"; clkout<=m7_3; end if; end if; end process;end behave;
完整代码
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity led is port (clkin:in std_logic;clkout:out std_logic_vector(7 downto 0);enout:out std_logic_vector(3 downto 0));end entity;architecture behave of led is signal mtime:std_logic_vector(15 downto 0);signal me:std_logic_vector(2 downto 0);signal m7_0:std_logic_vector(7 downto 0);signal m7_1:std_logic_vector(7 downto 0);signal m7_2:std_logic_vector(7 downto 0);signal m7_3:std_logic_vector(7 downto 0);begin process(clkin)begin if(clkin'event and clkin='1')then mtime<=mtime+1; if(mtime="1111111111111111")then mtime<=(others=>'0'); if(me="11")then me<=(others=>'0'); else me<=me+1; end if; end if; m7_0<="11000000"; m7_1<="11111001"; m7_2<="10100100"; m7_3<="10110000"; if(me="00")then enout<="1110"; clkout<=m7_0; end if; if(me="01")then enout<="1101"; clkout<=m7_1; end if; if(me="10")then enout<="1011"; clkout<=m7_2; end if; if(me="11")then enout<="0111"; clkout<=m7_3; end if; end if; end process;end behave;
0 0
- VHDL_3641BS四个7段数码管显示实验
- Zedboard---实验四驱动7段数码管
- 七段数码管显示
- 七段数码管显示
- 8段数码管显示
- 按键数码管显示实验
- 数码管显示实验
- 7段数码管自动全硬件显示器件
- 7段数码管显示驱动电路参数推导
- 【实验】动态显示二位七段数码管
- 数码管显示单元的实验
- 7.数码管动态显示实验
- SPI实验(数码管显示)
- 硬件实验2:数码管显示实验
- 七段数码管显示控制 (4个数码管)
- BCD-七段数码管显示译码器
- 7段数码管 数值编码
- 2*8键盘数码管显示实验
- 如何以最快的速度计算出一个二进制数中1的个数
- 接收通知中的语音输入(Receiving Voice Input in a Notification)
- 如何蒸螃蟹?教你蒸螃蟹3个小窍门
- 面向对象基础(一)
- “呼死你”重出江湖 如何避免骚扰电话?
- VHDL_3641BS四个7段数码管显示实验
- 在Angular中使用promise
- Android_app完美退出程序
- CRectTracker(橡皮筋)类的使用
- 理解Java传参
- 值得记录的面试题目(算法工程师)
- 各类开源库使用
- 呼叫中心如何培养新员工
- LINUX抓包命令详解-TCPdump