View previous topic :: View next topic |
Author |
Message |
khalis
Joined: 12 Feb 2009 Posts: 54
|
Relationship between Internal Clock Frequency and RS232 |
Posted: Sun Jun 12, 2011 7:25 pm |
|
|
Hi
Recently i was trying to test PIC18F25K20 RS232 capability by using internal clock frequency provided inside the PIC itself. At first 4Mhz, the RS232 unable to send the 'Test' string to the hyper terminal. Then i used 8 Mhz, also got the same result. But when i changed the internal clock to 16MHz, the PIC started to the correct string. So my question, does PIC needs a higher frequency when it start to dealing with RS232?.....
Looking forward the answer........:D...thanks |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9170 Location: Greensville,Ontario
|
|
Posted: Mon Jun 13, 2011 5:15 am |
|
|
No, it doesn't matter what the frequency is( fast,slow, higher,slower,..) however the actual baudrate( say 9600) of BOTH transmitting and receiving devices( PIC and PC, in this case) MUST be within 2% of each other.If one is at 9500 and the other at 9650 they can't communicate correctly.
The internal RC osc. is not very accurate but OK for serial communications using the internal hardware UART. If you're using a software uart, all timings may be off since you're using software delays.
I suspect this is the case (dumping the listing will prove/disprove it) as I've used the internal RC osc on PICs for years at 9600 and hyperterminal without any problems. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19359
|
|
Posted: Mon Jun 13, 2011 9:26 am |
|
|
It shouldn't matter at all, _but_ the error generated by loop accuracies etc, will decline as frequencies rise. Add the error from the internal RC, which is not terribly good, and I'd suggest the total error is just too large at the lower frequency....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
khalis
Joined: 12 Feb 2009 Posts: 54
|
|
Posted: Wed Jun 15, 2011 12:56 am |
|
|
Thanks for the comment..before this, i never try to use external oscillator inside the PIC because normally i used external one..so when it comes to external oscillator, do we need to have a SETUP_OSCILLATOR() in order to ensure the PIC runs at the speed that we set in SETUP_OSCILLATOR()?
Hope somebody can explain to me about the matter...Thanks in advance..
Last edited by khalis on Wed Jun 15, 2011 1:27 am; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19359
|
|
Posted: Wed Jun 15, 2011 1:47 am |
|
|
External oscillator:
Just setup the FUSES, and CLOCK.
Internal oscillator:
Just setup the FUSES and CLOCK. _Optionally_ use setup_oscillator, either to be sure of the rate, _or_ to change the rate after initial setting. On some older compilers, this was required to setup the internal oscillator, but not for a couple of years now.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|