Ich finde das Programm super, doch habe ich es gleich mit meinem speed - matal Lied versucht. HAbe über 250 Crashes gehabt ![]()
lg Tim
Ich finde das Programm super, doch habe ich es gleich mit meinem speed - matal Lied versucht. HAbe über 250 Crashes gehabt ![]()
lg Tim
Ok, Danke dir. Ja ich muss erst die Handls der IOWKitClose übergeben.
Und wo genau soll ich die _WinAPI_GetLastErrorMessage() un _WinAPI_GetLastError() hinsetzten ? Ich habe schon am Anfang am Ende und mitten drinn ![]()
lg Tim
PS: Ich habe auch die API includet ![]()
Hm, irgendetwas stimmt nicht ![]()
$tIOWKIT40_IO_REPORT = DLLStructCreate($tagIOWKIT40_IO_REPORT) ; korrekt
ConsoleWrite("Ok 1" & @CRLF)
DLLStructSetData($tIOWKIT40_IO_REPORT, "Value", 0x00000000 ) ; hier war was falsch
ConsoleWrite("Ok 2" & @CRLF)
$write = _IowKitWrite($ahIOW[$i-1], $IOW_PIPE_IO_PINS, DLLStructGetPtr($tIOWKIT40_IO_REPORT) , $IOWKIT40_IO_REPORT_SIZE) ; Würde ich so machen, die UDF sollte aber auch deine Version erlauben
ConsoleWrite("Ok 3" & @CRLF)
If Not ($write = $IOWKIT40_IO_REPORT_SIZE) Then ; Klammern nicht vergessen. Not bindet stärker als der Vergleich
ConsoleWrite("Fail to send Data to IOW " & $serial & @CRLF)
Exit
EndIf
Zurück kommt
[autoit]>"D:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\test2.au3"
Device Opened
1 IOWs in system
1 PID 1500, S/N "0000387C"
Ok 1
Ok 2
Ok 3
Fail to send Data to IOW 0000387C
und es häng mal wider ?
das kann doch nicht sein. Also soweit müssen ja alle Befehle stimmen. Sonnst würde es nicht bis OK 3 kommen. Irgendetwas muss beim senden schief gehen.
oh, dahin habe ich nicht geschaut ![]()
peinlich *_*
lg Tim
Hey, danke dir. Ich habe es eben mit folgendem Script versucht:
#include "iowkit.au3"
[/autoit] [autoit][/autoit] [autoit]Global $ahIOW[$IOWKIT_MAX_DEVICES]
[/autoit] [autoit][/autoit] [autoit]If Not _IowKitStartUp() Then ; Die Dll wird geladen
ConsoleWrite("Failed to load iowkit dll" & @CRLF)
Exit
EndIf
; Open device
Global $devHandle = _IowKitOpenDevice() ; Die Verbindung zum Warrior wird hergestellt
If Not $devHandle Then
ConsoleWrite("Failed to open device" & @CRLF)
Exit
EndIf
ConsoleWrite("Device Opened" & @CRLF)
; Get number of IOWs in system
$numIows = _IowKitGetNumDevs() ; Gibt die Anzahl an IOW´s im System wider
ConsoleWrite(StringFormat("%d IOWs in system\n", $numIows))
; Get all IOW handles
Dim $serial ; Variable wird deklariert
For $i = 1 To $numIows
;~ ConsoleWrite("+Loop " & $i & '/' & $numIows & @CRLF)
; Get device handle and init object
$ahIOW[$i-1] = _IowKitGetDeviceHandle($i) ; Gibt ein Handle für einen der IOW´s zurück
;~ ConsoleWrite("-after _IowKitGetDeviceHandle" & @CRLF)
; Get serial number
_IowKitGetSerialNumber($ahIOW[$i-1], $serial); Schreibt die Seriennummer in einen buffer ( serial )
;~ ConsoleWrite("-after _IowKitGetSerialNumber" & @CRLF)
$pid = _IowKitGetProductId($ahIOW[$i-1]) ; Gibt die Produkt ID des IOW´s zurück. Bei den 40ern ist es meist die 1500
ConsoleWrite(StringFormat('%d PID %x, S/N "%s"\n', $i, $pid, $serial));
Next
$tIOWKIT40_IO_REPORT = DLLStructCreate($IOWKIT40_IO_REPORT) ; korrekt
ConsoleWrite("Ok 1" & @CRLF)
DLLStructSetData($tIOWKIT40_IO_REPORT, "Value", 0x00000000 ) ; hier war was falsch
ConsoleWrite("Ok 2" & @CRLF)
$write = _IowKitWrite($ahIOW[$i-1], $IOW_PIPE_IO_PINS, DLLStructGetPtr($tIOWKIT40_IO_REPORT) , $IOWKIT40_IO_REPORT_SIZE) ; Würde ich so machen, die UDF sollte aber auch deine Version erlauben
ConsoleWrite("Ok 3" & @CRLF)
If Not ($write = $IOWKIT40_IO_REPORT_SIZE) Then ; Klammern nicht vergessen. Not bindet stärker als der Vergleich
ConsoleWrite("Fail to send Data to IOW " & $serial & @CRLF)
Exit
EndIf
; Close device
_IowKitCloseDevice($devHandle);
ConsoleWrite("Device closed" & @CRLF)
Als Antwort bekomme ich leider
[autoit]>"D:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\test2.au3"
Device Opened
1 IOWs in system
1 PID 1500, S/N "0000387C"
Hm, was ist denn an
[autoit]$tIOWKIT40_IO_REPORT = DLLStructCreate($IOWKIT40_IO_REPORT) ; korrekt
[/autoit]falsch ?
lg Tim
Also ich habe es nun 3 mal durchgelesen (die Hilfe) und bin der MEinung, das das so richtig ist:
[autoit]$tIOWKIT40_IO_REPORT = DLLStructCreate($IOWKIT40_IO_REPORT)
DLLStructSetData($tIOWKIT40_IO_REPORT,$tIOWKIT40_IO_REPORT, 0x00000000 )
$write = _IowKitWrite($ahIOW[$i-1], $IOW_PIPE_IO_PINS, $tIOWKIT40_IO_REPORT , $IOWKIT40_IO_REPORT_SIZE);
If Not $write = $IOWKIT40_IO_REPORT_SIZE Then
ConsoleWrite("Fail to send Data to IOW " & $serial & @CRLF)
Exit
EndIf
Leider hängt sich das Script auf. So, wieso habe ich das so gemacht ? Meine Begründung:
DLLStructSetData($tIOWKIT40_IO_REPORT,$tIOWKIT40_IO_REPORT, 0x00000000 )
$tIOWKIT40_IO_REPORT <- Weil das ja die Variable ist, in der der Wert eingeschrieben werden soll.
$tIOWKIT40_IO_REPORT <- Weil das die Variable ist, die von DLLStructCreate festgelegt worden ist. (Siehe Hilfe)
0x00000000 <- Weil das der Wert zum Testen ist, um alle LED´s zum leuchten zu bringen
So, ich wüsste nicht mehr, was noch falsch sein könnte. Ich habe auch schon anstadt $tIOWKIT40_IO_REPORT ,$IOWKIT40_IO_REPORT versucht, aber keine Changse.
lg Tim
Ok ![]()
Also wenn ich das richtig verstehe, dann setzt man mit
[autoit]DLLStructSetData($tIOWKIT40_IO_REPORT, ...)
[/autoit]den Wert, der in den Speicher meines IOW´s geschrieben werden soll. in der Anleitung von
[autoit]DLLStructSetData
[/autoit]steht, das noch ein Element ausgewählt werden muss. Kann ich dafür
[autoit]$IOWKIT40_IO_REPORT
[/autoit]verwenden ? Also z.B.
[autoit]DLLStructSetData($tIOWKIT40_IO_REPORT, $IOWKIT40_IO_REPORT, 00000000)
[/autoit]Oder soll das Element im Sinne von z.B. einem "ulong" geschrieben werden ?
lg Tim
Schaue dir mal folgendes an:
GUIGetCursorInfo
[/autoit]lg Tim
Also, zum Problem mit der Progressbar. Ich denke es ist am einfachsten am Anfang des Scriptes die Bar auf 0 zu setzten
->
GUICtrlSetData ( $progress1, 0)
und wenn du von der ShellExecute ein Ok zurückbekommst, das die Seite geladen ist, dann mache einfach
->
GUICtrlSetData ( $progress1, 100)
==========
Das ist zwar dann sehr schlagartig, aber du hast es schonmal angezeigt. Wenn du es Stück für stück haben möchtest, dann musst du die Datenkomunikation abfragen, und z.B. bei 50% der gesammten Daten eben GUICtrlSetData ( $progress1, 50) schreiben.
![]()
lg Tim
So, also soweit bin ich nun:
#include "iowkit.au3"
[/autoit] [autoit][/autoit] [autoit]Global $ahIOW[$IOWKIT_MAX_DEVICES]
[/autoit] [autoit][/autoit] [autoit]If Not _IowKitStartUp() Then ; Die Dll wird geladen
ConsoleWrite("Failed to load iowkit dll" & @CRLF)
Exit
EndIf
; Open device
Global $devHandle = _IowKitOpenDevice() ; Die Verbindung zum Warrior wird hergestellt
If Not $devHandle Then
ConsoleWrite("Failed to open device" & @CRLF)
Exit
EndIf
ConsoleWrite("Device Opened" & @CRLF)
; Get number of IOWs in system
$numIows = _IowKitGetNumDevs() ; Gibt die Anzahl an IOW´s im System wider
ConsoleWrite(StringFormat("%d IOWs in system\n", $numIows))
; Get all IOW handles
Dim $serial ; Variable wird deklariert
For $i = 1 To $numIows
;~ ConsoleWrite("+Loop " & $i & '/' & $numIows & @CRLF)
; Get device handle and init object
$ahIOW[$i-1] = _IowKitGetDeviceHandle($i) ; Gibt ein Handle für einen der IOW´s zurück
;~ ConsoleWrite("-after _IowKitGetDeviceHandle" & @CRLF)
; Get serial number
_IowKitGetSerialNumber($ahIOW[$i-1], $serial); Schreibt die Seriennummer in einen buffer ( serial )
;~ ConsoleWrite("-after _IowKitGetSerialNumber" & @CRLF)
$pid = _IowKitGetProductId($ahIOW[$i-1]) ; Gibt die Produkt ID des IOW´s zurück. Bei den 40ern ist es meist die 1500
ConsoleWrite(StringFormat('%d PID %x, S/N "%s"\n', $i, $pid, $serial));
Next
$write = _IowKitWrite($ahIOW[$i-1],"IOW_PIPE_IO_PINS",0x00000000, "IOWKIT40_IO_REPORT_SIZE");
If Not $write = "IOWKIT40_IO_REPORT_SIZE" Then
ConsoleWrite("Fail to send some Data to IOW " & $serial & @CRLF)
Exit
EndIf
; Close device
_IowKitCloseDevice($devHandle);
ConsoleWrite("Device closed" & @CRLF)
Das ist meine Antwort:
>"D:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\test2.au3"
Device Opened
1 IOWs in system
1 PID 1500, S/N "0000387C"
Fail to send some Data to IOW 0000387C
Ich weis nur nicht, ob ich nun IOW_PIPE_IO_PINS durch eine 0 ersetzten soll oder nicht. So steht es in der Beschreibung, aber in den Beispielen finde ich immer IOW_PIPE_IO_PINS.
Das selbe auch bei IOWKIT40_IO_REPORT_SIZE. Ich habe shcon gegoogelt, aber ich finde auch nur Beispiele, in denen der Text steht, und kein Wert.
lg Tim
So, nun sind 90% geschaft. Nun habe ich nurnoch 1 Problem. Undzwar das schreiben von Daten. Ich weis folgendes:
Die Daten werden in Form eines 32-Bit wortes geschrieben z.B. (0x00FF00FF00)
Es wird die Funktion _IOWKITWRITE benötigt.
Wenn ich 0x00000000 an meinen Warrior schicke, leuten alle Test-LED´s.
Vorraussetztungen sind diverse Handles und Variablen, die wir in den letzten 2 Wochen geschaft haben zu gewinnen.
Nun bleibt noch die Frage, was kommt wohin. Ich habe volgenden Ansatz, bei deinem Script. Das habe ich hier nochmal gepostet, um die Variablen und Arrays besser zu erkennen:
#include "iowkit.au3"
[/autoit] [autoit][/autoit] [autoit]Global $ahIOW[$IOWKIT_MAX_DEVICES]
[/autoit] [autoit][/autoit] [autoit]If Not _IowKitStartUp() Then
ConsoleWrite("Failed to load iowkit dll" & @CRLF)
Exit
EndIf
; Open device
Global $devHandle = _IowKitOpenDevice();
If Not $devHandle Then
ConsoleWrite("Failed to open device" & @CRLF)
Exit
EndIf
ConsoleWrite("Device Opened" & @CRLF)
; Get number of IOWs in system
$numIows = _IowKitGetNumDevs();
ConsoleWrite(StringFormat("%d IOWs in system\n", $numIows))
; Get all IOW handles
Dim $serial
For $i = 1 To $numIows
ConsoleWrite("+Loop " & $i & '/' & $numIows & @CRLF)
; Get device handle and init object
$ahIOW[$i-1] = _IowKitGetDeviceHandle($i)
ConsoleWrite("-after _IowKitGetDeviceHandle" & @CRLF)
; Get serial number
_IowKitGetSerialNumber($ahIOW[$i-1], $serial);
ConsoleWrite("-after _IowKitGetSerialNumber" & @CRLF)
$pid = _IowKitGetProductId($ahIOW[$i-1]);
ConsoleWrite(StringFormat('%d PID %x, S/N "%s"\n', $i, $pid, $serial));
Next
; Close device
_IowKitCloseDevice($devHandle);
ConsoleWrite("Device closed" & @CRLF)
IowKitWrite($ahIOW[$i-1], 0 - wegen den normalen I/O Pins - siehe der Beschreibung , Was als Report kommt kann ich mir nicht erklären, hier z.B. 0x00000000 - das was geschrieben werden soll)
[/autoit]Auszug aus der Beschreibung:
IowKitWrite
Declaration:
ULONG IOWKIT_API IowKitWrite(IOWKIT_HANDLE devHandle, ULONG numPipe,
PCHAR buffer, ULONG length);
function IowKitWrite(devHandle: IOWKIT_HANDLE; numPipe: ULONG;
buffer: PChar; length: ULONG): ULONG; stdcall;
Write length bytes of data to pipe numPipe of IO-Warrior. The return value is the number of bytes
written. Writing something else than a single report of the correct size and a valid report ID for the pipe
fails for Windows. The function allows writing to the I/O pins through pipe 0 and Special Mode functions
through pipe 1. To be completely compatible with the Windows version libiowkit.so expects a ReportID 0
for pipe 0 (I/O pins) even if Linux does not have a ReportID on pipe 0. The ReportID is stripped from the
data sent to the device.
Sample write to pipe 0 of an IO-Warrior 40:
DWORD value consists of 32 bits, which correspond to the 32 IO-Warrior 40 I/O pins. Each bit has the
following meaning:
When a 1 is written to a pin the output driver of that pin is off and the pin is pulled high by an internal
resistor. The pin can now be used as an input or an output with high state.
When a 0 is written to a pin the output driver is switched on pulling the pin to ground. The pin is now a
output driving low.
For example, writing 0 (all 32 bits are zero) to IO-Warrior sets all pins as outputs driving low (so if you
have LEDs connected to them they will be on).
Reading the status of the pins does always return the logic level on the pins, not the value written to the
pin drivers.
Writing 0xFFFFFFFF (value in hex, all 32 bits set) sets all pins as inputs.
Note that if you want to use a pin as an input, you must first set it up as input, in other words, you must
write 1 to it. For connected LEDs this means they go off.
Sample usage C:
IOWKIT40_IO_REPORT report;
ULONG res;
// Write IO pins of IO-Warrior 40
report.ReportID = 0;
report.Value = 0; // all LEDs *on*
res = IowKitWrite(ioHandle, IOW_PIPE_IO_PINS,
&report, IOWKIT40_IO_REPORT_SIZE);
if (res != IOWKIT40_IO_REPORT_SIZE)
{
// Didn't write, handle error
...
}
lg Tim
ES GEHT !!!!
DANKE DIR MEISTER
Ich bekomme nun folgendes zurück :
>"D:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\test2.au3"
Device Opened
1 IOWs in system
+Loop 1/1
-after _IowKitGetDeviceHandle
-after _IowKitGetSerialNumber
1 PID 1500, S/N "0000387C"
Device closed
>Exit code: 0 Time: 0.207
lg Tim
Meinst du als ID die Zeile 23 ?
Ich habe
For $i-1 = 1 To $numIows
[/autoit]und
For [$i-1] = 1 To $numIows
[/autoit]versucht. Klappt leider nicht. Ich bekomme in meiner ersten Msgbox wenn ich nur For $i = 1 To $numIows stehen habe einen "1" zurück, udn wenn ich For $i-1 = 1 To $numIows schreibe ein True.
lg Tim
Also, ich komme mir absolut doof vor. Ich lese die Hilfsdatei von meinem Warrior, und habe mein Script mit meinen Boxen:
#include "iowkit.au3"
[/autoit] [autoit][/autoit] [autoit]Global $ahIOW[$IOWKIT_MAX_DEVICES]
[/autoit] [autoit][/autoit] [autoit]If Not _IowKitStartUp() Then
ConsoleWrite("Failed to load iowkit dll" & @CRLF)
Exit
EndIf
; Open device
Global $devHandle = _IowKitOpenDevice();
If Not $devHandle Then
ConsoleWrite("Failed to open device" & @CRLF)
Exit
EndIf
ConsoleWrite("Device Opened" & @CRLF)
; Get number of IOWs in system
$numIows = _IowKitGetNumDevs();
ConsoleWrite(StringFormat("%d IOWs in system\n", $numIows))
; Get all IOW handles
Dim $serial
For $i = 1 To $numIows
Msgbox(0,"1",$i)
; Get device handle and init object
$iows[$i-1] = _IowKitGetDeviceHandle($i);
Msgbox(0,"2",)
; Get serial number
_IowKitGetSerialNumber($iows[$i-1], $serial);
$pid = _IowKitGetProductId($iows[$i]);
ConsoleWrite(StringFormat('%d PID %x, S/N "%s"\n', $i, $pid, $serial));
Next
; Close device
_IowKitCloseDevice($devHandle);
ConsoleWrite("Device closed" & @CRLF)
Und die 1 Box kommt, aber nicht mehr die zweite. Und ich begreife einfach nicht wieso. Es wird ja zuzusagen 0 für $i eingetragen, weil oben $i als 1 deklariert wird, und dann wider eines abgezogen wird.
Setze doch bitte noch den Status deine Beitrages auf "gelöst".
lg Tim
Ja, _IowKitGetSerialNumber wird nicht in eine Variable geschrieben. Oder meinst du, das man zuerst du Product ID abfragen sollte ?
Aber eigentlich sollte ja in $serial die Serial reingeschrieben werden.
lg Tim
So, aber nun:
#include "GUIConstants.au3"
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Dim $Zahl1 = 0 ; Deine Eingabe
Dim $Zahl2 = 2 ; Deine Zahl durch die geteilt werden soll ![]()
Dim $Zahl3 ; Dein Ergebnis
$Form2 = GUICreate("S", 405, 185, 228, 123)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$zahl1 = GUICtrlCreateInput("0", 8, 120, 73, 21)
$berechnen = GUICtrlCreateButton("Berechnen", 104, 118, 75, 25)
$Label6 = GUICtrlCreateLabel("LKVB noch ca.", 8, 152, 123, 17)
$Zahl3 = GUICtrlCreateLabel("- - -", 136, 150, 44, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Entfernung", 192, 152, 62, 17)
GUISetState(@SW_SHOW)
While 1
[/autoit] [autoit][/autoit] [autoit]Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $berechnen
GuiCtrlSetData($Zahl3, GUICtrlRead($zahl1) / $Zahl2)
EndSwitch
WEnd
lg Tim
Absolut Geiles Programm !!! Meine absolute Anerkennung.
lg Tim
PS: Im Menü unter Hilfe, bei Körper Hinzufügen ist in der ersten Zeile ein Schreibfehler. Das steht Meü statt Menü ![]()
Brauchst du noch Hilfe beim Abbrechen, oder Zahlen-Begrenzungen ?
lg Tim
#include "iowkit.au3"
[/autoit] [autoit][/autoit] [autoit]Global $ahIOW[$IOWKIT_MAX_DEVICES]
[/autoit] [autoit][/autoit] [autoit]If Not _IowKitStartUp() Then
ConsoleWrite("Failed to load iowkit dll" & @CRLF)
Exit
EndIf
; Open device
Global $devHandle = _IowKitOpenDevice();
If Not $devHandle Then
ConsoleWrite("Failed to open device" & @CRLF)
Exit
EndIf
ConsoleWrite("Device Opened" & @CRLF)
; Get number of IOWs in system
$numIows = _IowKitGetNumDevs();
ConsoleWrite(StringFormat("%d IOWs in system\n", $numIows))
; Get all IOW handles
Dim $serial
For $i = 1 To $numIows
; Get device handle and init object
$iows[$i-1] = _IowKitGetDeviceHandle($i);
; Get serial number
_IowKitGetSerialNumber($iows[$i-1], $serial);
$pid = _IowKitGetProductId($iows[$i]);
ConsoleWrite(StringFormat('%d PID %x, S/N "%s"\n', $i, $pid, $serial)); Habe hier noch eine Zweite klammer dazu gemacht ![]()
Next
; Close device
_IowKitCloseDevice($devHandle);
ConsoleWrite("Device closed" & @CRLF)
Und alle unterstriche gesetzt...
[/autoit] [autoit][/autoit] [autoit]Das bekomme ich zurück:
==========================
>"D:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\test2.au3"
Device Opened
1 IOWs in system
===========================
[/autoit] [autoit][/autoit] [autoit]Es passiert auch nicht mehr, als würde er wo stehen bleiben. Hm... Die Befehle sind richtig geschrieben, sonnst würde er wohl meckern ![]()