I am programming an E8257D Signal Generator in Visual Studio 2015 via LAN. My C# code is the following:
class Program
{
private MessageBasedSession mbSession;
static void Main(string[] args)
{
MessageBasedSession mbSession = (MessageBasedSession)ResourceManager.GetLocalManager().Open("TCPIP::192.168.100.20::inst0::INSTR");
mbSession.Write("*IDN?");
string temp = mbSession.ReadString();
Console.WriteLine(temp);
Console.WriteLine("Done1");
mbSession.Write("SYST:COMM:GTL\n");
Console.WriteLine("Done2");
try
{
mbSession.Dispose();
mbSession = null;
}
catch (Exception exp)
{
Console.WriteLine(exp.Message);
}
}
}
After "mbSession.Write("SYST:COMM:GTL\n") instruction; the E8257D goes to LOCAL mode but with the next instruction ”Dispose()”, it comes back again to REMOTE mode. I want the instrument in LOCAL mode when I close the session and it keeps this LOCAL mode after that. Any suggestion. Thanks.