Chad Simpson wrote:

I'm looking for something that I can write python or tcl or shell scripts
for and send strings to a GPIB device, and get strings back.  I'm trying to
get away from the LabView .vi model.  So, this looks fairly good, that way.

Jim



Yes, me too - shell or python would be great, I'm presently learning the
latter.  I just found PyVISA, which looks like it might be useful, possibly
pythonlabtools as well.

Then you should like the prologix usb adapter.  It took me maybe a half hour
to write an interface to it in python, and then I was up and running.

A simple example:
-------------------------

#! /usr/bin/env python

# 7854.py - try out some gpib data collection using the Prologix
gpib-usb controller
#

import os
import termios
import serial
import time

def gpib_init() :
        ser.write("++mode 1\r")
        time.sleep(0.1)
        ser.write("++ifc\r")
        time.sleep(0.1)
        ser.write("++auto 0\r")
        time.sleep(0.1)
        ser.write("++eoi 0\r")
        time.sleep(0.1)


def gpib_read(addr):
        ser.write("++addr " + str(addr) + "\r")
        time.sleep(0.1)
        ser.write("++read eoi\r")
        return ser.readline()

def gpib_write(addr,gpibstr):
        ser.write("++addr " + str(addr) + "\r")
        time.sleep(0.1)
        ser.write(gpibstr + "\r")


ser = serial.Serial('/dev/ttyUSB0',rtscts=0,timeout=1)

ser.write("++ver\r")
print ser.readline()

gpib_init()

gpib_write(10,"ID?\r")
print "ID= " + gpib_read(10) + "\r"

gpib_write(10,"VMDR\r")
gpib_write(10,"HMDB\r")

gpib_write(10,"1 0 2 4 >P/W AVG10\r")
gpib_read(10)

gpib_write(10,"SENDX\r")
time.sleep(4)

print "X=" + gpib_read(10) + "\r"
print "X=" + gpib_read(10) + "\r"

-------------------------

-Chuck Harris

_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to