+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2016
    Posts
    60

    Default Is it possible To change baud rate at runtime?

    I need to change The baud rate from 9600 to 115200 and then back to 9600. I did try with define but PBP3 does'nt like it and gives error at compiling. Is there a way To do the baud Switching from 9600 To 115200 and back To 9600? How?

    Thank you for any help.

    Alberto

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,197

    Default Re: Is it possible To change baud rate at runtime?

    Absolutely. But you can't use DEFINE because it's a compile time thing.
    You can skip the DEFINE altogether and do it manually all the way, what to set the registers to depends on the oscillator speed. For example, setting 9600 baud when running at 8MHz:
    Code:
    RCSTA = $90
    TXSTA = $20
    SPBRG = 51
    SPBRGH = 0
    BAUDCON.3 = 1
    /Henrik.

  3. #3
    Join Date
    Jun 2016
    Posts
    60

    Default Re: Is it possible To change baud rate at runtime?

    Thank you Henrik, very kind of you.

    Alberto

Similar Threads

  1. How to change baud rate with HSEROUT?
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th November 2011, 02:48
  2. Change baud rate on SerLCD
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd July 2010, 19:19
  3. Rf module baud rate
    By tazntex in forum Serial
    Replies: 4
    Last Post: - 5th August 2008, 18:47
  4. pic18f4520 baud rate change to 115200
    By caltex88 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th September 2007, 08:41
  5. Baud rate calculation
    By Demon in forum Serial
    Replies: 12
    Last Post: - 21st July 2006, 22:02

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