by sphericle » Mon Mar 31, 2014 2:59 pm
Hello Hitesh
I changed all Long datatypes to integer.
This is the declaration:
Declare Function pl1000OpenUnit Lib "pl1000.dll" (ByRef handle As Integer) As Integer
Declare Function pl1000CloseUnit Lib "pl1000.dll" (ByVal handle As Integer) As Integer
Declare Function pl1000GetUnitInfo Lib "pl1000.dll" (ByVal handle As Integer, ByVal S As String, ByVal lth As Integer, ByRef requiredSize As Integer, ByVal info As Integer) As Integer
Declare Function pl1000SetTrigger Lib "pl1000.dll" (ByVal handle As Integer, ByVal enabled As Integer, ByVal enable_auto As Integer, ByVal auto_ms As Integer, ByVal channel As Integer, ByVal dir As Integer, ByVal threshold As Integer, ByVal hysterisis As Integer, ByVal delay As Single) As Integer
Declare Function pl1000SetInterval Lib "pl1000.dll" (ByVal handle As Integer, ByRef us_for_block As Integer, ByVal ideal_no_of_samples As Integer, channels As Integer, ByVal No_of_channels As Integer) As Integer
Declare Function pl1000GetValues Lib "pl1000.dll" (ByVal handle As Integer, ByRef values As Integer, ByRef no_of_values As Integer, ByRef overflow As Integer, ByRef triggerIndex As Integer) As Integer
Declare Function pl1000Run Lib "pl1000.dll" (ByVal handle As Integer, ByVal no_of_values As Integer, ByVal method As Integer) As Integer
Declare Function pl1000Ready Lib "pl1000.dll" (ByVal handle As Integer, ByRef ready As Integer) As Integer
Declare Function pl1000MaxValue Lib "pl1000.dll" (ByVal handle As Integer, ByRef maxValue As Integer) As Integer[size=85][/size]
Resulting Error:
System.AccessViolationException wurde nicht behandelt.
HResult=-2147467261
Message=Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.
StackTrace:
bei CorroLog.Module1.pl1000SetInterval(Int32 handle, Int32& us_for_block, Int32 ideal_no_of_samples, Int32 channels, Int32 No_of_channels)
order of calling the function without the SetInterval function.
status = pl1000OpenUnit(handle)
status = pl1000MaxValue(handle, maxValue)
Call pl1000SetTrigger(handle, False, 0, 0, 0, 0, 0, 0, 0)
' now, do not call this function: commanded out
' status = pl1000SetInterval(handle, us_for_block, nValues, channels(0), 16)
status = pl1000Run(handle, nValues, 1)
status = pl1000GetValues(handle, values(0), nValues, overflow, triggerIndex)
-> no Error occurs, ... but of course no data is collected...
Regards,
sphericle