Verilog、FPGA

来源:百度知道 编辑:UC知道 时间:2024/06/05 19:34:14
想编写一个4*4键盘输入数字到LED数码管上显示的程序,请高手提示一些思路,我自己编写。别人说要抖动,我不知道什么意思。请说详细点,每个步骤都说一下。我可以多加分。急!
我买板子的时候附带光盘里有一个VHDL得程序,我看不懂啊。

楼上兄弟是用VHDL写的,要编写这个程序还是要看你的具体电路的。
不是要抖动,是要写去抖动的程序。去抖动是键盘程序必须写的,只要你学了单片机微机这个应该知道,就是单片机接键盘外设的时候书上有提到的。
一般是用查询的方式查键盘的值,采用的是状态机的思想。

这个不难,
试试我下面这个程序.希望你能学会.

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity key_scan is
port(clk0,clk2,cr: in std_logic;
col: in std_logic_vector(3 downto 0);
a1,b1,c1,d1,e1,f1,g1:out std_logic;
row:out std_logic_vector(3 downto 0);
p78:out std_logic);
end entity;

architecture art of key_scan is
signal line:std_logic_vector(3 downto 0);
signal bcdmin,bcdmo:std_logic_vector(3 downto 0);
signal clr:std_logic;

begin
p78<='1';
P1:process(clk0)
begin
if(clr='0')then
line<="1000";
elsif(clk0'event and clk0='1') then
line(3 downto 0)<=line(2 downto 0) & li