Author Topic: IWATSU SC7203 GPIB, no documentation: what to do?  (Read 215 times)

0 Members and 1 Guest are viewing this topic.

Offline justanothername

  • Contributor
  • Posts: 39
  • Country: at
IWATSU SC7203 GPIB, no documentation: what to do?
« on: March 22, 2020, 10:45:42 pm »
Hi Everyone!
I got an Iwatsu SC-7203 with SC-0111 GPIB option. Unfortunately in the user manual (available from the official website from Iwatsu) there is not documentation about the GPIB commands.
Asides from *IDN? which strangely always answers EEE#O9999999999E+9, I haven't found a way to get anything else out of this instrument.
I tried other Iwatsu commands like those from SC-7207H, but without any luck. Since I'm not that of a specialist with GPIB, I may have missed something essential.
Can anyone help me to get started or does anyone have a command reference for this instrument?
 

Offline justanothername

  • Contributor
  • Posts: 39
  • Country: at
Re: IWATSU SC7203 GPIB, no documentation: what to do?
« Reply #1 on: March 23, 2020, 12:45:39 am »
For all those that have the same Instrument, I got it working, sort of.
I oriented myself with the manual of this old instrument: http://www.iti.iwatsu.co.jp/manual/pdf/voac7510_13-ope-v2-e-t.pdf
I figured out these commands:

C - clear instrument
G0 - get measurement
G1 - get measurement (same as G0?)

modes:
F0 - check on (no turning off with anything but C)
F1 - Freq C
F2 - Freq A
F3 - Period A
F4 - f1/f2 A/B
F5 - f1-> f2 A -> B
F6 - TIME INT A -> B
F7 - MANUAL A

gate:
R0 - EXT GATE B
R3 - 1ms
R4 - 10ms
R5 - 100ms
R6 - 1s
R7 - 10s

I found these out by trying, but don't yet know what they mean:
P0 - set default number format?
P4 - displays H in front of the display and the readout will look like this: F C H  105.5293E+0, I guess this has something to do with programming modes.
P4 - displays E in front of the display and the readout will look like this: F S E  105.3383E+0

« Last Edit: March 23, 2020, 12:54:45 am by justanothername »
 

Offline justanothername

  • Contributor
  • Posts: 39
  • Country: at
Re: IWATSU SC7203 GPIB, no documentation: what to do?
« Reply #2 on: April 18, 2020, 12:14:21 pm »
Here is code in python file i've written to control this instrument using pyvisa:

Code: [Select]
'''
IWATSU COUNTER CODES

C - clear instrument
G0 - get measurement
G1 - get measurement (same as G0?)

modes:
F0 - check on (no turning off with anything but C)
F1 - Freq C
F2 - Freq A
F3 - Period A
F4 - f1/f2 A/B
F5 - f1 - f2 A - B
F6 - TIME INT A -> B
F7 - MANUAL A

gate:
R0 - EXT GATE B
R3 - 1ms
R4 - 10ms
R5 - 100ms
R6 - 1s
R7 - 10s
'''

import pyvisa
import enum





class Measurement:
    def __init__(self):
        self.raw = ""
        self.value = 1.0
        self.overflow = False
        self.unit = ""


# Command, Timeout for Gates(ms)
GATEMODES_LIST = (
    ('R0', 0),
    ('R3', 2),
    ('R4', 13),
    ('R5', 110),
    ('R6', 1010),
    ('R7', 10100),
    )

# Command, Timeout for Gates(ms)
MEASMODES_LIST = (
    'F0',
    'F1',
    'F2',
    'F3',
    'F4',
    'F5',
    'F6',
    'F7',
    )


def get_available_devices():
    rm = pyvisa.ResourceManager()
    devices = rm.list_resources()
    rm.close()
    return devices


def _decode(rawdata):
    measurement = Measurement()
    measurement.raw = rawdata
    measurement.value = float(rawdata[5:18])
    if rawdata[4] == "O":
        measurement.overflow = True
    if rawdata[0:2] == "F ":
        measurement.unit = "HZ"
    elif rawdata[0:2] == "FR":
        measurement.unit = "NONE"
    elif rawdata[0:2] == "FD":
        measurement.unit = "NONE"
    elif rawdata[0:2] == "TI":
        measurement.unit = "SEC"
    elif rawdata[0:2] == "P ":
        measurement.unit = "SEC"
    return measurement


class SC720X(object):

    class GateModes(enum.Enum):
        EXT_GATE_B = 0
        INT_1MS = 1
        INT_10MS = 2
        INT_100MS = 3
        INT_1S = 4
        INT_10S = 5

    class MeasModes(enum.Enum):
        CHECK_ON = 0
        FREQ_C = 1
        FREQ_A = 2
        PERIOD_A = 3
        A_DIV_B = 4
        A_MINUS_B = 5
        A_TO_B = 6
        MANUAL_A = 7

    def __init__(self, address):
        self._address = address
        self._rm = pyvisa.ResourceManager()
        self._inst = self._rm.open_resource(address)
        self.gatemode = self.GateModes.INT_1S
        self.measmode = self.MeasModes.FREQ_C

    def __del__(self):
        self._rm.close()

    def get_measurement(self):
        self._inst.timeout = GATEMODES_LIST[self._gatemode.value][1]
        result = self._inst.query('G0?')
        return _decode(result)

    def clear(self):
        self._inst.write('C')

    @property
    def gatemode(self):
        return self._gatemode

    @gatemode.setter
    def gatemode(self, mode):
        if not isinstance(mode, self.GateModes):
            raise TypeError('mode must be an instance of GateModes Enum')
        self._gatemode = mode
        self.clear()
        self._inst.write(GATEMODES_LIST[self._gatemode.value][0])

    @property
    def measmode(self):
        return self._measmode

    @measmode.setter
    def measmode(self, mode):
        if not isinstance(mode, self.MeasModes):
            raise TypeError('mode must be an instance of GateModes Enum')
        self._measmode = mode
        self.clear()
        self._inst.write(MEASMODES_LIST[self._measmode.value])


if __name__ == '__main__':
    instrument = SC720X("GPIB0::0::0::INSTR")
    instrument.measmode = instrument.MeasModes.FREQ_A
    instrument.gatemode = instrument.GateModes.INT_1S
    meas = instrument.get_measurement()
    print("raw answer: " + meas.raw)
    print("value: " + str(meas.value))
    print("unit: " + meas.unit)
    print("overflow: " + str(meas.overflow))
    del instrument
« Last Edit: April 18, 2020, 12:22:57 pm by justanothername »
 
The following users thanked this post: alm


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf