Re: how to program wait_for_srq with linux-gpib in Python

"J. Sommersberg" <[email protected]>
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <[email protected]>
my Raspberry Pi 3 is set up again.

It turns out i should not have changed it.
Because the behaviour in the Python interpreter ( in interactive mode ) remains the same!

However if i write the code into a file and have that executed as a python script everything is working as it should!!!

I could not find it out with my first trial because i only used it in interactive mode before.

The following code is working as it should :

import sys
sys.path.append('/usr/local/lib64/python2.7/site-packages')
import gpib

board  = 0
device = 7
SRQI   = (1<<12)
TIMO   = (1<<14)

print gpib.version()            # Show package version
t = gpib.dev(board,device)      # Open the PREMA 6048
gpib.clear(t)                   # Start out clean
gpib.write(t,"MRO4R2T7Q1L0")    # MR - measurement;
                                # O4 - Ohm 4-wire
                                # R2 - Range 2 K-Ohm
                                # T7 - 4 sec integration
                                # Q1 - SRQ after every measurement
                                # L0 - short output format
n = 10
i = 0
while i <= n:
    	gpib.wait(board, TIMO | SRQI) # Wait SRQI or TIMeOut
        sta = gpib.ibsta()            # Get status
        if (sta & TIMO) != 0:
                print "Timed out"
        else:
                i = i+1
                print gpib.read(t,41)        # read result from DMM
gpib.close(t)



It will also work with 

gpib.wait(board, 0x1000 )

or

gpib.wait(board, 4096 )

No surprise, because the linux-gpib PDF says the ibwait() function expects an integer.


In the interactive interpreter however none of these function calls will work!

They all produce an Error :

gpib.GpibError: wait() failed: One or more arguments to the function call were invalid.

>>>print (1<<12)
4096
>>>print (0x1000)
4096

looks like the interpreter is handling these expressions correctly.

For me its not a big problem because it does not make much sense anyway to complicated stuff interactive through the Interpreter.

But i would still consider this as a bug.
And for quick playing around with the gpib library it would be nice to have all functions working ( like it does in a script ).

@Vince
Did you test it in the interactive interpreter?
Or in a script?


Regards

Joerg

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.