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

16F630 Clock Accuracy

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



Joined: 11 Sep 2003
Posts: 51
Location: New Zealand

View user's profile Send private message

16F630 Clock Accuracy
PostPosted: Mon Mar 29, 2004 7:12 pm     Reply with quote

Has anyone experimented with 16F630 using internal clock and the delay_ms command?

I am attempting to create a reliable 10 second then 3 second then 3 minute delay but the results are quite variable.
Can anyone shed any light on why?

Mark
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Mon Mar 29, 2004 8:03 pm     Reply with quote

Are you calibrating the internal oscillator? Quoting from the datasheet:

Quote:

When calibrated, the internal oscillator provides a fixed
4 MHz (nominal) system clock...
A calibration instruction is programmed into the last
location of program memory. This instruction is a
RETLW XX, where the literal is the calibration value.
The literal is placed in the OSCCAL register to set the
calibration of the internal oscillator. Example 9-1
demonstrates how to calibrate the internal oscillator.
For best operation, decouple (with capacitance) VDD
and VSS as close to the device as possible.

Note: Erasing the device will also erase the preprogrammed
internal calibration value for
the internal oscillator. The calibration value
must be saved prior to erasing part as
specified in the PIC16F630/676 Programming
specification. Microchip Development
Tools maintain all calibration bits to
factory settings.

EXAMPLE 9-1: CALIBRATING THE
INTERNAL OSCILLATOR:

bsf STATUS, RP0 ;Bank 1
call 3FFh ;Get the cal value
movwf OSCCAL ;Calibrate
bcf STATUS, RP0 ;Bank 0


Also take a look at Electrical Specifications in the device datasheet (Section 12.0) for information on variation over voltage and temperature.
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