bicarlsen / easy-scpi

A library to control SCPI instruments
GNU General Public License v3.0
53 stars 20 forks source link

Add ability to explicitly query by passing '?' as first argument. #10

Open KLimit opened 1 year ago

KLimit commented 1 year ago

Tested with dummy instrument that simply prints the compiled SCPI string and whether it is querying or writing.

Some of the instruments that I am working with have the option to or require arguments after the question mark when querying a value. For example, modules used with a Keysight DAQ970 can have specific channels queried. For example, MEAS:VOLT:DC? 10,0.001,(@101, 102, 103) measure the DC voltage w/ 10V range, 1mV resolution, on channels 01, 02, and 03 of module 1.

As mentioned in the commit message, I've only tested this with a "fake" VISA instrument so far:

class FakeInst:
    def write(self, cmd):
        print(f"writing `{cmd}`")
    def query(self, msg):
        return input(f"asking `{msg}` > ")

If you'd prefer tests with an actual VISA instrument, let me know. Also, if you have particular formatting preferences let me know what they are.

bicarlsen commented 1 year ago

Thanks so much for this update. Can you also update the README documentation to include an explanation and example.

KLimit commented 1 year ago

Thanks so much for this update. Can you also update the README documentation to include an explanation and example.

Sure thing! I've been busy with some other projects, so I might not be able to add that documentation right away. Just wanted to give an update that I haven't abandoned this PR.