如何用vhdl语言编写一个8位七段数码管 实现动态扫描,比如让8位数码管在同一时刻分别显示876543210;
发布网友
发布时间:2022-04-30 03:51
我来回答
共1个回答
热心网友
时间:2023-10-10 11:17
PROCESS (HighCLK) --动态数码管控制显示部分
BEGIN
IF HighCLK 'EVENT AND HighCLK ='1' THEN
CASE Q IS
WHEN 0 => Y<="000"; VIEW<=h(7 DOWNTO 4); Q<= 1;
WHEN 1 => Y<="001"; VIEW<=h(3 DOWNTO 0); Q<= 2;
WHEN 2 => Y<="010"; VIEW<=c(7 DOWNTO 4); Q<= 3;
WHEN 3 => Y<="011"; VIEW<=c(3 DOWNTO 0); Q<= 4;
WHEN 4 => Y<="100"; VIEW<=s(7 DOWNTO 4); Q<= 5;
WHEN 5 => Y<="101"; VIEW<=s(3 DOWNTO 0); Q<= 6;
WHEN 6 => Y<="110"; VIEW<="0000"; Q<= 7;
WHEN 7 => Y<="111"; VIEW<="0000"; Q<= 0;
WHEN OTHERS => Q <= 0;
END CASE;
ELSE NULL;
END IF;
END PROCESS;
给分吧
HighCLK是扫描时钟设一个较高的时钟就行,我一般是设定为2000 HZ,VIEW 接你要显示的信号,Y 控制第几个数码管显示,比如你要第一个数码管显示8就把第一条改成:
WHEN 0 => Y<="000"; VIEW<="1000"; Q<= 1;