diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-02 21:15:41 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-04-02 21:18:40 -0400 |
commit | 181876aaaf6fa2ca087441ed8f8dfeb556f3b843 (patch) | |
tree | 3f76266fa71cd3a07f12096f43f028d8872a4cd3 | |
parent | fa51cdb682d792d39921128481fcd097726ccfca (diff) | |
download | qolab-181876aaaf6fa2ca087441ed8f8dfeb556f3b843.tar.gz qolab-181876aaaf6fa2ca087441ed8f8dfeb556f3b843.zip |
draft ue9qol
-rw-r--r-- | ue9qol.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ue9qol.py b/ue9qol.py new file mode 100644 index 0000000..2250f2b --- /dev/null +++ b/ue9qol.py @@ -0,0 +1,37 @@ +import sys +import traceback +import time # For sleep, clock, time and perf_counter +from datetime import datetime + +import u3 +import u6 +import ue9 + +class UE9qol: + + def __init__(self, debug = False, autoOpen = True, **kargs): + #d = ue9.UE9(ethernet=True, ipAddress="192.168.1.209") # Over TCP/ethernet connect to UE9 with IP address 192.168.1.209 + self.daq = ue9.UE9(debug=debug, autoOpen=autoOpen) + + # For applying the proper calibration to readings. + c=self.daq.getCalibrationData() + + # by evmik + # fixing missing slope for gain '0' + c['AINSlopes']['0']= 0.0000775030 + + def getInputCh(self, chNum): + return self.daq.getAIN(chNum) + + def setOutputCh(self, chNum=None, volts=None): + if chNum == None or volts == None: + print("setOutputCh needs chNum and volts to be set") + return 0 + bits = self.daq.voltageToDACBits(volts, dacNumber = chNum) + # out is completely bogus for DAC settings in UE9 + out=self.daq.singleIO(IOType=5, Channel=chNum, DAC=bits) + return volts + + def close(self): + self.daq.close() + |