Baud rate calculation


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159

    Default

    Quote Originally Posted by mister_e
    ...Do you really need it as this fast is always my question...
    Well, I don't know exactly how fast I need it the USART to go. All I know is that it has to be fast enough so that I can transfer 2 bytes from the 16F to the 18F without losing the USB connection.

    I had some difficulty in coming up with a baud rate that was compatible between a 16F @ 20MHz and a 18F @ 48MHz. Since I can't change the FOSC for the 18F because of USB, I did the next best thing and adjusted the FOSC on the 16F. I used 16 MHz which is a multiple of 48, I figured I could come up with a compatible SPBRG value that way.

    Sure enough, SPBRG=0 @ 16 MHz and SPBRG=2 @ 48 MHz both give 1000 KBAUD. It's not the maximum of 1250, but it's close. Now I have to make some tests later and see if the USB connection holds up.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    use the calc and get the lower error % is one of the best trick i can say. Now uncheck the BRGH=1 box to compare both results. Sometime BRGH=1 give a better error % sometimes not. it's all depend of the OSC speed and the BRGH setting. This one of the reason i did this calc. Probably i could add an auto error % feature wich will compare both BRGH=1 and BRGH=0 results and give the best of it. As now it just provide the best error % for the BRGH you choose.

    Using your example, both gave 0% error percentage.. couldn't be better assuming a real 16MHZ and a real 48MHZ
    HTH
    Last edited by mister_e; - 21st July 2006 at 21:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159

    Default

    Thanks Steve, the new "improved" version works great!

    Robert
    Attached Images Attached Images  
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    How dare you edit the title bar? mon esti'd'chien sale LMAO!

    Great to know it's working
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159

    Default

    Paint Brush is my friend.

    I was wondering if you'd notice.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Hehe... yes i do
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC 18f1220 EUSART Baud Rate Cache Problem
    By wklose99 in forum Off Topic
    Replies: 3
    Last Post: - 15th April 2008, 00:39
  3. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17
  4. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41
  5. Baud Rate and Timing Calculator
    By picnaut in forum General
    Replies: 3
    Last Post: - 23rd January 2004, 16:48

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts