AnsweredAssumed Answered

Microsoft Serial Class and Agilent Instrumentation

Question asked by Curt_C on Sep 13, 2012
Hi,
 
I need to write an application that controls an Agilent meter (34401a) and power supply (e3644a) over rs232.
 
The application (written in C#) needs to run on 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 or read commands.

[CODE]
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);

[CODE]


The same scpi commands work everytime with Visa
 
Am I missing a trigger command or something? Is there an issue with Microsofts Serial Class and using DTR/DSR handshaking?
 
 
Thanks
 
Curt  

Outcomes