1482
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
40
Programming Examples
End Function
Private Function DoQueryIEEEBlock_Bytes(query As String) As Long
On Error GoTo ErrorHandler
' Send query.
Call ivprintf(id, query + vbLf)
' Read definite-length block bytes.
Sleep 2000
' Delay before reading data.
Call ifread(id, byteArray(), ByteArraySize, vbNull, retCount)
' Get number of block length digits.
Dim intLengthDigits As Integer
intLengthDigits = CInt(Chr(byteArray(1)))
' Get block length from those digits.
Dim strBlockLength As String
strBlockLength = ""
Dim i As Integer
For i = 2 To intLength 1
strBlockLength = strBlock Chr(byteArray(i))
Next
' Return number of bytes in block plus header.
DoQueryIEEEBlock_Bytes = CLng(strBlockLength) + intLength 2
CheckInstrumentErrors
Exit Function
ErrorHandler:
MsgBox "*** Error : " + Error, vbExclamation
End
End Function
Private Sub CheckInstrumentErrors()
On Error GoTo ErrorHandler
Dim strErrVal As String * 200
Dim strOut As String
Call ivprintf(id, ":SYSTem:ERRor?" + vbLf)
' Query any errors data.
Call ivscanf(id, "%200t", strErrVal)
' Read: Errnum,"Error String".
While Val(strErrVal) <> 0
' End if find: +0,"No Error".
strOut = "INST Error: " + strErrVal
Call ivprintf(id, ":SYSTem:ERRor?" + vbLf)
' Request error message
.
Call ivscanf(id, "%200t", strErrVal)
' Read error message.
Wend
If Not strOut = "" Then