From 2040a9771b763eddd7f2748e3b4b9c519176a267 Mon Sep 17 00:00:00 2001 From: Dan White Date: Wed, 11 Jul 2012 22:12:09 -0500 Subject: [PATCH] WIP --- python-lib/calibrate.py | 12 +++++++++++- python-lib/usbio.py | 11 ++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/python-lib/calibrate.py b/python-lib/calibrate.py index 7e49ff5..2158b53 100644 --- a/python-lib/calibrate.py +++ b/python-lib/calibrate.py @@ -12,7 +12,7 @@ adc.channelGain(4, 1) adc.channelGain(5, 1) adc.mux(4) -mux.otaA.mode = mux.otaA.CAL_CMP +mux.otaA.mode = mux.otaA.CAL_BUF mux.otaB.mode = mux.otaB.CAL_CMP mux.write() @@ -29,5 +29,15 @@ def mux_a_offset(x): print offset2signed(adc.read(), 16) sleep(0.1) +def mux_b_offset(x): + mux.otaB.offset = x + mux.write() + for i in range(10): + print offset2signed(adc.read(), 16) + sleep(0.1) + +print 'Calibrating mux otaA' +bisect(mux_a_offset, [-128, 127]) +print 'Calibrating mux otaB' bisect(mux_a_offset, [-128, 127]) diff --git a/python-lib/usbio.py b/python-lib/usbio.py index 98517ee..96f9b86 100644 --- a/python-lib/usbio.py +++ b/python-lib/usbio.py @@ -867,9 +867,10 @@ class DAC8568(object): def send(self): self.bus.SetCS('dac') - self.bus.Start() - self.bus.Write(str(self)) - self.bus.Stop() + #self.bus.Start() + #self.bus.Write(str(self)) + #self.bus.Stop() + self.bus.Exchange(str(self)) # # internal functions to help construct a command @@ -1082,9 +1083,9 @@ class ADS8201(object): # TODO: also optionally read 4 TAG bits w = intbv(0x0000)[16:] self.bus.SetCS('adc') - self.bus.Start() + #self.bus.Start() rval = self.bus.Exchange(int2str(w, 16)) - self.bus.Stop() + #self.bus.Stop() i = 8 * (len(rval)-1) r = 0 for c in rval: -- 2.25.1