Re: how to program wait_for_srq with linux-gpib in Python
Vince Vielhaber <[email protected]>
| Newsgroups | gmane.linux.hardware.gpib.general |
|---|---|
| Message-ID | <[email protected]> |
Interactive. I never tried from a file.
I looked at the source of the python library and the error makes no
sense with the arguments given.
Vince.
On 09/14/2017 12:13 PM, J. Sommersberg wrote:
> 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 :
>
> importsys
> sys.path.append('/usr/local/lib64/python2.7/site-packages')
> importgpib
>
> board = 0
> device = 7
> SRQI = (1<<12)
> TIMO = (1<<14)
>
> printgpib.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
> whilei <= 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
> printgpib.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
>
--
Michigan VHF Corp. http://www.nobucks.net/ http://www.CDupe.com/
http://www.metalworkingfun.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot