diff options
Diffstat (limited to 'qolab/hardware/multimeter')
-rw-r--r-- | qolab/hardware/multimeter/bk_5491.py | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/qolab/hardware/multimeter/bk_5491.py b/qolab/hardware/multimeter/bk_5491.py index 6069efb..e9773cc 100644 --- a/qolab/hardware/multimeter/bk_5491.py +++ b/qolab/hardware/multimeter/bk_5491.py @@ -33,7 +33,7 @@ class BK_5491(Multimeter): self.query_binary_values = self.resource.query_binary_values self.switchTime = 0.5 # switch time in seconds for Function/Measurement change - self.deviceProperties.update({}) + self.deviceProperties.update({'Function'}) def isPrompt(self, string): if string[1] == '>': @@ -147,6 +147,50 @@ class BK_5491(Multimeter): def toLocal(self): self.sendCmd('K13', expect_reply=False) + def getFunction(self): + reply = self.query('R0') + """ + According to the manual: + The reply is in 10 digits in the form <h1><h2><g1><g2><v><x><f1><r1><f2><r2> + the <f1> and <f2> correspond to measurement/function of the 1st and 2nd display. + Looks like it some sort of a lie, since in our BK_5491A with firmware v1.23,3 + we get back either 11 digits (if both displays are on) or 9 if only 1st display + is on. + We are concerned with 1st (primary) display + """ + if len(reply) == 9: + f1 = reply[7] + elif len(reply) == 11: + f1 = reply[7] + else: + return "Unknown" + print(f1) + if f1 == "0": + return "Vdc" + elif f1 == "1": + return "Vac" + elif f1 == "2": + return "Resistance" + elif f1 == "3": + return "Resistance4Wires" + elif f1 == "4": + return "Adc" + elif f1 == "5": + return "Aac" + elif f1 == "6": + return "Diode" + elif f1 == "7": + return "Frequency" + elif f1 == "8": + return "V(ac+dc)" + elif f1 == "9": + return "A(ac+dc)" + elif f1 == "A": + return "Continuity" + else: + return "Unknown" + + if __name__ == '__main__': import pyvisa |