I am currently looking for different possibilities to communicate with SCPI-compatible devices via C#. I've written my first code in LabWindows/CVI (language: C) via a COM interface and did it quite "manually" as I would say:
ComOpen(ComId, "Com1",....);
ComWrite("SYST:...\r");
ComRead(&value)`
Something like this. The problem was for me that I don't like pure C and the lack of OOP was just stupid since I have real objects that want to communicate. Dear National Instruments, why not use OOP to control objects?
Now somebody gave me the hint, that I should look into the global SCPI-documentation since there is more information than in the manual of the device. And I've found a .NET-compatible set of commands. For example,
IIviDCPwr Ivi.DCPwr.Create(String resourceName,
Boolean idQuery,
Boolean reset,
LockType lockType,
String accessKey,
String options);
to build up an object-oriented communication with SCPI-devices. Since I really like C# I want to try this in the next weeks.
But I really can not see the connection settings since resourceName only seems to be a name to free the regarded device afterwards and the other settings were used when the connection is already set. How can an instance of IIviDCPwr know which connection (TCP/IP, COM or GPIB) should be used?
I've only seen solutions for TCP/IP by using sockets. But I think this is not applicable to COM and GPIB?
Another solution would be to use the National Instruments VISA-package. But I don't like the idea of using a proprietary package provided by NI (I think after using CVI I feel a newly developed repulsion towards NI).
Can you provide code snippets or documentations to handle this problem? Have you made any experiences by using VISA? Can I use sockets for COM/GPIB-communication?
BTW: How to create new lines in code snippets? Neither enter nor Shift + Enter, \r, \n, \ works for me...