Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Counter

Reply
Thread Tools

Counter

 
 
amirster amirster is offline
Junior Member
Join Date: May 2007
Posts: 4
 
      05-30-2007
Hello
I am new in writing VHDL code, and i need to write a code for a Counter thats work this way:
1. the counter take as input a number (X) between 0 and 2400
2. the counter has another clk input, and the counter count the Clk pulses
3. the counter check
if (clk pulses < number x)
stay HIGH
if (Clk pulses >= number x)
change to LOW
if (Clk Pulses = 2400)
reset Clk Pulses and change to HIGH
4. The counter should do this action nonstop
one more question: how can i count Clk pulses?
Thanks
Amirster
 

Last edited by amirster; 05-30-2007 at 06:39 AM..
Reply With Quote
 
 
 
 
sreenivas sreenivas is offline
Junior Member
Join Date: Jun 2007
Posts: 1
 
      06-07-2007
module counter(X, clk, reset, Q);
input [11:0] X;
input clk;
input reset;
output [11:0] Q;
reg [11:0] Q;
reg [11:0] q_int;
integer count;

always @(posedge clk) begin
count = count + 1;
if(reset) q_int <= 0;
else q_int <= q_int + 1;
end

always @(q_int)
begin
if(q_int == X) level = LOW;
end
endmodule


1. the counter take as input a number (X) between 0 and 2400
2. the counter has another clk input, and the counter count the Clk pulses
3. the counter check
if (clk pulses < number x)
stay HIGH
if (Clk pulses >= number x)
change to LOW
if (Clk Pulses = 2400)
reset Clk Pulses and change to HIGH
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page File counter and Private Bytes Counter George2 C++ 1 01-31-2008 09:27 AM
Reset network creation counter J.H. Holliday Wireless Networking 4 06-11-2005 08:09 PM
Session("counter") vs. ViewState("counter")...a newbie question The Eeediot ASP .Net 3 12-22-2004 09:31 PM
Java Applet counter doesn't display correctly Dick Stouffer Firefox 8 10-05-2004 04:52 PM
can I do such a simplest counter in VHDL? walala VHDL 3 09-14-2003 08:05 PM



Advertisments