Sub durch Timer-ISR beenden

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    Aufgrund technischer Veränderungen ist der Mailverkehr innerhalb des Forums (Private Nachrichten) nur noch eingeschränkt möglich. Die Einschränkung ist notwendig, um zusätzliche Betriebskosten für das Forum zu vermeiden. Näheres zu den Hintergründen im Thread "Aktuelles zum Forum".Wir bitten um Verständnis.

    Hinweis kann nach Kenntnisnahme deaktiviert werden!

    • Probier mal $timeout, die Hilfe schreibt:
      Action
      Enable timeout on the hardware UART and software UART.
      Syntax
      $TIMEOUT = value
      Remarks
      Value
      A constant that fits into a LONG , indicating how much time must be waited before the waiting is terminated.

      All RS-232 serial statements and functions(except INKEY) that use the hardware UART or software UART, will halt the program until a character is received. Only with buffered serial input you can process your main program while the buffer receives data on the background.
      $TIMEOUT is an alternative for normal serial reception. It is not intended to be used with buffered serial reception. As of version 2077, the first (and only the first) UART supports the $TIMEOUT feature.
      When you assign a constant to $TIMEOUT, you actual assign a value to the internal created value named ___TIMEOUT.
      This value will be decremented in the routine that waits for serial data. When it reaches zero, it will terminate.
      So the bigger the value, the longer the wait time before the timeout occurs. The timeout is not in seconds or microseconds, it is a relative number. Only the speed of the oscillator has effect on the duration. And the value of the number of course.
      When the time out is reached, a zero/null will be returned to the calling routine. Waitkey() will return 0 when used with a byte. When you use INPUT with a string, the timeout will be set for every character. So when 5 characters are expected, and they arrive just before the timeout value is reached, it may take a long time until the code is executed.
      Raum für Notizen

      -----------------------------------------------------------------------------------------------------

      -----------------------------------------------------------------------------------------------------
    • Hi,

      habe ich auch alles zigmal gelesen.

      Aber mir will nicht klar werden, was genau mit "first" UART gemeint ist.
      Ich habe nur einen, und dass ist ein Soft_Uart, somit kann ich den Vorschlag von Michael nicht nutzen.
      Der Timeout geht bei mir nicht, dann ist es wohl nicht der "erste" Uart?!?
      Ich benutze zwar auch das Serout-Kommando um ein Soundmodul seriell anzusteuern, das ist aber eine Einbahnstrasse...und wird ja auch nicht z.B. mit open eingerichtet...

      Was bedeutet, der erste? wird das in der Config eingestellt, also, welche Uart ich zuerst definiere, ist die erste?
      Aber ich close die doch auch gleich wieder, was also ist die erste?

      Der Soft_Uart ist halt etwas eingeschränkt.
      Allerdings könnte ich den PCINT, auf dem der S-Uart liegt, evtl. einsetzen.
      Habe ich schon versucht und kam nicht ganz weiter...

      Ich bin also, wie man sieht, recht auf dem Schlauch...
    • Ist es noch aktuell? möglicherweise wäre das hilfreich:

      Serial0bytereceived:
      Ein = _rs_bufcountr0 - 1 ' -1 nur falls config Base=0
      Set Zin 'Zeichen empfangen
      If Ein > 15 Then Clear Serialin0
      If _rs232inbuf0(ein) = Chr(13) Then
      Set Neu 'Neuer Befehl
      End If
      Return

      Damit könnte eine Wartezeit eingerichtet werden die eine Fehler ausgibt wenn nicht innerhalb einer gewissen Zeit ein Zeichen oder Befehl/Antwort empfangen wurde.