1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Homer J. S.

Beiträge von Homer J. S.

  • Problem mit DllCall (aaeonEAPI.dll)

    • Homer J. S.
    • 20. März 2019 um 23:12

    Hallo Zusammen,

    ich benötige nach langer Zeit nochmals eure Hilfe. Ich möchte von meinem Mainboard Informationen (Temperatur, GPIO, usw...) abrufen bzw. setzen. Allerdings komme ich mit der DLL nicht wirklich weiter. Nach der Dokumentation (pdf im Anhang) muss man erst ein "EApiLibInitialize" ausführen um gewisse andere Funktionen ausführen zu können und dies funktioniert schon mal ohne Fehlermeldung. Nach Beendigung des Programms muss man ein "EApiLibUnInitialize" ausführen was auch ohne Fehlermeldung funktioniert. Allerdings wenn ich eine andere Funktion aufrufe, dann schließt sich das Script ohne Fehlermeldung oder sonstiges. Ich muss zugeben, dass ich mit DLL´s nicht wirklich bewandert bin. Daher bitte ich euch, mir unter die Arme zu greifen und somit zu helfen.

    Enthaltene Dateien im Anhang (Zip-File):

    1 - aaeonEAPI.dll
    2 - aaeonEAPI.h
    3 - aaeonEAPI.lib
    4 - aaeonEAPI.pdf


    Mein Testcode:

    Spoiler anzeigen
    Code
    #include<array.au3>
    
    
    ;Dll öffnen
    $hDLL=DllOpen(@ScriptDir & "\aaeonEAPI.dll")
    If (@error) Then
     MsgBox(16, "Error DllOpen", @error)
     Exit
    Else
     MsgBox(0, "Info", "DllOpen erfolgreich")
    EndIf
    
    
    ;Dll init
    $DllCall=DllCall($hDLL, "none", "EApiLibInitialize")
    If (@error) Then
     MsgBox(16, "Error DllOpen", @error)
     Exit
    Else
     MsgBox(0, "Info", "EApiLibInitialize erfolgreich")
    EndIf
    
    
    ;Dll Temperaturabfrage
    $Buffer=0
    $EAPI_ID_HWMON_CPU_TEMP=0x20000 ;Aus der Datei aaeonEAPI.h
    $aRet=DllCall($hDLL, "uint", "EApiBoardGetValue", "uint", $EAPI_ID_HWMON_CPU_TEMP, "uint*", $Buffer)
    If (@error) Then
     MsgBox(16, "Error DllOpen", @error)
     Exit
    Else
     If IsArray($aRet) Then
      _ArrayDisplay($aRet, "Temperaturantwort"
     Else
      MsgBox(0, "Temperaturantwort", $aRet)
     EndIf
     If IsArray($Buffer) Then
      _ArrayDisplay($Buffer, "Temperaturbuffer"
     Else
      MsgBox(0, "Temperaturbuffer", $Buffer)
     EndIf
    ENDIF
    
    
    ;Dll uinit
    $DllCall=DllCall($hDLL, "none", "EApiLibUnInitialize")
    If (@error) Then
     MsgBox(16, "Error DllOpen", @error)
     Exit
    Else
     MsgBox(0, "Info", "EApiLibUnInitialize erfolgreich")
    EndIf
    
    
    ;Dll schliessen
    DllClose($hDLL)
    
    
    ;Script Ende
    MsgBox(0, "Info", "Script beenden")
    Alles anzeigen

    Ich bedanke mich im voraus für eure Unterstützung/Hilfe!


    Gruß

    Homer J. S.

    Dateien

    aaeonEAPI.zip 1,93 MB – 801 Downloads
  • Netzwerk-Analyzer

    • Homer J. S.
    • 10. September 2016 um 11:35

    Landfloh:
    Dein Vorhaben könnte mit einem UDP-Broadcast funktionieren. Allerdings benötigst du dann einen "Master" im Netzwerk der eine Antwort mit den gewünschten Informationen generiert.

    Gruß
    Homer J. S.

  • ModBus & libmodbus.dll - Funktion "0x10" (modbus_write_registers) integrieren

    • Homer J. S.
    • 17. August 2016 um 13:26

    Hallo Zusammen,
    ich habe mich letzter Zeit ein wenig mit der ModBus-UDF beschäftigt und ein Gerät läuft schon ohne Probleme. Allerdings benötige ich bei einem anderem Gerät die ModBus-Funktion "0x10" (modbus_write_registers), die in der Modbus-UDF (ModBus-UDF) nicht enthalten ist. Ich habe versucht diese selber zu integrieren aber leider ohne Erfolg. Allerdings tue ich mich auch sehr schwer mit einem DLL-Call.

    Im Anhang ist die Original Doku der ModBus-Funktion "0x10" von der libmodbus.dll (modbus_write_registers.zip).

    Hier ist die gekürzte (ohne native Funktionen) ModBus-UDF:

    Spoiler anzeigen
    AutoIt
    #include-Once
    ; #INDEX# =======================================================================================================================
    ; Title .........: libmodbus
    ; AutoIt Version : 3.2.10++
    ; Language ......: English/German
    ; Description ...: Functions for Handling the http://libmodbus.org/ dll
    ; Author(s) .....: vivus ( Marc Neininger ), funkey,
    ;					The libmodbus documentation was written by Stéphane Raimbault <stephane.raimbault@gmail.com>
    ; ===============================================================================================================================
    #include <Array.au3>
    #include <WinAPI.au3>
    Const $_sUDFVersion = 'V1.0'
    
    
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: __WinAPI_Int64ToDouble
    ; Description ...: Returns a 8 byte integer as a double value
    ; Syntax.........: __WinAPI_IntToFloat($iInt64)
    ; Parameters ....: $iInt64    - 8 byte Integer value (64 bit)
    ; Return values .: Success    - 8 byte integer value as a double
    ; Author ........: funkey
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func __WinAPI_Int64ToDouble($iInt64)
        Local $__TIDnt64 = DllStructCreate("INT64")
        Local $tDouble = DllStructCreate("double", DllStructGetPtr($__TIDnt64))
        DllStructSetData($__TIDnt64, 1, $iInt64)
        Return DllStructGetData($tDouble, 1)
    EndFunc   ;==>_WinAPI_Int64ToDouble
    
    
    Func __Convert_To_Binary($iNumber)
        Local $sBinString = ""
        Do
            $sBinString = BitAND($iNumber, 1) & $sBinString
            $iNumber = BitShift($iNumber, 1)
        Until $iNumber <= 0
        If $iNumber < 0 Then SetError(1, 0, 0)
        Return $sBinString
    EndFunc   ;==>_Convert_To_Binary
    
    
    
    
    Global $hDLL_Modbus = 0
    Global $__DLLNAME = 'libModbus.dll'
    ;===============================================================================
    ; Function Name:  _Modbus_SetDllPath($sFullPath)
    ; Description:    Sets full path to th extdll so that it can be in any location.
    ; Parameters:     $sFullPath -  Full path to the libmodbus.dll e.g. "C:\libmodbus\libmodbus.dll"
    ; Returns;  on success 1
    ;           on error -1 if full path does not exist
    ;===============================================================================
    Func _Modbus_SetDllPath($sFullPath)
        If Not FileExists($sFullPath) Then Return -1
    
    
        $__DLLNAME = $sFullPath
        Return 1
    
    
    EndFunc   ;==>_CommSetDllPath
    
    
    ;===============================================================================
    ; Function Name:  _Modbus_DllOpen()
    ; Description:    Start the Connection to the libmodbus dll
    ; Parameters:
    ; Returns;  on success 1
    ;           on error -1
    ;===============================================================================
    Func _Modbus_DllOpen()
    	$hDLL_Modbus = DllOpen($__DLLNAME)
            If $hDLL_Modbus = -1 Then
                SetError(1)
                $sErr = 'Failed to open DLL'
                Return 0;failed
            EndIf
    
    
    	return 1
    EndFunc
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_New_TCP
    ; Description ...: The modbus_new_tcp() function shall allocate and initialize a modbus_t structure to communicate with a Modbus TCP/IPv4 server.
    ; Syntax.........: _Modbus_New_TCP($sIP, $iPort = 502)
    ; Parameters ....: The ip argument specifies the IP address of the server to which the client wants etablish a connection.
    ;                  The port argument is the TCP port to use. Set the port to MODBUS_TCP_DEFAULT_PORT to use the default one (502). It’s convenient to use a port number greater than or equal to 1024 because it’s not necessary to have administrator privileges.
    ; Return values .: The modbus_new_tcp() function shall return a pointer to a modbus_t structure if successful. Otherwise it shall return NULL and set errno to one of the values defined below.
    ;                  Failure EINVAL An invalid IP address was given.
    ; C-Syntax.......: modbus_t *modbus_new_tcp(const char *ip, int port);
    ; ===============================================================================================================================
    Func _Modbus_New_TCP($sIP, $iPort = 502)
    	Local $aRet = DllCall($hDLL_Modbus, "ptr:cdecl", "modbus_new_tcp", "str", $sIP, "int", $iPort)
    	Return $aRet[0]
    EndFunc   ;==>_Modbus_New_TCP
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Connect
    ; Description ...: The modbus_connect() function shall etablish a connection to a Modbus server, a network or a bus using the context information of libmodbus context given in argument.
    ; Syntax.........: _Modbus_Connect($tModbus)
    ; Parameters ....: The $tModbus handle
    ; Return values .: The modbus_connect() function shall return 0 if successful. Otherwise it shall return -1 and set errno to one of the values defined by the system calls of the underlying platform.
    ; C-Syntax.......: int modbus_connect(modbus_t *ctx);
    ; ===============================================================================================================================
    Func _Modbus_Connect($tModbus)
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_connect", "ptr", $tModbus)
    	Return $aRet[0]
    EndFunc   ;==>_Modbus_Connect
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Close
    ; Description ...: The modbus_close() function shall close the connection established with the backend set in the context.
    ; Syntax.........: _Modbus_Close($tModbus)
    ; Parameters ....: The $tModbus handle
    ; Return values .: There is no return value.
    ; C-Syntax.......: void modbus_close(modbus_t *ctx);
    ; ===============================================================================================================================
    Func _Modbus_Close($tModbus)
    	DllCall($hDLL_Modbus, "none:cdecl", "modbus_close", "ptr", $tModbus)
    EndFunc   ;==>_Modbus_Close
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Free
    ; Description ...: The modbus_free() function shall free an allocated modbus_t structure.
    ; Syntax.........: _Modbus_Free($tModbus)
    ; Parameters ....: The $tModbus handle
    ; Return values .: There is no return value.
    ; C-Syntax.......: void modbus_free(modbus_t *ctx);
    ; ===============================================================================================================================
    Func _Modbus_Free($tModbus)
    	DllCall($hDLL_Modbus, "none:cdecl", "modbus_free", "ptr", $tModbus)
    EndFunc   ;==>_Modbus_Free
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_StrError
    ; Description ...: The modbus_strerror() function shall return a pointer to an error message string corresponding to the error number specified by the errnum argument. As libmodbus defines additional error numbers over and above those defined by the
    ;					operating system, applications should use modbus_strerror() in preference to the standard strerror() function.
    ; Syntax.........: _Modbus_StrError($iError)
    ; Parameters ....: the Error number
    ; Return values .: The modbus_strerror() function shall return a pointer to an error message string.
    ; C-Syntax.......: const char *modbus_strerror(*int errnum);
    ; ===============================================================================================================================
    Func _Modbus_StrError($iError)
    	Local $aRet = DllCall($hDLL_Modbus, "str:cdecl", "modbus_strerror", "int", $iError)
    	Return $aRet[0]
    EndFunc   ;==>_Modbus_StrError
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Read_Registers
    ; Description ...: The modbus_read_registers() function shall read the content of the nb holding registers to the address addr of the remote device. The result of reading is stored in dest array as word values (16 bits).
    ;					You must take care to allocate enough memory to store the results in dest (at least nb * sizeof(uint16_t)).
    ;					The function uses the Modbus function code 0x03 (read holding registers).
    ; Syntax.........: _Modbus_Read_Registers($tModbus, $iAddr, $iNum)
    ; Parameters ....: nb holding registers
    ;				   addr of the remote device
    ; Return values .: The modbus_read_registers() function shall return the number of read registers if successful. Otherwise it shall return -1 and set errno.
    ; C-Syntax.......: int modbus_read_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
    ; ===============================================================================================================================
    Func _Modbus_Read_Registers($tModbus, $iAddr, $iNum)
    	Local $tBuffer = DllStructCreate("WORD[" & $iNum & "]")
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_read_registers", "ptr", $tModbus, "int", $iAddr, "int", $iNum, "struct*", $tBuffer)
    
    
    	Local $aRes[$iNum]
    	For $i = 0 To $iNum - 1
    		$aRes[$i] = DllStructGetData($tBuffer, 1, $i + 1)
    	Next
    	Return $aRes
    EndFunc   ;==>_Modbus_Read_Registers
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Read_Input_Registers
    ; Description ...: The modbus_read_input_registers() function shall read the content of the nb input registers to address addr of the remote device. The result of the reading is stored in dest array as word values (16 bits).
    ;					You must take care to allocate enough memory to store the results in dest (at least nb * sizeof(uint16_t)).
    ;					The function uses the Modbus function code 0x04 (read input registers). The holding registers and input registers have different historical meaning, but nowadays it’s more common to use holding registers only.
    ; Syntax.........: _Modbus_Read_Input_Registers($tModbus, $iAddr, $iNum)
    ; Parameters ....: nb holding registers
    ;				   addr of the remote device
    ; Return values .: The modbus_read_input_registers() function shall return the number of read input registers if successful. Otherwise it shall return -1 and set errno.
    ; C-Syntax.......: int modbus_read_input_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
    ; ===============================================================================================================================
    Func _Modbus_Read_Input_Registers($tModbus, $iAddr, $iNum)
    	Local $tBuffer = DllStructCreate("WORD[" & $iNum & "]")
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_read_input_registers", "ptr", $tModbus, "int", $iAddr, "int", $iNum, "struct*", $tBuffer)
    
    
    	Local $aRes[$iNum]
    	For $i = 0 To $iNum - 1
    		$aRes[$i] = DllStructGetData($tBuffer, 1, $i + 1)
    	Next
    	Return $aRes
    EndFunc   ;==>_Modbus_Read_Input_Registers
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Read_Input_Bits
    ; Description ...: The modbus_read_input_bits() function shall read the content of the nb input bits to the address addr of the remote device. The result of reading is stored in dest array as unsigned bytes (8 bits) set to TRUE or FALSE.
    ;					You must take care to allocate enough memory to store the results in dest (at least nb * sizeof(uint8_t)).
    ;					The function uses the Modbus function code 0x02 (read input status).
    ; Syntax.........: _Modbus_Read_Input_Bits($tModbus, $iAddr, $iNum)
    ; Parameters ....: nb holding registers
    ;				   addr of the remote device
    ; Return values .: The modbus_read_input_status() function shall return the number of read input status if successful. Otherwise it shall return -1 and set errno.
    ; C-Syntax.......: int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
    ; ===============================================================================================================================
    Func _Modbus_Read_Input_Bits($tModbus, $iAddr, $iNum = 1)
    	Local $tBuffer = DllStructCreate("WORD[" & $iNum & "]")
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_read_input_bits", "ptr", $tModbus, "int", $iAddr, "int", $iNum, "struct*", $tBuffer)
    
    
    	Local $aRes[$iNum]
    	For $i = 0 To $iNum - 1
    		$aRes[$i] = DllStructGetData($tBuffer, 1, $i + 1)
    	Next
    
    
    	If $iNum = 1 Then
    		Return $aRes[0]
    	Else
    		Return $aRes
    	EndIf
    EndFunc   ;==>_Modbus_Read_Input_Bits
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Read_Bits  ( offiziell Read Coil )
    ; Description ...: The modbus_read_bits() function shall read the status of the nb bits (coils) to the address addr of the remote device. The result of reading is stored in dest array as unsigned bytes (8 bits) set to TRUE or FALSE.
    ;					You must take care to allocate enough memory to store the results in dest (at least nb * sizeof(uint8_t)).
    ;					The function uses the Modbus function code 0x01 (read coil status).
    ; Syntax.........: _Modbus_Read_Bits($tModbus, $iAddr, $iNum = 1 )
    ; Parameters ....: nb holding registers
    ;				   addr of the remote device
    ; Return values .: The modbus_read_bits() function shall return the number of read bits if successful. Otherwise it shall return -1 and set errno.
    ; C-Syntax.......: int modbus_read_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
    ; ===============================================================================================================================
    Func _Modbus_Read_Bits($tModbus, $iAddr, $iNum = 1)
    	Local $tBuffer = DllStructCreate("WORD[" & $iNum & "]")
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_read_bits", "ptr", $tModbus, "int", $iAddr, "int", $iNum, "struct*", $tBuffer)
    
    
    	Local $aRes[$iNum]
    	For $i = 0 To $iNum - 1
    		$aRes[$i] = DllStructGetData($tBuffer, 1, $i + 1)
    	Next
    
    
    	If $iNum = 1 Then
    		Return $aRes[0]
    	Else
    		Return $aRes
    	EndIf
    EndFunc   ;==>_Modbus_Read_Bits
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Write_Bit  ( write a single bit )
    ; Description ...: The modbus_write_bit() function shall write the status of status at the address addr of the remote device. The value must be set to TRUE or FALSE.
    ;					The function uses the Modbus function code 0x05 (force single coil).
    ; Syntax.........: _Modbus_Write_Bit($tModbus, $iAddr, $status )
    ; Parameters ....: addr of the remote device
    ;				   $status - True False
    ; Return values .: The modbus_write_bit() function shall return 1 if successful. Otherwise it shall return -1 and set errno.
    ; C-Syntax.......: int modbus_write_bit(modbus_t *ctx, int addr, int status);
    ; ===============================================================================================================================
    Func _Modbus_Write_Bit($tModbus, $iAddr, $status)
    	;Local $tBuffer = DllStructCreate("WORD[" & $iNum & "]")
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_write_bit", "ptr", $tModbus, "int", $iAddr, "int", $status);, "struct*", $tBuffer)
    
    
    	If (UBound($aRet)) >= 4 Then
    		If $aRet[3] = $status Then
    			Return 1
    		Else
    			Return -1
    		EndIf
    	EndIf
    	Return -1
    
    
    EndFunc   ;==>_Modbus_Write_Bit
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Write_Bits  ( offiziell write coils )
    ; Description ...:
    ; Syntax.........: _Modbus_Write_Bits($tModbus, $iAddr, $iNum)
    ; Parameters ....:
    ; Return values .:
    ; C-Syntax.......: int modbus_read_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
    ; ===============================================================================================================================
    Func _Modbus_Write_Bits($tModbus, $iAddr, $iNum)
    	Local $tBuffer = DllStructCreate("WORD[" & $iNum & "]")
    	;Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_write_bits", "ptr", $tModbus, "int", $iAddr, "int", $iNum, "struct*", $tBuffer)
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_write_bits", "ptr", $tModbus, "int", $iAddr, "int", $iNum);, "struct*", $tBuffer)
    	;Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_write_bits", "ptr", $tModbus, "int", $iAddr, "int", $iNum, "struct*", $tBuffer)
    
    
    	Local $aRes[$iNum]
    	For $i = 0 To $iNum - 1
    		$aRes[$i] = DllStructGetData($tBuffer, 1, $i + 1)
    	Next
    
    
    	If $iNum = 1 Then
    		Return $aRes[0]
    	Else
    		Return $aRes
    	EndIf
    EndFunc   ;==>_Modbus_Write_Bits
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Write_Register  ( write a single register )
    ; Description ...: The modbus_write_register() function shall write the value of value holding registers at the address addr of the remote device.
    ;					The function uses the Modbus function code 0x06 (preset single register).
    ; Syntax.........: _Modbus_Write_Register($tModbus, $iAddr, $Value)
    ; Parameters ....: addr of the remote device
    ;				   $status - True False
    ; Return values .: The modbus_write_register() function shall return 1 if successful. Otherwise it shall return -1 and set errno.
    ; C-Syntax.......: int modbus_write_register(modbus_t *ctx, int addr, int value);
    ; ===============================================================================================================================
    Func _Modbus_Write_Register($tModbus, $iAddr, $Value)
    
    
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_write_register", "ptr", $tModbus, "int", $iAddr, "int", $Value)
    
    
    	If (UBound($aRet)) >= 4 Then
    		If $aRet[3] = $Value Then
    			Return 1
    		Else
    			Return -1
    		EndIf
    	EndIf
    
    
    	Return -1
    
    
    EndFunc   ;==>_Modbus_Write_Register
    
    
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _Modbus_Set_Debug  ( set debug flag of the context)
    ; Description ...: The modbus_set_debug() function shall set the debug flag of the modbus_t context by using the argument boolean. When the boolean value is set to TRUE, many verbose messages are displayed on stdout and stderr. For example, this
    ;					flag is useful to display the bytes of the Modbus messages.
    ;					[00][14][00][00][00][06][12][03][00][6B][00][03]
    ;					Waiting for a confirmation…
    ;					<00><14><00><00><00><09><12><03><06><02><2B><00><00><00><00>
    ; Syntax.........: _Modbus_Set_Debug($tModbus, $boolean)
    ; Parameters ....: When the boolean value is set to TRUE many verbose messages are displayed on stdout and stderr
    ;
    ; Return values .: There is no return values.
    ; C-Syntax.......: void modbus_set_debug(modbus_t *ctx, int boolean);
    ; ===============================================================================================================================
    Func _Modbus_Set_Debug($tModbus, $boolean)
    
    
    	Local $aRet = DllCall($hDLL_Modbus, "int:cdecl", "modbus_set_debug", "ptr", $tModbus, "int", $boolean)
    
    
    	Return $aRet
    
    
    EndFunc
    Alles anzeigen

    Hier noch ein Link zu einem autoit.de-Thread wo @funkey und @vivus schon einiges besprochen haben: ModBus Thread

    Vieleicht findet sich ja einer von euch, der mir bezüglich der Integration helfen kann/will?!

    Vielen dank schon mal für eure Hilfe!

    Gruß
    Homer J. S.

    Dateien

    modbus_write_registers.zip 2,63 kB – 648 Downloads
  • modbus

    • Homer J. S.
    • 10. August 2016 um 22:38

    Hallo Zusammen,
    ich hatte nochmal etwas mehr Zeit mich mit ModBus zu beschäftigen.

    Zitat von Homer J. S.

    Allerdings wenn ich einen Disconnect mache, dann geht der Koppler in Störung, die sich nur durch AEG (ausschalten, einschalten, geht) lösen lässt. Das passiert allerdings nur, wenn ich nach einem Connect einen Ausgang gesetzt hatte.

    Das ist kein fehler vom ModBus bzw. der UDF, sondern das ist vom Watchdog des Beckhoff-Buskopllers. Dies kann man allerdings über den ModBus quittieren.
    Hier der Code dazu:

    Spoiler anzeigen
    AutoIt
    $Answer=_Modbus_Read_Registers($tModbus, 4108, 1)
    If (BitAND(32768, $Answer[0])=0) Then
    	_Modbus_Write_Register($tModbus, 4385, 48847)
    	Sleep(10)
    	_Modbus_Write_Register($tModbus, 4385, 45054)
    	Sleep(10)
    	$Answer=_Modbus_Read_Registers($tModbus, 4108, 1)
    	If (BitAND(32768, $Answer[0])=0) Then
    		MsgBox(16, "Error", 'BK9050: Reset connection error failed r')
    		_Modbus_Close($tModbus)
    		_Modbus_Free($tModbus)
    		Exit
    	EndIf
    	;_Modbus_Write_Register($tModbus, 4385, 0)
    EndIf
    Alles anzeigen
    Zitat von Homer J. S.

    Zudem schaffe ich es einfach nicht einen Analogausgang zu beschreiben. Eigentlich dachte ich, das ich dem WriteRegister lediglich eine andere Adresse mitgeben muß, aber das funktioniert so leider nicht

    Und doch, das funktioniert so. Ich habe lediglich die falsche Adresse benutzt :Face: .


    Ich hoffe, das ich dem ein oder anderem damit helfen konnte?!


    Gruß
    Homer J. S.

  • modbus

    • Homer J. S.
    • 27. Juli 2016 um 12:56
    Zitat von chip

    Wie kommt darauf? Wenn er das Thema nicht bewusst abboniert hat bekommt er keine Email.

    ...da gebe ich dir recht. Habe mich diesbezüglich im Forum geirrt - Sorry.


    Zitat von Code-Jack

    aber ich möchte sagen, dass ich es optimal finde, so wie Homer es gemacht hat.
    Einerseits aus den von ihm schon genannten Gründen, andererseits weil man so alles, was thematisch zusammen gehört, schön in einem einzelnen Thread hat. Das ist sehr vorteilhaft, wenn man die Suchfunktion benutzt.

    ...das war auch mein Denken bezüglich "Leiche ausgraben" ;)

    Gruß
    Homer J. S.

  • modbus

    • Homer J. S.
    • 26. Juli 2016 um 13:05
    Zitat von chip

    Homer J. S.: vivus = Letzte Aktivität 6. Mai 2015, also kein Grund hier die Leichen auszugraben.


    @chip: Prinzipiell gebe ich dir ja recht, aber da es so ein spezielles Thema ist, wollte ich keinen neuen Thread erstellen. Zudem bekommt @vivus im Regelfall eine E-Mail Benachrichtigung, wenn sich was in diesem Thread tut. Was wäre den deiner Meinung nach der richtige Weg?

    Gruß
    Homer J. S.

  • auf Event aus anderem Skript reagieren

    • Homer J. S.
    • 25. Juli 2016 um 22:52

    @Mistl: Lies dir in Ruhe den von mir gepostet Beitrag durch und mache es mir der Lösung von Andy. Das ist meiner Meinung nach die beste und sicherste Lösung!

    Gruß
    Homer J. S.

  • modbus

    • Homer J. S.
    • 25. Juli 2016 um 22:48

    vivus: Erst einmal Danke für dein spitzen ModBus-UDF! Allerdings habe ich noch zwei kleine Probleme, wo du mir, oder auch gerne ein anderer, ggf. helfen könntest.

    Ich habe einen Beckhoff Koppler BK9050 und einige Module zum Testen zu Verfügung. Der Koppler mit Digitalen IO's funktioniert grundsätzlich mit deiner UDF (mit DLL) schon sehr gut. Allerdings wenn ich einen Disconnect mache, dann geht der Koppler in Störung, die sich nur durch AEG (ausschalten, einschalten, geht) lösen lässt. Das passiert allerdings nur, wenn ich nach einem Connect einen Ausgang gesetzt hatte.

    Zudem schaffe ich es einfach nicht einen Analogausgang zu beschreiben. Eigentlich dachte ich, das ich dem WriteRegister lediglich eine andere Adresse mitgeben muß, aber das funktioniert so leider nicht.

    Vielen Dank schon mal für deine (eure) Hilfe!

    Gruß
    Homer J. S.

  • auf Event aus anderem Skript reagieren

    • Homer J. S.
    • 8. Juli 2016 um 09:16

    Mistil: Ich benötige auch öfter mal die Kommunikation von Skripten untereinander und das wird hier behandelt: Kommunikation Skripte untereinander

    => Der Post 27 enthält das erste Beispiel von @Andy

    Gruß
    Homer J. S.

  • TCPRecv liefert komische Zeichen

    • Homer J. S.
    • 6. Juli 2016 um 21:57
    Zitat von autoBert

    Homer J. S. wenn's hier einen LikeButton gäbe würde ich in klicken. Fühl dich also geehrt und füge ein Sir oder einen sonstigen Titel (außer Kaiser, König) vor deinem Namen ein!

    Danke für die Lorbeeren :). Hoffe das war nicht ironisch gemeint?

    Maxoo: Vielleicht ist es für dich etwas einfacher das Netzwerk mit Network Monitor 3.4 zu sniffen.
    => Link: https://www.microsoft.com/en-us/download…ls.aspx?id=4865

    Gruß
    Sir Homer J. S. ;)

  • TCPRecv liefert komische Zeichen

    • Homer J. S.
    • 5. Juli 2016 um 20:42

    ...ich würde den Verkehr mal mit WireShark mitlesen (in Hex) und schauen wo das Problem her kommt.

    Gruß
    Homer J. S.

  • übers Internet "anklingeln" - dynamische IP - Client Server

    • Homer J. S.
    • 24. Juni 2016 um 23:04

    BinDannMalWeg:
    Ich habe dein Testskript mal getestet mit Version 3.3.14.2. Im Anhang findest du das Logfiles. Ich sehe da auch die von dir beschribenen Probleme.
    Allerdings hatte auch einige schwirgkeiten seit Version 3.3.14.2 (vorher 3.3.12.0).

    Hier ein Auszug eines Skriptes von mir mit der Version 3.3.12.0:

    AutoIt
    ...
    $TCP_ACCEPT=-1
    Do
    	$TCP_ACCEPT=TCPAccept($TCP_LISTEN)
    Until $TCP_ACCEPT<>-1
    Sleep(50)
    $TCP_RECEIVE=''
    While 1
    	$TCP_RECEIVE&=TCPRecv($TCP_ACCEPT, 2048)
    	If (@error) Then ExitLoop
    WEnd
    If ($TCP_RECEIVE<>'') Then
    	ConsoleWrite('RECEIVE: ' &$TCP_RECEIVE &@CRLF)
    ...
    Alles anzeigen


    ...hier der Auszug des Skriptes mit der selben funktion unter Version 3.3.14.2:

    AutoIt
    ....
    $TCP_ACCEPT=-1
    Do
    	$TCP_ACCEPT=TCPAccept($TCP_LISTEN)
    Until $TCP_ACCEPT<>-1
    Sleep(50)
    $TCP_RECEIVE=''
    While 1
    	$TCP_RECEIVE&=TCPRecv($TCP_ACCEPT, 2048)
    	If ((@error) Or (@extended=1) OR StringInStr($TCP_RECEIVE, @CRLF&@CRLF)) Then ExitLoop
    WEnd
    If ($TCP_RECEIVE<>'') Then
    	ConsoleWrite('RECEIVE: ' &$TCP_RECEIVE &@CRLF)
    ...
    Alles anzeigen

    Mit dem @CRLF&@CRLF erkenne ich das Ende der gesendeten Daten.

    Vieleicht hilft dir das ja weiter?!


    Gruß
    Homer J. S.

    Dateien

    log1.txt 1,08 MB – 524 Downloads log2.txt 193,16 kB – 522 Downloads
  • Wert aus Array bekommen

    • Homer J. S.
    • 14. Juni 2016 um 16:37

    Hier gebe ich noch den Tipp das Array mal anzuschauen mit _ArrayDisplay, da sieht man genau Spalten und Zeilen...

  • Bluetooth: Kommandos senden

    • Homer J. S.
    • 27. Februar 2016 um 18:17

    Hallo Scritch,
    ich denke, das könnte eventuell über die virtueller Serieller-Schnittstelle (COM x) von Bluetooth funktionieren.
    Vorher kannst du mit Putty die Machbarkeit testen.

    Gruß
    Homer J. S.

  • Notification von PC an IOS - Gerät senden

    • Homer J. S.
    • 16. Februar 2016 um 22:50

    Stoani:

    Zu a: 4,99€ finde ich persönlich in Ordnung

    Zu b: Der feed Push ist auch eine extra App

    Allgemein: Pushover hat dafür eine offene dokumentierte API -> https://pushover.net/api

    Gruß
    Homer J. S.

  • Notification von PC an IOS - Gerät senden

    • Homer J. S.
    • 16. Februar 2016 um 22:37

    Stoani: Vieleicht ist das ja was für dich -> https://pushover.net

    Gruß
    Homer J. S.

  • Konsolenanwendung mit "StdoutRead" nur mitlesen

    • Homer J. S.
    • 7. Januar 2016 um 13:02

    Hallo BugFix

    Zitat von BugFix

    - Es läuft eine Konsolenanwendung in eigener Konsole
    - Der Outstream soll in diese Konsole geschrieben werden aber auch für dich in einen eigenen Output dupliziert werden.
    Ist das korrekt?


    Ja, das ist korrekt.

    Beispiel, ist etwas schwierig, da es eine node.js Anwendung ist und ich
    davon ausgehe, das du nicht alles dafür installieren möchtest?!

    Hier ein Beispiel wie es vom Prinzip her läuft:

    $PID=Run($INI_PATH_CONSOLE, "", @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
    While 1
     $SOR=StdoutRead($PID)
     ConsoleWrite($SOR &@CRLF)
    WEnd


    Vielen Dank für deine Hilfe.


    Gruß
    Homer J. S.

  • Konsolenanwendung mit "StdoutRead" nur mitlesen

    • Homer J. S.
    • 7. Januar 2016 um 09:45

    Hallo Zusammen,
    ich habe eine Konsolenanwendung die ich nur mitlesen möchte. Mit "StdoutRead" den Stream auslesen ist kein Problem. Aber was ich auslese, wird nicht mehr in der Konsolenanwendung angezeigt. Ich habe auch schon versucht den Stream via "StdinWrite" in die Konsolenanwendung zurück zu schreiben, aber leider ohne erfolg.


    Gibt es eine Möglichkeit einen Stream nur mit zu lesen?


    Danke für eure Hilfe.


    Gruß
    Homer J. S.

  • AuoIt & Homekit (Apple)

    • Homer J. S.
    • 5. Oktober 2015 um 20:28

    Hallo Zusammen,

    ich bin schon länger auf der Suche mit AutoIt und Siri (iOS) Steuerungsaufgaben umzusetzen. Dabei bin ich auf das Interessantes Projekt namens "HomeControl" von "brutella" (Matthias Hochgatterer) gestoßen, was es ermöglicht unter Linux und OS X eine "Homekit Hardware" zu simulieren. Durch dieses Projekt ist mir die Idee gekommen, dies auch mit AuoIt für Windows umzusetzen. Allerdings muss zugeben, das ich vom dem Quellcode von "HomeControl" nicht gerade viel verstehe. Da ich hoffentlich nicht der einzige bin, der AutoIt & Homekit miteinander verbinden möchte, hoffe ich auf eine rege Beteiligung eurerseits um das Projekt umzusetzen.


    Zusammenstellung der Informationen über "HomeControl":

    - Demovideo:

    Externer Inhalt www.youtube.com
    Inhalte von externen Seiten werden ohne deine Zustimmung nicht automatisch geladen und angezeigt.
    Durch die Aktivierung der externen Inhalte erklärst du dich damit einverstanden, dass personenbezogene Daten an Drittplattformen übermittelt werden. Mehr Informationen dazu haben wir in unserer Datenschutzerklärung zur Verfügung gestellt.

    - Homepage: http://selfcoded.com/homecontrol/

    - GitHub: https://github.com/brutella/hc

    - GitHub Doku: https://godoc.org/github.com/brutella/hc


    Zudem möchte ich bitte keine Grundsatzdiskussion über Apple/Microsoft und oder Android /iOS mit diesem Post ins rollen bringen.

    Ich würde mich sehr über eine rege Beteiligung eurerseits freuen :)

    Gruß
    Homer J. S.

  • MinnowBoard Max - GPIO Schnittstelle via AutoIt

    • Homer J. S.
    • 10. August 2015 um 23:17
    Zitat von autoBert

    Hast du denn schon eine DLL dafür gefunden?

    leider nicht. Habe mir die letzten Tage die Finger wund gegoogelt.


    Ich habe aber noch folgendes gefunden:

    https://msdn.microsoft.com/en-us/library/…vices.gpio.aspx
    https://msdn.microsoft.com/en-us/library/….85).aspx#nsobj

    Wenn ich das richtig verstanden habe, dann könnte das mit "ObjCreate" irgenwie funktionieren. Aber auch hier konnte ich bis jetzt keinen Erfolg erzielen. -> Ich habe leider zu wenig Ahnung von diesen Thema.

    Wenn noch einer eine Idee für mich hat, dann immer her damit.

    Gruß
    Homer J. S.

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™