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.
118080-001 REV A
Page 31 of 95
Summary of Contents for SLM SERIES
Page 15: ...SLM MANUAL 6 118073 001 Rev C Figure 2 2 Unit Dimensions 1200W ...
Page 19: ...SLM MANUAL 10 118073 001 Rev C Figure 3 3 Local Programming via External Voltage Source ...
Page 20: ...SLM MANUAL 11 118073 001 Rev C Figure 3 4 Remote Monitoring ...
Page 40: ...Figure 9 Web Page 1 Contact Information 118080 001 REV A Page 13 of 95 ...
Page 98: ...Request Faults 68 20 ASCII 118080 001 REV A Page 71 of 95 ...