PIC UART Rates

Status
Not open for further replies.

AtomSoft

Well-Known Member
Hello all i wanted to ask something that may be simple...

I wanted to send data at 4800bps i usually just get the info from the data sheet but this isnt a common speed i guess heh...

So i need to do the calculations. Now the issue is :

1. Im not sure if im right...
2. I have 2 speeds 1 micro is 20mhz and the other is 40mhz so im doing it for both..

The PIC in question is a 18F2525..
From Datasheet:

20Mhz:
20000000/4800 = 4166.666666666667
4166.666666666667 / 64 = 65.10416666666667
65.10416666666667 - 1 = 64.10416666666667
64.10416666666667 = 64
((20000000/4800)/64)-1 = 64

20000000/(64(64+1)) = 4807.692307692308
(4807.692307692308 - 4800)/4800 = 0.0016025641025642 %

Correct?

40Mhz:
40000000/4800 = 8333.333333333333
8333.333333333333 / 64 = 130.2083333333333
130.2083333333333 - 1 = 129.2083333333333
129.2083333333333 = 129
((40000000/4800)/64)-1 = 129

40000000/(64(129+1)) = 4807.692307692308
(4807.692307692308 - 4800)/4800 = 0.0016025641025642 %

Correct?

Exact same speed.... Would these values work ? I find it a pain in the butt to test 2 PICs communicating.... so i want to ask before i go nuts if i get some bad results heh i know it wasnt this...

EDIT:
I remember there being a calculator of some sort or a speed sheet formula... i dont know how to use those really to make my own but would love if someone can repost them heh
 
Last edited:
Hi atom, look at this.
 

Attachments

  • PicMultiCalc..exe
    340 KB · Views: 707
Last edited:
YAY!!!! thanks... just tested it and works fine!!! my calculations was spot on ... i did something right!! i feel great now heh... Thanks again Eric...
 
Jason,

I wrote a stand-alone SPBRG Calculator several years ago that supports 16-bit and legacy 8-bit SPBRG solutions (on Forum.Microchip). The code generator portion of the program is not completed.

Revised SPBRG Calculator (spreadsheet and stand-alone program)

Mike

**broken link removed**
 

Attachments

  • SPBRG Prog Screen&#32.JPG
    63.4 KB · Views: 368
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…