time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

EFRATOM TS-105A TEST SET

CH
Chuck Harris
Thu, Jan 17, 2008 11:49 AM

Here is a snippet of code that is a work in progress, but should help
you get your prologix working:

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

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

Patrick wrote:

So sorry guys. I have been pulling my hair out for the last hour. One
more question please.

Abdul sent me over a PySerial script just before I bought this item.

In the script there was line line like this:
ser.write("plot;\r\n")

I have tried ser.write("++ver;\r\n') and many other commands and
carriage returns.

With ser.read(100) I get
'Unrecognized command\r\n'

So at least I have some communication. Could someone help me with the
syntax?

Thanks in advance-Patrick

Patrick wrote:

Thanks to Chuck, Jeff, Christian and John!

I was trying to do a quick test with a live CD in bash but the general
message I have gotten is to fix the Ubuntu install. Indeed you were
right and I was wrong.

I tried this command (thanks Jeff)

sudo tail -f /var/log/messages

I found out that I had a conflict with brltty. I don't remember
installing a brail terminal!

It's funny it only had a conflict with the prologix device and not a
usb-serial adapter.

Anyhow I am trying to communicate with the device with PySerial now. I
am getting error messages back when I read but at least that's something.

Thanks again to all.

-Patrick

Here is a snippet of code that is a work in progress, but should help you get your prologix working: --------------------------------- #! /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") # # 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 Patrick wrote: > So sorry guys. I have been pulling my hair out for the last hour. One > more question please. > > Abdul sent me over a PySerial script just before I bought this item. > > In the script there was line line like this: > ser.write("plot;\r\n") > > I have tried ser.write("++ver;\r\n') and many other commands and > carriage returns. > > With ser.read(100) I get > 'Unrecognized command\r\n' > > So at least I have some communication. Could someone help me with the > syntax? > > Thanks in advance-Patrick > > Patrick wrote: >> Thanks to Chuck, Jeff, Christian and John! >> >> I was trying to do a quick test with a live CD in bash but the general >> message I have gotten is to fix the Ubuntu install. Indeed you were >> right and I was wrong. >> >> I tried this command (thanks Jeff) >> >> sudo tail -f /var/log/messages >> >> I found out that I had a conflict with brltty. I don't remember >> installing a brail terminal! >> >> It's funny it only had a conflict with the prologix device and not a >> usb-serial adapter. >> >> Anyhow I am trying to communicate with the device with PySerial now. I >> am getting error messages back when I read but at least that's something. >> >> Thanks again to all. >> >> -Patrick