Interrupt Driven Serial Input using DT_Ints?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Default Interrupt Driven Serial Input using DT_Ints?

    Can someone please point me to a link or example of how to make an interrupt-driven serial input buffer (hserin) for use with DT_Ints? I have had an interrupt jump to and receive an entire string of characters, but I've got too much going on for that, and will have to receive the string one character at a time, and put the command together when there's time. Any example would get me started. Thanks
    Last edited by circuitpro; - 10th August 2010 at 02:08.

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


    Did you find this post helpful? Yes | No

    Default

    Here's one where I modified Joe's serial backback program for use with DT_INTS.

    http://www.picbasic.co.uk/forum/show...8336#post28336
    DT

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Smile

    Thanks very much, Darrel!

  4. #4
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    I am having some kind of issue getting these two uarts set up right. I'm using a PIC18F6722 running at 40MHz. UART1 runs perfectly fine at 115K, but UART2 just can't hack it. (If I lower the baudrate to 57600, it works fine). Besides setting the pin directions, I am using the setup resulting from the PIC Multicalc as follows:

    Code:
    'EUSART 1 (RS422 LINK)
    DEFINE HSER1_RCSTA 90h
    DEFINE HSER1_TXSTA 24h
    DEFINE HSER1_CLROERR 1
    DEFINE HSER1_SPBRG 86
    SPBRGH1 = 0
    BAUDCON1.3 = 1
    
    'EUSART 2 (RS485 LINK)
    DEFINE HSER2_RCSTA 90h
    DEFINE HSER2_TXSTA 24h
    DEFINE HSER2_CLROERR 1
    DEFINE HSER2_SPBRG 86
    SPBRGH2 = 0
    BAUDCON2.3 = 1

    I am not doing anything fancy, just trying to get both ports to transmit and receive at 115k - one at a time. No interrupts, nothing fancy.

    Can anyone tell me why HSERIN2 fails to work when HSERIN1 works at this baudrate?

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


    Did you find this post helpful? Yes | No

    Default

    I'm not sure how you got EUSART1 working.

    There are no HSER1_ defines.
    They are just HSER_ for the first EUSART, and HSER2_ for the second.
    DT

  6. #6
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    The datasheet for the pic just refers to TCSTAx, and at first I was setting them up with HSER_RCSTA and HSER2_RCSTA, but out of mass frustration, thought I would see if it should really be HSER1 & HSER2. (Once again, it's logical, but wrong!)

    Do you see any reason uart2 isn't working at 115k?

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