Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

FindLstn

My problem with FindLstn appears to be addressed on this
URL: http://www.ni.com/support/gpib/langint/findlstnerr.htm except I am
using Visual Basic and unable to successfully send a Padlist that results
in a correct Result list. A few lines of code to correctly return the addresses
of all devices would be appreciated.
0 Kudos
Message 1 of 2
(5,286 Views)
Steven,

Here is a code snippet written in Visual Basic with all the calls necessary
for calling FindLstn (please note, the function call GpibErr() is a routine
that you would write to properly display the error message):

Hope this is helpful.

-------------- FindListn Code ---------------
' Your board needs to be the Controller-In-Charge in order to find all
' listeners on the GPIB. To accomplish this, the subroutine SendIFC
' is called. If the error bit EERR is set in ibsta, call GpibErr with
' an error message.

Call SendIFC(GPIB0)
If (ibsta And EERR) Then
GpibErr ("Error sending IFC.")
End If

' Create an array containing all valid GPIB primary addresses, except
' for the primary address 0. Your GPIB interface board is at address 0
' by default. This array (instruments%) will be given to the subroutine
' FindLstn to find all listeners. The constant NOADDR, defined in
' NIGLOBAL.BAS, signifies the end of the array.

For k% = 0 To 29
instruments%(k%) = k% + 1
Next k%
instruments%(30) = NOADDR

' Find all of the listeners on the bus. Store the listen addresses in
' the array result%. If the error bit ERR is set in ibsta, call
' GpibErr with an error message.

Call FindLstn(GPIB0, instruments%(), result%(), 31)
If (ibsta And EERR) Then
GpibErr ("Error finding all listeners.")
End If

' ibcnt contains the actual number of addresses stored in the result%
' array. Assign the value of ibcnt to the variable num_listeners.
' Print the number of listeners found.

num_listeners% = ibcnt

' The result% array contains the addresses of all listening devices
' found by FindLstn. Use the constant NOADDR, as defined in NIGLOBAL.BAS,
' to signify the end of the array.

result%(ibcnt) = NOADDR

----------- End of FindLstn code ------------

"Steven Hedgepeth" wrote:
>>My problem with FindLstn appears to be addressed on this> URL: http://www.ni.com/support/gpib/langint/findlstnerr.htm
except I am>using Visual Basic and unable to successfully send a Padlist
that results>in a correct Result list. A few lines of code to correctly
return the addresses>of all devices would be appreciated.
0 Kudos
Message 2 of 2
(5,286 Views)