連結已複製
4 回應
1.8 degrees in one step<><>
this my program.,. but still looping. how to stop it in order to move 30 degrees only library IEEE; use ieee.std_logic_1164.all; entity stepper is port ( CLK : in std_logic; tombol_arah : in std_logic; STEP_D : out std_logic_vector (3 downto 0) ); end stepper; Architecture behavioral of stepper is signal cnt : integer range 0 to 3; signal cnt_1 : integer range 0 to 3; begin process (CLK) is begin if (CLK'event and CLK = '1') then case cnt is when 0=> STEP_D <= "1001"; when 1=> STEP_D <= "0001"; when 2=> STEP_D <= "0011"; when 3=> STEP_D <= "0010"; end case; end if; end process; process (CLK) begin if(CLK' event and CLK = '1') then if cnt = 3 then cnt <= 0; else cnt <= cnt+1; end if; end if; end process; end behavioral;1.8 degrees in one step<><>
this my program.,. but still looping. how to stop it in order to move 30 degrees only library IEEE; use ieee.std_logic_1164.all; entity steper is port ( CLK : in std_logic; tombol_arah : in std_logic; STEP_D : out std_logic_vector (3 downto 0) ); end steper; Architecture behavioral of steper is signal cnt : integer range 0 to 3; signal cnt_1 : integer range 0 to 3; begin process (CLK) is begin if (CLK'event and CLK = '1') then case cnt is when 0=> STEP_D <= "1001"; when 1=> STEP_D <= "0001"; when 2=> STEP_D <= "0011"; when 3=> STEP_D <= "0010"; end case; end if; end process; process (CLK) begin if(CLK' event and CLK = '1') then if cnt = 3 then cnt <= 0; else cnt <= cnt+1; end if; end if; end process; end behavioral;