hserout not working with parity


Results 1 to 7 of 7

Threaded View

  1. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    What I was trying to say in the other thread was ...

    If you want 9 total bits (8 data + 1 parity) then the USART must be set for 9-bit operations.
    That is done by setting TX9 (TXSTA.6) and RX9 (RCSTA.6) bits.

    With your current settings, that would be ...

    DEFINE HSER_RCSTA 0D0h
    DEFINE HSER_TXSTA 64h


    However, PBP will do that for you, if you let it.
    But when you use these defines ...
    Code:
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H 'HIGH SPEED MODE BAUD RATE GENERATOR
    then you have specified what TXSTA and RCSTA values should be, and that overrides anything PBP will do.
    And 9-bit will not be enabled.

    If you don't define TXSTA and RCSTA, then PBP will do it for you, and all you have to tell it is the baud rate, total bits and parity.
    In your case ...
    Code:
    DEFINE OSC 48 ; set oscilator speed to 48mHz 
    DEFINE HSER_BAUD  38400
    DEFINE HSER_BITS 9
    DEFINE HSER_EVEN 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    hth,
    Last edited by Darrel Taylor; - 24th March 2010 at 08:41.
    DT

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