Verilog code for counting pulses in 555timer

Status
Not open for further replies.

SURAJ7

Newbie level 2
Joined
Dec 9, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
12
hey everybody,
I wish to write a verilog code for counting pulses from 555timer in fpga...can anybody help
 

Yes , definitely, But please post your efforts first.
 


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module pwm(clock,switches,pwm);
parameter sd = 195;//step delay in pulse
input clock;
input [7:0]switches;
output pwm;
reg pwm;
reg [15:0] counter=0;
 
always@(posedge clock)
begin
counter=counter+1;
if(counter<=switches*sd)
pwm=1;
else 
pwm=0;
if(counter>=50000)
counter=0;
end;
endmodule

 
Last edited by a moderator:

Hi,

So where exactly you are facing your problem ?.. also you need to re arrange your if else conditions.
I mean, error, or understanding wise , A good formatted question will avoid such delay.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…