|
|
View previous topic :: View next topic |
Author |
Message |
erpgc82
Joined: 02 May 2020 Posts: 73
|
Is the 18f46k22 internal oscillator for UART reliable? |
Posted: Fri Apr 09, 2021 11:58 am |
|
|
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: 9168 Location: Greensville,Ontario
|
|
Posted: Fri Apr 09, 2021 1:36 pm |
|
|
It's been fine for me for a few years.....
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..... |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 296
|
|
Posted: Fri Apr 09, 2021 2:09 pm |
|
|
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: 19358
|
|
Posted: Sat Apr 10, 2021 12:45 am |
|
|
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: 9168 Location: Greensville,Ontario
|
|
Posted: Sat Apr 10, 2021 5:17 am |
|
|
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
|
|
Posted: Sat Apr 10, 2021 8:01 am |
|
|
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 |
|
|
|
|
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
|