Weet iemand wat deze code betekent

Alle vragen m.b.t digitale schakelingen m.b.v. losse i.c's
en oplossingen m.b.v. PIC processoren.
Plaats reactie
Serkan
Berichten: 37
Lid geworden op: di 18 jan 2005, 11:17
Locatie: Rotterdam

Weet iemand wat deze code betekent

Bericht door Serkan »

Heeft iemand enig idee wat deze code doet?? Hoe het werkt??


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity pwm is
port ( ena_nv : in std_logic;
new_value : in std_logic_vector(7 downto 0);
clk : in std_logic;
pwm_out : out std_logic
);
end pwm;

architecture pwm_arch of pwm is

signal load : std_logic := '1';
signal updwn : std_logic := '0';
signal mark_value, fcount : std_logic_vector (7 downto 0) := "00000000";

begin

mark_register : process (clk)
begin

if (clk'event and clk = '1') then
if ena_nv = '1' then
mark_value <= new_value;
end if;
end if;
end process mark_register;

frame_counter : process (clk)
begin

if (clk'event and clk = '1') then
if load = '1' then
fcount <= mark_value;
else
if updwn = '1' then
fcount <= fcount + 1;
else
fcount <= fcount - 1;
end if;
end if;
end if;
end process frame_counter;

load <= '1' when (fcount = "00000000" or fcount = "11111111") else '0';

pwm : process (clk)
begin

if (clk'event and clk = '1') then
if load = '1' then
updwn <= not updwn;
end if;
end if;
end process pwm;

pwm_out <= updwn;

end pwm_arch;
Gebruikersavatar
crossover
Berichten: 740
Lid geworden op: zo 7 nov 2004, 18:58
Locatie: Bilzen. .. .
Contacteer:

Bericht door crossover »

steek het in xilinix zijn programmer, en maak een simulatie
software is gratis
Liggend Kan Je Sch**ten Maar Het Is Beter Als Je Zit.
Plaats reactie