Hallo ich würde gerne mein USB Board über Autoit ansteuern nur bei meinen ganzen versuchen dies zu gelingen scheitere ich. Liegt vielleicht daran das ich noch nicht viel erfahrung mit Programmierung und bräuchte etwas Hilfe. Danke im Voraus
K8055 Velleman USB Board
-
- [ offen ]
-
Domi94 -
15. März 2011 um 20:37 -
Geschlossen -
Erledigt
-
-
du meinst vermutlich dieses Board:
http://www.mercateo.com/p/102-191003%2…5-5410329282257Da steht, dass da eine dll dabei ist. Wenn Du keine Dokumentation dazu hast wird es schwierig.
Da wirst Du uns schon mehr an Info geben müssen ...
-
Hallo Domi94,
herzlich willkommen im Forum und viel Spass mit AutoIt.
Hier kannst du dir die deutsche Hilfe herunterladen.
Hier gibt es ein AutoIt-Tutorial: http://wiki.autoit.de/wiki/index.php/TutorialSehr hilfreich ist auch das Buch von peethebeeund jetzt etwas Erfreuliches zu deinem Board, du bist nicht der 1. der es mit AutoIt steuern möchte, daher gibt es schon eine UDF dazu: [ offen ] K8055 Programmer? einfach das Skript aus dem Spoiler kopieren und unter K8055.au3 abspeichern. In deinen Skripten incudest du sie dann mit
[autoit]#include <K055.au3> ;falls du sie im Include-Ordner abgelegt hast bzw.
[/autoit]
#include "c:\vellemann\K055.au3" ;Pfad anpassen nicht vergessen[autoit]
[/autoit]mfg autoBert
-
Ja genau dieses, ja die diverse dll's wurden mitgeliefert nur wie kann ich die in Autoit auslesen und verwenden bzw. ist die überhaupt richtig? Es gibt nur die für Visual Basic und Delphi.
-
Könnte mir jemand ein kleines Beispielprogramm zeigen wie man Output 1 schalten kann?
-
Hallo Domi94,
du legst dir diese
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. Spoiler anzeigen
[autoit][/autoit] [autoit][/autoit] [autoit]#region includes ;########################
[/autoit] [autoit][/autoit] [autoit]
#include <k8055udf.au3>
#include <GuiStatusBar.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#endregion includes ;########################
;##########################################Global $iBoard = 0 ;Board mit dem verbnden werden soll
[/autoit] [autoit][/autoit] [autoit]
Global $idChkDigitIn[6] ;für ControlIDs der Checkboxen Digitale Eingänge Element 0 ist nicht belegt
Global $idChkDigitOut[9] ;für ControlIDs der Checkboxen Digitale Ausgänge Element 0 ist nicht belegt;##########################################
[/autoit] [autoit][/autoit] [autoit]
$frmMain = GUICreate("K8055 Board Test", 519, 412, 187, 121)
$idStatus = _GUICtrlStatusBar_Create($frmMain)
Dim $idStatus_PartsWidth[2] = [439, -1]
_GUICtrlStatusBar_SetParts($idStatus, $idStatus_PartsWidth)
_GUICtrlStatusBar_SetText($idStatus, "", 0)
_GUICtrlStatusBar_SetText($idStatus, "Verbunden", 1)
GUICtrlCreateGroup("Digitale Eingänge", 8, 0, 169, 41)
For $i = 1 To 5
$idChkDigitIn[$i] = GUICtrlCreateCheckbox("I" & $i, -16 + $i * 32, 16, 25, 17)
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Digitale Ausgänge", 184, 0, 329, 41)
For $i = 1 To 8
$idChkDigitOut[$i] = GUICtrlCreateCheckbox("O" & $i, 152 + $i * 40, 16, 33, 17)
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView1 = GUICtrlCreateListView("Aktionen", 8, 48, 506, 310)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 502)
$beenden = GUICtrlCreateButton("Beenden", 432, 360, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#endregion includes ;########################
;#######################################$bK8055Debug = True
[/autoit] [autoit][/autoit] [autoit]
USB_DLLOpen()
initial_board($iBoard)While 1
[/autoit] [autoit][/autoit] [autoit][/autoit]
$nMsg = GUIGetMsg()
Switch $nMsg ;um die Events dieser GUI zu unterscheiden
Case $GUI_EVENT_CLOSE, $beenden
CloseAllDevice()
Exit
Case $idChkDigitOut[1] To $idChkDigitOut[8]
$iChannel = $nMsg - $idChkDigitOut[1] + 1
ConsoleWrite($iChannel & @CRLF)
If BitAND(GUICtrlRead($idChkDigitOut[1]), $GUI_CHECKED) Then
SetDigitalChannel($iBoard, $iChannel)
Else
ClearDigitalChannel($iBoard, $iChannel)
EndIf
Case $idChkDigitIn[1] To $idChkDigitIn[5]
For $i = 1 To 5
If ReadDigitalChannel($iBoard, $i] Then
GUICtrlSetState($idCheckDigiIn[$i], $GUI_CHECKED)
Else
GUICtrlSetState($idCheckDigiIn[$i], $GUI_UNCHECKED)
EndIf
Next
EndSwitch
WEndich hoffe es fnktioniert, denn ich habe kein K8055-Board und kann daher nicht testen,
mfg autoBert
-
Dll wird geöffnet
Board wird initialisiert
USBDevice 0 wird geöffnet
Board wurde initialisiert
C:\Users\Medion852\Desktop\h.au3 (58) : ==> Variable used without being declared.:58 Case $idCheckDigiIn
-
Hallo domi94,
sorry da war ich beim skripten wohl etwas z schnell. Ich hab den Fehler behoben und meinen vorhergehenden Post editiert,
PS.: den Debg-Modus kannst du wenn das Skript fehlerfrei läuft auf False setzen bzw. Zeile 42 löschen
mfg autoBert
-
Ich habs endlich zum laufen bekommen :DDD Danke
Hab auch gleich was nettes gescriptet ;D
Spoiler anzeigen
[autoit];===============================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
;===============================================================================================================================
DllOpen ( "k8055d.dll" )
;===============================================================================================================================
;===============================================================================================================================
#include <k8055.au3>
$o = USBOpenDevice (0 )
;===============================================================================================================================
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
;===============================================================================================================================
#Region ### START Koda GUI section ### Form=E:\AutoitV3\Koda Formdesigner\Forms\Main.kxf
$Main = GUICreate("K8055", 151, 201, 406, 166)
$CB1 = GUICtrlCreateCheckbox("Ausgang 1", 10, 5, 71, 26)
$CB2 = GUICtrlCreateCheckbox("Ausgang 2", 10, 25, 71, 26)
$CB3 = GUICtrlCreateCheckbox("Ausgang 3", 10, 45, 71, 26)
$CB4 = GUICtrlCreateCheckbox("Ausgang 4", 10, 65, 71, 26)
$CB5 = GUICtrlCreateCheckbox("Ausgang 5", 10, 85, 71, 26)
$CB6 = GUICtrlCreateCheckbox("Ausgang 6", 10, 105, 71, 26)
$CB7 = GUICtrlCreateCheckbox("Ausgang 7", 10, 125, 71, 26)
$CB8 = GUICtrlCreateCheckbox("Ausgang 8", 10, 145, 71, 26)
$Sl1 = GUICtrlCreateSlider(80, 5, 35, 165, BitOR($TBS_VERT,$TBS_AUTOTICKS))
GUICtrlSetLimit(-1, 255, 0)
$Sl2 = GUICtrlCreateSlider(115, 5, 35, 165, BitOR($TBS_VERT,$TBS_AUTOTICKS))
GUICtrlSetLimit(-1, 255, 0)
$Alle = GUICtrlCreateButton("Alle", 10, 170, 35, 25, 0)
$X = GUICtrlCreateButton("X", 50, 170, 35, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;===============================================================================================================================
USBClearAllDigital()
;===============================================================================================================================
HotKeySet("1" , "_Out1")
HotKeySet("q" , "_Out11")Func _Out1()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(1)
GUICtrlSetState($CB1, $GUI_CHECKED)
EndFunc
Func _Out11()
USBClearDigitalChannel(1)
GUICtrlSetState($CB1, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("2" , "_Out2")
HotKeySet("w" , "_Out22")Func _Out2()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(2)
GUICtrlSetState($CB2, $GUI_CHECKED)
EndFunc
Func _Out22()
USBClearDigitalChannel(2)
GUICtrlSetState($CB2, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("3" , "_Out3")
HotKeySet("e" , "_Out33")Func _Out3()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(3)
GUICtrlSetState($CB3, $GUI_CHECKED)
EndFunc
Func _Out33()
USBClearDigitalChannel(3)
GUICtrlSetState($CB3, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("4" , "_Out4")
HotKeySet("r" , "_Out44")Func _Out4()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(4)
GUICtrlSetState($CB4, $GUI_CHECKED)
EndFunc
Func _Out44()
USBClearDigitalChannel(4)
GUICtrlSetState($CB4, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("5" , "_Out5")
HotKeySet("t" , "_Out55")Func _Out5()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(5)
GUICtrlSetState($CB5, $GUI_CHECKED)
EndFunc
Func _Out55()
USBClearDigitalChannel(5)
GUICtrlSetState($CB5, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("6" , "_Out6")
HotKeySet("z" , "_Out66")Func _Out6()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(6)
GUICtrlSetState($CB6, $GUI_CHECKED)
EndFunc
Func _Out66()
USBClearDigitalChannel(6)
GUICtrlSetState($CB6, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("7" , "_Out7")
HotKeySet("u" , "_Out77")Func _Out7()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(7)
GUICtrlSetState($CB7, $GUI_CHECKED)
EndFunc
Func _Out77()
USBClearDigitalChannel(7)
GUICtrlSetState($CB7, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
HotKeySet("8" , "_Out8")
HotKeySet("i" , "_Out88")Func _Out8()
[/autoit] [autoit][/autoit] [autoit]
USBSetDigitalChannel(8)
GUICtrlSetState($CB8, $GUI_CHECKED)
EndFunc
Func _Out88()
USBClearDigitalChannel(8)
GUICtrlSetState($CB8, $GUI_UNCHECKED)
EndFunc
;===============================================================================================================================
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
USBClearAllDigital()
Exit
Case $CB1
If GUICtrlRead($CB1) = $GUI_CHECKED Then USBSetDigitalChannel(1)
If GUICtrlRead($CB1) = $GUI_UNCHECKED Then USBClearDigitalChannel(1)
Case $CB2
If GUICtrlRead($CB2) = $GUI_CHECKED Then USBSetDigitalChannel(2)
If GUICtrlRead($CB2) = $GUI_UNCHECKED Then USBClearDigitalChannel(2)
Case $CB3
If GUICtrlRead($CB3) = $GUI_CHECKED Then USBSetDigitalChannel(3)
If GUICtrlRead($CB3) = $GUI_UNCHECKED Then USBClearDigitalChannel(3)
Case $CB4
If GUICtrlRead($CB4) = $GUI_CHECKED Then USBSetDigitalChannel(4)
If GUICtrlRead($CB4) = $GUI_UNCHECKED Then USBClearDigitalChannel(4)
Case $CB5
If GUICtrlRead($CB5) = $GUI_CHECKED Then USBSetDigitalChannel(5)
If GUICtrlRead($CB5) = $GUI_UNCHECKED Then USBClearDigitalChannel(5)
Case $CB6
If GUICtrlRead($CB6) = $GUI_CHECKED Then USBSetDigitalChannel(6)
If GUICtrlRead($CB6) = $GUI_UNCHECKED Then USBClearDigitalChannel(6)
Case $CB7
If GUICtrlRead($CB7) = $GUI_CHECKED Then USBSetDigitalChannel(7)
If GUICtrlRead($CB7) = $GUI_UNCHECKED Then USBClearDigitalChannel(7)
Case $CB8
If GUICtrlRead($CB8) = $GUI_CHECKED Then USBSetDigitalChannel(8)
If GUICtrlRead($CB8) = $GUI_UNCHECKED Then USBClearDigitalChannel(8)Case $Sl1
[/autoit]
USBOutputAnalogChannel(1, GUICtrlRead($Sl1))
Case $Sl2
USBOutputAnalogChannel(2, GUICtrlRead($Sl2))
Case $Alle
USBSetAllDigital()
GUICtrlSetState($CB1, $GUI_CHECKED)
GUICtrlSetState($CB2, $GUI_CHECKED)
GUICtrlSetState($CB3, $GUI_CHECKED)
GUICtrlSetState($CB4, $GUI_CHECKED)
GUICtrlSetState($CB5, $GUI_CHECKED)
GUICtrlSetState($CB6, $GUI_CHECKED)
GUICtrlSetState($CB7, $GUI_CHECKED)
GUICtrlSetState($CB8, $GUI_CHECKED)
Case $X
USBClearAllDigital()
GUICtrlSetState($CB1, $GUI_UNCHECKED)
GUICtrlSetState($CB2, $GUI_UNCHECKED)
GUICtrlSetState($CB3, $GUI_UNCHECKED)
GUICtrlSetState($CB4, $GUI_UNCHECKED)
GUICtrlSetState($CB5, $GUI_UNCHECKED)
GUICtrlSetState($CB6, $GUI_UNCHECKED)
GUICtrlSetState($CB7, $GUI_UNCHECKED)
GUICtrlSetState($CB8, $GUI_UNCHECKED)
EndSwitch
WEnd
;===============================================================================================================================
;===============================================================================================================================
;===============================================================================================================================
;===============================================================================================================================Nur eines noch.. wie man die eingänge auslesen kann und so das verstehe ich nicht so ganz.. bitte eine kleine erklärung^^ danke
Lg Domi94