CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Accurate value frequency use NCO

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dmitrboristuk



Joined: 26 Sep 2020
Posts: 55

View user's profile Send private message

Accurate value frequency use NCO
PostPosted: Mon Mar 22, 2021 11:37 am     Reply with quote

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).
gaugeguy



Joined: 05 Apr 2011
Posts: 303

View user's profile Send private message

PostPosted: Mon Mar 22, 2021 3:48 pm     Reply with quote

If you want those exact frequencies you would be better using the CCP. Go through the formulas in the data sheet to determine values.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Mar 22, 2021 6:19 pm     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Tue Mar 23, 2021 8:14 am     Reply with quote

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%).
Sad

Not that accurate.
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Tue Mar 23, 2021 12:59 pm     Reply with quote

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..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group