Communicate with PC at baud rate :115200 bps


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    oky I have these things :
    1- max232 converter
    2- 4MHZ or 8MHZ crystal
    3- PIC16F877A or PIC18f452 or PIC4220

    I make a programm and put the values accoding to formula baud=fosc/(16(x+1)) or baud=fosc(64/(x+1))

    but the data I recived from pic at pc is a strange data not know
    "4MHZ or 8MHZ crystal" 4mhz too slow 8mhz probably too slow
    go get this from mister e http://www.mister-e.org/pages/picmulticalcpag.html
    using Mister_e's calculator set for 8mhz we get these settings:

    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 16 ' 115200 Baud @ 8MHz, 2.12%
    SPBRGH = 0
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator

    You may need to slow the character pacing a bit. DEFINE CHAR_PACING 1000
    Last edited by Archangel; - 8th March 2008 at 20:28.
    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.

  2. #2


    Did you find this post helpful? Yes | No

    Default start bit errors

    By default, PIC ports have their OFF or IDLE condition as zero volts. RS-232 however defines the IDLE or steady mark to be negative volts at the 25 pin connector. This means the idle condition between the PIC and the MAX232 chip must be HIGH or positive - the reverse of what you might first think.

    An asynchronous character begins when the receiving device detects the transition from the steady MARK to a SPACE bit. BUT, if you did nothing to the Txoutput pin before that character started, then the line had been in the space condition for some time. i.e. the start bit goes missing and so the character is corrupted.

    Try this.

    HIGH Txpin 'sets the RS-232 connector pin to negative = Mark = Idle
    pause 1 ' lest the line settle and the remote device see the mark condition
    Serout/hserout/serout21 pin, rate, data 'the message now starts with a guaranteed start bit.

    HTH
    BrianT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    SPBRGH = 0
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
    Oky with PIC16f877a this give me an error because theses registers are not exist

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    Oky with PIC16f877a this give me an error because theses registers are not exist
    And a quick look at the '877A datasheet, Table 10-3, would tell you that getting 115,200 baud out of 4 or 8 Mhz isn't going to happen, unless you can somehow magically get a divisor of 1.5 stuff into that byte value.
    You need more crystals in your toolbox.
    Actually, what you need is more variety...

  5. #5


    Did you find this post helpful? Yes | No

    Default

    ok what is the suitable PIC IC needed with crystal to achive this problem

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    ok what is the suitable PIC IC needed with crystal to achive this problem
    FASTER...that's all...FASTER! Read the Tables and you'll see what I mean.
    A serial link can tolerate X amount of error. So, find the combination of oscillator speeds and serial communication speeds that works for your unique situation.
    I can't help you much more than that...I don't think anybody can...until you do some reading and comprehending the information involved.
    The 16F877A will run at 20Mhz (possibly a bit faster), the 18Fxxxx series will run at 40Mhz (55Mhz in my experience, but not recommended for reliability). Either of those chips that you have been relating to in your threads will work just fine.
    You need more crystals! More oscillators! More freq! More cycles per second! More HERTZ! More variances of direct current per unit of time!
    That's all!

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 21:58
  2. pic18f4520 baud rate change to 115200
    By caltex88 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th September 2007, 09:41
  3. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 03: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, 23:41
  5. Baud Rate and Timing Calculator
    By picnaut in forum General
    Replies: 3
    Last Post: - 23rd January 2004, 17:48

Members who have read this thread : 2

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