From 3f1aeba530eed7b4a5310f829e2214af1c551cb8 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 5 Jan 2022 22:38:28 -0500 Subject: added set point aquisition --- qolab/hardware/i_server/i800.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/qolab/hardware/i_server/i800.py b/qolab/hardware/i_server/i800.py index 7743d84..bc87719 100644 --- a/qolab/hardware/i_server/i800.py +++ b/qolab/hardware/i_server/i800.py @@ -38,10 +38,41 @@ class I800(BasicInstrument): @BasicInstrument.tsdb_append def getTemperature(self): command='X01'; # give decimal representation (X) of the temperature (01 address) + return float(self.query(command)) + + def setPoinStr2value(self, spStr): + raw = int(spStr, 16) + if raw & (1<<23): + sign = -1 + else: + sign = 1 + + if raw & (0b1 << 20): + scale = 1 + elif raw & (0b10 << 20): + scale = 10 + elif raw & (0b11 << 20): + scale = 100 + elif raw & (0b100 << 20): + scale = 100 + else: + print('Error: unknown decimal point position') + return None + + val = raw & 0xFFFFF + return(sign*val/scale) + + @BasicInstrument.tsdb_append + def getSetPoin1(self): + command='R01' reply=self.query(command) - t = float(reply) - return t + return (self.setPoinStr2value(reply)) + @BasicInstrument.tsdb_append + def getSetPoin2(self): + command='R02' + reply=self.query(command) + return (self.setPoinStr2value(reply)) if __name__ == '__main__': tc = I800() -- cgit v1.2.3