problem with module PyVisa

Jean Dubois jeandubois314 at gmail.com
Tue Nov 20 08:28:57 EST 2012


On 11 nov, 20:30, Jean Dubois <jeandubois... at gmail.com> wrote:
> On 9 nov, 22:14, w... at mac.com wrote:
>
>
>
> > On Nov 9, 2012, at 3:43 PM, Jean Dubois <jeandubois... at gmail.com> wrote:
>
> > > The error may be obvious but finding this file and how to install it
> > > is not unfortunately.
> > > It seems I have to install it from the National Instruments site but
> > > Debian Linux doesn't seem to be supported...
> > > and I doubt whether just copying this file will be sufficient to make
> > > PyVisa work.
> > > I wonder whether there might be another way to communicate via USB
> > > with a Keithley programmable power supply using Python.
>
> > > best regards,
> > > Jean
>
> > > --
> > >http://mail.python.org/mailman/listinfo/python-list
>
> > I've been using pyserial quite successfully to control a USB-to-serial converter.
>
> > That is, controlling a couple of RS232 serial devices via the USB port through a KeySpan USB-to-Serial converter.
>
> > Pyserial seems to make communication through the USB port quite transparent, at least on my OS-X system.
>
> > -Bill
>
> Well, in fact I do have some working scripts using pyserial to control
> an older (and more expensive) Keithley sourcemeter in combination with
> a USB-to-serial converter.
> But the trouble started when buying a cheaper and newer Keithley model
> which does not have rs232 but only USB. I noticed they have put an
> extra layer above USB called USBTMC
> which complicates things further. I followed the instructions athttp://www.home.agilent.com/upload/cmc_upload/All/usbtmc.htm?&cc=BE&l...outline
> and compiled and loaded the usbtmc-driver but I still can't
> communicate with the Keithley, hence I started looking for an
> alternative using PyVisa...and now I'm stuck
>
> jean

I finally got it working without PyVisa as follows:
#!/usr/bin/python
#sample program for Keithley 2200 USB
#first compile and load module usbtmc
import os
usbkeith = open('/dev/usbtmc1','r+')
#next commando is very important
#without it you can fetch data but not SET data
usbkeith.write("SYST:REM" + "\n")
usbkeith.write("*IDN?\n")
identification=usbkeith.readline()
print 'Found: ',identification
usbkeith.write("SOUR:CURR 0.2A\n")
usbkeith.write("SOUR:OUTP:STAT ON\n")
usbkeith.write("MEAS:VOLT?\n")
measurement=usbkeith.readline()
print 'Measured voltage: ',measurement

regards,
jean



More information about the Python-list mailing list