I am trying to use the advanced .read method of the analog waveform
control. It is much more well suited to my application which is why I
am using it over the standard CWAI1_AcquiredData event (asynchronous and
default) or the .AcquireData (synchronous method).
My application is simple. For debugging I have a start command button
which has the following code:
' setup readspecification mode
ReadSpec.ReadMode = cwaiFromStartOfBuffer
ReadSpec.ReturnDataType = cwaiScaledData
ReadSpec.TimeLimit = 5
CWAI1.ReturnDataType = cwaiScaledData
CWAI1.AcquiredDataEnabled = False
CWAI1.UseDefaultBufferSize = True
'configure
CWAI1.Configure
' start
CWAI1.Start
I have another command button that uses the .Read method as follows:
Dim ReturnVal As Long
ReturnVal = CWAI1.Read(10, RawData, ReadSpec)
RawCh0 = CWArray1.IndexArray(RawData, Array(Null, 0))
RawCh1 = CWArray1.IndexArray(RawData, Array(Null, 1))
AvgCh0 = CWStat1.Mean(RawCh0)
AvgCh1 = CWStat1.Mean(RawCh1)
txtchannel(0) = AvgCh0
txtchannel(1) = AvgCh1
If ReturnVal <> 0 Then
Debug.Print "error= " & ReturnVal
End If
'Chart data
CWGraph1.ChartY RawData, 1
Clicking the READ button will read what appears to be valid data the
first time, but every click after the initial read it returns the same
data.
I thought using this functioned as a "circular buffer". The buffer was
continually overwritten with new data as it was scanned, then the user
could scan the buffer at their leisure to get the most recent data?
In order to get the data to change, I have to reissue a CWAI1.start
command every read. Is this the way it's supposed to work ? I'd doesn't
make sense. I have the StopCondition set to continuous so there should
be no reason for it to quit scanning.
I'd REALLY appreciate hearing from you. I am desperate to get this
working.
Thank You
--
----------------------
Wayne Pilgrim
wpilgri@v-wave.com
----------------------