From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to to GPIB address

Hello guys! I am trying to write a C# program to communicate with my Yokogawa multimeter,

I have NI Visa (version 2022 Q3) and Ni488.2 (version 21.5.0)  installed

My Visa resource name for this device is : GPIB0::1::INSTR

 

here is my C# code,

 

using System;
using System.Threading;
using System.Windows;
using NationalInstruments.Visa;

namespace GPIB_DMM_voltage
{
class program {


static void Main(string[] args)
{

try
{

var session = (Ivi.Visa.IMessageBasedSession)Ivi.Visa.GlobalResourceManager.Open("GPIB0::01::INSTR");
session.FormattedIO.WriteLine("*IDN?");
string idName = session.FormattedIO.ReadLine();

Console.WriteLine($"*IDN?) = {idName}");
session.Dispose();
session = null;

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

Console.WriteLine("press entrer key to end");
Console.ReadLine();

 

}
}
}

 

But when I ran it, it is giving me this error.

KevinSu66_0-1659385956531.png

 

 

Anyone know why? please help! and thank you guys!!

 

0 Kudos
Message 1 of 3
(703 Views)

Maybe the address is wrong.

 

Wrong : GPIB0::01::INSTR

Correct : GPIB0::1::INSTR

0 Kudos
Message 2 of 3
(684 Views)

Sorry about that! it was suppose to be 1, I changed it to 01 just to test, but it still didn't work 😞

0 Kudos
Message 3 of 3
(670 Views)