EasyManua.ls Logo

UNI-T UTG900E Series

UNI-T UTG900E Series
41 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Programming Manual UTG900E Series
Instruments.uni-trend.com
29 / 41
}
C# Example
Condition: Windows System & Visual Studio.
Description: Access the device through the USBTMC and TCP/IP, and send "*IDN?" command in NI-VISA
to check the device information.
Steps
1. Open the Visual Studio software, and newly create a C# console project.
2. Add the C# reference of VISA, Ivi.Visa.dll and NationalInstruments.Visa.dll.
3. Source Code
a) USBTMC Example
class Program
{
void usbtmc_test()
{
using (var rmSession = new ResourceManager())
{
var resources = rmSession.Find("USB?*INSTR");
foreach (string s in resources)
{
try
{
var mbSession = (MessageBasedSession)rmSession.Open(s);
mbSession.RawIO.Write("*IDN?\n");
System.Console.WriteLine(mbSession.RawIO.ReadString());
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message);
}
}
}
}
void Main(string[] args)
{
usbtmc_test();
}
}
b) TCP/IP Example
class Program
{
void tcp_ip_test(string ip)
{
using (var rmSession = new ResourceManager())
{

Table of Contents

Other manuals for UNI-T UTG900E Series

Related product manuals