Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:python-usbtmc:readme [2013/08/08 07:05]
alex [Installation]
en:python-usbtmc:readme [2013/12/17 08:22] (current)
alex
Line 38: Line 38:
 KERNEL=="​usbtmc[0-9]*", ​  ​MODE="​0660",​ GROUP="​usbtmc"​ KERNEL=="​usbtmc[0-9]*", ​  ​MODE="​0660",​ GROUP="​usbtmc"​
 </​code>​ </​code>​
 +
 +===== Windows setup =====
 +
 +To use Python USBTMC in Windows, PyUSB and libusb are required. ​ They can be downloaded from:
 +
 +  * http://​sourceforge.net/​projects/​pyusb/​
 +  * http://​www.libusb.org/​wiki/​libusb-win32
 +
 +An INF file will also need to be created in order to use devices with libusb. Without a properly set up INF file, Python USBTMC will not be able to locate the device. ​ There are instructions on the libusb page for how to generate the INF file.  ​
  
 ===== Usage examples ===== ===== Usage examples =====
Line 46: Line 55:
 import usbtmc import usbtmc
 instr =  usbtmc.Instrument(2391,​ 5973) instr =  usbtmc.Instrument(2391,​ 5973)
 +print(instr.ask("​*IDN?"​))
 +# returns '​AGILENT TECHNOLOGIES,​MSO7104A,​MY********,​06.16.0001'​
 +</​code>​
 +
 +When multiple instruments are connected they can be identified by serial number:
 +
 +<code python>
 +import usbtmc
 +instr =  usbtmc.Instrument(2391,​ 5973, '​MY********'​)
 +print(instr.ask("​*IDN?"​))
 +# returns '​AGILENT TECHNOLOGIES,​MSO7104A,​MY********,​06.16.0001'​
 +</​code>​
 +
 +It is also possible to connect with VISA resource strings like so:
 +
 +<code python>
 +import usbtmc
 +instr =  usbtmc.Instrument("​USB::​0x0957::​0x1755::​INSTR"​)
 +print(instr.ask("​*IDN?"​))
 +# returns '​AGILENT TECHNOLOGIES,​MSO7104A,​MY********,​06.16.0001'​
 +</​code>​
 +
 +and:
 +
 +<code python>
 +import usbtmc
 +instr =  usbtmc.Instrument("​USB::​0x0957::​0x1755::​MY********::​INSTR"​)
 print(instr.ask("​*IDN?"​)) print(instr.ask("​*IDN?"​))
 # returns '​AGILENT TECHNOLOGIES,​MSO7104A,​MY********,​06.16.0001'​ # returns '​AGILENT TECHNOLOGIES,​MSO7104A,​MY********,​06.16.0001'​