View previous topic :: View next topic |
Author |
Message |
dmitrboristuk
Joined: 26 Sep 2020 Posts: 51
|
Accurate value frequency use NCO |
Posted: Mon Mar 22, 2021 11:37 am |
|
|
Hello everyone!
How to use the NCO module to obtain exact frequency values of 5 kHz, 10 kHz, 20 kHz, 50 kHz, etc. at the generator output.
PIC16F1719 microcontroller. Is it possible in principle? Crystal oscillator frequency 8 (16 MHz). |
|
![](templates/subSilver/images/spacer.gif) |
gaugeguy
Joined: 05 Apr 2011 Posts: 296
|
|
Posted: Mon Mar 22, 2021 3:48 pm |
|
|
If you want those exact frequencies you would be better using the CCP. Go through the formulas in the data sheet to determine values. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9171 Location: Greensville,Ontario
|
|
Posted: Mon Mar 22, 2021 6:19 pm |
|
|
The problem is 'how accurate'?
According to an NCO calculator I downloaded, entering 8MHz, 5KHz, gives 5004.8876 and 5001.0729 as the 'possible frequency for '5000'.
So it is 'possible'......
Now if you need those frequencies, there are several non-PIC ways to get them. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19363
|
|
Posted: Tue Mar 23, 2021 8:14 am |
|
|
I'm very puzzled what frequency he is actually running?.
He says 8 (16Mhz). Only one can be true.
If he has an 8MHz oscillator, then the only way the NCO can be running
at 16MHz, is using the HFINTOSC, which is not that accurate (0.5%).
Not that accurate. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19363
|
|
Posted: Tue Mar 23, 2021 12:59 pm |
|
|
Add on, that if you have an 8MHz crystal, then use the *4 PLL, and run
at 32MHz. This then gives you a potential resolution around 30Hz, and
the long term accuracy of the synthesised frequency accuracy will
be much better. Understand that the NCO is rather like the accurate
RTC in the code library, where the overall accuracy is much better than
the individual cycle accuracy, so a lot depends on the nature of the
actual 'accuracy' you need.
As a further comment to this, gaugeguy is both right and wrong. If the
frequencies you want are integer divisions of the master clock, then the CCP
will actually give a more accurate result. If not then within the limitations
of it's available resolutions, then the NCO is the better solution. So the answer
does depend on the exact frequencies needed, the master clock rate, etc.
etc.. |
|
![](templates/subSilver/images/spacer.gif) |
|