Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

SerialClass and Agilent Instrumentation

Hi,

 

I need to write an application that controls an Agilent meter (34401a) and power supply (e3644a) over rs232.

The application needs to run machines without admin rights, so I can't install or use ni-gpib or visa and I'm stuck using Microsoft's serial class. I checked out my cable connection using NI-Max on my machine using a Visa test panel and everything works ok. I can send commands and read data.

 

When I use the Serial Class object, I can send commands that the instruments repsond to ("volt 1.0;  for example), but the meter and power supply don't respond to the measure commands.

 

private SerialPort comport = new SerialPort();
//......
comport.BaudRate = 9600; 
comport.DataBits = 8;
comport.StopBits = 2;
comport.Parity = Parity.None;
comport.PortName = "Com1";
comport.ReadTimeout = 5000;

comport.Open();
comport.DtrEnable;

//All these write commands work ok
comport.Write("output on;");
comport.Write("volt 1.0;");
comport.Write("meas:volt?;");

//tried several read methods and nothing works
int bytes = comport.BytesToRead; always returns zero
byte[] buffer = new byte[bytes]; 
comport.Read(buffer, 0, bytes);

//and this
string data = comport.ReadExisting();

//and this
string data = comport.ReadTo(m_readToString);

 

I've gotten lazy using Visa, it's too easy. The same scpi commands work everytime with Visa

 

Am I missing a trigger command or something?

 

Thanks

 

Curt

0 Kudos
Message 1 of 5
(6,461 Views)

Hi Curt,

 

Can I ask how you are using National Instruments products in your setup?  Once you gather the data via Microsoft's serial class, where are you trying to send the data?

 

Thanks,

 

David B

0 Kudos
Message 2 of 5
(6,444 Views)

Hi David,

 

I use Visual Studio 2008 and Measurement Studio 8.5, NI-Visa, NI-488.2 and DAQmx. On most of the test and automated systems I use, the IT group will give me temporary admin rights to install any hardware and software I need to run application on a machine.

In this case I need the application to run on any machine without having to get admin rights. It's just a simple inprocess test to set current levels and measure output and generate a data file.

 

After playing around with Microsoft's Serial Class I think there might be a issue DTR/DSR handshaking and Agilent instrumentation. The Serial Class worked ok with a Fluke meter I found. That meter didn't use any handshaking.

 

Thanks

 

Curt

0 Kudos
Message 3 of 5
(6,439 Views)

Hi Curt,

 

It sounds like the problems you are running into deal with Microsoft and Agilent products.  Have you considered posting on one of those forums?  Are any of NI's functions causing the issue, or is it more the Microsoft Serial Class?

 

Thanks,

 

David B

0 Kudos
Message 4 of 5
(6,382 Views)

Hi David,

 

I've come to the conclusion that the Serial Class is incompatable with any device using DTR/DSR handshaking.

I haven't had any issues when using NI-Visa with rs232 and Agilent hardware.

 

Thanks

 

Curt

0 Kudos
Message 5 of 5
(6,379 Views)