HSEROUT not working @ 40 MHz


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

    Default HSEROUT not working @ 40 MHz

    I running the 18F452 PLL and I'm running into problems with the HSEROUT command. If I use a 4 MHz crystal the LCDOUT command and HSEROUT command work fine. If however I switch out the 4 with a 10 MHz crytal the LCDOUT command still works fine but the HSEROUT output garbage. I have used DEFINE OSC 16 and DEFINE OSC 40 to tell PBP what oscillator speed I'm running. Is there something else I need to do to go to 40 MHz?

  2. #2


    Did you find this post helpful? Yes | No

    Default

    I also just noticed that I have a warning when I define the OSC as 40. The warning is:

    Warning[202] c:\pbp\pbppic18.lib 7695: Argument out of range. Least significant bits used.

  3. #3


    Did you find this post helpful? Yes | No

    Default Found the problem

    After looking through the pbppic18.lib file I noticed that the problem was with the line HSER_TXSTA 24h. It should be HSER_TXSTA 20h.

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


    Did you find this post helpful? Yes | No

    Default

    mmm yes no toaster hamburger after all. I bet you use HSER_BAUD instead of HSER_SPBRG right?

    IF SO it's probably caused by the internal calculation of the SPBRG value.

    Wich BaudRate you wanted to use??? Did you look in the datasheet for the SPBRG value with the TXSTA you did???

    I'm just curious about that one.
    Steve

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

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Just to satisfy your curiosity Mr E

    Code:
    DEFINE  HSER_BAUD 9600
    DEFINE  HSER_CLROERR 1
    DEFINE  HSER_RCSTA 90h
    DEFINE  HSER_TXSTA 20h

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


    Did you find this post helpful? Yes | No

    Default

    HEHE i was right... I post a SPBRH Calc on this forum to help to figure out.

    BTW here's a short explanation. Using the Calc @9600 baud with 40MHZ with TXSTA = $24 give a SPBRG of 255 with error % 1.725. If you decrease this value the error % increase, so increasing SPBRG will reduce the error %... as SPBRG is a Byte register, you can't or you'll be OUT OF RANGE
    Warning[202] c:\pbp\pbppic18.lib 7695: Argument out of range. Least significant bits used.
    This is where it's coming from

    NOW using SPBRG=20 @40MHZ 9600 bauds gives a SPBRG=64 and error % 0.16

    I'm Satisfied now
    Last edited by mister_e; - 14th September 2005 at 17:10.
    Steve

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

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Can you post a link to this Calc. This could come in handy in the future.

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


    Did you find this post helpful? Yes | No

    Default

    here's the link for the download... on this forum
    http://www.picbasic.co.uk/forum/atta...tachmentid=316
    Steve

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

Similar Threads

  1. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  2. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  3. Need help multiplexing EUSART output
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 7th April 2008, 19:17
  4. help
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th February 2005, 20:42
  5. Need once your help one please
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2005, 20:33

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