Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure serial port from MS Visual Studio?

Hello,

 

I am building a test setup which includes Agilent E3631A power supply connected via serial port.

We use MS Visual Studio C# for programming our test apps.

 

Some settings of E3631A serial port are fixed - number of stop bits (2), and hardware flow control(DTR/DSR).

Using correct serial port setting I can access the instrument from MAX and Hyperterminal,

but our C# app sometimes gets "Query interrupted" and "RS-232 framing error".

 

It seems that it has to do with how Agilent driver configures serial port -

this is what I see in AgilentE3xxxClass.IO.IO.OptionString (which is read only):

BaudRate=9600; .. FlowControl=ASRL_FLOW_NONE; .. StopBits=ASRL_STOP_ONE;

 

I expected the serial port would be the the same I set in MAX, but it's obviously not the case.

 

How do I configure serial port in Visual Studio apps? 

 

Best regards,

Yuriy Olkhovyy

 

 

 

 

 

0 Kudos
Message 1 of 2
(4,314 Views)

Ok, I've found this:

http://forums.ni.com/ni/board/message?board.id=140&message.id=15297&query.id=9245302

 

So I can set stop bits to ASRL_STOP_TWO and flow control to ASRL_FLOW_DTR_DSR -

tt works fine but at the end I need to call AgilentE36xxClass.Initialize(), and after this the

serial port stop bits and flow control are set back to ASRL_STOP_ONE adn ASRL_FLOW_NONE.

 

 

0 Kudos
Message 2 of 2
(4,311 Views)