SCPI on Mac

This post is part of USB Programming on Mac series. More posts in this series can be found here.

Some more days passed and some more finishing touches added to my MacSCPI app. It is entirely dependent on hooking the device via the USBTMC driver, but it works fine and is stable:

Some SCPI commands sent from an OS X terminal to my Agilent DSOX 2002A scope (see the *IDN? query result — serial wiped for security reasons); all values are returned in NR3 format, but seem to be reliable (crossed-checked with reading from the display).

Some SCPI commands sent from an OS X terminal to my KeysightAgilent DSOX 2002A scope (see the *IDN? query result — serial wiped for security reasons); all values are returned in NR3 format, but seem to be reliable (crossed-checked with reading from the display).

I had some problems with buffer padding and the output it is still not 100% gibberish–free , but I assume I have to play with buffer size and with zero–filled calloc routines. We’ll see. I implemented a fgets–based terminal character read. So far so good, the apps sends proper DEV_DEP_MSG_OUT and reads DEV_DEP_MSG_IN usbtmc messages. Some more screens with control reference waveforms and marker tests:

Some tests with markers and control reference waveforms, performed on my Agilent DSOX 2002A oscilloscope. Note the result of :MARKer:XDELta? SCPI query (last line) and compare with ΔX value (44.200 ns) displayed on the scope screen (next image).

Some tests with markers and control reference waveforms, performed on my KeysightAgilent DSOX 2002A oscilloscope. Note the result of :MARKer:XDELta? SCPI query (last line) and compare with ΔX value (44.200 ns) displayed on the scope screen (next image).

Some tests with markers and control reference waveforms, performed on my Agilent DSOX 2002A oscilloscope. Note the ΔX value (44.200 ns) and compare with the result of :MARKer:XDELta? SCPI query in the previous image (last line).

Some tests with markers and control reference waveforms, performed on my KeysightAgilent DSOX 2002A oscilloscope. Note the ΔX value (44.200 ns) and compare with the result of :MARKer:XDELta? SCPI query in the previous image (last line).

There are many ways to continue. For now, I will go with limited objectives: developing just the console app and adding support for parameters and inline help. Then some code refinements will follow: the next big move is to start creating the actual SCPI libraries — probably a stdandalone framework for Mac — thus increasing the level of abstraction to a stage that will be much programming–friendly and allow reusability and more flexibility in bigger, more complex applications. More to come.

2 Comments to SCPI on Mac

  1. Britt says:

    I would REALLY like to play with this… even if it’s in incomplete pre-alpha causes-a-kernel-panic-every-10-minuites-and-might-eat-all-your-data condition. Is there a github repository or something somewhere yet? Or if not, could you just email me the code? Heck; I’ll even send you back any/all changes/bugfixes/additions I make! 🙂

    I’ve got a Rigol DS1052e that I’m pretty sure that can be made to talk to my Mac with this driver – or at least the driver can be modified to talk to it.

    • AP says:

      Hi, Britt,
      Thank you for your comments. This is experimental work in progress and no, I do not have github-like repo. Will probably share something when the project will be finalized. Meanwhile, I am keeping it as it is. Sorry, no code by email. 🙂 My intention is to share some knowledge and not a long-hanging fruit. Keep close, will post my progress in this and some more code snippets.
      Regards,
      AP

Leave a Reply

Your email address will not be published. Required fields are marked *