118142-001 Rev B
Page 33 of 104
4.3.3 Enabling Communications Objects in Visual Basic for USB
The dynamic link library USB_dll.dll will be provided which needs to be
added to the project. The library has three functions that can be called
from the VB code.
The three functions are:
FindTheHid – finds the connection with the correct VID, PID and Serial
Number
WriteReport(str) – Writes a string to the connected HID interface
ReadReport() – Returns a string from the connected HID interface
4.3.4 Configuring
Communications in Visual Basic for USB
To use the USB_dll.dll in VB the following statements are needed.
Dim usb As usbDll
Dim MyDeviceDetected As Boolean
Set usb = New usbDll
Using this statement determines whether a connection is present.
MyDeviceDetected = usb.FindTheHid
If MyDeviceDetected is true then the connection is present.
4.3.5 Software Considerations for USB Reconnection
The following Visual Basic code snippets are presented as a guideline for
implementation with revision C and higher assemblies.
4.3.5.1
Recognize partial, corrupt, or absent data
1: temp2$ = inputInputString
2: If temp2$ <> "" Then
3:
btn_UPDATEDATA.Value = False
4:
CommStatusFlag = True
5:
CommaPos = InStr(Start, temp2$, Comma, vbTextCompare)
6:
' Channel 0
7:
On Error GoTo endhere
8:
AmbTemp = Mid(temp2$, Start, (CommaPos - Start))
Please note that even though we have guarded against no data, in
line 2, we still need to guard against bad data, in this case no
comma, on line 8. If there is no comma, we wind up passing a
negative value to Mid, which is an error, that we should trap for.
Содержание DXM100 Series
Страница 11: ...DXM100 MANUAL 5 118147 001 Rev D Figure 2 1 Unit Dimensions ...
Страница 16: ...DXM100 MANUAL 10 118147 001 Rev D Figure 3 3 Local Programming Via External Voltage Source ...
Страница 17: ...DXM100 MANUAL 11 118147 001 Rev D Figure 3 4 Remote Monitoring ...
Страница 18: ...DXM100 MANUAL 12 118147 001 Rev D RELAY Figure 3 5 Enable Interlock Logic Control ...
Страница 37: ...118142 001 Rev B Page 13 of 104 Figure 9 Web Page 1 Contact Information ...