Question

I have an issue with one of my GPIB instruments. It is quite an old one, and it is stated as IEEE-488-1978. I have been trying to get the reference manual for that version of IEEE-488, but it has not been successful.

The issue regards the fact that in order to read the Status Register of the instrument it requires a Serial Polling Function (as its reference manual says). I do not know how can I do so in Python using PyVISA.

For example, what I am using to read from the device is _instrument.ask("RV")_, where _RV_ means _Read Version_. Also, for writing a parameter like temperature, I do _instrument.write("ST20.00")_, where _ST20.00_ means _Set Temperature to 20.00 Celcius_.

I have been trying to find an ASCII command to send to the instrument with the _ask_ Python/VISA command and get in return the _Status Register Byte_, but there seems to be nothing feasible.

If anybody has a suggestion, regarding how to pass a serial polling function with Python/VISA, that could solve my issue.

Was it helpful?

Solution

In 1975 the IEEE created the IEEE-488-1975 standard, describing a digital communication bus, sometimes refered to as GPIB. It was revised in 1978. It described the hardware interface, but not the format of the commands and the data. In 1987 they introduced the IEEE-488.2-1987 standard describing Standard Codes, Formats, Protocols, and Common Commands.

Now back to your problem.

pyvisas visa.GpibInstrument class has a property called stb which you can use to access the status byte. From the source:

@property
def stb(self):
    """Service request status register."""

    return vpp43.read_stb(self.vi)

So you can simply do

instrument = visa.instrument('GPIB::01')  # Assuming a GPIB device on channel 1
print instrument.stb  # Print status register

If your device conforms to IEEE-488.2, you have one more option. You can send the common command *STB?

instrument = visa.instrument('GPIB::01')  # Assuming a GPIB device on channel 1
print instrument.ask('*STB?')  # Print status register
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top