| 안녕하세요..HBE-Combo를 이용하여 vhdl을 공부하고 있는 전자과 학생입니다. 다름이 아니고. 제가 작성한(책에 있는예제ㅡ.ㅡ;) 프로그램을 7세그먼트로 해서.올릴려고 하는데. 출력이.y0,y1,y2,y3이면 일일이...번호를 지정해주닌깐. 세그먼트 전체에 숫자가 나오더라고요. 근데..이번에 책 예제를 따라한건..도저히 핀번호도 모지라고..매뉴얼을 암만 처다봐도 무스말인지 모를겠네요.뭐...com1, com2뭐..이런걸 해야될것같은데..
도와주세요...
<이프로그램입니다.>
library ieee;
use ieee.std_logic_1164.all;
entity display_control is
port(clk, reset : in std_logic;
counta_dec, countb_dec, countc_dec, countd_dec
: out std_logic_vector(6 downto 0));
end display_control;
architecture sample of display_control is
function dis_seg(cnt : integer range 0 to 15)return std_logic_vector is
variable seg_decode : std_logic_vector(6 downto 0);
begin
case cnt is
when 0=>seg_decode := 111111;
when 1=>seg_decode := 000110;
when 2=>seg_decode :=1011011;
when 3=>seg_decode :=1001111;
when 4=>seg_decode :=1100110;
when 5=>seg_decode :=1101101;
when 6=>seg_decode :=1111101;
when 7=>seg_decode := 100111;
when 8=>seg_decode :=1111111;
when 9=>seg_decode :=1100111;
when others=>seg_decode := 000000;
end case;
return(seg_decode);
end dis_seg;
signal counta,countb,countc,countd : integer range 0 to 9;
begin
a_counter : process(clk, reset)
begin
if reset =1 then
counta<=0;
elsif(clkevent and clk=1)then
if counta=9 then
counta <= 0;
else
counta <=counta + 1;
end if;
end if;
end process;
b_counter : process(clk, reset)
begin
if reset=1 then
countb <= 0;
elsif(clkevent and clk=1)then
if countb = 9 then
countb <= 0;
else
countb <= countb + 1;
end if;
end if;
end process;
c_counter : process(clk, reset)
begin
if reset=1 then
countc <= 0;
elsif(clkevent and clk=1)then
if countc = 9 then
countc <= 0;
else
countc <= countc + 1;
end if;
end if;
end process;
d_counter : process(clk, reset)
begin
if reset = 1 then
countd <= 0;
elsif(clkevent and clk=1)then
if countd = 9 then
countd <= 0;
else
countd <= countd + 1;
end if;
end if;
end process;
counta_dec<=dis_seg(counta);
countb_dec<=dis_seg(countb);
countc_dec<=dis_seg(countc);
countd_dec<=dis_seg(countd);
end sample; |