Many thanks to vleeuwen for the code from 17.04.2014, this was an extremly good job! I did some tests with it.
1) There is only one observation left:
Connection only works with "ftMscLib.dll", with "ftMscLibEx.dll" there is an error message:
System.DllNotFoundException wurde nicht behandelt.
Message=Die DLL "C:\windows\system32\ftMscLibEx.dll": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
This behavior is still very strange, because the file "ftMscLibEx.dll" is stored under the given path. Even the line
Debug.Print(If(System.IO.File.Exists(FtMscLibEx.dllpath), "File exists.", "File does not exist."))
has the result: "File exists."
2) The rest works very well with the following extendet code on the basis of vleeuwens work (Microsoft Visual Basic 2010 Express)
a) class classFtMscLib
Code: Alles auswählen
Imports System
Imports System.Text
Imports System.Runtime.InteropServices
Public Class classFtMscLib
'*** List of var
Public Const dllpath As String = "C:\windows\system32\ftMscLib.dll"
'*** List of declarations
<DllImport(dllpath, EntryPoint:="ftxGetLibVersionStr", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxGetLibVersionStr(<MarshalAs(UnmanagedType.LPStr)> ByVal Foo2 As StringBuilder, ByVal len As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxGetLibVersion", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxGetLibVersion() As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxIsTransferActiv", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxIsTransferActiv(ByVal fthdl As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="GetAvailableComPorts", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxGetAvailableComPorts(ByVal selectMode As Integer) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="EnumComPorts", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxEnumComPorts(ByVal idx As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal comstr As StringBuilder, ByVal len As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxOpenComDevice", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxOpenComDevice(ByVal comStr As String, ByVal bdr As UInteger, ByRef uint As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxOpenComDeviceNr", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxOpenComDeviceNr(ByVal comStr As UInteger, ByVal bdr As UInteger, ByRef uint As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxInitLib", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxInitLib() As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxIsLibInit", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxIsLibInit() As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxIsHandleValid", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxIsHandleValid(ByVal fthdl As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="GetComStatus", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxGetComStatus(ByVal fthdl As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxCloseLib", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxCloseLib() As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxGetLibErrorString", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxGetLibErrorString(ByVal errCode As UInteger, ByVal typ As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal buff As StringBuilder, ByVal maxLen As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxCloseDevice", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxCloseDevice(ByVal fthdl As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxStartTransferArea", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxStartTransferArea(ByVal fthdl As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="ftxStopTransferArea", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxStopTransferArea(ByVal fthdl As UInteger) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="SetOutMotorValues", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxSetOutMotorValues(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal id As Integer, ByVal duty_p As Integer, ByVal duty_m As Integer, ByVal brake As Boolean) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="SetFtMotorConfig", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function ftxSetOutMotorConfig(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal id As Integer, ByVal status As Boolean) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="SetFtUniConfig", CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ftxSetUniConfig(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal id As Integer, ByVal mode As Integer, ByVal status As Boolean) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="GetInIOValue", CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ftxGetInIOValue(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal idx As Integer, ByRef valRef As Short, ByRef overrunRef As Boolean) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="StartCounterReset", CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ftxStartCounterReset(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal idx As Integer) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="GetInCounterValue", CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ftxGetInCounterValue(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal idx As Integer, ByRef contRef As UShort, ByRef valRef As UShort) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="GetInDisplayButtonValue", CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ftxGetInDisplayButtonValue(ByVal fthdl As UInteger, ByVal shmId As Integer, ByRef leftRef As UShort, ByRef rightRef As UShort) As UInteger
End Function
<DllImport(dllpath, EntryPoint:="SetRoboTxMessage", CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ftxSetRoboTxMessage(ByVal fthdl As UInteger, ByVal shmId As Integer, ByVal msg As String) As UInteger
End Function
'*** List of error codes
Public Const FTLIB_ERR_SUCCESS As UInteger = &H0UI 'decErr 0
Public Const FTLIB_ERR_NO_MEMORY As UInteger = &HE0000100UI '
Public Const FTLIB_ERR_FAILED As UInteger = &HE0001000UI '
Public Const FTLIB_ERR_TIMEOUT As UInteger = &HE000100CUI '
Public Const FTLIB_ERR_INVALID_PARAM As UInteger = &HE0001018UI '
Public Const FTLIB_ERR_SOME_DEVICES_ARE_OPEN As UInteger = &HE0001101UI '
Public Const FTLIB_ERR_DEVICE_IS_OPEN As UInteger = &HE0001102UI '
Public Const FTLIB_ERR_DEVICE_NOT_OPEN As UInteger = &HE0001103UI '
Public Const FTLIB_ERR_NO_SUCH_DEVICE_INSTANCE As UInteger = &HE0001104UI '
Public Const FTLIB_ERR_UNKNOWN_DEVICE_HANDLE As UInteger = &HE0001283UI '
Public Const FTLIB_ERR_LIB_IS_INITIALIZED As UInteger = &HE0001286UI '
Public Const FTLIB_ERR_LIB_IS_NOT_INITIALIZED As UInteger = &HE0001287UI '
Public Const FTLIB_ERR_THREAD_NOT_STARTABLE As UInteger = &HE00012A0UI '
Public Const FTLIB_ERR_THREAD_IS_RUNNING As UInteger = &HE00012A5UI '
Public Const FTLIB_ERR_THREAD_NOT_RUNNING As UInteger = &HE00012A6UI '
Public Const FTLIB_ERR_THREAD_SYNCHRONIZED As UInteger = &HE00012AFUI '
Public Const FTLIB_ERR_TIMEOUT_TA As UInteger = &HE00012B0UI '
Public Const FTLIB_ERR_CREATE_EVENT As UInteger = &HE00012B1UI '
Public Const FTLIB_ERR_CREATE_MM_TIMER As UInteger = &HE00012B2UI '
Public Const FTLIB_ERR_UPLOAD_FILE_NOT_OPEN As UInteger = &HE0001400UI '
Public Const FTLIB_ERR_UPLOAD_FILE_READ_ERR As UInteger = &HE0001401UI '
Public Const FTLIB_ERR_UPLOAD_INVALID_FSIZE As UInteger = &HE0001402UI '
Public Const FTLIB_ERR_UPLOAD_START As UInteger = &HE0001403UI '
Public Const FTLIB_ERR_UPLOAD_CANCELED As UInteger = &HE0001404UI '
Public Const FTLIB_ERR_UPLOAD_FAILED As UInteger = &HE0001405UI '
Public Const FTLIB_ERR_UPLOAD_TIMEOUT As UInteger = &HE0001406UI '
Public Const FTLIB_ERR_UPLOAD_ACK As UInteger = &HE0001407UI '
Public Const FTLIB_ERR_UPLOAD_NAK As UInteger = &HE0001408UI '
Public Const FTLIB_ERR_UPLOAD_DONE As UInteger = &HE0001409UI '
Public Const FTLIB_ERR_UPLOAD_FLASHWRITE As UInteger = &HE000140AUI '
Public Const FTLIB_ERR_REM_CMD_FAILED As UInteger = &HE000140BUI '
Public Const FTLIB_ERR_REM_CMD_NOT_SUPPORTED As UInteger = &HE000140CUI '
Public Const FTLIB_ERR_FWUPD_GET_FILES As UInteger = &HE000140DUI '
Public Const FTLIB_ERR_FWUPD_NO_FILES As UInteger = &HE000140EUI '
Public Const FTLIB_ERR_ACCESS_DENIED As UInteger = &HE0001905UI '
Public Const FTLIB_ERR_OPEN_COM As UInteger = &HE0001906UI '
Public Const FTLIB_ERR_INIT_COM As UInteger = &HE0001908UI '
Public Const FTLIB_ERR_INIT_COM_TIMEOUT As UInteger = &HE0001909UI '
Public Const FTLIB_ERR_WRONG_HOSTNAME_LEN As UInteger = &HE0002000UI '
Public Const FTLIB_FWUPD_UPLOAD_START As UInteger = &HE0003000UI '
Public Const FTLIB_FWUPD_UPLOAD_DONE As UInteger = &HE0003001UI '
Public Const FTLIB_FWUPD_TIMEOUT As UInteger = &HE0003002UI '
Public Const FTLIB_FWUPD_FLUSH_DISK As UInteger = &HE0003003UI '
Public Const FTLIB_FWUPD_CLEAN_DISK As UInteger = &HE0003004UI '
Public Const FTLIB_FWUPD_ERR_FILE_READ As UInteger = &HE0003005UI '
Public Const FTLIB_FWUPD_UPLOAD_FAILED As UInteger = &HE0003006UI '
Public Const FTLIB_FWUPD_STARTING As UInteger = &HE0003007UI '
Public Const FTLIB_FWUPD_FINISHED As UInteger = &HE0003008UI '
Public Const FTLIB_FWUPD_REM_COMMAND As UInteger = &HE0003009UI '
Public Const FTLIB_FWUPD_REM_TIMEOUT As UInteger = &HE000300AUI '
Public Const FTLIB_FWUPD_REM_FAILED As UInteger = &HE000300BUI '
Public Const FTLIB_FWUPD_IZ_STEPS As UInteger = &HE000300CUI '
Public Const FTLIB_FWUPD_STEP As UInteger = &HE000300DUI '
Public Const FTLIB_BT_INVALID_CONIDX As UInteger = &HE0004000UI '
Public Const FTLIB_BT_CON_NOT_EXISTS As UInteger = &HE0004001UI '
Public Const FTLIB_BT_CON_ACTIVE As UInteger = &HE0004002UI '
Public Const FTLIB_BT_CON_INACTIVE As UInteger = &HE0004003UI '
Public Const FTLIB_BT_CON_WRONG_ADDR As UInteger = &HE0004004UI '
Public Const FTLIB_BT_CON_WAIT_BUSY As UInteger = &HE0004005UI '
Public Const FTLIB_I2C_INVALID_DEV_ADDR As UInteger = &HE0005000UI '
Public Const FTLIB_I2C_INVALID_FLAGS_ADDRMODE As UInteger = &HE0005001UI '
Public Const FTLIB_I2C_INVALID_FLAGS_DATAMODE As UInteger = &HE0005002UI '
Public Const FTLIB_I2C_INVALID_FLAGS_ERRMODE As UInteger = &HE0005003UI '
Public Const FTLIB_ERR_UNKNOWN As UInteger = &HEFFFFFFFUI '
End Class
b) additional function
Code: Alles auswählen
Module modVersionCalc
Public Function VersionEncode(ByVal VersionCode As Long) As String
On Error Resume Next
Dim VersionString As String
Dim VersionStringLen As Integer
Dim VersionStringMain As String
Dim VersionStringRel As String
Dim VersionStringSub As String
'converts integer format to binary
VersionString = System.Convert.ToString(VersionCode, 2)
VersionStringLen = Len(VersionString)
'encoding sub version
If VersionStringLen >= 8 Then
VersionStringSub = Right(VersionString, 8)
Else
VersionStringSub = "x"
End If
'Debug.Print(VersionStringSub)
VersionString = Left(VersionString, VersionStringLen - 8)
VersionStringLen = Len(VersionString)
'encoding release version
If VersionStringLen >= 8 Then
VersionStringRel = Right(VersionString, 8)
Else
VersionStringRel = "x"
End If
'Debug.Print(VersionStringRel)
VersionString = Left(VersionString, VersionStringLen - 8)
'encoding main version
VersionStringMain = Right(VersionString, 8)
'Debug.Print(VersionStringMain)
VersionEncode = System.Convert.ToUInt32(VersionStringMain, 2) & "." & System.Convert.ToUInt32(VersionStringRel, 2) & "." & System.Convert.ToUInt32(VersionStringSub, 2)
End Function
End Module
c) main programm
In the main programm some functions of the library "ftMscLib.dll" are explained with a code examples. The most of it happens in the direct diolog box in the development invirenment of visual basic, with message boxes are for user dialogs.
Code: Alles auswählen
Module modMain
Sub Main()
Dim errCode As UInteger
Dim errCode2 As UInteger
Dim allPorts As UInteger
Dim r As UInteger
Dim buff As System.Text.StringBuilder = New System.Text.StringBuilder(45)
Dim buff2 As System.Text.StringBuilder = New System.Text.StringBuilder(45)
Dim valRef As Short
Dim overrunRef As Boolean
Dim rightRef As Short
Dim leftRef As Short
Dim countRef As UShort
Dim valRef2 As UShort
'Check if dll of the class is really available under the given path
Debug.Print(If(System.IO.File.Exists(classFtMscLib.dllpath), "File exists.", "File does not exist."))
'step 1: initialisation of library
Debug.Print("")
Debug.Print("step 1")
errCode = classFtMscLib.ftxInitLib()
Debug.Print("ftxInitLib(), errCode=" & errCode)
'step 2: check initialisation of library
Debug.Print("")
Debug.Print("step 2")
errCode = classFtMscLib.ftxIsLibInit()
Debug.Print("ftxIsLibInit(), errCode=" & errCode)
If errCode = classFtMscLib.FTLIB_ERR_LIB_IS_INITIALIZED Then
Debug.Print(" FTLIB_ERR_LIB_IS_INITIALIZED")
End If
'step 3: look up existing com ports
Debug.Print("")
Debug.Print("step 3")
Debug.Print("number of all ports=" & classFtMscLib.ftxGetAvailableComPorts(0))
Debug.Print("number of usb ports=" & classFtMscLib.ftxGetAvailableComPorts(1))
Debug.Print("number ob bt ports=" & classFtMscLib.ftxGetAvailableComPorts(2))
'step 4: list all existing ports
Debug.Print("")
Debug.Print("step 4")
allPorts = classFtMscLib.ftxGetAvailableComPorts(0)
For tel As UInteger = 0 To allPorts - 1
r = classFtMscLib.ftxIsLibInit()
buff2 = New System.Text.StringBuilder(100)
buff = New System.Text.StringBuilder(100)
r = classFtMscLib.ftxEnumComPorts(tel, buff2, 100)
If (r < 100) Then
Debug.Print(" found " + buff2.ToString())
Else
classFtMscLib.ftxGetLibErrorString(r, 1, buff, 40)
Debug.Print(buff.ToString())
End If
Next
'step 5: direct command window
Debug.Print("")
Debug.Print("step 5")
MsgBox("wait & check: look at direct command window")
'step 6: activate connection to RoboTX controller
Debug.Print("")
Debug.Print("step 6")
fthdl = classFtMscLib.ftxOpenComDevice("COM7", 38400, errCode2) 'way of working 1
'fthdl = classFtMscLib.ftxOpenComDeviceNr(7, 38400, errCode2) 'way of working 2 (alternatively)
Debug.Print("ftxOpenComDevice('COM7', 38400, errCode2), errCode2=" & errCode2)
'step 7: connection OK?
Debug.Print("")
Debug.Print("step 7")
MsgBox("wait & check: connection OK?")
'step 8: activate transfer area for command and data exchenge between RoboRX controller and PC
Debug.Print("")
Debug.Print("step 8")
errCode = classFtMscLib.ftxStartTransferArea(fthdl)
Debug.Print("ftxStartTransferArea(fthdl), errCode=" & errCode)
'step 9: test of transfer area
Debug.Print("")
Debug.Print("step 9")
errCode = classFtMscLib.ftxIsTransferActiv(fthdl)
Debug.Print("ftxIsTransferActiv(fthdl), errCode=" & errCode)
If errCode = classFtMscLib.FTLIB_ERR_THREAD_IS_RUNNING Then
Debug.Print(" FTLIB_ERR_THREAD_IS_RUNNING")
End If
'step 10: from step before, show acitive error code as human interface reply
Debug.Print("")
Debug.Print("step 10")
buff = New System.Text.StringBuilder(100)
Debug.Print(classFtMscLib.ftxGetLibErrorString(errCode, 1, buff, 40))
Debug.Print(errCode & " = " & buff.ToString())
'step 11: read master RoboTXController (0), inpitID (1)
Debug.Print("")
Debug.Print("step 11")
Debug.Print(classFtMscLib.ftxGetInIOValue(fthdl, 0, 1, valRef, overrunRef))
Debug.Print(" valRef=" & valRef)
Debug.Print(" overrunRef=" & overrunRef)
'step 12: connection still active?
Debug.Print("")
Debug.Print("step 12")
MsgBox("wait & check: connection still active?")
'step 13: read library version as integer output
Debug.Print("")
Debug.Print("step 13")
Debug.Print("ftxGetLibVersion()=" & classFtMscLib.ftxGetLibVersion() & " = " & VersionEncode(classFtMscLib.ftxGetLibVersion()))
'step 14: read library version as string output
Debug.Print("")
Debug.Print("step 14")
buff2 = New System.Text.StringBuilder(100)
Debug.Print("ftxGetLibVersionStr(), string length=" & classFtMscLib.ftxGetLibVersionStr(buff2, 100))
Debug.Print("ftxGetLibVersionStr(), string content=" & buff2.ToString)
'step 15: check if RoboTxController handle ist still active
Debug.Print("")
Debug.Print("step 15")
errCode = classFtMscLib.ftxIsHandleValid(fthdl)
buff = New System.Text.StringBuilder(100)
Debug.Print(classFtMscLib.ftxGetLibErrorString(errCode, 1, buff, 40))
Debug.Print("handle still active = " & buff.ToString())
'step 16: check communication status to RoboTxController
Debug.Print("")
Debug.Print("step 16")
errCode = classFtMscLib.ftxGetComStatus(fthdl)
buff = New System.Text.StringBuilder(100)
Debug.Print(classFtMscLib.ftxGetLibErrorString(errCode, 1, buff, 40))
Debug.Print("communication status = " & buff.ToString())
'step 17: wait & check: press red RoboTXController button
Debug.Print("")
Debug.Print("step 17")
MsgBox("wait & check: press and hold one button on the RoboTXController and quit this diolog box")
'step 18: from step before, check which button was pressed from RoboTXController (0)
Debug.Print("")
Debug.Print("step 18")
errCode = classFtMscLib.ftxGetInDisplayButtonValue(fthdl, 0, leftRef, rightRef)
Debug.Print("leftRef button press time=" & leftRef)
Debug.Print("rightRef button press time=" & rightRef)
'step 19: reset from RoboTXController (0) counter c1 (0)
Debug.Print("")
Debug.Print("step 19")
errCode = classFtMscLib.ftxStartCounterReset(fthdl, 0, 0)
buff = New System.Text.StringBuilder(100)
Debug.Print(classFtMscLib.ftxGetLibErrorString(errCode, 1, buff, 40))
Debug.Print("reset of counter c1 = " & buff.ToString())
'step 20: wait & check: set some signal pulses on counter c1 of RoboTXController
Debug.Print("")
Debug.Print("step 20")
MsgBox("wait & check: set some signal pulses on counter c1 of RoboTXController and quit this diolog box")
'step 21: from step before, check how many event there were on counter c1 (0) of RoboTXController (0)
Debug.Print("")
Debug.Print("step 21")
Debug.Print(classFtMscLib.ftxGetInCounterValue(fthdl, 0, 0, countRef, valRef2))
Debug.Print("contRef=" & countRef)
Debug.Print("valRef2=" & valRef2)
'step 22: wait & check: connect a motor to M2 (1) of RoboTXController (0)
Debug.Print("")
Debug.Print("step 22")
MsgBox("wait & check: connect a motor to M2 (1) of RoboTXController (0)")
'step 23: run motor on M2 turning right
Debug.Print("")
Debug.Print("step 23")
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorConfig(fthdl, 0, 1, True)) 'def out O3 and O4 as motor
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorValues(fthdl, 0, 1, 512, 0, False)) '512 is full speed
'step 24: wait & check: is motor on M2 running, turning right?
Debug.Print("")
Debug.Print("step 24")
MsgBox("wait & check: is motor on M2 running, turning right?")
'step 25: run motor in other direction
Debug.Print("")
Debug.Print("step 25")
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorValues(fthdl, 0, 1, 0, 512, False)) '512 is full speed
'step 26: wait & check: is motor on M2 running, turning left?
Debug.Print("")
Debug.Print("step 26")
MsgBox("wait & check: is motor on M2 running, turning left?")
'step 27: stop running motor
Debug.Print("")
Debug.Print("step 27")
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorValues(fthdl, 0, 1, 0, 0, True))
'step 28: wait & check: disconnect motor an connect 2 lamps to O3 and O4
Debug.Print("")
Debug.Print("step 28")
MsgBox("wait & check: disconnect motor an connect 2 lamps to O3 and O4")
'step 29: run 2 separate lamps on O3 and O4
Debug.Print("")
Debug.Print("step 29")
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorConfig(fthdl, 0, 1, False)) 'def out O3 and O4 as 2 single outputs
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorValues(fthdl, 0, 1, 512, 512, False))
'step 30: wait & check: are both lamps on
Debug.Print("")
Debug.Print("step 30")
MsgBox("wait & check: are both lamps on?")
'step 31: only O4 lamp is on, and only on 50% brightness (256=50%)
Debug.Print("")
Debug.Print("step 31")
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorValues(fthdl, 0, 1, 0, 256, False))
'step 32: wait & check: only O4 lamp is on, and only on 50% brightness
Debug.Print("")
Debug.Print("step 32")
MsgBox("wait & check: only O4 lamp is on, and only on 50% brightness?")
'step 33: set both lamps off
Debug.Print("")
Debug.Print("step 33")
Debug.Print("M2 error=" & classFtMscLib.ftxSetOutMotorValues(fthdl, 0, 1, 0, 0, False))
'step 34: wait & check: connect a photo resistance to I8
Debug.Print("")
Debug.Print("step 34")
MsgBox("wait & check: connect a photo resistance to I8")
'step 35: set I8 to analog 5k resistance measurement
Debug.Print("")
Debug.Print("step 35")
Debug.Print("set I8 error = " & classFtMscLib.ftxSetUniConfig(fthdl, 0, 7, 1, False))
MsgBox("pause")
Debug.Print("read analog I8 error = " & classFtMscLib.ftxGetInIOValue(fthdl, 0, 7, valRef, overrunRef))
Debug.Print("valRef=" & valRef)
Debug.Print("overrunRef=" & overrunRef)
'step 36: send a message to RoboTXController display
Debug.Print("")
Debug.Print("step 36")
errCode = classFtMscLib.ftxSetRoboTxMessage(fthdl, 0, "Hello World")
'step 37: wait & check: message on RoboTXController lcd display
Debug.Print("")
Debug.Print("step 37")
MsgBox("wait & check: what is written on the RoboTXController display")
'step 38: clear RoboTXController display
Debug.Print("")
Debug.Print("step 38")
Debug.Print("clear display error = " & classFtMscLib.ftxSetRoboTxMessage(fthdl, 0, ""))
'step 39: wait & check: RoboTXController lcd display clear
Debug.Print("")
Debug.Print("step 39")
MsgBox("wait & check: RoboTXController display normal again?")
'step 40: close transfer area
Debug.Print("")
Debug.Print("step 40")
errCode = classFtMscLib.ftxStopTransferArea(fthdl)
Debug.Print("ftxStopTransferArea(fthdl), errCode=" & errCode)
'step 41: cut connection to RoboTX controller
Debug.Print("")
Debug.Print("step 41")
errCode = classFtMscLib.ftxCloseDevice(fthdl)
Debug.Print("ftxCloseDevice(fthdl), errCode=" & errCode)
'step 42: close library
Debug.Print("")
Debug.Print("step 42")
errCode = classFtMscLib.ftxCloseLib()
Debug.Print("ftxCloseLib(), errCode=" & errCode)
'step 43: program end
Debug.Print("")
Debug.Print("step 43")
Debug.Print("program end")
'end program
End
End Sub
End Module
3) It follows the list of functions of "ftMscLib.dll"
a) Functions explained above
EnumComPorts
GetAvailableComPorts
GetComStatus
GetInCounterValue
GetInDisplayButtonValue
GetInIOValue
SetFtMotorConfig
SetFtUniConfig
SetOutMotorValues
StartCounterReset
ftxCloseDevice
ftxCloseLib
ftxGetLibErrorString
ftxGetLibVersion
ftxGetLibVersionStr
ftxInitLib
ftxIsHandleValid
ftxIsLibInit
ftxIsTransferActiv
ftxOpenComDevice
ftxOpenComDeviceNr
ftxStartTransferArea
ftxStopTransferArea
b) Functions not explained above (so there is some work left

... )
SetFtCntConfig
SetOutPwmValues
FtRamFileUpload
FtRemoteCmd
GetRoboTxBtAddr
GetRoboTxBtStatus
GetRoboTxDevName
GetRoboTxDllStr
GetRoboTxFwStr
GetRoboTxFwVal
GetRoboTxHwStr
GetRoboTxInfo
GetRoboTxMasterState
GetRoboTxMemLayout
GetRoboTxSerialStr
GetRoboTxSlaveAlive
GetRoboTxSlaveState
GetSessionId
GetTransferAreaStatusAddr
GetTransferAreasArrayAddr
GetTrapStatistic
RTxCleanDisk
ResetTrapStatistic
RoboTxFwUpdate
SendBtMessage
SetCBCounterResetted
SetCBMotorExReached
SetCBRoboExtState
SetRoboTxDevName
SetRoboTxMessage
StartMotorExCmd
StartScanBtDevice
StatusBtConnection
StopAllMotorExCmd
StopMotorExCmd
ftxCloseAllDevices
ftxI2cRead
ftxI2cWrite
ftxGetLongNameStrg
ftxGetManufacturerStrg
ftxGetSerialNrStrg
ftxGetShortNameStrg
so now the community can start havin' fun with VB and the RoboTXController
Andy42