05-13-2025 04:33 AM
Hi,
I am trying to build an application with C# .NET to control a few instruments (Scope, DC Supply and Spectrum Analyzer). In the example programs you can use the "FindResources" for doing so. Now I want to use LAN to acces the instruments.
In the examples you can basically only find the standard ASRL sources. I can connect to the instruments by manually entering the string with the IP address. Now if I first make a sort of alias for these devices in NI MAX, the example will find the VXI/LXI devices. (not the one SOCKET device sadly)
What code does NI MAX use to achieve this? Is that functionality of the "VxiSession" class? And why are there not more examples for more advanced things in VISA?
05-15-2025 04:56 AM
Hello,
NI MAX uses the VISA Resource Manager underneath, which implements discovery mechanisms for all VISA-compatible resources. For LAN instruments, it typically uses:
LXI Discovery Protocol: Instruments broadcast their presence using mDNS/Bonjour or other discovery protocols.
VXI-11 Protocol: Most LXI instruments implement VXI-11 over TCP/IP.
Best Regards
05-15-2025 05:36 AM - edited 05-15-2025 06:17 AM
Isn't that what this does?
private void OnLoad(object sender, System.EventArgs e)
{
// This example uses an instance of the NationalInstruments.Visa.ResourceManager class to find resources on the system.
// Alternatively, static methods provided by the Ivi.Visa.ResourceManager class may be used when an application
// requires additional VISA .NET implementations.
using (var rmSession = new ResourceManager())
{
foreach (string s in rmSession.Find("(ASRL|GPIB|TCPIP|USB)?*INSTR"))
{
availableResourcesListBox.Items.Add(s);
}
}
}
This is straight out the example. But it can not find my instruments on its own. But if I add them in NI MAX and let the wizard search for devices it can see them.
I only turned on the one device in the last picture. And after adding the devices to this list the code in the example can find the device strings. So what does it do different?