+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Pedro Pinto's Avatar
    Pedro Pinto Guest

    Question Redefinition of CON bmode during runtime


    I need only in the start of my program a 2400 baudrate, later im programm during runtime i need to change the baurate to 9600, but become error by the compiler "Redefinition of CON bmode"
    How can i do that?

    Thanks in advance

    Best regards


  2. #2
    Join Date
    Sep 2005
    Campbell, CA


    You can change your baudrate any time during runtime by issuing the command

    SPBRG = x,

    where "x" is a number you will find in your datasheet and
    is based on your oscillator, and the BRGH and BRG16 settings.

    After changing the baud rate, pause at least two byte-times before you
    attempt to use the serial port.
    Charles Linquist

  3. #3
    Pedro Pinto's Avatar
    Pedro Pinto Guest


    Thank You Charles



  4. #4
    Join Date
    Aug 2006
    Look, behind you.


    Hi Pedro,
    What Charles said is proper for HSERIN and HSEROUT, I have a little program I use to test serial LCD units using SEROUT and it works for several baudrates, here is a sample of the code.
    SEROUT PortB.7,N2400,[254,128,"2400 baud line 1~"]'inverted
    pause 100
    serout PortB.6,N9600,[254,128,"9600 baud line 1~"] '128 so as not to add space
    pause 100
    SEROUT PortB.5,T2400,[254,128,"2400 baud line 1~"]'true
    pause 100
    serout PortB.4,T9600,[254,128,"9600 baud line 1~"] '128 so as not to add space
    pause 1000
    each output having a different baudrate.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Pedro Pinto's Avatar
    Pedro Pinto Guest


    Hi Joe

    What Charles say is what i need

    i have this for soft usart
    bmode con 16780' serin2' 16780 = 2400 true
    'and set with this the hardware usart for 10466 baudrate, i have not tested, next week
    'can i test, and hope that this work
    ' Set receive register to receiver enabled
    ' Set baud rate
    ' Set SPBRG directly (normally set by HSER_BAUD)


Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  2. PIC 18F4550 and MCP23017
    By DaveC3 in forum Code Examples
    Replies: 12
    Last Post: - 4th December 2010, 14:01
  3. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  4. example code for DS1337
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 8th December 2009, 21:16
  5. Parallax GPS Receiver
    By emavil in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th February 2009, 09:35

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