Changing Baud Rates


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default Changing Baud Rates

    I’m working with an ELM327 OBD to USART Interpreter (communicates with 1996+ automotive ECUs). It initializes at 38400 Baud. It has faster options, which I want to capitalize upon. Once a faster option is programmed, it will always communicate at that faster Baud rate from that point onward. I tried DEFINE-ing HSER1_BAUD at 115200 in the upper portion of my code, and then reDEFINE-ing it at the 38400 rate in the subroutine that initializes the ELM327. The Compiler gave me an error for DEFINE-ing the same thing more than once.

    I see only one option; use SPRG1H/SPRG1/Sync/BRGH/BRG to define baud rate in both instances. I worked out the math, but I haven’t breadboarded it yet. Will the HSERIN/OUT Commands work without the appropriate HSER1_BAUD DEFINE since I can’t declare it twice? Ideally I’d like to structure the Header DEFINE for the 115200 and change it in the “used only once” subroutine to the 38400. Experienced thoughts appreciated.

  2. #2
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    67


    Did you find this post helpful? Yes | No

    Default Re: Changing Baud Rates

    Quote Originally Posted by mpgmike View Post
    I’m working with an ELM327 OBD to USART Interpreter (communicates with 1996+ automotive ECUs). It initializes at 38400 Baud. It has faster options, which I want to capitalize upon. Once a faster option is programmed, it will always communicate at that faster Baud rate from that point onward. I tried DEFINE-ing HSER1_BAUD at 115200 in the upper portion of my code, and then reDEFINE-ing it at the 38400 rate in the subroutine that initializes the ELM327. The Compiler gave me an error for DEFINE-ing the same thing more than once.

    I see only one option; use SPRG1H/SPRG1/Sync/BRGH/BRG to define baud rate in both instances. I worked out the math, but I haven’t breadboarded it yet. Will the HSERIN/OUT Commands work without the appropriate HSER1_BAUD DEFINE since I can’t declare it twice? Ideally I’d like to structure the Header DEFINE for the 115200 and change it in the “used only once” subroutine to the 38400. Experienced thoughts appreciated.
    Go with SPRG1H/SPRG1/Sync/BRGH/BRG, works fine for changing baudrate anytime in your code.

    Also, get Mr E's Multicalc: http://www.picbasic.co.uk/forum/show...286#post130286 it's a real helper!

  3. #3
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Changing Baud Rates

    Many thanks. Clicking on that link was like going to the store for just a loaf of bread...while you're hungry. You come back with a cart full of stuff you didn't know you needed.

Similar Threads

  1. 18F24J11 clock and HSER/HSER2 baud rates
    By kinburn in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th September 2010, 19:00
  2. 2 Pics, different baud rates needed
    By peter_wiersig in forum Serial
    Replies: 3
    Last Post: - 27th February 2010, 16:51
  3. HighSpeed A/D and Baud Rates
    By flyingasics in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th January 2010, 02:35
  4. DEBUG baud rates
    By btaylor in forum Serial
    Replies: 6
    Last Post: - 23rd January 2006, 13:00
  5. Faster baud rates with SEROUT commands
    By TurboLS in forum PBP Wish List
    Replies: 1
    Last Post: - 19th February 2005, 11:05

Members who have read this thread : 1

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