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

Relationship between Internal Clock Frequency and RS232

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



Joined: 12 Feb 2009
Posts: 54

View user's profile Send private message

Relationship between Internal Clock Frequency and RS232
PostPosted: Sun Jun 12, 2011 7:25 pm     Reply with quote

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
temtronic



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

View user's profile Send private message

PostPosted: Mon Jun 13, 2011 5:15 am     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19505

View user's profile Send private message

PostPosted: Mon Jun 13, 2011 9:26 am     Reply with quote

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
khalis



Joined: 12 Feb 2009
Posts: 54

View user's profile Send private message

PostPosted: Wed Jun 15, 2011 12:56 am     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19505

View user's profile Send private message

PostPosted: Wed Jun 15, 2011 1:47 am     Reply with quote

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