Hello Everyone; I am trying to integrate a TRDI Workhorse Sentinel ADCP with a CR1000 datalogger to get real-time waves and currents (at several bins). Does anyone have a code I could use?
Thanks,
Felipe
This is a generic program to read in the PD0 binary format:
'CR1000 Series Datalogger 'To create a different opening program template, type in new 'date: 'program author: Jacob 'RDI PD0 format reference program Const MaxCellCount = 30 'Number of cells configured in sensor Const MaxEnsembleLength = 20000 Public PTemp, batt_volt Dim EnsembleString As String * MaxEnsembleLength Dim i As Long, k As Long Public BytesAvailable As Long Public CalculatedChecksum As Long, EnsembleCheck As Long Public EnsembleStart As Long, EnsembleLength As Long Public VariableLeaderStart As Long, FixedLeaderStart As Long, VelocityStart As Long, CorrelationStart As Long Public EchoIntenseStart As Long, PercentGoodStart As Long, StatusProfileStart As Long Public NewEnsemble As Boolean, NeedMoreBytes As Boolean, EnsembleValid As Boolean 'Fixed Leader Variables Public NumberOfCells As Long, RangeCellLength As Long, BlankAfterTransmit As Long Public LowCorrThresh As Long, ErrorVelocityMax As Long, Bin1Distance As Long Public FalseTargetThreshold As Long 'Variable Leader Variables Public EnsembleNumber As Long, BITResult As Long, SpeedOfSound As Long Public DepthOfTranducer As Long, Pitch As Long, Roll As Long Public Salinity As Long, TransducerTemp As Long, BITHex As String 'Data Types Public NumberDataTypes As Long, DataTypeOffset(13) As Long, DataTypeID(13) As Long 'Velocity Values Public Velocity1(MaxCellCount) As Long, Velocity2(MaxCellCount) As Long, Velocity3(MaxCellCount) As Long 'Quality Values Public Correlation1(MaxCellCount) As Long, Correlation2(MaxCellCount) As Long, Correlation3(MaxCellCount) As Long Public Echo1(MaxCellCount) As Long, Echo2(MaxCellCount) As Long, Echo3(MaxCellCount) As Long Public PercentGood1(MaxCellCount) As Long, PercentGood2(MaxCellCount) As Long, PercentGood3(MaxCellCount) As Long Dim ProcessVelocity As Boolean, ProcessCorrelation As Boolean, ProcessEcho As Boolean Dim ProcessPercentGood As Boolean, ProcessFixedLeader As Boolean, ProcessVariableLeader As Boolean 'Define Data Tables DataTable (Test,1,1000) DataInterval (0,15,Sec,10) Minimum (1,batt_volt,FP2,0,False) Sample (1,PTemp,FP2) EndTable Sub EnsembleShiftUp 'Shifts entire buffer up, so that EnsembleStart is now 1 MoveBytes (EnsembleString,0,EnsembleString,EnsembleStart-1,MaxEnsembleLength - EnsembleStart + 1) EnsembleStart = 1 EndSub Sub BufferShiftUp(NumberToShift As Long) 'Shifts entire buffer up by number of bytes MoveBytes (EnsembleString,0,EnsembleString,NumberToShift,MaxEnsembleLength - NumberToShift) EndSub Function SignedInt16(tempDec As Long) 'Converts two byte long to 16bit signed If tempDec>32767 Then tempDec=tempDec-65536 EndIf SignedInt16=tempDec EndFunction 'Main Program BeginProg SerialOpen (COMRS232,-115200,3,0, MaxEnsembleLength *2 + 1 ) 'Be sure to open in binary format Scan (1,Sec,0,0) PanelTemp (PTemp,250) Battery (batt_volt) If IfTime (0,2,Min) Then SerialOutBlock (COMRS232,"cs" & CHR(13) & CHR(10),4) EndIf If IfTime (1,2,Min) Then 'Change interval to coincide with sensor BytesAvailable = SerialInChk(ComRS232) SerialInBlock (COMRS232,EnsembleString,BytesAvailable) EnsembleStart = 0 For i = 1 To BytesAvailable 'Find start of Ensemble If ASCII(EnsembleString(1,1,i)) = 127 Then '&h7F is 127 If ASCII(EnsembleString(1,1,i+1)) = 127 Then EnsembleStart = i NewEnsemble = true ExitFor EndIf EndIf Next i 'next byte in buffer EndIf If NewEnsemble Then 'check ensemble data validity EnsembleValid = false If BytesAvailable >=6 Then 'enough bytes to read length EnsembleLength = ASCII(EnsembleString(1,1,EnsembleStart + 3)) * 256 + ASCII(EnsembleString(1,1,EnsembleStart + 2)) NumberDataTypes = ASCII(EnsembleString(1,1,EnsembleStart + 5)) If BytesAvailable >= (EnsembleStart + EnsembleLength + 1) Then 'Enough length for whole ensemble NeedMoreBytes = false 'Checksum validation EnsembleCheck = ASCII(EnsembleString(1,1,EnsembleStart + EnsembleLength + 1)) * 256 + ASCII(EnsembleString(1,1,EnsembleStart + EnsembleLength)) CalculatedChecksum = 0 For i = 0 To (EnsembleLength - 1) CalculatedChecksum = (CalculatedChecksum + ASCII(EnsembleString(1,1,EnsembleStart + i)) ) MOD 65536 Next i 'Byte of ensemble If CalculatedChecksum = EnsembleCheck Then EnsembleValid = true Else EnsembleValid = false EndIf 'checksums equal Else NeedMoreBytes = true 'Catch invalid ensemble lengths If EnsembleLength +2 > MaxEnsembleLength Then Call BufferShiftUp(EnsembleStart) EndIf EndIf 'Enough bytes EndIf 'bytes available for header NewEnsemble = false EndIf 'end ensemble data processing If EnsembleValid Then 'process data from ensemble For i = 1 To NumberDataTypes DataTypeOffset(i) = ASCII(EnsembleString(1,1,EnsembleStart + i *2 + 4 )) + 256 * ASCII(EnsembleString(1,1,EnsembleStart + i *2 + 5 )) DataTypeID(i) = ASCII(EnsembleString(1,1,EnsembleStart + DataTypeOffset(i) )) + 256 * ASCII(EnsembleString(1,1,EnsembleStart + DataTypeOffset(i) + 1)) If DataTypeID(i) = 256 Then 'Velocity Data located VelocityStart = EnsembleStart + DataTypeOffset(i) ProcessVelocity = true EndIf 'End ID is velocity If DataTypeID(i) = 512 Then 'Correlation Data located CorrelationStart = EnsembleStart + DataTypeOffset(i) ProcessCorrelation = true EndIf 'End ID is velocity If DataTypeID(i) = 768 Then 'Echo Data located EchoIntenseStart = EnsembleStart + DataTypeOffset(i) ProcessEcho = true EndIf 'End ID is velocity If DataTypeID(i) = 1024 Then 'Percent Good Data located PercentGoodStart = EnsembleStart + DataTypeOffset(i) ProcessPercentGood = true EndIf 'End ID is velocity If DataTypeID(i) = 0 Then 'Fixed Leader Data located FixedLeaderStart = EnsembleStart + DataTypeOffset(i) ProcessFixedLeader = true EndIf 'End ID is velocity If DataTypeID(i) = 128 Then 'Variable Leader Data located VariableLeaderStart = EnsembleStart + DataTypeOffset(i) ProcessVariableLeader = true EndIf 'End ID is velocity Next i 'next datatype EndIf 'ensemble valid If ProcessVelocity Then For i = 1 To MaxCellCount Velocity1(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 -6)) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 -5)) Velocity1(i) = SignedInt16(Velocity1(i)) Velocity2(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 -4)) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 -3)) Velocity2(i) = SignedInt16(Velocity2(i)) Velocity3(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 -2)) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 -1)) Velocity3(i) = SignedInt16(Velocity3(i)) Next i 'next cell ProcessVelocity = false EndIf If ProcessFixedLeader Then NumberOfCells = ASCII(EnsembleString(1,1,FixedLeaderStart + 9 )) RangeCellLength = ASCII(EnsembleString(1,1,FixedLeaderStart + 12 )) + 256 * ASCII(EnsembleString(1,1,FixedLeaderStart + 13 )) BlankAfterTransmit = ASCII(EnsembleString(1,1,FixedLeaderStart + 14 )) + 256 * ASCII(EnsembleString(1,1,FixedLeaderStart + 15 )) LowCorrThresh = ASCII(EnsembleString(1,1,FixedLeaderStart + 17 )) ErrorVelocityMax = ASCII(EnsembleString(1,1,FixedLeaderStart + 20 )) + 256 * ASCII(EnsembleString(1,1,FixedLeaderStart + 21 )) FalseTargetThreshold = ASCII(EnsembleString(1,1,FixedLeaderStart + 38 )) ProcessFixedLeader = false EndIf If ProcessVariableLeader Then EnsembleNumber = ASCII(EnsembleString(1,1,VariableLeaderStart + 2 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 3 )) BITResult = ASCII(EnsembleString(1,1,VariableLeaderStart + 12 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 13 )) BITHex = FormatLong (BITResult,"%X") SpeedOfSound = ASCII(EnsembleString(1,1,VariableLeaderStart + 14 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 15 )) DepthOfTranducer = ASCII(EnsembleString(1,1,VariableLeaderStart + 16 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 17 )) Pitch = ASCII(EnsembleString(1,1,VariableLeaderStart + 20 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 21 )) Roll = ASCII(EnsembleString(1,1,VariableLeaderStart + 22 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 23 )) Salinity = ASCII(EnsembleString(1,1,VariableLeaderStart + 24 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 25 )) TransducerTemp = ASCII(EnsembleString(1,1,VariableLeaderStart + 26 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 27 )) ProcessVariableLeader = false EndIf If ProcessEcho Then For i = 1 To MaxCellCount Echo1(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 -2)) Echo2(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 -1)) Echo3(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 )) Next i ProcessEcho = false EndIf If ProcessCorrelation Then For i = 1 To MaxCellCount Correlation1(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 -2)) Correlation2(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 -1)) Correlation3(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 )) Next i ProcessCorrelation = false EndIf If ProcessPercentGood Then For i = 1 To MaxCellCount PercentGood1(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 -2)) PercentGood2(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 -1)) PercentGood3(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 )) Next i ProcessPercentGood = false EndIf CallTable Test NextScan EndProg
Thanks a lot! I intend to interface the ADCP to the CR1000 datalogger via cable (200-m long) using the RS232 comm port on the datalogger.
This program is for 4 beam mode instead of XYZ mode.
For the connection between the Workhorse and the datalogger RS232 port, you will need to use a RS232 to RS422 converter like the one that ships with the Workhorse. RS232 wouldn't work at that cable length. Between the converter and the RS232 port, use a male to male null modem cable. When you set the datalogger up to communicate with the ADCP on the RS232 port, you can't connect to it with Campbell software on that port. So you will need an alternate connection like the CSIO port for downloading data.
'CR1000 Series Datalogger 'To create a different opening program template, type in new 'date: 'program author: Jacob 'RDI PD0 format reference program Const MaxCellCount = 30 'Number of cells configured in sensor Const MaxEnsembleLength = 20000 Public PTemp, batt_volt Dim EnsembleString As String * MaxEnsembleLength Dim i As Long, k As Long Dim bufferEnd As Long Public BytesAvailable As Long Public CalculatedChecksum As Long, EnsembleCheck As Long Public EnsembleStart As Long, EnsembleLength As Long Public VariableLeaderStart As Long, FixedLeaderStart As Long, VelocityStart As Long, CorrelationStart As Long Public EchoIntenseStart As Long, PercentGoodStart As Long, StatusProfileStart As Long Public NewEnsemble As Boolean, NeedMoreBytes As Boolean, EnsembleValid As Boolean 'Fixed Leader Variables Public NumberOfCells As Long, RangeCellLength As Long, BlankAfterTransmit As Long Public LowCorrThresh As Long, ErrorVelocityMax As Long, Bin1Distance As Long Public FalseTargetThreshold As Long 'Variable Leader Variables Public EnsembleNumber As Long, BITResult As Long, SpeedOfSound As Long Public DepthOfTranducer As Long, Pitch As Long, Roll As Long Public Salinity As Long, TransducerTemp As Long, BITHex As String 'Data Types Public NumberDataTypes As Long, DataTypeOffset(13) As Long, DataTypeID(13) As Long 'Velocity Values Public Velocity1(MaxCellCount) As Long, Velocity2(MaxCellCount) As Long, Velocity3(MaxCellCount) As Long , Velocity4(MaxCellCount) As Long 'Quality Values Public Correlation1(MaxCellCount) As Long, Correlation2(MaxCellCount) As Long, Correlation3(MaxCellCount) As Long , Correlation4(MaxCellCount) As Long Public Echo1(MaxCellCount) As Long, Echo2(MaxCellCount) As Long, Echo3(MaxCellCount) As Long , Echo4(MaxCellCount) As Long Public PercentGood1(MaxCellCount) As Long, PercentGood2(MaxCellCount) As Long, PercentGood3(MaxCellCount) As Long, PercentGood4(MaxCellCount) As Long Dim ProcessVelocity As Boolean, ProcessCorrelation As Boolean, ProcessEcho As Boolean Dim ProcessPercentGood As Boolean, ProcessFixedLeader As Boolean, ProcessVariableLeader As Boolean 'Define Data Tables DataTable (Test,1,1000) DataInterval (0,15,Sec,10) Minimum (1,batt_volt,FP2,0,False) Sample (1,PTemp,FP2) EndTable Sub EnsembleShiftUp 'Shifts entire buffer up, so that EnsembleStart is now 1 MoveBytes (EnsembleString,0,EnsembleString,EnsembleStart-1,MaxEnsembleLength - EnsembleStart + 1) bufferEnd -= EnsembleStart - 1 'Must do before resetting EnsembleStart EnsembleStart = 1 EndSub Sub BufferShiftUp(NumberToShift As Long) 'Shifts entire buffer up by number of bytes MoveBytes (EnsembleString,0,EnsembleString,NumberToShift,MaxEnsembleLength - NumberToShift) bufferEnd -= NumberToShift EndSub Function SignedInt16(tempDec As Long) 'Converts two byte long to 16bit signed If tempDec>32767 Then tempDec=tempDec-65536 EndIf SignedInt16=tempDec EndFunction 'Main Program BeginProg bufferEnd = 0 SerialOpen (COMRS232,-115200,3,0, MaxEnsembleLength *2 + 1 ) 'Be sure to open in binary format Scan (1,Sec,0,0) PanelTemp (PTemp,250) Battery (batt_volt) If IfTime (0,2,Min) Then SerialOutBlock (COMRS232,"cs" & CHR(13) & CHR(10),4) EndIf If IfTime (1,2,Min) Then 'Change interval to coincide with sensor manual poll interval, or run faster than sensor in case of automatic output BytesAvailable = SerialInChk(ComRS232) If BytesAvailable Then 'Bring in data into buffer string, after unused data, up to the available space in the string BytesAvailable = SerialInBlock (COMRS232,EnsembleString(1,1,bufferEnd + 1), IIF (BytesAvailable <= (MaxEnsembleLength - bufferEnd),BytesAvailable,(MaxEnsembleLength - bufferEnd))) bufferEnd = bufferEnd + BytesAvailable EnsembleStart = 0 For i = 1 To bufferEnd 'Find start of Ensemble If ASCII(EnsembleString(1,1,i)) = 127 Then '&h7F is 127 If ASCII(EnsembleString(1,1,i+1)) = 127 Then EnsembleStart = i NewEnsemble = true ExitFor EndIf 'Second byte of header EndIf 'First byte of header Next i 'next byte in buffer 'If did not find an EnsembleStart in entire buffer, shift up to last byte(in case it is first byte of new ensemble) If i > bufferEnd Then Call BufferShiftUp(bufferEnd - 1) EndIf EndIf 'BytesAvailable EndIf ' IfTime (1,2,Min) If NewEnsemble Then 'check ensemble data validity EnsembleValid = false If bufferEnd - EnsembleStart >=5 Then 'enough bytes to read length EnsembleLength = ASCII(EnsembleString(1,1,EnsembleStart + 3)) * 256 + ASCII(EnsembleString(1,1,EnsembleStart + 2)) NumberDataTypes = ASCII(EnsembleString(1,1,EnsembleStart + 5)) If bufferEnd-EnsembleStart + 1 >= (EnsembleLength + 2) Then 'Enough length for whole ensemble NeedMoreBytes = false 'Checksum validation EnsembleCheck = ASCII(EnsembleString(1,1,EnsembleStart + EnsembleLength + 1)) * 256 + ASCII(EnsembleString(1,1,EnsembleStart + EnsembleLength)) CalculatedChecksum = 0 For i = 0 To (EnsembleLength - 1) CalculatedChecksum = (CalculatedChecksum + ASCII(EnsembleString(1,1,EnsembleStart + i)) ) AND 65535 Next i 'Byte of ensemble If CalculatedChecksum = EnsembleCheck Then EnsembleValid = true ' Call EnsembleShiftUp Else EnsembleValid = false Call BufferShiftUp(1) 'Move up data in buffer by one byte to clear start of bad Ensemble EndIf 'checksums equal Else NeedMoreBytes = true 'Catch buffer overruns If bufferEnd >= MaxEnsembleLength Then Call BufferShiftUp(EnsembleStart - 1) EndIf 'Catch invalid ensemble lengths If EnsembleLength +2 > MaxEnsembleLength Then Call BufferShiftUp(EnsembleStart) EndIf EndIf 'Enough bytes EndIf 'bytes available for header NewEnsemble = false EndIf 'end ensemble data processing If EnsembleValid Then 'process data from ensemble For i = 1 To NumberDataTypes DataTypeOffset(i) = ASCII(EnsembleString(1,1,EnsembleStart + i *2 + 4 )) + 256 * ASCII(EnsembleString(1,1,EnsembleStart + i *2 + 5 )) DataTypeID(i) = ASCII(EnsembleString(1,1,EnsembleStart + DataTypeOffset(i) )) + 256 * ASCII(EnsembleString(1,1,EnsembleStart + DataTypeOffset(i) + 1)) If DataTypeID(i) = 256 Then 'Velocity Data located VelocityStart = EnsembleStart + DataTypeOffset(i) ProcessVelocity = true EndIf 'End ID is velocity If DataTypeID(i) = 512 Then 'Correlation Data located CorrelationStart = EnsembleStart + DataTypeOffset(i) ProcessCorrelation = true EndIf 'End ID is velocity If DataTypeID(i) = 768 Then 'Echo Data located EchoIntenseStart = EnsembleStart + DataTypeOffset(i) ProcessEcho = true EndIf 'End ID is velocity If DataTypeID(i) = 1024 Then 'Percent Good Data located PercentGoodStart = EnsembleStart + DataTypeOffset(i) ProcessPercentGood = true EndIf 'End ID is velocity If DataTypeID(i) = 0 Then 'Fixed Leader Data located FixedLeaderStart = EnsembleStart + DataTypeOffset(i) ProcessFixedLeader = true EndIf 'End ID is velocity If DataTypeID(i) = 128 Then 'Variable Leader Data located VariableLeaderStart = EnsembleStart + DataTypeOffset(i) ProcessVariableLeader = true EndIf 'End ID is velocity Next i 'next datatype EndIf 'ensemble valid If ProcessVelocity Then For i = 1 To MaxCellCount Velocity1(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 -6)) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 -5)) Velocity1(i) = SignedInt16(Velocity1(i)) Velocity2(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 -4)) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 -3)) Velocity2(i) = SignedInt16(Velocity2(i)) Velocity3(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 -2)) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 -1)) Velocity3(i) = SignedInt16(Velocity3(i)) Velocity4(i) = ASCII(EnsembleString(1,1,VelocityStart + i*8 )) + 256 * ASCII(EnsembleString(1,1,VelocityStart + i*8 +1)) Velocity4(i) = SignedInt16(Velocity4(i)) Next i 'next cell ProcessVelocity = false EndIf If ProcessFixedLeader Then NumberOfCells = ASCII(EnsembleString(1,1,FixedLeaderStart + 9 )) RangeCellLength = ASCII(EnsembleString(1,1,FixedLeaderStart + 12 )) + 256 * ASCII(EnsembleString(1,1,FixedLeaderStart + 13 )) BlankAfterTransmit = ASCII(EnsembleString(1,1,FixedLeaderStart + 14 )) + 256 * ASCII(EnsembleString(1,1,FixedLeaderStart + 15 )) LowCorrThresh = ASCII(EnsembleString(1,1,FixedLeaderStart + 17 )) ErrorVelocityMax = ASCII(EnsembleString(1,1,FixedLeaderStart + 20 )) + 256 * ASCII(EnsembleString(1,1,FixedLeaderStart + 21 )) FalseTargetThreshold = ASCII(EnsembleString(1,1,FixedLeaderStart + 38 )) ProcessFixedLeader = false EndIf If ProcessVariableLeader Then EnsembleNumber = ASCII(EnsembleString(1,1,VariableLeaderStart + 2 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 3 )) BITResult = ASCII(EnsembleString(1,1,VariableLeaderStart + 12 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 13 )) BITHex = FormatLong (BITResult,"%X") SpeedOfSound = ASCII(EnsembleString(1,1,VariableLeaderStart + 14 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 15 )) DepthOfTranducer = ASCII(EnsembleString(1,1,VariableLeaderStart + 16 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 17 )) Pitch = ASCII(EnsembleString(1,1,VariableLeaderStart + 20 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 21 )) Pitch = SignedInt16(Pitch) Roll = ASCII(EnsembleString(1,1,VariableLeaderStart + 22 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 23 )) Roll = SignedInt16(Roll) Salinity = ASCII(EnsembleString(1,1,VariableLeaderStart + 24 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 25 )) TransducerTemp = ASCII(EnsembleString(1,1,VariableLeaderStart + 26 )) + 256 * ASCII(EnsembleString(1,1,VariableLeaderStart + 27 )) ProcessVariableLeader = false EndIf If ProcessEcho Then For i = 1 To MaxCellCount Echo1(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 -2)) Echo2(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 -1)) Echo3(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 )) Echo4(i) = ASCII(EnsembleString(1,1,EchoIntenseStart + i *4 + 1 )) Next i ProcessEcho = false EndIf If ProcessCorrelation Then For i = 1 To MaxCellCount Correlation1(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 -2)) Correlation2(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 -1)) Correlation3(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 )) Correlation4(i) = ASCII(EnsembleString(1,1,CorrelationStart + i *4 + 1 )) Next i ProcessCorrelation = false EndIf If ProcessPercentGood Then For i = 1 To MaxCellCount PercentGood1(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 -2)) PercentGood2(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 -1)) PercentGood3(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 )) PercentGood4(i) = ASCII(EnsembleString(1,1,PercentGoodStart + i *4 + 1 )) Next i ProcessPercentGood = false EndIf If EnsembleValid Then 'You might want to call a data table without a data interval from within here. 'Finalize processing Call BufferShiftUp(EnsembleStart + 1) 'Shift things in the buffer up past start bytes of the processed Ensemble EnsembleValid = false 'Done, so mark false to not reprocess EndIf CallTable Test NextScan EndProg
Thanks a lot JDavis! Your comments are really appreciated.
This post is under review.