Autobaud Detection without USART 12F683 etc


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Autobaud Detection without USART 12F683 etc

    I'm using a 12F683 running with the internal oscillator at 8mhz and a SERIN2 routine catching incomming characters at 9600 baud. No problem.

    However the transmitting device baud rate varies a bit and I was wondering if i could use some sort of autobaud routine to detect the length of a bit and work out the baud rate for the day!

    I was thinking pulsin to measure a selection of bits, find the shortest, do some maths and then manipulate either the osctune register or the serin2 MODE low order baud rate bits?

    Any comments. I can't use an enhanced pic and the transmitting device is not modifiable.

    Anyone ever tried this?

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    When you say the transmitting device varies a bit do you mean it changes from say 9600 to 4800 or is it just off by a percentage?

    I might add that the internal OSC on many of the MCUs are not stable enough for serial comms. That might also be part of the problem.
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    It varies a bit, say 1000 baud either way from 9600.

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    How best to do this depends on how fast it changes, and how many characters you have to "throw away" to determine the correct baud rate.

    Two methods that come to mind:

    #1. Send a string of characters to the PIC (0x80) for example. Have the PIC sit in a loop and wait for the line to go TRUE (probably high, in your case). Then use PULSIN to measure the LOW period. Calculate the baud rate from that. You should have 7 low bits at 9600 (73uSec). Adjust the baud rate accordingly.

    #2. Send a known string of 4 or 5 characters. Start with SERIN2 baud rate value about 10% low. Increment until you receive the correct string . Store that value as baudrate #1. Keep incrementing until the checksum no longer matches Store that value as baudrate #2. Take the average of baudrate #1 and baudrate #2 and use that.
    Charles Linquist

  5. #5
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    12F1822 if you can wait until 10 Oct 2010.
    8 pin with USART.

    Bo

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Thanks for the ideas? I like the 12f1822

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