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

What is Baudrate value?

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



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

What is Baudrate value?
PostPosted: Sat Dec 27, 2014 6:34 am     Reply with quote

I am using RS485 communication. What should be baudrate value for 20 MHz crystal frequency ? Can you give a formula or table/chart?
_________________
M.Emir SADE
temtronic



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

View user's profile Send private message

PostPosted: Sat Dec 27, 2014 6:59 am     Reply with quote

The baudrate you choose depends on the peripherals or devices within the RS485 'network'.
If you're trying to get a PIC to talk to commercial devices already purchased, then look at the devices datasheet for the 'communications specs.
If you're creating a PIC to PIC RS485 'network' for in house use, YOU, get to choose everything. I'd start with 9600 baud as it seems to be the 'standard' speed. If there's a lot of data being transferred, then increase to say 115K200.If the distance is great between network devices, you'll need to slow down the baudrate.You can go miles at 24 baud.

bottom line....start at 9600

jay
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Sat Dec 27, 2014 7:11 am     Reply with quote

thank you. I saw different tables for BRGH=1 and BRGH=0. What is this?
_________________
M.Emir SADE
temtronic



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

View user's profile Send private message

PostPosted: Sat Dec 27, 2014 8:17 am     Reply with quote

That bit controls the Baud Rate Generator divider chain.

From the 16F877 datasheet UART section, 10.xx.....

...
It may be advantageous to use the high baud rate
(BRGH = 1), even for slower baud clocks. This is
because the FOSC/(16(X + 1)) equation can reduce the
baud rate error in some cases
...

There are charts/examples of FOSC vs. Baud rates vs. error and obviously the closer you can get the baud rate the less error. Xtals like 2.457600 are binary so baud rates are perfect(say 9600). If the xtal is say 2.457000 then once divided down you will not get 9600,maybe 9601, 9599. when that happens, communications between two devices may result in errors as the bits are noy in sync.

You need to read up on UARTs for a better explanation.The PIC datasheets are good, there may be an application note at Microchips website or use Google.

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