Forum Discussion
Altera_Forum
Honored Contributor
13 years agoNCO Sine output
HI All,
I am trying to generate sine output from NCO with in the range of 1Mhz to 21Mhz , Altera Megacore function NCO has an input called frequency modulation incremenet "freq_mod_i [F-1:0]" how does it work ? when i input a 16-bit word ( in my design) to freq_mod_i bus e.g 65535 , after a delay 65534 and then 65533 the output remained around 1.5Mhz . But when i input 4096 to this 16-bit bus i get 7.692Mhz How can i use NCO to increment frequency . Thanks5 Replies
- Altera_Forum
Honored Contributor
That input is used exactly for the same purpose as it is mentioned in documentation: MODULATION. You don't need that if I understood you correctly.
- Altera_Forum
Honored Contributor
The primary input to an NCO is frequency word (i.e. phase increment value) . The additional modulation input adds to that internally so that you can move away from centre frequency generated by frequency word. For example if your frequency word generates 1MHz centre then you can set modulation input as +/- that word to move off centre instead of changing frequency word directly(thus your mod input gets modulated on centre frequency).
However many people modulate by multiplying NCO centre frequency with input. Either way it works. - Altera_Forum
Honored Contributor
--- Quote Start --- The primary input to an NCO is frequency word (i.e. phase increment value) . The additional modulation input adds to that internally so that you can move away from centre frequency generated by frequency word. For example if your frequency word generates 1MHz centre then you can set modulation input as +/- that word to move off centre instead of changing frequency word directly(thus your mod input gets modulated on centre frequency). However many people modulate by multiplying NCO centre frequency with input. Either way it works. --- Quote End --- OK, so then what do i write to this 16-bit bus to decrease or increase frequency , Is it 16-bit , 2's complement when i need to decrease freq See attached that's the only explanation written in altera datasheet of NCO - Altera_Forum
Honored Contributor
I was expecting mod input to be signed but it seems not.
assuming accumulator resolution of 20 bits and mod_i resolution of 16 bits then and according to doc: fo = clk*inc/2^20 (hence inc = fo*2^20/clk) f(fm) = clk*mod_i/2^16 (hence mod_i = f(fm)*2^16/clk) what f(fm) means only God and altera editor knows.. I think they mean increment from fo. I think you can easily test that and tell us. - Altera_Forum
Honored Contributor
OK , i will try to alter frequency using this formula