Added commands for HP356X devices. Added STA, IS and AS as commands (instead of constants).

Thu, 28 Feb 2008 18:16:52 +0100

author
David Douard <david.douard@logilab.fr>
date
Thu, 28 Feb 2008 18:16:52 +0100
changeset 60
5297b8707096
parent 59
d8bd4a931516
child 61
6ecb0fd8c129

Added commands for HP356X devices. Added STA, IS and AS as commands (instead of constants).

pygpibtoolkit/HP3562A/HP356X.py file | annotate | diff | comparison | revisions
--- a/pygpibtoolkit/HP3562A/HP356X.py	Thu Feb 28 18:15:59 2008 +0100
+++ b/pygpibtoolkit/HP3562A/HP356X.py	Thu Feb 28 18:16:52 2008 +0100
@@ -55,7 +55,8 @@
         byte = byte & 0x8F
         return self._conditions.get(byte, "N/A")
 
-class IS_REGISTER(Constants):
+class IS(Flag):
+    "INTERNAL STATUS - Internal Status Register"
     _constants = [(0x01, "MEASP", "measeurement pause"),
                   (0x02, "ASQP", "Auto sequence pause"),
                   (0X04, "EOM", "End of measurement, capture or throughput"),
@@ -73,8 +74,8 @@
                   (0x4000, "PWRF", "Power-on test failed"),
                   ]
     
-class StatusQuery(Constants):
-    _command = "STA?"
+class STA(Flag):
+    "STATUS QUERY - Status/event query"
     _constants = [(0x01, "N/A", "Not used"),
                   (0x02, "N/A", "Not used"),
                   (0x04, "KEY", "Key pressed"),
@@ -83,24 +84,24 @@
                   (0x20, "ERR", "Error"),
                   (0x40, "RQS", "Request"),
                   (0x80, "MOS", "Message on screen"),
-                  (0x100, "MEASP", "measeurement pause"),
+                  (0x100, "MEASP", "Measurement pause"),
                   (0x200, "ASQP", "Auto sequence pause"),
-                  (0X400, "EOM", "End of measurement, capture or throughput"),
+                  (0x400, "EOM", "End of measurement, capture or throughput"),
                   (0x800, "EOAS", "End of auto sequence"),
                   (0x1000, "SWPR", "Sweep point ready"),
                   (0x2000, "CH1OV", "Channel 1 overrange"),
                   (0x4000, "CH2OV", "Channel 2 overrange"),
                   (0x8000, "MAOV", "Math overflow"),
                   ]
-class ActivityStatysRegister(Constants):
-    _command = "AS?"
+class AS(Flag):
+    "ACTIVITY STATUS - Activity Status Register"
     _constants = [(0x01, "CKFL", "Check fault log"),
                   (0x02, "FITR", "Filling time record"),
                   (0x04, "FLTR", "Filters settings"),
                   (0x08, "CFTP", "Curve fir in progress"),
                   (0x10, "MSSM", "Missed sample"),
                   (0x20, "TMPR", "Timed preview"),
-                  (0x40, "ACDA", "Accept date"),
+                  (0x40, "ACDA", "Accept data"),
                   #...
                   ]
 
@@ -157,6 +158,7 @@
     "START FREQ - Start freq."
 class CF(FrequencyValue):
     "CENTER FREQ - Center freq."
+    _units = "hz","khz","mhz","ord","rmp"
     _condition = lambda device: device.MeasMode in ['LINEAR RES','TIME CAPTUR','SWEPT SINE']
 class ZST(Command):
     "ZERO START - Zero start"
@@ -185,7 +187,7 @@
 # INPUT COUPLING
 class C1AC(EnumValue):
     "CHAN1 AC DC - Channel 1 AC/DC"
-    _values = ["AC", "DC"]
+    _values = ["DC", "AC"]
     
 class Chan1Coupling(Mode):
     "Channel 1 coupling"
@@ -204,6 +206,14 @@
 class LCL(Command):
     "LOCAL - Local"
 
+class C1RG(VoltageValue):
+    "CHAN 1 RANGE - Channel 1 range"
+    _units = "V","mV","Vrms","mVrms","dBV", "EU" 
+
+class C2RG(VoltageValue):
+    "CHAN 2 RANGE - Channel 2 range"
+    _units = "V","mV","Vrms","mVrms","dBV", "EU" 
+
 # MEAS MODE
 class MeasMode(Mode):
     "Measurement mode"
@@ -229,6 +239,12 @@
     CH1 = ModeCommand("Channel 1 active", "CH 1 ACTIVE", condition=lambda device: device.MeasMode in ["LINEAR RES", "LOG RES", "TIME CAPTUR"])
     CH2 = ModeCommand("Channel 2 active", "CH 2 ACTIVE", condition=lambda device: device.MeasMode in ["LINEAR RES", "LOG RES", "TIME CAPTUR"])
 
+class REV(StringValue):
+    _readonly = True
+    "REVISION - Revision"
+
+class SACR(Command):
+    "SACR - Send Auto Carrier"
     
 class HP356XDevice(AbstractGPIBDevice):
     _accepts = ["HP3562A", "HP3563A"]

mercurial