how to set RCSTA


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251

    Default how to set RCSTA

    I use the pic16F876.
    In my definition I want to set the RCSTA register to D0 hex.
    The compiler does not like this.
    When I write:
    DEFINE HSER_RCSTA 90H
    then it is ok
    If I come to A0H or higher the compiler gives an error.
    The compiler is PBP2.47
    Regards
    Mat

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


    Did you find this post helpful? Yes | No

    Default

    EDIT: forget me if you readed the previous post version

    Yeah i got issue here too. so just set all register directly whithout the DEFINEs solve the problem....BUT i didn't check what the A0 value did so, it could be normal
    Last edited by mister_e; - 26th September 2006 at 15:30.
    Steve

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

  3. #3
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Thanks, I did it also like that. But it looks like a small buggiein the compiler!
    Regards.
    M

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


    Did you find this post helpful? Yes | No

    Default

    Hi Mat,

    To set the USART to 9-bit mode, use ...

    DEFINE HSER_BITS 9

    RCSTA will automatically be set to 0D0h
    TXSTA will also be set to 60h

    HTH,
    DT

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


    Did you find this post helpful? Yes | No

    Talking

    i don't know why but my attention was mostely on 'above A0' than on the real purpose ... i just saw that D0.

    Too bad, there's some missing conditions in the Macro
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    I think it would also work with a 0 before the D0h in DEFINE HSER_RCSTA.

    Don't think there's anything missing. Sometimes it helps to look at the Defaults in the PBPPIC14.lib file.
    Code:
    ;****************************************************************
    ;* Default hardware serial port values                          *
    ;****************************************************************
    
        ifndef HSER_BITS
    HSER_BITS = 8			; Default to 8 bits
        endif
        ifndef HSER_RCSTA           ; Receive register data
          if (HSER_BITS != 9)
    HSER_RCSTA EQU 90h              ; Receiver enabled
          else
    HSER_RCSTA EQU 0d0h		; Receiver enabled for 9 bits
          endif
        endif
        ifndef HSER_TXSTA           ; Transmit register data
          if (HSER_BITS != 9)
    HSER_TXSTA EQU 20h              ; Transmitter enabled
          else
    HSER_TXSTA EQU 60h              ; Transmitter enabled for 9 bits
          endif
        endif
    DT

Similar Threads

  1. Pin won't stay high during Repeat...Until loop??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th August 2009, 23:57
  2. Interruptus Frustratus
    By Byte_Butcher in forum General
    Replies: 16
    Last Post: - 17th April 2009, 20:36
  3. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  4. UberNewbie can't set his clock...
    By Byte_Butcher in forum General
    Replies: 19
    Last Post: - 7th January 2009, 04:22
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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