USART TX Interrupt problem. (DT_INTS)


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: USART TX Interrupt problem. (DT_INTS)

    Henrik, Yes I understand now. However if you are going to use this routine:
    '-- Interrupt service rotuine for USART TX Interrupt ---------------
    USART_TX:
    TXReg = String_1[TxPointer] ' Load character from array into USART TX register
    If String_1[TxPointer] = 0 then ' If that character was a NULL we're done so we.....
    @ INT_DISABLE TX_INT ; ...disable the any further USART TX interrupts.
    ELSE ' If the character was not a CR we.....
    TxPointer = TxPointer + 1 ' ...increase the pointer, prepare to send the next character.
    ENDIF ' As soon as the TX-reg is empty the interrupt will fire again. (~1ms at 9600baud)
    @ INT_RETURN

    I would check for the end of the string before I send the a character, That way you won't be sending the null character from the end of the array. You will get an interrupt when the last character is sent and at that time you don't want to be sending any more, just disable the interrupt and leave.... just change the routine to read:

    '-- Interrupt service rotuine for USART TX Interrupt ---------------
    USART_TX:
    If String_1[TxPointer] = 0 then ' If that character was a NULL we're done so we.....
    @ INT_DISABLE TX_INT ; ...disable the any further USART TX interrupts.
    ELSE ' If the character was not a CR we.....
    TXReg = String_1[TxPointer] ' Load character from array into USART TX register
    TxPointer = TxPointer + 1 ' ...increase the pointer, prepare to send the next character.
    ENDIF ' As soon as the TX-reg is empty the interrupt will fire again. (~1ms at 9600baud)
    @ INT_RETURN
    Dave Purola,
    N8NTA
    EN82fn

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


    Did you find this post helpful? Yes | No

    Default Re: USART TX Interrupt problem. (DT_INTS)

    Hi Dave,
    Good point! I cut and pasted the routine from a working program in which I used 13 as the string terminator - which I did want to send. With NULL as the terminator checking it first is of course better.

    /Henrik.

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