View previous topic :: View next topic |
Author |
Message |
musti463
Joined: 19 Sep 2013 Posts: 66
|
What is Baudrate value? |
Posted: Sat Dec 27, 2014 6:34 am |
|
|
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: 9229 Location: Greensville,Ontario
|
|
Posted: Sat Dec 27, 2014 6:59 am |
|
|
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
|
|
Posted: Sat Dec 27, 2014 7:11 am |
|
|
thank you. I saw different tables for BRGH=1 and BRGH=0. What is this? _________________ M.Emir SADE |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Sat Dec 27, 2014 8:17 am |
|
|
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 |
|
|
|