I'm using VB6 and attempting input streaming using the LJM stream functions:
https://labjack.com/support/software/api/ljm/function-reference/stream-f...
In the example VB code (VBA_LJM_2014_07_28.zip), the definition for LJM_eStreamStart is:
Declare Function LJM_eStreamStart Lib "labjackm.dll" (ByVal Handle As Long, ByVal ScansPerRead As Long, ByVal NumAddresses As Long, ByRef aScanList As Long, ByRef ScanRate As Double) As Long
Shouldn't aScanList be "ByRef ScanRate() As Double"?
If I made that change and then ran the following (trying to scan AIN0):
Dim lngHandle As Long
Dim ScansPerRead As Long
Dim aScanList(2) As Long
Dim ScanRate As Double
Dim NumAddresses As Long
ScanRate = 50000
ScansPerRead = 2
NumAddresses = 1
aScanList(0) = 0
lngError = LJM_eStreamStart(lngHandle, ScansPerRead, NumAddresses, aScanList, ScanRate)
If lngError <> LJME_NOERROR Then
Erase aScanList
Err.Raise lngError + 50000 'Adding 50000 makes sure Labjack errors are recognized by VB as "user-defined"
End If
I'm getting an error:
LJM Error # 2607 STREAM_CHN_LIST_INVALID
Any ideas?
"ByRef aScanList As Long" is correct when using a dll declare and passing an array. You need to pass the first element of aScanList when calling LJM_eStreamStart. So something like:
lngError = LJM_eStreamStart(lngHandle, ScansPerRead, NumAddresses, aScanList(0), ScanRate)
The VBA code in the LJM_VBA_SimpleStream.xls demonstrates using the stream functions. I'm attaching that code in case you don't have Xcel. Unzip for the text file with the code. Besides the Excel cell based code, the VBA code is VB6 compatible.
That solved my stream in issues.
Thanks!
Eric