Hallo,
ich würde gerne die Verbindung von zwei RS232 Schnittstellen überwachen und habe mal als Grundlage diesen Link als Funktion genutzt Func_Serial leider stimmt das Timing, oder so nicht. Mein Versuch ist simple, ich wollte einfach sehen, ob die Kommunikation gestört wird.
Könnt Ihr helfen?
[autoit]
#include "Func_Serial.au3"
#include <String.au3>
$ourDll = DllOpen(@SystemDir & "\kernel32.dll")
Global Const $ComPort = 2
Global Const $Baudrate = 2400
Global Const $Bits = 8
Global Const $Parity = 0
Global Const $Stop = 0
Global Const $Rts = 0
Global Const $ComPort1 = 1
Global Const $Baudrate1 = 2400
Global Const $Bits1 = 8
Global Const $Parity1 = 0
Global Const $Stop1 = 0
Global Const $Rts1 = 0
Local $SendPort = _OpenCOMPort($ComPort, $Baudrate, $Bits, $Parity, $Stop, $Rts)
If $SendPort = -1 Then MsgBox(0, "Fehler", "Der sendende COM-Port konnte nicht geöffnet werden!")
Local $SendPort1 = _OpenCOMPort($ComPort1, $Baudrate1, $Bits1, $Parity1, $Stop1, $Rts1)
If $SendPort1 = -1 Then MsgBox(0, "Fehler", "Der sendende COM-Port konnte nicht geöffnet werden!")
While 1
[/autoit][autoit][/autoit][autoit]$sende1= StringToBinary(_ReceiveStringWait($SendPort,100,100))
ConsoleWrite("Sende1 "&$sende1&@CRLF)
_SendSerialString($SendPort1, _hexToString ($sende1))
$sende2=StringToBinary( _ReceiveStringWait($SendPort1,100,100))
_SendSerialString($SendPort, _hexToString ($sende2))
ConsoleWrite("Sende2 "&$sende2&@CRLF)
WEnd
_CloseCOMPort($SendPort)
_CloseCOMPort($SendPort1)