From 55da0b654f1768d48911db4b79242765bc975a47 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Sun, 10 Jun 2018 16:33:34 -0700 Subject: [PATCH] rigol yea, dj pauly d yea --- tests/gmbitbang/rigol.py | 26 ++++++++++++++++++++++++++ tests/gmbitbang/test.py | 19 +++++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) create mode 100755 tests/gmbitbang/rigol.py diff --git a/tests/gmbitbang/rigol.py b/tests/gmbitbang/rigol.py new file mode 100755 index 00000000000000..f3080c310524d4 --- /dev/null +++ b/tests/gmbitbang/rigol.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +import numpy as np +import visa +import matplotlib.pyplot as plt + +resources = visa.ResourceManager() +print resources.list_resources() + +scope = resources.open_resource('USB0::0x1AB1::0x04CE::DS1ZA184652242::INSTR', timeout=2000, chunk_size=1024000) +print(scope.query('*IDN?').strip()) + +#voltscale = scope.ask_for_values(':CHAN1:SCAL?')[0] +#voltoffset = scope.ask_for_values(":CHAN1:OFFS?")[0] + +#scope.write(":STOP") +scope.write(":WAV:POIN:MODE RAW") +scope.write(":WAV:DATA? CHAN1")[10:] +rawdata = scope.read_raw() +data = np.frombuffer(rawdata, 'B') +print data.shape +plt.plot(data) +plt.show() +#data = (data - 130.0 - voltoffset/voltscale*25) / 25 * voltscale + +print data + diff --git a/tests/gmbitbang/test.py b/tests/gmbitbang/test.py index 76ef3712b766c2..60c35ad2ba70c6 100755 --- a/tests/gmbitbang/test.py +++ b/tests/gmbitbang/test.py @@ -17,16 +17,11 @@ p2.set_gmlan(bus=2) # send w bitbang then without -p1.set_gmlan(bus=None) -p1.can_send(20, "\x01", bus=3) -p1.set_gmlan(bus=2) -p1.can_send(20, "\x01", bus=3) -#time.sleep(0.1) -#p1.set_gmlan(bus=None) -#p1.can_send(20, "\x01", bus=3) - -# test echo -# (to send on GMLAN, set bus=3) -time.sleep(0.1) -print p2.can_recv() +while 1: + p1.set_gmlan(bus=None) + p1.can_send(20, "\x01", bus=3) + p1.set_gmlan(bus=2) + p1.can_send(20, "\x01", bus=3) + time.sleep(0.01) + print p2.can_recv()