Author Topic: python-based instrument control  (Read 1927 times)

0 Members and 1 Guest are viewing this topic.

Offline troubleshooterTopic starter

  • Newbie
  • Posts: 2
python-based instrument control
« on: March 17, 2015, 05:16:28 pm »
Hi,

If I'm not asking at the right place, please transfert my post.

I have a Stanford Research System SIM900 Mainframe and I can communicate with it using Pyvisa. Now, I would like to communicate with the PID module SIM960 connnected to it.

I can send commands such as : mainframe.ask("*IDN?"), etc...

My problem is that I cannot send command to the module.

For example to assign the module to the 4th mainframe port outside of python I would have to type : CONN 4,"PID"

and I could then type: PID*IDN?

to get the model of the module with the variable name PID.

In python I can only give one argument to mainframe and I cannot write something like : mainframe.write("CONN 4, "PID"") or mainframe.write("PID*IDN?")

To summarize, I want to send command from python to the PID module through the mainframe (COM5 for example)  but I don't know what's the syntax for it. (or if it is possible)

Does anyone ever experienced this situation?

Thanks
 

Offline Lukas

  • Frequent Contributor
  • **
  • Posts: 412
  • Country: de
    • carrotIndustries.net
Re: python-based instrument control
« Reply #1 on: March 17, 2015, 05:45:29 pm »
In python I can only give one argument to mainframe and I cannot write something like : mainframe.write("CONN 4, "PID"") or mainframe.write("PID*IDN?")
There are no such things like arguments. VISA isn't much more than string in-string out. Your example should have raised a Syntax error because of incorrect escaping. either use .write('CONN 4, "PID"') or .write("CONN 4, \"PID\""). You didn't say which VISA implementation you're using. Agi^H^H^HKeysight VISA has got a VISA monitor that allows you to examine the VISA commands that you send to the instrument. NI VISA should provide something similar. Have you tried sending the commands using the interactive shell provided by your VISA vendor?
 

Offline troubleshooterTopic starter

  • Newbie
  • Posts: 2
Re: python-based instrument control
« Reply #2 on: March 17, 2015, 07:22:15 pm »
Hi Lukas,

Thanks a lot for the reply. Indeed, my problem was only about the syntax. Using write.('CONN 4, "PID"') worked as it is considered as one string.
I'm using NI-VISA. I didn't know about this VISA monitor but I just tested the interactive shell they provide and it's great.

Cheers
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf