Serial comunication osc 20Mhz and baud 38400 donīt work


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2011
    Posts
    12

    Default Serial comunication osc 20Mhz and baud 38400 donīt work

    Hello

    I try hardware serial communication with PIC 18F4520 baudrate 38400 but unfortunatly without sucess
    Have anyone sucess with this. What make i wrong?

    DEFINE OSC 20

    BAUDCON.3 = 1 'SETUP FOR HIGH SPEED.
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H 'HIGH SPEED MODE BAUD RATE GENERATOR
    DEFINE HSER_BAUD 38400
    DEFINE HSER_SPBRG 38H '38400 BAUD
    DEFINE HSER_SPBRGH 01H
    Hserout ["DISPLAY"]
    '
    Have tried this too, but donīt work
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h ;HIGH SPEED BRG SET
    DEFINE HSER_SPBRG 110 ;38400 BAUD
    DEFINE HSER_CLROERR 1 ;AUTO CLEAR ERRORS
    Hserout ["DISPLAY-B"]

    Can anyone help?
    Thanks in advance
    visitac

  2. #2
    Join Date
    Dec 2010
    Location
    Colchester England
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Serial comunication osc 20Mhz and baud 38400 donīt work

    Hi Visitac

    Will this work for you.

    define OSC 20
    define HSER_CLROERR 1 ' Automatically clear over-run errors
    define HSER_SPBRG 32 ' 32 = 38400 at -1.36%error MisterE Calc software
    define HSER_RCSTA 90h ' Enable USART receive
    define HSER_TXSTA 24H ' Set TXSTA to allow for higher baud rate

    Hserout ["DISPLAY-B"]

    Not tried 18F4520 but works on 18F4331 OK (from what I remember, long time ago).

    Chris

  3. #3
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Serial comunication osc 20Mhz and baud 38400 donīt work

    A quick look at the datasheet suggests it is never going to run at that rate.
    Try 9600 and see how that works.

  4. #4
    Join Date
    Nov 2011
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Serial comunication osc 20Mhz and baud 38400 donīt work

    Hello Ceetee,

    Thank You, i will try it on Monday

    Charlie, i donīt see on the datasheet why it can not work with 38400 baud

    Best regards
    visita


    Quote Originally Posted by Ceetee View Post
    Hi Visitac

    Will this work for you.

    define OSC 20
    define HSER_CLROERR 1 ' Automatically clear over-run errors
    define HSER_SPBRG 32 ' 32 = 38400 at -1.36%error MisterE Calc software
    define HSER_RCSTA 90h ' Enable USART receive
    define HSER_TXSTA 24H ' Set TXSTA to allow for higher baud rate

    Hserout ["DISPLAY-B"]

    Not tried 18F4520 but works on 18F4331 OK (from what I remember, long time ago).

    Chris

Similar Threads

  1. Serial comunication problem
    By synsyn in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 8th October 2011, 11:00
  2. Can't set 38400 baud @ 48Mhz
    By b1arrk5 in forum Serial
    Replies: 38
    Last Post: - 19th January 2009, 23:56
  3. Unusual serial comunication
    By MegaADY in forum Serial
    Replies: 7
    Last Post: - 5th January 2006, 17:49
  4. How to code Baud 38400
    By chai98a in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2005, 17:30
  5. 18F458 and 20MHz osc problem...
    By batee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th October 2004, 20:16

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