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

RS232 and Calibration memory value

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

RS232 and Calibration memory value
PostPosted: Thu Jan 12, 2006 4:24 am     Reply with quote

Hi Everibody,

I'm using RS232 in PIC16F630 with internal clock of 4 Mhz.

The application work right exept in some micro were I need to adjust calibration memory value manually otherways I have some comunication errors.

By factory the value is 0x40 and I change it to 0x45 to obtain 100% comunication error free.

I don't want to adjust calibration memory manually.

Can the software adjust itself in function of factory calibration value or must I change it by software ?

Thanks for support,

Regards,
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Jan 12, 2006 10:06 am     Reply with quote

If the only timing problem is serial baud rate you can tweak the baud rate by software. With the a software UART it is trivial. With hardware you just calculate the divisors for a step or two slower and a step or two faster.
Somehow the software has to decide what speed to use, but trial-and-error might be an option.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Ttelmah
Guest







PostPosted: Thu Jan 12, 2006 11:24 am     Reply with quote

What voltage are you running the chip at?.
The internal calibrated value, is normally rather better than this, _but_ it is only 'warranted' to give 4MHz +/-1%, with a 3.5v supply. With a 5v supply, the tolerance 'slips' to +/-2%, and if the operating enviroment is exposed to temperature extremes, the accuracy slips further to +/-5%. The commonest problem is that with a 5v supply, the accuracy, can begin to become borderline on some enviroments.
There was a problem with the timings generated for RS232, by some versions of CCS a while ago, and tweaking the 'clock' value in the code, is the easiest fix for this, rather than adjusting the oscillator. Beware also, that though it is easy to 'assume' that a PC has correct timings, I have seen a suprising number of recent machines that produce innaccurate timings, and 'tweaking' the PIC timing to get it to work, might then cause problems on another machine.
So, I'd suggest proving where the problem is. For instance, it is relatively simple to write a program to count to 100 in seconds, then operate an output pin. If you time this with a stopwatch, and it is well out, then adjusting the OSCCAL value is well worth doing, but if this time is accurate, look elsewhere (I am assuming you don't have access to a frequency meter). I suspect you will find the actual value is not that bad.
Some programmers have the ability to adjust this value (the Mach-X for example). They compare the clock being generated with that from their own crystal, and adjust the value to get a close figure.
The calibration word is not accessible from code, on the 16F630. However there is nothing at all to stop you storing your own calibration value in the EEPROM memory, and writing this to the OSCCAL register after boot. This will override the value already loaded by the compiler.

Best Wishes
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