목차
1. 실습주제
2.엘리베이터 동작절차분석
3.엘리베이터 운행에 영향을 끼치는 변수들 조사 .
4.엘리베이터 편의성을 높이기 위한 방안.
5. 후기
6.추가 해야할것들.
7.vhdl 소스코드
2.엘리베이터 동작절차분석
3.엘리베이터 운행에 영향을 끼치는 변수들 조사 .
4.엘리베이터 편의성을 높이기 위한 방안.
5. 후기
6.추가 해야할것들.
7.vhdl 소스코드
본문내용
s ( clk, sel_floor)
begin
if clk'event and clk = '1' then
-- 해당 층 선택 버튼이 눌려지면 해당 변수는 '1'로 설정되고 해당 층에
-- 도착할 경우 값은 '0'으로 된다.
if senser_floor(0) = '0' then
sel_floor(0) <= '0';
elsif bt_floor(0) = '0' then
sel_floor(0) <= '1';
end if;
if senser_floor(1) = '0' then
sel_floor(1) <= '0';
elsif bt_floor(1) = '0' then
sel_floor(1) <= '1';
end if;
if senser_floor(2) = '0' then
sel_floor(2) <= '0';
elsif bt_floor(2) = '0' then
sel_floor(2) <= '1';
end if;
if senser_floor(3) = '0' then
sel_floor(3) <= '0';
elsif bt_floor(3) = '0' then
sel_floor(3) <= '1';
end if;
end if;
led_sel_floor <= sel_floor;
end process;
-- 엘리베이터가 위치한 층을 7segment로 표시하기 위한 구문
process ( clk )
variable seg : std_logic_vector (6 downto 0);
begin
if clk'event and clk = '1' then
case senser_floor is
when "0111" =>
seg := "1100110";
floor <= "11";
when "1011" =>
seg :="1001111";
floor <= "10";
when "1101" =>
seg := "1011011";
floor <= "01";
when "1110" =>
seg := "0000110";
floor <= "00";
when "1111" =>
seg := seg;
floor <= floor;
when others =>
seg := "1111001";
floor <= floor;
end case;
end if;
seg_floor <= seg;
end process;
process(clk)
variable cnt_Hz : integer range 0 to 100;
variable cnt_Hzz : integer range 0 to 50;
begin
if clk'event and clk = '1' then
if cnt_Hz = 100 then
cnt_Hz := 0;
CLK_T <= NOT CLK_T;
else
cnt_Hz := cnt_Hz + 1;
end if;
if cnt_Hzz = 50 then
cnt_Hz := 0;
CLK_TT <= NOT CLK_TT;
else
cnt_Hzz := cnt_Hzz + 1;
end if;
end if;
end process;
process(soun,clk_t,clk_tt)
begin
if soun = "01" then
buz <= clk_t;
elsif soun = "10" then
buz <= clk_tt;
else
buz <= '0';
end if;
end process;
-- 스텝 모터를 구동하기 위한 데이터를 생성하기 위한 구문
process ( clk )
variable count : integer range 0 to 1;
variable d_count: integer range 0 to 4;
-- m_data의 값을 우로 1bit 순환 쉬프트하면 상승이 되며
-- 좌로 1bit 순환 쉬프트하면 하강이 된다.
variable m_data : std_logic_vector (3 downto 0);
begin
if clk'event and clk = '1' then
if status = "10" or status = "01" or status = "110" or status = "001" then
if count = 1 then
count := 0;
if d_count = 3 then
d_count := 0;
else
d_count := d_count + 1;
end if;
else
d_count := d_count;
count := count + 1;
end if;
else
d_count := d_count;
count := count;
end if;
--고속상승제어
if status = "110" then
if d_count = 0 then
m_data := "0011";
elsif d_count = 1 then
m_data := "1001";
elsif d_count = 2 then
m_data := "1100";
else
m_data := "0110";
end if;
--고속하강제어
elsif status = "011" then
if d_count = 0 then
m_data := "1100";
elsif d_count = 1 then
m_data := "1001";
elsif d_count = 2 then
m_data := "0011";
else
m_data := "0110";
end if;
else
m_data := m_data;
--저속상승제어
if status = "100" then
if d_count = 0 then
m_data := "0001";
elsif d_count = 1 then
m_data := "1000";
elsif d_count = 2 then
m_data := "0100";
else
m_data := "0010";
end if;
--저속하강제어
elsif status = "001" then
if d_count = 0 then
m_data := "1000";
elsif d_count = 1 then
m_data := "0001";
elsif d_count = 2 then
m_data := "0010";
else
m_data := "0100";
end if;
else
m_data := m_data;
end if;
end if;
end if;
motor_data <= m_data;
end process;
end cont_car;
begin
if clk'event and clk = '1' then
-- 해당 층 선택 버튼이 눌려지면 해당 변수는 '1'로 설정되고 해당 층에
-- 도착할 경우 값은 '0'으로 된다.
if senser_floor(0) = '0' then
sel_floor(0) <= '0';
elsif bt_floor(0) = '0' then
sel_floor(0) <= '1';
end if;
if senser_floor(1) = '0' then
sel_floor(1) <= '0';
elsif bt_floor(1) = '0' then
sel_floor(1) <= '1';
end if;
if senser_floor(2) = '0' then
sel_floor(2) <= '0';
elsif bt_floor(2) = '0' then
sel_floor(2) <= '1';
end if;
if senser_floor(3) = '0' then
sel_floor(3) <= '0';
elsif bt_floor(3) = '0' then
sel_floor(3) <= '1';
end if;
end if;
led_sel_floor <= sel_floor;
end process;
-- 엘리베이터가 위치한 층을 7segment로 표시하기 위한 구문
process ( clk )
variable seg : std_logic_vector (6 downto 0);
begin
if clk'event and clk = '1' then
case senser_floor is
when "0111" =>
seg := "1100110";
floor <= "11";
when "1011" =>
seg :="1001111";
floor <= "10";
when "1101" =>
seg := "1011011";
floor <= "01";
when "1110" =>
seg := "0000110";
floor <= "00";
when "1111" =>
seg := seg;
floor <= floor;
when others =>
seg := "1111001";
floor <= floor;
end case;
end if;
seg_floor <= seg;
end process;
process(clk)
variable cnt_Hz : integer range 0 to 100;
variable cnt_Hzz : integer range 0 to 50;
begin
if clk'event and clk = '1' then
if cnt_Hz = 100 then
cnt_Hz := 0;
CLK_T <= NOT CLK_T;
else
cnt_Hz := cnt_Hz + 1;
end if;
if cnt_Hzz = 50 then
cnt_Hz := 0;
CLK_TT <= NOT CLK_TT;
else
cnt_Hzz := cnt_Hzz + 1;
end if;
end if;
end process;
process(soun,clk_t,clk_tt)
begin
if soun = "01" then
buz <= clk_t;
elsif soun = "10" then
buz <= clk_tt;
else
buz <= '0';
end if;
end process;
-- 스텝 모터를 구동하기 위한 데이터를 생성하기 위한 구문
process ( clk )
variable count : integer range 0 to 1;
variable d_count: integer range 0 to 4;
-- m_data의 값을 우로 1bit 순환 쉬프트하면 상승이 되며
-- 좌로 1bit 순환 쉬프트하면 하강이 된다.
variable m_data : std_logic_vector (3 downto 0);
begin
if clk'event and clk = '1' then
if status = "10" or status = "01" or status = "110" or status = "001" then
if count = 1 then
count := 0;
if d_count = 3 then
d_count := 0;
else
d_count := d_count + 1;
end if;
else
d_count := d_count;
count := count + 1;
end if;
else
d_count := d_count;
count := count;
end if;
--고속상승제어
if status = "110" then
if d_count = 0 then
m_data := "0011";
elsif d_count = 1 then
m_data := "1001";
elsif d_count = 2 then
m_data := "1100";
else
m_data := "0110";
end if;
--고속하강제어
elsif status = "011" then
if d_count = 0 then
m_data := "1100";
elsif d_count = 1 then
m_data := "1001";
elsif d_count = 2 then
m_data := "0011";
else
m_data := "0110";
end if;
else
m_data := m_data;
--저속상승제어
if status = "100" then
if d_count = 0 then
m_data := "0001";
elsif d_count = 1 then
m_data := "1000";
elsif d_count = 2 then
m_data := "0100";
else
m_data := "0010";
end if;
--저속하강제어
elsif status = "001" then
if d_count = 0 then
m_data := "1000";
elsif d_count = 1 then
m_data := "0001";
elsif d_count = 2 then
m_data := "0010";
else
m_data := "0100";
end if;
else
m_data := m_data;
end if;
end if;
end if;
motor_data <= m_data;
end process;
end cont_car;