I have a problem Spartan3E Freq generator var duty cycle

Status
Not open for further replies.

catalinutz

Newbie level 6
Joined
Nov 17, 2010
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,365
First of all Hello everyone!! I have a problem a very big one I am new to verilog and i have a Spartan 3E FPGA Starter ,i am facing a rather difficult problem for me i want to create a verilog code to make a frequency generator from the 50Mhz Spartan s internal oscillator .So i need a frequency generator with frequency between 1Hz and 10Khz from the rotary button, with aduty cycle variable between 5% and 95% with 5% step , synchronous sistem with asynchrounus reset.
If u kind pls post me the verilog code i know u are very smart and pro and maybe u had this problem once.....

Yours truly ,George
 

That's fairly easy. You'll need a 24 bit counter to be able to divide by 50 000 000 (to get 1 Hz). You also need a stroring division factor (which depends on frequency). You will match counter against this register and reset the counter if it's equal to freq register. As for duty cycle: duty cycle of 50% means you match the counter against half (50%) of factor reg value, and set output signal to '0' if it's less or '1' if it's greater. Similarly, to get 10% you have to match against 0.1 (1/10th) of it's value. As far as only division by power of 2 is synthesisable, you either have to actually use divider module or to use duty cycle that can be received with didvision by a factor of 2.
 
Well it s easy from what u explained but can u send me some code cause i am a begginer and i want to see how this verilog stuff works ....or maybe a scheme with what u said . i need variable duty cycle with step of 5% from 5 to 95% and variable frequency vbetween 1Hz and 10Khz which i would see on spartans lcd pls help ...i feel like a noob
 

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