I'm using a ps3204a device with a sofware written on my own. I have implemented a solution that use the streaming mode continuously (autostop is set to 0) but when the buffer is wrapped the device stops streaming and the autostop flag is autoset to 1. Furthermore the getstreaming function is always returning 0 samples read after that event.
I've written the application using vb.net and here you can see the call to the runstreaming function:
You need to use the AutoStopped function in the ps3000aWrap.dll
(Note, in vb.net a long is a 64 bit number, whereas when the documentation refers to a long, it is a 32 bit number, therefore, use interger in place of long, UInteger in place of unsigned long)
Declare Function IsReady Lib "ps3000awrap.dll" (ByVal handle As Integer) As Short
Declare Function AvailableData Lib "ps3000awrap.dll" (ByVal handle As Integer, ByRef startIndex As Integer) As UInteger
Declare Function AutoStopped Lib "ps3000awrap.dll" (ByVal handle As Integer) As Short
Do
Do
status = GetStreamingLatestValues(handle)
Loop While IsReady(handle) = 0
thanks for your reply.
I have already tried your code using the functions in the provided SDK with the same result.
I have also implemented a solution using your snippet but the result is always the same.
About the conversion between managed and com data types I use to help myself with this hyperlink and I haven't experienced any problem until now. http://msdn.microsoft.com/en-us/library/sak564ww.aspx
After a buffer memory wrap around the device sets the autostop flag to 1 and stops streaming.
Here is a snippet of the last implementation obtained from your snippet:
Declare Function AvailableData Lib "ps3000awrap.dll" (ByVal handle As Short, ByRef startIndex As UShort) As Integer
Declare Function AutoStopped Lib "ps3000awrap.dll" (ByVal handle As Short) As UShort
Declare Function GetStreamingLatestValues Lib "ps3000awrap.dll" (ByVal handle As Short) As UShort
Declare Function IsReady Lib "ps3000awrap.dll" (ByVal handle As Short) As UShort
Declare Function ps3000aRunStreaming Lib "ps3000a.dll" (ByVal handle As IntPtr, _
ByRef sampleInterval As UInteger, _
ByVal sampleIntervalTimeUnits As short, _
ByVal maxPreTriggerSamples As UInteger, _
ByVal maxPostTriggerSamples As UInteger, _
ByRef autoStop As Short, _
ByVal downSampleRatio As UInteger, _
ByVal downSampleRatioMode As short, _
ByVal overviewBufferSize As UInteger) As short
status= ps3000aRunStreaming(Handle, _
32, _
2, _
0, _
4194218, _
0, _
1, _
0, _
4194218)
Do
Do
status = GetStreamingLatestValues(Handle)
Loop While IsReady(Handle) = 0
autoStop = AutoStopped(Handle)
Loop While autoStop = 0 Or TSTrigBtnStop.Checked
Call ps3000aStop(Handle)
Call ps3000aStop(Handle)
here is the result:
Collected 4194213samples, Index = 0 ,Total 4194213
Collected 5samples, Index = 65445 ,Total 4194218
Collected 0samples, Index = 0 ,Total 4194218
There were two matters:
- I've changed the runstreaming declaration, the autostop argument need to be passed byval and not byref.
- I've used the last driver. I was using 1.0.0.45 instead of 1.0.0.66