HP 3497A GPIB Python programming [solved] - Page 1
Forum section: electronics / testgear

author: davorin
author_rank: Unknown
timestamp: January 15, 2015, 01:59:14 pm
content: HelloI have a small problem when I either try to control my HP 3497A on Linux via Python and linux-gpib or directly with the "ibterm" terminal...It doesn't accept a command until the next one is entered, so I suspect something wrong with the EOS settings...but haven't figured out yet what it is exactly...Currently I have in my gpib.conf:Code:interface {minor = 1board_type = "agilent_82357a"name = "agilent2"pad = 0sad = 0timeout = T3seos = 0x0aset-bin = noset-eot = yes/* Assert EOI with last byte on writes */master = yes}device {minor = 1name = "3497A"pad = 9sad = 0eos = 0x0aset-xeos = yes}But if I enter in "ibterm":Code:ibterm>DO2,0\rThen the command is immediately accepted but with an error beep (o;Any ideas which settings is wrong/missing?thanks in advancerichard

author: davorin
author_rank: Unknown
timestamp: January 15, 2015, 02:34:47 pm
content: Hmm...this seems to do it in Python without error beeps, add an extra "\r".Dunno why it beeps in ibterm though...Code:#!/usr/bin/pythonimport Gpiba = Gpib.Gpib('3497A')a.write('DO2,0\r')gpib.config:Code:device {minor = 1name = "3497A"pad = 9sad = 0eos = 0x0a}

author: MarkL
author_rank: Unknown
timestamp: January 15, 2015, 03:53:43 pm
content: You didn't include the command line you're using for ibterm, but you might need to set -x1.If you look at the source for ibterm, it uses ibdev() and passes it's own values for timeout, send_eoi, and eos flags. ibdev() probably overrides those even if they're set in the gpib.conf interface{} entries.Plus, ibdev() doesn't even look at the device{} entries, so anything set in those sections is definitely ignored by ibterm. It would have been better if they used ibfind(), which does look at the device{} entries.

author: davorin
author_rank: Unknown
timestamp: January 15, 2015, 03:58:15 pm
content: Yes I know this...tried with several settings for ibterm, mainly same ones as we discussed together my HP 5335A problem (o;What matters that it works in Python now....and if I still need to set something manually on the HP 3497A, I just did a wrapper Python script to send command:Code:#!/usr/bin/pythonimport Gpibimport syscommand = sys.argva = Gpib.Gpib('3497A')a.write(command + '\r')So I can do a simple:Code:./3497a.py AO4,0,5000What's missing now is the 44421A card now. Ah yes...and my logic analyzer from France to trace down the GPIB problems (o;

author: MarkL
author_rank: Unknown
timestamp: January 15, 2015, 04:23:21 pm
content: Yes, it's really convenient to be able to send off one-liners to the equipment from the command line. I wrote a similar wrapper thing in perl.I found I needed two modes of commands: One just to send a command, and another to send a command and wait for an answer. It's binary clean so any GPIB script can be written in bash.You're welcome to try it if you don't care it's not written in python. Send me a PM if you're interested.

author: bingo600
author_rank: Super Contributor
timestamp: January 15, 2015, 07:18:36 pm
content: @davorinYou do know you set eos to LF , and sends "extra" CR's to the instrument/Bingo

author: davorin
author_rank: Unknown
timestamp: January 15, 2015, 07:24:41 pm
content: Yes I'm aware of that, but it works error free now (o;Seems this instrument needs this....haven't found anything specific in the manuals though....

author: manuggalan
author_rank: Newbie
timestamp: March 20, 2019, 09:38:37 am
content: Could you help me with more information about this code?Thankyou