Question

I'm trying to do a IV curve measurement with Keithley and PyVISA. I found a Matlab example on Keithley website, but there's one section that I could not understand.

% Used the serail poll function to wait for SRQ
val = [1];          % 1st instrument in the gpib object, not the gpib add
spoll(obj1,val);    % keep control until SRQ
fprintf(obj1,':TRAC:DATA?')

What exactly does this serial poll function do? And I don't have this spoll function in PyVISA, do I?

Was it helpful?

Solution

Serial polling is usually implemented in higher-level drivers. It is just repeated querying with the SCPI *STB? or the equivalent bus command.

PyVISA's read_stb(vi) calls VISA's viReadSTB(vi). With it you can do your own polling.

EDIT:

read_stb is from PyVISA's low-level module. To use the low-level calls you need to pass the vi field obtained from the instrument object.

There is a good example here but be sure to use the appropriate SCPI commands for your instrument and its status model.

Status polling depends on the status and event registers being set up before the measurements start. You can set up the instrument to indicate that samples are available or that measurement is complete.

If the bus is GPIB (IEEE 488.2) then PyVISA's wait_for_srq function will work because, on GPIB, SRQ is one of the bus signals. The code for that is also shown in the example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top