0

Is there C# example code to communicate with a device through an RS-232 serial port using VISA?

I just want to issue some simple commands and queries to the device as well as open and close it, of course.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
George
  • 347
  • 2
  • 9
  • 21
  • Thank you all for the info supplied. Just after midnight I was send a solution from a support engineer at Agilent who solved my problem, which as I guessed was very simple. Thanks again, George. – George Aug 28 '09 at 13:50

2 Answers2

0

There is sample code here:

C# and Visual Basic .NET Instrument Control Tutorial

It uses National Instrument software:

"The VISA .NET API is an object-oriented interface made up of a set of .NET classes to communicate with instruments with VISA. You can use .NET compliant languages such as C# and Visual Basic .NET."

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • Sorry, I should have mentioned that its an Agilent scope I am using and this seems to be a bit different to the NI one. I have asked Agilent several times for help with this and as you can see I am still looking. I find it hard to believe nobody has already tried to do this relatively simple thing with their scopes alrewady, after all, what are the RS-232 communication modules for anyway ? Mumble mutter. – George Aug 27 '09 at 11:15
  • Perhaps you should update your question with this information. – Peter Mortensen Aug 27 '09 at 11:21
  • What country are you in ? We use HPLC systems from Agilent and I am under the impression that their service is OK. – Peter Mortensen Aug 27 '09 at 11:23
0

I finally got the answer I was looking for.

It appears all you need to do to access an RS-232 serial port instead of a USB port in VISA is change the USB id string to the RS-232 string (ASRL1::INSTR).

I knew it was going to be simple, just not that simple.

Thanks for all the other ideas.

George
  • 347
  • 2
  • 9
  • 21