HSEROUT Disable


Closed Thread
Results 1 to 3 of 3

Thread: HSEROUT Disable

  1. #1

    Default HSEROUT Disable

    Is there any way to disable the hserout function once it's set in place with DEFINES? I found that the pins assigned to the hardware function cannot be used for anything else.

    [QUOTE'Define hserout parametersDEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 2400
    DEFINE HSER_CLROERR 1 'clear overflow error

    APFCON.7 = 1 'rx on ra1 (16f1823)
    APFCON.2 = 1 'tx on pin ra0 (16f1823) ][/QUOTE]

    I use hserout briefly at the start of my program. Later, I would to use pin RA0 for something else, but the circuit does work. Oddly, the debug function does not have any problem with this kind of switching.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT Disable

    Hi,
    Try something like
    Code:
    SPEN VAR RCSTA.7    ' Serial port enable
    
    USART_OFF:
    SPEN = 0
    
    USART_ON:
    SPEN = 1
    You MAY (but I don't think it's neccessary) also need to toggle the TXEN-bit, it's in the TXREG somewhere...

    /Henrik.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT Disable

    Henrick,
    Your suggestion worked.
    It's the TX pin that I wanted to free up after using hersout at the top of my program. So, I inserted this line.

    TXSTA.5 = 0 'disable transmit function.

    Later, the function is re-enabled:

    TXSTA.5 = 1

    I should have read the data sheet more carefully.
    Thanks,
    Dick

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