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.

PA1000 USB control using Python

Post Reply
AshwinD
Posts: 1
Joined: January 16th, 2020, 10:32 pm
Country: India

PA1000 USB control using Python

Post by AshwinD » January 16th, 2020, 11:10 pm

Hello,
I am trying to remotely control a PA1000 via USB. I wrote the following code to get the serial number and firmware version from the device.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import pyvisa as visa

PA_1000_res = ""
PA_1000_ADDR = "USB0::0x0699::0x4002::C020460::INSTR"

def PA_1000_open(res_man, dev_addr):
global PA_1000_res
try:
PA_1000_res = res_man.open_resource(dev_addr)
print "Connected to device"
return True
except visa.Error as ex:
print('Couldn\'t connect to \'%s\', exiting now...' % dev_addr)
return False

def PA_1000_unit_identity():
global PA_1000_res
try:
print PA_1000_res.write("*IDN?")
except visa.VisaIOError as ex1:
print "Communication error"

rM = visa.ResourceManager()
PA_1000_open(rM,PA_1000_ADDR)
PA_1000_unit_identity()

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Command Prompt Output:
Connected to device
(7L, <StatusCode.success: 0>)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Initially, I tried using query instead of write, and it showed communication error.
When I tried all possible combinations like ":*IDN?", ":*IDN?\n" the output is as the one shown above.
I couldn't understand exactly where I'm committing a mistake. Can any help?

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

Re: PA1000 USB control using Python

Post by Andrea C » January 17th, 2020, 8:06 am

Seems you are successful to write the *idn? command. (Note: no leading : in the *idn? command).
When you attempt to read the response, what error in particular are you getting?
Do you have NI MAX and can use a VISA test panel?

Post Reply

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest