Friday, January 30, 2015

Using the Passthrough Command in IVI drivers

Hi everybody!

I was working on a customer question yesterday and I thought that it would make an enlightening blog post.  We have a feature for our IVI-COM and IVI-C drivers that allows you to directly send SCPI commands to your instrument.  This is really useful if you run into a situation where you think there is a function is missing from our driver or you run into something unexpected.  Overall, it is pretty easy to use once you know where to find it.

Let's look at the IVI-COM driver first.  You can find the passthrough in the Systems Interface under the IO property.  One you get to the IO level, you can just use the standard VISA-COM commands to send commands to the instrument and read responses back.  For my little example here I am just going to send a voltage measurement and read back the response:

In the code above, agDrvr is the name I gave to the instrument when I initialized it.

We also provide an IVI-C driver.  The IVI-C driver also has a passthrough command that is just a little more complicated than the IVI-COM version.. To send SCPI commands, you use the AgN67xx_SystemWrite function and to read data back you would use the AgN67xx_SystemRead function.  The same example as above would look like this:

In this IVI-C code:
status is where the IVI-C driver will report an error if there is an unsuccessful call 
session is the handle that I gave to this instrument when I initialized
32 was my best guess at the size of the response string.  I like to overestimate.
strResp is where I want the response to be stored
respSize is the actual size of the response and is returned by the program

All in all it's not too difficult and will definitely come in handy.  

That all I have for you this month.  As always, let us know if you have any questions.

Matt







No comments:

Post a Comment

Note: Only a member of this blog may post a comment.