11-21-2013 07:24 AM
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)
11-21-2013 09:09 AM
I'm not sure why you are asking this question here. The bit values of the status byte should be explained in the instrument's manual. You haven't even provided the make and model of the instrument.
11-21-2013 09:26 AM
The piece of equipment I am asking for readstatus byte from is the Keithley 2612A Dual SMU.
11-21-2013 09:40 AM
11-21-2013 09:47 AM
The below sub was creasted by NI in 1997 and is within the VBIB32 module and references the Gpib-32.dll. Can you expand on the command set within the sub? The command set should be within the Gpib-32.dll which NI created. The Keithley 2612A has many status bits and I'm trying to find which bit the call is querying.
Declare Sub ReadStatusByte32 Lib "Gpib-32.dll" Alias "ReadStatusByte" (ByVal ud As Long, ByVal addr As Long, result As Long)
Thanks,
Chris
11-21-2013 11:04 AM
The query is reading the status byte register and there are standard and non-standard bits contained. GPIB tutorial.