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.

Convert Keithley's code into Python

Post Reply
Posts: 2
Joined: September 9th, 2018, 6:51 am
Country: Greece

Convert Keithley's code into Python

Post by thanos » September 16th, 2018, 3:58 am

I am new in IEEE-488 Bus programming (SCPI), so I have started with small and simple examples. I use a 7001 Switch with a Model 7065 Hall Effect Card in Slot 1.
I am try to convert an example program written in Hewlett-Packard BASIC. This is from Keithley's Model 7065 Hall Effect Card, Instruction Manual Addendum.

Code: Select all

10 REMOTE 7008		                                ! Put 7001 in remote.
20 OUTPUT 708;  ":CONF:SLOT1:CTYPE C7065"	! Slot 1 = 7065 card
30 OUTPUT 708;  ":CLOS  (@1!1!1, 1!2!3)"          ! Close 1,1 and 2,2
40 PRINT "PRESS 'CONT' TO OPEN" 		        
60 OUTPUT 708,  ":OPEN ALL"				! Open all channels
Python Code using pyVisa package.

Code: Select all

import visa
rm = visa.ResourceManager()
keithley = rm.open_resource("GPIB::7")
keithley.write("*rst; status:preset; *cls")
keihtley.write(":CONF:SLOT1:CTYPE C7065")
keithley.write(":CLOS (@1!1!1,1!2!3)")
cont = input("Press CONT to open all channels ")
while cont != 'CONT':
	cont = input("Press CONT to open all channels")
keithley.write(":OPEN ALL")
It is right or I has to modify this. In the same manner I convert program's written in Basic from Manual in Python. There something I should consider?

Posts: 1
Joined: June 11th, 2021, 3:34 am
Country: Canada

Re: Convert Keithley's code into Python

Post by Derrils54 » June 11th, 2021, 3:36 am

You need to use an interactive development environment (IDE), rather than the Python interpreter. Some people use IDLE, which comes with Python, I believe. I'm assuming you don’t have a code compare tool, There is a free application that you can download called File and Folder Merge Tool. You should download it ;)

Post Reply

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests