Automatic Baud Rate Detection


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

    Angry Automatic Baud Rate Detection

    I am beginner with Pic Micro controller, my objective is use 16F876A I/SP and I want to automatically detect baud rates from any device. How can I do that, any ideas from seniors?

    I use Latest Proton development Suite, and PICPRO BASIC version 2.46

    Thank you all in advance

  2. #2
    bot402's Avatar
    bot402 Guest


    Did you find this post helpful? Yes | No

    Default

    Within the PROTON samples folder there are two programs for detecting baud rate and setting up the USART to match. One for 16F devices and one for 18F devices.

    Both of these programs could be converted to PBP as they are simple in operation.

  3. #3


    Did you find this post helpful? Yes | No

    Smile

    Hi Titanvision,

    For PDS questions, go to --> http://www.picbasic.org/forum



    Cheers.
    ---> picnaut

  4. #4
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Question

    Ok I've got to ask the question...

    How would one go about providing automatic baud rate detection with PBP?

    I did a quick search of the forums, but did not find anything on this topic. If someone does know of an example, can you please post a link here. Or perhaps we can do some tinkering with it here, and come up with some code that'll work. I'll be doing some more research into this. So stay tuned...

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


    Did you find this post helpful? Yes | No

    Default

    Well i think... just a thought, that is feasable and accurate if the Serial data that comes to the PIC have a Special kind of header like at least 2 bytes wide. Let's say the Master will send $55 as header
    $55= %0101 0101
    you measure the gaps between 1 and zero with internal timer or whatever else method and once it's done, you calculate the baudrate.

    So, my assumption should be correct if the master send few $55 or $AA + some kind of special Synchro character.

    at the end you have a pseudo code like
    1. 1. Measure incoming $aa $55 pulse width
    2. 2. calculate and set according baudrate
    3. 3. Waiting for synchro byte... bytes or string
    4. 4. Get serial data with according baudrate
    Steve

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

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Thanks you all, is there a codes samples can be offered?

    As I mentioned I am beginner with proton development suite and pic basic pro compiler,

    Mister e was given some good high light,
    somehow my points is my target X device baud rate unknown, device it might be even or odd parity, I want to build a baud trace function for that, when I get correct handshake with target device I take that result in temporary variable as a my default baud rate for communicate with that device..
    If I made connection to another X device process routines will be same,

    Baud rates range can be 150 ~ 115000 it doesn’t matter what baud rate is come or generated from X device, for example it can be 9900.

    So far I get some information from Other forms and manual of compilers what I am using for instance 1000000 / baud rate – 20 gives decimal numbers set up my device sufficient, if I know my target X device will communicate with baud rate for example 9600 above mentioned calculation formula result Hex format should be 54h .

    It might be there is some limitation with micro controller according the clock rate however my theory I do not want to depend on micro controller serial port pins it can be shifted any I/O pin get a freedom of max usage of such a micro controller.

    Regards

    Joe

  7. #7
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by titanvision
    Thanks you all, is there a codes samples can be offered? . . .
    Joe
    Joe,
    You are asking too much.

    Start small.
    Think about how this could be solved.
    Steve's approach is something you could start with.

    Let's assume the "unknown" device sends out a (more or less) continous datastream
    at unknown Baudrate, Parity etc. and there is now way to influence that Datastream.
    So there will be no $55 or $AA Pattern you could sync to.
    It will be a challenge to detect the comms parameters.

    Even worse if the "unknown" device sends out data on request only.

    Again,
    start small, let your PC transmit data and try to detect it on your PIC.
    (and you'll soon see what I mean)
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  8. #8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by NavMicroSystems
    Joe,
    You are asking too much.

    Start small.
    Think about how this could be solved.
    Steve's approach is something you could start with.

    Let's assume the "unknown" device sends out a (more or less) continous datastream
    at unknown Baudrate, Parity etc. and there is now way to influence that Datastream.
    So there will be no $55 or $AA Pattern you could sync to.
    It will be a challenge to detect the comms parameters.

    Even worse if the "unknown" device sends out data on request only.

    Again,
    start small, let your PC transmit data and try to detect it on your PIC.
    (and you'll soon see what I mean)
    Thank you Ralph,

    I understand what you mean; somehow I have short of experience with PDS and PBP compilers. Anyway your advice still appreciates

    Regards,

    Joe

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. AUTO baud rate detection FOR UART connection to PC
    By mike20200 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd September 2007, 00:56
  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 : 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