From e16d1a44da605e9e4a00fd30ad2589a9688d5b15 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 21 Jun 2023 16:52:22 -0400 Subject: added Function reporting for the BK_5491 multimeter --- qolab/hardware/multimeter/bk_5491.py | 46 +++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'qolab/hardware/multimeter/bk_5491.py') 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

+ the and 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 -- cgit v1.2.3