r4814 - in developers/werner/ahrt/host/tmc: . lib
werner at docs.openmoko.org
werner at docs.openmoko.org
Sat Nov 22 04:42:02 CET 2008
Author: werner
Date: 2008-11-22 04:42:01 +0100 (Sat, 22 Nov 2008)
New Revision: 4814
Modified:
developers/werner/ahrt/host/tmc/lib/dxplore.py
developers/werner/ahrt/host/tmc/lib/scope.py
developers/werner/ahrt/host/tmc/setup.py
Log:
Highlights:
- increase delay to improve reliability of communication with DS1000
- some bug fixes
Details:
- setup.py: forgot to install phosphor.py
- lib/scope.py: increase pause after commands from 100ms to 300ms :-(
- lib/scope.py: :HARDCOPY is synonymous to :LCD:DATA? - remove it
- lib/scope.py (rigol_ds1000c): new experimental method "window" to set up the
horizontal system in application-centered terms
- lib/dxplore.py (channel.draw): if a channel contained edits, we cut off the
channel after them
Modified: developers/werner/ahrt/host/tmc/lib/dxplore.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/dxplore.py 2008-11-22 03:28:50 UTC (rev 4813)
+++ developers/werner/ahrt/host/tmc/lib/dxplore.py 2008-11-22 03:42:01 UTC (rev 4814)
@@ -54,7 +54,7 @@
for pos in self.edits:
if pos < self.main.pos0:
- return
+ break
self.main.w.create_rectangle(
self.x(pos)-self.edit_border, self.y(0)+self.edit_border,
self.x(pos+1)+self.edit_border, self.y(1)-self.edit_border,
Modified: developers/werner/ahrt/host/tmc/lib/scope.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/scope.py 2008-11-22 03:28:50 UTC (rev 4813)
+++ developers/werner/ahrt/host/tmc/lib/scope.py 2008-11-22 03:42:01 UTC (rev 4814)
@@ -156,7 +156,7 @@
if self.scope.trigger is not None and self.trigger_get is not None:
return self.trigger_get(self.scope.trigger)
-
+
class horizontal(settable):
state_map = [ "RUN", "STOP", "T'D", "WAIT", "SCAN", "AUTO" ]
@@ -346,7 +346,7 @@
def send(self, s):
scope.send(self, s)
- time.sleep(0.1)
+ time.sleep(0.3)
# --- functions below are for internal use --------------------------------
@@ -378,7 +378,6 @@
return float(self.query(":ACQ:SAMP? CH1"))
def screendump(self):
- self.send(":HARDCOPY")
return rigol_to_ppm(self.query(":LCD:DATA?"))
def wave(self, channels, start = None, end = None, step = None):
@@ -394,3 +393,59 @@
la = self.download_la(start, end, step)
res.append(la[ch])
return res
+
+ # WORK IN PROGRESS. INTERFACE WILL CHANGE !
+
+ # DS1000C/CD only ! E/D will need a different map.
+ #
+ # Note that we don't check if 400MSa/s mode is actually available.
+
+ rate_map = (
+ ( 400e6, 50e-9 ), # 50ns/div -> 400MSa/s
+ ( 200e6, 200e-9 ), # 200ns/div -> 200MSa/s
+ ( 100e6, 200e-6 ), # 200us/div -> 100MSa/s, mind the gap !
+ ( 50e6, 500e-6 ), # 500us/div -> 50MSa/s
+ ( 20e6, 1e-3 ), # 1ms/div -> 20MSa/s
+ ( 10e6, 2e-3 ), # 2ms/div -> 10MSa/s
+ ( 5e6, 5e-3 ), # 5ms/div -> 5MSa/s
+ ( 2e6, 10e-3 ), # 10ms/div -> 2MSa/s
+ ( 1e6, 20e-3 ), # 20ms/div -> 1MSa/s
+ ( 873813.3125, 50e-3 ), # mystery clock divider
+ ( 436906.65625, 100e-3 ), # PLL at 32.768 Hz ?
+ ( 218453.328125, 200e-3 ), # *80/3 yields 873813.3333... Hz
+ ( 87381.335938, 500e-3 ),
+ ( 43690.667969, 1 ),
+ ( 21845.333984, 2 ),
+ ( 8738.133789, 5 ),
+ ( 4369.066895, 10 ),
+ ( 2184.533447, 20 ),
+ ( 873.813354, 50 ),
+ )
+
+ def rate_to_div(self, rate):
+ last = None
+ for e in self.rate_map:
+ if rate > e[0]:
+ break
+ last = e
+ if last is None:
+ raise hell
+ return last[0], last[1]
+
+ def window(self, rate, t0 = None, t1 = None, trigger = 0):
+ real_rate, div = self.rate_to_div(rate)
+ if t0 is not None and t1 is not None:
+ if t0 >= t1:
+ raise hell
+ samples = (t1-t0)*real_rate
+ if samples > 524288: # 512*1024 Sa
+ raise hell
+ self.hor.pos = 0
+ self.hor.scale = div
+ if t0 is None and t1 is None:
+ self.hor.pos = 0
+ else:
+ if t0 is None:
+ t0 = t1-self.samples/real_rate
+ center = (t0+t1)/2.0
+ self.hor.pos = center-trigger
Modified: developers/werner/ahrt/host/tmc/setup.py
===================================================================
--- developers/werner/ahrt/host/tmc/setup.py 2008-11-22 03:28:50 UTC (rev 4813)
+++ developers/werner/ahrt/host/tmc/setup.py 2008-11-22 03:42:01 UTC (rev 4814)
@@ -6,6 +6,7 @@
py_modules = [ "tmc.instrument",
"tmc.wave", "tmc.trigger", "tmc.shape",
"tmc.crc", "tmc.decode", "tmc.dxplore",
+ "tmc.phosphor",
"tmc.meter", "tmc.scope", "tmc.power", "tmc.function" ],
package_dir = { "tmc": "lib" },
ext_modules = [
More information about the commitlog
mailing list