其原理如图
数码管的具体使用
根据其管理图比如说我想点亮显示一个3,我只需要把a、b、c、d、g设置成高电平,把其余设置成低电平即可。
效果图如下
以后所用的译码代码如下:
p4:process(num)--num为要显示的数字、abc为段选
begin
if(num=0) then
abc<="0000001";
elsif(num=1) then
abc<="1001111";
elsif(num=2) then
abc<="0010010";
elsif(num=3) then
abc<="0000110";
elsif(num=4) then
abc<="1001100";
elsif(num=5) then
abc<="0100100";
elsif(num=6) then
abc<="0100000";
elsif(num=7) then
abc<="0001111";
elsif(num=8) then
abc<="0000000";
elsif(num=9) then
abc<="0000100";
end if;
end process p4;