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 support@ccsinfo.com

oscillator scalar conversion for 16f15xx NCO

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

oscillator scalar conversion for 16f15xx NCO
PostPosted: Mon Mar 25, 2013 12:00 pm     Reply with quote

Code:

// Efficient, 1 hz accuracy conversion to
// perform scalar correction for frequency to NCO_increment
// based on desired 2,097,152 vs actual ( 20 bit , power of 2 reference 'F' )
// versus +/- ~ 1% PIC 2mhz oscillator, gives ~ 1 hz accuracy
// for 16f15xx family NCO.
//
unsigned int16 NCOFreqtoINCR( unsigned int16 desiredfreq){
     unsigned int32 t1;
     t1= (unsigned int32) desiredfreq*8590;
     return(t1 >>13);
}



the residual error is all based on the absolute accuracy of the PIC internal oscillator. converts the frequency you want based on a 2mhz int osc setting of 16f15xx part , and returns the NCO_increment value
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library 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