--- a/pygpibtoolkit/HP8904.py Thu Mar 26 20:56:18 2009 +0100 +++ b/pygpibtoolkit/HP8904.py Mon Mar 30 21:32:14 2009 +0200 @@ -19,7 +19,7 @@ from pygpibtoolkit.pygpib import Constants, Command from pygpibtoolkit.pygpib import Mode, ModeCommand from pygpibtoolkit.pygpib import VoltageValue -from pygpibtoolkit.pygpib import WriteOnlyMode +from pygpibtoolkit.pygpib import SimpleMode from pygpibtoolkit.gpibcontroller import AbstractGPIBDevice, deviceRegister @@ -29,20 +29,20 @@ class APA(_VoltageValue): "CHAN A AMP - Channel A amplitude" class APB(_VoltageValue): - "CHAN A AMP - Channel A amplitude" + "CHAN B AMP - Channel B amplitude" class APC(_VoltageValue): - "CHAN A AMP - Channel A amplitude" + "CHAN C AMP - Channel C amplitude" class APD(_VoltageValue): - "CHAN A AMP - Channel A amplitude" + "CHAN D AMP - Channel D amplitude" -class Backlight(WriteOnlyMode): +class Backlight(SimpleMode): "Backlight" - _init_value = "BO" BF = ModeCommand("Off", "OFF") BO = ModeCommand("On", "ON") -class _PerOutputMode(WriteOnlyMode): + +class _PerOutputMode(SimpleMode): def __init__(self): self._cmds = [] @@ -60,7 +60,7 @@ class Filter1(_PerOutputMode): "Filter for output 1" _prefix = "FS1" - _init_value = "AU" + SH = ModeCommand("Elliptic (sharp cutoff)", "ELIPT.") LO = ModeCommand("Gaussian (low overshoot)", "GAUSS.") AU = ModeCommand("Automatic", "AUTO") @@ -69,6 +69,85 @@ "Filter for output 2" _prefix = "FS2" + +class Float1(_PerOutputMode): + "Float Control for output 1" + _prefix = "FC1" + ON = ModeCommand("On", "ON") + OF = ModeCommand("Off", "OFF") + +class Float2(Float1): + "Float Control for output 2" + _prefix = "FC2" + +class _FrequencyValue(FrequencyValue): + _units = ['HZ','KZ'] + +class FRA(_FrequencyValue): + "CHAN A FRQ - Channel A frequency" +class FRB(_FrequencyValue): + "CHAN B FRQ - Channel B frequency" +class FRC(_FrequencyValue): + "CHAN C FRQ - Channel C frequency" +class FRD(_FrequencyValue): + "CHAN D FRQ - Channel D frequency" + +class OutputControl1(_PerOutputMode): + "Output 1" + _prefix = "OO1" + ON = ModeCommand("On", "ON") + OF = ModeCommand("Off", "OFF") + +class OutputControl2(OutputControl1): + "Output 2" + _prefix = "OO2" + +class _PhaseValue(FloatUnitValue): + _units = ['DG', 'RD'] + _name = "phase" + +class PHA(_PhaseValue): + "CHAN A PHA - Channel A phase" +class PHB(_PhaseValue): + "CHAN B PHA - Channel B phase" +class PHC(_PhaseValue): + "CHAN C PHA - Channel C phase" +class PHD(_PhaseValue): + "CHAN D PHA - Channel D phase" + +class _Waveform(_PerOutputMode): + "waveform" + SI = ModeCommand('Sine', 'SINE') + RA = ModeCommand('Ramp', 'RAMP') + TR = ModeCommand('Triangle', 'TRG') + SQ = ModeCommand('Square', 'SQR') + NS = ModeCommand('Noise', 'NOIS') + DC = ModeCommand('DC', 'DC') + +class WaveformA(_Waveform): + "CHAN A FORM - Channel A waveform" + _prefix = "WFA" +class WaveformB(_Waveform): + "CHAN B FORM - Channel B waveform" + _prefix = "WFB" +class WaveformC(_Waveform): + "CHAN C FORM - Channel C waveform" + _prefix = "WFC" +class WaveformD(_Waveform): + "CHAN D FORM - Channel D waveform" + _prefix = "WFD" + + +class _Destination(_PerOutputMode): + "Destination" + AM = ModeCommand('AM', 'AM') + FM = ModeCommand('FM', 'FM') + PM = ModeCommand('PM', 'PM') + DS = ModeCommand('DS', 'DS') + PU = ModeCommand('PU', 'PU') + OC1 = ModeCommand('OC1', 'OC1') + OC2 = ModeCommand('OC2', 'OC2') + OF = ModeCommand('OF', 'OF') class HP8904Device(AbstractGPIBDevice): _accepts = ["^(?P<model>HP *8904A).*$",]