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

Is the 18f46k22 internal oscillator for UART reliable?

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



Joined: 02 May 2020
Posts: 73

View user's profile Send private message Send e-mail

Is the 18f46k22 internal oscillator for UART reliable?
PostPosted: Fri Apr 09, 2021 11:58 am     Reply with quote

Hello my friends.


I would like to take a doubt, I learned to program the 18F46K22 using the internal clock of 16Mhz, in PLL, with that I have 64Mhz. It is working correctly, including the UART serial communication.

My question is, is this safe, efficient, stable ???
Because today I am learning, and in a prototype here everything looks "beautifully" and working correctly.

And when I use it in a commercial project, where there will be humidity or heat, can I have problems?
For my whole life that I designed plates, assemblies, maintenance, I always saw commercial products using external crystal.

Look at the configuration, if it works well with me, it’s not reliable to use internal crystal, save pins and save parts $. ???

Code:

#include <18f46k22.h>
#use delay(clock=64Mhz,internal)
#fuses INTRC_IO 
#fuses NOWDT     
#fuses PUT       
#fuses BROWNOUT 
#fuses NOLVP   
#fuses NODEBUG
#fuses NOMCLR

#use rs232(baud=9600, parity=N, xmit=PIN_D6, rcv=PIN_D7, bits=8, stop=1, ERRORS, stream=barcode)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8, stop=1, ERRORS, stream=PC)

void main()
{
    setup_oscillator(OSC_64MHZ,OSC_PLL_ON);
    while(TRUE)
    {
    }
}


Thanks.
erpgc82
_________________
Gradually you will go far with persistence, will and determination!
temtronic



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

View user's profile Send private message

PostPosted: Fri Apr 09, 2021 1:36 pm     Reply with quote

It's been fine for me for a few years..... Smile
When I got the 46K22, I 'looped' both UARTS to a PC, via USbTTL sticks, ran at 115K200, using ISrs and buffers...never missed a bit of a byte..
for precise timing a crystal is better(esp. over wide temp ranges) but at 9600 it should be just fine......
others that actually sell products will chime in..... Cool
gaugeguy



Joined: 05 Apr 2011
Posts: 303

View user's profile Send private message

PostPosted: Fri Apr 09, 2021 2:09 pm     Reply with quote

You can get by if you make sure to only use it at room temperature. Otherwise the internal oscillator can move off far enough with temperature changes for the baud rate change too far.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Sat Apr 10, 2021 12:45 am     Reply with quote

Yes, Gaugeguy, says it all.
The internal oscillator for 'domestic' applications is fine. For 'Industrial'
temperature ranges it can become 'borderline'. For something like an
automotive application, you may well have problems.
temtronic



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

View user's profile Send private message

PostPosted: Sat Apr 10, 2021 5:17 am     Reply with quote

As others have said, for a commercial product, spend the extra 50 cents for a 4mhz xtal and 2 caps ! Say it actually costs a $1 per board, for 100 units that's $100 BUT NO headaches, no returns, no 2AM trips to a noisey,dirty steel mill to replace a 'bad board'. BTDT.

4 decades ago, just prePIC, I had to redesign an inuse product, as the R-C clock wasn't 'tight' enough. Not a simple xtal/2 caps deal. Daughter PCB, 3 chips+xtal/caps. NEVER had a problem after that. You'd have thought 24 baud would be 'stable'......

It's a spend a little more now and NOT 100s later.
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Sat Apr 10, 2021 8:01 am     Reply with quote

One thing about crystals and caps is that you should be careful in your manufacturing process. Any residue can screw up the capacitance, leading to no clock at all.

And if you expect the board to see dust/moisture I think it's a good idea to conformal coat or otherwise protect that board. Otherwise you might just end up with a bunch of "sick"boards a few months later... Been there, done that lol
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