Pic18f4550 hserout


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

    Default Pic18f4550 hserout

    Hi Guys, Wonder if any one can point out the difference between the PIC18 and PIC 16 HSEROUT commands.
    I normally use the following code in my PIC 16 programs,
    '*Serial port Setup 9600 8E1*
    DEFINE HSER_BAUD 9600 ; 9600 Baud
    DEFINE HSER_BITS 9
    DEFINE HSER_EVEN 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically

    I now want to make use of a PIC18F4550
    the following code work at 38000 baud
    '*Serial port Setup 3800 8N1*
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 56 ' 38400 Baud @ 48MHz, -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1 ' Enable 16 bit baud rate generator

    Is there any way I can get it configured to run 9600 8E1, I have tried changing the HSER_SPBRG value but with no success I also want to activate the parity.

    Any leads would be welcomed.

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588

    Default Re: Pic18f4550 hserout

    No reason why you couldn't. Have you made sure you're not missing any CONFIG? Try to blink an LED first when in doubt.

    Have you tried Mr E's USART Utility to generate the DEFINES?

    Robert
    Last edited by Demon; - 8th September 2014 at 21:29. Reason: MultiCalc: http://www.picbasic.co.uk/forum/showthread.php?t=4994

  3. #3

    Default Re: Pic18f4550 hserout

    It seems to be the 16 bit baud rate generator that is creating the problems as soon as you disable it everything works

Similar Threads

  1. 2 pic18f4550 connection
    By aqieera in forum mel PIC BASIC
    Replies: 0
    Last Post: - 18th November 2011, 03:04
  2. PIC18F4550 help please
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th January 2010, 20:14
  3. PIC18f4550 error
    By williamlaw in forum Off Topic
    Replies: 1
    Last Post: - 14th May 2009, 20:27
  4. DS18B20 and PIC18F4550
    By sjohansson in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th April 2006, 20:57
  5. PIC18F4550 rebooting
    By RubenR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th September 2005, 12:19

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