Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5691

Understand ReadStatusByte return values in VBIB32, VB6

$
0
0

Hello,
When I perform the below function GetData, Call ReadStatusByte(0, GPIBAddress,
spr%)  returns many responses.  I would like to understand what these number
mean.  Can you expand on this?

The definitions of the Hierarchy is found below. The final call,
ReadStatusByte32,  is within the VBIB32 Module.

 

I get values such as 128, 4.....and am looking for a list of what these all mean.  

 

Thanks,

********************************************************************************
***
Public Function GetData(GPIBAddress, sendstring) As String
ErrorLocation = "GetData"
On Error GoTo errorhandler
    Dim ReadThis As String, spr As Integer, ReadTemp As String
    Dim ReRead As Integer
    Dim ReReadCnt As Integer
    'Dim ErrorLocation As String
    ErrorLocation = "GetData"
    ReReadCnt = 0
    ReadThis = ""
    ReadThis = Space$(200) 'space$(180)
    spr = 0
resend:
    Call Send(0, GPIBAddress, sendstring, NLend)
    Call ReadStatusByte(0, GPIBAddress, spr%) '144= ok, 208=ok,
128=trouble(empty), 148= ? , 132 = ? 20 = ok 16 = ok 4 = ?
   
    Do While (spr% <> 208 And spr% <> 144 And spr% <> 148 And spr% <> 16 And
spr% <> 20 And spr% <> 132 And ReReadCnt < 20) ' 0 ' give readstatusbyte a
chance to switch
        If ReReadCnt > 10 Then ' if readstatusbyte does not correct clear the
device and resend to retrieve data after 10 tries.
            Call DevClear(0, GPIBAddress)
            Call ibclr(GPIBAddress)
            Call ErrorLog("Error Tracker: Read Status Byte returned a " & spr%
& ". DevClr/ibclr handled the error. " & FormatDateTime(Now, vbLongDate) & " ,
" & FormatDateTime(Now, vbLongTime))
            ReReadCnt = ReReadCnt + 1
            GoTo resend
        End If
        Call ReadStatusByte(0, GPIBAddress, spr%)
        ReReadCnt = ReReadCnt + 1
    Loop
   
    Call Receive(0, GPIBAddress, ReadThis, STOPend)
   
    GetData = Trim(ReadThis)
   
Exit Function

errorhandler:
    Call ErrorLog(Err.Number & " , " & Err.Description & " , " & ErrorLocation
& " , " & FormatDateTime(Now, vbLongDate) & " , " & FormatDateTime(Now,
vbLongTime))
    Select Case Err.Number
        Case 13
            msgbox (ErrorLocation)
        Case Else
            msgbox (Err.Number & ", " & Err.Description & " , " & ErrorLocation)
    End Select
    Resume Next
 End Function
************************************************************************


*********************************************************
Sub ReadStatusByte(ByVal ud As Integer, ByVal addr As Integer, result As
Integer)
    Dim tmpresult As Long

' Check to see if GPIB Global variables are registered
    If (GPIBglobalsRegistered = 0) Then
      Call RegisterGPIBGlobals
    End If

' Call the 32-bit DLL.
    Call ReadStatusByte32(ud, addr, tmpresult)

    result = ConvertLongToInt(tmpresult)

    Call copy_ibvars
End Sub
*******************************************************
Declare Sub ReadStatusByte32 Lib "Gpib-32.dll" Alias "ReadStatusByte" (ByVal ud
As Long, ByVal addr As Long, result As Long)


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>