No announcement yet.

Using com_TXemptyEvent

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by ESPsupport View Post
    I know of no system that can return the number of bytes in the hardware queue, they all return the number of bytes still to be sent to the hardware (buffer).
    Please see bits UTXISEL and TRMT in UxSTA status register of Diablo16 processor...

    Originally posted by ESPsupport View Post
    If you really need to know when the hardware buffer is empty in your code, try using com_TXemptyEvent()
    I tried it and got to know, that I must send one more dummy character to not break ongoing useful transmission...


    • #17
      Really, this is very sad, my answer was typed in haste and so is not completely correct.

      I answered your queries about this in January, in an Email. There they are again.

      >can you answer me please when the func bufEmpty() in the example BUFFEREDTX.4DG is processed?

      It is processed when the physical buffer is empty, which occurs when the UART hardware loads the last character for sending.

      If, however, you set a turnaround pin, it occurs when the last character in the UART hardware has been transmitted.

      You didn't respond in a way related to this particular question, so I thought that you understood what was going on.

      The next I see is this rather ridiculous throw away comment here, this is not really fair, and just plain wrong.

      Here are traces to show what was explained above

      Click image for larger version

Name:	TurnPlusEvent.png
Views:	35
Size:	27.9 KB
ID:	75447
      When both Turnarounf Pin and event are used.

      Click image for larger version

Name:	TurnOnly.png
Views:	40
Size:	27.7 KB
ID:	75448
      When only Turnaround Pin is used.

      Click image for larger version

Name:	EventOnly.png
Views:	61
Size:	29.0 KB
ID:	75445
      When only Event is used. In this case the event occurs when the SW buffer is empty and can thus be too close to, or in the middle of, the last transmission. A dummy turnaround pin can be used to force the event to the same position as in the first case.

      Click image for larger version

Name:	EventWithDummyTurnaround.png
Views:	40
Size:	27.8 KB
ID:	75446
      Event with dummy turnaround.

      Code is attached


      • #18
        I'm sorry, in January it was for another usage so I didn't remember this workaround with turnaround pin.
        Today I meet the same problem in another situation and port COM0 and was unable to find any solution in manuals or forum.
        Solution with dummy turnaround pin has one complication as I have no free pin left in this application, ie. every pins are used for something useful.
        Or can I set as turnaround pin pin which is set and used as input (for example RX pin)?
        I will experiment with it next week.
        Thank you


        • #19
          Look at the example, it is a non existent pin (0xffff)