Posted Mon, 13 Nov 2023 00:25:03 GMT by SHIN, JIHAN

I'm using instrument 2612b and want to call the function of the .tsp file created by TestScript Builder from C#.

I installed the IVI-COM drive and checked the connection from C# to the instrument.

But I couldn't find a way to call the function yet.

There was an example of reading a .tsp file as text to communicate with the instrument, but is there a way to call a function stored in instrument nonvolatile memory?

The ideal result I want is to call function 2612B in C# and get measurement data in C#.

And is there a way to output data from smua.nvbuffer1 measured by .tsp script to C#?

Posted Tue, 14 Nov 2023 02:33:58 GMT by C, Andrea
If using the IVI driver, it has the driver.System.DirectIO.WriteString() for sending commands directly to the instrument.

Using the loadscript/endscript constructs, you can load your functions into runtime memory of instrument.
Of course you can read the tsp file line by line and write the line to the instrument to load functions defined in TSP file that you write/validate in Test Script Builder.
 
              // load a very simple script that defines a funtion that has two parameters
                myInstr.WriteString("loadscript mysciptname");
                myInstr.WriteString("function myfunction(freq, duration)");
                myInstr.WriteString("beeper.beep(duration, freq)");
                myInstr.WriteString("end");
                myInstr.WriteString("endscript");

                myInstr.WriteString("mysciptname.run()");   // run the script

                // now call the loaded function to cause 1 second 1200Hz tone from 26xx
                myInstr.WriteString("myfunction(1200, 1)");

                //myInstr.WriteString("myfunction(800, 5)");

You must be signed in to post in this forum.