Baud Rate Converter


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2008
    Location
    Pewaukee, WI, USA
    Posts
    2

    Question Baud Rate Converter

    Hi All,

    I need to convert a serial data stream from 9600 baud to 1200 baud. I was wondering if any one has attempted this and could share some code or tips. I am using PIC Basic Pro and the target processor is a 16F876A

    Thanks in advance, Paul

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

    Default

    How much data at a time? And is it always the same (if string) length?
    Could receive into EEPROM at one rate, then send from EEPROM at the other.
    Do the same with an array.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jun 2008
    Location
    Pewaukee, WI, USA
    Posts
    2

    Red face Baud Rate Converter

    Hi Dave,

    Thanks for you thoughts. I believe that the string lengths are the same and the content is constant, but I will need to do some testing to make sure.

    My initial thought was to read the string into and 8*String_length array on one serial input port defined at 9600 baud, discard 7 of the array elements and transmit the 8th element on another serial port defined as 1200 baud and loop back.

    Actually the above approach may be over engineering it. It might be as simple as reading in the string, retransmitting it and when its done, go get another string.

    My reason that I posed the question to the forum is that I suspect that someone has figured this out before, probably with a far more elegant solution than my idea. I just didn't want to re invent the wheel.

    Regards, Paul

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    Find out what the strings actually look like. You can probably set it up to 'trigger' on a certain byte and take the next byte or the next one, whatever.

    Other than that, yes, grab 8, throw 7, send out the 8th. That'll work, as long as the 9600 baud isn't coming in fast enough to overwhelm the 1200 baud data. You could do it completely in software (SERIN/SEROUT) as long as the timing permits and NOTHING could possibly overlap, otherwise, you'll end up using either a combination of hardware/software serial comm's, or maybe some external 'steering' logic...grab the 9600 baud, re-do the baud rate registers, steer the data, send the 1200 baud, re-do the baud registers, re-steer the data, grab the 9600...and so on...
    Actually, since you are only RECEIVING 9600 and SENDING 1200, you probably wouldn't have to do any steering at all. Just use the same hardware serial port for both, 9600 on the RX, 1200 on the TX, switch baud rates in mid-stream. Shouldn't be too difficult.

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. PIC 18f1220 EUSART Baud Rate Cache Problem
    By wklose99 in forum Off Topic
    Replies: 3
    Last Post: - 15th April 2008, 00:39
  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