Model 2110 5½ Digit Multimeter Reference Manual
Appendix C: Communication interface
2110-901-01 Rev. C/August 2013
C-21
VISA-COM sample code
This example gets the instrument identification string using VISA-COM in C#.
The first thing to do is add a reference to the VISA-COM interop DLL, which is usually located at
C:\Program Files\IVI Foundation\VISA\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll.
using Ivi.Visa.Interop;
namespace WindowsApplication1
{
public class IdnSample: System.Windows.Forms.Form
{
private Ivi.Visa.Interop.FormattedIO488 ioDmm;
//
}
}
private void IdnSample_Load(object sender, System.EventArgs e)
{
ioDmm = new FormattedIO488Class();
SetAccessForClosed();
}
private void btnInitIO_Click(object sender, System.EventArgs e)
{
try
{
ResourceManager grm = new ResourceManager();
ioDmm.IO = (IMessage)grm.Open("GPIB::16::INSTR",
AccessMode.NO_LOCK, 2000, "");
ioDmm.IO.TerminationCharacterEnabled = true;
}
catch (SystemException ex)
{
MessageBox.Show("Open failed on " + this.txtAddress.Text + " " +
ex. " " + ex.Message, "IdnSample", MessageBoxButtons.OK,
MessageBoxIcon.Error);
ioDmm.IO = null;
}
}