Communicate with PC at baud rate :115200 bps


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1

    Question Communicate with PC at baud rate :115200 bps

    Hi all,
    I woking on project communicate with Nokia 5110 through serial protocol , but I have a problem that the serial protocol must be at baud rate 115200 bps , so I try PC with PIC16f877a first. I can communicate at 9600 with higher than this the data is not true it's corrupted .
    if anyone can help me ?

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


    Did you find this post helpful? Yes | No

    Default

    Hello iugmoh,
    Need a little more information, over what distance, what kind of wire are you using, are you using max 232 level shifters chips, are you using hand shaking, what oscillator speed is the PIC running, are you using serout, serout2, hserout . . . ? Do a search on character pacing
    http://www.picbasic.co.uk/forum/showthread.php?p=3633
    Last edited by Archangel; - 8th March 2008 at 06:30.
    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.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    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 19: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.

  5. #5


    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

  6. #6


    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

  7. #7
    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...

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    I can communicate at 9600 with higher than this the data is not true it's corrupted
    Quote Originally Posted by iugmoh View Post
    2- 4MHZ or 8MHZ crystal
    3- PIC16F877A or PIC18f452 or PIC4220
    Says right in the back of the manual that a faster clock speed than 4Mhz will most likely be needed with a 4Mhz crystal, like quite a bit faster.
    If you're using a '452, turn on the 4xPLL and use the 8Mhz crystal. That'll give you 32Mhz to play with.

  9. #9
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    But i always use 115200 Baud in nokia 3350 sms zone alarm with this code.

    DEFINE OSC 12 ( I use 11.0592 mhz xtal after define osc 12 )

    OUTPUT PORTC.6 '-- SERIAL Port TX
    INPUT PORTC.7 '-- SERIAL Port RX

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 5 ' 115200 Bauds with 0% error

    HSEROUT [X,Y,Z]

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by precision View Post
    But i always use 115200 Baud in nokia 3350 sms zone alarm with this code.
    Well, that'll work too, because you're using the HARDWARE USART.
    The note at the back of the book is for SERIN(2)/SEROUT(2).
    The O/P didn't specify if hardware or software serial was being used...

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. pic18f4520 baud rate change to 115200
    By caltex88 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th September 2007, 08:41
  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 : 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