library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity serwosterowanie is port ( clk : in std_logic; data : in Integer range 0 to 255; sygnal : out std_logic; load : in std_logic ); end serwosterowanie; -- to coś ma zamieniać sygnał danych na sygnal zrozumianły dla serwo -- architecture serwosterowanie of serwosterowanie is constant drgan : Integer := 5; constant dolny : Integer := 1; constant gorny : Integer := 2; constant skok : Integer :=5; signal clock : std_logic; signal aktvalue : Integer range 0 to 13107100; signal wartosc: Integer range 0 to 13107100; signal zmiana : std_logic; begin countSigTime: process (clk,load) begin if (load = '1') then aktvalue <= 0; wartosc <= data*skok + dolny*drgan; elsif (clk'event and clk = '1') then if (aktvalue < wartosc) then aktvalue <= aktvalue + 1; zmiana <= '1'; else zmiana <= '0'; end if; end if; end process; sygnal <= zmiana; end architecture;