¿ªÔÆÌåÓý

Re: GPIB scripting software?


 

# 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")

#
# test program...
#

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,"STORED\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

On Tue, 17 Sep 2024 12:20:03 +0200 "Harke Smits via groups.io"
<yrrah@...> wrote:
Do you have a simple example at hand? I used the Prologix adapter in
the past with KE5FX toolbox but never with pyvisa. I prefer to use
Python as I want more data processing options than available with the
kit.

H

On 17/09/2024 04:27, Andrew Hakman wrote:
Python + prologix adapter is about as simple, portable, and
dependency free as it gets.

Open the port with the python "serial" library, and send direct
GPIB commands to it.

No need to install any drivers or i/o libraries, basically just
plug and play!

On Mon, Sep 16, 2024 at 12:25?AM Anders via groups.io
<> <anders.gustafsson@...> wrote:

I do the same with my own Prologix-clone




Join [email protected] to automatically receive all group messages.