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.

6221 ethernet control with Pyvisa

6220, 6221 Current Sources
Post Reply
F_CHEM_
Posts: 7
Joined: March 31st, 2015, 6:26 am
Country: United Kingdom

6221 ethernet control with Pyvisa

Post by F_CHEM_ » March 31st, 2015, 6:37 am

Hello all,

I am looking to set up my 6221 current source to be controlled via ethernet. I can successfully ping the device and validate it's existence using NI-VISA configuration.

I am however unable to control the device using visa commands (via pyvisa wrapper). An example snippet of python code:

import visa

visa.get_instruments_list()
# Does not return keithly connected via ethernet

keithly = visa.instrument('keithly_6221') # currently using pyvisa pre-dating 1.5.. this is the alias I defined in MAX.

keithly.ask('*IDN?')

... And then get a timeout error.

I have read this maybe a problem with termination characters. I am not sure how to use these and could find very little information on them. I have tried sending various strings:

keithly.ask('*IDN?\n')
keithly.ask('*IDN?<CR>') and so on..


But to no avail.

If anyone has any experience with this your help would be much appreciated.

EDIT:

Using the VISA test panel I can successfully write '*IDN?\r' to the instrument and then read it. But the same command does not work using python.

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

Re: 6221 ethernet control with Pyvisa

Post by Andrea C » March 31st, 2015, 1:50 pm

Assuming IP address of instrument is 10.10.10.10, try this:

keithly = visa.instrument("TCPIP::10.10.10.10::1394::SOCKET")
keithley.term_chars = "\n"
keithley.ask("*IDN?")

Modify for your IP address.

F_CHEM_
Posts: 7
Joined: March 31st, 2015, 6:26 am
Country: United Kingdom

Re: 6221 ethernet control with Pyvisa

Post by F_CHEM_ » April 1st, 2015, 12:56 pm

Brilliant thanks - this worked!

Could of sworn I tried this but must of used a different termination character!

Post Reply

Return to “Current Sources”

Who is online

Users browsing this forum: No registered users and 2 guests