Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

How to call TSP scripts in Python or upload onto Sourcemeter

Use this forum for questions about Keithley Test Script Builder software.
Post Reply
wilhelmet
Posts: 2
Joined: May 21st, 2015, 11:09 am
Country: Canada

How to call TSP scripts in Python or upload onto Sourcemeter

Post by wilhelmet » May 21st, 2015, 11:29 am

Hi Everyone,

I have python communicating to a Keithley 2602A perfectly fine, but I want to run some TSP script which I have developed in the TestScript Builder. I want to run these TSP scripts without having to call run on the console of the TSB. I have the following questions:

How would I run a TSP script in python? Is there an example?
How would I upload a TSP script into the 2602A?

I've read the manual for the 2602A and there are instructions on interacting with LabVIEW, MATLAB, and importing scripts into TSB from the sourcmeter and running scripts that are already uploaded from the front panel, but nothing that I understood about uploading scripts into the sourcemeter or running it from python. Anyone have any ideas? Thanks!

Andrea C
Keithley Applications
Keithley Applications
Posts: 1262
Joined: October 15th, 2010, 10:35 am
Country: United States
Contact:

Re: How to call TSP scripts in Python or upload onto Sourcem

Post by Andrea C » May 27th, 2015, 4:21 am

In general the approach is to encapsulate your script into one or more functions.
Use the loadandrunscript/endscript construct to load the function into the runtime memory of the Test Script Processor.
Then call your function.

The very simple code below illustrates the concept:

Code: Select all

    import visa

    mysmu=visa.instrument('gpib0::26::instr')

    mysmu.write('reset()')
    mysmu.write('errorqueue.clear()')

    mysmu.write('loadandrunscript')
    mysmu.write('function DoMyThing(duration, frequency)')
    mysmu.write('beeper.beep(duration, frequency)')
    mysmu.write('end')
    mysmu.write('endscript')

    # call custom function
    mysmu.write('DoMyThing(1, 800)')

    mysmu.close()

Post Reply

Return to “Test Script Builder”

Who is online

Users browsing this forum: No registered users and 1 guest