Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Understand ReadStatusByte return values in VBIB32, VB6

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)

0 Kudos
Message 1 of 3
(6,489 Views)

Hey cmseguin,

 

This is a question that is that would fit better on the Instrument Control Boards since the method is a member of the GPIB communication library and not the Measurement Studio libraries. That being said it is difficult to find documentation for VB6, since much of the documentation online is newer. One of the better documents I found was this from the 2013 LabVIEW Help:

 

http://zone.ni.com/reference/en-XX/help/371361K-01/lvinstio/gpib_read/

 

The Status section of the article has a table with the different values and what they correspond with. 

 

This article, called Using Service Requests in your GPIB application gives a more general overview of the 488.2 protocol that might shed more light on the standard:

 

http://www.ni.com/white-paper/4629/en/

 

If you have more questions feel free to post to the Instrument Driver board. 

 

Best,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 2 of 3
(6,481 Views)

Hi Kurt,

I posted this on the Instrument Control Forum. 

 

As you stated your advice was more related to NI Labview. My return values are different then those described in the readings.

 

Thanks,

 

Chris

0 Kudos
Message 3 of 3
(6,403 Views)