Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

How increase counter after one second+quartus II

Altera_Forum
Honored Contributor II
2,214 Views

My Problem I make verilog program counter in quartus I want increase counter after one secound I use de2 board and used clock_50 in generarte clock but very high speed I wand any etting in quartus to setting clock at one secod any one help me I'm very thank you. 

Please I'm very very very needly to this is idea.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
1,410 Views

in order to avoid clock issues, the easiest way is incrementing the counter every 50E6 cycles of the 50 MHz clock, this can be achieved using a 26 bits (ceil(log2(50e6-1))) preescaler.  

 

 

always@(posedge clk_50 or negedge reset_n) begin if(!reset_n) begin counter_out <= 0; counter_preescaler <= 0; end else begin if(counter_preescaler == 49999999 ) begin counter_out <= counter_out+1; counter_preescaler <= 0; end else counter_preescaler <= counter_preescaler+1; end end
0 Kudos
Altera_Forum
Honored Contributor II
1,410 Views
0 Kudos
Reply