Is there a command to take the meter out of remote mode after taking a measurement. I am using VISA COM 3.0 with both c# and VBA. My users are complaining about having to push the Local button.
Yes, but you can't do it with VISA COM; you will have to use VISA for this functionality (you can keep using VISA COM for everything else):
*_C#_*
Include the file visa32.cs. It can usually be found at: 64-bit Windows - C:\Program Files\IVI Foundation\VISA\Win64\agvisa\include 32-bit Windows - C:\Program Files\IVI Foundation\VISA\WinNT\agvisa\include
Code:
static void GoToLocal(string address) {
int rm = 0; int vi = 0;
StringBuilder buf = new StringBuilder(100);
visa32.viOpenDefaultRM(out rm); visa32.viOpen(rm, address, 0, 0, out vi);
//put instrument in local mode visa32.viGpibControlREN(vi, visa32.VI_GPIB_REN_ADDRESS_GTL);
visa32.viClose(vi); visa32.viClose(rm);
}
*_Excel VBA (or VB6)_*
Import the file visa32.bas. It can usually be found at: 64-bit Windows - C:\Program Files\IVI Foundation\VISA\Win64\agvisa\include 32-bit Windows - C:\Program Files\IVI Foundation\VISA\WinNT\agvisa\include
Thanks for the reply. I haven't tried to do it in C# yet. But I got it working with VBA by doing this: (The bold is code I added to existing code written by another person many moons ago.)
Private m_usbHPMeter As VisaComLib.FormattedIO488 Private m_usbRM As VisaComLib.ResourceManager *Private m_Usb As VisaComLib.IUsb*
Set m_usbRM = New VisaComLib.ResourceManager Set m_usbHPMeter = New VisaComLib.FormattedIO488 Set m_usbHPMeter.IO = m_usbRM.Open(DeviceName) *Set m_Usb = m_usbRM.Open(m_usbHPMeter.IO.ResourceName)*
*m_Usb.ControlREN GPIB_REN_GTL*
Not fully tested yet but seems to be doing the job
*_C#_*
Include the file visa32.cs. It can usually be found at:
64-bit Windows - C:\Program Files\IVI Foundation\VISA\Win64\agvisa\include
32-bit Windows - C:\Program Files\IVI Foundation\VISA\WinNT\agvisa\include
Code:
static void GoToLocal(string address)
{
int rm = 0;
int vi = 0;
StringBuilder buf = new StringBuilder(100);
visa32.viOpenDefaultRM(out rm);
visa32.viOpen(rm, address, 0, 0, out vi);
//put instrument in local mode
visa32.viGpibControlREN(vi, visa32.VI_GPIB_REN_ADDRESS_GTL);
visa32.viClose(vi);
visa32.viClose(rm);
}
*_Excel VBA (or VB6)_*
Import the file visa32.bas. It can usually be found at:
64-bit Windows - C:\Program Files\IVI Foundation\VISA\Win64\agvisa\include
32-bit Windows - C:\Program Files\IVI Foundation\VISA\WinNT\agvisa\include
Code:
Public Function GoToLocal(address)
Dim rm As Long
Dim vi As Long
Dim err As Integer
err = viOpenDefaultRM(rm)
err = viOpen(rm, address, 0, 0, vi)
err = viGpibControlREN(vi, VI_GPIB_REN_ADDRESS_GTL)
err = viClose(vi)
err = viClose(rm)
End Function