[VHDL] Needed help with frequency divider

Status
Not open for further replies.

marcin1135

Newbie level 1
Joined
Mar 29, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,286
HI all.
I have some problems with frequency divider. I have divider 5MHz -> 2Hz.

Code:
signal CONTENT: std_logic_vector(21 downto 0):= "0000000000000000000000";
begin
process (CLK5MHZ_IN)
begin
if rising_edge(CLK5MHZ_IN) then
if CONTENT(20 downto 0) = "111111111111111111111" then
CONTENT <= not CONTENT(21) & "000000000000000000000";
else CONTENT <= CONTENT + 1;
end if;
end if;
end process;
CLK2HZ_OUT <= CONTENT(21);

I need frequency: 1Hz and 5Hz.
Please help me with this issue. I will be grateful for any sugestions.

regards
Martin:!:
 

In my opinion you can realize it as:
if rising_edge(clk) then CONTENT<=CONTENT+1;
end if;
end processs;
CLK2HZ<=CONTENT(21);
CLK5HZ<=CONTENT(20);
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…